* [PATCH 1/1] net: fec: fix miss init spinlock
@ 2013-02-01 8:56 Frank Li
2013-02-03 4:08 ` David Miller
[not found] ` <kepftg$f3c$1@ger.gmane.org>
0 siblings, 2 replies; 7+ messages in thread
From: Frank Li @ 2013-02-01 8:56 UTC (permalink / raw)
To: linux-arm-kernel
BUG: spinlock bad magic on CPU#1, swapper/0/1
lock: 0xbfae0f8c, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
Backtrace:
[<80011d54>] (dump_backtrace+0x0/0x10c) from [<804e7800>] (dump_stack+0x18/0x1c)
r6:bfae0000 r5:bfae0f8c r4:00000000 r3:806c1310
[<804e77e8>] (dump_stack+0x0/0x1c) from [<804e9f20>] (spin_dump+0x80/0x94)
[<804e9ea0>] (spin_dump+0x0/0x94) from [<804e9f60>] (spin_bug+0x2c/0x30)
r5:805f6f8c r4:bfae0f8c
[<804e9f34>] (spin_bug+0x0/0x30) from [<80257984>] (do_raw_spin_lock+0x170/0x1b0 )
r5:806b4950 r4:bfae0f8c
[<80257814>] (do_raw_spin_lock+0x0/0x1b0) from [<804ed15c>] (_raw_spin_lock_irqs ave+0x18/0x20)
[<804ed144>] (_raw_spin_lock_irqsave+0x0/0x20) from [<8033c694>] (fec_ptp_start_ cyclecounter+0x3c/0x120)
r4:bfae0f8c r3:00000002
[<8033c658>] (fec_ptp_start_cyclecounter+0x0/0x120) from [<80339e08>] (fec_resta rt+0x56c/0x5f8)
r8:00000000 r7:806e6f48 r6:00000112 r5:806b4950 r4:bfae0000
[<8033989c>] (fec_restart+0x0/0x5f8) from [<8033b9e4>] (fec_probe+0x508/0xa48)
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
drivers/net/ethernet/freescale/fec.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 69b16b9..f900ae4 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1607,6 +1607,7 @@ static int fec_enet_init(struct net_device *ndev)
}
spin_lock_init(&fep->hw_lock);
+ spin_lock_init(&fep->tmreg_lock);
fep->netdev = ndev;
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 1/1] net: fec: fix miss init spinlock
2013-02-01 8:56 [PATCH 1/1] net: fec: fix miss init spinlock Frank Li
@ 2013-02-03 4:08 ` David Miller
2013-02-04 2:22 ` Frank Li
[not found] ` <kepftg$f3c$1@ger.gmane.org>
1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2013-02-03 4:08 UTC (permalink / raw)
To: linux-arm-kernel
From: Frank Li <Frank.Li@freescale.com>
Date: Fri, 1 Feb 2013 16:56:26 +0800
> @@ -1607,6 +1607,7 @@ static int fec_enet_init(struct net_device *ndev)
> }
>
> spin_lock_init(&fep->hw_lock);
> + spin_lock_init(&fep->tmreg_lock);
This breaks the build, tmreg_lock is only present in certain
configurations.
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/1] net: fec: fix miss init spinlock
2013-02-03 4:08 ` David Miller
@ 2013-02-04 2:22 ` Frank Li
2013-02-04 5:24 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Frank Li @ 2013-02-04 2:22 UTC (permalink / raw)
To: linux-arm-kernel
2013/2/3 David Miller <davem@davemloft.net>:
> From: Frank Li <Frank.Li@freescale.com>
> Date: Fri, 1 Feb 2013 16:56:26 +0800
>
>> @@ -1607,6 +1607,7 @@ static int fec_enet_init(struct net_device *ndev)
>> }
>>
>> spin_lock_init(&fep->hw_lock);
>> + spin_lock_init(&fep->tmreg_lock);
>
> This breaks the build, tmreg_lock is only present in certain
> configurations.
No, FEC have changed to check dramatically instead of static config.
You can look fec.h. tmreg_lock is always defined.
struct napi_struct napi;
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_caps;
unsigned long last_overflow_check;
spinlock_t tmreg_lock;
struct cyclecounter cc;
struct timecounter tc;
int rx_hwtstamp_filter;
u32 base_incval;
u32 cycle_speed;
int hwts_rx_en;
int hwts_tx_en;
struct timer_list time_keep;
best regards
Frank Li
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/1] net: fec: fix miss init spinlock
2013-02-04 2:22 ` Frank Li
@ 2013-02-04 5:24 ` David Miller
2013-02-04 6:31 ` Frank Li
0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2013-02-04 5:24 UTC (permalink / raw)
To: linux-arm-kernel
From: Frank Li <lznuaa@gmail.com>
Date: Mon, 4 Feb 2013 10:22:23 +0800
> 2013/2/3 David Miller <davem@davemloft.net>:
>> From: Frank Li <Frank.Li@freescale.com>
>> Date: Fri, 1 Feb 2013 16:56:26 +0800
>>
>>> @@ -1607,6 +1607,7 @@ static int fec_enet_init(struct net_device *ndev)
>>> }
>>>
>>> spin_lock_init(&fep->hw_lock);
>>> + spin_lock_init(&fep->tmreg_lock);
>>
>> This breaks the build, tmreg_lock is only present in certain
>> configurations.
>
> No, FEC have changed to check dramatically instead of static config.
> You can look fec.h. tmreg_lock is always defined.
Not in the 'net' tree or you don't want this bug fixed there at all?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/1] net: fec: fix miss init spinlock
2013-02-04 5:24 ` David Miller
@ 2013-02-04 6:31 ` Frank Li
2013-02-04 20:03 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Frank Li @ 2013-02-04 6:31 UTC (permalink / raw)
To: linux-arm-kernel
>>> This breaks the build, tmreg_lock is only present in certain
>>> configurations.
>>
>> No, FEC have changed to check dramatically instead of static config.
>> You can look fec.h. tmreg_lock is always defined.
>
> Not in the 'net' tree or you don't want this bug fixed there at all?
Sorry, I forget mask tree.
This patch is for net-next.
best regards
Frank Li
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/1] net: fec: fix miss init spinlock
2013-02-04 6:31 ` Frank Li
@ 2013-02-04 20:03 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2013-02-04 20:03 UTC (permalink / raw)
To: linux-arm-kernel
From: Frank Li <lznuaa@gmail.com>
Date: Mon, 4 Feb 2013 14:31:52 +0800
>>>> This breaks the build, tmreg_lock is only present in certain
>>>> configurations.
>>>
>>> No, FEC have changed to check dramatically instead of static config.
>>> You can look fec.h. tmreg_lock is always defined.
>>
>> Not in the 'net' tree or you don't want this bug fixed there at all?
>
> Sorry, I forget mask tree.
> This patch is for net-next.
Ok, applied to net-next.
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <kepftg$f3c$1@ger.gmane.org>]
* [PATCH 1/1] net: fec: fix miss init spinlock
[not found] ` <kepftg$f3c$1@ger.gmane.org>
@ 2013-02-05 2:40 ` Frank Li
0 siblings, 0 replies; 7+ messages in thread
From: Frank Li @ 2013-02-05 2:40 UTC (permalink / raw)
To: linux-arm-kernel
2013/2/5 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>:
> On Fri, 01 Feb 2013 16:56:26 +0800, Frank Li wrote:
>
>> BUG: spinlock bad magic on CPU#1, swapper/0/1 lock: 0xbfae0f8c, .magic:
>> 00000000, .owner: <none>/-1, .owner_cpu: 0 Backtrace:
>> [<80011d54>] (dump_backtrace+0x0/0x10c) from [<804e7800>]
>> (dump_stack+0x18/0x1c)
>> r6:bfae0000 r5:bfae0f8c r4:00000000 r3:806c1310 [<804e77e8>]
>> (dump_stack+0x0/0x1c) from [<804e9f20>] (spin_dump+0x80/0x94)
>> [<804e9ea0>] (spin_dump+0x0/0x94) from [<804e9f60>]
>> (spin_bug+0x2c/0x30)
>> r5:805f6f8c r4:bfae0f8c [<804e9f34>] (spin_bug+0x0/0x30) from
>> [<80257984>] (do_raw_spin_lock+0x170/0x1b0
>> )
>> r5:806b4950 r4:bfae0f8c [<80257814>] (do_raw_spin_lock+0x0/0x1b0) from
>> [<804ed15c>] (_raw_spin_lock_irqs
>> ave+0x18/0x20) [<804ed144>] (_raw_spin_lock_irqsave+0x0/0x20) from
>> [<8033c694>] (fec_ptp_start_
>> cyclecounter+0x3c/0x120)
>> r4:bfae0f8c r3:00000002 [<8033c658>]
>> (fec_ptp_start_cyclecounter+0x0/0x120) from [<80339e08>] (fec_resta
>> rt+0x56c/0x5f8) r8:00000000
>> r7:806e6f48 r6:00000112 r5:806b4950 r4:bfae0000 [<8033989c>]
>> (fec_restart+0x0/0x5f8) from [<8033b9e4>] (fec_probe+0x508/0xa48)
>>
>> Signed-off-by: Frank Li <Frank.Li@freescale.com>
>> ---
>> drivers/net/ethernet/freescale/fec.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec.c
>> b/drivers/net/ethernet/freescale/fec.c index 69b16b9..f900ae4 100644 ---
>> a/drivers/net/ethernet/freescale/fec.c +++
>> b/drivers/net/ethernet/freescale/fec.c @@ -1607,6 +1607,7 @@ static int
>> fec_enet_init(struct net_device *ndev)
>> }
>>
>> spin_lock_init(&fep->hw_lock);
>> + spin_lock_init(&fep->tmreg_lock);
>>
>> fep->netdev = ndev;
>
> Please excuse me, if I'm wrong. I would consider this as a very wrong
> solution:
>
> First, then the spin lock is initialised twice (first time in
> fec_enet_init(), second time in fec_ptp_init()).
>
> Then this patch actually hides the fact that PTP part of fec
> is accessed from fec_ptp_start_cyclecounter() way before
> than fec_ptp_init() is called to initialize PTP).
>
> In my opinion the right patch should either move fec_ptp_init() call
> before fec_restart(), or make fec_restart intelelctual about calling
> fec_ptp_init()/fec_ptp_startcyclecounter() at proper time.
Yes, you are right.
>
> --
> With best wishes
> Dmitry
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-02-05 2:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-01 8:56 [PATCH 1/1] net: fec: fix miss init spinlock Frank Li
2013-02-03 4:08 ` David Miller
2013-02-04 2:22 ` Frank Li
2013-02-04 5:24 ` David Miller
2013-02-04 6:31 ` Frank Li
2013-02-04 20:03 ` David Miller
[not found] ` <kepftg$f3c$1@ger.gmane.org>
2013-02-05 2:40 ` Frank Li
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).