From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: Justin Lai <justinlai0215@realtek.com>, <kuba@kernel.org>,
<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
<andrew+netdev@lunn.ch>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <horms@kernel.org>,
<pkshih@realtek.com>, <larry.chiu@realtek.com>
Subject: Re: [PATCH] rtase: Avoid sleeping in get_stats64()
Date: Tue, 2 Jun 2026 15:43:04 +0200 [thread overview]
Message-ID: <d84e7de2-d30d-4ec1-bdfd-6d5e25d0271a@intel.com> (raw)
In-Reply-To: <20260601224203.5d282c21@pumpkin>
From: David Laight <david.laight.linux@gmail.com>
Date: Mon, 1 Jun 2026 22:42:03 +0100
> On Mon, 1 Jun 2026 15:14:50 +0200
> Alexander Lobakin <aleksander.lobakin@intel.com> wrote:
>
>> From: Justin Lai <justinlai0215@realtek.com>
>> Date: Mon, 1 Jun 2026 14:24:47 +0800
>>
>>> The .ndo_get_stats64 callback must not sleep because it can be
>>> called when reading /proc/net/dev.
>>>
>>> rtase_get_stats64() calls rtase_dump_tally_counter(), which polls
>>> the tally counter dump bit with read_poll_timeout(). This may
>>> sleep while waiting for the hardware counter dump to complete.
>>>
>>> Use read_poll_timeout_atomic() instead to avoid sleeping in the
>>> get_stats64() path.
>>>
>>> Signed-off-by: Justin Lai <justinlai0215@realtek.com>
>>
>> Looks legit.
>>
>> One question: for how long can this poll for in real life scenarios? Up
>> to ~1 ms is okay-ish for atomic, but if longer, then you'd better to
>> split it into shorter polls and reschedule() time to time.
>
> Anyone trying to get a thread running at an RT priority won't thank you
> for spinning for anywhere near that long.
> When an RT processes becomes runnable the scheduler will preempt a lower
> priority process that is running on the cpu the RT process last ran on.
> The RT process won't run until the preempt actually happens.
>
> 1ms is a very long time.
That's why I wrote "okay-ish". Ideally atomic polling should not go past
100 us, I usually used it for no longer than 10-50 us.
The author says that it usually takes around 25 us which is acceptable
I'd say.
Thanks,
Olek
next prev parent reply other threads:[~2026-06-02 13:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 6:24 [PATCH] rtase: Avoid sleeping in get_stats64() Justin Lai
2026-06-01 13:14 ` Alexander Lobakin
2026-06-01 21:42 ` David Laight
2026-06-02 13:43 ` Alexander Lobakin [this message]
2026-06-02 10:50 ` Justin Lai
2026-06-02 18:09 ` Jakub Kicinski
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=d84e7de2-d30d-4ec1-bdfd-6d5e25d0271a@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=david.laight.linux@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=justinlai0215@realtek.com \
--cc=kuba@kernel.org \
--cc=larry.chiu@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pkshih@realtek.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