All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: David Matlack <dmatlack@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Jim Mattson <jmattson@google.com>, Peter Xu <peterx@redhat.com>,
	Colton Lewis <coltonlewis@google.com>,
	Aaron Lewis <aaronlewis@google.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH v2 3/8] KVM: selftests: Delete dead ucall code
Date: Thu, 27 Oct 2022 23:44:20 +0000	[thread overview]
Message-ID: <Y1sX1FP4YIWRl5YU@google.com> (raw)
In-Reply-To: <20221018214612.3445074-4-dmatlack@google.com>

On Tue, Oct 18, 2022, David Matlack wrote:
> Delete a bunch of code related to ucall handling from
> smaller_maxphyaddr_emulation_test. The only thing
> smaller_maxphyaddr_emulation_test needs to check is that the vCPU exits
> with UCALL_DONE after the second vcpu_run().
> 
> Signed-off-by: David Matlack <dmatlack@google.com>
> ---
>  .../smaller_maxphyaddr_emulation_test.c       | 54 +------------------
>  1 file changed, 2 insertions(+), 52 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c b/tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c
> index c5353ad0e06d..d6e71549ca08 100644
> --- a/tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c
> +++ b/tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c
> @@ -90,64 +90,15 @@ static void process_exit_on_emulation_error(struct kvm_vcpu *vcpu)
>  	vcpu_regs_set(vcpu, &regs);
>  }
>  
> -static void do_guest_assert(struct ucall *uc)
> -{
> -	REPORT_GUEST_ASSERT(*uc);
> -}
> -
> -static void check_for_guest_assert(struct kvm_vcpu *vcpu)
> +static void assert_ucall_done(struct kvm_vcpu *vcpu)

I vote to delete this helper too, it's used exactly once and doesn't exactly make
the code more readable.

>  	TEST_ASSERT(get_ucall(vcpu, &uc) == UCALL_DONE,
>  		    "Unexpected ucall command: %lu, expected UCALL_DONE (%d)",
>  		    uc.cmd, UCALL_DONE);

I believe the warning is due to gcc resolving the VA args inputs to test_assert()
before the call to get_ucall().  One thought:

  uint64_t cmd = get_ucall(vcpu, NULL);

  TEST_ASSERT(cmd == UCALL_DONE, ...)

In file included from x86_64/smaller_maxphyaddr_emulation_test.c:11:
include/test_util.h: In function ‘assert_ucall_done’:
include/test_util.h:54:9: warning: ‘uc.cmd’ is used uninitialized [-Wuninitialized]
   54 |         test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~
x86_64/smaller_maxphyaddr_emulation_test.c:69:22: note: ‘uc’ declared here
   69 |         struct ucall uc;
      |                      ^~


  reply	other threads:[~2022-10-27 23:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 21:46 [PATCH v2 0/8] KVM: selftests: Fix and clean up emulator_error_test David Matlack
2022-10-18 21:46 ` [PATCH v2 1/8] KVM: selftests: Rename emulator_error_test to smaller_maxphyaddr_emulation_test David Matlack
2022-10-27 23:27   ` Sean Christopherson
2022-10-18 21:46 ` [PATCH v2 2/8] KVM: selftests: Explicitly require instructions bytes David Matlack
2022-10-27 23:41   ` Sean Christopherson
2022-10-18 21:46 ` [PATCH v2 3/8] KVM: selftests: Delete dead ucall code David Matlack
2022-10-27 23:44   ` Sean Christopherson [this message]
2022-10-28 23:59     ` David Matlack
2022-10-18 21:46 ` [PATCH v2 4/8] KVM: selftests: Move flds instruction emulation failure handling to header David Matlack
2022-10-18 21:46 ` [PATCH v2 5/8] KVM: x86/mmu: Use BIT{,_ULL}() for PFERR masks David Matlack
2022-10-27 23:45   ` Sean Christopherson
2022-10-18 21:46 ` [PATCH v2 6/8] KVM: selftests: Copy KVM PFERR masks into selftests David Matlack
2022-10-28  0:34   ` Sean Christopherson
2022-10-18 21:46 ` [PATCH v2 7/8] KVM: selftests: Expect #PF(RSVD) when TDP is disabled David Matlack
2022-10-28  0:31   ` Sean Christopherson
2022-10-28 23:51     ` David Matlack
2022-10-31 16:47       ` Sean Christopherson
2022-10-18 21:46 ` [PATCH v2 8/8] KVM: selftest: Add a test for KVM_CAP_EXIT_ON_EMULATION_FAILURE David Matlack
2022-10-28  0:34   ` Sean Christopherson

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=Y1sX1FP4YIWRl5YU@google.com \
    --to=seanjc@google.com \
    --cc=aaronlewis@google.com \
    --cc=coltonlewis@google.com \
    --cc=dmatlack@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@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.