[ Added back the list, as this is good to document ] On Tue, 1 Oct 2019 14:17:08 +0200 Eugene Syromyatnikov <evgsyr@xxxxxxxxx> wrote: > On Mon, Sep 30, 2019 at 11:13 PM Steven Rostedt <rostedt@xxxxxxxxxxx> 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
![]() |