All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/14] ravb/sh_eth: fix sleep in atomic by reusing shared ethtool handlers
@ 2018-07-04  8:12 Vladimir Zapolskiy
  2018-07-04  8:12 ` [PATCH v2 01/14] sh_eth: fix invalid context bug while calling auto-negotiation by ethtool Vladimir Zapolskiy
                   ` (16 more replies)
  0 siblings, 17 replies; 45+ messages in thread
From: Vladimir Zapolskiy @ 2018-07-04  8:12 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc

For ages trivial changes to RAVB and SuperH ethernet links by means of
standard 'ethtool' trigger a 'sleeping function called from invalid
context' bug, to visualize it on r8a7795 ULCB:

  % ethtool -r eth0
  BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747
  in_atomic(): 1, irqs_disabled(): 128, pid: 554, name: ethtool
  INFO: lockdep is turned off.
  irq event stamp: 0
  hardirqs last  enabled at (0): [<0000000000000000>]           (null)
  hardirqs last disabled at (0): [<ffff0000080e1d3c>] copy_process.isra.7.part.8+0x2cc/0x1918
  softirqs last  enabled at (0): [<ffff0000080e1d3c>] copy_process.isra.7.part.8+0x2cc/0x1918
  softirqs last disabled at (0): [<0000000000000000>]           (null)
  CPU: 5 PID: 554 Comm: ethtool Not tainted 4.17.0-rc4-arm64-renesas+ #33
  Hardware name: Renesas H3ULCB board based on r8a7795 ES2.0+ (DT)
  Call trace:
   dump_backtrace+0x0/0x198
   show_stack+0x24/0x30
   dump_stack+0xb8/0xf4
   ___might_sleep+0x1c8/0x1f8
   __might_sleep+0x58/0x90
   __mutex_lock+0x50/0x890
   mutex_lock_nested+0x3c/0x50
   phy_start_aneg_priv+0x38/0x180
   phy_start_aneg+0x24/0x30
   ravb_nway_reset+0x3c/0x68
   dev_ethtool+0x3dc/0x2338
   dev_ioctl+0x19c/0x490
   sock_do_ioctl+0xe0/0x238
   sock_ioctl+0x254/0x460
   do_vfs_ioctl+0xb0/0x918
   ksys_ioctl+0x50/0x80
   sys_ioctl+0x34/0x48
   __sys_trace_return+0x0/0x4

The root cause is that an attempt to modify ECMR and GECMR registers
only when RX/TX function is disabled was too overcomplicated in its
original implementation, also processing of an optional Link Change
interrupt added even more complexity, as a result the implementation
was error prone.

The new locking scheme is confirmed to be correct by dumping driver
specific and generic PHY framework function calls with aid of ftrace
while running more or less advanced tests.

Please note that sh_eth patches from the series were built-tested only.

On purpose I do not add Fixes tags, the reused PHY handlers were added
way later than the fixed problems were firstly found in the drivers.

Changes from v1 to v2:
* the original patches are split to bugfixes and enhancements only,
  both v1 and v2 series are absolutely equal in total, thus I omit
  description of changes in individual patches,
* the latter implies that there should be no strict need for retesting,
  but because formally two series are different, I have to drop the tags
  given by Geert and Andrew, please send your tags again.

Vladimir Zapolskiy (14):
  sh_eth: fix invalid context bug while calling auto-negotiation by ethtool
  sh_eth: fix invalid context bug while changing link options by ethtool
  sh_eth: simplify link auto-negotiation by ethtool
  sh_eth: remove custom .nway_reset from ethtool ops
  sh_eth: remove useless serialization in sh_eth_get_link_ksettings()
  sh_eth: remove custom .get_link_ksettings from ethtool ops
  sh_eth: remove custom .set_link_ksettings from ethtool ops
  ravb: fix invalid context bug while calling auto-negotiation by ethtool
  ravb: fix invalid context bug while changing link options by ethtool
  ravb: simplify link auto-negotiation by ethtool
  ravb: remove custom .nway_reset from ethtool ops
  ravb: remove useless serialization in ravb_get_link_ksettings()
  ravb: remove custom .get_link_ksettings from ethtool ops
  ravb: remove custom .set_link_ksettings from ethtool ops

 drivers/net/ethernet/renesas/ravb_main.c | 93 +++++------------------
 drivers/net/ethernet/renesas/sh_eth.c    | 94 +++++-------------------
 2 files changed, 34 insertions(+), 153 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2018-07-09 18:16 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04  8:12 [PATCH v2 00/14] ravb/sh_eth: fix sleep in atomic by reusing shared ethtool handlers Vladimir Zapolskiy
