During probe, each DPIO object is assigned to exactly one CPU, and its interrupt affinity is set accordingly. CPUs are picked from all online CPUs, regardless of CPU isolation.
The dpaa2-eth and caam qi2 drivers use one DPIO per CPU and follow its affinity: notifications from each DPIO and the matching NAPI polling are handled on the DPIO object's assigned CPU. When isolcpus=managed_irq is used to reserve CPUs for latency-sensitive applications, those CPUs are expected to be free of routine device interrupts. However, DPIO interrupts currently continue to arrive on isolated CPUs. Restrict the CPUs available to DPIO objects to the online CPUs in the HK_TYPE_MANAGED_IRQ housekeeping mask, so that isolated CPUs are skipped and left to the applications pinned to them. Signed-off-by: Josua Mayer <[email protected]> --- drivers/soc/fsl/dpio/dpio-driver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c index d5198ffc44550..242db78affb95 100644 --- a/drivers/soc/fsl/dpio/dpio-driver.c +++ b/drivers/soc/fsl/dpio/dpio-driver.c @@ -13,6 +13,7 @@ #include <linux/dma-mapping.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/sched/isolation.h> #include <linux/sys_soc.h> #include <linux/fsl/mc.h> @@ -173,7 +174,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) /* get the cpu to use for the affinity hint */ possible_next_cpu = cpumask_first(cpus_unused_mask); if (possible_next_cpu >= nr_cpu_ids) { - dev_err(dev, "probe failed. Number of DPIOs exceeds NR_CPUS.\n"); + dev_err(dev, "No unused managed_irq cpu left for dpio\n"); err = -ERANGE; goto err_allocate_irqs; } @@ -317,9 +318,11 @@ static struct fsl_mc_driver dpaa2_dpio_driver = { static int dpio_driver_init(void) { + const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ); + if (!zalloc_cpumask_var(&cpus_unused_mask, GFP_KERNEL)) return -ENOMEM; - cpumask_copy(cpus_unused_mask, cpu_online_mask); + cpumask_and(cpus_unused_mask, cpu_online_mask, hk_mask); return fsl_mc_driver_register(&dpaa2_dpio_driver); } -- 2.51.0
