Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177754009
D61771.1795206912.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61771.1795206912.diff
View Options
diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c
--- a/sys/dev/hwpmc/hwpmc_core.c
+++ b/sys/dev/hwpmc/hwpmc_core.c
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <sys/bus.h>
+#include <sys/pcpu.h>
#include <sys/pmc.h>
#include <sys/pmckern.h>
#include <sys/smp.h>
@@ -104,6 +105,9 @@
static u_int pmc_alloc_refs;
static bool pmc_tsx_force_abort_set;
+/* Stray-NMI credits, as in hwpmc_amd.c. */
+DPCPU_DEFINE_STATIC(uint32_t, core_nmi_counter);
+
static int
core_pcpu_noop(struct pmc_mdep *md, int cpu)
{
@@ -1059,7 +1063,7 @@
static int
core2_intr(struct trapframe *tf)
{
- int error, found_interrupt = 0, n, cpu;
+ int claimed, error, found_interrupt = 0, n, cpu;
uint64_t flag, intrstatus, intrdisable = 0;
struct pmc *pm;
struct core_cpu *cc;
@@ -1144,6 +1148,20 @@
wrmsr(core_iap_wroffset + IAP_PMC0 + n, v);
}
+ /*
+ * A PMI raised while this handler runs can latch a second NMI
+ * whose status bits were already acked here. Claim one empty
+ * NMI per serviced PMI so it does not hit machdep.panic_on_nmi.
+ */
+ claimed = 0;
+ if (found_interrupt) {
+ DPCPU_SET(core_nmi_counter, 1);
+ claimed = 1;
+ } else if (DPCPU_GET(core_nmi_counter) != 0) {
+ DPCPU_SET(core_nmi_counter, 0);
+ claimed = 1;
+ }
+
if (found_interrupt)
counter_u64_add(pmc_stats.pm_intr_processed, 1);
else
@@ -1172,7 +1190,7 @@
(uintmax_t) rdmsr(IA_GLOBAL_CTRL),
(uintmax_t) rdmsr(IA_GLOBAL_STATUS));
- return (found_interrupt);
+ return (claimed);
}
int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 20, 8:35 PM (16 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41874879
Default Alt Text
D61771.1795206912.diff (1 KB)
Attached To
Mode
D61771: hwpmc: claim stray PMI NMIs on Intel
Attached
Detach File
Event Timeline