From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlEp4-0000YW-OU for qemu-devel@nongnu.org; Thu, 23 Apr 2015 06:57:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlEp1-00046r-HA for qemu-devel@nongnu.org; Thu, 23 Apr 2015 06:57:34 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:34203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlEp1-00046n-CT for qemu-devel@nongnu.org; Thu, 23 Apr 2015 06:57:31 -0400 Received: by iget9 with SMTP id t9so7995567ige.1 for ; Thu, 23 Apr 2015 03:57:30 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1429722561-12651-1-git-send-email-greg.bellows@linaro.org> <1429722561-12651-10-git-send-email-greg.bellows@linaro.org> <20150423024929.GC17116@toto> From: Peter Maydell Date: Thu, 23 Apr 2015 11:57:10 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v2 9/9] target-arm: Add WFx instruction trap support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Edgar E. Iglesias" Cc: Sergey Fedorov , =?UTF-8?B?QWxleCBCZW5uw6ll?= , QEMU Developers , Greg Bellows On 23 April 2015 at 11:39, Edgar E. Iglesias wrote: > > On 23/04/2015 6:00 pm, "Peter Maydell" wrote: >> In theory you could maybe check has_work() for the WFI case, >> since doing an EXCP_HLT really should cause us to stop until >> has_work is true, but it seems a bit fragile -- could we really >> guarantee that nothing would change between this point and >> when we went back through the main loop that would change >> whether has_work evaluates true or not? I think that it's better >> there too to just always take the trap: setting EXCP_HLT is our >> "going into a low power state" and so we should take the trap >> if we would otherwise have done that. > > I think functional wise we are OK. > The implementation can AFAIK always choose to nop for whatever reason (e.g > has_work()). Only when we choose to enter low power, the trap comes into > play. Ah, so in helper_wfi() do something like if (!has_work()) { if (trapping wfi) { EXCP_UDEF code; } else { EXCP_HALT code; } } /* otherwise just return, making this WFI a nop */ ? I think that would work. > Maybe wfe is the most problematic one because it fires more frequently and > often when has_work() is true? Yes, I think we should start by not trapping on WFE and then look at how good/bad perf is. -- PMM