diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2019-07-05 17:14:24 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-25 13:03:19 +0200 |
commit | ed5207afc580937cd6cc671357fe1119f1b5b0f5 (patch) | |
tree | ad448f597fecc9421936cf8ae2e086253f7e1902 /drivers/hwtracing/intel_th | |
parent | 57b69a1f66486d632e188fb167950fb4bdf84221 (diff) | |
download | linux-ed5207afc580937cd6cc671357fe1119f1b5b0f5.tar.bz2 |
intel_th: msu: Prevent freeing buffers while locked windows exist
We already prevent freeing buffers via sysfs interface in case there are
existing users or if trace is active. Treat the existence of locked windows
similarly and return -EBUSY on attempts to free the buffer. When the last
window is unlocked, the freeing will succeed.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20190705141425.19894-5-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/intel_th')
-rw-r--r-- | drivers/hwtracing/intel_th/msu.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index a6c0eb09c515..b200d9d1c7a0 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -724,6 +724,11 @@ static int msc_win_set_lockout(struct msc_window *win, win->lockout = new; + if (old == expect && new == WIN_LOCKED) + atomic_inc(&win->msc->user_count); + else if (old == expect && old == WIN_LOCKED) + atomic_dec(&win->msc->user_count); + unlock: spin_unlock_irqrestore(&win->lo_lock, flags); |