From: Peter Zijlstra <peterz@infradead.org>
To: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>,
Eranian Stephane <eranian@google.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Dapeng Mi <dapeng1.mi@intel.com>
Subject: Re: [Patch v4 09/13] perf/x86/intel: Setup PEBS data configuration and enable legacy groups
Date: Sat, 21 Jun 2025 11:34:37 +0200 [thread overview]
Message-ID: <20250621093437.GV1613376@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250620103909.1586595-10-dapeng1.mi@linux.intel.com>
On Fri, Jun 20, 2025 at 10:39:05AM +0000, Dapeng Mi wrote:
> +static void intel_pmu_enable_event_ext(struct perf_event *event)
> +{
> + struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> + struct hw_perf_event *hwc = &event->hw;
> + union arch_pebs_index cached, index;
> + struct arch_pebs_cap cap;
> + u64 ext = 0;
> +
> + if (!x86_pmu.arch_pebs)
> + return;
> +
> + cap = hybrid(cpuc->pmu, arch_pebs_cap);
> +
> + if (event->attr.precise_ip) {
> + u64 pebs_data_cfg = intel_get_arch_pebs_data_config(event);
> +
> + ext |= ARCH_PEBS_EN;
> + if (hwc->flags & PERF_X86_EVENT_AUTO_RELOAD)
> + ext |= (-hwc->sample_period) & ARCH_PEBS_RELOAD;
> +
> + if (pebs_data_cfg && cap.caps) {
> + if (pebs_data_cfg & PEBS_DATACFG_MEMINFO)
> + ext |= ARCH_PEBS_AUX & cap.caps;
> +
> + if (pebs_data_cfg & PEBS_DATACFG_GP)
> + ext |= ARCH_PEBS_GPR & cap.caps;
> +
> + if (pebs_data_cfg & PEBS_DATACFG_XMMS)
> + ext |= ARCH_PEBS_VECR_XMM & cap.caps;
> +
> + if (pebs_data_cfg & PEBS_DATACFG_LBRS)
> + ext |= ARCH_PEBS_LBR & cap.caps;
> + }
> +
> + if (cpuc->n_pebs == cpuc->n_large_pebs)
> + index.split.thresh = ARCH_PEBS_THRESH_MUL;
> + else
> + index.split.thresh = ARCH_PEBS_THRESH_SINGLE;
> +
> + rdmsrl(MSR_IA32_PEBS_INDEX, cached.full);
Its unclear to me we need this rdmrsl(); does anything actually change
in there or is it just the value we wrote last? The naming seems to
suggested you want it cached instead of re-read. Most confusing.
Also, if you do:
union arch_perf_index {
u64 full;
struct {
u64 foo:1,
bar:2;
};
};
Then you can get rid of that .split naming.
> + if (index.split.thresh != cached.split.thresh || !cached.split.en) {
> + if (cached.split.thresh == ARCH_PEBS_THRESH_MUL &&
> + cached.split.wr > 0) {
> + /*
> + * Large PEBS was enabled.
> + * Drain PEBS buffer before applying the single PEBS.
> + */
> + intel_pmu_drain_pebs_buffer();
> + } else {
> + index.split.wr = 0;
> + index.split.full = 0;
> + index.split.en = 1;
> + wrmsrq(MSR_IA32_PEBS_INDEX, index.full);
> + }
> + }
> + }
> +
> + if (cpuc->cfg_c_val[hwc->idx] != ext)
> + __intel_pmu_update_event_ext(hwc->idx, ext);
> +}
next prev parent reply other threads:[~2025-06-21 9:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 10:38 [Patch v4 00/13] arch-PEBS enabling for Intel platforms Dapeng Mi
2025-06-20 10:38 ` [Patch v4 01/13] perf/x86/intel: Replace x86_pmu.drain_pebs calling with static call Dapeng Mi
2025-06-20 10:38 ` [Patch v4 02/13] perf/x86/intel: Correct large PEBS flag check Dapeng Mi
2025-06-20 10:38 ` [Patch v4 03/13] perf/x86/intel: Initialize architectural PEBS Dapeng Mi
2025-06-20 10:39 ` [Patch v4 04/13] perf/x86/intel/ds: Factor out PEBS record processing code to functions Dapeng Mi
2025-06-20 10:39 ` [Patch v4 05/13] perf/x86/intel/ds: Factor out PEBS group " Dapeng Mi
2025-06-20 10:39 ` [Patch v4 06/13] perf/x86/intel: Process arch-PEBS records or record fragments Dapeng Mi
2025-06-20 10:39 ` [Patch v4 07/13] perf/x86/intel: Allocate arch-PEBS buffer and initialize PEBS_BASE MSR Dapeng Mi
2025-06-21 9:20 ` Peter Zijlstra
2025-06-23 1:17 ` Mi, Dapeng
2025-06-23 7:28 ` Peter Zijlstra
2025-06-23 8:41 ` Mi, Dapeng
2025-06-20 10:39 ` [Patch v4 08/13] perf/x86/intel: Update dyn_constranit base on PEBS event precise level Dapeng Mi
2025-06-20 10:39 ` [Patch v4 09/13] perf/x86/intel: Setup PEBS data configuration and enable legacy groups Dapeng Mi
2025-06-21 9:27 ` Peter Zijlstra
2025-06-23 1:20 ` Mi, Dapeng
2025-06-21 9:34 ` Peter Zijlstra [this message]
2025-06-23 1:38 ` Mi, Dapeng
2025-06-21 9:36 ` Peter Zijlstra
2025-06-23 1:39 ` Mi, Dapeng
2025-06-21 9:41 ` Peter Zijlstra
2025-06-23 1:55 ` Mi, Dapeng
2025-06-21 9:43 ` Peter Zijlstra
2025-06-23 1:55 ` Mi, Dapeng
2025-06-20 10:39 ` [Patch v4 10/13] perf/x86/intel: Add counter group support for arch-PEBS Dapeng Mi
2025-06-20 10:39 ` [Patch v4 11/13] perf/x86: Support to sample SSP register Dapeng Mi
2025-06-20 10:39 ` [Patch v4 12/13] perf/x86/intel: Support to sample SSP register for arch-PEBS Dapeng Mi
2025-06-20 10:39 ` [Patch v4 13/13] perf tools: x86: Support to show SSP register Dapeng Mi
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=20250621093437.GV1613376@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dapeng1.mi@intel.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@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 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®