public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Jakub Kicinski <kuba@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 9/9] u64_stat: Remove the obsolete fetch_irq() variants
Date: Mon, 22 Aug 2022 17:17:00 +0200	[thread overview]
Message-ID: <YwOd7Ex7W21WzQ8N@linutronix.de> (raw)
In-Reply-To: <20220818104505.010ff950@kernel.org>

On 2022-08-18 10:45:05 [-0700], Jakub Kicinski wrote:
> BTW, I have a hazy memory of people saying they switched to the _irq()
> version because it reduced the number of retries significantly under
> traffic. Dunno how practical that is but would you be willing to scan
> the git history to double check that's not some of the motivation?

I didn't find any changes like -u64_stats_fetch_begin()
+u64_stats_fetch_begin_irq() for perf reasons. Thinking about it:

- On 32bit UP u64_stats_fetch_begin() disables only preemption during
  stats read up, so the number of retries must be 0 because no seqcount
  is used.

- On 32bit UP u64_stats_fetch_begin_irq() disables interrupt during stats
  read out so the number of retries must be 0 because no seqcount is
  used.

- On 32bit SMP u64_stats_fetch_begin()/ u64_stats_fetch_begin_irq()
  keep preemption/ interrupts as-is, uses seqcount and so retries might
  be observed.

Based on that I don't see how a switch to _irq() makes a change in an
SMP build while on UP you shouldn't see a retry at all.

Using u64_stats_fetch_begin() is most likely wrong in networking because
the stats are updated while packets are received which is either in IRQ
or in BH (except maybe for the SPI/I2C ethernet driver). The _bh()
version was replaced with _irq() for netpoll reasons.
u64_stats_fetch_begin() does not disable any of those two (IRQ, BH) on
32bit-UP and does not use a seqcount so it is possible that an update
happens during the read out of stats. Let me look…
	drivers/net/ethernet/cortina/gemini.c
reads in net_device_ops::ndo_get_stats64(), updates in NAPI.

	drivers/net/ethernet/huawei/hinic/hinic_rx.c
reads in net_device_ops::ndo_get_stats64() and
ethtool_ops::get_ethtool_stats(), updates in NAPI. Good.

So I guess these want be fixed properly instead of silently via the
series?

Sebastian

  reply	other threads:[~2022-08-22 15:22 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 16:26 [PATCH 0/9] Replace PREEMPT_RT ifdefs with preempt_[dis|en]able_nested() Sebastian Andrzej Siewior
2022-08-17 16:26 ` [PATCH 1/9] slub: Make PREEMPT_RT support less convoluted Sebastian Andrzej Siewior
2022-08-18  9:42   ` Christoph Lameter
2022-08-18 14:37     ` Vlastimil Babka
2022-08-18 15:22       ` Sebastian Andrzej Siewior
2022-08-19 15:04       ` Christoph Lameter
2022-08-25  5:15         ` Hyeonggon Yoo
2022-08-18 17:34   ` Linus Torvalds
2022-08-23 17:15   ` Vlastimil Babka
2022-08-24 13:25     ` Sebastian Andrzej Siewior
2022-08-24 13:54       ` Vlastimil Babka
2022-08-24 13:57         ` Sebastian Andrzej Siewior
2022-08-17 16:26 ` [PATCH 2/9] preempt: Provide preempt_[dis|en]able_nested() Sebastian Andrzej Siewior
2022-08-17 16:26 ` [PATCH 3/9] dentry: Use preempt_[dis|en]able_nested() Sebastian Andrzej Siewior
2022-08-17 16:26 ` [PATCH 4/9] mm/vmstat: " Sebastian Andrzej Siewior
2022-08-17 16:26 ` [PATCH 5/9] mm/debug: Provide VM_WARN_ON_IRQS_ENABLED() Sebastian Andrzej Siewior
2022-08-17 16:27 ` [PATCH 6/9] mm/memcontrol: Replace the PREEMPT_RT conditionals Sebastian Andrzej Siewior
2022-08-17 16:59   ` Johannes Weiner
2022-08-18  2:45   ` Muchun Song
2022-08-17 16:27 ` [PATCH 7/9] mm/compaction: Get rid of RT ifdeffery Sebastian Andrzej Siewior
2022-08-18  8:55   ` Rasmus Villemoes
2022-08-18 15:51     ` Sebastian Andrzej Siewior
2022-08-24 13:50     ` Thomas Gleixner
2022-08-17 16:27 ` [PATCH 8/9] u64_stats: Streamline the implementation Sebastian Andrzej Siewior
2022-08-17 16:27 ` [PATCH 9/9] u64_stat: Remove the obsolete fetch_irq() variants Sebastian Andrzej Siewior
2022-08-17 18:27   ` Jakub Kicinski
2022-08-18 15:27     ` Sebastian Andrzej Siewior
2022-08-18 16:02       ` Jakub Kicinski
2022-08-18 16:59         ` Sebastian Andrzej Siewior
2022-08-18 17:45           ` Jakub Kicinski
2022-08-22 15:17             ` Sebastian Andrzej Siewior [this message]
2022-08-22 18:05               ` Jakub Kicinski
2022-08-25 16:45                 ` Sebastian Andrzej Siewior
2022-08-25 17:30                   ` Jakub Kicinski
2022-08-18  8:20 ` [PATCH 0/9] Replace PREEMPT_RT ifdefs with preempt_[dis|en]able_nested() Peter Zijlstra
2022-08-18 17:41 ` Linus Torvalds

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=YwOd7Ex7W21WzQ8N@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.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