lkml.org 
[lkml]   [2022]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH v3 0/4] cpumask: Fix invalid uniprocessor assumptions
Date
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.

[1] https://lore.kernel.org/all/20220530082552.46113-1-sander@svanheule.net/

Changes since v2:
Link: https://lore.kernel.org/all/cover.1654362935.git.sander@svanheule.net/
- Put new tests after patch fixes
- Update for_each_* macros

Changes since v1:
Link: https://lore.kernel.org/all/cover.1654201862.git.sander@svanheule.net/
- 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 (4):
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

include/linux/cpumask.h | 89 +++------------------------
lib/Kconfig.debug | 9 +++
lib/Makefile | 4 +-
lib/test_cpumask.c | 132 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 151 insertions(+), 83 deletions(-)
create mode 100644 lib/test_cpumask.c

--
2.36.1

\
 
 \ /
  Last update: 2022-06-05 08:23    [W:0.096 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site