netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "Csókás Bence" <csokas.bence@prolan.hu>
Cc: netdev@vger.kernel.org,
	Richard Cochran <richardcochran@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	qiangqing.zhang@nxp.com, Andrew Lunn <andrew@lunn.ch>,
	kernel@pengutronix.de
Subject: BUG: Re: [PATCH v3 resubmit] fec: Restart PPS after link state change
Date: Sat, 27 Aug 2022 18:09:22 +0200	[thread overview]
Message-ID: <20220827160922.642zlcd5foopozru@pengutronix.de> (raw)
In-Reply-To: <20220822081051.7873-1-csokas.bence@prolan.hu>

[-- Attachment #1: Type: text/plain, Size: 4842 bytes --]

On 22.08.2022 10:10:52, Csókás Bence wrote:
> On link state change, the controller gets reset,
> causing PPS to drop out and the PHC to lose its
> time and calibration. So we restart it if needed,
> restoring calibration and time registers.
> 
> Changes since v2:
> * Add `fec_ptp_save_state()`/`fec_ptp_restore_state()`
> * Use `ktime_get_real_ns()`
> * Use `BIT()` macro
> Changes since v1:
> * More ECR #define's
> * Stop PPS in `fec_ptp_stop()`
> 
> Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>

current net-next/main fails on my imx6 with:

| [   14.001542] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:283                                                                                                 
| [   14.010604] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 13, name: kworker/0:1                                                                                                     
| [   14.018737] preempt_count: 201, expected: 0                                                                                                                                                  
| [   14.022931] CPU: 0 PID: 13 Comm: kworker/0:1 Not tainted 6.0.0-rc2+ #225                                                                                                                     
| [   14.029643] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)                                                                                                                       
| [   14.036175] Workqueue: events_power_efficient phy_state_machine                                                                                                                              
| [   14.042121] [<c010ffe0>] (unwind_backtrace) from [<c010ac04>] (show_stack+0x10/0x14)                                                                                                         
| [   14.049889] [<c010ac04>] (show_stack) from [<c0ccab04>] (dump_stack_lvl+0x40/0x4c)                                                                                                           
| [   14.057479] [<c0ccab04>] (dump_stack_lvl) from [<c014ed7c>] (__might_resched+0x11c/0x154)                                                                                                    
| [   14.065678] [<c014ed7c>] (__might_resched) from [<c0cd9c20>] (mutex_lock+0x18/0x58)                                                                                                          
| [   14.073356] [<c0cd9c20>] (mutex_lock) from [<c082b59c>] (fec_ptp_gettime+0x2c/0xc4)                                                                                                          
| [   14.081035] [<c082b59c>] (fec_ptp_gettime) from [<c082bff4>] (fec_ptp_save_state+0x14/0x50)                                                                                                  
| [   14.089403] [<c082bff4>] (fec_ptp_save_state) from [<c0826ee0>] (fec_restart+0x40/0x6f4)                                                                                                     
| [   14.097510] [<c0826ee0>] (fec_restart) from [<c082b170>] (fec_enet_adjust_link+0xb0/0x21c)                                                                                                   
| [   14.105789] [<c082b170>] (fec_enet_adjust_link) from [<c0819bb4>] (phy_link_change+0x28/0x54)                                                                                                
| [   14.114333] [<c0819bb4>] (phy_link_change) from [<c0815688>] (phy_check_link_status+0x78/0xb4)
| [   14.122969] [<c0815688>] (phy_check_link_status) from [<c0816bec>] (phy_state_machine+0x68/0x29c)
| [   14.131857] [<c0816bec>] (phy_state_machine) from [<c0140604>] (process_one_work+0x1f8/0x410)
| [   14.140398] [<c0140604>] (process_one_work) from [<c01419c8>] (worker_thread+0x2c/0x544)
| [   14.148502] [<c01419c8>] (worker_thread) from [<c0148a4c>] (kthread+0xe4/0xf0)
| [   14.155739] [<c0148a4c>] (kthread) from [<c0100170>] (ret_from_fork+0x14/0x24)
| [   14.162973] Exception stack(0xc2097fb0 to 0xc2097ff8)
| [   14.168032] 7fa0:                                     00000000 00000000 00000000 00000000
| [   14.176217] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
| [   14.184402] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
| [   14.191309] fec 2188000.ethernet lan0: Link is Up - 100Mbps/Full - flow control rx/tx

Reverting this patch "fixes" the problem.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2022-08-27 16:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22  8:10 [PATCH v3 resubmit] fec: Restart PPS after link state change Csókás Bence
2022-08-24  9:00 ` patchwork-bot+netdevbpf
2022-08-27 16:09 ` Marc Kleine-Budde [this message]
2022-09-05 18:05 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220827160922.642zlcd5foopozru@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=csokas.bence@prolan.hu \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=qiangqing.zhang@nxp.com \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).