From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D550C433EF for ; Thu, 16 Sep 2021 15:10:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C678861216 for ; Thu, 16 Sep 2021 15:10:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C678861216 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:52296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQt26-0008PF-1u for qemu-devel@archiver.kernel.org; Thu, 16 Sep 2021 11:10:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQsuU-0007Zj-IO; Thu, 16 Sep 2021 11:02:46 -0400 Received: from mail.csgraf.de ([85.25.223.15]:51254 helo=zulu616.server4you.de) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQsuS-00044G-3S; Thu, 16 Sep 2021 11:02:46 -0400 Received: from MacBook-Air.alex.local (dynamic-077-009-016-098.77.9.pool.telefonica.de [77.9.16.98]) by csgraf.de (Postfix) with ESMTPSA id A91D36080098; Thu, 16 Sep 2021 17:02:40 +0200 (CEST) Subject: Re: [PATCH v11 05/10] arm/hvf: Add a WFI handler To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , QEMU Developers , Peter Collingbourne References: <20210915181049.27597-1-agraf@csgraf.de> <20210915181049.27597-6-agraf@csgraf.de> <8d255a90-7d7c-fcb6-2d9f-8febe182c286@amsat.org> From: Alexander Graf Message-ID: <2de02003-8355-8022-835d-5fcdf2dddbff@csgraf.de> Date: Thu, 16 Sep 2021 17:02:39 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <8d255a90-7d7c-fcb6-2d9f-8febe182c286@amsat.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=85.25.223.15; envelope-from=agraf@csgraf.de; helo=zulu616.server4you.de X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-1.488, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Sergio Lopez , Richard Henderson , Cameron Esfahani , Roman Bolshakov , qemu-arm , Frank Yang , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 16.09.21 06:49, Philippe Mathieu-Daudé wrote: > On 9/15/21 8:10 PM, Alexander Graf wrote: >> From: Peter Collingbourne >> >> Sleep on WFI until the VTIMER is due but allow ourselves to be woken >> up on IPI. >> >> In this implementation IPI is blocked on the CPU thread at startup and >> pselect() is used to atomically unblock the signal and begin sleeping. >> The signal is sent unconditionally so there's no need to worry about >> races between actually sleeping and the "we think we're sleeping" >> state. It may lead to an extra wakeup but that's better than missing >> it entirely. >> >> Signed-off-by: Peter Collingbourne >> [agraf: Remove unused 'set' variable, always advance PC on WFX trap, >> support vm stop / continue operations and cntv offsets] >> Signed-off-by: Alexander Graf >> Acked-by: Roman Bolshakov >> Reviewed-by: Sergio Lopez >> >> --- >> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c >> index 8fe008dab5..49f265cc08 100644 >> --- a/target/arm/hvf/hvf.c >> +++ b/target/arm/hvf/hvf.c >> @@ -2,6 +2,7 @@ >> * QEMU Hypervisor.framework support for Apple Silicon >> >> * Copyright 2020 Alexander Graf >> + * Copyright 2020 Google LLC >> * >> * This work is licensed under the terms of the GNU GPL, version 2 or later. >> * See the COPYING file in the top-level directory. >> @@ -490,6 +491,7 @@ int hvf_arch_init_vcpu(CPUState *cpu) >> >> void hvf_kick_vcpu_thread(CPUState *cpu) >> { >> + cpus_kick_thread(cpu); > Doesn't this belong to the previous patch? Until this patch, we're never running outside guest context on the vCPU thread, so hv_vcpus_exit() is enough to kick us out :). Thanks a lot for the review! Alex