All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coresight: etm4x: avoid build failure with unrolled loops
@ 2021-09-26 10:35 ` Tao Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Tao Zhang @ 2021-09-26 10:35 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Alexander Shishkin
  Cc: Tao Zhang, Mike Leach, Leo Yan, Greg Kroah-Hartman, coresight,
	linux-arm-kernel, linux-kernel, Tingwei Zhang, Mao Jinlong,
	Yuanfang Zhang

clang-12 fails to build the etm4x driver with -fsanitize=array-bounds,
where it decides to unroll certain loops in a way that result in a
C variable getting put into an inline assembly.

Search this build failure and find this is a known issue and there
has been a mail thread discussing it.
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210429145752.3218324-1-arnd@kernel.org/
According to the modification suggestions of this mail thread,
coresight infrastucture has already provided another API that
can replace the function that caused the error.

Used here "csdev_access_read32" to replace the original API
"etm4x_relaxed_read32".

This patch applies to coresight/next
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
---
 drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index f58afbab6e6d..0bca8e2be070 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -797,7 +797,7 @@ static void etm4_disable_hw(void *info)
 	/* read back the current counter values */
 	for (i = 0; i < drvdata->nr_cntr; i++) {
 		config->cntr_val[i] =
-			etm4x_relaxed_read32(csa, TRCCNTVRn(i));
+			csdev_access_read32(csa, TRCCNTVRn(i));
 	}
 
 	coresight_disclaim_device_unlocked(csdev);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* [PATCH] coresight: etm4x: avoid build failure with unrolled loops
@ 2021-09-26 10:35 ` Tao Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Tao Zhang @ 2021-09-26 10:35 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Alexander Shishkin
  Cc: Tao Zhang, Mike Leach, Leo Yan, Greg Kroah-Hartman, coresight,
	linux-arm-kernel, linux-kernel, Tingwei Zhang, Mao Jinlong,
	Yuanfang Zhang

clang-12 fails to build the etm4x driver with -fsanitize=array-bounds,
where it decides to unroll certain loops in a way that result in a
C variable getting put into an inline assembly.

Search this build failure and find this is a known issue and there
has been a mail thread discussing it.
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210429145752.3218324-1-arnd@kernel.org/
According to the modification suggestions of this mail thread,
coresight infrastucture has already provided another API that
can replace the function that caused the error.

Used here "csdev_access_read32" to replace the original API
"etm4x_relaxed_read32".

This patch applies to coresight/next
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
---
 drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index f58afbab6e6d..0bca8e2be070 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -797,7 +797,7 @@ static void etm4_disable_hw(void *info)
 	/* read back the current counter values */
 	for (i = 0; i < drvdata->nr_cntr; i++) {
 		config->cntr_val[i] =
-			etm4x_relaxed_read32(csa, TRCCNTVRn(i));
+			csdev_access_read32(csa, TRCCNTVRn(i));
 	}
 
 	coresight_disclaim_device_unlocked(csdev);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] coresight: etm4x: avoid build failure with unrolled loops
  2021-09-26 10:35 ` Tao Zhang
@ 2021-09-28 17:01   ` Mathieu Poirier
  -1 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2021-09-28 17:01 UTC (permalink / raw)
  To: Tao Zhang
  Cc: Suzuki K Poulose, Alexander Shishkin, Mike Leach, Leo Yan,
	Greg Kroah-Hartman, coresight, linux-arm-kernel, linux-kernel,
	Tingwei Zhang, Mao Jinlong, Yuanfang Zhang

Hi Tao,

On Sun, Sep 26, 2021 at 06:35:50PM +0800, Tao Zhang wrote:
> clang-12 fails to build the etm4x driver with -fsanitize=array-bounds,
> where it decides to unroll certain loops in a way that result in a
> C variable getting put into an inline assembly.
> 
> Search this build failure and find this is a known issue and there
> has been a mail thread discussing it.
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210429145752.3218324-1-arnd@kernel.org/
> According to the modification suggestions of this mail thread,
> coresight infrastucture has already provided another API that
> can replace the function that caused the error.
> 
> Used here "csdev_access_read32" to replace the original API
> "etm4x_relaxed_read32".
> 
> This patch applies to coresight/next
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> 
> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
> ---
>  drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index f58afbab6e6d..0bca8e2be070 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -797,7 +797,7 @@ static void etm4_disable_hw(void *info)
>  	/* read back the current counter values */
>  	for (i = 0; i < drvdata->nr_cntr; i++) {
>  		config->cntr_val[i] =
> -			etm4x_relaxed_read32(csa, TRCCNTVRn(i));
> +			csdev_access_read32(csa, TRCCNTVRn(i));

It seems like the patch you are referencing above was never applied...  So the
question is, how is it that only this instance is giving you trouble when there
are many more instances of the same pattern in the file?

Thanks,
Mathieu

>  	}
>  
>  	coresight_disclaim_device_unlocked(csdev);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

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

