From owner-svn-src-all@FreeBSD.ORG Sat May 23 22:28:59 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EC776416; Sat, 23 May 2015 22:28:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBA6215E7; Sat, 23 May 2015 22:28:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NMSxQ3032366; Sat, 23 May 2015 22:28:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4NMSxs2032365; Sat, 23 May 2015 22:28:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201505232228.t4NMSxs2032365@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 23 May 2015 22:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283331 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 May 2015 22:29:00 -0000 Author: andrew Date: Sat May 23 22:28:59 2015 New Revision: 283331 URL: https://svnweb.freebsd.org/changeset/base/283331 Log: Use the wait-for-event instruction to put the core we have just enabled to sleep while it waits to start scheduling. The boot core can then use the send-event instruction to wake the cores when they should enter the scheduler. MFC after: 1 week Modified: head/sys/arm/arm/mp_machdep.c Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Sat May 23 21:58:41 2015 (r283330) +++ head/sys/arm/arm/mp_machdep.c Sat May 23 22:28:59 2015 (r283331) @@ -185,8 +185,11 @@ init_secondary(int cpu) atomic_add_rel_32(&mp_naps, 1); /* Spin until the BSP releases the APs */ - while (!aps_ready) - ; + while (!atomic_load_acq_int(&aps_ready)) { +#if __ARM_ARCH >= 7 + __asm __volatile("wfe"); +#endif + } /* Initialize curthread */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); @@ -353,6 +356,10 @@ release_aps(void *dummy __unused) arm_unmask_irq(i); } atomic_store_rel_int(&aps_ready, 1); + /* Wake the other threads up */ +#if __ARM_ARCH >= 7 + armv7_sev(); +#endif printf("Release APs\n");