Skip to content

Commit 63906ca

Browse files
Suzuki K Poulosegregkh
Suzuki K Poulose
authored andcommitted
coresight: etb10: Do not call smp_processor_id from preemptible
commit 730766b upstream. During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 2997aa4 ("coresight: etb10: implementing AUX API") Cc: Mathieu Poirier <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Cc: stable <[email protected]> # 4.6+ Signed-off-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 03e520d commit 63906ca

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/hwtracing/coresight/coresight-etb10.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,
275275
int node;
276276
struct cs_buffers *buf;
277277

278-
if (cpu == -1)
279-
cpu = smp_processor_id();
280-
node = cpu_to_node(cpu);
278+
node = (cpu == -1) ? NUMA_NO_NODE : cpu_to_node(cpu);
281279

282280
buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node);
283281
if (!buf)

0 commit comments

Comments
 (0)