mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] coresight: Only register perf symlink for sinks with alloc_buffer
@ 2025-06-30 10:26 Yuanfang Zhang
  2025-06-30 10:37 ` Suzuki K Poulose
  2025-07-09 10:35 ` Suzuki K Poulose
  0 siblings, 2 replies; 4+ messages in thread
From: Yuanfang Zhang @ 2025-06-30 10:26 UTC (permalink / raw)
  To: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin
  Cc: kernel, coresight, linux-arm-kernel, linux-kernel, Yuanfang Zhang

Ensure that etm_perf_add_symlink_sink() is only called for devices
that implement the alloc_buffer operation. This prevents invalid
symlink creation for dummy sinks that do not implement alloc_buffer.

Without this check, perf may attempt to use a dummy sink that lacks
alloc_buffer operationsu to initialise perf's ring buffer, leading
to runtime failures.

Fixes: 9d3ba0b6c0569 ("Coresight: Add coresight dummy driver")
Signed-off-by: Yuanfang Zhang <quic_yuanfang@quicinc.com>
---
 drivers/hwtracing/coresight/coresight-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index fa758cc21827552a5c97b6bdd05d22dec4994b22..fddf04c5ee46eb4d559416296f7e85ce6c5689fa 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1374,8 +1374,9 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
 		goto out_unlock;
 	}
 
-	if (csdev->type == CORESIGHT_DEV_TYPE_SINK ||
-	    csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) {
+	if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
+	     csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) &&
+	    sink_ops(csdev)->alloc_buffer) {
 		ret = etm_perf_add_symlink_sink(csdev);
 
 		if (ret) {

---
base-commit: 408c97c4a5e0b634dcd15bf8b8808b382e888164
change-id: 20250630-etm_perf_sink-ee0fcffc6820

Best regards,
-- 
Yuanfang Zhang <quic_yuanfang@quicinc.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: Only register perf symlink for sinks with alloc_buffer
  2025-06-30 10:26 [PATCH] coresight: Only register perf symlink for sinks with alloc_buffer Yuanfang Zhang
@ 2025-06-30 10:37 ` Suzuki K Poulose
  2025-07-09 10:35 ` Suzuki K Poulose
  1 sibling, 0 replies; 4+ messages in thread
From: Suzuki K Poulose @ 2025-06-30 10:37 UTC (permalink / raw)
  To: Yuanfang Zhang, Mike Leach, James Clark, Alexander Shishkin
  Cc: kernel, coresight, linux-arm-kernel, linux-kernel

On 30/06/2025 11:26, Yuanfang Zhang wrote:
> Ensure that etm_perf_add_symlink_sink() is only called for devices
> that implement the alloc_buffer operation. This prevents invalid
> symlink creation for dummy sinks that do not implement alloc_buffer.
> 
> Without this check, perf may attempt to use a dummy sink that lacks
> alloc_buffer operationsu to initialise perf's ring buffer, leading
> to runtime failures.
> 
> Fixes: 9d3ba0b6c0569 ("Coresight: Add coresight dummy driver")
> Signed-off-by: Yuanfang Zhang <quic_yuanfang@quicinc.com>
> ---
>   drivers/hwtracing/coresight/coresight-core.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
> index fa758cc21827552a5c97b6bdd05d22dec4994b22..fddf04c5ee46eb4d559416296f7e85ce6c5689fa 100644
> --- a/drivers/hwtracing/coresight/coresight-core.c
> +++ b/drivers/hwtracing/coresight/coresight-core.c
> @@ -1374,8 +1374,9 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
>   		goto out_unlock;
>   	}
>   
> -	if (csdev->type == CORESIGHT_DEV_TYPE_SINK ||
> -	    csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) {
> +	if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
> +	     csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) &&
> +	    sink_ops(csdev)->alloc_buffer) {
>   		ret = etm_perf_add_symlink_sink(csdev);
>   
>   		if (ret) {
> 

Looks good to me, I will queue this

Suzuki


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: Only register perf symlink for sinks with alloc_buffer
  2025-06-30 10:26 [PATCH] coresight: Only register perf symlink for sinks with alloc_buffer Yuanfang Zhang
  2025-06-30 10:37 ` Suzuki K Poulose
@ 2025-07-09 10:35 ` Suzuki K Poulose
  2025-07-09 10:38   ` Suzuki K Poulose
  1 sibling, 1 reply; 4+ messages in thread
From: Suzuki K Poulose @ 2025-07-09 10:35 UTC (permalink / raw)
  To: Mike Leach, James Clark, Alexander Shishkin, Yuanfang Zhang
  Cc: Suzuki K Poulose, kernel, coresight, linux-arm-kernel, linux-kernel


On Mon, 30 Jun 2025 18:26:19 +0800, Yuanfang Zhang wrote:
> Ensure that etm_perf_add_symlink_sink() is only called for devices
> that implement the alloc_buffer operation. This prevents invalid
> symlink creation for dummy sinks that do not implement alloc_buffer.
> 
> Without this check, perf may attempt to use a dummy sink that lacks
> alloc_buffer operationsu to initialise perf's ring buffer, leading
> to runtime failures.
> 
> [...]

Applied, thanks!

[1/1] coresight: Only register perf symlink for sinks with alloc_buffer
      commit: 59b61f705b83d41a876144975a2332c7b8ea96b0

Best regards,
-- 
Suzuki K Poulose <suzuki.poulose@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: Only register perf symlink for sinks with alloc_buffer
  2025-07-09 10:35 ` Suzuki K Poulose
@ 2025-07-09 10:38   ` Suzuki K Poulose
  0 siblings, 0 replies; 4+ messages in thread
From: Suzuki K Poulose @ 2025-07-09 10:38 UTC (permalink / raw)
  To: Mike Leach, James Clark, Alexander Shishkin, Yuanfang Zhang
  Cc: Suzuki K Poulose, kernel, coresight, linux-arm-kernel, linux-kernel


On Mon, 30 Jun 2025 18:26:19 +0800, Yuanfang Zhang wrote:
> Ensure that etm_perf_add_symlink_sink() is only called for devices
> that implement the alloc_buffer operation. This prevents invalid
> symlink creation for dummy sinks that do not implement alloc_buffer.
> 
> Without this check, perf may attempt to use a dummy sink that lacks
> alloc_buffer operationsu to initialise perf's ring buffer, leading
> to runtime failures.
> 
> [...]

Applied, thanks!

[1/1] coresight: Only register perf symlink for sinks with alloc_buffer
      https://git.kernel.org/coresight/c/59b61f70

Best regards,
-- 
Suzuki K Poulose <suzuki.poulose@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-09 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 10:26 [PATCH] coresight: Only register perf symlink for sinks with alloc_buffer Yuanfang Zhang
2025-06-30 10:37 ` Suzuki K Poulose
2025-07-09 10:35 ` Suzuki K Poulose
2025-07-09 10:38   ` Suzuki K Poulose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®