From: Conor Dooley <conor.dooley@microchip.com>
To: Evan Green <evan@rivosinc.com>
Cc: Palmer Dabbelt <palmer@rivosinc.com>, <slewis@rivosinc.com>,
<heiko@sntech.de>, Conor Dooley <conor@kernel.org>,
<vineetg@rivosinc.com>, Albert Ou <aou@eecs.berkeley.edu>,
Andrew Bresticker <abrestic@rivosinc.com>,
Andrew Jones <ajones@ventanamicro.com>,
Andrew Morton <akpm@linux-foundation.org>,
Anup Patel <apatel@ventanamicro.com>,
Atish Patra <atishp@rivosinc.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Celeste Liu <coelacanthus@outlook.com>,
Guo Ren <guoren@kernel.org>, Heiko Carstens <hca@linux.ibm.com>,
Heiko Stuebner <heiko.stuebner@vrull.eu>,
Jann Horn <jannh@google.com>, Jisheng Zhang <jszhang@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Ley Foon Tan <leyfoon.tan@starfivetech.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Mark Brown <broonie@kernel.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Nathan Chancellor <nathan@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Samuel Holland <samuel@sholland.org>,
Shuah Khan <shuah@kernel.org>,
Sunil V L <sunilvl@ventanamicro.com>,
Tobias Klauser <tklauser@distanz.ch>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
<linux-riscv@lists.infradead.org>
Subject: Re: [PATCH v6 0/6] RISC-V Hardware Probing User Interface
Date: Tue, 11 Apr 2023 15:16:58 +0100 [thread overview]
Message-ID: <20230411-primate-rice-a5c102f90c6c@wendy> (raw)
In-Reply-To: <20230407231103.2622178-1-evan@rivosinc.com>
[-- Attachment #1: Type: text/plain, Size: 3615 bytes --]
Hey Evan,
On Fri, Apr 07, 2023 at 04:10:57PM -0700, Evan Green wrote:
>
> There's been a bunch of off-list discussions about this, including at
> Plumbers. The original plan was to do something involving providing an
> ISA string to userspace, but ISA strings just aren't sufficient for a
> stable ABI any more: in order to parse an ISA string users need the
> version of the specifications that the string is written to, the version
> of each extension (sometimes at a finer granularity than the RISC-V
> releases/versions encode), and the expected use case for the ISA string
> (ie, is it a U-mode or M-mode string). That's a lot of complexity to
> try and keep ABI compatible and it's probably going to continue to grow,
> as even if there's no more complexity in the specifications we'll have
> to deal with the various ISA string parsing oddities that end up all
> over userspace.
>
> Instead this patch set takes a very different approach and provides a set
> of key/value pairs that encode various bits about the system. The big
> advantage here is that we can clearly define what these mean so we can
> ensure ABI stability, but it also allows us to encode information that's
> unlikely to ever appear in an ISA string (see the misaligned access
> performance, for example). The resulting interface looks a lot like
> what arm64 and x86 do, and will hopefully fit well into something like
> ACPI in the future.
>
> The actual user interface is a syscall, with a vDSO function in front of
> it. The vDSO function can answer some queries without a syscall at all,
> and falls back to the syscall for cases it doesn't have answers to.
> Currently we prepopulate it with an array of answers for all keys and
> a CPU set of "all CPUs". This can be adjusted as necessary to provide
> fast answers to the most common queries.
>
> An example series in glibc exposing this syscall and using it in an
> ifunc selector for memcpy can be found at [1].
>
> I was asked about the performance delta between this and something like
> sysfs. I created a small test program [2] and ran it on a Nezha D1
> Allwinner board. Doing each operation 100000 times and dividing, these
> operations take the following amount of time:
> - open()+read()+close() of /sys/kernel/cpu_byteorder: 3.8us
> - access("/sys/kernel/cpu_byteorder", R_OK): 1.3us
> - riscv_hwprobe() vDSO and syscall: .0094us
> - riscv_hwprobe() vDSO with no syscall: 0.0091us
>
> These numbers get farther apart if we query multiple keys, as sysfs will
> scale linearly with the number of keys, where the dedicated syscall
> stays the same. To frame these numbers, I also did a tight
> fork/exec/wait loop, which I measured as 4.8ms. So doing 4
> open/read/close operations is a delta of about 0.3%, versus a single vDSO
> call is a delta of essentially zero.
Two nits w.r.t. build bot complaints...
On patch 2:
arch/riscv/include/uapi/asm/unistd.h:54:1: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
I think this one is kinda spurious, all of the syscalls complain like
this (and do on arm64 too IIRC). There was a patch from Guo somewhere to
disable -Winitializer-overrides in this case, I should go find out what
happened to it.
On patch 4:
arch/riscv/kernel/cpufeature.c:29:1: warning: symbol '__pcpu_scope_misaligned_access_speed' was not declared. Should it be static?
Probably because cos cpufeature.c doesn't include the header of the same
name... Perhaps Palmer could fix that one up on application?
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-04-11 14:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 23:10 [PATCH v6 0/6] RISC-V Hardware Probing User Interface Evan Green
2023-04-07 23:10 ` [PATCH v6 1/6] RISC-V: Move struct riscv_cpuinfo to new header Evan Green
2023-04-19 14:30 ` patchwork-bot+linux-riscv
2023-04-07 23:10 ` [PATCH v6 2/6] RISC-V: Add a syscall for HW probing Evan Green
2023-04-07 23:11 ` [PATCH v6 3/6] RISC-V: hwprobe: Add support for RISCV_HWPROBE_BASE_BEHAVIOR_IMA Evan Green
2023-04-14 1:37 ` Paul Walmsley
2023-04-07 23:11 ` [PATCH v6 4/6] RISC-V: hwprobe: Support probing of misaligned access performance Evan Green
2023-04-11 14:06 ` Conor Dooley
2023-04-12 13:50 ` Paul Walmsley
2023-04-07 23:11 ` [PATCH v6 5/6] selftests: Test the new RISC-V hwprobe interface Evan Green
2023-04-07 23:11 ` [PATCH v6 6/6] RISC-V: Add hwprobe vDSO function and data Evan Green
2023-04-11 14:16 ` Conor Dooley [this message]
2023-04-20 17:36 ` [PATCH v6 0/6] RISC-V Hardware Probing User Interface Palmer Dabbelt
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=20230411-primate-rice-a5c102f90c6c@wendy \
--to=conor.dooley@microchip.com \
--cc=Liam.Howlett@oracle.com \
--cc=abrestic@rivosinc.com \
--cc=ajones@ventanamicro.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=apatel@ventanamicro.com \
--cc=atishp@rivosinc.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=coelacanthus@outlook.com \
--cc=conor@kernel.org \
--cc=corbet@lwn.net \
--cc=evan@rivosinc.com \
--cc=guoren@kernel.org \
--cc=hca@linux.ibm.com \
--cc=heiko.stuebner@vrull.eu \
--cc=heiko@sntech.de \
--cc=jannh@google.com \
--cc=jszhang@kernel.org \
--cc=leyfoon.tan@starfivetech.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mike.kravetz@oracle.com \
--cc=nathan@kernel.org \
--cc=palmer@dabbelt.com \
--cc=palmer@rivosinc.com \
--cc=paul.walmsley@sifive.com \
--cc=philipp.tomsich@vrull.eu \
--cc=samuel@sholland.org \
--cc=shuah@kernel.org \
--cc=slewis@rivosinc.com \
--cc=sunilvl@ventanamicro.com \
--cc=tklauser@distanz.ch \
--cc=vineetg@rivosinc.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;
as well as URLs for NNTP newsgroup(s).