All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kurt Kanzenbach <kurt@linutronix.de>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Bouska, Zdenek" <zdenek.bouska@siemens.com>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
	Nishanth Menon <nm@ti.com>, Puranjay Mohan <p-mohan@ti.com>
Subject: Re: Unfair qspinlocks on ARM64 without LSE atomics => 3ms delay in interrupt handling
Date: Thu, 27 Apr 2023 15:45:09 +0200	[thread overview]
Message-ID: <871qk5782i.fsf@kurt> (raw)
In-Reply-To: <19641ab0-ab6a-9af7-8c64-34030e187848@siemens.com>

[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]

On Thu Apr 27 2023, Jan Kiszka wrote:
> On 26.04.23 23:29, Thomas Gleixner wrote:
>> On Wed, Apr 26 2023 at 12:03, Zdenek Bouska wrote:
>>> following patch is my current approach for fixing this issue. I introduced
>>> big_cpu_relax(), which uses Will's implementation [1] on ARM64 without
>>> LSE atomics and original cpu_relax() on any other CPU.
>> 
>> Why is this interrupt handling specific? Just because it's the place
>> where you observed it?
>> 
>> That's a general issue for any code which uses atomics for forward
>> progress. LL/SC simply does not guarantee that.
>> 
>> So if that helps, then this needs to be addressed globaly and not with
>> some crude hack in the interrupt handling code.
>
> My impression is that the retry loop of irq_finalize_oneshot is
> particularly susceptible to that issue due to the high acquire/relax
> pressure and inter-dependency between holder and waiter it generates -
> which does not mean it cannot occur in other places.
>
> Are we aware of other concrete case where it bites? Even with just
> "normal" contented spin_lock usage?

Well, some years ago I've observed a similar problem with ARM64
spinlocks, cpu_relax() and retry loops (in the futex code). It also
generated latency spikes up to 2-3ms. Back then, it was easily
reproducible using stress-ng --ptrace 4.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Kurt Kanzenbach <kurt@linutronix.de>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Bouska, Zdenek" <zdenek.bouska@siemens.com>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
	Nishanth Menon <nm@ti.com>, Puranjay Mohan <p-mohan@ti.com>
Subject: Re: Unfair qspinlocks on ARM64 without LSE atomics => 3ms delay in interrupt handling
Date: Thu, 27 Apr 2023 15:45:09 +0200	[thread overview]
Message-ID: <871qk5782i.fsf@kurt> (raw)
In-Reply-To: <19641ab0-ab6a-9af7-8c64-34030e187848@siemens.com>


[-- Attachment #1.1: Type: text/plain, Size: 1363 bytes --]

On Thu Apr 27 2023, Jan Kiszka wrote:
> On 26.04.23 23:29, Thomas Gleixner wrote:
>> On Wed, Apr 26 2023 at 12:03, Zdenek Bouska wrote:
>>> following patch is my current approach for fixing this issue. I introduced
>>> big_cpu_relax(), which uses Will's implementation [1] on ARM64 without
>>> LSE atomics and original cpu_relax() on any other CPU.
>> 
>> Why is this interrupt handling specific? Just because it's the place
>> where you observed it?
>> 
>> That's a general issue for any code which uses atomics for forward
>> progress. LL/SC simply does not guarantee that.
>> 
>> So if that helps, then this needs to be addressed globaly and not with
>> some crude hack in the interrupt handling code.
>
> My impression is that the retry loop of irq_finalize_oneshot is
> particularly susceptible to that issue due to the high acquire/relax
> pressure and inter-dependency between holder and waiter it generates -
> which does not mean it cannot occur in other places.
>
> Are we aware of other concrete case where it bites? Even with just
> "normal" contented spin_lock usage?

Well, some years ago I've observed a similar problem with ARM64
spinlocks, cpu_relax() and retry loops (in the futex code). It also
generated latency spikes up to 2-3ms. Back then, it was easily
reproducible using stress-ng --ptrace 4.

Thanks,
Kurt

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-04-27 13:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 12:03 Unfair qspinlocks on ARM64 without LSE atomics => 3ms delay in interrupt handling Bouska, Zdenek
2023-04-26 21:29 ` Thomas Gleixner
2023-04-26 21:29   ` Thomas Gleixner
2023-04-27  9:38   ` Bouska, Zdenek
2023-04-27  9:38     ` Bouska, Zdenek
2023-04-27 10:06     ` Will Deacon
2023-04-27 10:06       ` Will Deacon
2023-04-27 13:14   ` Jan Kiszka
2023-04-27 13:14     ` Jan Kiszka
2023-04-27 13:45     ` Kurt Kanzenbach [this message]
2023-04-27 13:45       ` Kurt Kanzenbach
2023-04-28  7:30       ` Sebastian Andrzej Siewior
2023-04-28  7:30         ` Sebastian Andrzej Siewior
2023-04-28  7:37         ` Kurt Kanzenbach
2023-04-28  7:37           ` Kurt Kanzenbach
  -- strict thread matches above, loose matches on Subject: below --
2023-03-24  8:43 Bouska, Zdenek
2023-03-24  8:43 ` Bouska, Zdenek
2023-03-24 17:01 ` Catalin Marinas
2023-03-24 17:01   ` Catalin Marinas
2023-03-24 18:09   ` Will Deacon
2023-03-24 18:09     ` Will Deacon
2023-03-28  9:39     ` Bouska, Zdenek
2023-03-28  9:39       ` Bouska, Zdenek
2023-03-27  5:44   ` Bouska, Zdenek
2023-03-27  5:44     ` Bouska, Zdenek

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=871qk5782i.fsf@kurt \
    --to=kurt@linutronix.de \
    --cc=catalin.marinas@arm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=p-mohan@ti.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=zdenek.bouska@siemens.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 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.