patch "coresight: etb10: Do not call smp_processor_id from preemptible" added to char-misc-next
This is a note to let you know that I've just added the patch titled
coresight: etb10: Do not call smp_processor_id from preemptible
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-next branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will also be merged in the next major kernel release during the merge window.
If you have any questions about this process, please let me know.
From 730766bae3280a25d40ea76a53dc6342e84e6513 Mon Sep 17 00:00:00 2001
From: Suzuki K Poulose <[email protected]>
Date: Thu, 20 Jun 2019 16:12:36 -0600
Subject: coresight: etb10: Do not call smp_processor_id from preemptible
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.
--- drivers/hwtracing/coresight/coresight-etb10.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +2 -4
@@ -374,12 +374,10 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - int node, cpu = event->cpu; + int node;struct cs_buffers *buf; -if (cpu ==-1 ) - cpu =smp_processor_id (); - node =cpu_to_node (cpu); + node = (event->cpu ==-1 ) ?NUMA_NO_NODE :cpu_to_node (event->cpu); buf =kzalloc_node (sizeof (struct cs_buffers ),GFP_KERNEL , node);if (!buf)
Signature · 1 line
2.22.0