From: Marc Zyngier <maz@kernel.org>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Linus Walleij <linus.walleij@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Philipp Zabel <p.zabel@pengutronix.de>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
Phil Edworthy <phil.edworthy@renesas.com>,
Biju Das <biju.das.jz@bp.renesas.com>
Subject: Re: [PATCH v3 3/5] gpio: gpiolib: Allow free() callback to be overridden
Date: Thu, 12 May 2022 23:24:25 +0100 [thread overview]
Message-ID: <87sfpemlt2.wl-maz@kernel.org> (raw)
In-Reply-To: <CA+V-a8sMvjYK5NfkqpD3ertfUOy1zbauXW9gLzG+GLzZtvUygg@mail.gmail.com>
On Thu, 12 May 2022 18:55:38 +0100,
"Lad, Prabhakar" <prabhakar.csengg@gmail.com> wrote:
>
> Hi Marc,
>
> On Thu, May 12, 2022 at 5:26 PM Marc Zyngier <maz@kernel.org> wrote:
> >
> > On Thu, 12 May 2022 14:50:05 +0100,
> > "Lad, Prabhakar" <prabhakar.csengg@gmail.com> wrote:
> > >
> > > Hi Marc,
> > >
> > > On Thu, May 12, 2022 at 2:24 PM Marc Zyngier <maz@kernel.org> wrote:
> > > >
> > > > On Thu, 12 May 2022 13:48:53 +0100,
> > > > "Lad, Prabhakar" <prabhakar.csengg@gmail.com> wrote:
> > > > >
> > > > > Hi Marc,
> > > > >
> > > > > Thank you for the review.
> > > > >
> > > > > On Thu, May 12, 2022 at 12:19 PM Marc Zyngier <maz@kernel.org> wrote:
> > > > > >
> > > > > > On Wed, 11 May 2022 19:32:08 +0100,
> > > > > > Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > > > > > >
> > > > > > > Allow free() callback to be overridden from irq_domain_ops for
> > > > > > > hierarchical chips.
> > > > > > >
> > > > > > > This allows drivers to free any resources which are allocated during
> > > > > > > populate_parent_alloc_arg().
> > > > > >
> > > > > > Do you mean more than the fwspec? I don't see this being used.
> > > > > >
> > > > > The free callback is used in patch 5/5 where free is overridden by
> > > > > rzg2l_gpio_irq_domain_free. I just gave an example there as an
> > > > > populate_parent_alloc_arg() In actual in the child_to_parent_hwirq
> > > > > callback I am using a bitmap [0] to get a free tint slot, this bitmap
> > > > > needs freeing up when the GPIO interrupt is released from the driver
> > > > > that as when overridden free callback frees the allocated tint slot so
> > > > > that its available for re-use.
> > > >
> > > > Right, so that's actually a different life-cycle, and the whole
> > > > populate_parent_alloc_arg() is a red herring. What you want is to free
> > > > resources that have been allocated via some other paths. It'd be good
> > > Is there any other path which I have missed where I can free up resources?
> >
> > No, that's the only one. It is just that usually, the alloc()
> > callback is where you are supposed to perform... allocations.
> >
> OK.
>
> > It'd be good if you could move your allocation there, as I would
> > expect calls to child_to_parent_hwirq() to be idempotent.
> >
> For now I'll go with the current implementation, as currently a an
> array is maintained which is tied with the tint slot and child (which
> is obtained from child_to_parent_hwirq)
>
> > >
> > > > if your commit message actually reflected this instead of using an
> > > > example that doesn't actually exist.
> > > >
> > > My bad, I will update the commit message.
> > >
> > > > >
> > > > > > There is also the question of why we need to have dynamic allocation
> > > > > > for the fwspec itself. Why isn't that a simple stack allocation in the
> > > > > > context of gpiochip_hierarchy_irq_domain_alloc()?
> > > > > >
> > > > > you mean gpio core itself should handle the fwspec
> > > > > allocation/freeing?
> > > >
> > > > Yes. The only reason we resort to dynamic allocation is because
> > > > ThunderX is using MSI-based GPIOs, and thus doesn't use a fwspec (no
> > > > firmware is involved here).
> > > >
> > > I see..
> > >
> > > > If we had a union of the two types, we could just have a stack
> > > > variable, and pass that along, completely sidestepping the whole
> > > > dynamic allocation/freeing business.
> > > >
> > > Right agreed.
> >
> > FWIW, I've just posted a PoC patch[1].
> >
> I guess I'll have to rebase my changes on top of it now ;)
Not yet. Let's see what people say about it.
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2022-05-12 22:24 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 18:32 [PATCH v3 0/5] Renesas RZ/G2L IRQC support Lad Prabhakar
2022-05-11 18:32 ` [PATCH v3 1/5] dt-bindings: interrupt-controller: Add Renesas RZ/G2L Interrupt Controller Lad Prabhakar
2022-05-12 6:14 ` Biju Das
2022-05-12 6:43 ` Geert Uytterhoeven
2022-05-12 17:58 ` Lad, Prabhakar
2022-05-11 18:32 ` [PATCH v3 2/5] irqchip: Add RZ/G2L IA55 Interrupt Controller driver Lad Prabhakar
2022-05-11 19:25 ` Biju Das
2022-05-12 18:01 ` Lad, Prabhakar
2022-05-12 7:05 ` Geert Uytterhoeven
2022-05-12 7:23 ` Marc Zyngier
2022-05-12 7:26 ` Geert Uytterhoeven
2022-05-12 18:08 ` Lad, Prabhakar
2022-05-11 18:32 ` [PATCH v3 3/5] gpio: gpiolib: Allow free() callback to be overridden Lad Prabhakar
2022-05-12 7:06 ` Geert Uytterhoeven
2022-05-12 11:19 ` Marc Zyngier
2022-05-12 12:48 ` Lad, Prabhakar
2022-05-12 13:24 ` Marc Zyngier
2022-05-12 13:50 ` Lad, Prabhakar
2022-05-12 16:26 ` Marc Zyngier
2022-05-12 17:55 ` Lad, Prabhakar
2022-05-12 22:24 ` Marc Zyngier [this message]
2022-05-11 18:32 ` [PATCH v3 4/5] gpio: gpiolib: Add ngirq member to struct gpio_irq_chip Lad Prabhakar
2022-05-12 7:29 ` Geert Uytterhoeven
2022-05-18 18:30 ` Lad, Prabhakar
2022-05-13 20:47 ` Linus Walleij
2022-05-18 18:36 ` Lad, Prabhakar
2022-05-19 13:21 ` Linus Walleij
2022-05-11 18:32 ` [PATCH v3 5/5] pinctrl: renesas: pinctrl-rzg2l: Add IRQ domain to handle GPIO interrupt Lad Prabhakar
2022-05-12 5:35 ` Biju Das
2022-05-12 17:43 ` Lad, Prabhakar
2022-05-12 17:59 ` Biju Das
2022-05-13 6:12 ` Biju Das
2022-05-13 13:42 ` Lad, Prabhakar
2022-05-12 7:39 ` Geert Uytterhoeven
2022-05-12 17:36 ` Lad, Prabhakar
2022-05-13 6:53 ` Geert Uytterhoeven
2022-05-13 13:55 ` Lad, Prabhakar
2022-05-13 14:29 ` Geert Uytterhoeven
2022-05-13 18:13 ` Lad, Prabhakar
2022-05-15 5:13 ` Biju Das
[not found] ` <87pmkfm0v3.wl-maz@kernel.org>
2022-05-16 7:20 ` Biju Das
[not found] ` <87pmkd6gda.wl-maz@kernel.org>
2022-05-16 8:33 ` Biju Das
[not found] ` <87o7zx6ckp.wl-maz@kernel.org>
2022-05-16 9:56 ` Biju Das
2022-05-16 7:13 ` Geert Uytterhoeven
2022-05-18 19:04 ` Lad, Prabhakar
2022-05-12 11:15 ` Marc Zyngier
2022-05-12 17:46 ` Lad, Prabhakar
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=87sfpemlt2.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=biju.das.jz@bp.renesas.com \
--cc=brgl@bgdev.pl \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=phil.edworthy@renesas.com \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh+dt@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).