From: Robert.Richter@cavium.com (Richter, Robert)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/10] irqchip/gic-v3-its: Decouple its initialization from gic
Date: Fri, 9 Nov 2018 08:09:28 +0000 [thread overview]
Message-ID: <20181109080920.GE4064@rric.localdomain> (raw)
In-Reply-To: <21a0183b-bf4b-1895-d10b-8287dbff930a@arm.com>
On 08.11.18 11:26:02, Julien Thierry wrote:
> On 07/11/18 22:03, Robert Richter wrote:
> >-static int __init its_init(void)
> >+int __init its_init(void)
> > {
> > struct its_node *its;
> > bool has_v4 = false;
> > int err;
> >
> >+ if (list_empty(&its_probed))
> >+ return 0;
> >+
> >+ raw_spin_lock(&its_lock);
> >+redo:
> >+ list_for_each_entry(its, &its_probed, entry) {
> >+ list_del_init(&its->entry);
> >+
> >+ raw_spin_unlock(&its_lock);
> >+
> >+ /* Needs to be called in non-atomic context */
> >+ err = its_init_one(its);
> >+ if (err)
> >+ its_free(its);
> >+
> >+ raw_spin_lock(&its_lock);
> >+
> >+ if (!err)
> >+ list_add_tail(&its->entry, &its_nodes);
> >+
> >+ goto redo;
>
> Again, you're starting a loop only to work on the first element and then
> restarting the loop.
>
> Just do a while (!list_empty()), and without gotos...
When writing the code I have looked into an alternative to
list_for_each_entry() and did not find a better way that works with
proper locking. list_first_entry() requires the list being non-empty.
If you set the lock after list_empty() it is not granted the list is
actual empty. See also my other comment in an earlier mail.
-Robert
>
> >+ }
> >+
> >+ raw_spin_unlock(&its_lock);
> >+
> > if (list_empty(&its_nodes)) {
> > pr_warn("ITS: No ITS available, not enabling LPIs\n");
> > return -ENXIO;
> > }
> >
> > err = allocate_lpi_tables();
> >- if (err)
> >+ if (err) {
> >+ pr_warn("ITS: Failed to initialize (%d), not enabling LPIs\n",
> >+ err);
> > return err;
> >+ }
next prev parent reply other threads:[~2018-11-09 8:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-07 22:03 [PATCH 00/10] irqdomain, gic-v3-its: Implement late irq domain initialization Robert Richter
2018-11-07 22:03 ` [PATCH 01/10] irqdomain: Add interface to request an irq domain Robert Richter
2018-11-08 10:19 ` Julien Thierry
2018-11-08 15:05 ` Richter, Robert
2018-11-09 9:05 ` Julien Thierry
2018-11-12 8:54 ` Richter, Robert
2018-11-07 22:03 ` [PATCH 02/10] irqchip/gic-v3-its-platform-msi: Remove domain init order dependencies Robert Richter
2018-11-07 22:03 ` [PATCH 03/10] irqchip/irq-gic-v3-its-pci-msi: " Robert Richter
2018-11-07 22:03 ` [PATCH 04/10] irqchip/irq-gic-v3-its-fsl-mc-msi: " Robert Richter
2018-11-07 22:03 ` [PATCH 05/10] fsl-mc/dprc-driver: " Robert Richter
2018-11-07 22:03 ` [PATCH 06/10] irqchip/gic-v3-its: Initialize its nodes in probe order Robert Richter
2018-11-07 22:03 ` [PATCH 07/10] irqchip/gic-v3-its: Split probing from its node initialization Robert Richter
2018-11-08 11:25 ` Julien Thierry
2018-11-09 7:58 ` Richter, Robert
2018-11-07 22:03 ` [PATCH 08/10] irqchip/gic-v3-its: Decouple its initialization from gic Robert Richter
2018-11-08 11:26 ` Julien Thierry
2018-11-09 8:09 ` Richter, Robert [this message]
2018-11-07 22:03 ` [PATCH 09/10] irqchip/gic-v3-its: Initialize its nodes later Robert Richter
2018-11-07 22:03 ` [PATCH 10/10] irqchip/gic-v3-its: Initialize MSIs with subsys_initcalls Robert Richter
2018-11-09 17:19 ` [PATCH 00/10] irqdomain, gic-v3-its: Implement late irq domain initialization John Garry
2018-11-11 9:42 ` Richter, Robert
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=20181109080920.GE4064@rric.localdomain \
--to=robert.richter@cavium.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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