Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, nmi: Track NMI usage stats

Now that the NMI handler are broken into lists, increment the appropriate
stats for each list. This allows us to see what is going on when they
get printed out in the next patch.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1317409584-23662-6-git-send-email-dzickus@redhat.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Don Zickus and committed by
Ingo Molnar
efc3aac5 b227e233

+18 -2
+18 -2
arch/x86/kernel/nmi.c
··· 53 53 54 54 }; 55 55 56 + struct nmi_stats { 57 + unsigned int normal; 58 + unsigned int unknown; 59 + unsigned int external; 60 + unsigned int swallow; 61 + }; 62 + 63 + static DEFINE_PER_CPU(struct nmi_stats, nmi_stats); 64 + 56 65 static int ignore_nmis; 57 66 58 67 int unknown_nmi_panic; ··· 271 262 * if it caused the NMI) 272 263 */ 273 264 handled = nmi_handle(NMI_UNKNOWN, regs, false); 274 - if (handled) 265 + if (handled) { 266 + __this_cpu_add(nmi_stats.unknown, handled); 275 267 return; 268 + } 269 + 270 + __this_cpu_add(nmi_stats.unknown, 1); 271 + 276 272 #ifdef CONFIG_MCA 277 273 /* 278 274 * Might actually be able to figure out what the guilty party ··· 328 314 __this_cpu_write(last_nmi_rip, regs->ip); 329 315 330 316 handled = nmi_handle(NMI_LOCAL, regs, b2b); 317 + __this_cpu_add(nmi_stats.normal, handled); 331 318 if (handled) { 332 319 /* 333 320 * There are cases when a NMI handler handles multiple ··· 359 344 */ 360 345 reassert_nmi(); 361 346 #endif 347 + __this_cpu_add(nmi_stats.external, 1); 362 348 raw_spin_unlock(&nmi_reason_lock); 363 349 return; 364 350 } ··· 396 380 * for now. 397 381 */ 398 382 if (b2b && __this_cpu_read(swallow_nmi)) 399 - ; 383 + __this_cpu_add(nmi_stats.swallow, 1); 400 384 else 401 385 unknown_nmi_error(reason, regs); 402 386 }