Messages in this thread | | | Subject | Re: [PATCH] perf, x86: try to handle unknown nmis with running perfctrs | From | Huang Ying <> | Date | Wed, 11 Aug 2010 11:19:39 +0800 |
| |
On Wed, 2010-08-11 at 04:48 +0800, Don Zickus wrote: > > From d2739578199d881ae6a9537c1b96a0efd1cdea43 Mon Sep 17 00:00:00 2001 > > From: Robert Richter <robert.richter@amd.com> > > Date: Thu, 5 Aug 2010 16:19:59 +0200 > > Subject: [PATCH] perf, x86: try to handle unknown nmis with running perfctrs > > On top of Robert's patch: > (compiled tested only because I don't have a fancy button to trigger > unknown nmis)
You can trigger unknown NMIs via apic->send_IPI_mask(cpu_mask, NMI_VECTOR).
How about the algorithm as follow:
int perf_event_nmi_handler() { ... switch (cmd) { case DIE_NMIUNKNOWN: if (per_cpu(perfctr_prev_handled) > 1 && rdtsc() - per_cpu(perfctr_handled_timestamp) < 1000) return NOTIFY_STOP; else return NOTIFY_DONE; } ... handled = x86_pmu.handle_irq(regs); per_cpu(perfctr_prev_handled) = per_cpu(perfctr_handled); per_cpu(perfctr_handled) = handled; if (handled) { per_cpu(perfctr_handled_timestamp) = rdtsc(); return NOTIFY_STOP; } else return NOTIFY_DONE; }
Best Regards, Huang Ying
| |