2018-07-04  8:12 ` [PATCH v2 01/14] sh_eth: fix invalid context bug while calling auto-negotiation by ethtool Vladimir Zapolskiy
2018-07-06 15:39   ` Sergei Shtylyov
2018-07-04  8:12 ` [PATCH v2 02/14] sh_eth: fix invalid context bug while changing link options " Vladimir Zapolskiy
2018-07-06 18:43   ` Sergei Shtylyov
2018-07-04  8:12 ` [PATCH v2 03/14] sh_eth: simplify link auto-negotiation " Vladimir Zapolskiy
2018-07-06 18:48   ` Sergei Shtylyov
2018-07-04  8:12 ` [PATCH v2 04/14] sh_eth: remove custom .nway_reset from ethtool ops Vladimir Zapolskiy
2018-07-06 19:04   ` Sergei Shtylyov
2018-07-04  8:14 ` [PATCH v2 05/14] sh_eth: remove useless serialization in sh_eth_get_link_ksettings() Vladimir Zapolskiy
2018-07-06 19:06   ` Sergei Shtylyov
2018-07-04  8:14 ` [PATCH v2 06/14] sh_eth: remove custom .get_link_ksettings from ethtool ops Vladimir Zapolskiy
2018-07-06 19:08   ` Sergei Shtylyov
2018-07-04  8:14 ` [PATCH v2 07/14] sh_eth: remove custom .set_link_ksettings " Vladimir Zapolskiy
2018-07-06 19:15   ` Sergei Shtylyov
2018-07-04  8:14 ` [PATCH v2 08/14] ravb: fix invalid context bug while calling auto-negotiation by ethtool Vladimir Zapolskiy
2018-07-05  6:09   ` Vladimir Zapolskiy
2018-07-05  6:09     ` Vladimir Zapolskiy
2018-07-05  8:27     ` Sergei Shtylyov
2018-07-06 19:47   ` Sergei Shtylyov
2018-07-04  8:14 ` [PATCH v2 09/14] ravb: fix invalid context bug while changing link options " Vladimir Zapolskiy
2018-07-05  6:09   ` Vladimir Zapolskiy
2018-07-05  6:09     ` Vladimir Zapolskiy
2018-07-06 19:58   ` Sergei Shtylyov
2018-07-04  8:16 ` [PATCH v2 10/14] ravb: simplify link auto-negotiation " Vladimir Zapolskiy
2018-07-06 20:30   ` Sergei Shtylyov
2018-07-04  8:16 ` [PATCH v2 11/14] ravb: remove custom .nway_reset from ethtool ops Vladimir Zapolskiy
2018-07-06 20:30   ` Sergei Shtylyov
2018-07-04  8:16 ` [PATCH v2 12/14] ravb: remove useless serialization in ravb_get_link_ksettings() Vladimir Zapolskiy
2018-07-06 20:31   ` Sergei Shtylyov
2018-07-04  8:16 ` [PATCH v2 13/14] ravb: remove custom .get_link_ksettings from ethtool ops Vladimir Zapolskiy
2018-07-06 20:39   ` Sergei Shtylyov
2018-07-04  8:16 ` [PATCH v2 14/14] ravb: remove custom .set_link_ksettings " Vladimir Zapolskiy
2018-07-06 20:41   ` Sergei Shtylyov
2018-07-05  0:56 ` [PATCH v2 00/14] ravb/sh_eth: fix sleep in atomic by reusing shared ethtool handlers David Miller
2018-07-05  5:59   ` Vladimir Zapolskiy
2018-07-05  5:59     ` Vladimir Zapolskiy
2018-07-05 19:13     ` Sergei Shtylyov
2018-07-05  7:21 ` Geert Uytterhoeven
2018-07-07  1:47 ` David Miller
2018-07-07 15:22   ` Sergei Shtylyov
2018-07-07 23:58     ` David Miller
2018-07-08 23:24       ` Sergei Shtylyov
2018-07-08 23:33         ` Sergei Shtylyov
2018-07-09 18:16         ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.