* [PATCH net] dcbnl : Fix lock initialization
@ 2014-11-06 18:09 Anish Bhatt
2014-11-06 19:03 ` John Fastabend
0 siblings, 1 reply; 5+ messages in thread
From: Anish Bhatt @ 2014-11-06 18:09 UTC (permalink / raw)
To: netdev
Cc: davem, john.r.fastabend, ying.xue, jeffrey.t.kirsher, ebiederm,
Anish Bhatt
dcb_lock was being used uninitialized in dcbnl and is infact missing
initialization code. Fixed
Signed-off-by: Anish Bhatt <anish@chelsio.com>
---
net/dcb/dcbnl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ca11d28..7bc44e1 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1914,6 +1914,8 @@ static int __init dcbnl_init(void)
{
INIT_LIST_HEAD(&dcb_app_list);
+ spin_lock_init(&dcb_lock);
+
rtnl_register(PF_UNSPEC, RTM_GETDCB, dcb_doit, NULL, NULL);
rtnl_register(PF_UNSPEC, RTM_SETDCB, dcb_doit, NULL, NULL);
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net] dcbnl : Fix lock initialization
2014-11-06 18:09 [PATCH net] dcbnl : Fix lock initialization Anish Bhatt
@ 2014-11-06 19:03 ` John Fastabend
2014-11-06 19:12 ` Anish Bhatt
0 siblings, 1 reply; 5+ messages in thread
From: John Fastabend @ 2014-11-06 19:03 UTC (permalink / raw)
To: Anish Bhatt
Cc: netdev, davem, john.r.fastabend, ying.xue, jeffrey.t.kirsher,
ebiederm
On 11/06/2014 10:09 AM, Anish Bhatt wrote:
> dcb_lock was being used uninitialized in dcbnl and is infact missing
> initialization code. Fixed
>
Are you trying to resolve a bug? It is initialized with
static DEFINE_SPINLOCK(dcb_lock);
and if you follow the code far enough you get to this in
spinlock_types.h:
#ifdef CONFIG_DEBUG_SPINLOCK
# define SPIN_DEBUG_INIT(lockname) \
.magic = SPINLOCK_MAGIC, \
.owner_cpu = -1, \
.owner = SPINLOCK_OWNER_INIT,
#else
# define SPIN_DEBUG_INIT(lockname)
#endif
#define __RAW_SPIN_LOCK_INITIALIZER(lockname) \
{ \
.raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
SPIN_DEBUG_INIT(lockname) \
SPIN_DEP_MAP_INIT(lockname) }
[...]
--
John Fastabend Intel Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [PATCH net] dcbnl : Fix lock initialization
2014-11-06 19:03 ` John Fastabend
@ 2014-11-06 19:12 ` Anish Bhatt
2014-11-06 20:16 ` John Fastabend
0 siblings, 1 reply; 5+ messages in thread
From: Anish Bhatt @ 2014-11-06 19:12 UTC (permalink / raw)
To: John Fastabend
Cc: netdev@vger.kernel.org, davem@davemloft.net,
john.r.fastabend@intel.com, ying.xue@windriver.com,
jeffrey.t.kirsher@intel.com, ebiederm@xmission.com
Yes, without this kernel is complaining about inconsitent lock state when lock debugging is enabled. Unfortunately I do not have the trace lying around right now.
If you wish, you can reject this patch, I'll resend it when I get the trace again, with trace included.
-Anish
________________________________________
From: John Fastabend [john.fastabend@gmail.com]
Sent: Thursday, November 06, 2014 11:03 AM
To: Anish Bhatt
Cc: netdev@vger.kernel.org; davem@davemloft.net; john.r.fastabend@intel.com; ying.xue@windriver.com; jeffrey.t.kirsher@intel.com; ebiederm@xmission.com
Subject: Re: [PATCH net] dcbnl : Fix lock initialization
On 11/06/2014 10:09 AM, Anish Bhatt wrote:
> dcb_lock was being used uninitialized in dcbnl and is infact missing
> initialization code. Fixed
>
Are you trying to resolve a bug? It is initialized with
static DEFINE_SPINLOCK(dcb_lock);
and if you follow the code far enough you get to this in
spinlock_types.h:
#ifdef CONFIG_DEBUG_SPINLOCK
# define SPIN_DEBUG_INIT(lockname) \
.magic = SPINLOCK_MAGIC, \
.owner_cpu = -1, \
.owner = SPINLOCK_OWNER_INIT,
#else
# define SPIN_DEBUG_INIT(lockname)
#endif
#define __RAW_SPIN_LOCK_INITIALIZER(lockname) \
{ \
.raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
SPIN_DEBUG_INIT(lockname) \
SPIN_DEP_MAP_INIT(lockname) }
[...]
--
John Fastabend Intel Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net] dcbnl : Fix lock initialization
2014-11-06 19:12 ` Anish Bhatt
@ 2014-11-06 20:16 ` John Fastabend
2014-11-06 20:19 ` Anish Bhatt
0 siblings, 1 reply; 5+ messages in thread
From: John Fastabend @ 2014-11-06 20:16 UTC (permalink / raw)
To: Anish Bhatt
Cc: netdev@vger.kernel.org, davem@davemloft.net,
john.r.fastabend@intel.com, ying.xue@windriver.com,
jeffrey.t.kirsher@intel.com, ebiederm@xmission.com
On 11/06/2014 11:12 AM, Anish Bhatt wrote:
> Yes, without this kernel is complaining about inconsitent lock state
> when lock debugging is enabled. Unfortunately I do not have the trace
> lying around right now.
>
If you have the trace that might help. I can't recall seeing any splats
in these code paths. Also as far as I can tell you shouldn't need to do
an init after the define. There are lots of examples in ./net/core where
this is done.
So we need to sort out why the init resolves the issue.
> If you wish, you can reject this patch, I'll resend it when I get the trace again, with trace included.
> -Anish
> ________________________________________
> From: John Fastabend [john.fastabend@gmail.com]
> Sent: Thursday, November 06, 2014 11:03 AM
> To: Anish Bhatt
> Cc: netdev@vger.kernel.org; davem@davemloft.net; john.r.fastabend@intel.com; ying.xue@windriver.com; jeffrey.t.kirsher@intel.com; ebiederm@xmission.com
> Subject: Re: [PATCH net] dcbnl : Fix lock initialization
>
> On 11/06/2014 10:09 AM, Anish Bhatt wrote:
>> dcb_lock was being used uninitialized in dcbnl and is infact missing
>> initialization code. Fixed
>>
>
> Are you trying to resolve a bug? It is initialized with
>
> static DEFINE_SPINLOCK(dcb_lock);
>
> and if you follow the code far enough you get to this in
> spinlock_types.h:
>
>
> #ifdef CONFIG_DEBUG_SPINLOCK
> # define SPIN_DEBUG_INIT(lockname) \
> .magic = SPINLOCK_MAGIC, \
> .owner_cpu = -1, \
> .owner = SPINLOCK_OWNER_INIT,
> #else
> # define SPIN_DEBUG_INIT(lockname)
> #endif
>
> #define __RAW_SPIN_LOCK_INITIALIZER(lockname) \
> { \
> .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
> SPIN_DEBUG_INIT(lockname) \
> SPIN_DEP_MAP_INIT(lockname) }
>
> [...]
>
>
>
> --
> John Fastabend Intel Corporation
>
--
John Fastabend Intel Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [PATCH net] dcbnl : Fix lock initialization
2014-11-06 20:16 ` John Fastabend
@ 2014-11-06 20:19 ` Anish Bhatt
0 siblings, 0 replies; 5+ messages in thread
From: Anish Bhatt @ 2014-11-06 20:19 UTC (permalink / raw)
To: John Fastabend
Cc: netdev@vger.kernel.org, davem@davemloft.net,
john.r.fastabend@intel.com, ying.xue@windriver.com,
jeffrey.t.kirsher@intel.com, ebiederm@xmission.com
Dave,
Please do not apply this patch then.
John,
I will try to recreate this again and investigate. My setup is currently being used for other purposes so might take a few days.
-Anish
________________________________________
From: John Fastabend [john.fastabend@gmail.com]
Sent: Thursday, November 06, 2014 12:16 PM
To: Anish Bhatt
Cc: netdev@vger.kernel.org; davem@davemloft.net; john.r.fastabend@intel.com; ying.xue@windriver.com; jeffrey.t.kirsher@intel.com; ebiederm@xmission.com
Subject: Re: [PATCH net] dcbnl : Fix lock initialization
On 11/06/2014 11:12 AM, Anish Bhatt wrote:
> Yes, without this kernel is complaining about inconsitent lock state
> when lock debugging is enabled. Unfortunately I do not have the trace
> lying around right now.
>
If you have the trace that might help. I can't recall seeing any splats
in these code paths. Also as far as I can tell you shouldn't need to do
an init after the define. There are lots of examples in ./net/core where
this is done.
So we need to sort out why the init resolves the issue.
> If you wish, you can reject this patch, I'll resend it when I get the trace again, with trace included.
> -Anish
> ________________________________________
> From: John Fastabend [john.fastabend@gmail.com]
> Sent: Thursday, November 06, 2014 11:03 AM
> To: Anish Bhatt
> Cc: netdev@vger.kernel.org; davem@davemloft.net; john.r.fastabend@intel.com; ying.xue@windriver.com; jeffrey.t.kirsher@intel.com; ebiederm@xmission.com
> Subject: Re: [PATCH net] dcbnl : Fix lock initialization
>
> On 11/06/2014 10:09 AM, Anish Bhatt wrote:
>> dcb_lock was being used uninitialized in dcbnl and is infact missing
>> initialization code. Fixed
>>
>
> Are you trying to resolve a bug? It is initialized with
>
> static DEFINE_SPINLOCK(dcb_lock);
>
> and if you follow the code far enough you get to this in
> spinlock_types.h:
>
>
> #ifdef CONFIG_DEBUG_SPINLOCK
> # define SPIN_DEBUG_INIT(lockname) \
> .magic = SPINLOCK_MAGIC, \
> .owner_cpu = -1, \
> .owner = SPINLOCK_OWNER_INIT,
> #else
> # define SPIN_DEBUG_INIT(lockname)
> #endif
>
> #define __RAW_SPIN_LOCK_INITIALIZER(lockname) \
> { \
> .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
> SPIN_DEBUG_INIT(lockname) \
> SPIN_DEP_MAP_INIT(lockname) }
>
> [...]
>
>
>
> --
> John Fastabend Intel Corporation
>
--
John Fastabend Intel Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-06 20:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-06 18:09 [PATCH net] dcbnl : Fix lock initialization Anish Bhatt
2014-11-06 19:03 ` John Fastabend
2014-11-06 19:12 ` Anish Bhatt
2014-11-06 20:16 ` John Fastabend
2014-11-06 20:19 ` Anish Bhatt
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).