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

locking, oprofile: Annotate oprofilefs lock as raw

The oprofilefs_lock can be taken in atomic context (in profiling
interrupts) and therefore cannot cannot be preempted on -rt -
annotate it.

In mainline this change documents the low level nature of
the lock - otherwise there's no functional difference. Lockdep
and Sparse checking will work as usual.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Thomas Gleixner and committed by
Ingo Molnar
2d21a29f 6b2c1800

+10 -10
+2 -2
arch/x86/oprofile/nmi_int.c
··· 355 355 int cpu = smp_processor_id(); 356 356 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu); 357 357 nmi_cpu_save_registers(msrs); 358 - spin_lock(&oprofilefs_lock); 358 + raw_spin_lock(&oprofilefs_lock); 359 359 model->setup_ctrs(model, msrs); 360 360 nmi_cpu_setup_mux(cpu, msrs); 361 - spin_unlock(&oprofilefs_lock); 361 + raw_spin_unlock(&oprofilefs_lock); 362 362 per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC); 363 363 apic_write(APIC_LVTPC, APIC_DM_NMI); 364 364 }
+2 -2
drivers/oprofile/event_buffer.c
··· 82 82 { 83 83 unsigned long flags; 84 84 85 - spin_lock_irqsave(&oprofilefs_lock, flags); 85 + raw_spin_lock_irqsave(&oprofilefs_lock, flags); 86 86 buffer_size = oprofile_buffer_size; 87 87 buffer_watershed = oprofile_buffer_watershed; 88 - spin_unlock_irqrestore(&oprofilefs_lock, flags); 88 + raw_spin_unlock_irqrestore(&oprofilefs_lock, flags); 89 89 90 90 if (buffer_watershed >= buffer_size) 91 91 return -EINVAL;
+2 -2
drivers/oprofile/oprofile_perf.c
··· 160 160 161 161 static int oprofile_perf_setup(void) 162 162 { 163 - spin_lock(&oprofilefs_lock); 163 + raw_spin_lock(&oprofilefs_lock); 164 164 op_perf_setup(); 165 - spin_unlock(&oprofilefs_lock); 165 + raw_spin_unlock(&oprofilefs_lock); 166 166 return 0; 167 167 } 168 168
+3 -3
drivers/oprofile/oprofilefs.c
··· 21 21 22 22 #define OPROFILEFS_MAGIC 0x6f70726f 23 23 24 - DEFINE_SPINLOCK(oprofilefs_lock); 24 + DEFINE_RAW_SPINLOCK(oprofilefs_lock); 25 25 26 26 static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode) 27 27 { ··· 76 76 if (copy_from_user(tmpbuf, buf, count)) 77 77 return -EFAULT; 78 78 79 - spin_lock_irqsave(&oprofilefs_lock, flags); 79 + raw_spin_lock_irqsave(&oprofilefs_lock, flags); 80 80 *val = simple_strtoul(tmpbuf, NULL, 0); 81 - spin_unlock_irqrestore(&oprofilefs_lock, flags); 81 + raw_spin_unlock_irqrestore(&oprofilefs_lock, flags); 82 82 return 0; 83 83 } 84 84
+1 -1
include/linux/oprofile.h
··· 166 166 int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count); 167 167 168 168 /** lock for read/write safety */ 169 - extern spinlock_t oprofilefs_lock; 169 + extern raw_spinlock_t oprofilefs_lock; 170 170 171 171 /** 172 172 * Add the contents of a circular buffer to the event buffer.