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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B4D5C54EBC for ; Tue, 10 Jan 2023 21:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4RM0Jv0v0qqrnyPVt+bqDi/5KyB3jNO5VU7KQSL8RHM=; b=vWzG4/i1PUJ+Wr REeiqK/uR0mYhMF34Y5hr+ezJmVzZoeoS/RSRzWrXrftOPa5LY5LxChk54e6/Jt85wcqhCFGhTPYB q1rJvluxWd8ubld8QszULFAEEW69PRmb6xa0oAOnw1r0s1bzFEJ/J+AZRH6P0EIcfuzCVHPXVZO1V e5ZDicc0YT+SDOc49vcl5m8QNQHdizSEE6Bz72w6NWKxXq5LmM3MvylalBrKa6kTaGOlHMtJAbUup nSiVAgAA7/S3FaqThIFUM8XU5+LXxeSZeBBAZ+gkbvAmsp5If/B6RxO54yXq0pEQCvBHg+B3+lclU IJGJeEPic0/IVFQxQuKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFMb5-008gzq-6r; Tue, 10 Jan 2023 21:55:55 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFMb1-008gz6-Lp for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2023 21:55:54 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EBC6DB819AB; Tue, 10 Jan 2023 21:55:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FB96C433D2; Tue, 10 Jan 2023 21:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673387748; bh=sFugDj6Iq2B5+3uwAQWP4qGymuLbH8bh5FbmajTo6ZU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ueLMRqY1e49MT71yDO1fHXjdfzxao1JqlzzqnmhaHqrS7XlWK5FMGTvrbzclrGzFJ 1vQjV9fRt4mOXOzPVNipeBK7XYUz5OKQ1HFQ7hFIhwnGe3uFesTIZDAjhG6Cq0PqRA ZsfGUfwZ9BYaV7SPs47lDzur/vx45eEhsPTz64k7rWtGuMwWMD42Tn5DtDppZsmIyh yNsbd9AbDxYRwFSLqZ9TNtR704mQMawNYsNA0TYrZnnxi2M03FmMWLgWDlAJKRWscA xMQ2ktod2YLyq8Qox3UGvmT6Hs+faQoc7azeHVdjvDER1FDuq2sGI60f0srzfc+geE cWmEWeSerSzow== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pFMaw-000htF-Ar; Tue, 10 Jan 2023 21:55:46 +0000 Date: Tue, 10 Jan 2023 21:54:39 +0000 Message-ID: <87o7r6dpi8.wl-maz@kernel.org> From: Marc Zyngier To: Ganapatrao Kulkarni Cc: catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, scott@os.amperecomputing.com, Darren Hart Subject: Re: [PATCH 0/3] KVM: arm64: nv: Fixes for Nested Virtualization issues In-Reply-To: <6171dc7c-5d83-d378-db9e-d94f27afe43a@os.amperecomputing.com> References: <20220824060304.21128-1-gankulkarni@os.amperecomputing.com> <6171dc7c-5d83-d378-db9e-d94f27afe43a@os.amperecomputing.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") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: gankulkarni@os.amperecomputing.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, scott@os.amperecomputing.com, darren@os.amperecomputing.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_135552_024203_F660162C X-CRM114-Status: GOOD ( 22.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 10 Jan 2023 12:17:20 +0000, Ganapatrao Kulkarni wrote: > > I am currently working around this with "nohlt" kernel param to > NestedVM. Any suggestions to handle/fix this case/issue and avoid the > slowness of booting of NestedVM with more cores? > > Note: Guest-Hypervisor and NestedVM are using default kernel installed > using Fedora 36 iso. Despite what I said earlier, I have a vague idea here, thanks to the interesting call traces that you provided (this is really awesome work BTW, given how hard it is to trace things across 3 different kernels). We can slightly limit the impact of the prepare/finish sequence if the guest hypervisor only accesses the active registers for SGIs/PPIs on the vcpu that owns them, forbidding any cross-CPU-to-redistributor access. Something along these lines, which is only boot-tested. Let me know how this fares for you. Thanks, M. diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c index b32d434c1d4a..1cca45be5335 100644 --- a/arch/arm64/kvm/vgic/vgic-mmio.c +++ b/arch/arm64/kvm/vgic/vgic-mmio.c @@ -473,9 +473,10 @@ int vgic_uaccess_write_cpending(struct kvm_vcpu *vcpu, * active state can be overwritten when the VCPU's state is synced coming back * from the guest. * - * For shared interrupts as well as GICv3 private interrupts, we have to - * stop all the VCPUs because interrupts can be migrated while we don't hold - * the IRQ locks and we don't want to be chasing moving targets. + * For shared interrupts as well as GICv3 private interrupts accessed from the + * non-owning CPU, we have to stop all the VCPUs because interrupts can be + * migrated while we don't hold the IRQ locks and we don't want to be chasing + * moving targets. * * For GICv2 private interrupts we don't have to do anything because * userspace accesses to the VGIC state already require all VCPUs to be @@ -484,7 +485,8 @@ int vgic_uaccess_write_cpending(struct kvm_vcpu *vcpu, */ static void vgic_access_active_prepare(struct kvm_vcpu *vcpu, u32 intid) { - if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 || + if ((vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 && + vcpu == kvm_get_running_vcpu()) || intid >= VGIC_NR_PRIVATE_IRQS) kvm_arm_halt_guest(vcpu->kvm); } @@ -492,7 +494,8 @@ static void vgic_access_active_prepare(struct kvm_vcpu *vcpu, u32 intid) /* See vgic_access_active_prepare */ static void vgic_access_active_finish(struct kvm_vcpu *vcpu, u32 intid) { - if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 || + if ((vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 && + vcpu == kvm_get_running_vcpu()) || intid >= VGIC_NR_PRIVATE_IRQS) kvm_arm_resume_guest(vcpu->kvm); } -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel