Re: "unexpected unlock" when unlocking, conditional, lock in loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Oct 6, 2012, at 10:39 PM, Josh Triplett wrote:

> On Sat, Oct 06, 2012 at 08:56:57PM -0500, Ed Cashin wrote:
...
>> OK.  From the sparse man page section on context, along with
>> include/linux/compiler.h, it sounds like the way to do exactly that 
>> would be something unusual:
>> 
>> int demofn(void) __attribute__((context(&lk,1,1)))
>> 
>> ... but using that in demo.c causes sparse to warn me that it's 
>> ignoring that attribute, so I doubt that can be what you mean.
> 
> I did mean precisely that; I don't know why Sparse complains about that
> syntax.

Maybe there's a header I need.  Searching with cscope and ctags for definitions of "context" doesn't seem to be the right kind of searching.

The complaint looks like:

  CC [M]  drivers/block/aoe/demo.o
drivers/block/aoe/demo.c:9: warning: `context' attribute directive ignored
drivers/block/aoe/demo.c:9: error: expected `,' or `;' before `{' token
make[1]: *** [drivers/block/aoe/demo.o] Error 1
make: *** [drivers/block/aoe/aoe.ko] Error 2

... for this code:

     1  #include <linux/netdevice.h>
     2  
     3  static spinlock_t lk;
     4  static struct sk_buff_head q;
     5  int demofn(void);
     6  
     7  /* enters with lk held */
     8  int demofn(void) __attribute__((context(&lk,1,1)))
     9  {
    10          struct sk_buff *skb;
    11  
    12          while ((skb = skb_dequeue(&q))) {
    13                  spin_unlock_irq(&lk);
    14                  if (dev_queue_xmit(skb) == NET_XMIT_DROP && net_ratelimit())
    15                          pr_warn("informative warning\n");
    16                  spin_lock_irq(&lk);
    17          }
    18          return 0;
    19  }

Thanks.

-- 
  Ed Cashin
  ecashin@xxxxxxxxxx


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux