Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing/osnoise: Allow arbitrarily long CPU string

Allocate kernel memory for processing CPU string
(/sys/kernel/tracing/osnoise/cpus) also in osnoise_cpus_write to allow
the writing of a CPU string of an arbitrary length.

This replaces the 256-byte buffer, which is insufficient with the rising
number of CPUs. For example, if I wanted to measure on every even CPU
on a system with 256 CPUs, the string would be 456 characters long.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250425091839.343289-1-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Tomas Glozar and committed by
Steven Rostedt (Google)
17f89102 a54665ab

+5 -4
+5 -4
kernel/trace/trace_osnoise.c
··· 2302 2302 * osnoise_cpus_write - Write function for "cpus" entry 2303 2303 * @filp: The active open file structure 2304 2304 * @ubuf: The user buffer that contains the value to write 2305 - * @cnt: The maximum number of bytes to write to "file" 2305 + * @count: The maximum number of bytes to write to "file" 2306 2306 * @ppos: The current position in @file 2307 2307 * 2308 2308 * This function provides a write implementation for the "cpus" ··· 2320 2320 { 2321 2321 cpumask_var_t osnoise_cpumask_new; 2322 2322 int running, err; 2323 - char buf[256]; 2323 + char *buf __free(kfree) = NULL; 2324 2324 2325 - if (count >= 256) 2326 - return -EINVAL; 2325 + buf = kmalloc(count, GFP_KERNEL); 2326 + if (!buf) 2327 + return -ENOMEM; 2327 2328 2328 2329 if (copy_from_user(buf, ubuf, count)) 2329 2330 return -EFAULT;