Skip to contentSkip to conversation

dpaa2: avoid scheduling dpio interrupts on isolated CPUs

RFC PATCH In review Josua Mayer 2 participants 7 messages Sep 30 – Oct 8

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

cover dpaa2: avoid scheduling dpio interrupts on isolated CPUs

Sent as RFC due to very superficial testing, and confusion wrt. which list/tree to target. Suggest net-next. Last patch is logical first, but must be applied last.

Each DPAA2 software portal (DPIO) is bound to one CPU. The dpaa2-eth and caam qi2 drivers allocate channels and queues for each online CPU. Notifications, and NAPI polling are processed on each DPIO's affine CPU. This balances I/O load nicely across all available CPU cores while keeping data on the hot path.

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, interrupting any application running there.

This series assigns DPIOs only to CPUs in the HK_TYPE_MANAGED_IRQ housekeeping mask, and changes dpaa2-eth and caam qi2 to set up their per-CPU channels and queue pairs only on those CPUs. Without the driver changes, both would defer probe indefinitely, waiting for a DPIO on an isolated CPU.

Isolated CPUs can still transmit frames and enqueue crypto requests; the resulting ingress, Tx confirmation and response processing runs on housekeeping CPUs. Systems without isolcpus=managed_irq are unaffected.

Note: This series is submitted in reverse, to ease bisecting. Otherwise caam/dpaa2-eth would defer probe iondefinitely when booted with one or more isolated CPUs.

---
Josua Mayer (3):
dpaa2-eth: skip isolated CPUs when allocating channels
crypto: caam/qi2 - skip isolated CPUs when setting up queue pairs
soc: fsl: dpio: skip isolated CPUs when assigning portals

 drivers/crypto/caam/caamalg_qi2.c                | 26 +++++++++++++++---------
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 10 +++++++--
 drivers/soc/fsl/dpio/dpio-driver.c               |  7 +++++--
 3 files changed, 29 insertions(+), 14 deletions(-)

---
base-commit: 47a1446725732cd3996edf607e8739334bbf4d78
change-id: 20260930-dpaa2-isolcpus-ecb715f2004d

Best regards,

Signature · 1 line
Josua Mayer <[email protected]>
#1 lore raw

RFC PATCH 1/3 dpaa2-eth: skip isolated CPUs when allocating channels

The driver allocates one channel per online CPU and registers it with that CPU's affine DPIO.

When isolcpus=managed_irq is used to reserve CPUs for latency-sensitive applications, those CPUs are expected to be free of routine device interrupts.

The DPIO driver assigns affine CPUs only from the HK_TYPE_MANAGED_IRQ housekeeping mask, leaving isolated CPUs without an affine DPIO. This defers dpaa2-eth probe indefinitely once channel setup reaches an isolated CPU.

Restrict channel setup to the online CPUs in the HK_TYPE_MANAGED_IRQ housekeeping mask, so that isolated CPUs are skipped and don't defer probe.

---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +8 -2
index 6f1046c9cc515..850834388790a 100644
@@ -15,6 +15,7 @@
 #include <linux/bpf_trace.h>
 #include <linux/fsl/ptp_qoriq.h>
 #include <linux/ptp_classify.h>
+#include <linux/sched/isolation.h>
 #include <net/pkt_cls.h>
 #include <net/sock.h>
 #include <net/tso.h>
@@ -3173,6 +3174,7 @@ static int dpaa2_eth_setup_dpio(struct dpaa2_eth_priv *priv)
 	struct dpaa2_eth_channel *channel;
 	struct dpcon_notification_cfg dpcon_notif_cfg;
 	struct device *dev = priv->net_dev->dev.parent;
+	const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ);
 	int i, err;
 
 	/* We want the ability to spread ingress traffic (RX, TX conf) to as
@@ -3182,10 +3184,11 @@ static int dpaa2_eth_setup_dpio(struct dpaa2_eth_priv *priv)
 	 * Allocate one channel per core and register it to the core's
 	 * affine DPIO. If not enough channels are available for all cores
 	 * or if some cores don't have an affine DPIO, there will be no
-	 * ingress frame processing on those cores.
+	 * ingress frame processing on those cores. Isolated cores
+	 * (isolcpus=managed_irq) have no affine DPIO.
 	 */
 	cpumask_clear(&priv->dpio_cpumask);
