[lkml]   [2022]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH v4 0/5] cpumask: Fix invalid uniprocessor assumptions
On uniprocessor builds, it is currently assumed that any cpumask will
contain the single CPU: cpu0. This assumption is used to provide
optimised implementations.

The current assumption also appears to be wrong, by ignoring the fact
that users can provide empty cpumask-s. This can result in bugs as
explained in [1].

This series introduces some basic tests, and updates the optimisations
for uniprocessor builds.

The x86 patch was written after the kernel test robot [2] ran into a
failed build. I have tried to list the files potentially affected by the
changes to cpumask.h, in an attempt to find any other cases that fail on
!SMP. I've gone through some of the files manually, and ran a few cross
builds, but nothing else popped up. I (build) checked about half of the
potientally affected files, but I do not have the resources to do them
all. I hope we can fix other issues if/when they pop up later.


Changes since v3:
- Guard againts CPU hotpluggin while testing cpu online/present masks
- Add fix for cpu_llc_shared_map on x86

Changes since v2:
- Put new tests after patch fixes
- Update for_each_* macros

Changes since v1:
- Place tests in lib/test_cpumask.c
- Drop the modified UP code in favor of the generic SMP implementation
- Update declaration of cpumask_next_wrap()

Sander Vanheule (5):
x86/cacheinfo: move shared cache map definitions
cpumask: Fix invalid uniprocessor mask assumption
lib/test: Introduce cpumask KUnit test suite
cpumask: Add UP optimised for_each_*_cpu versions
cpumask: Update cpumask_next_wrap() signature

arch/x86/kernel/cpu/cacheinfo.c | 6 ++
arch/x86/kernel/smpboot.c | 4 -
include/linux/cpumask.h | 108 +++++++------------------
lib/Kconfig.debug | 9 +++
lib/Makefile | 4 +-
lib/cpumask.c | 2 +
lib/test_cpumask.c | 138 ++++++++++++++++++++++++++++++++
7 files changed, 184 insertions(+), 87 deletions(-)
create mode 100644 lib/test_cpumask.c


 \ /
  Last update: 2022-07-02 18:09    [W:0.140 / U:1.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site