|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/vpmu: Simplify is_pmc_quirk
commit 6c32a08e2b7e6d796081ed84c84ad682bcc4b3a6
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jun 20 17:36:19 2023 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jun 28 15:59:34 2023 +0100
x86/vpmu: Simplify is_pmc_quirk
This should be static, and there's no need for a separate (non-init, even)
function to perform a simple equality test. Drop the is_ prefix which is
gramatically questionable, and make it __ro_after_init.
Leave a TODO, because the behaviour is definitely wrong to be applied to all
modern Intel CPUs. The question has been raised on xen-devel previously
without conclusion.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/cpu/vpmu_intel.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 35e350578b..bda5d511ac 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -91,22 +91,14 @@ static const unsigned int regs_off =
* 1 (or another value != 0) into it.
* There exist no errata and the real cause of this behaviour is unknown.
*/
-bool_t __read_mostly is_pmc_quirk;
-
-static void check_pmc_quirk(void)
-{
- if ( current_cpu_data.x86 == 6 )
- is_pmc_quirk = 1;
- else
- is_pmc_quirk = 0;
-}
+static bool __ro_after_init pmc_quirk;
static void handle_pmc_quirk(u64 msr_content)
{
int i;
u64 val;
- if ( !is_pmc_quirk )
+ if ( !pmc_quirk )
return;
val = msr_content;
@@ -791,8 +783,9 @@ static int cf_check core2_vpmu_do_interrupt(struct
cpu_user_regs *regs)
rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, msr_content);
if ( msr_content )
{
- if ( is_pmc_quirk )
+ if ( pmc_quirk )
handle_pmc_quirk(msr_content);
+
core2_vpmu_cxt->global_status |= msr_content;
msr_content &= ~global_ovf_ctrl_mask;
wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, msr_content);
@@ -967,7 +960,8 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
sizeof(uint64_t) * fixed_pmc_cnt +
sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt;
- check_pmc_quirk();
+ /* TODO: It's clearly incorrect for this to quirk all Intel Fam6 CPUs. */
+ pmc_quirk = current_cpu_data.x86 == 6;
if ( sizeof(struct xen_pmu_data) + sizeof(uint64_t) * fixed_pmc_cnt +
sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt > PAGE_SIZE )
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |