All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sander Vanheule <sander@svanheule.net>
To: Peter Zijlstra <peterz@infradead.org>,
	Yury Norov <yury.norov@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Valentin Schneider <vschneid@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Marco Elver <elver@google.com>
Cc: linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Sander Vanheule <sander@svanheule.net>
Subject: [PATCH v2 0/4] cpumask: Fix invalid uniprocessor assumptions
Date: Sat,  4 Jun 2022 19:15:55 +0200	[thread overview]
Message-ID: <cover.1654362935.git.sander@svanheule.net> (raw)

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 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):
  lib/test: Introduce cpumask KUnit test suite
  cpumask: Fix invalid uniprocessor mask assumption
  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      | 115 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 134 insertions(+), 83 deletions(-)
 create mode 100644 lib/test_cpumask.c

-- 
2.36.1


             reply	other threads:[~2022-06-04 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-04 17:15 Sander Vanheule [this message]
2022-06-04 17:15 ` [PATCH v2 1/4] lib/test: Introduce cpumask KUnit test suite Sander Vanheule
2022-06-04 19:31   ` Yury Norov
2022-06-05  6:21     ` Sander Vanheule
2022-06-04 17:15 ` [PATCH v2 2/4] cpumask: Fix invalid uniprocessor mask assumption Sander Vanheule
2022-06-04 17:15 ` [PATCH v2 3/4] cpumask: Add UP optimised for_each_*_cpu versions Sander Vanheule
2022-06-04 17:15 ` [PATCH v2 4/4] cpumask: Update cpumask_next_wrap() signature Sander Vanheule

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=cover.1654362935.git.sander@svanheule.net \
    --to=sander@svanheule.net \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=elver@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vschneid@redhat.com \
    --cc=yury.norov@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.