kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vishal Annapurve <vannapurve@google.com>
To: David Matlack <dmatlack@google.com>
Cc: x86 <x86@kernel.org>, kvm list <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-kselftest@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>, shuah <shuah@kernel.org>,
	Ben Gardon <bgardon@google.com>,
	Sean Christopherson <seanjc@google.com>,
	Oliver Upton <oupton@google.com>,
	peterx@redhat.com, Vitaly Kuznetsov <vkuznets@redhat.com>,
	drjones@redhat.com
Subject: Re: [V1 PATCH 3/5] selftests: kvm: x86: Execute vmcall/vmmcall according to CPU type
Date: Wed, 14 Sep 2022 12:12:16 -0700	[thread overview]
Message-ID: <CAGtprH9C9qTSBC8zB+q0K7ZgT=gs6hHy=i=1AQ80cD0U1vg7nA@mail.gmail.com> (raw)
In-Reply-To: <YxpysbHZb2G56K+f@google.com>

On Thu, Sep 8, 2022 at 3:54 PM David Matlack <dmatlack@google.com> wrote:
>
> Please use "KVM: selftest: ..." for the shortlog.
>

Ack.

> On Sat, Sep 03, 2022 at 01:28:47AM +0000, Vishal Annapurve wrote:
> > Modify following APIs for x86 implementation:
> > 1) kvm_arch_main : Query the cpu vendor and cache the value in advance.
> > 2) kvm_arch_post_vm_load: Populate cpu type in the guest memory so that
> >       guest doesn't need to execute cpuid instruction again.
>
> This commit message only describes a subset of the changes in this
> commit, and does not provide any context on why the changes are being
> made (other than a clue about avoiding CPUID).
>
> I also think this could be split up into 2 separate commits.
>

Ack, will add more details to the commit log. Though since
is_amd_cpu/is_intel_cpu is used by both selftest VMM and selftest
guest logic, I would prefer to not split this change into two. For
now, I will upload the series with this change being a single patch.
We can discuss again if this split is really needed.

Regards,
Vishal

> I would suggest first patch changes is_{intel,amd}_cpu() to return a cached
> result. e.g.
>
>   KVM: selftests: Precompute the result for is_{intel,amd}_cpu()
>
>   Cache the vendor CPU type in a global variable so that multiple calls
>   to is_intel_cpu() do not need to re-execute CPUID. This will be useful
>   in a follow-up commit to check if running on AMD or Intel from within
>   a selftest guest where executing CPUID requires a VM-exit.
>
> Then add support for AMD to kvm_hypercall():
>
>   KVM: selftests: Add AMD support to kvm_hypercall()
>
>   Add support for AMD hypercalls to kvm_hypercall() so that it can be
>   used in selftests running on Intel or AMD hosts. This will be used in
>   a follow up commit to ...
>
>   As part of this change, sync the global variable is_cpu_amd into the
>   guest so the guest can determine which hypercall instruction to use
>   without needing to re-execute CPUID for every hypercall.
>

  parent reply	other threads:[~2022-09-14 19:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03  1:28 [V1 PATCH 0/5] Execute hypercalls from guests according to cpu type Vishal Annapurve
2022-09-03  1:28 ` [V1 PATCH 1/5] selftests: kvm: move common startup logic to kvm_util.c Vishal Annapurve
2022-09-08 21:09   ` David Matlack
2022-09-14 19:09     ` Vishal Annapurve
2022-09-03  1:28 ` [V1 PATCH 2/5] selftests: kvm: Introduce kvm_arch_main and helpers Vishal Annapurve
2022-09-05  7:46   ` Andrew Jones
2022-09-06 22:46     ` Vishal Annapurve
2022-09-08 21:21       ` David Matlack
2022-09-09  7:01         ` Andrew Jones
2022-09-14 19:13           ` Vishal Annapurve
2022-09-08 21:27   ` David Matlack
2022-09-03  1:28 ` [V1 PATCH 3/5] selftests: kvm: x86: Execute vmcall/vmmcall according to CPU type Vishal Annapurve
2022-09-08 22:54   ` David Matlack
2022-09-08 22:57     ` David Matlack
2022-09-14 19:12     ` Vishal Annapurve [this message]
2022-09-03  1:28 ` [V1 PATCH 4/5] selftests: kvm: delete svm_vmcall_test Vishal Annapurve
2022-09-03  1:28 ` [V1 PATCH 5/5] selftests: kvm: Execute vmcall/vmmcall as per cpu type Vishal Annapurve

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='CAGtprH9C9qTSBC8zB+q0K7ZgT=gs6hHy=i=1AQ80cD0U1vg7nA@mail.gmail.com' \
    --to=vannapurve@google.com \
    --cc=bgardon@google.com \
    --cc=dmatlack@google.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=vkuznets@redhat.com \
    --cc=x86@kernel.org \
    /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 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).