-	for_each_online_cpu(i) {
+	for_each_cpu_and(i, cpu_online_mask, hk_mask) {
 		/* Try to allocate a channel */
 		channel = dpaa2_eth_alloc_channel(priv);
 		if (IS_ERR_OR_NULL(channel)) {
@@ -3245,6 +3248,9 @@ static int dpaa2_eth_setup_dpio(struct dpaa2_eth_priv *priv)
 			break;
 	}
 
+	if (cpumask_empty(&priv->dpio_cpumask))
+		goto err_alloc_ch;
+
 	return 0;
 
 err_set_cdan:
Signature · 1 line
2.51.0
#2 lore raw

RFC PATCH 2/3 crypto: caam/qi2 - skip isolated CPUs when setting up queue pairs

In reply to Josua Mayer

The driver looks up the affine DPIO and sets up one Rx/Tx queue pair for each online CPU, up to the number of queues. Response notifications and NAPI polling are handled on the DPIO object's assigned CPU. All online may enqueue requests.

When isolcpus=managed_irq is used to reserve CPUs for latency-sensitive applications, those CPUs are expected to be free of routine device interrupts.

The DPIO driver assigns affine CPUs only from the HK_TYPE_MANAGED_IRQ housekeeping mask, leaving isolated CPUs without an affine DPIO. This defers caam qi2 probe indefinitely once DPIO setup reaches an isolated CPU.

Restrict queue pairs, notifications and NAPI polling to the online CPUs in the HK_TYPE_MANAGED_IRQ housekeeping mask, so that isolated CPUs are skipped and don't defer probe. Isolated CPUs may still enqueue requests, with responses handled on housekeeping CPUs.

As the dequeuing CPUs are no longer necessarily CPUs 0 to num_pairs - 1, enable and disable NAPI based on the bookkeeping in clean_mask instead.

---
 drivers/crypto/caam/caamalg_qi2.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/crypto/caam/caamalg_qi2.c +16 -10
index 6b47bcc16a506..e9faaee009b74 100644
@@ -25,6 +25,7 @@
 #include <soc/fsl/dpaa2-fd.h>
 #include <crypto/xts.h>
 #include <linux/unaligned.h>
+#include <linux/sched/isolation.h>
 
 #define CAAM_CRA_PRIORITY	2000
 
@@ -4683,9 +4684,10 @@ static int __cold dpaa2_dpseci_dpio_setup(struct dpaa2_caam_priv *priv)
 	struct device *dev = priv->dev;
 	struct dpaa2_io_notification_ctx *nctx;
 	struct dpaa2_caam_priv_per_cpu *ppriv;
+	const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ);
 	int err, i = 0, cpu;
 
-	for_each_online_cpu(cpu) {
+	for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
 		ppriv = per_cpu_ptr(priv->ppriv, cpu);
 		ppriv->priv = priv;
 		nctx = &ppriv->nctx;
@@ -4725,14 +4727,14 @@ static int __cold dpaa2_dpseci_dpio_setup(struct dpaa2_caam_priv *priv)
 	return 0;
 
 err:
-	for_each_online_cpu(cpu) {
+	for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
 		ppriv = per_cpu_ptr(priv->ppriv, cpu);
 		if (!ppriv->nctx.cb)
 			break;
 		dpaa2_io_service_deregister(ppriv->dpio, &ppriv->nctx, dev);
 	}
 
-	for_each_online_cpu(cpu) {
+	for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
 		ppriv = per_cpu_ptr(priv->ppriv, cpu);
 		if (!ppriv->store)
 			break;
@@ -4745,9 +4747,10 @@ static int __cold dpaa2_dpseci_dpio_setup(struct dpaa2_caam_priv *priv)
 static void __cold dpaa2_dpseci_dpio_free(struct dpaa2_caam_priv *priv)
 {
 	struct dpaa2_caam_priv_per_cpu *ppriv;
+	const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ);
 	int i = 0, cpu;
 
-	for_each_online_cpu(cpu) {
+	for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
 		ppriv = per_cpu_ptr(priv->ppriv, cpu);
 		dpaa2_io_service_deregister(ppriv->dpio, &ppriv->nctx,
 					    priv->dev);
@@ -4764,10 +4767,11 @@ static int dpaa2_dpseci_bind(struct dpaa2_caam_priv *priv)
 	struct device *dev = priv->dev;
 	struct fsl_mc_device *ls_dev = to_fsl_mc_device(dev);
 	struct dpaa2_caam_priv_per_cpu *ppriv;
+	const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ);
 	int err = 0, i = 0, cpu;
 
 	/* Configure Rx queues */
-	for_each_online_cpu(cpu) {
+	for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
 		ppriv = per_cpu_ptr(priv->ppriv, cpu);
 
 		rx_queue_cfg.options = DPSECI_QUEUE_OPT_DEST |
@@ -5012,6 +5016,8 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
 	struct device *dev = &ls_dev->dev;
 	struct dpaa2_caam_priv *priv;
 	struct dpaa2_caam_priv_per_cpu *ppriv;
+	const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ);
+	unsigned int num_online_hk_cpus = cpumask_weight_and(cpu_online_mask, hk_mask);
 	int err, cpu;
 	u8 i;
 
@@ -5070,10 +5076,10 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
 
 	priv->num_pairs = min(priv->dpseci_attr.num_rx_queues,
 			      priv->dpseci_attr.num_tx_queues);
-	if (priv->num_pairs > num_online_cpus()) {
+	if (priv->num_pairs > num_online_hk_cpus) {
 		dev_warn(dev, "%d queues won't be used\n",
-			 priv->num_pairs - num_online_cpus());
-		priv->num_pairs = num_online_cpus();
+			 priv->num_pairs - num_online_hk_cpus);
+		priv->num_pairs = num_online_hk_cpus;
 	}
 
 	for (i = 0; i < priv->dpseci_attr.num_rx_queues; i++) {
@@ -5151,7 +5157,7 @@ static int dpaa2_dpseci_enable(struct dpaa2_caam_priv *priv)
 	struct dpaa2_caam_priv_per_cpu *ppriv;
 	int i;
 
-	for (i = 0; i < priv->num_pairs; i++) {
+	for_each_cpu(i, priv->clean_mask) {
 		ppriv = per_cpu_ptr(priv->ppriv, i);
 		napi_enable(&ppriv->napi);
 	}
@@ -5180,7 +5186,7 @@ static int __cold dpaa2_dpseci_disable(struct dpaa2_caam_priv *priv)
 
 	dev_dbg(dev, "disable: %s\n", str_false_true(enabled));
 
-	for (i = 0; i < priv->num_pairs; i++) {
+	for_each_cpu(i, priv->clean_mask) {
 		ppriv = per_cpu_ptr(priv->ppriv, i);
 		napi_disable(&ppriv->napi);
 		netif_napi_del(&ppriv->napi);
Signature · 1 line
2.51.0
maintainer
#3 lore raw

Re: [PATCH RFC net-next 2/3] crypto: caam/qi2 - skip isolated CPUs when setting up queue pairs

Quoted 14 lines · Josua Mayer

The driver looks up the affine DPIO and sets up one Rx/Tx queue pair for each online CPU, up to the number of queues. Response notifications and NAPI polling are handled on the DPIO object's assigned CPU. All online may enqueue requests.

When isolcpus=managed_irq is used to reserve CPUs for latency-sensitive applications, those CPUs are expected to be free of routine device interrupts.

The DPIO driver assigns affine CPUs only from the HK_TYPE_MANAGED_IRQ housekeeping mask, leaving isolated CPUs without an affine DPIO. This defers caam qi2 probe indefinitely once DPIO setup reaches an isolated CPU.

Quoted 4 lines

Restrict queue pairs, notifications and NAPI polling to the online CPUs in the HK_TYPE_MANAGED_IRQ housekeeping mask, so that isolated CPUs are skipped and don't defer probe. Isolated CPUs may still enqueue requests, with responses handled on housekeeping CPUs.

Don't you need to also change the for_each_online_cpu() from dpaa2_dpseci_setup() to take into account only the housekeeping managed_irq cores?

Something like:

drivers/crypto/caam/caamalg_qi2.c +1 -1
@@ -5101,7 +5101,7 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
        }
 
        i = 0;
-       for_each_online_cpu(cpu) {
+       for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
                u8 j;
 
                j = i % priv->num_pairs;

Ioana

#4 lore raw

Re: [PATCH RFC net-next 2/3] crypto: caam/qi2 - skip isolated CPUs when setting up queue pairs

Hi Ioana,

Thank you for taking a look at my patch!

Quoted 15 lines · Ioana Ciornei
Quoted 14 lines · Josua Mayer

The driver looks up the affine DPIO and sets up one Rx/Tx queue pair for each online CPU, up to the number of queues. Response notifications and NAPI polling are handled on the DPIO object's assigned CPU. All online may enqueue requests.

When isolcpus=managed_irq is used to reserve CPUs for latency-sensitive applications, those CPUs are expected to be free of routine device interrupts.

The DPIO driver assigns affine CPUs only from the HK_TYPE_MANAGED_IRQ housekeeping mask, leaving isolated CPUs without an affine DPIO. This defers caam qi2 probe indefinitely once DPIO setup reaches an isolated CPU.

Quoted 8 lines
Quoted 4 lines

Restrict queue pairs, notifications and NAPI polling to the online CPUs in the HK_TYPE_MANAGED_IRQ housekeeping mask, so that isolated CPUs are skipped and don't defer probe. Isolated CPUs may still enqueue requests, with responses handled on housekeeping CPUs.

Don't you need to also change the for_each_online_cpu() from dpaa2_dpseci_setup() to take into account only the housekeeping managed_irq cores?

I initially thought no, because of the "Allow all cores to enqueue" comment in code.

Quoted 7 lines

Something like:

drivers/crypto/caam/caamalg_qi2.c static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev) · line 5107

Quoted 8 lines
drivers/crypto/caam/caamalg_qi2.c +1 -1
@@ -5101,7 +5101,7 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
         }
 
         i = 0;
-       for_each_online_cpu(cpu) {
+       for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
                 u8 j;
 
                 j = i % priv->num_pairs;

Correct.

The loop is doing two things in one: assign tx queue to each cpu, and assign rx queue to each cpu.

Only rx side is an issue for isolcpus. Do you have any idea why each cpu got a tx queue assigned, and if this may be changed?

Here is a copy of the complete loop, with inline comments on the control flow:

Quoted 8 lines
	i = 0;
	for_each_online_cpu(cpu) {
		u8 j;

		j = i % priv->num_pairs;

		ppriv = per_cpu_ptr(priv->ppriv, cpu);
		ppriv->req_fqid = priv->tx_queue_attr[j].fqid;

Assigns a tx queue to the cpu, one tx queue may be assigned to multiple cores due to modulo above (if i >= num_pairs).

Quoted 6 lines
		/*
		 * Allow all cores to enqueue, while only some of them
		 * will take part in dequeuing.
		 */
		if (++i > priv->num_pairs)
			continue;

After this i <= num_pairs.

Quoted 2 lines
		ppriv->rsp_fqid = priv->rx_queue_attr[j].fqid;
		ppriv->prio = j;

Assigns a rx queue to the cpu.
This is the case which causes issues with isolcpus, and it should be avoided for non-housekeeping cpus.

Quoted 8 lines
		dev_dbg(dev, "pair %d: rx queue %d, tx queue %d\n", j,
			priv->rx_queue_attr[j].fqid,
			priv->tx_queue_attr[j].fqid);

		ppriv->net_dev = alloc_netdev_dummy(0);
		if (!ppriv->net_dev) {
			err = -ENOMEM;
			goto err_alloc_netdev;
Quoted 8 lines
		}
		cpumask_set_cpu(cpu, priv->clean_mask);
		ppriv->net_dev->dev = *dev;

		netif_napi_add_tx_weight(ppriv->net_dev, &ppriv->napi,
					 dpaa2_dpseci_poll,
					 DPAA2_CAAM_NAPI_WEIGHT);
	}

dpaa2_caam_enqueue unconditionally accesses ppriv->dpio per-cpu and ppriv->req_fqid, not gated by any checks, percpu (any cpu).

This causes two issues:
1. each cpu is still expected to have a dpio object
2. each cpu is still expected to have an assigned tx queue

I don't quite understand how we get into dpaa2_caam_enqueue, I suppose it can legitimately happen on any cpu core whatsoever?

sincerely
Josua Mayer

maintainer
#5 lore raw

Re: [PATCH RFC net-next 2/3] crypto: caam/qi2 - skip isolated CPUs when setting up queue pairs

Quoted 99 lines · Josua Mayer

Hi Ioana,

Thank you for taking a look at my patch!

Quoted 15 lines · Ioana Ciornei
Quoted 14 lines · Josua Mayer

The driver looks up the affine DPIO and sets up one Rx/Tx queue pair for each online CPU, up to the number of queues. Response notifications and NAPI polling are handled on the DPIO object's assigned CPU. All online may enqueue requests.

When isolcpus=managed_irq is used to reserve CPUs for latency-sensitive applications, those CPUs are expected to be free of routine device interrupts.

The DPIO driver assigns affine CPUs only from the HK_TYPE_MANAGED_IRQ housekeeping mask, leaving isolated CPUs without an affine DPIO. This defers caam qi2 probe indefinitely once DPIO setup reaches an isolated CPU.

Quoted 8 lines
Quoted 4 lines

Restrict queue pairs, notifications and NAPI polling to the online CPUs in the HK_TYPE_MANAGED_IRQ housekeeping mask, so that isolated CPUs are skipped and don't defer probe. Isolated CPUs may still enqueue requests, with responses handled on housekeeping CPUs.

Don't you need to also change the for_each_online_cpu() from dpaa2_dpseci_setup() to take into account only the housekeeping managed_irq cores?

I initially thought no, because of the "Allow all cores to enqueue" comment in code.

Quoted 7 lines

Something like:

drivers/crypto/caam/caamalg_qi2.c static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev) · line 5107

Quoted 8 lines
drivers/crypto/caam/caamalg_qi2.c +1 -1
@@ -5101,7 +5101,7 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
         }
 
         i = 0;
-       for_each_online_cpu(cpu) {
+       for_each_cpu_and(cpu, cpu_online_mask, hk_mask) {
                 u8 j;
 
                 j = i % priv->num_pairs;

Correct.

The loop is doing two things in one: assign tx queue to each cpu, and assign rx queue to each cpu.

Only rx side is an issue for isolcpus. Do you have any idea why each cpu got a tx queue assigned, and if this may be changed?

Here is a copy of the complete loop, with inline comments on the control flow:

Quoted 8 lines
	i = 0;
	for_each_online_cpu(cpu) {
		u8 j;

		j = i % priv->num_pairs;

		ppriv = per_cpu_ptr(priv->ppriv, cpu);
		ppriv->req_fqid = priv->tx_queue_attr[j].fqid;

Assigns a tx queue to the cpu, one tx queue may be assigned to multiple cores due to modulo above (if i >= num_pairs).

Quoted 6 lines
		/*
		 * Allow all cores to enqueue, while only some of them
		 * will take part in dequeuing.
		 */
		if (++i > priv->num_pairs)
			continue;

After this i <= num_pairs.

Quoted 2 lines
		ppriv->rsp_fqid = priv->rx_queue_attr[j].fqid;
		ppriv->prio = j;

Assigns a rx queue to the cpu.
This is the case which causes issues with isolcpus, and it should be avoided for non-housekeeping cpus.

Quoted 8 lines
		dev_dbg(dev, "pair %d: rx queue %d, tx queue %d\n", j,
			priv->rx_queue_attr[j].fqid,
			priv->tx_queue_attr[j].fqid);

		ppriv->net_dev = alloc_netdev_dummy(0);
		if (!ppriv->net_dev) {
			err = -ENOMEM;
			goto err_alloc_netdev;
Quoted 8 lines
		}
		cpumask_set_cpu(cpu, priv->clean_mask);
		ppriv->net_dev->dev = *dev;

		netif_napi_add_tx_weight(ppriv->net_dev, &ppriv->napi,
					 dpaa2_dpseci_poll,
					 DPAA2_CAAM_NAPI_WEIGHT);
	}

dpaa2_caam_enqueue unconditionally accesses ppriv->dpio per-cpu and ppriv->req_fqid, not gated by any checks, percpu (any cpu).

Quoted 6 lines

This causes two issues:
1. each cpu is still expected to have a dpio object
2. each cpu is still expected to have an assigned tx queue

I don't quite understand how we get into dpaa2_caam_enqueue, I suppose it can legitimately happen on any cpu core whatsoever?

I don't have any experience in the crypto area but from the looks of it, there is nothing limiting on what cpus crypto_aead_encrypt() could run on.

For example, one of crypto_aead_encrypt() callers is the macsec software implementation. In that case, I would expect that the macsec's .ndo_start_xmit() callback could be run on a non-housekeeping, which in turn means that caam_qi2 needs to be prepared to run the enqueue() from any cpu.

Ioana

#6 lore raw

RFC PATCH 3/3 soc: fsl: dpio: skip isolated CPUs when assigning portals

In reply to Josua Mayer

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.

---
 drivers/soc/fsl/dpio/dpio-driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/soc/fsl/dpio/dpio-driver.c +5 -2
index d5198ffc44550..242db78affb95 100644
@@ -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);
 }
Signature · 1 line
2.51.0