linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] arch_topology: Pre-allocate cacheinfo from primary CPU
@ 2023-04-03 23:15 Radu Rendec
  2023-04-03 23:15 ` [PATCH v2 1/2] cacheinfo: Add arch specific early level initializer Radu Rendec
  2023-04-03 23:15 ` [PATCH v2 2/2] cacheinfo: Add arm64 early level initializer implementation Radu Rendec
  0 siblings, 2 replies; 5+ messages in thread
From: Radu Rendec @ 2023-04-03 23:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Catalin Marinas, Will Deacon, Pierre Gondois, Sudeep Holla,
	linux-arm-kernel

Commit 5944ce092b97 ("arch_topology: Build cacheinfo from primary CPU")
tries to build the cacheinfo from the primary CPU prior to secondary
CPUs boot, if the DT/ACPI description contains cache information.
However, if such information is not present, it still reverts to the old
behavior, which allocates the cacheinfo memory on each secondary CPU. On
RT kernels, this triggers a "BUG: sleeping function called from invalid
context" because the allocation is done before preemption is first
enabled on the secondary CPU.

The solution is to add cache information to DT/ACPI, but at least on
arm64 systems this can be avoided by leveraging automatic detection
(through the CLIDR_EL1 register), which is already implemented but
currently doesn't work on RT kernels for the reason described above.

This patch series attempts to enable automatic detection for RT kernels
when no DT/ACPI cache information is available, by pre-allocating
cacheinfo memory on the primary CPU.

The first patch adds an architecture independent infrastructure that
allows architecture specific code to take an early guess at the number
of cache leaves of the secodary CPUs, while it runs in preemptible
context on the primary CPU. At the same time, it gives architecture
specific code the opportunity to go back later, while it runs on the
secondary CPU, and reallocate the cacheinfo memory if the initial guess
proves to be wrong.

The second patch leverages the infrastructure implemented in the first
patch and enables early cache depth detection for arm64.

The patch series is based on an RFC patch that was posted to the
linux-arm-kernel mailing list and discussed with a smaller audience:
https://lore.kernel.org/all/20230323224242.31142-1-rrendec@redhat.com/

Radu Rendec (2):
  cacheinfo: Add arch specific early level initializer
  cacheinfo: Add arm64 early level initializer implementation

 arch/arm64/kernel/cacheinfo.c | 32 +++++++++++++++-----
 drivers/base/cacheinfo.c      | 57 +++++++++++++++++++++++------------
 include/linux/cacheinfo.h     |  2 ++
 3 files changed, 64 insertions(+), 27 deletions(-)

-- 
2.39.2


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-06 21:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-03 23:15 [PATCH v2 0/2] arch_topology: Pre-allocate cacheinfo from primary CPU Radu Rendec
2023-04-03 23:15 ` [PATCH v2 1/2] cacheinfo: Add arch specific early level initializer Radu Rendec
2023-04-06  8:17   ` Pierre Gondois
2023-04-06 21:21     ` Radu Rendec
2023-04-03 23:15 ` [PATCH v2 2/2] cacheinfo: Add arm64 early level initializer implementation Radu Rendec

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).