mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: "Aiqun(Maria) Yu" <quic_aiquny@quicinc.com>
Cc: Will Deacon <will@kernel.org>,
	corbet@lwn.net, catalin.marinas@arm.com, maz@kernel.org,
	quic_pkondeti@quicinc.com, quic_kaushalk@quicinc.com,
	quic_satyap@quicinc.com, quic_shashim@quicinc.com,
	quic_songxue@quicinc.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: Add the arm64.nolse_atomics command line option
Date: Thu, 13 Jul 2023 12:20:19 +0100	[thread overview]
Message-ID: <ZK_d86ApI1FCHhTL@FVFF77S0Q05N.cambridge.arm.com> (raw)
In-Reply-To: <604ac52d-4336-744f-2ab8-44d1c93fbaa8@quicinc.com>

On Thu, Jul 13, 2023 at 10:24:24AM +0800, Aiqun(Maria) Yu wrote:
> On 7/12/2023 3:36 PM, Mark Rutland wrote:
> > On Wed, Jul 12, 2023 at 11:09:10AM +0800, Aiqun(Maria) Yu wrote:
> > > On 7/11/2023 6:25 PM, Will Deacon wrote:
> > > > On Tue, Jul 11, 2023 at 06:15:49PM +0800, Aiqun(Maria) Yu wrote:
> > > > > On 7/11/2023 4:22 PM, Will Deacon wrote:
> > > > > > On Tue, Jul 11, 2023 at 12:02:22PM +0800, Aiqun(Maria) Yu wrote:
> > > > > > > On 7/10/2023 5:37 PM, Will Deacon wrote:
> > > > > > > > On Mon, Jul 10, 2023 at 01:59:55PM +0800, Maria Yu wrote:
> > > > > > > > > In order to be able to disable lse_atomic even if cpu
> > > > > > > > > support it, most likely because of memory controller
> > > > > > > > > cannot deal with the lse atomic instructions, use a
> > > > > > > > > new idreg override to deal with it.
> > > > > > > > 
> > > > > > > > This should not be a problem for cacheable memory though, right?
> > > > > > > > 
> > > > > > > > Given that Linux does not issue atomic operations to non-cacheable mappings,
> > > > > > > > I'm struggling to see why there's a problem here.
> > > > > > > 
> > > > > > > The lse atomic operation can be issued on non-cacheable mappings as well.
> > > > > > > Even if it is cached data, with different CPUECTLR_EL1 setting, it can also
> > > > > > > do far lse atomic operations.
> > > > > > 
> > > > > > Please can you point me to the place in the kernel sources where this
> > > > > > happens? The architecture doesn't guarantee that atomics to non-cacheable
> > > > > > mappings will work, see "B2.2.6 Possible implementation restrictions on
> > > > > > using atomic instructions". Linux, therefore, doesn't issue atomics
> > > > > > to non-cacheable memory.
> > > > > 
> > > > > We encounter the issue on third party kernel modules and third party apps
> > > > > instead of linux kernel itself.
> > > > 
> > > > Great, so there's nothing to do in the kernel then!
> > > > 
> > > > The third party code needs to be modified not to use atomic instructions
> > > > with non-cacheable mappings. No need to involve us with that.
> > > 
> > > > > This is a tradeoff of performance and stability. Per my understanding,
> > > > > options can be used to enable the lse_atomic to have the most performance
> > > > > cared system, and disable the lse_atomic by stability cared most system.
> > > > 
> > > > Where do livelock and starvation fit in with "stability"? Disabling LSE
> > > > atomics for things like qspinlock and the scheduler just because of some
> > > > badly written third-party code isn't much of a tradeoff.
> > 
> > > We also have requirement to have cpus/system fully support lse atomic and
> > > cpus/system not fully support lse atomic with a generic kernel image.
> > 
> > Who *specifically* has this requirement (i.e. what does 'we' mean here)? The
> 
> I can use other word to describe the requirement instead of "we".
> 
> There is requirements like android google gki. It request different cpu arch
> system to use same generic kernel Image.

