Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH v1 1/1] igc: Fix BUG: scheduling while atomic: kworker/u64:0/9/0x00000002
Date: Tue, 8 Mar 2022 16:49:48 +0100	[thread overview]
Message-ID: <Yid7HCwekP1IsMN3@calimero.vinschen.de> (raw)
In-Reply-To: <20220308092422.2971655-1-sasha.neftin@intel.com>

Hi Sasha,

On Mar  8 11:24, Sasha Neftin wrote:
> Replace usleep_range() method with udelay() method to allow atomic contects
> in low-level MDIO access functions.

The commit message is a bit on the short end.  It should probably quote
the reproducer from the below Bugzilla, rather than just pointing to the
Bugzilla, i.e.,

$ modprobe -r bonding
$ modprobe -v bonding max_bonds=1 mode=1 miimon=100 use_carrier=0
$ ip link set bond0 up
$ ifenslave bond0 eth0 eth1

leads to the following [shortened] kernel log:

[  120.198086] Voluntary context switch within RCU read-side critical section!
[  120.198093] WARNING: CPU: 3 PID: 10 at kernel/rcu/tree_plugin.h:318 rcu_note_context_switch+0x4ea/0x580
[  120.207310] bond0: (slave ens5f0): Enslaving as a backup interface with a down link
[  120.229488] [...]
[  120.754723] Workqueue: bond0 bond_mii_monitor [bonding]
[  120.779106] RIP: 0010:rcu_note_context_switch+0x4ea/0x580
[  120.803880] Code: 08 49 89 8e 40 08 00 00 4d 89 be 48 08 00 00 4d 89 07 e9 98 fe ff ff 48 c7 c7 48 83 94 b6 c6 05 74 3b e1 01 01 e8 35 fd 8a 00 <0f> 0b e9 67 fb ff ff 45 85 f6 0f 84 9e fe ff ff 4c 89 85 a8 00 00
[  120.890778] RSP: 0018:ffffa2f5c01bbbc8 EFLAGS: 00010082
[  120.915218] RAX: 0000000000000000 RBX: ffff938d6f8f1740 RCX: 0000000000000027
[  120.948713] RDX: 0000000000000027 RSI: ffff938d6f8dfcc0 RDI: ffff938d6f8dfcc8
[  120.982368] RBP: ffffa2f5c01bbc50 R08: 0000000000000000 R09: c0000000ffff7fff
[  121.016065] R10: 0000000000000001 R11: ffffa2f5c01bb9e0 R12: ffff938a022a9980
[  121.049504] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001
[  121.082870] FS:  0000000000000000(0000) GS:ffff938d6f8c0000(0000) knlGS:0000000000000000
[  121.121993] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  121.151532] CR2: 0000556901ea4f28 CR3: 0000000482810001 CR4: 00000000001706e0
[  121.186337] Call Trace:
[  121.197543]  <TASK>
[  121.207444]  __schedule+0x9a/0x7b0
[  121.223316]  ? hrtimer_start_range_ns+0x11d/0x300
[  121.245293]  schedule+0x41/0xc0
[  121.259860]  schedule_hrtimeout_range_clock+0x83/0x100
[  121.283548]  ? hrtimer_init_sleeper+0x80/0x80
[  121.303830]  usleep_range_state+0x5b/0x80
[  121.322747]  igc_read_phy_reg_gpy+0x90/0x180 [igc]
[  121.345249]  igc_phy_has_link+0x7d/0x170 [igc]
[  121.365980]  igc_check_for_copper_link+0x60/0xd0 [igc]
[  121.390260]  igc_has_link+0x2a/0x80 [igc]
[  121.409093]  igc_ethtool_get_link+0x24/0x30 [igc]
[  121.431248]  bond_check_dev_link.isra.49+0x5a/0x120 [bonding]
[  121.458271]  ? pick_next_task_fair+0x3e/0x3b0
[  121.478749]  ? put_prev_entity+0x22/0xe0
[  121.497154]  ? put_prev_task_fair+0x1b/0x30
[  121.516903]  bond_mii_monitor+0x107/0x540 [bonding]
[...]

> Fixes: 5586838fe9ce ("igc: Add code for PHY support")
> Reported-by: Corinna Vinschen <vinschen@redhat.com>
> Suggested-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
> Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
> ---
>  drivers/net/ethernet/intel/igc/igc_phy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_phy.c b/drivers/net/ethernet/intel/igc/igc_phy.c
> index 40dbf4b43234..6961f65d36b9 100644
> --- a/drivers/net/ethernet/intel/igc/igc_phy.c
> +++ b/drivers/net/ethernet/intel/igc/igc_phy.c
> @@ -581,7 +581,7 @@ static s32 igc_read_phy_reg_mdic(struct igc_hw *hw, u32 offset, u16 *data)
>  	 * the lower time out
>  	 */
>  	for (i = 0; i < IGC_GEN_POLL_TIMEOUT; i++) {
> -		usleep_range(500, 1000);
> +		udelay(50);
>  		mdic = rd32(IGC_MDIC);
>  		if (mdic & IGC_MDIC_READY)
>  			break;
> @@ -638,7 +638,7 @@ static s32 igc_write_phy_reg_mdic(struct igc_hw *hw, u32 offset, u16 data)
>  	 * the lower time out
>  	 */
>  	for (i = 0; i < IGC_GEN_POLL_TIMEOUT; i++) {
> -		usleep_range(500, 1000);
> +		udelay(50);
>  		mdic = rd32(IGC_MDIC);
>  		if (mdic & IGC_MDIC_READY)
>  			break;
> -- 
> 2.30.2

Tested-by: Corinna Vinschen <vinschen@redhat.com>


Thanks,
Corinna


  parent reply	other threads:[~2022-03-08 15:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  9:24 [Intel-wired-lan] [PATCH v1 1/1] igc: Fix BUG: scheduling while atomic: kworker/u64:0/9/0x00000002 Sasha Neftin
2022-03-08  9:31 ` Maciej Fijalkowski
2022-03-08 15:49 ` Corinna Vinschen [this message]
2022-03-08 17:34   ` Neftin, Sasha
2022-03-24 10:23 ` naamax.meir

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=Yid7HCwekP1IsMN3@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=intel-wired-lan@osuosl.org \
    /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