From: Andrew Lunn <andrew@lunn.ch>
To: Nathan Rossi <nathan@nathanrossi.com>
Cc: Marc Zyngier <maz@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Nathan Rossi <nathan.rossi@digi.com>,
Gregory Clement <gregory.clement@bootlin.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] irqchip/armada-370-xp: Enable MSI affinity configuration
Date: Thu, 21 Apr 2022 14:00:27 +0200 [thread overview]
Message-ID: <YmFHW5joJkxLpU3v@lunn.ch> (raw)
In-Reply-To: <CA+aJhH026fR5p6-JBaoQikZwC1F-iLBQWrqAvagauKjQoOqykQ@mail.gmail.com>
> > > static void armada_370_xp_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
> > > {
> > > +#ifdef CONFIG_SMP
> > > + unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(data));
> > > +
> > > + msg->data = (1 << (cpu + 8)) | (data->hwirq + PCI_MSI_DOORBELL_START);
> >
> > BIT(cpu + 8) | ...
> >
> > > +#else
> > > + msg->data = 0xf00 | (data->hwirq + PCI_MSI_DOORBELL_START);
> >
> > This paints the existing code a bit differently. This seems to target
> > all 4 CPUs. Why is that? I'd expect only bit 8 to be set, and the
> > whole #ifdefery to go away.
>
> I will remove the #ifdef in a v2 patch that addresses your
> other comments.
Please try to remove all the #ifdef'ery.
> > > static int armada_370_xp_msi_set_affinity(struct irq_data *irq_data,
> > > const struct cpumask *mask, bool force)
> > > {
> > > - return -EINVAL;
> > > +#ifdef CONFIG_SMP
> > > + unsigned int cpu;
> > > +
> > > + if (!force)
> > > + cpu = cpumask_any_and(mask, cpu_online_mask);
> > > + else
> > > + cpu = cpumask_first(mask);
> > > +
> > > + if (cpu >= nr_cpu_ids)
> > > + return -EINVAL;
> > > +
> > > + irq_data_update_effective_affinity(irq_data, cpumask_of(cpu));
> > > +
> > > + return IRQ_SET_MASK_OK;
> > > +#else
> > > + return -EINVAL;
> > > +#endif
A quick look in cpumask.h suggests that if NR_CPUS == 1, there are
stub functions which return constant values. So you might not need
this #ifdef. However, i'm a network guy, not a scheduling guy, so
don't trust what i say...
Andrew
prev parent reply other threads:[~2022-04-21 12:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 1:57 Nathan Rossi
2022-04-20 23:19 ` Marc Zyngier
2022-04-21 8:32 ` Nathan Rossi
2022-04-21 9:51 ` Marc Zyngier
2022-04-21 12:11 ` Andrew Lunn
2022-04-22 4:49 ` Nathan Rossi
2022-04-22 12:19 ` Andrew Lunn
2022-04-22 12:58 ` Nathan Rossi
2022-04-23 16:21 ` Andrew Lunn
2022-05-04 0:37 ` Nathan Rossi
2022-04-21 12:00 ` Andrew Lunn [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=YmFHW5joJkxLpU3v@lunn.ch \
--to=andrew@lunn.ch \
--cc=gregory.clement@bootlin.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=nathan.rossi@digi.com \
--cc=nathan@nathanrossi.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=tglx@linutronix.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®