From: Conor Dooley <conor@kernel.org>
To: Jonathan Cameron <jonathan.cameron@huawei.com>
Cc: Randy Dunlap <rdunlap@infradead.org>,
Catalin Marinas <catalin.marinas@arm.com>,
linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
Dan Williams <dan.j.williams@intel.com>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>, Drew Fustini <fustini@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
james.morse@arm.com, Will Deacon <will@kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>,
linuxarm@huawei.com, Yushan Wang <wangyushan12@huawei.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, Andy Lutomirski <luto@kernel.org>,
Dave Jiang <dave.jiang@intel.com>
Subject: Re: [PATCH v6 3/7] lib: Support ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
Date: Wed, 19 Nov 2025 18:44:43 +0000 [thread overview]
Message-ID: <20251119-charging-gallon-bea196c3a547@spud> (raw)
In-Reply-To: <20251119094255.00000020@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 4739 bytes --]
On Wed, Nov 19, 2025 at 09:42:55AM +0000, Jonathan Cameron wrote:
> On Tue, 18 Nov 2025 17:18:31 -0800
> Randy Dunlap <rdunlap@infradead.org> wrote:
>
> > On 11/18/25 1:30 AM, Jonathan Cameron wrote:
> > > On Tue, 18 Nov 2025 00:13:07 +0000
> > > Conor Dooley <conor@kernel.org> wrote:
> > >
> > >> On Mon, Nov 17, 2025 at 10:51:11AM -0800, Randy Dunlap wrote:
> > >>> Hi,
> > >>>
> > >>> On 11/17/25 2:47 AM, Jonathan Cameron wrote:
> > >>>> diff --git a/lib/Kconfig b/lib/Kconfig
> > >>>> index e629449dd2a3..e11136d188ae 100644
> > >>>> --- a/lib/Kconfig
> > >>>> +++ b/lib/Kconfig
> > >>>> @@ -542,6 +542,10 @@ config MEMREGION
> > >>>> config ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
> > >>>> bool
> > >>>>
> > >>>> +config GENERIC_CPU_CACHE_MAINTENANCE
> > >>>> + bool
> > >>>> + select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
> > >>>> +
> > >>>> config ARCH_HAS_MEMREMAP_COMPAT_ALIGN
> > >>>> bool
> > >>>
> > >>> Architectures and/or platforms select ARCH_HAS_*.
> > >>>
> > >>> With this change above, it becomes the only entry in
> > >>> lib/Kconfig that does "select ARCH_HAS_anytning".
> > >>>
> > >>> so I think this is wrong, back*wards.
> > >>
> > >> Maybe it is backwards, but I feel like this way is more logical. ARM64
> > >> has memregion invalidation only because this generic approach is
> > >> enabled, so the arch selects what it needs to get the support.
> > >
> > > Exactly this. Catalin requested this form in response to an earlier
> > > version where arm64 Kconfig just had both selects for pretty much that
> > > reason. This is expected to be used on a subset of architectures.
> > > It is similar to things like GENERIC_ARCH_NUMA in this respect (though the
> > > arch_numa_init() etc in there are called only from other arch code
> > > so no ARCH_HAS_ symbols are associated with them).
> > >
> > >> Alternatively, something like
> > >
> > > I'm fine with this solution if Randy prefers it.
> >
> > I do much prefer this alternative.
> >
> > > Thanks for your help with this.
> >
> > Thanks for listening.
>
> Conor,
>
> Given it is your proposed solution, I'm guessing you'll either spin a patch
> on top or squash it into original. If you spin a patch for this.
>
> Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>
New patch I think, since you say Catalin specifically asked for the
current setup.
>
> Thanks again!
>
> Jonathan
>
> >
> >
> > >> | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > >> | index 5f7f63d24931..75b2507f7eb2 100644
> > >> | --- a/arch/arm64/Kconfig
> > >> | +++ b/arch/arm64/Kconfig
> > >> | @@ -21,6 +21,7 @@ config ARM64
> > >> | select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
> > >> | select ARCH_HAS_CACHE_LINE_SIZE
> > >> | select ARCH_HAS_CC_PLATFORM
> > >> | + select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
> > >> | select ARCH_HAS_CURRENT_STACK_POINTER
> > >> | select ARCH_HAS_DEBUG_VIRTUAL
> > >> | select ARCH_HAS_DEBUG_VM_PGTABLE
> > >> | @@ -146,7 +147,6 @@ config ARM64
> > >> | select GENERIC_ARCH_TOPOLOGY
> > >> | select GENERIC_CLOCKEVENTS_BROADCAST
> > >> | select GENERIC_CPU_AUTOPROBE
> > >> | - select GENERIC_CPU_CACHE_MAINTENANCE
> > >> | select GENERIC_CPU_DEVICES
> > >> | select GENERIC_CPU_VULNERABILITIES
> > >> | select GENERIC_EARLY_IOREMAP
> > >> | diff --git a/lib/Kconfig b/lib/Kconfig
> > >> | index 09aec4a1e13f..ac223e627bc5 100644
> > >> | --- a/lib/Kconfig
> > >> | +++ b/lib/Kconfig
> > >> | @@ -544,8 +544,9 @@ config ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
> > >> | bool
> > >> |
> > >> | config GENERIC_CPU_CACHE_MAINTENANCE
> > >> | - bool
> > >> | - select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
> > >> | + def_bool y
> > >> | + depends on ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
> > >> | + depends on ARM64
> > >> |
> > >> | config ARCH_HAS_MEMREMAP_COMPAT_ALIGN
> > >> | bool
> > >> implies (to me at least) that arm64 has memregion invalidation as an
> > >> architectural feature and that the GENERIC_CPU_CACHE_MAINTENANCE option
> > >> is a just common cross-arch code, like generic entry etc, rather than
> > >> being the option gating the drivers that provide the feature in the
> > >> first place.
> > >>
> > >> I didn't really care which way it went, and was gonna post something to
> > >> squash and avoid another revision, but I found the resultant Kconfig
> > >> setup to be make less sense to me than what came before. If the switched
> > >> around version is less likely to be problematic etc, then sure, but I
> > >> amn't convinced by switching it at a first glance.
> >
> >
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-11-19 18:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 10:47 [PATCH v6 0/7] Cache coherency management subsystem Jonathan Cameron
2025-11-17 10:47 ` [PATCH v6 1/7] memregion: Drop unused IORES_DESC_* parameter from cpu_cache_invalidate_memregion() Jonathan Cameron
2025-11-17 10:47 ` [PATCH v6 2/7] memregion: Support fine grained invalidate by cpu_cache_invalidate_memregion() Jonathan Cameron
2025-11-17 10:47 ` [PATCH v6 3/7] lib: Support ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION Jonathan Cameron
2025-11-17 18:51 ` Randy Dunlap
2025-11-18 0:13 ` Conor Dooley
2025-11-18 9:30 ` Jonathan Cameron
2025-11-19 1:18 ` Randy Dunlap
2025-11-19 9:42 ` Jonathan Cameron
2025-11-19 18:44 ` Conor Dooley [this message]
2025-11-20 9:55 ` Jonathan Cameron
2025-11-17 10:47 ` [PATCH v6 4/7] arm64: Select GENERIC_CPU_CACHE_MAINTENANCE Jonathan Cameron
2025-11-17 10:47 ` [PATCH v6 5/7] MAINTAINERS: Add Jonathan Cameron to drivers/cache and add lib/cache_maint.c + header Jonathan Cameron
2025-11-17 10:47 ` [PATCH v6 6/7] cache: Make top level Kconfig menu a boolean dependent on RISCV Jonathan Cameron
2025-11-17 10:48 ` [PATCH v6 7/7] cache: Support cache maintenance for HiSilicon SoC Hydra Home Agent Jonathan Cameron
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=20251119-charging-gallon-bea196c3a547@spud \
--to=conor@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexandre.belloni@bootlin.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=fustini@kernel.org \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=krzk@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxarm@huawei.com \
--cc=lpieralisi@kernel.org \
--cc=luto@kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=tglx@linutronix.de \
--cc=wangyushan12@huawei.com \
--cc=will@kernel.org \
--cc=x86@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