From: Peter Zijlstra <peterz@infradead.org>
To: x86@kernel.org, kan.liang@linux.intel.com, eranian@google.com,
ravi.bangoria@amd.com
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
acme@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
namhyung@kernel.org
Subject: [PATCH v2 8/9] perf/x86/intel: Shadow MSR_ARCH_PERFMON_FIXED_CTR_CTRL
Date: Mon, 29 Aug 2022 12:10:07 +0200 [thread overview]
Message-ID: <20220829101321.905673933@infradead.org> (raw)
In-Reply-To: 20220829100959.917169441@infradead.org
Less RDMSR is more better.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/events/intel/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -2405,6 +2405,8 @@ static inline void intel_clear_masks(str
__clear_bit(idx, (unsigned long *)&cpuc->intel_cp_status);
}
+static DEFINE_PER_CPU(u64, intel_fixed_ctrl);
+
static void intel_pmu_disable_fixed(struct perf_event *event)
{
struct hw_perf_event *hwc = &event->hw;
@@ -2426,8 +2428,9 @@ static void intel_pmu_disable_fixed(stru
intel_clear_masks(event, idx);
mask = 0xfULL << ((idx - INTEL_PMC_IDX_FIXED) * 4);
- rdmsrl(hwc->config_base, ctrl_val);
+ ctrl_val = this_cpu_read(intel_fixed_ctrl);
ctrl_val &= ~mask;
+ this_cpu_write(intel_fixed_ctrl, ctrl_val);
wrmsrl(hwc->config_base, ctrl_val);
}
@@ -2746,9 +2749,10 @@ static void intel_pmu_enable_fixed(struc
mask |= ICL_FIXED_0_ADAPTIVE << (idx * 4);
}
- rdmsrl(hwc->config_base, ctrl_val);
+ ctrl_val = this_cpu_read(intel_fixed_ctrl);
ctrl_val &= ~mask;
ctrl_val |= bits;
+ this_cpu_write(intel_fixed_ctrl, ctrl_val);
wrmsrl(hwc->config_base, ctrl_val);
}
next prev parent reply other threads:[~2022-08-29 10:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-29 10:09 [PATCH v2 0/9] perf/x86: Some cleanups Peter Zijlstra
2022-08-29 10:10 ` [PATCH v2 1/9] perf/x86: Add two more x86_pmu methods Peter Zijlstra
2022-09-09 8:52 ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2022-08-29 10:10 ` [PATCH v2 2/9] perf/x86/intel: Move the topdown stuff into the intel driver Peter Zijlstra
2022-08-31 13:41 ` Liang, Kan
2022-09-01 9:06 ` Peter Zijlstra
2022-09-09 8:52 ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2022-08-29 10:10 ` [PATCH v2 3/9] perf/x86: Change x86_pmu::limit_period signature Peter Zijlstra
2022-09-09 8:52 ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2022-08-29 10:10 ` [PATCH v2 4/9] perf/x86: Add a x86_pmu::limit_period static_call Peter Zijlstra
2022-09-09 8:52 ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2022-08-29 10:10 ` [PATCH v2 5/9] perf/x86/intel: Remove x86_pmu::set_topdown_event_period Peter Zijlstra
2022-09-09 8:52 ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2022-08-29 10:10 ` [PATCH v2 6/9] perf/x86/intel: Remove x86_pmu::update_topdown_event Peter Zijlstra
2022-09-09 8:52 ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2022-08-29 10:10 ` [PATCH v2 7/9] perf/x86/p4: Remove perfctr_second_write quirk Peter Zijlstra
2022-09-09 8:52 ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2022-08-29 10:10 ` Peter Zijlstra [this message]
2022-08-31 13:52 ` [PATCH v2 8/9] perf/x86/intel: Shadow MSR_ARCH_PERFMON_FIXED_CTR_CTRL Liang, Kan
2022-09-01 9:10 ` Peter Zijlstra
2022-09-01 10:04 ` Peter Zijlstra
2022-09-01 11:37 ` Liang, Kan
2022-08-29 10:10 ` [PATCH v2 9/9] perf/x86/intel: Optimize short PEBS counters Peter Zijlstra
2022-08-29 15:55 ` Liang, Kan
2022-08-29 21:12 ` Peter Zijlstra
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=20220829101321.905673933@infradead.org \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=namhyung@kernel.org \
--cc=ravi.bangoria@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.