Re: [PATCH] coresight: STM: Balance enable/disable

From: Suzuki K Poulose
Date: Fri Jan 13 2017 - 12:11:53 EST


On 13/01/17 16:48, Mathieu Poirier wrote:
On 10 January 2017 at 04:21, Suzuki K Poulose <suzuki.poulose@xxxxxxx> wrote:
The stm is automatically enabled when an application sets the policy
via ->link() call back by using coresight_enable(), which keeps the
refcount of the current users of the STM. However, the unlink() callback
issues stm_disable() directly, which leaves the STM turned off, without
the coresight layer knowing about it. This prevents any further uses
of the STM hardware as the coresight layer still thinks the STM is
turned on and doesn't issue an stm_enable(). Even manually enabling
the STM via sysfs can't really enable the hw.

...

This patch balances the unlink operation by using the coresight_disable(),
keeping the coresight layer in sync with the hardware state.

Fixes: commit 237483aa5cf43 ("coresight: stm: adding driver for CoreSight STM component")
Cc: Pratik Patel <pratikp@xxxxxxxxxxxxxx>
Cc: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
Cc: Chunyan Zhang <zhang.chunyan@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx # 4.7+
Reported-by: Robert Walker <robert.walker@xxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
drivers/hwtracing/coresight/coresight-stm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index 3524452..57b7330 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -356,7 +356,7 @@ static void stm_generic_unlink(struct stm_data *stm_data,
if (!drvdata || !drvdata->csdev)
return;

- stm_disable(drvdata->csdev, NULL);
+ coresight_disable(drvdata->csdev);
}

static phys_addr_t

Applied - thanks,

Mathieu, Greg,

I think this should go into 4.10 (either way, as fix in this cycle or via stable after the release). I think
it would be easier if it goes in as fix during one of these rc cycle.

Please let me know your thoughts.

Suzuki

Mathieu

--
2.7.4