mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
coresight: tmc-etr: Fix deadlock issue while reading from ETR
If ETR is being read repeatedly, at the same time, trying to reset source link again and again, sometimes deadlock problems occur. Beacause reset_source_sink_store holds coresight_mutex and waits for mem_lock, meanwhile, tmc_read_prepare_etr holds mem_lock and waits for coresight_mutex. Change-Id: I8c70575b8a70d820748492313d6232923478ede3 Signed-off-by: Tao,Zhang <taozha@codeaurora.org>
This commit is contained in:
parent
ad191fdc0c
commit
7c7dfa62ff
1 changed files with 9 additions and 5 deletions
|
|
@ -2164,14 +2164,18 @@ int tmc_read_prepare_etr(struct tmc_drvdata *drvdata)
|
|||
goto out;
|
||||
}
|
||||
|
||||
drvdata->reading = true;
|
||||
|
||||
/* Disable the TMC if we are trying to read from a running session. */
|
||||
if (drvdata->mode == CS_MODE_SYSFS) {
|
||||
spin_unlock_irqrestore(&drvdata->spinlock, flags);
|
||||
mutex_unlock(&drvdata->mem_lock);
|
||||
coresight_disable_all_source_link();
|
||||
mutex_lock(&drvdata->mem_lock);
|
||||
spin_lock_irqsave(&drvdata->spinlock, flags);
|
||||
__tmc_etr_disable_hw(drvdata);
|
||||
}
|
||||
drvdata->reading = true;
|
||||
|
||||
out:
|
||||
spin_unlock_irqrestore(&drvdata->spinlock, flags);
|
||||
mutex_unlock(&drvdata->mem_lock);
|
||||
|
|
@ -2199,10 +2203,6 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata)
|
|||
* be NULL.
|
||||
*/
|
||||
__tmc_etr_enable_hw(drvdata);
|
||||
|
||||
spin_unlock_irqrestore(&drvdata->spinlock, flags);
|
||||
coresight_enable_all_source_link();
|
||||
spin_lock_irqsave(&drvdata->spinlock, flags);
|
||||
} else {
|
||||
/*
|
||||
* The ETR is not tracing and the buffer was just read.
|
||||
|
|
@ -2219,5 +2219,9 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata)
|
|||
tmc_etr_free_sysfs_buf(sysfs_buf);
|
||||
|
||||
mutex_unlock(&drvdata->mem_lock);
|
||||
|
||||
if (drvdata->mode == CS_MODE_SYSFS)
|
||||
coresight_enable_all_source_link();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue