From: Xi Ruoyao <xry111@xry111.site>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>
Cc: Arnd Bergmann <arnd@arndb.de>,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org
Subject: Re: [PATCH 2/3] loongarch: Introduce sys_loongarch_flush_icache syscall
Date: Sat, 04 Jan 2025 17:31:48 +0800 [thread overview]
Message-ID: <3409b0608ba127c356e2a6d760c3ac2d446c9da7.camel@xry111.site> (raw)
In-Reply-To: <20250102-la32-uapi-v1-2-db32aa769b88@flygoat.com>
On Thu, 2025-01-02 at 18:34 +0000, Jiaxun Yang wrote:
/* snip */
> Sadly many user space applications are assuming ICACHET support, we can't
> recall those binaries. So we'd better get UAPI for cacheflush ready soonish
> and encourage application to start using it.
To encourage the developers changing ibar to loongarch_flush_icache, we
should minimize the extra overhead on mainstream systems. We can add an
vDSO layer so if the CPU has ICACHET:
int vdso_loongarch_flush_icache(...)
{
asm ("ibar 0");
return 0;
}
And otherwise the vDSO wrapper invokes the real syscall. I've
implemented the boot-time alternative runtime patching for vDSO at
https://lore.kernel.org/loongarch/20240816110717.10249-3-xry111@xry111.site/.
> The syscall resolves to a ibar for now, it should be revised when we have
> actual non-ICACHET support in kernel.
/* snip */
> diff --git a/arch/loongarch/include/asm/cacheflush.h b/arch/loongarch/include/asm/cacheflush.h
> index f8754d08a31ab07490717c31b9253871668b9a76..94f4a47f00860977db0b360965a22ff0a461c098 100644
> --- a/arch/loongarch/include/asm/cacheflush.h
> +++ b/arch/loongarch/include/asm/cacheflush.h
> @@ -80,6 +80,12 @@ static inline void flush_cache_line(int leaf, unsigned long addr)
> }
> }
>
> +/*
> + * Bits in sys_loongarch_flush_icache()'s flags argument.
> + */
> +#define SYS_LOONGARCH_FLUSH_ICACHE_LOCAL 1UL
> +#define SYS_LOONGARCH_FLUSH_ICACHE_ALL (SYS_LOONGARCH_FLUSH_ICACHE_LOCAL)
Not a UAPI header so not usable by the user? How would they specify
flags then?
If you meant to add them for UAPI, it would be very problematic. When a
new cache type emerges in the hardware implementations, we need to grow
SYS_LOONGARCH_FLUSH_ICACHE_ALL in the UAPI header, but we cannot change
the already compiled JIT applications. Thus all JIT applications have
to be recompiled with the latest UAPI header. This just seems an
unnecessary severe burden to the packagers.
Instead IMO it's better not to expose so much details to the userspace.
Just remove the flags argument and flush all the icaches the kernel
knows, so with a new cache type the user (and distro) just need to
update or patch their kernel, w/o recompiling all JIT apps.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
next prev parent reply other threads:[~2025-01-04 9:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 18:34 [PATCH 0/3] LoongArch: initial 32-bit UAPI Jiaxun Yang
2025-01-02 18:34 ` [PATCH 1/3] loongarch: Wire up 32 bit syscalls Jiaxun Yang
2025-01-04 15:31 ` Arnd Bergmann
2025-01-02 18:34 ` [PATCH 2/3] loongarch: Introduce sys_loongarch_flush_icache syscall Jiaxun Yang
2025-01-04 9:04 ` Jinyang Shen
2025-01-04 11:18 ` Jiaxun Yang
2025-01-04 15:07 ` Arnd Bergmann
2025-01-04 15:42 ` Jiaxun Yang
2025-01-04 9:31 ` Xi Ruoyao [this message]
2025-01-04 11:33 ` Jiaxun Yang
2025-01-02 18:34 ` [PATCH 3/3] loongarch: vdso: Introduce __vdso_flush_icache function Jiaxun Yang
2025-01-04 8:27 ` [PATCH 0/3] LoongArch: initial 32-bit UAPI Jinyang Shen
2025-01-04 15:00 ` Arnd Bergmann
2025-01-04 15:13 ` Xi Ruoyao
2025-01-04 16:03 ` Jiaxun Yang
2025-01-05 4:43 ` Arnd Bergmann
2025-01-05 10:27 ` Jiaxun Yang
2025-01-05 12:03 ` Jiaxun Yang
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=3409b0608ba127c356e2a6d760c3ac2d446c9da7.camel@xry111.site \
--to=xry111@xry111.site \
--cc=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
/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