All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saurabh Sengar <ssengar@linux.microsoft.com>
To: ssengar@microsoft.com, mikelley@microsoft.com,
	sander@svanheule.net, linux-kernel@vger.kernel.org
Subject: [RFC] issue with cpumask for UniProcessor
Date: Mon,  8 Aug 2022 09:23:41 -0700	[thread overview]
Message-ID: <1659975821-30762-1-git-send-email-ssengar@linux.microsoft.com> (raw)
In-Reply-To: <e78c55ecb98172356248a7a89da501479ead6ae0.1659077534.git.sander@svanheule.net>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1144 bytes --]


Hi,

I am working on a UniProcessor system with latest linux-next kernel (20220803).
I observed two files "shared_cpu_map” and “shared_cpu_list” are missing
for L3 cache (/sys/devices/system/cpu/cpu0/cache/index3). This causes lscpu
version 2.34 to segfault. On further digging I figured below is the commit
which introduced this problem.

https://lore.kernel.org/lkml/e78c55ecb98172356248a7a89da501479ead6ae0.1659077534.git.sander@svanheule.net/


I am not 100% certain what the proper fix for it is, but below changes fix
this issue. I understand above patch is already confirmed for linux kernel
6.0, please suggest if we need fixing this in 6.0.

Regards,
Saurabh



diff --git a/lib/cpumask.c b/lib/cpumask.c
index b9728513a4d4..81fc2e35b5b1 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -16,10 +16,14 @@
  */
 unsigned int cpumask_next(int n, const struct cpumask *srcp)
 {
+#if NR_CPUS == 1
+       return n+1;
+#else
        /* -1 is a legal arg here. */
        if (n != -1)
                cpumask_check(n);
        return find_next_bit(cpumask_bits(srcp), nr_cpumask_bits, n + 1);
+#endif
 }
 EXPORT_SYMBOL(cpumask_next);

  reply	other threads:[~2022-08-08 16:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  7:01 [PATCH v5 0/5] cpumask: fix invalid uniprocessor assumptions Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 1/5] x86/cacheinfo: move shared cache map definitions Sander Vanheule
2022-08-02 11:13   ` Ingo Molnar
2022-07-29  7:01 ` [PATCH v5 2/5] cpumask: add UP optimised for_each_*_cpu versions Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 3/5] cpumask: fix invalid uniprocessor mask assumption Sander Vanheule
2022-08-08 16:23   ` Saurabh Sengar [this message]
2022-08-08 17:34     ` [RFC] issue with cpumask for UniProcessor Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 4/5] lib/test: introduce cpumask KUnit test suite Sander Vanheule
2022-07-31 15:23   ` Maíra Canal
2022-07-31 15:42     ` Sander Vanheule
2022-07-31 22:11       ` Maíra Canal
2022-08-09 18:38     ` Sander Vanheule
2022-07-29  7:01 ` [PATCH v5 5/5] cpumask: update cpumask_next_wrap() signature Sander Vanheule
2022-07-30 18:15 ` [PATCH v5 0/5] cpumask: fix invalid uniprocessor assumptions Yury Norov
2022-07-31 13:02   ` Sander Vanheule
2022-07-31 15:28     ` Yury Norov

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=1659975821-30762-1-git-send-email-ssengar@linux.microsoft.com \
    --to=ssengar@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=sander@svanheule.net \
    --cc=ssengar@microsoft.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.