Re: [PATCH 4.14 65/74] coresight: tmc-etf: Do not call smp_processor_id from preemptible

From: Suzuki Kuruppassery Poulose
Date: Wed Jan 08 2020 - 04:28:35 EST


Hi Nathan,

On 07/01/2020 23:08, Nathan Chancellor wrote:
On Tue, Jan 07, 2020 at 09:55:30PM +0100, Greg Kroah-Hartman wrote:
From: Suzuki K Poulose <suzuki.poulose@xxxxxxx>

[ Upstream commit 024c1fd9dbcc1d8a847f1311f999d35783921b7f ]


...

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index 336194d059fe..329a201c0c19 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -308,9 +308,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int 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);

This breaks the build on 4.14 (and I believe 4.19 from the looks of it)
because the event variable is not available without
commit a0f08a6a9fee ("coresight: Communicate perf event to sink buffer
allocation functions") from upstream. I am not sure how this should be
fixed (either backporting the above commit or changing this one somehow)
but it should be dropped in the meantime.

Thanks for the report. I will send a separate fix for the version where
it breaks. We should be able to use the "cpu" argument directly in these
cases, where event was not introduced.

Cheers
Suzuki