From: Marc Zyngier <maz@kernel.org>
To: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
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 <darren@os.amperecomputing.com>
Subject: Re: [PATCH 0/3] KVM: arm64: nv: Fixes for Nested Virtualization issues
Date: Wed, 11 Jan 2023 13:36:34 +0000 [thread overview]
Message-ID: <f0ef11fad6cef5d0e33238052a77670a@kernel.org> (raw)
In-Reply-To: <b3895df9-8094-5548-1633-0c6a405d1c0c@os.amperecomputing.com>
On 2023-01-11 12:46, Ganapatrao Kulkarni wrote:
> On 11-01-2023 05:09 pm, Marc Zyngier wrote:
>> On 2023-01-11 08:46, Ganapatrao Kulkarni wrote:
>>> On 11-01-2023 03:24 am, Marc Zyngier wrote:
>>>> On Tue, 10 Jan 2023 12:17:20 +0000,
>>>> Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com> 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()) ||
>>>
>>> Thanks Marc for the patch!
>>>
>>> I think, you mean not equal to?
>>> + vcpu != kvm_get_running_vcpu()) ||
>>
>> Yeah, exactly. I woke up this morning realising this patch was
>> *almost* right. Don't write patches like this after a long day
>> at work...
>>
>>> With the change to not-equal, the issue is fixed and I could see the
>>> NestedVM booting is pretty fast with higher number of cores as well.
>>
>> Good, thanks for testing it. I'll roll up an actual patch for that
>> and stick it in the monster queue.
>
> Thanks, Please pull patch 3/3 also to nv-6.2 tree along with this
> patch. I will move my setup to nv-6.2 once these patches are in.
3/3 should already be in the branch, merged with the shadow
S2 fault handling.
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2023-01-11 13:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 6:03 [PATCH 0/3] KVM: arm64: nv: Fixes for Nested Virtualization issues Ganapatrao Kulkarni
2022-08-24 6:03 ` [PATCH 1/3] KVM: arm64: nv: only emulate timers that have not yet fired Ganapatrao Kulkarni
2022-12-29 13:00 ` Marc Zyngier
2023-01-09 12:25 ` Ganapatrao Kulkarni
2023-01-09 13:44 ` Marc Zyngier
2023-01-09 14:03 ` Ganapatrao Kulkarni
2022-08-24 6:03 ` [PATCH 2/3] KVM: arm64: nv: Emulate ISTATUS when emulated timers are fired Ganapatrao Kulkarni
2022-12-29 13:53 ` Marc Zyngier
2023-01-02 11:46 ` Marc Zyngier
2023-01-03 4:21 ` Ganapatrao Kulkarni
2023-01-10 8:41 ` Ganapatrao Kulkarni
2023-01-10 10:46 ` Marc Zyngier
2022-08-24 6:03 ` [PATCH 3/3] KVM: arm64: nv: Avoid block mapping if max_map_size is smaller than block size Ganapatrao Kulkarni
2022-12-29 17:42 ` Marc Zyngier
2023-01-03 4:26 ` Ganapatrao Kulkarni
2023-01-09 13:58 ` Ganapatrao Kulkarni
2022-10-10 5:56 ` [PATCH 0/3] KVM: arm64: nv: Fixes for Nested Virtualization issues Ganapatrao Kulkarni
2022-10-19 7:59 ` Marc Zyngier
2023-01-10 12:17 ` Ganapatrao Kulkarni
2023-01-10 14:05 ` Marc Zyngier
2023-01-10 21:54 ` Marc Zyngier
2023-01-11 7:54 ` Marc Zyngier
2023-01-11 8:46 ` Ganapatrao Kulkarni
2023-01-11 8:48 ` Ganapatrao Kulkarni
2023-01-11 11:39 ` Marc Zyngier
2023-01-11 12:46 ` Ganapatrao Kulkarni
2023-01-11 13:36 ` Marc Zyngier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0ef11fad6cef5d0e33238052a77670a@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=darren@os.amperecomputing.com \
--cc=gankulkarni@os.amperecomputing.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=scott@os.amperecomputing.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).