lkml.org 
[lkml]   [2013]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH v8 2/3] trace,x86: add x86 irq vector tracepoints
From
Date
On Mon, 2013-01-21 at 22:14 +0000, Seiji Aguchi wrote:

> +void trace_irq_vector_regfunc(void)
> +{
> + if (!trace_irq_vector_refcount) {
> + smp_call_function(switch_to_trace_idt, NULL, 0);
> + local_irq_disable();
> + switch_to_trace_idt(NULL);
> + local_irq_enable();
> + }
> + trace_irq_vector_refcount++;
> +}
> +
> +void trace_irq_vector_unregfunc(void)
> +{
> + trace_irq_vector_refcount--;
> + if (!trace_irq_vector_refcount) {
> + smp_call_function(restore_original_idt, NULL, 0);
> + local_irq_disable();
> + restore_original_idt(NULL);
> + local_irq_enable();
> + }
> +}
> +

What protection do these functions have? I mean, the reg functions of a
TRACE_EVENT() can be initiated by perf and ftrace at he same time, as
well as LTTng (if someone adds it). The tracepoint itself may have
protection, but all the tracepoints you created use the same reg
functions, and they are not protected from each other.

You need to add a mutex around these, like:

static DEFINE_MUTEX(irq_reg_mutex);

void trace_irq_vector_regfunc(void)
{
mutex_lock(&irq_reg_mutex);
if (!trace_irq_vector_refcount) {
smp_call_function(switch_to_trace_idt, NULL, 0);
local_irq_disable();
switch_to_trace_idt(NULL);
local_irq_enable();
}
trace_irq_vector_refcount++;
mutex_unlock(&irq_reg_mutex);
}

and the same for the trace_irq_vector_unregfunc().

-- Steve




\
 
 \ /
  Last update: 2013-02-01 04:21    [W:0.126 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site