Re: [PATCH 1/4] coresight: tmc-etr: Do not call smp_processor_id() from preemptible

From: Suzuki K Poulose
Date: Thu May 30 2019 - 11:56:20 EST


Hi Robin,

On 10/05/2019 11:38, Robin Murphy wrote:
Hi Suzuki,

On 10/05/2019 10:31, Suzuki K Poulose wrote:
Instead of using smp_processor_id() to figure out the node,
use the numa_node_id() for the current CPU node to avoid
splats like :



diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 793639f..cae9d8a 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -1323,13 +1323,11 @@ static struct etr_perf_buffer *
tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, struct perf_event *event,
int nr_pages, void **pages, bool snapshot)
{
- int node, cpu = event->cpu;
+ int node;
struct etr_buf *etr_buf;
struct etr_perf_buffer *etr_perf;
- if (cpu == -1)
- cpu = smp_processor_id();
- node = cpu_to_node(cpu);
+ node = (event->cpu == -1) ? numa_node_id() : cpu_to_node(event->cpu);

If cpu == -1 represents a "don't care" scenario, it might be clearer to
just use NUMA_NO_NODE instead, and let the allocator handle it.

Thanks for the suggestion, will use that instead

Cheers
Suzuki