GKI requires the system to use the generic kernel image; GKI does not require
supporting atomics to non-cacheable mappings.

What I am asking is: who has the requirement to perform atomics to
non-cacheable mappings?

> > upstream kernel does not require that atomics work on non-cacheable memory, and
> 
> The same issue the system can be down of lse atomic not supported for
> cachable memory when there need far atomic.

Are you saying that LSE atomics to *cacheable* mappings do not work on your
system?

Specifically, when using a Normal Inner-Shareable Inner-Writeback
Outer-Writeback mapping, do the LSE atomics work or not work?

> > saying "The company I work for want this" doesn't change that.
> > 
> > AFAICT the system here is architecturally compliant, and what you're relying
> > upon something that the architecture doesn't guarantee, and Linux doesn't
> > guarantee.
> 
> It is not also only our company's problem:
> To support the atomic instructions added in the Armv8.1 architecture, CHI-B
> provides Atomic Transactions. while Atomic Transactions support is also
> *optional* from CHI-B.
> 
> So far atomic cannot fully supported by ARMv8.1 cpu + CHI-B system as well.
> 
> from:
> https://developer.arm.com/documentation/102407/0100/Atomic-operations?lang=en
> 
> So only cpu support atomic cannot garantee the system support lse atomic
> > 
> > > Same kernel module wanted to be used by lse atomic fully support cpu and not
> > > fully support cpu/system as well.
> > 
> > Which kernel modules *specifically* need to do atomics to non-cacheable memory?
> The driver want to always do far atomic(no speculatively) and allow a
> read-modify-write non-interruptible sequence in a single instruction.

That doesn't answer my question (you haven't told me what "the driver" is).

That doesn't explain why you need to use non-cachable memory for this.

Thanks,
Mark.

  reply	other threads:[~2023-07-13 11:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  5:59 Maria Yu
2023-07-10  6:07 ` Randy Dunlap
2023-07-10  6:13   ` Aiqun(Maria) Yu
2023-07-10  7:27 ` Marc Zyngier
2023-07-10  8:19   ` Aiqun(Maria) Yu
2023-07-10  9:31     ` Marc Zyngier
2023-07-11  3:30       ` Aiqun(Maria) Yu
2023-07-11  6:57         ` Marc Zyngier
2023-07-11 10:12           ` Aiqun(Maria) Yu
2023-07-11 10:38             ` Marc Zyngier
2023-07-12  2:47               ` Aiqun(Maria) Yu
2023-07-12  7:29                 ` Marc Zyngier
2023-07-12  8:03                   ` Aiqun(Maria) Yu
2023-07-10  9:37 ` Will Deacon
2023-07-11  4:02   ` Aiqun(Maria) Yu
2023-07-11  8:22     ` Will Deacon
2023-07-11 10:15       ` Aiqun(Maria) Yu
2023-07-11 10:25         ` Will Deacon
2023-07-12  3:09           ` Aiqun(Maria) Yu
2023-07-12  7:36             ` Mark Rutland
2023-07-13  2:24               ` Aiqun(Maria) Yu
2023-07-13 11:20                 ` Mark Rutland [this message]
2023-07-13 14:08                   ` Aiqun(Maria) Yu
2023-07-13 19:08                     ` Mark Rutland
2023-07-14  1:56                       ` Aiqun(Maria) Yu
2023-07-14  8:23                         ` Will Deacon
2023-07-14 10:12                           ` Aiqun(Maria) Yu
2023-07-14 12:09                             ` Will Deacon
2023-07-17  2:01                               ` Aiqun(Maria) Yu
2023-07-11 10:34         ` Mark Rutland

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=ZK_d86ApI1FCHhTL@FVFF77S0Q05N.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=quic_aiquny@quicinc.com \
    --cc=quic_kaushalk@quicinc.com \
    --cc=quic_pkondeti@quicinc.com \
    --cc=quic_satyap@quicinc.com \
    --cc=quic_shashim@quicinc.com \
    --cc=quic_songxue@quicinc.com \
    --cc=will@kernel.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

all inboxes | Powered by JetHome®