summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/ptt/hisi_ptt.h
diff options
context:
space:
mode:
authorYicong Yang <yangyicong@hisilicon.com>2023-06-21 12:28:04 +0300
committerSuzuki K Poulose <suzuki.poulose@arm.com>2023-06-21 13:52:39 +0300
commit6c50384ef8b94a527445e3694ae6549e1f15d859 (patch)
tree81afd8e02ddbee9736d8fb35f322d654f81d497e /drivers/hwtracing/ptt/hisi_ptt.h
parent45c90292ad0e275ef4b870838b3b5273b3ef8ade (diff)
downloadlinux-6c50384ef8b94a527445e3694ae6549e1f15d859.tar.xz
hwtracing: hisi_ptt: Fix potential sleep in atomic context
We're using pci_irq_vector() to obtain the interrupt number and then bind it to the CPU start perf under the protection of spinlock in pmu::start(). pci_irq_vector() might sleep since [1] because it will call msi_domain_get_virq() to get the MSI interrupt number and it needs to acquire dev->msi.data->mutex. Getting a mutex will sleep on contention. So use pci_irq_vector() in an atomic context is problematic. This patch cached the interrupt number in the probe() and uses the cached data instead to avoid potential sleep. [1] commit 82ff8e6b78fc ("PCI/MSI: Use msi_get_virq() in pci_get_vector()") Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20230621092804.15120-6-yangyicong@huawei.com
Diffstat (limited to 'drivers/hwtracing/ptt/hisi_ptt.h')
-rw-r--r--drivers/hwtracing/ptt/hisi_ptt.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hwtracing/ptt/hisi_ptt.h b/drivers/hwtracing/ptt/hisi_ptt.h
index 164012dba4ec..e17f045d7e72 100644
--- a/drivers/hwtracing/ptt/hisi_ptt.h
+++ b/drivers/hwtracing/ptt/hisi_ptt.h
@@ -201,6 +201,7 @@ struct hisi_ptt_pmu_buf {
* @pdev: pci_dev of this PTT device
* @tune_lock: lock to serialize the tune process
* @pmu_lock: lock to serialize the perf process
+ * @trace_irq: interrupt number used by trace
* @upper_bdf: the upper BDF range of the PCI devices managed by this PTT device
* @lower_bdf: the lower BDF range of the PCI devices managed by this PTT device
* @port_filters: the filter list of root ports
@@ -221,6 +222,7 @@ struct hisi_ptt {
struct pci_dev *pdev;
struct mutex tune_lock;
spinlock_t pmu_lock;
+ int trace_irq;
u32 upper_bdf;
u32 lower_bdf;