All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, wei.huang2@amd.com, cavery@redhat.com
Subject: Re: [PATCH kvm-unit-tests] SVM: move guest past HLT
Date: Thu, 23 Apr 2020 12:46:05 -0700	[thread overview]
Message-ID: <20200423194605.GQ17824@linux.intel.com> (raw)
In-Reply-To: <20200423170653.191992-1-pbonzini@redhat.com>

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@redhat.com>
> ---
>  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@linux.intel.com

> +        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
> 

  reply	other threads:[~2020-04-23 19:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 17:06 [PATCH kvm-unit-tests] SVM: move guest past HLT Paolo Bonzini
2020-04-23 19:46 ` Sean Christopherson [this message]
2020-04-23 21:23   ` Paolo Bonzini

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=20200423194605.GQ17824@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=cavery@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=wei.huang2@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.