mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: linux-mips@vger.kernel.org,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Thomas Gleixner <tglx@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] MIPS: SB1250: Validate and update IRQ affinity
Date: Mon, 9 Nov 2026 09:43:53 -0800	[thread overview]
Message-ID: <de0d1eb4-b866-43a0-980a-ec017d93549f@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.21.2611090615360.17804@angie.orcam.me.uk>

Hi Maciej,

On 11/8/26 22:17, Maciej W. Rozycki wrote:
> On Fri, 6 Nov 2026, Maciej W. Rozycki wrote:
> 
>>> sb1250_set_affinity() selects the first online CPU in the requested
>>> affinity mask without checking whether such a CPU exists. If the
>>> intersection is empty, the resulting CPU index is invalid and must
>>> not be passed to cpu_logical_map().
>>>
>>> Reject affinity masks containing no online CPU with -EINVAL before
>>> accessing the CPU mapping or interrupt mapper registers.
>>
>>   Why do you think this is needed?  The only case where an unvalidated mask
>> is passed is AFAICT with:
>>
>> /**
>>   * irq_force_affinity - Force the irq affinity of a given irq
>>   * @irq:	Interrupt to set affinity
>>   * @cpumask:	cpumask
>>   *
>>   * Same as irq_set_affinity, but without checking the mask against
>>   * online cpus.
>>   *
>>   * Solely for low level cpu hotplug code, where we need to make per
>>   * cpu interrupts affine before the cpu becomes online.
>>   */
>>
>> -- which does not apply here (nor for arch/mips/sibyte/bcm1480/irq.c,
>> which uses analogous code and should otherwise be updated accordingly)
>> since all the CPUs are onchip the SoC.
>>
>>   Have I missed anything?
>>
>>> Also update the effective affinity mask to reflect the single logical
>>> CPU selected as the interrupt target.
>>
>>   Likewise, why is it needed?  This code returns IRQ_SET_MASK_OK (should
>> really use the enumeration constant), so the caller will do the copy.
> 
>   I can see it went to Linus already.  Can we please have it reverted?

Apologies for the late response, I was hoping Thomas would allow us to 
discuss this before applying. The effective-affinity update addresses 
this warning observed during boot:

genirq: irq_chip SB1250-IMR did not update eff. affinity mask of irq 2

IRQ_SET_MASK_OK causes irq_do_set_affinity() to copy the requested mask 
into irq_common_data.affinity, but it does not populate the separate 
effective_affinity mask when CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK is 
enabled. irq_validate_effective_affinity() then finds that mask empty 
and emits the warning.

Since the mapper selects a single CPU, 
irq_data_update_effective_affinity(d, cpumask_of(i)) records the actual 
target and addresses that warning. I should have included this in the 
commit message.

You are right about the empty-mask check, I will remove that part, 
revise the commit message accordingly, and use IRQ_SET_MASK_OK 
explicitly. BCM1480 should receive the analogous effective-affinity 
update as well.
-- 
Florian

      reply	other threads:[~2026-11-09 17:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 21:50 Florian Fainelli
2026-11-05 15:44 ` Thomas Bogendoerfer
2026-11-06  6:00 ` Maciej W. Rozycki
2026-11-09  6:17   ` Maciej W. Rozycki
2026-11-09 17:43     ` Florian Fainelli [this message]

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=de0d1eb4-b866-43a0-980a-ec017d93549f@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=tglx@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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

all inboxes | Powered by JetHome®