Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1695616pxb; Tue, 26 Oct 2021 14:04:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgCfhieyNqIhJBHqJ5xTW4brTR9dHIwDYVjN/fUwzfLia77YKlt5WCosAo3vqYRWwmwYnt X-Received: by 2002:a63:3585:: with SMTP id c127mr2503335pga.431.1635282267112; Tue, 26 Oct 2021 14:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635282267; cv=none; d=google.com; s=arc-20160816; b=zTzmUPw642xV3z4bplsmdXWtDCb8aN57GmzE/p1ZyhjKtm6uifwZ7PsDTxOdSimzmV S4Ta3KfhadvLjs/TrK1oyxhojhLdmlqdzFuwmdGQsjwwcLPBAcPYf1NXkgEtHGTpirHh LGTVsVqjHSrah3CFYRJdbLh7k4PBcNVOjkMsRnTKdOe50ZBPXYKm81bibUr0s0ScbOtI 5J4mLuIDeus4Kf7ZHPMGxjgT3Vz8BbegCNtQjF5jyZg+CRhnReD0/4Zf3dyxu4F4d4dE CEB2EwNwkgyaDTivcUeGM9c8PUHquH14T6f2vSgKcRqSdfIUdttNsW+14cv4Cm/9Rzs1 7Urw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=pkW4+vhzULlMcPs+GK2BdfYLr8nKiQCgv2s8BPS6jMc=; b=HfFPGU3Th1DXPrN9jG9ukdca7yxQlXBHwSYgIbJjEBiZIFK+vPt9fR8aD/5U7bflGS P9fr6U84zUTWsMoiRvvAxw4DgL6i0zAlEVbpNHc6xRSMkCzsOy+7IMB3QcUb6rhqBIC9 HmgSG5hg14SybuHwJEw1jxm/Ptlq334LWdH7BsvzD5bs5VQH+T57NutNAJHEWZ9fmoO2 djHo9H0xJU6CVmjRTD0qAHYG6dOPabOFo/qQZXOyA9ma5YbaZgYWZoYqRyUFVxLm4MuT rzsxu7NPyXMm4r3TXGsr23kYLOhW/3KSw18wVWOwBSFkpUxPtehHR6+cSAuH1B1fcFt9 7I4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q20si31169329pls.53.2021.10.26.14.04.12; Tue, 26 Oct 2021 14:04:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237092AbhJZPnk (ORCPT + 99 others); Tue, 26 Oct 2021 11:43:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:47404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237087AbhJZPnc (ORCPT ); Tue, 26 Oct 2021 11:43:32 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9634460EFF; Tue, 26 Oct 2021 15:41:08 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mfOZW-001iWu-7f; Tue, 26 Oct 2021 16:41:06 +0100 Date: Tue, 26 Oct 2021 16:41:05 +0100 Message-ID: <875ytjbxpq.wl-maz@kernel.org> From: Marc Zyngier To: Paolo Bonzini Cc: Sean Christopherson , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang Subject: Re: [PATCH v2 10/43] KVM: arm64: Move vGIC v4 handling for WFI out arch callback hook In-Reply-To: <9236e715-c471-e1c8-6117-6f37b908a6bd@redhat.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-11-seanjc@google.com> <9236e715-c471-e1c8-6117-6f37b908a6bd@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: pbonzini@redhat.com, seanjc@google.com, chenhuacai@kernel.org, aleksandar.qemu.devel@gmail.com, paulus@ozlabs.org, anup.patel@wdc.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, borntraeger@de.ibm.com, frankja@linux.ibm.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, atish.patra@wdc.com, david@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, dmatlack@google.com, oupton@google.com, jingzhangos@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 25 Oct 2021 14:31:48 +0100, Paolo Bonzini wrote: > > On 09/10/21 04:12, Sean Christopherson wrote: > > Move the put and reload of the vGIC out of the block/unblock callbacks > > and into a dedicated WFI helper. Functionally, this is nearly a nop as > > the block hook is called at the very beginning of kvm_vcpu_block(), and > > the only code in kvm_vcpu_block() after the unblock hook is to update the > > halt-polling controls, i.e. can only affect the next WFI. > > > > Back when the arch (un)blocking hooks were added by commits 3217f7c25bca > > ("KVM: Add kvm_arch_vcpu_{un}blocking callbacks) and d35268da6687 > > ("arm/arm64: KVM: arch_timer: Only schedule soft timer on vcpu_block"), > > the hooks were invoked only when KVM was about to "block", i.e. schedule > > out the vCPU. The use case at the time was to schedule a timer in the > > host based on the earliest timer in the guest in order to wake the > > blocking vCPU when the emulated guest timer fired. Commit accb99bcd0ca > > ("KVM: arm/arm64: Simplify bg_timer programming") reworked the timer > > logic to be even more precise, by waiting until the vCPU was actually > > scheduled out, and so move the timer logic from the (un)blocking hooks to > > vcpu_load/put. > > > > In the meantime, the hooks gained usage for enabling vGIC v4 doorbells in > > commit df9ba95993b9 ("KVM: arm/arm64: GICv4: Use the doorbell interrupt > > as an unblocking source"), and added related logic for the VMCR in commit > > 5eeaf10eec39 ("KVM: arm/arm64: Sync ICH_VMCR_EL2 back when about to block"). > > > > Finally, commit 07ab0f8d9a12 ("KVM: Call kvm_arch_vcpu_blocking early > > into the blocking sequence") hoisted the (un)blocking hooks so that they > > wrapped KVM's halt-polling logic in addition to the core "block" logic. > > > > In other words, the original need for arch hooks to take action _only_ > > in the block path is long since gone. > > > > Cc: Oliver Upton > > Cc: Marc Zyngier > > Signed-off-by: Sean Christopherson > > This needs a word on why kvm_psci_vcpu_suspend does not need the > hooks. Or it needs to be changed to also use kvm_vcpu_wfi in the PSCI > code, I don't know. > > Marc, can you review and/or advise? I was looking at that over the weekend, and that's a pre-existing bug. I would have addressed it independently, but it looks like you already have queued the patch. I guess I'll have to revisit this once the whole thing lands somewhere. M. -- Without deviation from the norm, progress is not possible.