Re: [PATCH kvm-unit-tests] SVM: move guest past HLT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 23, 2020 at 01:06:53PM -0400, Paolo Bonzini wrote:
> On AMD, the guest is not woken up from HLT by the interrupt or NMI vmexits.
> Therefore we have to fix up the RIP manually.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
>  x86/svm_tests.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/x86/svm_tests.c b/x86/svm_tests.c
> index c2725af..1f2975c 100644
> --- a/x86/svm_tests.c
> +++ b/x86/svm_tests.c
> @@ -1316,6 +1316,11 @@ static bool interrupt_finished(struct svm_test *test)
>              return true;
>          }
>  
> +        /* The guest is not woken up from HLT, unlike Intel.  Fix that up.  */

The comment about "unlike Intel" isn't correct, or at least it's not always
correct.  Intercept NMIs/interrupts don't affect vmcs.GUEST_ACTIVITY, i.e.
if the guest was in HLT before the exit then that's what will be recorded
in the VMCS.

https://lkml.kernel.org/r/20190509204838.GC12810@xxxxxxxxxxxxxxx

> +        if (get_test_stage(test) == 3) {
> +            vmcb->save.rip++;
> +        }
> +
>          irq_enable();
>          asm volatile ("nop");
>          irq_disable();
> @@ -1501,6 +1506,9 @@ static bool nmi_hlt_finished(struct svm_test *test)
>              return true;
>          }
>  
> +        /* The guest is not woken up from HLT, unlike Intel.  Fix that up.  */
> +        vmcb->save.rip++;
> +
>          report(true, "NMI intercept while running guest");
>          break;
>  
> -- 
> 2.18.2
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux