From: Ingo Molnar Date: Tue, 25 Nov 2008 16:30:25 +0000 (+0100) Subject: Merge branches 'tracing/core', 'x86/urgent' and 'x86/ptrace' into tracing/hw-branch... X-Git-Tag: v2.6.30-rc1~2^2~255 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d55718b0c19ba611241c330f688ee824e9bab79;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git Merge branches 'tracing/core', 'x86/urgent' and 'x86/ptrace' into tracing/hw-branch-tracing This pulls together all the topic branches that are needed for the DS/BTS/PEBS tracing work. --- 7d55718b0c19ba611241c330f688ee824e9bab79 diff --cc arch/x86/kernel/ds.c index d1a1214,a2d1176,c570252..d6938d9 --- a/arch/x86/kernel/ds.c +++ b/arch/x86/kernel/ds.c @@@@ -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) { @@@@ -251,30 -244,27 -247,18 +244,27 @@@@ 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;