mmc: host: Fix spinbug in performance sysfs nodes
In CMDQ, the mmc_release_host runs in softirq context. There's a potential race condition between show/set_perf since it doesn't disable pre-emption. Change this to disable preemption. Change-Id: I20918a459e8b35ac666971b8ebf179f44aa9c40f Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
This commit is contained in:
parent
4d105602c4
commit
b099847e11
1 changed files with 6 additions and 5 deletions
|
@ -776,9 +776,9 @@ show_perf(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct mmc_host *host = cls_dev_to_mmc_host(dev);
|
struct mmc_host *host = cls_dev_to_mmc_host(dev);
|
||||||
int64_t rtime_drv, wtime_drv;
|
int64_t rtime_drv, wtime_drv;
|
||||||
unsigned long rbytes_drv, wbytes_drv;
|
unsigned long rbytes_drv, wbytes_drv, flags;
|
||||||
|
|
||||||
spin_lock(&host->lock);
|
spin_lock_irqsave(&host->lock, flags);
|
||||||
|
|
||||||
rbytes_drv = host->perf.rbytes_drv;
|
rbytes_drv = host->perf.rbytes_drv;
|
||||||
wbytes_drv = host->perf.wbytes_drv;
|
wbytes_drv = host->perf.wbytes_drv;
|
||||||
|
@ -786,7 +786,7 @@ show_perf(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
rtime_drv = ktime_to_us(host->perf.rtime_drv);
|
rtime_drv = ktime_to_us(host->perf.rtime_drv);
|
||||||
wtime_drv = ktime_to_us(host->perf.wtime_drv);
|
wtime_drv = ktime_to_us(host->perf.wtime_drv);
|
||||||
|
|
||||||
spin_unlock(&host->lock);
|
spin_unlock_irqrestore(&host->lock, flags);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "Write performance at driver Level:"
|
return snprintf(buf, PAGE_SIZE, "Write performance at driver Level:"
|
||||||
"%lu bytes in %lld microseconds\n"
|
"%lu bytes in %lld microseconds\n"
|
||||||
|
@ -802,16 +802,17 @@ set_perf(struct device *dev, struct device_attribute *attr,
|
||||||
{
|
{
|
||||||
struct mmc_host *host = cls_dev_to_mmc_host(dev);
|
struct mmc_host *host = cls_dev_to_mmc_host(dev);
|
||||||
int64_t value;
|
int64_t value;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
sscanf(buf, "%lld", &value);
|
sscanf(buf, "%lld", &value);
|
||||||
spin_lock(&host->lock);
|
spin_lock_irqsave(&host->lock, flags);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
memset(&host->perf, 0, sizeof(host->perf));
|
memset(&host->perf, 0, sizeof(host->perf));
|
||||||
host->perf_enable = false;
|
host->perf_enable = false;
|
||||||
} else {
|
} else {
|
||||||
host->perf_enable = true;
|
host->perf_enable = true;
|
||||||
}
|
}
|
||||||
spin_unlock(&host->lock);
|
spin_unlock_irqrestore(&host->lock, flags);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue