All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH kvm-unit-tests v2] memory: Skip tests for instructions that are absent
Date: Mon, 3 Apr 2023 09:53:52 -0700	[thread overview]
Message-ID: <ZCsEoLRT4Y+Tumaa@google.com> (raw)
In-Reply-To: <20230403164411.388475-1-pbonzini@redhat.com>

On Mon, Apr 03, 2023, Paolo Bonzini wrote:
> Checking that instructions are absent is broken when running with CPU
> models other than the bare metal processor's, because neither VMX nor SVM have
> intercept controls for the instructions.
> 
> This can even happen with "-cpu max" when running under nested
> virtualization, which is the current situation in the Fedora KVM job
> on Cirrus-CI:
> 
> FAIL: clflushopt (ABSENT)
> FAIL: clwb (ABSENT)
> 
> In other words it looks like the features have been marked as disabled
> in the L0 host, while the hardware supports them.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  x86/memory.c | 83 +++++++++++++++++++++++++++++++---------------------
>  1 file changed, 49 insertions(+), 34 deletions(-)
> 
> diff --git a/x86/memory.c b/x86/memory.c
> index 351e7c0..58ef835 100644
> --- a/x86/memory.c
> +++ b/x86/memory.c
> @@ -25,53 +25,68 @@ static void handle_ud(struct ex_regs *regs)
>  
>  int main(int ac, char **av)
>  {
> -	int expected;
> -
>  	handle_exception(UD_VECTOR, handle_ud);
>  
>  	/* 3-byte instructions: */
>  	isize = 3;

We can clean this up even further by utilizing TRY_ASM().  Though I think this is
a good excuse to add things like asm_safe(), asm_safe_report(), and asm_safe_report_ex(),
to cut down on the boilerplate even more.  I'll send patches on top.

      reply	other threads:[~2023-04-03 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 16:44 [PATCH kvm-unit-tests v2] memory: Skip tests for instructions that are absent Paolo Bonzini
2023-04-03 16:53 ` Sean Christopherson [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=ZCsEoLRT4Y+Tumaa@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.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.