Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Nitin Rawat <nitin.rawat@oss.qualcomm.com>,
	mani@kernel.org, James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH V1 1/3] ufs: ufs-qcom: Add UFS ESI CPU affinity support
Date: Thu, 22 Jan 2026 16:57:28 -0800	[thread overview]
Message-ID: <4097a1d7-5594-44e2-b2f0-1d1877981928@acm.org> (raw)
In-Reply-To: <20260122141331.239354-2-nitin.rawat@oss.qualcomm.com>

On 1/22/26 6:13 AM, Nitin Rawat wrote:
> +static void ufs_qcom_set_esi_affinity(struct ufs_hba *hba)
> +{
> +	struct msi_desc *desc;
> +	int ret, i = 0, nr_irqs = 0;
> +	const cpumask_t *mask;
> +	int cpu;
> +
> +	__msi_lock_descs(hba->dev);
> +	/* Count the number of MSI descriptors */
> +	msi_for_each_desc(desc, hba->dev, MSI_DESC_ALL) {
> +		nr_irqs++;
> +	}
> +	__msi_unlock_descs(hba->dev);
> +
> +	if (nr_irqs == 0)
> +		return;
> +
> +	__msi_lock_descs(hba->dev);
> +	/* Set affinity hints for each interrupt in round-robin fashion */
> +	msi_for_each_desc(desc, hba->dev, MSI_DESC_ALL) {
> +		if (i >= nr_irqs)
> +			break;
> +
> +		/* Distribute interrupts across online CPUs in round-robin */
> +		cpu = cpumask_nth(i % num_online_cpus(), cpu_online_mask);
> +		mask = get_cpu_mask(cpu);
> +		if (!cpumask_subset(mask, cpu_online_mask)) {
> +			dev_err(hba->dev, "Invalid CPU %d in map, using online CPUs\n",
> +				cpu);
> +			mask = cpu_online_mask;
> +		}
> +
> +		ret = irq_set_affinity_hint(desc->irq, mask);
> +		if (ret < 0)
> +			dev_err(hba->dev, "Failed to set affinity hint to CPU %d for ESI IRQ %d, err = %d\n",
> +				cpu, desc->irq, ret);
> +
> +		i++;
> +	}
> +	__msi_unlock_descs(hba->dev);
> +}

Why an entirely new function for setting interrupt affinity? Why isn't
irq_create_affinity_masks() good enough? Are you aware that
devm_platform_get_irqs_affinity() calls irq_create_affinity_masks()?

Thanks,

Bart.

  reply	other threads:[~2026-01-23  0:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 14:13 [PATCH V1 0/3] ufs: ufs-qcom: Fixes and optimizations for Qualcomm UFS platform Nitin Rawat
2026-01-22 14:13 ` [PATCH V1 1/3] ufs: ufs-qcom: Add UFS ESI CPU affinity support Nitin Rawat
2026-01-23  0:57   ` Bart Van Assche [this message]
2026-01-22 14:13 ` [PATCH V1 2/3] ufs: ufs-qcom: Align programming sequence for UFS controller v6.2 Nitin Rawat
2026-01-22 15:09   ` Konrad Dybcio
2026-08-26  5:27     ` Nitin Rawat
2026-01-22 14:13 ` [PATCH V1 3/3] ufs: ufs-qcom: Fix sequential read variance Nitin Rawat
2026-01-22 15:11   ` Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4097a1d7-5594-44e2-b2f0-1d1877981928@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nitin.rawat@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox