Skip to content

Commit 1f80621

Browse files
lclaudiowilldeacon
authored andcommitted
iommu/tegra241-cmdqv: do not use smp_processor_id in preemptible context
During boot some of the calls to tegra241_cmdqv_get_cmdq() will happen in preemptible context. As this function calls smp_processor_id(), if CONFIG_DEBUG_PREEMPT is enabled, these calls will trigger a series of "BUG: using smp_processor_id() in preemptible" backtraces. As tegra241_cmdqv_get_cmdq() only calls smp_processor_id() to use the CPU number as a factor to balance out traffic on cmdq usage, it is safe to use raw_smp_processor_id() here. Cc: <[email protected]> Fixes: 918eb5c ("iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV") Signed-off-by: Luis Claudio R. Goncalves <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Nicolin Chen <[email protected]> Tested-by: Nicolin Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent fac04ef commit 1f80621

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ tegra241_cmdqv_get_cmdq(struct arm_smmu_device *smmu,
339339
* one CPU at a time can enter the process, while the others
340340
* will be spinning at the same lock.
341341
*/
342-
lidx = smp_processor_id() % cmdqv->num_lvcmdqs_per_vintf;
342+
lidx = raw_smp_processor_id() % cmdqv->num_lvcmdqs_per_vintf;
343343
vcmdq = vintf->lvcmdqs[lidx];
344344
if (!vcmdq || !READ_ONCE(vcmdq->enabled))
345345
return NULL;

0 commit comments

Comments
 (0)