From owner-svn-src-all@FreeBSD.ORG Mon May 18 11:30:54 2015 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A2CE993; Mon, 18 May 2015 11:30:54 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 4855918CF; Mon, 18 May 2015 11:30:52 +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 OAA07047; Mon, 18 May 2015 14:30:44 +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 1YuJFs-000Bq6-7Y; Mon, 18 May 2015 14:30:44 +0300 Message-ID: <5559CD29.8020106@FreeBSD.org> Date: Mon, 18 May 2015 14:29:45 +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: r282678 - in head: share/man/man4 sys/amd64/acpica sys/amd64/include sys/dev/acpica sys/i386/acpica sys/i386/include sys/x86/include sys/x86/x86 References: <201505091228.t49CSmVv062442@svn.freebsd.org> In-Reply-To: <201505091228.t49CSmVv062442@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Mon, 18 May 2015 11:30:54 -0000 On 09/05/2015 15:28, Konstantin Belousov wrote: > +void > +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. > + */ > + cpu_monitor(state, 0, 0); > + cpu_mwait(MWAIT_INTRBREAK, mwait_hint); > +} > + Kostik, it's been a while since I studied this code, so please pardon me if I am asking something obvious or silly. I wonder why this function does not set 'state' before monitor + mwait. As far as I can see, all other idling functions do that. And cpu_idle_wakeup() compares the state to STATE_MWAIT before changing it. So, I am concerned that if the state happens to be anything other than STATE_MWAIT when acpi_cpu_idle_mwait() is called, then cpu_idle_wakeup() won't wake up the idled CPU. It seems that if the state is not STATE_SLEEPING then an IPI won't be sent either. Actually, that leaves STATE_RUNNING is the only problematic case, but that's probably the state that the CPU would have before idling. -- Andriy Gapon