linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: tmc: Fix bad register address for CLAIM
@ 2018-10-19  4:56 Leo Yan
  2018-10-19  8:39 ` Suzuki K Poulose
  2018-10-19 15:47 ` Mathieu Poirier
  0 siblings, 2 replies; 3+ messages in thread
From: Leo Yan @ 2018-10-19  4:56 UTC (permalink / raw)
  To: Mathieu Poirier, Alexander Shishkin, linux-arm-kernel,
	linux-kernel, Coresight ML
  Cc: Leo Yan, Suzuki Poulose, Mike Leach, Robert Walker

Commit 4d3ebd3658d8 ("coreisght: tmc: Claim device before use") uses
CLAIM tag to validate if the device is available, it needs to pass
the device base address to access related registers.

In the function tmc_etb_disable_hw() it wrongly passes the driver data
pointer as register base address, thus it's easily to produce the kernel
warning info like below:

[   83.579898] WARNING: CPU: 4 PID: 2970 at drivers/hwtracing/coresight/coresight.c:207 coresight_disclaim_device_unlocked+0x44/0x80
[   83.591448] Modules linked in:
[   83.594485] CPU: 4 PID: 2970 Comm: uname Not tainted 4.19.0-rc6-00417-g721b509 #110
[   83.602067] Hardware name: ARM Juno development board (r2) (DT)
[   83.607932] pstate: 80000085 (Nzcv daIf -PAN -UAO)
[   83.612681] pc : coresight_disclaim_device_unlocked+0x44/0x80
[   83.618375] lr : coresight_disclaim_device_unlocked+0x44/0x80
[   83.624064] sp : ffff00000fe3ba20
[   83.627347] x29: ffff00000fe3ba20 x28: ffff80002d430dc0
[   83.632618] x27: ffff800033177c00 x26: ffff80002eb44480
[   83.637889] x25: 0000000000000001 x24: ffff800033c72600
[   83.643160] x23: ffff0000099b11f8 x22: ffff0000099b11c8
[   83.648430] x21: 0000000000000002 x20: ffff800033a90418
[   83.653701] x19: ffff0000099b11c8 x18: 0000000000000000
[   83.658971] x17: 0000000000000000 x16: 0000000000000000
[   83.664241] x15: 0000000000000000 x14: 0000000000000000
[   83.669511] x13: 0000000000000000 x12: 0000000000000000
[   83.674782] x11: 0000000000000000 x10: 0000000000000000
[   83.680052] x9 : 0000000000000000 x8 : 0000000000000001
[   83.685322] x7 : 0000000000010000 x6 : ffff800033ebab18
[   83.690593] x5 : ffff800033ebab18 x4 : ffff800033e6c698
[   83.695862] x3 : 0000000000000001 x2 : 0000000000000000
[   83.701133] x1 : 0000000000000000 x0 : 0000000000000001
[   83.706404] Call trace:
[   83.708830]  coresight_disclaim_device_unlocked+0x44/0x80
[   83.714180]  coresight_disclaim_device+0x34/0x48
[   83.718756]  tmc_disable_etf_sink+0xc4/0xf0
[   83.722902]  coresight_disable_path_from+0xc8/0x240
[   83.727735]  coresight_disable_path+0x24/0x30
[   83.732053]  etm_event_stop+0x130/0x170
[   83.735854]  etm_event_del+0x24/0x30
[   83.739399]  event_sched_out.isra.51+0xcc/0x1e8
[   83.743887]  group_sched_out.part.53+0x44/0xb0
[   83.748291]  ctx_sched_out+0x298/0x2b8
[   83.752005]  task_ctx_sched_out+0x74/0xa8
[   83.755980]  perf_event_exit_task+0x140/0x418
[   83.760298]  do_exit+0x3f4/0xcf0
[   83.763497]  do_group_exit+0x5c/0xc0
[   83.767041]  __arm64_sys_exit_group+0x24/0x28
[   83.771359]  el0_svc_common+0x110/0x178
[   83.775160]  el0_svc_handler+0x94/0xe8
[   83.778875]  el0_svc+0x8/0xc
[   83.781728] ---[ end trace 02d8d8eac46db9e5 ]---