* Re: [PATCH] coresight: etm4x: avoid build failure with unrolled loops
@ 2021-09-28 17:01   ` Mathieu Poirier
  0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2021-09-28 17:01 UTC (permalink / raw)
  To: Tao Zhang
  Cc: Suzuki K Poulose, Alexander Shishkin, Mike Leach, Leo Yan,
	Greg Kroah-Hartman, coresight, linux-arm-kernel, linux-kernel,
	Tingwei Zhang, Mao Jinlong, Yuanfang Zhang

Hi Tao,

On Sun, Sep 26, 2021 at 06:35:50PM +0800, Tao Zhang wrote:
> clang-12 fails to build the etm4x driver with -fsanitize=array-bounds,
> where it decides to unroll certain loops in a way that result in a
> C variable getting put into an inline assembly.
> 
> Search this build failure and find this is a known issue and there
> has been a mail thread discussing it.
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210429145752.3218324-1-arnd@kernel.org/
> According to the modification suggestions of this mail thread,
> coresight infrastucture has already provided another API that
> can replace the function that caused the error.
> 
> Used here "csdev_access_read32" to replace the original API
> "etm4x_relaxed_read32".
> 
> This patch applies to coresight/next
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> 
> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
> ---
>  drivers/hwtracing/coresight/coresight-etm4x-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index f58afbab6e6d..0bca8e2be070 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -797,7 +797,7 @@ static void etm4_disable_hw(void *info)
>  	/* read back the current counter values */
>  	for (i = 0; i < drvdata->nr_cntr; i++) {
>  		config->cntr_val[i] =
> -			etm4x_relaxed_read32(csa, TRCCNTVRn(i));
> +			csdev_access_read32(csa, TRCCNTVRn(i));

It seems like the patch you are referencing above was never applied...  So the
question is, how is it that only this instance is giving you trouble when there
are many more instances of the same pattern in the file?

Thanks,
Mathieu

>  	}
>  
>  	coresight_disclaim_device_unlocked(csdev);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] coresight: etm4x: avoid build failure with unrolled loops
  2021-09-26 10:35 ` Tao Zhang
@ 2021-09-29 10:29   ` Suzuki K Poulose
  -1 siblings, 0 replies; 6+ messages in thread
From: Suzuki K Poulose @ 2021-09-29 10:29 UTC (permalink / raw)
  To: Tao Zhang, Mathieu Poirier, Alexander Shishkin
  Cc: Mike Leach, Leo Yan, Greg Kroah-Hartman, coresight,
	linux-arm-kernel, linux-kernel, Tingwei Zhang, Mao Jinlong,
	Yuanfang Zhang, Arnd Bergmann

Hi Tao

On 26/09/2021 11:35, Tao Zhang wrote:
> clang-12 fails to build the etm4x driver with -fsanitize=array-bounds,
> where it decides to unroll certain loops in a way that result in a
> C variable getting put into an inline assembly.
> 
> Search this build failure and find this is a known issue and there
> has been a mail thread discussing it.
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210429145752.3218324-1-arnd@kernel.org/
> According to the modification suggestions of this mail thread,
> coresight infrastucture has already provided another API that
> can replace the function that caused the error.
> 
> Used here "csdev_access_read32" to replace the original API
> "etm4x_relaxed_read32".
> 
> This patch applies to coresight/next
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> 
> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>


Thanks for picking up the patch. Please could you convert all the other
variable indexed register access too ? That would save us spinning up
patches for fixing those individual cases whenever the compiler decides
to change its behavior.

Suzuki

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

* Re: [PATCH] coresight: etm4x: avoid build failure with unrolled loops
@ 2021-09-29 10:29   ` Suzuki K Poulose
  0 siblings, 0 replies; 6+ messages in thread
From: Suzuki K Poulose @ 2021-09-29 10:29 UTC (permalink / raw)
  To: Tao Zhang, Mathieu Poirier, Alexander Shishkin
  Cc: Mike Leach, Leo Yan, Greg Kroah-Hartman, coresight,
	linux-arm-kernel, linux-kernel, Tingwei Zhang, Mao Jinlong,
	Yuanfang Zhang, Arnd Bergmann

Hi Tao

On 26/09/2021 11:35, Tao Zhang wrote:
> clang-12 fails to build the etm4x driver with -fsanitize=array-bounds,
> where it decides to unroll certain loops in a way that result in a
> C variable getting put into an inline assembly.
> 
> Search this build failure and find this is a known issue and there
> has been a mail thread discussing it.
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210429145752.3218324-1-arnd@kernel.org/
> According to the modification suggestions of this mail thread,
> coresight infrastucture has already provided another API that
> can replace the function that caused the error.
> 
> Used here "csdev_access_read32" to replace the original API
> "etm4x_relaxed_read32".
> 
> This patch applies to coresight/next
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> 
> Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>


Thanks for picking up the patch. Please could you convert all the other
variable indexed register access too ? That would save us spinning up
patches for fixing those individual cases whenever the compiler decides
to change its behavior.

Suzuki

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-09-29 10:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 10:35 [PATCH] coresight: etm4x: avoid build failure with unrolled loops Tao Zhang
2021-09-26 10:35 ` Tao Zhang
2021-09-28 17:01 ` Mathieu Poirier
2021-09-28 17:01   ` Mathieu Poirier
2021-09-29 10:29 ` Suzuki K Poulose
2021-09-29 10:29   ` Suzuki K Poulose

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.