linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why sparse does not support context tracking?
@ 2015-05-04 11:05 Alexander Riesen
  2015-05-04 13:38 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Riesen @ 2015-05-04 11:05 UTC (permalink / raw)
  To: linux-sparse, linux-kernel; +Cc: Josh Triplett, Christopher Li, Johannes Berg

Hi,

I tried to instrument my code (a kernel driver) with __must_hold hints
and noticed that they don't really work: a definitely broken code caused
no errors from sparse.

A test in the "sparse" tree confirmed. Here is the test I used:

static int ctx;

static void must_hold(void) __attribute__((context(ctx,1,1)))
{
     if (ctx)
         ;
}
static void bad_must_hold(void)
{
     must_hold();
}

After a bit of looking I found a commit which removed context tracking
from the "sparse":

Author: Johannes Berg <johannes@sipsolutions.net> 2008-12-23 10:59:22

     Revert the context tracking code

     > Do you want to resend your change which revert the context changes?
     > Make it base on Josh's git's tree and I will merge your changes in my
     > branch.

     Below. Or I can give it to you in git if you prefer. I still think we
     should redo this in some form so that annotations with different
     contexts can work properly, but I don't have time to take care of it
     right now.

     johannes

     >From ca95b62edf1600a2b55ed9ca0515d049807a84fc Mon Sep 17 00:00:00 2001
     From: Johannes Berg <johannes@sipsolutions.net>
     Date: Tue, 23 Dec 2008 10:53:19 +0100
     Subject: [PATCH] Revert context tracking code

So it seems that the code has problems with different contexts. Still, it seems
a bit heavy-handed to remove it completely (assuming it worked, of course).
The kernel even has a bit of use for it (not much, admittedly: DRBD and aoe).

Is it be possible to reintroduce the code at least for the same context?
So that it catches at least some locks not taken?

Regards,
Alex Riesen



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

* Re: Why sparse does not support context tracking?
  2015-05-04 11:05 Why sparse does not support context tracking? Alexander Riesen
@ 2015-05-04 13:38 ` Johannes Berg
  2015-05-04 14:05   ` Alexander Riesen
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2015-05-04 13:38 UTC (permalink / raw)
  To: Alexander Riesen
  Cc: linux-sparse, linux-kernel, Josh Triplett, Christopher Li

On Mon, 2015-05-04 at 13:05 +0200, Alexander Riesen wrote:
> Hi,
> 
> I tried to instrument my code (a kernel driver) with __must_hold hints
> and noticed that they don't really work: a definitely broken code caused
> no errors from sparse.

>      Revert the context tracking code

> So it seems that the code has problems with different contexts. Still, it seems
> a bit heavy-handed to remove it completely (assuming it worked, of course).

It didn't really work. It had a lot of issues that were too big for my
little wireless-focused brain :)

johannes


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

* Re: Why sparse does not support context tracking?
  2015-05-04 13:38 ` Johannes Berg
@ 2015-05-04 14:05   ` Alexander Riesen
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Riesen @ 2015-05-04 14:05 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-sparse, linux-kernel, Josh Triplett, Christopher Li

On 05/04/2015 03:38 PM, Johannes Berg wrote:
> On Mon, 2015-05-04 at 13:05  +0200, Alexander Riesen wrote:
 >>
 >>      Revert the context tracking code
 >>
 >> So it seems that the code has problems with different contexts. Still, it seems
 >> a bit heavy-handed to remove it completely (assuming it worked, of course).
 >
 > It didn't really work. It had a lot of issues that were too big for my
 > little wireless-focused brain :)

Ah, pity. Wasn't there any hope for it?



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

end of thread, other threads:[~2015-05-04 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 11:05 Why sparse does not support context tracking? Alexander Riesen
2015-05-04 13:38 ` Johannes Berg
2015-05-04 14:05   ` Alexander Riesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).