Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146123
b: refs/heads/master
c: 8d99b3a
h: refs/heads/master
i:
  146121: 6530f73
  146119: 3b80db9
v: v3
  • Loading branch information
Markus Metzger authored and Ingo Molnar committed Apr 7, 2009
1 parent 4d3f384 commit dc4fa8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e2b371f00a6f529f6362654239bdec8dcd510760
refs/heads/master: 8d99b3ac2726e5edd97ad147fa5c1f2acb63a745
23 changes: 19 additions & 4 deletions trunk/arch/x86/kernel/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ static inline struct ds_context *ds_get_context(struct task_struct *task)

static inline void ds_put_context(struct ds_context *context)
{
struct task_struct *task;
unsigned long irq;

if (!context)
Expand All @@ -313,14 +314,20 @@ static inline void ds_put_context(struct ds_context *context)

*(context->this) = NULL;

if (context->task)
clear_tsk_thread_flag(context->task, TIF_DS_AREA_MSR);
task = context->task;

if (task)
clear_tsk_thread_flag(task, TIF_DS_AREA_MSR);

if (!context->task || (context->task == current))
if (!task || (task == current))
wrmsrl(MSR_IA32_DS_AREA, 0);

spin_unlock_irqrestore(&ds_lock, irq);

/* The context might still be in use for context switching. */
if (task && (task != current))
wait_task_context_switch(task);

kfree(context);
}

Expand Down Expand Up @@ -781,15 +788,23 @@ struct pebs_tracer *ds_request_pebs(struct task_struct *task,

void ds_release_bts(struct bts_tracer *tracer)
{
struct task_struct *task;

if (!tracer)
return;

task = tracer->ds.context->task;

ds_suspend_bts(tracer);

WARN_ON_ONCE(tracer->ds.context->bts_master != tracer);
tracer->ds.context->bts_master = NULL;

put_tracer(tracer->ds.context->task);
/* Make sure tracing stopped and the tracer is not in use. */
if (task && (task != current))
wait_task_context_switch(task);

put_tracer(task);
ds_put_context(tracer->ds.context);

kfree(tracer);
Expand Down

0 comments on commit dc4fa8d

Please sign in to comment.