Re: [PATCH] coresight: tmc: Fix bad register address for CLAIM

2018-10-19 Thread Mathieu Poirier
On Thu, 18 Oct 2018 at 22:56, 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
> [   83.602067] Hardware name: ARM Juno development board (r2) (DT)
> [   83.607932] pstate: 8085 (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 : 0fe3ba20
> [   83.627347] x29: 0fe3ba20 x28: 80002d430dc0
> [   83.632618] x27: 800033177c00 x26: 80002eb44480
> [   83.637889] x25: 0001 x24: 800033c72600
> [   83.643160] x23: 099b11f8 x22: 099b11c8
> [   83.648430] x21: 0002 x20: 800033a90418
> [   83.653701] x19: 099b11c8 x18: 
> [   83.658971] x17:  x16: 
> [   83.664241] x15:  x14: 
> [   83.669511] x13:  x12: 
> [   83.674782] x11:  x10: 
> [   83.680052] x9 :  x8 : 0001
> [   83.685322] x7 : 0001 x6 : 800033ebab18
> [   83.690593] x5 : 800033ebab18 x4 : 800033e6c698
> [   83.695862] x3 : 0001 x2 : 
> [   83.701133] x1 :  x0 : 0001
> [   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 
> Cc: Mathieu Poirier 
> Cc: Mike Leach 
> Cc: Robert Walker 
> Signed-off-by: Leo Yan 
> ---
>  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
>


Re: [PATCH] coresight: tmc: Fix bad register address for CLAIM

2018-10-19 Thread Suzuki K Poulose

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 
Cc: Mathieu Poirier 
Cc: Mike Leach 
Cc: Robert Walker 
Signed-off-by: Leo Yan 


Reviewed-by: Suzuki K Poulose 


---
  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);
  }
  





[PATCH] coresight: tmc: Fix bad register address for CLAIM

2018-10-18 Thread Leo Yan
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: 8085 (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 : 0fe3ba20
[   83.627347] x29: 0fe3ba20 x28: 80002d430dc0
[   83.632618] x27: 800033177c00 x26: 80002eb44480
[   83.637889] x25: 0001 x24: 800033c72600
[   83.643160] x23: 099b11f8 x22: 099b11c8
[   83.648430] x21: 0002 x20: 800033a90418
[   83.653701] x19: 099b11c8 x18: 
[   83.658971] x17:  x16: 
[   83.664241] x15:  x14: 
[   83.669511] x13:  x12: 
[   83.674782] x11:  x10: 
[   83.680052] x9 :  x8 : 0001
[   83.685322] x7 : 0001 x6 : 800033ebab18
[   83.690593] x5 : 800033ebab18 x4 : 800033e6c698
[   83.695862] x3 : 0001 x2 : 
[   83.701133] x1 :  x0 : 0001
[   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 
Cc: Mathieu Poirier 
Cc: Mike Leach 
Cc: Robert Walker 
Signed-off-by: Leo Yan 
---
 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