From: Dapeng Mi <dapeng1.mi@linux.intel.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Jim Mattson <jmattson@google.com>,
Mingwei Zhang <mizhang@google.com>,
Zide Chen <zide.chen@intel.com>,
Das Sandipan <Sandipan.Das@amd.com>,
Shukla Manali <Manali.Shukla@amd.com>,
Dapeng Mi <dapeng1.mi@intel.com>,
Dapeng Mi <dapeng1.mi@linux.intel.com>
Subject: [PATCH] x86/pmu_pebs: Initalize and enable PMU interrupt (PMI_VECTOR)
Date: Thu, 24 Apr 2025 05:22:01 +0000 [thread overview]
Message-ID: <20250424052201.7194-1-dapeng1.mi@linux.intel.com> (raw)
PMU interrupt is not correctly initialized and enabled in pmu_pebs test.
It leads to the APIC_LVTPC mask bit is never cleared after first PMI and
all subsequential PEBS PMIs are suppressed.
Although it doesn't impact pmu_pebs test results since current pmu_pebs
test checks PEBS records by polling instead of PMI driving, it's still an
incorrect behavior and could cause some unexpected false positives.
Thus initialize and enable PMU interrupt and ensure PEBS PMI can be
generated and correctly processed.
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
---
x86/pmu_pebs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/x86/pmu_pebs.c b/x86/pmu_pebs.c
index 6396d51c..6e73fc34 100644
--- a/x86/pmu_pebs.c
+++ b/x86/pmu_pebs.c
@@ -417,9 +417,11 @@ int main(int ac, char **av)
printf("PEBS Fixed counters: %d\n", pmu.nr_fixed_counters);
printf("PEBS baseline (Adaptive PEBS): %d\n", has_baseline);
+ apic_write(APIC_LVTPC, PMI_VECTOR);
handle_irq(PMI_VECTOR, cnt_overflow);
alloc_buffers();
+ sti();
for (i = 0; i < ARRAY_SIZE(counter_start_values); i++) {
ctr_start_val = counter_start_values[i];
check_pebs_counters(0, false);
@@ -441,6 +443,7 @@ int main(int ac, char **av)
report_prefix_pop();
}
}
+ cli();
free_buffers();
base-commit: abdc5d02a7796a55802509ac9bb704c721f2a5f6
--
2.40.1
next reply other threads:[~2025-04-24 3:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 5:22 Dapeng Mi [this message]
2025-06-10 19:42 ` [PATCH] x86/pmu_pebs: Initalize and enable PMU interrupt (PMI_VECTOR) 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=20250424052201.7194-1-dapeng1.mi@linux.intel.com \
--to=dapeng1.mi@linux.intel.com \
--cc=Manali.Shukla@amd.com \
--cc=Sandipan.Das@amd.com \
--cc=dapeng1.mi@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=zide.chen@intel.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