From: Andrew Jones <ajones@ventanamicro.com>
To: "Clément Léger" <cleger@rivosinc.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, paul.walmsley@sifive.com,
palmer@dabbelt.com, charlie@rivosinc.com,
Anup Patel <apatel@ventanamicro.com>,
corbet@lwn.net
Subject: Re: [PATCH v3 7/8] riscv: Add parameter for skipping access speed tests
Date: Tue, 18 Mar 2025 15:57:16 +0100 [thread overview]
Message-ID: <20250318-58828155d9ca2801a21fa411@orel> (raw)
In-Reply-To: <ee650a6c-eed8-4a2b-82ee-868a784f26b3@rivosinc.com>
On Tue, Mar 18, 2025 at 03:09:58PM +0100, Clément Léger wrote:
>
>
> On 18/03/2025 10:00, Andrew Jones wrote:
> > On Tue, Mar 18, 2025 at 09:48:21AM +0100, Andrew Jones wrote:
> >> On Mon, Mar 17, 2025 at 03:39:01PM +0100, Alexandre Ghiti wrote:
> >>> Hi Drew,
> >>>
> >>> On 04/03/2025 13:00, Andrew Jones wrote:
> >>>> Allow skipping scalar and vector unaligned access speed tests. This
> >>>> is useful for testing alternative code paths and to skip the tests in
> >>>> environments where they run too slowly. All CPUs must have the same
> >>>> unaligned access speed.
> >>>
> >>> I'm not a big fan of the command line parameter, this is not where we should
> >>> push uarch decisions because there could be many other in the future, the
> >>> best solution to me should be in DT/ACPI and since the DT folks, according
> >>> to Palmer, shut down this solution, it remains using an extension.
> >>>
> >>> I have been reading a bit about unaligned accesses. Zicclsm was described as
> >>> "Even though mandated, misaligned loads and stores might execute extremely
> >>> slowly. Standard software distributions should assume their existence only
> >>> for correctness, not for performance." in rva20/22 but *not* in rva23. So
> >>> what about using this "hole" and consider that a platform that *advertises*
> >>> Zicclsm means its unaligned accesses are fast? After internal discussion, It
> >>> actually does not make sense to advertise Zicclsm if the platform accesses
> >>> are slow right?
> >>
> >> This topic pops up every so often, including in yesterday's server
> >> platform TG call. In that call, and, afaict, every other time it has
> >> popped up, the result is to reiterate that ISA extensions never say
> >> anything about performance. So, Zicclsm will never mean fast and we
> >> won't likely be able to add any extension that does.
> >>
> >>>
> >>> arm64 for example considers that armv8 has fast unaligned accesses and can
> >>> then enable HAVE_EFFICIENT_ALIGNED_ACCESS in the kernel, even though some
> >>> uarchs are slow. Distros will very likely use rva23 as baseline so they will
> >>> enable Zicclsm which would allow us to take advantage of this too, without
> >>> this, we lose a lot of perf improvement in the kernel, see
> >>> https://lore.kernel.org/lkml/20231225044207.3821-1-jszhang@kernel.org/.
> >>>
> >>> Or we could have a new named feature for this, even though it's weird to
> >>> have a named feature which would basically mean "Zicclsm is fast". We don't
> >>> have, for example, a named feature to say "Zicboz is fast" but given the
> >>> vague wording in the profile spec, maybe we can ask for one in that case?
> >>>
> >>> Sorry for the late review and for triggering this debate...
> >>
> >> No problem, let's try to pick the best option. I'll try listing all the
> >> options and there pros/cons.
> >>
> >> 1. Leave as is, which is to always probe
> >> pro: Nothing to do
> >> con: Not ideal in all environments
> >>
> >> 2. New DT/ACPI description
> >> pro: Describing whether or not misaligned accesses are implemented in
> >> HW (which presumably means fast) is something that should be done
> >> in HW descriptions
> >> con: We'll need to live with probing until we can get the descriptions
> >> defined, which may be never if there's too much opposition
> >>
> >> 3. Command line
> >> pro: Easy and serves its purpose, which is to skip probing in the
> >> environments where probing is not desired
> >> con: Yet another command line option (which we may want to deprecate
> >> someday)
> >>
> >> 4. New ISA extension
> >> pro: Easy to add to HW descriptions
> >> con: Not likely to get it through ratification
> >>
> >> 5. New SBI FWFT feature
> >> pro: Probably easier to get through ratification than an ISA extension
> >> con: Instead of probing, kernel would have to ask SBI -- would that
> >> even be faster? Will all the environments that want to skip
> >> probing even have a complete SBI?
>
> Hi Andrew
>
> FWFT is not really meant to "query" information from the firmware,
> fwft_set() wouldn't have anything to actually set. The problem would
> also just be pushed away from Linux but would probably still require
> specification anyway.
Agreed. Actually, if we had HW descriptions for every feature in FWFT,
and allowed each feature to have implementation-defined reset values,
then we wouldn't need the get function. The OS would only call the
set function if it disagreed with the value it saw in the HW description.
But this is getting off-topic and we can just agree that FWFT isn't the
right approach.
>
> >>
> >> 6. ??
> >
> > I forgot one, which was v1 of this series and already rejected,
> >
> > 6. Use ID registers
> > pro: None of the above cons, including the main con with the command
> > line, which is that there could be many other decisions in the
> > future, implying we could need many more command line options.
> > con: A slippery slope. We don't want to open the door to
> > features-by-idregs. (However, we can at least always close the
> > door again if better mechanisms become available. Command
> > lines would need to be deprecated, but feature-by-idreg code
> > can just be deleted.)
>
> My preferred option would have been option 2. BTW, what are the
> arguments to push away the description of misaligned access speed out of
> device-tree ? that's almost exactly what the device-tree is meant to do,
> ie describe hardware.
Actually, I don't know. Maybe Palmer can point to something.
Thanks,
drew
>
> As a last resort solution, I'm for option 3. There already exists a
> command line option to preset the jiffies. This is almost the same use
> case that we have, ie have a faster boot time by presetting the
> misaligned access probing.
>
> IMHO, skipping misaligned access probing speed is orthogonal to
> EFFICIENT_UNALIGNED_ACCESS. one is done at runtime and allows the
> userspace to know the speed of misaligned accesses, the other one at
> compile time to improve kernel speed. Depending on which system we want
> to support, we might need to enable EFFICIENT_UNALIGNED_ACCESS as a
> default, allowing for the most Linux "capable" chips to have full
> performances.
>
> Thanks,
>
> Clément
>
> >
> > Thanks,
> > drew
> >
> >>
> >> I'm voting for (3), which is why I posted this patchset, but I'm happy
> >> to hear other votes or other proposals and discuss.
> >>
> >> Thanks,
> >> drew
>
next prev parent reply other threads:[~2025-03-18 14:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 12:00 [PATCH v3 0/8] riscv: Unaligned access speed probing fixes and skipping Andrew Jones
2025-03-04 12:00 ` [PATCH v3 1/8] riscv: Annotate unaligned access init functions Andrew Jones
2025-03-04 12:00 ` [PATCH v3 2/8] riscv: Fix riscv_online_cpu_vec Andrew Jones
2025-03-04 12:00 ` [PATCH v3 3/8] riscv: Fix check_unaligned_access_all_cpus Andrew Jones
2025-03-04 12:00 ` [PATCH v3 4/8] riscv: Change check_unaligned_access_speed_all_cpus to void Andrew Jones
2025-03-04 12:00 ` [PATCH v3 5/8] riscv: Fix set up of cpu hotplug callbacks Andrew Jones
2025-03-04 12:00 ` [PATCH v3 6/8] riscv: Fix set up of vector cpu hotplug callback Andrew Jones
2025-03-04 12:00 ` [PATCH v3 7/8] riscv: Add parameter for skipping access speed tests Andrew Jones
2025-03-17 14:39 ` Alexandre Ghiti
2025-03-18 8:48 ` Andrew Jones
2025-03-18 9:00 ` Andrew Jones
2025-03-18 14:09 ` Clément Léger
2025-03-18 14:57 ` Andrew Jones [this message]
2025-03-18 12:13 ` Alexandre Ghiti
2025-03-18 12:45 ` Andrew Jones
2025-03-18 12:58 ` Alexandre Ghiti
2025-03-18 13:04 ` Andrew Jones
2025-03-18 14:09 ` Alexandre Ghiti
2025-03-18 14:22 ` Clément Léger
2025-03-18 15:09 ` Andrew Jones
2025-03-18 15:40 ` Anup Patel
2025-04-07 9:49 ` Geert Uytterhoeven
2025-04-07 13:45 ` Andrew Jones
2025-04-08 12:25 ` Geert Uytterhoeven
2025-04-08 13:03 ` Andrew Jones
2025-04-08 15:32 ` Geert Uytterhoeven
2025-03-04 12:00 ` [PATCH v3 8/8] Documentation/kernel-parameters: Add riscv unaligned speed parameters Andrew Jones
2025-03-05 22:48 ` [PATCH v3 0/8] riscv: Unaligned access speed probing fixes and skipping Charlie Jenkins
2025-03-06 8:13 ` Andrew Jones
2025-03-27 3:24 ` patchwork-bot+linux-riscv
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=20250318-58828155d9ca2801a21fa411@orel \
--to=ajones@ventanamicro.com \
--cc=alex@ghiti.fr \
--cc=apatel@ventanamicro.com \
--cc=charlie@rivosinc.com \
--cc=cleger@rivosinc.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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