Merge branches 'tracing/core', 'x86/urgent' and 'x86/ptrace' into tracing/hw-branch...
authorIngo Molnar <mingo@elte.hu>
Tue, 25 Nov 2008 16:30:25 +0000 (17:30 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 25 Nov 2008 16:30:30 +0000 (17:30 +0100)
This pulls together all the topic branches that are needed
for the DS/BTS/PEBS tracing work.

1  2  3 
arch/x86/kernel/Makefile
arch/x86/kernel/ds.c

Simple merge
index d1a121443bde5b571c2e853734b006cbb100fbcb,a2d1176c38ee0d59b3e47925a79d8aebdff73d20,c570252905a1a71a0812ca0831dc5eba671e1c04..d6938d9351cfefa4afaaf5b78eb3b584111709e5
@@@@ -234,16 -231,12 -234,12 +231,12 @@@@ static inline struct ds_context *ds_all
        struct ds_context **p_context =
                (task ? &task->thread.ds_ctx : &this_system_context);
        struct ds_context *context = *p_context;
+ +     unsigned long irq;
   
        if (!context) {
-               spin_unlock(&ds_lock);
-  
                context = kzalloc(sizeof(*context), GFP_KERNEL);
- -
-               if (!context) {
-                       spin_lock(&ds_lock);
+               if (!context)
                        return NULL;
-               }
   
                context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
                if (!context->ds) {
                        return NULL;
                }
   
-               spin_lock(&ds_lock);
-               /*
-                * Check for race - another CPU could have allocated
-                * it meanwhile:
-                */
  -             *p_context = context;
+ +             spin_lock_irqsave(&ds_lock, irq);
+  
  -             context->this = p_context;
  -             context->task = task;
  +             if (*p_context) {
  +                     kfree(context->ds);
  +                     kfree(context);
-                       return *p_context;
-               }
  +
-               *p_context = context;
+ +                     context = *p_context;
+ +             } else {
+ +                     *p_context = context;
   
-               context->this = p_context;
-               context->task = task;
  -             if (task)
  -                     set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
+ +                     context->this = p_context;
+ +                     context->task = task;
   
-               if (task)
-                       set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
  -             if (!task || (task == current))
  -                     wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0);
+ +                     if (task)
+ +                             set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
   
-               if (!task || (task == current))
-                       wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0);
-  
- -             get_tracer(task);
+ +                     if (!task || (task == current))
+ +                             wrmsrl(MSR_IA32_DS_AREA,
+ +                                    (unsigned long)context->ds);
+ +             }
+ +             spin_unlock_irqrestore(&ds_lock, irq);
        }
   
        context->count++;
@@@@ -398,26 -391,27 -382,25 +391,27 @@@@ static int ds_request(struct task_struc
                return -EOPNOTSUPP;
   
   
- -     spin_lock(&ds_lock);
  -
  -     if (!check_tracer(task))
  -             return -EPERM;
- -
- -     error = -ENOMEM;
        context = ds_alloc_context(task);
        if (!context)
-               goto out_unlock;
+ +             return -ENOMEM;
+ +
+ +     spin_lock_irqsave(&ds_lock, irq);
  +
  +     error = -EPERM;
  +     if (!check_tracer(task))
                goto out_unlock;
   
+ +     get_tracer(task);
+ +
        error = -EALREADY;
        if (context->owner[qual] == current)
- -             goto out_unlock;
+ +             goto out_put_tracer;
        error = -EPERM;
        if (context->owner[qual] != NULL)
- -             goto out_unlock;
+ +             goto out_put_tracer;
        context->owner[qual] = current;
   
- -     spin_unlock(&ds_lock);
+ +     spin_unlock_irqrestore(&ds_lock, irq);
   
   
        error = -ENOMEM;