From: Costa Shulyupin <costa.shul@redhat.com>
To: Costa Shulyupin <costa.shul@redhat.com>,
linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: John Kacur <jkacur@redhat.com>,
Clark Williams <williams@redhat.com>,
Tomas Glozar <tglozar@redhat.com>
Subject: [PATCH v2] rt-tests: hwlatdetect: Add a grouping separator to tracing_cpumask
Date: Mon, 2 Jun 2025 19:03:41 +0300 [thread overview]
Message-ID: <20250602160342.2740857-1-costa.shul@redhat.com> (raw)
Writing values longer than 32 bits without a comma results in an error:
echo 100000000 > /sys/kernel/debug/tracing/tracing_cpumask
bash: echo: write error: Value too large for defined data type
The bitmap_pars() kernel function specification:
"Commas group hex digits into chunks.
Each chunk defines exactly 32 bits of the resultant bitmask.
No chunk may specify a value larger than 32 bits (%-EOVERFLOW)"
Add a comma as a grouping separator every 32 bits to a hexadecimal number,
as expected by the bitmap_pars() kernel function.
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
Cnahges in v2:
- rebased
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
src/hwlatdetect/hwlatdetect.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index dc28f38b751a..946bef33748b 100755
--- a/src/hwlatdetect/hwlatdetect.py
+++ b/src/hwlatdetect/hwlatdetect.py
@@ -33,6 +33,11 @@ def info(istr):
print(istr)
+def group_sep(hex):
+ """ Add a comma as a grouping separator every 32 bits to a hexadecimal number. """
+ return ','.join([hex[max(i - 8, 0):i] for i in range(len(hex), 0, -8)][::-1])
+
+
#
# Class used to manage mounting and umounting the debugfs
# filesystem. Note that if an instance of this class mounts
@@ -494,7 +499,7 @@ def microseconds(sval):
for i in range(l, r + 1):
cpumask |= (1 << i)
debug(f"set tracing_cpumask to {cpumask:x}")
- detect.set("cpumask", f"{cpumask:x}")
+ detect.set("cpumask", group_sep(f"{cpumask:x}"))
info(f"hwlatdetect: test duration {detect.testduration} seconds")
info(f" detector: {detect.type}")
--
2.48.1
next reply other threads:[~2025-06-02 16:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 16:03 Costa Shulyupin [this message]
2025-06-17 17:33 ` [PATCH v2] rt-tests: hwlatdetect: Add a grouping separator to tracing_cpumask John Kacur
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=20250602160342.2740857-1-costa.shul@redhat.com \
--to=costa.shul@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=tglozar@redhat.com \
--cc=williams@redhat.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 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).