diff options
Diffstat (limited to 'kernel/trace/trace_irqsoff.c')
-rw-r--r-- | kernel/trace/trace_irqsoff.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 9c74071c10e0..a87a20fa3fc6 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -353,15 +353,28 @@ void trace_preempt_off(unsigned long a0, unsigned long a1) | |||
353 | } | 353 | } |
354 | #endif /* CONFIG_PREEMPT_TRACER */ | 354 | #endif /* CONFIG_PREEMPT_TRACER */ |
355 | 355 | ||
356 | /* | ||
357 | * save_tracer_enabled is used to save the state of the tracer_enabled | ||
358 | * variable when we disable it when we open a trace output file. | ||
359 | */ | ||
360 | static int save_tracer_enabled; | ||
361 | |||
356 | static void start_irqsoff_tracer(struct trace_array *tr) | 362 | static void start_irqsoff_tracer(struct trace_array *tr) |
357 | { | 363 | { |
358 | register_ftrace_function(&trace_ops); | 364 | register_ftrace_function(&trace_ops); |
359 | tracer_enabled = 1; | 365 | if (tracing_is_enabled()) { |
366 | tracer_enabled = 1; | ||
367 | save_tracer_enabled = 1; | ||
368 | } else { | ||
369 | tracer_enabled = 0; | ||
370 | save_tracer_enabled = 0; | ||
371 | } | ||
360 | } | 372 | } |
361 | 373 | ||
362 | static void stop_irqsoff_tracer(struct trace_array *tr) | 374 | static void stop_irqsoff_tracer(struct trace_array *tr) |
363 | { | 375 | { |
364 | tracer_enabled = 0; | 376 | tracer_enabled = 0; |
377 | save_tracer_enabled = 0; | ||
365 | unregister_ftrace_function(&trace_ops); | 378 | unregister_ftrace_function(&trace_ops); |
366 | } | 379 | } |
367 | 380 | ||
@@ -389,17 +402,29 @@ static void irqsoff_tracer_ctrl_update(struct trace_array *tr) | |||
389 | stop_irqsoff_tracer(tr); | 402 | stop_irqsoff_tracer(tr); |
390 | } | 403 | } |
391 | 404 | ||
405 | static void irqsoff_tracer_start(struct trace_array *tr) | ||
406 | { | ||
407 | irqsoff_tracer_reset(tr); | ||
408 | tracer_enabled = 1; | ||
409 | save_tracer_enabled = 1; | ||
410 | } | ||
411 | |||
412 | static void irqsoff_tracer_stop(struct trace_array *tr) | ||
413 | { | ||
414 | tracer_enabled = 0; | ||
415 | save_tracer_enabled = 0; | ||
416 | } | ||
417 | |||
392 | static void irqsoff_tracer_open(struct trace_iterator *iter) | 418 | static void irqsoff_tracer_open(struct trace_iterator *iter) |
393 | { | 419 | { |
394 | /* stop the trace while dumping */ | 420 | /* stop the trace while dumping */ |
395 | if (iter->tr->ctrl) | 421 | tracer_enabled = 0; |
396 | stop_irqsoff_tracer(iter->tr); | ||
397 | } | 422 | } |
398 | 423 | ||
399 | static void irqsoff_tracer_close(struct trace_iterator *iter) | 424 | static void irqsoff_tracer_close(struct trace_iterator *iter) |
400 | { | 425 | { |
401 | if (iter->tr->ctrl) | 426 | /* restart tracing */ |
402 | start_irqsoff_tracer(iter->tr); | 427 | tracer_enabled = save_tracer_enabled; |
403 | } | 428 | } |
404 | 429 | ||
405 | #ifdef CONFIG_IRQSOFF_TRACER | 430 | #ifdef CONFIG_IRQSOFF_TRACER |
@@ -414,6 +439,8 @@ static struct tracer irqsoff_tracer __read_mostly = | |||
414 | .name = "irqsoff", | 439 | .name = "irqsoff", |
415 | .init = irqsoff_tracer_init, | 440 | .init = irqsoff_tracer_init, |
416 | .reset = irqsoff_tracer_reset, | 441 | .reset = irqsoff_tracer_reset, |
442 | .start = irqsoff_tracer_start, | ||
443 | .stop = irqsoff_tracer_stop, | ||
417 | .open = irqsoff_tracer_open, | 444 | .open = irqsoff_tracer_open, |
418 | .close = irqsoff_tracer_close, | 445 | .close = irqsoff_tracer_close, |
419 | .ctrl_update = irqsoff_tracer_ctrl_update, | 446 | .ctrl_update = irqsoff_tracer_ctrl_update, |
@@ -440,6 +467,8 @@ static struct tracer preemptoff_tracer __read_mostly = | |||
440 | .name = "preemptoff", | 467 | .name = "preemptoff", |
441 | .init = preemptoff_tracer_init, | 468 | .init = preemptoff_tracer_init, |
442 | .reset = irqsoff_tracer_reset, | 469 | .reset = irqsoff_tracer_reset, |
470 | .start = irqsoff_tracer_start, | ||
471 | .stop = irqsoff_tracer_stop, | ||
443 | .open = irqsoff_tracer_open, | 472 | .open = irqsoff_tracer_open, |
444 | .close = irqsoff_tracer_close, | 473 | .close = irqsoff_tracer_close, |
445 | .ctrl_update = irqsoff_tracer_ctrl_update, | 474 | .ctrl_update = irqsoff_tracer_ctrl_update, |
@@ -468,6 +497,8 @@ static struct tracer preemptirqsoff_tracer __read_mostly = | |||
468 | .name = "preemptirqsoff", | 497 | .name = "preemptirqsoff", |
469 | .init = preemptirqsoff_tracer_init, | 498 | .init = preemptirqsoff_tracer_init, |
470 | .reset = irqsoff_tracer_reset, | 499 | .reset = irqsoff_tracer_reset, |
500 | .start = irqsoff_tracer_start, | ||
501 | .stop = irqsoff_tracer_stop, | ||
471 | .open = irqsoff_tracer_open, | 502 | .open = irqsoff_tracer_open, |
472 | .close = irqsoff_tracer_close, | 503 | .close = irqsoff_tracer_close, |
473 | .ctrl_update = irqsoff_tracer_ctrl_update, | 504 | .ctrl_update = irqsoff_tracer_ctrl_update, |