All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, kernel-team@android.com,
	Daniel Palmer <daniel@thingy.jp>,
	Romain Perier <romain.perier@gmail.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Robert Richter <rric@kernel.org>,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH] gpio: Remove dynamic allocation from populate_parent_alloc_arg()
Date: Sat, 14 May 2022 11:36:13 +0100	[thread overview]
Message-ID: <87r14wmmea.wl-maz@kernel.org> (raw)
In-Reply-To: <CACRpkdajTCS5CmQLY8hffVe1x4WzWuC_myQVGZNKV3sRzLPa=w@mail.gmail.com>

Hey Linus,

On Fri, 13 May 2022 22:24:40 +0100,
Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> On Thu, May 12, 2022 at 6:23 PM Marc Zyngier <maz@kernel.org> wrote:
> 
> > The gpiolib is unique in the way it uses intermediate fwspecs
> > when feeding an interrupt specifier to the parent domain, as it
> > relies on the populate_parent_alloc_arg() callback to perform
> > a dynamic allocation.
> >
> > THis is pretty inefficient (we free the structure almost immediately),
> > and the only reason this isn't a stack allocation is that our
> > ThunderX friend uses MSIs rather than a FW-constructed structure.
> >
> > Let's solve it by providing a new type composed of the union
> > of a struct irq_fwspec and a msi_info_t, which satisfies both
> > requirements. This allows us to use a stack allocation, and we
> > can move the handful of users to this new scheme.
> >
> > Also perform some additional cleanup, such as getting rid of the
> > stub versions of the irq_domain_translate_*cell helpers, which
> > are never used when CONFIG_IRQ_DOMAIN_HIERARCHY isn't selected.
> >
> > Tested on a Tegra186.
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > Cc: Daniel Palmer <daniel@thingy.jp>
> > Cc: Romain Perier <romain.perier@gmail.com>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Bartosz Golaszewski <brgl@bgdev.pl>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Jonathan Hunter <jonathanh@nvidia.com>
> > Cc: Robert Richter <rric@kernel.org>
> > Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> > Cc: Andy Gross <agross@kernel.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> This looks very appetizing to me but:
> 
> drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 15 ++++-----
> 
> This seems to have some changes to
> ->populate_parent_alloc_arg not even in linux-next,
> so I get confused, what are the prerequisites? (Probably
> something I already reviewed, but...)

Odd. This patch is on top of irqchip-next, which is itself already in
-next (you got me worried and I just pulled everything to check).

> Also: don't you also need to fix something in
> drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c?
> the way I remember it it was quite similar to spmi-gpio
> but I may be mistaken.

No, this one is graceful enough to use
gpiochip_populate_parent_fwspec_twocell(), which is directly provided
by gpiolib and thus addressed directly by this patch. Same thing for
the spmi-mpp version, which uses the fourcell variant.

HTH,

	M.

-- 
Without deviation from the norm, progress is not possible.

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, kernel-team@android.com,
	Daniel Palmer <daniel@thingy.jp>,
	Romain Perier <romain.perier@gmail.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Robert Richter <rric@kernel.org>,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH] gpio: Remove dynamic allocation from populate_parent_alloc_arg()
Date: Sat, 14 May 2022 11:36:13 +0100	[thread overview]
Message-ID: <87r14wmmea.wl-maz@kernel.org> (raw)
In-Reply-To: <CACRpkdajTCS5CmQLY8hffVe1x4WzWuC_myQVGZNKV3sRzLPa=w@mail.gmail.com>

Hey Linus,

On Fri, 13 May 2022 22:24:40 +0100,
Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> On Thu, May 12, 2022 at 6:23 PM Marc Zyngier <maz@kernel.org> wrote:
> 
> > The gpiolib is unique in the way it uses intermediate fwspecs
> > when feeding an interrupt specifier to the parent domain, as it
> > relies on the populate_parent_alloc_arg() callback to perform
> > a dynamic allocation.
> >
> > THis is pretty inefficient (we free the structure almost immediately),
> > and the only reason this isn't a stack allocation is that our
> > ThunderX friend uses MSIs rather than a FW-constructed structure.
> >
> > Let's solve it by providing a new type composed of the union
> > of a struct irq_fwspec and a msi_info_t, which satisfies both
> > requirements. This allows us to use a stack allocation, and we
> > can move the handful of users to this new scheme.
> >
> > Also perform some additional cleanup, such as getting rid of the
> > stub versions of the irq_domain_translate_*cell helpers, which
> > are never used when CONFIG_IRQ_DOMAIN_HIERARCHY isn't selected.
> >
> > Tested on a Tegra186.
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > Cc: Daniel Palmer <daniel@thingy.jp>
> > Cc: Romain Perier <romain.perier@gmail.com>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Bartosz Golaszewski <brgl@bgdev.pl>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Jonathan Hunter <jonathanh@nvidia.com>
> > Cc: Robert Richter <rric@kernel.org>
> > Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> > Cc: Andy Gross <agross@kernel.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> This looks very appetizing to me but:
> 
> drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 15 ++++-----
> 
> This seems to have some changes to
> ->populate_parent_alloc_arg not even in linux-next,
> so I get confused, what are the prerequisites? (Probably
> something I already reviewed, but...)

Odd. This patch is on top of irqchip-next, which is itself already in
-next (you got me worried and I just pulled everything to check).

> Also: don't you also need to fix something in
> drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c?
> the way I remember it it was quite similar to spmi-gpio
> but I may be mistaken.

No, this one is graceful enough to use
gpiochip_populate_parent_fwspec_twocell(), which is directly provided
by gpiolib and thus addressed directly by this patch. Same thing for
the spmi-mpp version, which uses the fourcell variant.

HTH,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-14 10:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 16:23 [PATCH] gpio: Remove dynamic allocation from populate_parent_alloc_arg() Marc Zyngier
2022-05-12 16:23 ` Marc Zyngier
2022-05-13 11:14 ` Daniel Palmer
2022-05-13 11:14   ` Daniel Palmer
2022-05-13 21:24 ` Linus Walleij
2022-05-13 21:24   ` Linus Walleij
2022-05-14 10:36   ` Marc Zyngier [this message]
2022-05-14 10:36     ` Marc Zyngier
2022-05-14 16:26     ` Linus Walleij
2022-05-14 16:26       ` Linus Walleij

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=87r14wmmea.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=daniel@thingy.jp \
    --cc=jonathanh@nvidia.com \
    --cc=kernel-team@android.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=romain.perier@gmail.com \
    --cc=rric@kernel.org \
    --cc=thierry.reding@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.