public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] x86, bts: fix unlock problem in ds.c
@ 2008-11-15 10:00 Markus Metzger
  2008-11-16  7:26 ` Ingo Molnar
  2008-11-20 21:14 ` stephane eranian
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Metzger @ 2008-11-15 10:00 UTC (permalink / raw)
  To: lkml; +Cc: work, H. Peter Anvin, stephane eranian, Thomas Gleixner,
	Ingo Molnar

Fix a problem where ds_request() returned an error without releasing the
ds lock.

Reported-by: Stephane Eranian <eranian@gmail.com>
Signed-off-by: Markus Metzger <markus.t.metzger@gmail.com>
---

Index: gits/arch/x86/kernel/ds.c
===================================================================
--- gits.orig/arch/x86/kernel/ds.c	2008-11-15 10:51:51.000000000 +0100
+++ gits/arch/x86/kernel/ds.c	2008-11-15 10:53:43.000000000 +0100
@@ -384,8 +384,9 @@
 
 	spin_lock(&ds_lock);
 
+	error = -EPERM;
 	if (!check_tracer(task))
-		return -EPERM;
+		goto out_unlock;
 
 	error = -ENOMEM;
 	context = ds_alloc_context(task);



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] x86, bts: fix unlock problem in ds.c
  2008-11-15 10:00 [patch] x86, bts: fix unlock problem in ds.c Markus Metzger
@ 2008-11-16  7:26 ` Ingo Molnar
  2008-11-20 21:14 ` stephane eranian
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-11-16  7:26 UTC (permalink / raw)
  To: Markus Metzger
  Cc: lkml, work, H. Peter Anvin, stephane eranian, Thomas Gleixner


* Markus Metzger <markus.t.metzger@googlemail.com> wrote:

> Fix a problem where ds_request() returned an error without releasing 
> the ds lock.
> 
> Reported-by: Stephane Eranian <eranian@gmail.com>
> Signed-off-by: Markus Metzger <markus.t.metzger@gmail.com>

applied to tip/x86/urgent, thanks Markus!

i also reviewed the other locking branches there and they seem to be 
fine.

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] x86, bts: fix unlock problem in ds.c
  2008-11-15 10:00 [patch] x86, bts: fix unlock problem in ds.c Markus Metzger
  2008-11-16  7:26 ` Ingo Molnar
@ 2008-11-20 21:14 ` stephane eranian
  2008-11-20 21:48   ` Ingo Molnar
  1 sibling, 1 reply; 5+ messages in thread
From: stephane eranian @ 2008-11-20 21:14 UTC (permalink / raw)
  To: Markus Metzger; +Cc: lkml, work, H. Peter Anvin, Thomas Gleixner, Ingo Molnar

Markus,

I think this patch is not quite right. You don't want to go out via out_unlock
because you're going to call ds_put_context)() when you did not invoke the
matching ds_get_context() (hidden in ds_alloc_context). It happens later in
the ds_request() function.


On Sat, Nov 15, 2008 at 11:00 AM, Markus Metzger
<markus.t.metzger@googlemail.com> wrote:
> Fix a problem where ds_request() returned an error without releasing the
> ds lock.
>
> Reported-by: Stephane Eranian <eranian@gmail.com>
> Signed-off-by: Markus Metzger <markus.t.metzger@gmail.com>
> ---
>
> Index: gits/arch/x86/kernel/ds.c
> ===================================================================
> --- gits.orig/arch/x86/kernel/ds.c      2008-11-15 10:51:51.000000000 +0100
> +++ gits/arch/x86/kernel/ds.c   2008-11-15 10:53:43.000000000 +0100
> @@ -384,8 +384,9 @@
>
>        spin_lock(&ds_lock);
>
> +       error = -EPERM;
>        if (!check_tracer(task))
> -               return -EPERM;
> +               goto out_unlock;
>
>        error = -ENOMEM;
>        context = ds_alloc_context(task);
>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] x86, bts: fix unlock problem in ds.c
  2008-11-20 21:14 ` stephane eranian
@ 2008-11-20 21:48   ` Ingo Molnar
  2008-11-20 22:06     ` stephane eranian
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2008-11-20 21:48 UTC (permalink / raw)
  To: eranian; +Cc: Markus Metzger, lkml, work, H. Peter Anvin, Thomas Gleixner


* stephane eranian <eranian@googlemail.com> wrote:

> Markus,
> 
> I think this patch is not quite right. You don't want to go out via 
> out_unlock because you're going to call ds_put_context)() when you 
> did not invoke the matching ds_get_context() (hidden in 
> ds_alloc_context). It happens later in the ds_request() function.

i noticed that, and fixed it via:

 10db4ef: x86, PEBS/DS: fix code flow in ds_request()

can you still see problems with it?

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] x86, bts: fix unlock problem in ds.c
  2008-11-20 21:48   ` Ingo Molnar
@ 2008-11-20 22:06     ` stephane eranian
  0 siblings, 0 replies; 5+ messages in thread
From: stephane eranian @ 2008-11-20 22:06 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Markus Metzger, lkml, work, H. Peter Anvin, Thomas Gleixner

On Thu, Nov 20, 2008 at 10:48 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * stephane eranian <eranian@googlemail.com> wrote:
>
>> Markus,
>>
>> I think this patch is not quite right. You don't want to go out via
>> out_unlock because you're going to call ds_put_context)() when you
>> did not invoke the matching ds_get_context() (hidden in
>> ds_alloc_context). It happens later in the ds_request() function.
>
> i noticed that, and fixed it via:
>
>  10db4ef: x86, PEBS/DS: fix code flow in ds_request()
>
> can you still see problems with it?
>
Well, I have lots of problems with ds.c so I have heavily modified the
code therefore I have not pulled from
any public tree in several days.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-11-20 22:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-15 10:00 [patch] x86, bts: fix unlock problem in ds.c Markus Metzger
2008-11-16  7:26 ` Ingo Molnar
2008-11-20 21:14 ` stephane eranian
2008-11-20 21:48   ` Ingo Molnar
2008-11-20 22:06     ` stephane eranian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox