From: Robin Murphy <robin.murphy@arm.com>
To: Mason <slash.tmp@free.fr>, Bjorn Helgaas <helgaas@kernel.org>
Cc: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>,
Marc Zyngier <marc.zyngier@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Jiang Liu <jiang.liu@linux.intel.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>,
David Laight <david.laight@aculab.com>,
linux-pci <linux-pci@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Thibaud Cornic <thibaud_cornic@sigmadesigns.com>,
Phuong Nguyen <phuong_nguyen@sigmadesigns.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] PCI: Add tango MSI controller support
Date: Tue, 23 May 2017 19:03:36 +0100 [thread overview]
Message-ID: <ef36137c-f0d1-23b9-8b91-a6ed87239578@arm.com> (raw)
In-Reply-To: <b6541fd2-200f-35be-208e-931bb0b5ba49@free.fr>
On 23/05/17 18:54, Mason wrote:
> On 23/05/2017 19:03, Bjorn Helgaas wrote:
>> On Wed, May 17, 2017 at 04:56:08PM +0200, Marc Gonzalez wrote:
>>> On 20/04/2017 16:28, Marc Gonzalez wrote:
>>>
>>>> +static int tango_set_affinity(struct irq_data *data,
>>>> + const struct cpumask *mask, bool force)
>>>> +{
>>>> + return -EINVAL;
>>>> +}
>>>> +
>>>> +static struct irq_chip tango_chip = {
>>>> + .irq_ack = tango_ack,
>>>> + .irq_mask = tango_mask,
>>>> + .irq_unmask = tango_unmask,
>>>> + .irq_set_affinity = tango_set_affinity,
>>>> + .irq_compose_msi_msg = tango_compose_msi_msg,
>>>> +};
>>>
>>> Hmmm... I'm wondering why .irq_set_affinity is required.
>>>
>>> static int setup_affinity(struct irq_desc *desc, struct cpumask *mask)
>>> first calls __irq_can_set_affinity() to check whether
>>> desc->irq_data.chip->irq_set_affinity) exists.
>>>
>>> then calls irq_do_set_affinity(&desc->irq_data, mask, false);
>>> which calls chip->irq_set_affinity(data, mask, force);
>>> = msi_domain_set_affinity()
>>> which calls parent->chip->irq_set_affinity() unconditionally.
>>>
>>> Would it make sense to test that the callback is implemented
>>> before calling it?
>>>
>>>
>>> [ 0.723895] Unable to handle kernel NULL pointer dereference at virtual address 00000000
>>
>> I'm not sure what you're asking.
>>
>> Is this a bug report for the v4 tango driver?
>
> No.
>
>> Or are you asking whether msi_domain_set_affinity() should be changed
>> to check whether parent->chip->irq_set_affinity is implemented?
>
> Yes. The way things are implemented now, drivers are forced
> to define an irq_set_affinity callback, even if it just returns
> an error, otherwise, the kernel crashes, because of the
> unconditional function pointer deref.
>
>> msi_domain_set_affinity() has called parent->chip->irq_set_affinity()
>> without checking since it was added in 2014 by f3cf8bb0d6c3 ("genirq: Add
>> generic msi irq domain support"), so if there's a problem here, it's most
>> likely in the tango code.
>
> The issue is having to define an "empty" function.
> (Unnecessary code bloat and maintenance.)
AFAICS, only one driver (other than this one) implements a "do nothing"
set_affinity callback - everyone else who doesn't do anything hardware
specific just passes it along via irq_chip_set_affinity_parent().
Robin.
>
> I'll send a patch illustrating exactly what I intended.
>
> Regards.
>
next prev parent reply other threads:[~2017-05-23 18:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-20 14:24 [PATCH v4 0/2] Tango PCIe " Marc Gonzalez
2017-04-20 14:28 ` [PATCH v4 1/2] PCI: Add tango MSI " Marc Gonzalez
2017-05-17 14:56 ` Marc Gonzalez
2017-05-23 17:03 ` Bjorn Helgaas
2017-05-23 17:54 ` Mason
2017-05-23 18:03 ` Robin Murphy [this message]
2017-05-23 19:15 ` Mason
2017-05-24 10:00 ` Robin Murphy
2017-05-24 10:22 ` Marc Zyngier
2017-05-31 14:18 ` Mason
2017-05-31 17:34 ` Bjorn Helgaas
2017-05-31 18:49 ` Mason
2017-05-31 19:00 ` Bjorn Helgaas
2017-05-31 19:12 ` Bjorn Helgaas
2017-05-31 19:27 ` Mason
2017-05-31 20:04 ` Bjorn Helgaas
2017-05-31 21:55 ` Mason
2017-05-25 8:37 ` Marc Zyngier
2017-05-31 7:32 ` Marc Gonzalez
2017-04-20 14:31 ` [PATCH v4 2/2] PCI: Add tango PCIe host bridge support Marc Gonzalez
2017-05-23 17:24 ` Bjorn Helgaas
2017-05-23 17:43 ` Mason
2017-05-23 18:35 ` Bjorn Helgaas
2017-05-23 19:29 ` Mason
2017-05-25 8:48 ` Marc Zyngier
2017-05-25 12:00 ` Mason
2017-05-25 12:23 ` Marc Zyngier
2017-05-25 12:41 ` Mason
2017-05-25 13:20 ` Marc Zyngier
2017-05-15 8:16 ` [PATCH v4 0/2] Tango PCIe controller support Marc Gonzalez
2017-05-23 17:17 ` Bjorn Helgaas
2017-05-23 18:07 ` Mason
2017-05-23 18:30 ` Bjorn Helgaas
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=ef36137c-f0d1-23b9-8b91-a6ed87239578@arm.com \
--to=robin.murphy@arm.com \
--cc=david.laight@aculab.com \
--cc=helgaas@kernel.org \
--cc=jiang.liu@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=marc.zyngier@arm.com \
--cc=marc_gonzalez@sigmadesigns.com \
--cc=phuong_nguyen@sigmadesigns.com \
--cc=slash.tmp@free.fr \
--cc=tglx@linutronix.de \
--cc=thibaud_cornic@sigmadesigns.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
all inboxes | Powered by JetHome®