From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Binbin Wu <binbin.wu@linux.intel.com>,
Kai Huang <kai.huang@intel.com>
Subject: [PATCH 2/9] KVM: x86/mmu: Annotate tdp_enabled as being read-mostly
Date: Thu, 25 Jun 2026 15:04:43 -0700 [thread overview]
Message-ID: <20260625220450.3354415-3-seanjc@google.com> (raw)
In-Reply-To: <20260625220450.3354415-1-seanjc@google.com>
Tag tdp_enabled with __read_mostly as the variable is only ever written
during vendor module load, same as all the other global MMU variables that
are handled by kvm_configure_mmu().
Opportunistically annotate the tdp_mmu_enabled and eager_page_split
declarations with __read_mostly, to match their definitions. The compiler
will warn if there are conflicting annotations, i.e. there's minimal risk
of the declaration annotation becoming stale.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/mmu.h | 6 +++---
arch/x86/kvm/mmu/mmu.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index c9f628b97dae..85bc503de1b6 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -6,14 +6,14 @@
#include "regs.h"
#include "cpuid.h"
-extern bool tdp_enabled;
+extern bool __read_mostly tdp_enabled;
#ifdef CONFIG_X86_64
-extern bool tdp_mmu_enabled;
+extern bool __read_mostly tdp_mmu_enabled;
#else
#define tdp_mmu_enabled false
#endif
extern bool __read_mostly enable_mmio_caching;
-extern bool eager_page_split;
+extern bool __read_mostly eager_page_split;
#define KVM_MEMSLOT_PAGES_TO_MMU_PAGES_RATIO 50
#define KVM_MIN_ALLOC_MMU_PAGES 64UL
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 6c13da942bfc..af3820136f7c 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -104,7 +104,7 @@ module_param_named(flush_on_reuse, force_flush_and_sync_on_reuse, bool, 0644);
* 2. while doing 1. it walks guest-physical to host-physical
* If the hardware supports that we don't need to do shadow paging.
*/
-bool tdp_enabled = false;
+bool __read_mostly tdp_enabled = false;
static bool __ro_after_init tdp_mmu_allowed;
--
2.55.0.rc0.799.gd6f94ed593-goog
next prev parent reply other threads:[~2026-06-25 22:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 22:04 [PATCH 0/9] KVM: x86: Spring cleaning, part 2 Sean Christopherson
2026-06-25 22:04 ` [PATCH 1/9] KVM: x86: Move the "APIC attention" macros from kvm_host.h => lapic.c Sean Christopherson
2026-06-26 0:10 ` Huang, Kai
2026-06-26 14:36 ` Sean Christopherson
2026-06-25 22:04 ` Sean Christopherson [this message]
2026-06-26 0:14 ` [PATCH 2/9] KVM: x86/mmu: Annotate tdp_enabled as being read-mostly Huang, Kai
2026-06-25 22:04 ` [PATCH 3/9] KVM: x86: Pluralize the macro guard name for msrs.h Sean Christopherson
2026-06-26 0:14 ` Huang, Kai
2026-06-25 22:04 ` [PATCH 4/9] KVM: x86: Move CR and DR macro definitions from kvm_host.h => regs.h Sean Christopherson
2026-06-26 0:37 ` Huang, Kai
2026-06-25 22:04 ` [PATCH 5/9] KVM: x86: Move KVM_GUESTDBG_VALID_MASK from kvm_host.h => x86.c Sean Christopherson
2026-06-26 0:38 ` Huang, Kai
2026-06-25 22:04 ` [PATCH 6/9] KVM: x86: Add static asserts to document connection b/w TSS structs and macros Sean Christopherson
2026-06-26 0:43 ` Huang, Kai
2026-06-25 22:04 ` [PATCH 7/9] KVM: x86: Move KVM's arbitrary task switch reason enums to x86.h Sean Christopherson
2026-06-26 0:46 ` Huang, Kai
2026-06-25 22:04 ` [PATCH 8/9] KVM: x86: Move "struct kvm_apic_map" definition from kvm_host.h => lapic.h Sean Christopherson
2026-06-26 0:50 ` Huang, Kai
2026-06-25 22:04 ` [PATCH 9/9] KVM: x86: Move "struct kvm_vcpu_hv" and all children from kvm_host.h => hyperv.h Sean Christopherson
2026-06-26 0:57 ` Huang, Kai
2026-07-14 18:41 ` [PATCH 0/9] KVM: x86: Spring cleaning, part 2 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=20260625220450.3354415-3-seanjc@google.com \
--to=seanjc@google.com \
--cc=binbin.wu@linux.intel.com \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@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 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®