public inbox for linux-mips@vger.kernel.org
 help / color / mirror / Atom feed
From: <markus.stockhausen@gmx.de>
To: "'Thomas Gleixner'" <tglx@linutronix.de>,
	<tsbogend@alpha.franken.de>, <linux-mips@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <s.gottschall@dd-wrt.com>
Subject: AW: [PATCH] irqchip/mips-gic: allow forced affinity for current cpu during hotplug
Date: Sun, 25 May 2025 11:43:21 +0200	[thread overview]
Message-ID: <043701dbcd59$73bcfb70$5b36f250$@gmx.de> (raw)
In-Reply-To: <87bjrhqcn8.ffs@tglx>

> Von: Thomas Gleixner <tglx@linutronix.de> 
>
> On Fri, May 23 2025 at 11:15, Markus Stockhausen wrote:
> > +
> > +	if ((cpu >= NR_CPUS) && !force)
> > +		/* In normal mode allow only online CPUs. */
> >  		return -EINVAL;
> >  
> > +	if (cpu >= NR_CPUS) {
> > +		/* In force mode allow current not yet online CPU for
hotplug handlers. */
> > +		cpu = cpumask_first(cpumask);
> > +		if (cpu != get_cpu())
> > +			return -EINVAL;
> > +	}
>
> This logic really makes my brain hurt. Why not doing the obvious:
>
>	if (cpu >= NR_CPUS) {
>         	/* Sensible comment */	
>         	if (!force)
>                 	return -EINVAL;
>                 ...
>         }

Then what about an even more relaxed and cleaner version like in other
drivers?

If (force)
  cpu = cpumask_first(cpumask);
else
  cpu = cpumask_first_and(cpumask, cpu_online_mask);

Markus


  reply	other threads:[~2025-05-25  9:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 15:15 [PATCH] irqchip/mips-gic: allow forced affinity for current cpu during hotplug Markus Stockhausen
2025-05-25  9:10 ` Thomas Gleixner
2025-05-25  9:43   ` markus.stockhausen [this message]
2025-05-25 18:40     ` AW: " Thomas Gleixner

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='043701dbcd59$73bcfb70$5b36f250$@gmx.de' \
    --to=markus.stockhausen@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=s.gottschall@dd-wrt.com \
    --cc=tglx@linutronix.de \
    --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