From: Steven Rostedt <rostedt@goodmis.org>
To: Eugene Syromyatnikov <evgsyr@gmail.com>
Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>,
Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 2/2] trace-cmd: Reset CPU mask to its default value with "trace-cmd reset".
Date: Tue, 1 Oct 2019 09:52:47 -0400 [thread overview]
Message-ID: <20191001095247.6f020759@gandalf.local.home> (raw)
In-Reply-To: <CACGkJdseMqPBcM8YOUoZvssT68BFrsmriis4DaMK74cUZVpKvg@mail.gmail.com>
[ Added back the list, as this is good to document ]
On Tue, 1 Oct 2019 14:17:08 +0200
Eugene Syromyatnikov <evgsyr@gmail.com> wrote:
> On Mon, Sep 30, 2019 at 11:13 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> > if (bits)
> > sprintf(buf, "%x", (1 << bits) - 1);
> > while (fullwords-- > 0)
> > strcat(buf, "ffffffff");
> Additional commas that split 32-bit chunks are needed here, if I read
> lib/bitmap.c:__bitmap_parse correctly.
>
You're right. I just tested it:
# echo fffffffff > /debug/tracing/tracing_cpumask
-bash: echo: write error: Value too large for defined data type
# echo f,ffffffff > /debug/tracing/tracing_cpumask
#
This should work then:
int fullwords;
char *buf;
int bits;
int cpus;
int len;
fullwords = (cpus - 1) / 32;
bits = (cpus - 1) % 32 + 1;
len = (fullwords + 1) * 9;
buf = malloc(len + 1);
buf[0] = '\0';
if (bits)
sprintf(buf, "%x", (unsigned int)((1ULL << bits) - 1));
while (fullwords-- > 0)
strcat(buf, ",ffffffff");
-- Steve
prev parent reply other threads:[~2019-10-01 13:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 11:08 [PATCH 0/2] Reset CPU mask Tzvetomir Stoyanov (VMware)
2019-09-25 11:08 ` [PATCH 1/2] trace-cmd: Reset CPU mask after setting it in trace-cmd record with option -M Tzvetomir Stoyanov (VMware)
2019-09-25 11:08 ` [PATCH 2/2] trace-cmd: Reset CPU mask to its default value with "trace-cmd reset" Tzvetomir Stoyanov (VMware)
2019-09-30 18:44 ` Steven Rostedt
[not found] ` <CACGkJdseMqPBcM8YOUoZvssT68BFrsmriis4DaMK74cUZVpKvg@mail.gmail.com>
2019-10-01 13:52 ` Steven Rostedt [this message]
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=20191001095247.6f020759@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=evgsyr@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tstoyanov@vmware.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).