aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/mmiotrace/mmio-mod.c
diff options
context:
space:
mode:
authorPekka Paalanen <pq@iki.fi>2008-05-12 15:20:56 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-24 05:21:39 -0400
commitfe1ffafa80f6673101c6560c2bacfe3df10372ee (patch)
tree15391f0e992a4b149270a12fc861dd5353980318 /arch/x86/kernel/mmiotrace/mmio-mod.c
parent75bb88350e0501b3cf5ac096a1008757844414a9 (diff)
x86 mmiotrace: fix relay-buffer-full flag for SMP
Relay has per-cpu buffers, but mmiotrace was using only a single flag for detecting buffer full/not-full transitions. The new code makes this per-cpu and actually counts missed events. Signed-off-by: Pekka Paalanen <pq@iki.fi> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/mmiotrace/mmio-mod.c')
-rw-r--r--arch/x86/kernel/mmiotrace/mmio-mod.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/kernel/mmiotrace/mmio-mod.c b/arch/x86/kernel/mmiotrace/mmio-mod.c
index e43947d218a5..0019dcdf6158 100644
--- a/arch/x86/kernel/mmiotrace/mmio-mod.c
+++ b/arch/x86/kernel/mmiotrace/mmio-mod.c
@@ -29,6 +29,7 @@
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <linux/mmiotrace.h> 30#include <linux/mmiotrace.h>
31#include <asm/e820.h> /* for ISA_START_ADDRESS */ 31#include <asm/e820.h> /* for ISA_START_ADDRESS */
32#include <asm/atomic.h>
32 33
33#include "kmmio.h" 34#include "kmmio.h"
34#include "pf_in.h" 35#include "pf_in.h"
@@ -47,9 +48,13 @@ struct trap_reason {
47 int active_traces; 48 int active_traces;
48}; 49};
49 50
51/* Accessed per-cpu. */
50static struct trap_reason pf_reason[NR_CPUS]; 52static struct trap_reason pf_reason[NR_CPUS];
51static struct mm_io_header_rw cpu_trace[NR_CPUS]; 53static struct mm_io_header_rw cpu_trace[NR_CPUS];
52 54
55/* Access to this is not per-cpu. */
56static atomic_t dropped[NR_CPUS];
57
53static struct file_operations mmio_fops = { 58static struct file_operations mmio_fops = {
54 .owner = THIS_MODULE, 59 .owner = THIS_MODULE,
55}; 60};
@@ -57,7 +62,6 @@ static struct file_operations mmio_fops = {
57static const size_t subbuf_size = 256*1024; 62static const size_t subbuf_size = 256*1024;
58static struct rchan *chan; 63static struct rchan *chan;
59static struct dentry *dir; 64static struct dentry *dir;
60static int suspended; /* XXX should this be per cpu? */
61static struct proc_dir_entry *proc_marker_file; 65static struct proc_dir_entry *proc_marker_file;
62 66
63/* module parameters */ 67/* module parameters */
@@ -269,19 +273,21 @@ static void post(struct kmmio_probe *p, unsigned long condition,
269static int subbuf_start_handler(struct rchan_buf *buf, void *subbuf, 273static int subbuf_start_handler(struct rchan_buf *buf, void *subbuf,
270 void *prev_subbuf, size_t prev_padding) 274 void *prev_subbuf, size_t prev_padding)
271{ 275{
276 unsigned int cpu = buf->cpu;
277 atomic_t *drop = &dropped[cpu];
278 int count;
272 if (relay_buf_full(buf)) { 279 if (relay_buf_full(buf)) {
273 if (!suspended) { 280 if (atomic_inc_return(drop) == 1) {
274 suspended = 1; 281 printk(KERN_ERR MODULE_NAME ": cpu %d buffer full!\n",
275 printk(KERN_ERR MODULE_NAME 282 cpu);
276 ": cpu %d buffer full!!!\n",
277 smp_processor_id());
278 } 283 }
279 return 0; 284 return 0;
280 } else if (suspended) { 285 } else if ((count = atomic_read(drop))) {
281 suspended = 0;
282 printk(KERN_ERR MODULE_NAME 286 printk(KERN_ERR MODULE_NAME
283 ": cpu %d buffer no longer full.\n", 287 ": cpu %d buffer no longer full, "
284 smp_processor_id()); 288 "missed %d events.\n",
289 cpu, count);
290 atomic_sub(count, drop);
285 } 291 }
286 292
287 return 1; 293 return 1;