* [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases
[not found] <20260819102314.1499258-14-jgross@suse.com>
@ 2026-08-21 10:57 ` Juergen Gross
2026-09-11 21:33 ` Shreshth Srivastava
0 siblings, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2026-08-21 10:57 UTC (permalink / raw)
To: linux-kernel, x86, linux-perf-users, linux-hyperv, kvm,
linux-coco
Cc: Juergen Gross, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
Dexuan Cui, Long Li, Sean Christopherson, Paolo Bonzini,
Kiryl Shutsemau, Rick Edgecombe, Michael Kelley
After the conversion of rdmsrq() to an inline function some use cases
can be simplified by dropping an intermediate variable or by
eliminating the inline function completely.
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com> # Hyper-V
---
V3:
- eliminate KVM's read_msr() (Sean Christopherson)
---
arch/x86/events/amd/core.c | 6 +-----
arch/x86/events/amd/lbr.c | 12 ++----------
arch/x86/events/intel/core.c | 6 +-----
arch/x86/events/intel/cstate.c | 5 +----
arch/x86/events/intel/knc.c | 6 +-----
arch/x86/events/intel/lbr.c | 17 +++--------------
arch/x86/events/intel/uncore.c | 6 +-----
arch/x86/events/rapl.c | 4 +---
arch/x86/events/zhaoxin/core.c | 6 +-----
arch/x86/hyperv/hv_apic.c | 5 +----
arch/x86/include/asm/apic.h | 5 +----
arch/x86/include/asm/debugreg.h | 6 +-----
arch/x86/include/asm/kvm_host.h | 10 ----------
arch/x86/kvm/vmx/tdx.c | 2 +-
arch/x86/kvm/vmx/vmx.c | 6 +++---
15 files changed, 19 insertions(+), 83 deletions(-)
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 80ed49dba255..3d0e076c1636 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -660,12 +660,8 @@ static __always_inline void amd_pmu_set_global_ctl(u64 ctl)
static inline u64 amd_pmu_get_global_status(void)
{
- u64 status;
-
/* PerfCntrGlobalStatus is read-only */
- status = rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS);
}
static inline void amd_pmu_ack_global_status(u64 status)
diff --git a/arch/x86/events/amd/lbr.c b/arch/x86/events/amd/lbr.c
index 29628af6a023..1b4c0ef81485 100644
--- a/arch/x86/events/amd/lbr.c
+++ b/arch/x86/events/amd/lbr.c
@@ -74,20 +74,12 @@ static __always_inline void amd_pmu_lbr_set_to(unsigned int idx, u64 val)
static __always_inline u64 amd_pmu_lbr_get_from(unsigned int idx)
{
- u64 val;
-
- val = rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2);
-
- return val;
+ return rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2);
}
static __always_inline u64 amd_pmu_lbr_get_to(unsigned int idx)
{
- u64 val;
-
- val = rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2 + 1);
-
- return val;
+ return rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2 + 1);
}
static __always_inline u64 sign_ext_branch_ip(u64 ip)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 41ae90b6bbdc..d19ac42b6e8c 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -2963,11 +2963,7 @@ static void intel_tfa_pmu_enable_all(int added)
static inline u64 intel_pmu_get_status(void)
{
- u64 status;
-
- status = rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
}
static inline void intel_pmu_ack_status(u64 ack)
diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 69eb6cf51d3b..c6d9146d8ec8 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -322,10 +322,7 @@ static int cstate_pmu_event_init(struct perf_event *event)
static inline u64 cstate_pmu_read_counter(struct perf_event *event)
{
- u64 val;
-
- val = rdmsrq(event->hw.event_base);
- return val;
+ return rdmsrq(event->hw.event_base);
}
static void cstate_pmu_event_update(struct perf_event *event)
diff --git a/arch/x86/events/intel/knc.c b/arch/x86/events/intel/knc.c
index c4f81215f758..a74caa8280be 100644
--- a/arch/x86/events/intel/knc.c
+++ b/arch/x86/events/intel/knc.c
@@ -199,11 +199,7 @@ static void knc_pmu_enable_event(struct perf_event *event)
static inline u64 knc_pmu_get_status(void)
{
- u64 status;
-
- status = rdmsrq(MSR_KNC_IA32_PERF_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_KNC_IA32_PERF_GLOBAL_STATUS);
}
static inline void knc_pmu_ack_status(u64 ack)
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index fc05ec3b9a99..70dae299627a 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -209,10 +209,7 @@ void intel_pmu_lbr_reset(void)
*/
static inline u64 intel_pmu_lbr_tos(void)
{
- u64 tos;
-
- tos = rdmsrq(x86_pmu.lbr_tos);
- return tos;
+ return rdmsrq(x86_pmu.lbr_tos);
}
enum {
@@ -311,26 +308,18 @@ static __always_inline u64 rdlbr_from(unsigned int idx, struct lbr_entry *lbr)
static __always_inline u64 rdlbr_to(unsigned int idx, struct lbr_entry *lbr)
{
- u64 val;
-
if (lbr)
return lbr->to;
- val = rdmsrq(x86_pmu.lbr_to + idx);
-
- return val;
+ return rdmsrq(x86_pmu.lbr_to + idx);
}
static __always_inline u64 rdlbr_info(unsigned int idx, struct lbr_entry *lbr)
{
- u64 val;
-
if (lbr)
return lbr->info;
- val = rdmsrq(x86_pmu.lbr_info + idx);
-
- return val;
+ return rdmsrq(x86_pmu.lbr_info + idx);
}
static inline void
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index ab2c5a962b31..cffbd780a435 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -169,11 +169,7 @@ struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu
u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event)
{
- u64 count;
-
- count = rdmsrq(event->hw.event_base);
-
- return count;
+ return rdmsrq(event->hw.event_base);
}
void uncore_mmio_exit_box(struct intel_uncore_box *box)
diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
index 180cc18282ca..2d2376c59816 100644
--- a/arch/x86/events/rapl.c
+++ b/arch/x86/events/rapl.c
@@ -192,9 +192,7 @@ static inline unsigned int get_rapl_pmu_idx(int cpu, int scope)
static inline u64 rapl_read_counter(struct perf_event *event)
{
- u64 raw;
- raw = rdmsrq(event->hw.event_base);
- return raw;
+ return rdmsrq(event->hw.event_base);
}
static inline u64 rapl_scale(u64 v, struct perf_event *event)
diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
index 1980e5995e27..9203321c18b4 100644
--- a/arch/x86/events/zhaoxin/core.c
+++ b/arch/x86/events/zhaoxin/core.c
@@ -266,11 +266,7 @@ static void zhaoxin_pmu_enable_all(int added)
static inline u64 zhaoxin_pmu_get_status(void)
{
- u64 status;
-
- status = rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
}
static inline void zhaoxin_pmu_ack_status(u64 ack)
diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 4e30f9a11bc4..52ee8c237c2c 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -36,10 +36,7 @@ static struct apic orig_apic;
static u64 hv_apic_icr_read(void)
{
- u64 reg_val;
-
- reg_val = rdmsrq(HV_X64_MSR_ICR);
- return reg_val;
+ return rdmsrq(HV_X64_MSR_ICR);
}
static void hv_apic_icr_write(u32 low, u32 id)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index e028140fac49..993b52b52625 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -231,10 +231,7 @@ static inline void native_x2apic_icr_write(u32 low, u32 id)
static inline u64 native_x2apic_icr_read(void)
{
- unsigned long val;
-
- val = rdmsrq(APIC_BASE_MSR + (APIC_ICR >> 4));
- return val;
+ return rdmsrq(APIC_BASE_MSR + (APIC_ICR >> 4));
}
extern int x2apic_mode;
diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h
index 60a3df32a4d3..e00251c7eb12 100644
--- a/arch/x86/include/asm/debugreg.h
+++ b/arch/x86/include/asm/debugreg.h
@@ -174,15 +174,11 @@ static inline unsigned long amd_get_dr_addr_mask(unsigned int dr)
static inline unsigned long get_debugctlmsr(void)
{
- unsigned long debugctlmsr = 0;
-
#ifndef CONFIG_X86_DEBUGCTLMSR
if (boot_cpu_data.x86 < 6)
return 0;
#endif
- debugctlmsr = rdmsrq(MSR_IA32_DEBUGCTLMSR);
-
- return debugctlmsr;
+ return rdmsrq(MSR_IA32_DEBUGCTLMSR);
}
static inline void update_debugctlmsr(unsigned long debugctlmsr)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 2097602a00a0..74a10e7ffbd6 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -2412,16 +2412,6 @@ static inline void kvm_load_ldt(u16 sel)
asm("lldt %0" : : "rm"(sel));
}
-#ifdef CONFIG_X86_64
-static inline unsigned long read_msr(unsigned long msr)
-{
- u64 value;
-
- value = rdmsrq(msr);
- return value;
-}
-#endif
-
static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code)
{
kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index 545b03d9d10b..88f2e137598b 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -793,7 +793,7 @@ void tdx_prepare_switch_to_guest(struct kvm_vcpu *vcpu)
if (likely(is_64bit_mm(current->mm)))
vt->msr_host_kernel_gs_base = current->thread.gsbase;
else
- vt->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);
+ vt->msr_host_kernel_gs_base = rdmsrq(MSR_KERNEL_GS_BASE);
vt->guest_state_loaded = true;
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index bd16bdfc1d61..534e83d857c2 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -1374,8 +1374,8 @@ void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu)
} else {
savesegment(fs, fs_sel);
savesegment(gs, gs_sel);
- fs_base = read_msr(MSR_FS_BASE);
- vt->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);
+ fs_base = rdmsrq(MSR_FS_BASE);
+ vt->msr_host_kernel_gs_base = rdmsrq(MSR_KERNEL_GS_BASE);
}
wrmsrq(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
@@ -1434,7 +1434,7 @@ static u64 vmx_read_guest_host_msr(struct vcpu_vmx *vmx, u32 msr, u64 *cache)
{
preempt_disable();
if (vmx->vt.guest_state_loaded)
- *cache = read_msr(msr);
+ *cache = rdmsrq(msr);
preempt_enable();
return *cache;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases
2026-08-21 10:57 ` [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
@ 2026-09-11 21:33 ` Shreshth Srivastava
2026-09-12 6:50 ` Jürgen Groß
0 siblings, 1 reply; 5+ messages in thread
From: Shreshth Srivastava @ 2026-09-11 21:33 UTC (permalink / raw)
To: jgross, linux-kernel, x86, linux-perf-users, linux-hyperv, kvm,
linux-coco
Cc: acme, adrian.hunter, alexander.shishkin, bp, dave.hansen, decui,
haiyangz, hpa, irogers, james.clark, jolsa, kas, kys, longli,
mark.rutland, mhklinux, mingo, namhyung, pbonzini, peterz,
rick.p.edgecombe, seanjc, tglx, wei.liu, shreshth.srivastava
Hi Juergen,
I'm working on a v3 of Dave's "x86/msr: Consolidate native/paravirt MSR
functions" series on top of yours, so I tried testing this patch.
While I'm here: you mentioned you'd send a V3 after rc1 if conflicts
turned up. Is that still the plan? I wasn't sure whether to base on v2
plus the respins of 4 and 13, or wait.
Most of the code this touches can't run on my box, so I compared compiled
output instead. Built patches 1-12, then 1-13, with the same .config and
compiler, and diffed "objdump -d" output for every .o in both trees. All
9396 objects came out identical. The 1-13 kernel boots fine under KVM.
Only tried the one config: x86_64, gcc 11.5.0,
CPU_SUP_{INTEL,AMD,ZHAOXIN}=y, HYPERV=y, KVM_INTEL=y, KVM_INTEL_TDX=y.
Tested-by: Shreshth Srivastava <shreshth.srivastava@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases
2026-09-11 21:33 ` Shreshth Srivastava
@ 2026-09-12 6:50 ` Jürgen Groß
0 siblings, 0 replies; 5+ messages in thread
From: Jürgen Groß @ 2026-09-12 6:50 UTC (permalink / raw)
To: Shreshth Srivastava, linux-kernel, x86, linux-perf-users,
linux-hyperv, kvm, linux-coco
Cc: acme, adrian.hunter, alexander.shishkin, bp, dave.hansen, decui,
haiyangz, hpa, irogers, james.clark, jolsa, kas, kys, longli,
mark.rutland, mhklinux, mingo, namhyung, pbonzini, peterz,
rick.p.edgecombe, seanjc, tglx, wei.liu
[-- Attachment #1.1.1: Type: text/plain, Size: 1259 bytes --]
On 11.09.26 23:33, Shreshth Srivastava wrote:
> Hi Juergen,
>
> I'm working on a v3 of Dave's "x86/msr: Consolidate native/paravirt MSR
> functions" series on top of yours, so I tried testing this patch.
You should look at [1] and [2] as well.
>
> While I'm here: you mentioned you'd send a V3 after rc1 if conflicts
> turned up. Is that still the plan? I wasn't sure whether to base on v2
> plus the respins of 4 and 13, or wait.
I did send out V3 yesterday [3].
>
> Most of the code this touches can't run on my box, so I compared compiled
> output instead. Built patches 1-12, then 1-13, with the same .config and
> compiler, and diffed "objdump -d" output for every .o in both trees. All
> 9396 objects came out identical. The 1-13 kernel boots fine under KVM.
>
> Only tried the one config: x86_64, gcc 11.5.0,
> CPU_SUP_{INTEL,AMD,ZHAOXIN}=y, HYPERV=y, KVM_INTEL=y, KVM_INTEL_TDX=y.
>
> Tested-by: Shreshth Srivastava <shreshth.srivastava@intel.com>
Thanks.
Juergen
[1]: https://lore.kernel.org/lkml/20260911075216.3142309-1-jgross@suse.com/T/#t
[2]: https://lore.kernel.org/lkml/20260911084211.3149957-1-jgross@suse.com/T/#t
[3]: https://lore.kernel.org/lkml/20260911074530.3140830-1-jgross@suse.com/T/#t
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 00/13] x86/msr: Drop 32-bit MSR interfaces
@ 2026-09-11 7:45 Juergen Gross
2026-09-11 7:45 ` [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
0 siblings, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2026-09-11 7:45 UTC (permalink / raw)
To: linux-kernel, x86, virtualization, linux-ide, dri-devel,
linux-fbdev, linux-crypto, linux-gpio, linux-perf-users,
linux-hyperv, kvm, linux-edac, linux-pci, linux-pm, linux-coco,
linux-acpi, linux-hwmon, linux-mtd, platform-driver-x86
Cc: Juergen Gross, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin, Ajay Kaher, Alexey Makhalov,
Broadcom internal kernel review list, Damien Le Moal,
Niklas Cassel, David Airlie, Helge Deller, linux-geode,
Olivia Mackall, Herbert Xu, Linus Walleij, Bartosz Golaszewski,
Arnd Bergmann, Greg Kroah-Hartman, Peter Zijlstra,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
Long Li, Sean Christopherson, Paolo Bonzini, Josh Poimboeuf,
Pawan Gupta, Pu Wen, Tony Luck, Reinette Chatre, Dave Martin,
James Morse, Babu Moger, Tony W Wang-oc, Vitaly Kuznetsov,
Andy Lutomirski, Bjorn Helgaas, Rafael J. Wysocki, Pavel Machek,
Kiryl Shutsemau, Rick Edgecombe, Boris Ostrovsky, Len Brown,
Viresh Kumar, Huang Rui, Mario Limonciello, Perry Yuan,
K Prateek Nayak, Srinivas Pandruvada, Yazen Ghannam,
Guenter Roeck, Artem Bityutskiy, Artem Bityutskiy, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Ashok Raj, Hans de Goede,
Ilpo Järvinen, Rajneesh Bhardwaj, Xi Pardee, Daniel Lezcano,
Zhang Rui, Lukasz Luba, xen-devel
For accessing the MSR registers on the local CPU, there are 2 types of
interfaces: the "modern" 64-bit ones (rdmsrq() etc.) and the 32-bit
ones (rdmsr() etc.) which are using the upper and lower 32-bit halves
of the 64-bit wide MSR register values.
The 32-bit interfaces are not optimal for 3 reasons:
- They are based on primitives using 64-bit sized values anyway.
- Modern x86 CPUs have added support for MSR access instructions using
an immediate value instead of a register for addressing the MSR,
while the value is in a 64-bit register.
- rdmsr() is a macro storing the upper and lower 32-bit halves in
variables specified as macro parameters. This is obscuring variable
assignment through a macro. Additionally rdmsrq() is mimicking this
pattern by being a macro, too, with the target variable specified as
a parameter as well.
For those reasons drop the 32-bit interfaces for accessing the x86 MSR
registers completely and only use the 64-bit variants.
This allows to switch all "high-level" MSR access macros to inline
functions in the end.
This series will be used as the base for further reorganisation of the
MSR access functions, especially for completely inlining the MSR
access instructions even with paravirtualization being active.
Based on kernel 7.3 as of 2026-09-11.
Changes in V2:
- dropped already applied patches
- added patch 1
- rebased
Changes in V3:
- small fixes in patches 4 and 13
- rebased
Juergen Gross (13):
x86/cpu: Fix coding style violation
x86/msr: Remove wrmsr_safe()
x86/msr: Remove rdmsr_safe()
drivers/ata: Stop using 32-bit MSR interfaces
agp/nvidia: Stop using 32-bit MSR interfaces
fbdev/geode: Stop using 32-bit MSR interfaces
hw_random/via-rng: Stop using 32-bit MSR interfaces
drivers/gpio: Stop using 32-bit MSR interfaces
drivers/misc: Stop using 32-bit MSR interfaces
x86/msr: Remove wrmsr()
x86/msr: Remove rdmsr()
treewide: convert rdmsrq() from a macro to an inline function
x86/msr: Simplify some rdmsrq() use cases
arch/x86/coco/sev/core.c | 2 +-
arch/x86/events/amd/brs.c | 4 +-
arch/x86/events/amd/core.c | 8 +--
arch/x86/events/amd/ibs.c | 18 +++----
arch/x86/events/amd/lbr.c | 16 ++----
arch/x86/events/amd/power.c | 8 +--
arch/x86/events/amd/uncore.c | 4 +-
arch/x86/events/core.c | 20 ++++----
arch/x86/events/intel/core.c | 15 ++----
arch/x86/events/intel/cstate.c | 5 +-
arch/x86/events/intel/ds.c | 2 +-
arch/x86/events/intel/knc.c | 10 ++--
arch/x86/events/intel/lbr.c | 25 +++-------
arch/x86/events/intel/p4.c | 6 +--
arch/x86/events/intel/p6.c | 4 +-
arch/x86/events/intel/pt.c | 12 ++---
arch/x86/events/intel/uncore.c | 6 +--
arch/x86/events/intel/uncore_nhmex.c | 4 +-
arch/x86/events/intel/uncore_snb.c | 2 +-
arch/x86/events/intel/uncore_snbep.c | 6 +--
arch/x86/events/msr.c | 2 +-
arch/x86/events/perf_event.h | 6 +--
arch/x86/events/rapl.c | 6 +--
arch/x86/events/zhaoxin/core.c | 10 ++--
arch/x86/hyperv/hv_apic.c | 9 ++--
arch/x86/hyperv/hv_init.c | 26 +++++-----
arch/x86/hyperv/hv_spinlock.c | 2 +-
arch/x86/include/asm/apic.h | 7 +--
arch/x86/include/asm/debugreg.h | 6 +--
arch/x86/include/asm/fsgsbase.h | 2 +-
arch/x86/include/asm/kvm_host.h | 10 ----
arch/x86/include/asm/msr.h | 39 ++-------------
arch/x86/include/asm/paravirt.h | 26 +---------
arch/x86/kernel/apic/apic.c | 14 +++---
arch/x86/kernel/apic/apic_numachip.c | 6 +--
arch/x86/kernel/cet.c | 2 +-
arch/x86/kernel/cpu/amd.c | 14 +++---
arch/x86/kernel/cpu/aperfmperf.c | 8 +--
arch/x86/kernel/cpu/bugs.c | 12 ++---
arch/x86/kernel/cpu/bus_lock.c | 8 +--
arch/x86/kernel/cpu/centaur.c | 8 +--
arch/x86/kernel/cpu/common.c | 12 ++---
arch/x86/kernel/cpu/feat_ctl.c | 4 +-
arch/x86/kernel/cpu/hygon.c | 4 +-
arch/x86/kernel/cpu/intel.c | 6 +--
arch/x86/kernel/cpu/intel_epb.c | 4 +-
arch/x86/kernel/cpu/mce/amd.c | 4 +-
arch/x86/kernel/cpu/mce/core.c | 8 +--
arch/x86/kernel/cpu/mce/inject.c | 2 +-
arch/x86/kernel/cpu/mce/intel.c | 18 +++----
arch/x86/kernel/cpu/mce/p5.c | 8 +--
arch/x86/kernel/cpu/mce/winchip.c | 2 +-
arch/x86/kernel/cpu/microcode/intel.c | 2 +-
arch/x86/kernel/cpu/mshyperv.c | 6 +--
arch/x86/kernel/cpu/mtrr/amd.c | 4 +-
arch/x86/kernel/cpu/mtrr/cleanup.c | 4 +-
arch/x86/kernel/cpu/mtrr/generic.c | 32 ++++++------
arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +-
arch/x86/kernel/cpu/resctrl/core.c | 2 +-
arch/x86/kernel/cpu/resctrl/monitor.c | 4 +-
arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 +-
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 +-
arch/x86/kernel/cpu/topology.c | 2 +-
arch/x86/kernel/cpu/topology_amd.c | 4 +-
arch/x86/kernel/cpu/transmeta.c | 8 +--
arch/x86/kernel/cpu/tsx.c | 10 ++--
arch/x86/kernel/cpu/umwait.c | 2 +-
arch/x86/kernel/cpu/zhaoxin.c | 4 +-
arch/x86/kernel/fpu/core.c | 2 +-
arch/x86/kernel/hpet.c | 2 +-
arch/x86/kernel/kvm.c | 2 +-
arch/x86/kernel/mmconf-fam10h_64.c | 6 +--
arch/x86/kernel/process.c | 4 +-
arch/x86/kernel/process_64.c | 14 +++---
arch/x86/kernel/shstk.c | 8 +--
arch/x86/kernel/traps.c | 4 +-
arch/x86/kernel/tsc.c | 2 +-
arch/x86/kernel/tsc_msr.c | 6 +--
arch/x86/kernel/tsc_sync.c | 6 +--
arch/x86/kvm/msrs.c | 2 +-
arch/x86/kvm/svm/pmu.c | 4 +-
arch/x86/kvm/svm/svm.c | 4 +-
arch/x86/kvm/vmx/nested.c | 4 +-
arch/x86/kvm/vmx/pmu_intel.c | 8 +--
arch/x86/kvm/vmx/sgx.c | 6 +--
arch/x86/kvm/vmx/tdx.c | 2 +-
arch/x86/kvm/vmx/vmx.c | 42 ++++++++--------
arch/x86/kvm/x86.c | 6 +--
arch/x86/lib/insn-eval.c | 6 +--
arch/x86/lib/msr-smp.c | 2 +-
arch/x86/mm/pat/memtype.c | 2 +-
arch/x86/pci/amd_bus.c | 8 +--
arch/x86/platform/olpc/olpc-xo1-rtc.c | 6 +--
arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +-
arch/x86/power/cpu.c | 10 ++--
arch/x86/realmode/init.c | 2 +-
arch/x86/virt/hw.c | 8 +--
arch/x86/virt/svm/sev.c | 18 +++----
arch/x86/virt/vmx/tdx/tdx.c | 2 +-
arch/x86/xen/suspend.c | 2 +-
drivers/acpi/processor_perflib.c | 2 +-
drivers/ata/pata_cs5535.c | 24 ++++-----
drivers/ata/pata_cs5536.c | 17 +++----
drivers/char/agp/nvidia-agp.c | 32 ++++++------
drivers/char/hw_random/via-rng.c | 29 +++++------
drivers/cpufreq/acpi-cpufreq.c | 8 +--
drivers/cpufreq/amd-pstate.c | 4 +-
drivers/cpufreq/e_powersaver.c | 20 ++++----
drivers/cpufreq/intel_pstate.c | 28 +++++------
drivers/cpufreq/longhaul.c | 12 ++---
drivers/cpufreq/longrun.c | 16 +++---
drivers/cpufreq/powernow-k7.c | 10 ++--
drivers/cpufreq/powernow-k8.c | 8 +--
drivers/cpufreq/speedstep-centrino.c | 4 +-
drivers/cpufreq/speedstep-lib.c | 14 +++---
drivers/edac/amd64_edac.c | 6 +--
drivers/gpio/gpio-cs5535.c | 10 ++--
drivers/hv/mshv_vtl_main.c | 2 +-
drivers/hwmon/hwmon-vid.c | 4 +-
drivers/idle/intel_idle.c | 26 +++++-----
drivers/misc/cs5535-mfgpt.c | 33 ++++++------
drivers/mtd/nand/raw/cs553x_nand.c | 6 +--
drivers/platform/x86/intel/ifs/load.c | 10 ++--
drivers/platform/x86/intel/ifs/runtest.c | 8 +--
drivers/platform/x86/intel/pmc/cnp.c | 2 +-
.../intel/speed_select_if/isst_if_mbox_msr.c | 6 +--
.../intel/speed_select_if/isst_tpmi_core.c | 2 +-
drivers/platform/x86/intel_ips.c | 20 ++++----
drivers/powercap/intel_rapl_msr.c | 2 +-
drivers/thermal/intel/intel_hfi.c | 8 +--
drivers/thermal/intel/therm_throt.c | 22 ++++----
drivers/thermal/intel/x86_pkg_temp_thermal.c | 6 +--
drivers/video/fbdev/geode/display_gx.c | 8 +--
drivers/video/fbdev/geode/gxfb_core.c | 2 +-
drivers/video/fbdev/geode/lxfb_ops.c | 50 +++++++++----------
drivers/video/fbdev/geode/suspend_gx.c | 24 +++++----
drivers/video/fbdev/geode/video_gx.c | 8 +--
include/linux/cs5535.h | 10 ++--
138 files changed, 575 insertions(+), 694 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases
2026-09-11 7:45 [PATCH v3 00/13] x86/msr: Drop 32-bit MSR interfaces Juergen Gross
@ 2026-09-11 7:45 ` Juergen Gross
2026-09-11 13:20 ` Sean Christopherson
0 siblings, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2026-09-11 7:45 UTC (permalink / raw)
To: linux-kernel, x86, linux-perf-users, linux-hyperv, kvm,
linux-coco
Cc: Juergen Gross, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
Dexuan Cui, Long Li, Sean Christopherson, Paolo Bonzini,
Kiryl Shutsemau, Rick Edgecombe, Michael Kelley
After the conversion of rdmsrq() to an inline function some use cases
can be simplified by dropping an intermediate variable or by
eliminating the inline function completely.
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com> # Hyper-V
---
V3:
- eliminate KVM's read_msr() (Sean Christopherson)
---
arch/x86/events/amd/core.c | 6 +-----
arch/x86/events/amd/lbr.c | 12 ++----------
arch/x86/events/intel/core.c | 6 +-----
arch/x86/events/intel/cstate.c | 5 +----
arch/x86/events/intel/knc.c | 6 +-----
arch/x86/events/intel/lbr.c | 17 +++--------------
arch/x86/events/intel/uncore.c | 6 +-----
arch/x86/events/rapl.c | 4 +---
arch/x86/events/zhaoxin/core.c | 6 +-----
arch/x86/hyperv/hv_apic.c | 5 +----
arch/x86/include/asm/apic.h | 5 +----
arch/x86/include/asm/debugreg.h | 6 +-----
arch/x86/include/asm/kvm_host.h | 10 ----------
arch/x86/kvm/vmx/tdx.c | 2 +-
arch/x86/kvm/vmx/vmx.c | 6 +++---
15 files changed, 19 insertions(+), 83 deletions(-)
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 80ed49dba255..3d0e076c1636 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -660,12 +660,8 @@ static __always_inline void amd_pmu_set_global_ctl(u64 ctl)
static inline u64 amd_pmu_get_global_status(void)
{
- u64 status;
-
/* PerfCntrGlobalStatus is read-only */
- status = rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS);
}
static inline void amd_pmu_ack_global_status(u64 status)
diff --git a/arch/x86/events/amd/lbr.c b/arch/x86/events/amd/lbr.c
index 29628af6a023..1b4c0ef81485 100644
--- a/arch/x86/events/amd/lbr.c
+++ b/arch/x86/events/amd/lbr.c
@@ -74,20 +74,12 @@ static __always_inline void amd_pmu_lbr_set_to(unsigned int idx, u64 val)
static __always_inline u64 amd_pmu_lbr_get_from(unsigned int idx)
{
- u64 val;
-
- val = rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2);
-
- return val;
+ return rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2);
}
static __always_inline u64 amd_pmu_lbr_get_to(unsigned int idx)
{
- u64 val;
-
- val = rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2 + 1);
-
- return val;
+ return rdmsrq(MSR_AMD_SAMP_BR_FROM + idx * 2 + 1);
}
static __always_inline u64 sign_ext_branch_ip(u64 ip)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 41ae90b6bbdc..d19ac42b6e8c 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -2963,11 +2963,7 @@ static void intel_tfa_pmu_enable_all(int added)
static inline u64 intel_pmu_get_status(void)
{
- u64 status;
-
- status = rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
}
static inline void intel_pmu_ack_status(u64 ack)
diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 69eb6cf51d3b..c6d9146d8ec8 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -322,10 +322,7 @@ static int cstate_pmu_event_init(struct perf_event *event)
static inline u64 cstate_pmu_read_counter(struct perf_event *event)
{
- u64 val;
-
- val = rdmsrq(event->hw.event_base);
- return val;
+ return rdmsrq(event->hw.event_base);
}
static void cstate_pmu_event_update(struct perf_event *event)
diff --git a/arch/x86/events/intel/knc.c b/arch/x86/events/intel/knc.c
index c4f81215f758..a74caa8280be 100644
--- a/arch/x86/events/intel/knc.c
+++ b/arch/x86/events/intel/knc.c
@@ -199,11 +199,7 @@ static void knc_pmu_enable_event(struct perf_event *event)
static inline u64 knc_pmu_get_status(void)
{
- u64 status;
-
- status = rdmsrq(MSR_KNC_IA32_PERF_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_KNC_IA32_PERF_GLOBAL_STATUS);
}
static inline void knc_pmu_ack_status(u64 ack)
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index fc05ec3b9a99..70dae299627a 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -209,10 +209,7 @@ void intel_pmu_lbr_reset(void)
*/
static inline u64 intel_pmu_lbr_tos(void)
{
- u64 tos;
-
- tos = rdmsrq(x86_pmu.lbr_tos);
- return tos;
+ return rdmsrq(x86_pmu.lbr_tos);
}
enum {
@@ -311,26 +308,18 @@ static __always_inline u64 rdlbr_from(unsigned int idx, struct lbr_entry *lbr)
static __always_inline u64 rdlbr_to(unsigned int idx, struct lbr_entry *lbr)
{
- u64 val;
-
if (lbr)
return lbr->to;
- val = rdmsrq(x86_pmu.lbr_to + idx);
-
- return val;
+ return rdmsrq(x86_pmu.lbr_to + idx);
}
static __always_inline u64 rdlbr_info(unsigned int idx, struct lbr_entry *lbr)
{
- u64 val;
-
if (lbr)
return lbr->info;
- val = rdmsrq(x86_pmu.lbr_info + idx);
-
- return val;
+ return rdmsrq(x86_pmu.lbr_info + idx);
}
static inline void
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index ab2c5a962b31..cffbd780a435 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -169,11 +169,7 @@ struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu
u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event)
{
- u64 count;
-
- count = rdmsrq(event->hw.event_base);
-
- return count;
+ return rdmsrq(event->hw.event_base);
}
void uncore_mmio_exit_box(struct intel_uncore_box *box)
diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
index 180cc18282ca..2d2376c59816 100644
--- a/arch/x86/events/rapl.c
+++ b/arch/x86/events/rapl.c
@@ -192,9 +192,7 @@ static inline unsigned int get_rapl_pmu_idx(int cpu, int scope)
static inline u64 rapl_read_counter(struct perf_event *event)
{
- u64 raw;
- raw = rdmsrq(event->hw.event_base);
- return raw;
+ return rdmsrq(event->hw.event_base);
}
static inline u64 rapl_scale(u64 v, struct perf_event *event)
diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c
index 1980e5995e27..9203321c18b4 100644
--- a/arch/x86/events/zhaoxin/core.c
+++ b/arch/x86/events/zhaoxin/core.c
@@ -266,11 +266,7 @@ static void zhaoxin_pmu_enable_all(int added)
static inline u64 zhaoxin_pmu_get_status(void)
{
- u64 status;
-
- status = rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
-
- return status;
+ return rdmsrq(MSR_CORE_PERF_GLOBAL_STATUS);
}
static inline void zhaoxin_pmu_ack_status(u64 ack)
diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 4e30f9a11bc4..52ee8c237c2c 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -36,10 +36,7 @@ static struct apic orig_apic;
static u64 hv_apic_icr_read(void)
{
- u64 reg_val;
-
- reg_val = rdmsrq(HV_X64_MSR_ICR);
- return reg_val;
+ return rdmsrq(HV_X64_MSR_ICR);
}
static void hv_apic_icr_write(u32 low, u32 id)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index e028140fac49..993b52b52625 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -231,10 +231,7 @@ static inline void native_x2apic_icr_write(u32 low, u32 id)
static inline u64 native_x2apic_icr_read(void)
{
- unsigned long val;
-
- val = rdmsrq(APIC_BASE_MSR + (APIC_ICR >> 4));
- return val;
+ return rdmsrq(APIC_BASE_MSR + (APIC_ICR >> 4));
}
extern int x2apic_mode;
diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h
index 60a3df32a4d3..e00251c7eb12 100644
--- a/arch/x86/include/asm/debugreg.h
+++ b/arch/x86/include/asm/debugreg.h
@@ -174,15 +174,11 @@ static inline unsigned long amd_get_dr_addr_mask(unsigned int dr)
static inline unsigned long get_debugctlmsr(void)
{
- unsigned long debugctlmsr = 0;
-
#ifndef CONFIG_X86_DEBUGCTLMSR
if (boot_cpu_data.x86 < 6)
return 0;
#endif
- debugctlmsr = rdmsrq(MSR_IA32_DEBUGCTLMSR);
-
- return debugctlmsr;
+ return rdmsrq(MSR_IA32_DEBUGCTLMSR);
}
static inline void update_debugctlmsr(unsigned long debugctlmsr)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index b7887dccb829..3cf50e938099 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1857,16 +1857,6 @@ enum kvm_intr_type {
#define kvm_arch_has_readonly_mem(kvm) (!(kvm)->arch.has_protected_state)
-#ifdef CONFIG_X86_64
-static inline unsigned long read_msr(unsigned long msr)
-{
- u64 value;
-
- value = rdmsrq(msr);
- return value;
-}
-#endif
-
#define HF_GUEST_MASK (1 << 0) /* VCPU is in guest-mode */
#ifdef CONFIG_KVM_SMM
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index b272c20586a7..1bcecdb52d78 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -793,7 +793,7 @@ void tdx_prepare_switch_to_guest(struct kvm_vcpu *vcpu)
if (likely(is_64bit_mm(current->mm)))
vt->msr_host_kernel_gs_base = current->thread.gsbase;
else
- vt->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);
+ vt->msr_host_kernel_gs_base = rdmsrq(MSR_KERNEL_GS_BASE);
vt->guest_state_loaded = true;
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 2c8487bbda6a..faf5eabe37fe 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -1390,8 +1390,8 @@ void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu)
} else {
savesegment(fs, fs_sel);
savesegment(gs, gs_sel);
- fs_base = read_msr(MSR_FS_BASE);
- vt->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);
+ fs_base = rdmsrq(MSR_FS_BASE);
+ vt->msr_host_kernel_gs_base = rdmsrq(MSR_KERNEL_GS_BASE);
}
wrmsrq(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
@@ -1450,7 +1450,7 @@ static u64 vmx_read_guest_host_msr(struct vcpu_vmx *vmx, u32 msr, u64 *cache)
{
preempt_disable();
if (vmx->vt.guest_state_loaded)
- *cache = read_msr(msr);
+ *cache = rdmsrq(msr);
preempt_enable();
return *cache;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases
2026-09-11 7:45 ` [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
@ 2026-09-11 13:20 ` Sean Christopherson
0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2026-09-11 13:20 UTC (permalink / raw)
To: Juergen Gross
Cc: linux-kernel, x86, linux-perf-users, linux-hyperv, kvm,
linux-coco, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
Borislav Petkov, Dave Hansen, H. Peter Anvin, K. Y. Srinivasan,
Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li, Paolo Bonzini,
Kiryl Shutsemau, Rick Edgecombe, Michael Kelley
On Fri, Sep 11, 2026, Juergen Gross wrote:
> After the conversion of rdmsrq() to an inline function some use cases
> can be simplified by dropping an intermediate variable or by
> eliminating the inline function completely.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Michael Kelley <mhklinux@outlook.com> # Hyper-V
> ---
> V3:
> - eliminate KVM's read_msr() (Sean Christopherson)
Thank you!
Acked-by: Sean Christopherson <seanjc@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-12 6:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260819102314.1499258-14-jgross@suse.com>
2026-08-21 10:57 ` [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
2026-09-11 21:33 ` Shreshth Srivastava
2026-09-12 6:50 ` Jürgen Groß
2026-09-11 7:45 [PATCH v3 00/13] x86/msr: Drop 32-bit MSR interfaces Juergen Gross
2026-09-11 7:45 ` [PATCH v3 13/13] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
2026-09-11 13:20 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox