intel_th: msu: Serialize enabling/disabling
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Thu, 10 Mar 2016 16:21:14 +0000 (18:21 +0200)
committerAlexander Shishkin <alexander.shishkin@linux.intel.com>
Fri, 8 Apr 2016 13:11:59 +0000 (16:11 +0300)
commita45ff6ed742cdfdb3cdebee83d19ab1c00d91fcc
treef87e814284007aab0e97cc61d9c9209532b8bc50
parentf18a9531f6da9aba2920a3a5f166dba5a20592a0
intel_th: msu: Serialize enabling/disabling

In order to guarantee that readers don't race with trace enabling,
both should happen under the same mutex. Having two mutexes seems
like an overkill, considering that because of the above, they'll
have to be acquired together, around trace enabling and char device
opening.

This patch makes both buffer accesses and readers serialize on
msc::buf_mutex and makes sure that 'enabled' flag accesses are also
serialized on it.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Laurent Fert <laurent.fert@intel.com>
drivers/hwtracing/intel_th/msu.c