* [PATCH] KVM: arm64: Fixes ARM VM hangs at boot
@ 2020-09-30 22:12 Thomas Tai
2020-10-01 8:30 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Tai @ 2020-09-30 22:12 UTC (permalink / raw)
To: maz, james.morse, julien.thierry.kdev, suzuki.poulose,
linux-arm-kernel, kvmarm
Cc: thomas.tai
When using the latest kernel v5.9-rc7 on an ARM server, VMs could
hang at boot with no output. The commit a0e50aa3f4a8 removed
asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT)),
it looks like isb is still needed for non
ARM64_WORKAROUND_SPECULATIVE_AT host when switching to guest.
The code fragment for the original patch:
- /* __load_guest_stage2() includes an ISB for the workaround. */
- __load_guest_stage2(kvm);
- asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
+ __load_guest_stage2(mmu);
The code should have been:
- /* __load_guest_stage2() includes an ISB for the workaround. */
- __load_guest_stage2(kvm);
- asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
+ __load_guest_stage2(mmu);
+ asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
ie, the workaround is still needed.
Fixes: a0e50aa3f4a8 ("KVM: arm64: Factor out stage 2 page table data from
struct kvm")
Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
---
arch/arm64/kvm/hyp/nvhe/tlb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c b/arch/arm64/kvm/hyp/nvhe/tlb.c
index 69eae60..536496e 100644
--- a/arch/arm64/kvm/hyp/nvhe/tlb.c
+++ b/arch/arm64/kvm/hyp/nvhe/tlb.c
@@ -32,6 +32,7 @@ static void __tlb_switch_to_guest(struct kvm_s2_mmu *mmu,
}
__load_guest_stage2(mmu);
+ asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
}
static void __tlb_switch_to_host(struct tlb_inv_context *cxt)
--
1.8.3.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: arm64: Fixes ARM VM hangs at boot
2020-09-30 22:12 [PATCH] KVM: arm64: Fixes ARM VM hangs at boot Thomas Tai
@ 2020-10-01 8:30 ` Marc Zyngier
2020-10-01 12:59 ` Thomas Tai
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2020-10-01 8:30 UTC (permalink / raw)
To: Thomas Tai
Cc: kvmarm, james.morse, linux-arm-kernel, julien.thierry.kdev,
suzuki.poulose
Hi Thomas,
On 2020-09-30 23:12, Thomas Tai wrote:
> When using the latest kernel v5.9-rc7 on an ARM server, VMs could
> hang at boot with no output. The commit a0e50aa3f4a8 removed
> asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT)),
> it looks like isb is still needed for non
> ARM64_WORKAROUND_SPECULATIVE_AT host when switching to guest.
Is that on an eMAG system, by any chance?
>
> The code fragment for the original patch:
> - /* __load_guest_stage2() includes an ISB for the workaround. */
> - __load_guest_stage2(kvm);
> - asm(ALTERNATIVE("isb", "nop",
> ARM64_WORKAROUND_SPECULATIVE_AT));
> + __load_guest_stage2(mmu);
>
> The code should have been:
> - /* __load_guest_stage2() includes an ISB for the workaround. */
> - __load_guest_stage2(kvm);
> - asm(ALTERNATIVE("isb", "nop",
> ARM64_WORKAROUND_SPECULATIVE_AT));
> + __load_guest_stage2(mmu);
> + asm(ALTERNATIVE("isb", "nop",
> ARM64_WORKAROUND_SPECULATIVE_AT));
> ie, the workaround is still needed.
>
> Fixes: a0e50aa3f4a8 ("KVM: arm64: Factor out stage 2 page table data
> from
> struct kvm")
>
> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
> ---
> arch/arm64/kvm/hyp/nvhe/tlb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c
> b/arch/arm64/kvm/hyp/nvhe/tlb.c
> index 69eae60..536496e 100644
> --- a/arch/arm64/kvm/hyp/nvhe/tlb.c
> +++ b/arch/arm64/kvm/hyp/nvhe/tlb.c
> @@ -32,6 +32,7 @@ static void __tlb_switch_to_guest(struct kvm_s2_mmu
> *mmu,
> }
>
> __load_guest_stage2(mmu);
> + asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
> }
>
> static void __tlb_switch_to_host(struct tlb_inv_context *cxt)
Ouch. I remember fixing this a while ago, but somehow dropped it
after applying it and *not* merging it...
Thanks a lot for the heads up!
M.
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=kvm-arm64/pre-nv-5.9
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: arm64: Fixes ARM VM hangs at boot
2020-10-01 8:30 ` Marc Zyngier
@ 2020-10-01 12:59 ` Thomas Tai
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Tai @ 2020-10-01 12:59 UTC (permalink / raw)
To: Marc Zyngier
Cc: kvmarm, james.morse, linux-arm-kernel, julien.thierry.kdev,
suzuki.poulose
On 2020-10-01 4:30 a.m., Marc Zyngier wrote:
> Hi Thomas,
>
> On 2020-09-30 23:12, Thomas Tai wrote:
>> When using the latest kernel v5.9-rc7 on an ARM server, VMs could
>> hang at boot with no output. The commit a0e50aa3f4a8 removed
>> asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT)),
>> it looks like isb is still needed for non
>> ARM64_WORKAROUND_SPECULATIVE_AT host when switching to guest.
>
> Is that on an eMAG system, by any chance?
Hi Marc,
Yes, it is indeed an eMAG system.
>
>>
>> The code fragment for the original patch:
>> - /* __load_guest_stage2() includes an ISB for the workaround. */
>> - __load_guest_stage2(kvm);
>> - asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
>> + __load_guest_stage2(mmu);
>>
>> The code should have been:
>> - /* __load_guest_stage2() includes an ISB for the workaround. */
>> - __load_guest_stage2(kvm);
>> - asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
>> + __load_guest_stage2(mmu);
>> + asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
>> ie, the workaround is still needed.
>>
>> Fixes: a0e50aa3f4a8 ("KVM: arm64: Factor out stage 2 page table data from
>> struct kvm")
>>
>> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
>> ---
>> arch/arm64/kvm/hyp/nvhe/tlb.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c
>> b/arch/arm64/kvm/hyp/nvhe/tlb.c
>> index 69eae60..536496e 100644
>> --- a/arch/arm64/kvm/hyp/nvhe/tlb.c
>> +++ b/arch/arm64/kvm/hyp/nvhe/tlb.c
>> @@ -32,6 +32,7 @@ static void __tlb_switch_to_guest(struct kvm_s2_mmu
>> *mmu,
>> }
>>
>> __load_guest_stage2(mmu);
>> + asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
>> }
>>
>> static void __tlb_switch_to_host(struct tlb_inv_context *cxt)
>
> Ouch. I remember fixing this a while ago, but somehow dropped it
> after applying it and *not* merging it...
>
> Thanks a lot for the heads up!
>
> M.
>
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=kvm-arm64/pre-nv-5.9
Good to know you have the fix.
Thank you,
Thomas
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-01 13:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 22:12 [PATCH] KVM: arm64: Fixes ARM VM hangs at boot Thomas Tai
2020-10-01 8:30 ` Marc Zyngier
2020-10-01 12:59 ` Thomas Tai
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).