From owner-svn-src-head@FreeBSD.ORG Fri May 22 10:44:32 2015 Return-Path: Delivered-To: svn-src-head@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 1CCA5E4B; Fri, 22 May 2015 10:44:32 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id BD1EF11D9; Fri, 22 May 2015 10:44:30 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id NAA19156; Fri, 22 May 2015 13:44:29 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1YvkRI-000Fi2-UA; Fri, 22 May 2015 13:44:28 +0300 Message-ID: <555F0855.4030805@FreeBSD.org> Date: Fri, 22 May 2015 13:43:33 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Konstantin Belousov , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r283109 - head/sys/x86/x86 References: <201505191421.t4JEL1vd075036@svn.freebsd.org> In-Reply-To: <201505191421.t4JEL1vd075036@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2015 10:44:32 -0000 On 19/05/2015 17:21, Konstantin Belousov wrote: > Author: kib > Date: Tue May 19 14:21:00 2015 > New Revision: 283109 > URL: https://svnweb.freebsd.org/changeset/base/283109 > > Log: > When sleeping in Sx state using MWAIT instruction, accept fast wakeup > requests from writes to the monitored line. > > Submitted by: avg Thanks! > Modified: > head/sys/x86/x86/cpu_machdep.c > > Modified: head/sys/x86/x86/cpu_machdep.c > ============================================================================== > --- head/sys/x86/x86/cpu_machdep.c Tue May 19 14:05:15 2015 (r283108) > +++ head/sys/x86/x86/cpu_machdep.c Tue May 19 14:21:00 2015 (r283109) > @@ -101,6 +101,10 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#define STATE_RUNNING 0x0 > +#define STATE_MWAIT 0x1 > +#define STATE_SLEEPING 0x2 > + > /* > * Machine dependent boot() routine > * > @@ -134,13 +138,24 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint) > { > int *state; > > - state = (int *)PCPU_PTR(monitorbuf); > /* > * XXXKIB. Software coordination mode should be supported, > * but all Intel CPUs provide hardware coordination. > */ > + > + state = (int *)PCPU_PTR(monitorbuf); > + KASSERT(*state == STATE_SLEEPING, > + ("cpu_mwait_cx: wrong monitorbuf state")); > + *state = STATE_MWAIT; > cpu_monitor(state, 0, 0); > - cpu_mwait(MWAIT_INTRBREAK, mwait_hint); > + if (*state == STATE_MWAIT) > + cpu_mwait(MWAIT_INTRBREAK, mwait_hint); > + > + /* > + * We should exit on any event that interrupts mwait, because > + * that event might be a wanted interrupt. > + */ > + *state = STATE_RUNNING; > } > > /* Get current clock frequency for the given cpu id. */ > @@ -231,10 +246,6 @@ static int idle_mwait = 1; /* Use MONIT > SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RWTUN, &idle_mwait, > 0, "Use MONITOR/MWAIT for short idle"); > > -#define STATE_RUNNING 0x0 > -#define STATE_MWAIT 0x1 > -#define STATE_SLEEPING 0x2 > - > #ifndef PC98 > static void > cpu_idle_acpi(sbintime_t sbt) > -- Andriy Gapon