This patch is to fix this bug by using 'drvdata->base' as the
register base address for CLAIM related operation.

Fixes: 4d3ebd3658d8 ("coreisght: tmc: Claim device before use")
Cc: Suzuki Poulose <suzuki.poulose@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Robert Walker <robert.walker@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index 53fc83b..5864ac5 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -86,7 +86,7 @@ static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
 
 static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
 {
-	coresight_disclaim_device(drvdata);
+	coresight_disclaim_device(drvdata->base);
 	__tmc_etb_disable_hw(drvdata);
 }
 
-- 
2.7.4


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

* Re: [PATCH] coresight: tmc: Fix bad register address for CLAIM
  2018-10-19  4:56 [PATCH] coresight: tmc: Fix bad register address for CLAIM Leo Yan
@ 2018-10-19  8:39 ` Suzuki K Poulose
  2018-10-19 15:47 ` Mathieu Poirier
  1 sibling, 0 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2018-10-19  8:39 UTC (permalink / raw)
  To: Leo Yan, Mathieu Poirier, Alexander Shishkin, linux-arm-kernel,
	linux-kernel, Coresight ML
  Cc: Mike Leach, Robert Walker

Hi Leo,

On 10/19/2018 05:56 AM, Leo Yan wrote:
> Commit 4d3ebd3658d8 ("coreisght: tmc: Claim device before use") uses
> CLAIM tag to validate if the device is available, it needs to pass
> the device base address to access related registers.
> 
> In the function tmc_etb_disable_hw() it wrongly passes the driver data
> pointer as register base address, thus it's easily to produce the kernel
> warning info like below:
> 
> [   83.579898] WARNING: CPU: 4 PID: 2970 at drivers/hwtracing/coresight/coresight.c:207 coresight_disclaim_device_unlocked+0x44/0x80
> [   83.591448] Modules linked in:
> [   83.594485] CPU: 4 PID: 2970 Comm: uname Not tainted 4.19.0-rc6-00417-g721b509 #110

Oops! Thanks for fixing !


> 
> This patch is to fix this bug by using 'drvdata->base' as the
> register base address for CLAIM related operation.
> 
> Fixes: 4d3ebd3658d8 ("coreisght: tmc: Claim device before use")
> Cc: Suzuki Poulose <suzuki.poulose@arm.com>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Robert Walker <robert.walker@arm.com>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>

> ---
>   drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> index 53fc83b..5864ac5 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> @@ -86,7 +86,7 @@ static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
>   
>   static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
>   {
> -	coresight_disclaim_device(drvdata);
> +	coresight_disclaim_device(drvdata->base);
>   	__tmc_etb_disable_hw(drvdata);
>   }
>   
> 


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

* Re: [PATCH] coresight: tmc: Fix bad register address for CLAIM
  2018-10-19  4:56 [PATCH] coresight: tmc: Fix bad register address for CLAIM Leo Yan
  2018-10-19  8:39 ` Suzuki K Poulose
@ 2018-10-19 15:47 ` Mathieu Poirier
  1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Poirier @ 2018-10-19 15:47 UTC (permalink / raw)
  To: Leo Yan
  Cc: Alexander Shishkin, linux-arm-kernel, Linux Kernel Mailing List,
	coresight, Suzuki K. Poulose, Mike Leach, Robert Walker

