]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
hwtracing: hisi_ptt: Fix potential sleep in atomic context
authorYicong Yang <yangyicong@hisilicon.com>
Wed, 21 Jun 2023 09:28:04 +0000 (17:28 +0800)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:19:58 +0000 (17:19 +0200)
commitd4df2f26d8256a179aaf8c7bef73dce5a9d847ad
tree54c373ae727eaeca7a9d33869ad32fb3de668c67
parentc8406423f03cea3faba36b3d518c2acb15d42bec
hwtracing: hisi_ptt: Fix potential sleep in atomic context

BugLink: https://bugs.launchpad.net/bugs/2034469
[ Upstream commit 6c50384ef8b94a527445e3694ae6549e1f15d859 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/hwtracing/ptt/hisi_ptt.c
drivers/hwtracing/ptt/hisi_ptt.h