diff options
author | Ahmed S. Darwish <a.darwish@linutronix.de> | 2020-06-03 16:49:47 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-05 00:50:42 +0200 |
commit | c7e261d81783387a0502878cd229327e7c54322e (patch) | |
tree | a0d67fe433ec03508860a48ea59db759a5a1552d /drivers/net/phy/mdio_bus.c | |
parent | u64_stats: Document writer non-preemptibility requirement (diff) | |
download | linux-c7e261d81783387a0502878cd229327e7c54322e.tar.xz linux-c7e261d81783387a0502878cd229327e7c54322e.zip |
net: mdiobus: Disable preemption upon u64_stats update
The u64_stats mechanism uses sequence counters to protect against 64-bit
values tearing on 32-bit architectures. Updating u64_stats is thus a
sequence counter write side critical section where preemption must be
disabled.
For mdiobus_stats_acct(), disable preemption upon the u64_stats update.
It is called from process context through mdiobus_read() and
mdiobus_write().
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio_bus.c')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 255fdfcc13a6..6ceee82b2839 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -764,6 +764,7 @@ EXPORT_SYMBOL(mdiobus_scan); static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) { + preempt_disable(); u64_stats_update_begin(&stats->syncp); u64_stats_inc(&stats->transfers); @@ -778,6 +779,7 @@ static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) u64_stats_inc(&stats->writes); out: u64_stats_update_end(&stats->syncp); + preempt_enable(); } /** |