mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Yu Zhang <yu.c.zhang@linux.intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 05/12] KVM: x86: Use KVM-governed feature framework to track "XSAVES enabled"
Date: Wed, 22 Feb 2023 10:56:04 -0800	[thread overview]
Message-ID: <Y/ZlRDuRivMDKGwo@google.com> (raw)
In-Reply-To: <20230221145610.ytlj5nkqsscc2yxo@linux.intel.com>

On Tue, Feb 21, 2023, Yu Zhang wrote:
> On Fri, Feb 17, 2023 at 03:10:15PM -0800, Sean Christopherson wrote:
> > Use the governed feature framework to track if XSAVES is "enabled", i.e.
> > if XSAVES can be used by the guest.  Add a comment in the SVM code to
> > explain the very unintuitive logic of deliberately NOT checking if XSAVES
> > is enumerated in the guest CPUID model.
> > 
> > No functional change intended.
> 
> xsaves_enabled in struct kvm_vcpu_arch is no longer used. But instead of
> just deleting it, maybe we could move 'bool load_eoi_exitmap_pending' to
> its place, so 7 bytes can be saved for each struct kvm_vcpu_arch:

I prefer leaving load_eoi_exitmap_pending where it is so that it's co-located with
ioapic_handled_vectors.  I agree wasting 7 bytes is unfortunate, but I don't want
to take an ad hoc approach to shrinking per-vCPU structs.  See the link below for
more discussion.

https://lore.kernel.org/all/20230213163351.30704-1-minipli@grsecurity.net

> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index cd660de02f7b..0eef5469c165 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -740,7 +740,6 @@ struct kvm_vcpu_arch {
>         u64 efer;
>         u64 apic_base;
>         struct kvm_lapic *apic;    /* kernel irqchip context */
> -       bool load_eoi_exitmap_pending;
>         DECLARE_BITMAP(ioapic_handled_vectors, 256);
>         unsigned long apic_attention;
>         int32_t apic_arb_prio;
> @@ -750,7 +749,7 @@ struct kvm_vcpu_arch {
>         u64 smi_count;
>         bool at_instruction_boundary;
>         bool tpr_access_reporting;
> -       bool xsaves_enabled;
> +       bool load_eoi_exitmap_pending;
>         bool xfd_no_write_intercept;
>         u64 ia32_xss;
>         u64 microcode_version;
> 
> B.R.
> Yu
> 

  reply	other threads:[~2023-02-22 18:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 23:10 [PATCH 00/12] KVM: x86: Add "governed" X86_FEATURE framework Sean Christopherson
2023-02-17 23:10 ` [PATCH 01/12] KVM: x86: Add a framework for enabling KVM-governed x86 features Sean Christopherson
2023-02-21 17:12   ` Vitaly Kuznetsov
2023-06-29  2:40   ` Binbin Wu
2023-06-29 16:26     ` Sean Christopherson
2023-06-30  8:01   ` Chao Gao
2023-06-30 15:31     ` Sean Christopherson
2023-02-17 23:10 ` [PATCH 02/12] KVM: x86/mmu: Use KVM-governed feature framework to track "GBPAGES enabled" Sean Christopherson
2023-02-17 23:10 ` [PATCH 03/12] KVM: VMX: Recompute "XSAVES enabled" only after CPUID update Sean Christopherson
2023-02-17 23:10 ` [PATCH 04/12] KVM: VMX: Rename XSAVES control to follow KVM's preferred "ENABLE_XYZ" Sean Christopherson
2023-02-17 23:10 ` [PATCH 05/12] KVM: x86: Use KVM-governed feature framework to track "XSAVES enabled" Sean Christopherson
2023-02-21 14:56   ` Yu Zhang
2023-02-22 18:56     ` Sean Christopherson [this message]
2023-02-24  9:54       ` Yu Zhang
2023-02-17 23:10 ` [PATCH 06/12] KVM: nSVM: Use KVM-governed feature framework to track "NRIPS enabled" Sean Christopherson
2023-02-17 23:10 ` [PATCH 07/12] KVM: nSVM: Use KVM-governed feature framework to track "TSC scaling enabled" Sean Christopherson
2023-02-17 23:10 ` [PATCH 08/12] KVM: nSVM: Use KVM-governed feature framework to track "vVM{SAVE,LOAD} enabled" Sean Christopherson
2023-02-21 15:23   ` Yu Zhang
2023-02-21 15:33     ` Yu Zhang
2023-02-21 23:48       ` Sean Christopherson
2023-02-22  6:49         ` Yu Zhang
2023-02-22 16:39           ` Sean Christopherson
2023-02-24  9:25             ` Yu Zhang
2023-02-24 16:16               ` Sean Christopherson
2023-06-29 16:50             ` Sean Christopherson
2023-06-30 10:00               ` Yu Zhang
2023-02-17 23:10 ` [PATCH 09/12] KVM: nSVM: Use KVM-governed feature framework to track "LBRv enabled" Sean Christopherson
2023-02-17 23:10 ` [PATCH 10/12] KVM: nSVM: Use KVM-governed feature framework to track "Pause Filter enabled" Sean Christopherson
2023-02-17 23:10 ` [PATCH 11/12] KVM: nSVM: Use KVM-governed feature framework to track "vGIF enabled" Sean Christopherson
2023-02-17 23:10 ` [PATCH 12/12] KVM: x86: Disallow guest CPUID lookups when IRQs are disabled 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=Y/ZlRDuRivMDKGwo@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=yu.c.zhang@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®