From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Heiner Kallweit <hkallweit1@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Andrew Lunn <andrew+netdev@lunn.ch>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 8/8] net: phy: improve mdiobus_stats_acct
Date: Thu, 5 Mar 2026 09:31:37 +0100 [thread overview]
Message-ID: <9433de15-8675-4645-a6aa-85458e833d2d@samsung.com> (raw)
In-Reply-To: <2ceeb542-986a-404e-ad0f-62e0a938ce7c@gmail.com>
On 27.02.2026 23:11, Heiner Kallweit wrote:
> - Remove duplicated preempt disable. Disabling preemption has been added
> to functions like u64_stats_update_begin() in the meantime.
> - Simplify branch structure
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
This patch has been merged to yesterday's linux-next as commit
1afccc5a201e ("net: phy: improve mdiobus_stats_acct"). In my tests I
found that it introduces the following warning on 32bit machines with
USB ethernet adapters, so the preempt disable was there for a good reason:
------------[ cut here ]------------
WARNING: ./include/linux/u64_stats_sync.h:171 at
mdiobus_stats_acct+0x288/0x2b4, CPU#0: kworker/0:3/50
Loading compiled-in X.509 certificates
Modules linked in:
CPU: 0 UID: 0 PID: 50 Comm: kworker/0:3 Not tainted
7.0.0-rc2-next-20260304 #12283 PREEMPT
Hardware name: Samsung Exynos (Flattened Device Tree)
Workqueue: usb_hub_wq hub_event
Call trace:
unwind_backtrace from show_stack+0x10/0x14
show_stack from dump_stack_lvl+0x68/0x88
dump_stack_lvl from __warn+0x94/0x210
__warn from warn_slowpath_fmt+0x1b0/0x1bc
warn_slowpath_fmt from mdiobus_stats_acct+0x288/0x2b4
mdiobus_stats_acct from __mdiobus_read+0x84/0xf0
__mdiobus_read from mdiobus_read+0x30/0x44
mdiobus_read from get_phy_device+0xac/0x140
get_phy_device from mdiobus_scan+0x24/0x104
mdiobus_scan from __mdiobus_register+0x21c/0x478
__mdiobus_register from smsc95xx_bind+0x3f4/0x5f0
smsc95xx_bind from usbnet_probe+0x330/0x928
usbnet_probe from usb_probe_interface+0xec/0x318
usb_probe_interface from really_probe+0xe0/0x424
really_probe from __driver_probe_device+0x9c/0x1f4
__driver_probe_device from driver_probe_device+0x30/0xc0
driver_probe_device from __device_attach_driver+0xa8/0x140
__device_attach_driver from bus_for_each_drv+0x84/0xdc
bus_for_each_drv from __device_attach+0xb0/0x214
__device_attach from device_initial_probe+0x3c/0x48
device_initial_probe from bus_probe_device+0x24/0x80
bus_probe_device from device_add+0x5c0/0x810
device_add from usb_set_configuration+0x4e4/0x974
usb_set_configuration from usb_generic_driver_probe+0x3c/0x78
usb_generic_driver_probe from usb_probe_device+0x4c/0x14c
usb_probe_device from really_probe+0xe0/0x424
really_probe from __driver_probe_device+0x9c/0x1f4
__driver_probe_device from driver_probe_device+0x30/0xc0
driver_probe_device from __device_attach_driver+0xa8/0x140
__device_attach_driver from bus_for_each_drv+0x84/0xdc
bus_for_each_drv from __device_attach+0xb0/0x214
__device_attach from device_initial_probe+0x3c/0x48
device_initial_probe from bus_probe_device+0x24/0x80
bus_probe_device from device_add+0x5c0/0x810
device_add from usb_new_device+0x23c/0x4f8
usb_new_device from hub_event+0x11dc/0x1ca4
hub_event from process_one_work+0x24c/0x7b8
process_one_work from worker_thread+0x1b8/0x3bc
worker_thread from kthread+0x128/0x168
kthread from ret_from_fork+0x14/0x28
Exception stack(0xf0a15fb0 to 0xf0a15ff8)
...
irq event stamp: 5711
hardirqs last enabled at (5911): [<c01c6c54>]
console_flush_one_record+0x424/0x570
hardirqs last disabled at (5943): [<c013ce4c>] handle_softirqs+0x53c/0x5c0
softirqs last enabled at (5944): [<c013cc3c>] handle_softirqs+0x32c/0x5c0
softirqs last disabled at (6157): [<c013d07c>] __irq_exit_rcu+0x144/0x1f0
---[ end trace 0000000000000000 ]---
> ---
> drivers/net/phy/mdio_bus.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 48c0447e6a8..b32a369cd25 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -358,22 +358,17 @@ EXPORT_SYMBOL(of_mdio_find_bus);
>
> 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);
> - if (ret < 0) {
> + if (ret < 0)
> u64_stats_inc(&stats->errors);
> - goto out;
> - }
> -
> - if (op)
> + else if (op)
> u64_stats_inc(&stats->reads);
> else
> u64_stats_inc(&stats->writes);
> -out:
> +
> u64_stats_update_end(&stats->syncp);
> - preempt_enable();
> }
>
> /**
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2026-03-05 8:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 22:04 [PATCH net-next 0/8] net: phy: improve stats handling in mdio_bus.c Heiner Kallweit
2026-02-27 22:05 ` [PATCH net-next 1/8] net: mdio: extend struct mdio_bus_stat_attr instead of using dev_ext_attribute Heiner Kallweit
2026-02-27 22:06 ` [PATCH net-next 2/8] net: mdio: use macro __ATTR to simplify the code Heiner Kallweit
2026-02-27 22:07 ` [PATCH net-next 3/8] net: phy: consider that mdio_bus_device_stat_field_show doesn't use member address Heiner Kallweit
2026-02-27 22:07 ` [PATCH net-next 4/8] net: phy: avoid extra casting in mdio_bus_get_stat Heiner Kallweit
2026-02-27 22:08 ` [PATCH net-next 5/8] net: mdio: constify attributes and attribute arrays Heiner Kallweit
2026-02-27 22:09 ` [PATCH net-next 6/8] net: mdio: use macro __ATTRIBUTE_GROUPS Heiner Kallweit
2026-02-27 22:10 ` [PATCH net-next 7/8] net: phy: inline helper mdio_bus_get_global_stat Heiner Kallweit
2026-02-27 22:11 ` [PATCH net-next 8/8] net: phy: improve mdiobus_stats_acct Heiner Kallweit
2026-03-05 8:31 ` Marek Szyprowski [this message]
2026-03-05 9:57 ` Heiner Kallweit
2026-03-03 12:30 ` [PATCH net-next 0/8] net: phy: improve stats handling in mdio_bus.c patchwork-bot+netdevbpf
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=9433de15-8675-4645-a6aa-85458e833d2d@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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