On Thu, 18 Oct 2018 at 22:56, Leo Yan <leo.yan@linaro.org> wrote:
>
> Commit 4d3ebd3658d8 ("coreisght: tmc: Claim device before use") uses
> CLAIM tag to validate if the device is available, it needs to pass
> the device base address to access related registers.
>
> In the function tmc_etb_disable_hw() it wrongly passes the driver data
> pointer as register base address, thus it's easily to produce the kernel
> warning info like below:
>
> [   83.579898] WARNING: CPU: 4 PID: 2970 at drivers/hwtracing/coresight/coresight.c:207 coresight_disclaim_device_unlocked+0x44/0x80
> [   83.591448] Modules linked in:
> [   83.594485] CPU: 4 PID: 2970 Comm: uname Not tainted 4.19.0-rc6-00417-g721b509 #110
> [   83.602067] Hardware name: ARM Juno development board (r2) (DT)
> [   83.607932] pstate: 80000085 (Nzcv daIf -PAN -UAO)
> [   83.612681] pc : coresight_disclaim_device_unlocked+0x44/0x80
> [   83.618375] lr : coresight_disclaim_device_unlocked+0x44/0x80
> [   83.624064] sp : ffff00000fe3ba20
> [   83.627347] x29: ffff00000fe3ba20 x28: ffff80002d430dc0
> [   83.632618] x27: ffff800033177c00 x26: ffff80002eb44480
> [   83.637889] x25: 0000000000000001 x24: ffff800033c72600
> [   83.643160] x23: ffff0000099b11f8 x22: ffff0000099b11c8
> [   83.648430] x21: 0000000000000002 x20: ffff800033a90418
> [   83.653701] x19: ffff0000099b11c8 x18: 0000000000000000
> [   83.658971] x17: 0000000000000000 x16: 0000000000000000
> [   83.664241] x15: 0000000000000000 x14: 0000000000000000
> [   83.669511] x13: 0000000000000000 x12: 0000000000000000
> [   83.674782] x11: 0000000000000000 x10: 0000000000000000
> [   83.680052] x9 : 0000000000000000 x8 : 0000000000000001
> [   83.685322] x7 : 0000000000010000 x6 : ffff800033ebab18
> [   83.690593] x5 : ffff800033ebab18 x4 : ffff800033e6c698
> [   83.695862] x3 : 0000000000000001 x2 : 0000000000000000
> [   83.701133] x1 : 0000000000000000 x0 : 0000000000000001
> [   83.706404] Call trace:
> [   83.708830]  coresight_disclaim_device_unlocked+0x44/0x80
> [   83.714180]  coresight_disclaim_device+0x34/0x48
> [   83.718756]  tmc_disable_etf_sink+0xc4/0xf0
> [   83.722902]  coresight_disable_path_from+0xc8/0x240
> [   83.727735]  coresight_disable_path+0x24/0x30
> [   83.732053]  etm_event_stop+0x130/0x170
> [   83.735854]  etm_event_del+0x24/0x30
> [   83.739399]  event_sched_out.isra.51+0xcc/0x1e8
> [   83.743887]  group_sched_out.part.53+0x44/0xb0
> [   83.748291]  ctx_sched_out+0x298/0x2b8
> [   83.752005]  task_ctx_sched_out+0x74/0xa8
> [   83.755980]  perf_event_exit_task+0x140/0x418
> [   83.760298]  do_exit+0x3f4/0xcf0
> [   83.763497]  do_group_exit+0x5c/0xc0
> [   83.767041]  __arm64_sys_exit_group+0x24/0x28
> [   83.771359]  el0_svc_common+0x110/0x178
> [   83.775160]  el0_svc_handler+0x94/0xe8
> [   83.778875]  el0_svc+0x8/0xc
> [   83.781728] ---[ end trace 02d8d8eac46db9e5 ]---
>
> This patch is to fix this bug by using 'drvdata->base' as the
> register base address for CLAIM related operation.
>
> Fixes: 4d3ebd3658d8 ("coreisght: tmc: Claim device before use")
> Cc: Suzuki Poulose <suzuki.poulose@arm.com>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Robert Walker <robert.walker@arm.com>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> index 53fc83b..5864ac5 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
> @@ -86,7 +86,7 @@ static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
>
>  static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
>  {
> -       coresight_disclaim_device(drvdata);
> +       coresight_disclaim_device(drvdata->base);
>         __tmc_etb_disable_hw(drvdata);
>  }
>

Applied - thanks.
Mathieu

> --
> 2.7.4
>

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

end of thread, other threads:[~2018-10-19 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19  4:56 [PATCH] coresight: tmc: Fix bad register address for CLAIM Leo Yan
2018-10-19  8:39 ` Suzuki K Poulose
2018-10-19 15:47 ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).