public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: "Aiqun(Maria) Yu" <quic_aiquny@quicinc.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	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: Fri, 14 Jul 2023 13:09:46 +0100	[thread overview]
Message-ID: <20230714120946.GA5597@willie-the-truck> (raw)
In-Reply-To: <b76c7a9b-8ed6-97da-bdfa-47cc7db51ff5@quicinc.com>

On Fri, Jul 14, 2023 at 06:12:02PM +0800, Aiqun(Maria) Yu wrote:
> On 7/14/2023 4:23 PM, Will Deacon wrote:
> > On Fri, Jul 14, 2023 at 09:56:27AM +0800, Aiqun(Maria) Yu wrote:
> > > Try to a detailed summarise of the whole discussions, anyone can ignore some
> > > part if you are already know.
> > > 
> > > * Part 1: Solution for this issue.
> > > While we still want to have options to let third party and end users can
> > > have options:
> > >    1.Disable lse atomic cap.
> > >    2.*Disallow* far atomic by "CPUECTLR_EL1.atom force near atomic" and
> > > non-cachable mappling for lse atomic only.
> > 
> > Sorry, but this still isn't making sense to me. Which CPUs do you have on
> > this SoC?
> cpu is cortex A78/A55.
> > 
> > My understanding of the CPUs from ARM is that LSE atomics are not supposed
> > to be sent to blocks that don't support them. That doesn't mean you have to
> > do everything near, however -- you can still execute them at e.g. L2.
> > 
> > For example, the Cortex-X1 TRM states:
> > 
> >    | Atomic instructions to cacheable memory can be performed as either
> >    | near atomics or far atomics, depending on where the cache line
> >    | containing the data resides.
> >    |
> >    | When an instruction hits in the L1 data cache in a unique state, then
> >    | it is performed as a near atomic in the L1 memory system. If the atomic
> >    | operation misses in the L1 cache, or the line is shared with another
> >    | core, then the atomic is sent as a far atomic on the core CHI interface.
> lse atomic is optional to CHI-B for example, some system may have cpu
> feature register have lse atomic feature, but the far atomic is not accpeted
> by CHI side. It will be simiar issue that we do.

Again, that should not be a problem. Looking at the A55 TRM, it explicitly
says that atomics will be done in the L3 if the interconnect does not
support them. The A78 TRM doesn't talk about this at all, so I defer to
Mark (or anybody else from Arm) on how that works, but one might assume
that it does something similar to the other Arm cores.

> > > * Part 2: Why we need the solution
> > > 1. There is also some case far atomic is better performance than near
> > > atomic. end user may still can still try to do allow far atomic.
> > > while this driver is also use kerenl LSE ATOMIC macro, so it can be running
> > > on cpu don't support lse atomic and cpu support lse atomic already.
> > > while current system, cpu have feature register said lse atomic is
> > > supported, but memory controller is not supported is currently not yet
> > > supported.
> > 
> > I think you're forgetting the fact that these instructions can be executed
> > by userspace, so the kernel option is completely bogus. If you're saying
> > that cacheable atomics can cause external aborts, then I can write an app
> > which will crash your device even if you've set this command line option.
> > 
> For apps like userspace also needed to check the system capbility as far as

That's not something you can enforce, so a malicious application can easily
crash your system.

Will

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

  parent reply	other threads:[~2023-07-14 12:10 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  5:59 [PATCH] arm64: Add the arm64.nolse_atomics command line option 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
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  1:56                         ` Aiqun(Maria) Yu
2023-07-14  8:23                         ` Will Deacon
2023-07-14 10:12                           ` Aiqun(Maria) Yu
2023-07-14 10:12                             ` Aiqun(Maria) Yu
2023-07-14 12:09                             ` Will Deacon [this message]
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=20230714120946.GA5597@willie-the-truck \
    --to=will@kernel.org \
    --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=mark.rutland@arm.com \
    --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 \
    /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