[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874k2kccse.wl-maz@kernel.org>
Date: Sat, 23 Apr 2022 11:30:25 +0100
From: Marc Zyngier <maz@...nel.org>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: linux-kernel@...r.kernel.org, Bartosz Golaszewski <brgl@...ev.pl>,
Thierry Reding <thierry.reding@...il.com>,
Joey Gouly <joey.gouly@....com>,
Jonathan Hunter <jonathanh@...dia.com>,
Hector Martin <marcan@...can.st>,
Sven Peter <sven@...npeter.dev>,
Alyssa Rosenzweig <alyssa@...enzweig.io>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Andy Gross <agross@...nel.org>,
Jeffrey Hugo <jeffrey.l.hugo@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Basavaraj Natikar <Basavaraj.Natikar@....com>,
Shyam Sundar S K <Shyam-sundar.S-k@....com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
linux-gpio@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v3 00/10] gpiolib: Handle immutable irq_chip structures
On Fri, 22 Apr 2022 22:24:22 +0100,
Linus Walleij <linus.walleij@...aro.org> wrote:
>
> On Tue, Apr 19, 2022 at 4:19 PM Marc Zyngier <maz@...nel.org> wrote:
>
> > This is a followup from [2].
> >
> > I recently realised that the gpiolib play ugly tricks on the
> > unsuspecting irq_chip structures by patching the callbacks.
> >
> > Not only this breaks when an irq_chip structure is made const (which
> > really should be the default case), but it also forces this structure
> > to be copied at nauseam for each instance of the GPIO block, which is
> > a waste of memory.
> >
> > My current approach is to add a new irq_chip flag (IRQCHIP_IMMUTABLE)
> > which does what it says on the tin: don't you dare writing to them.
> > Gpiolib is further updated not to install its own callbacks, and it
> > becomes the responsibility of the driver to call into the gpiolib when
> > required. This is similar to what we do for other subsystems such as
> > PCI-MSI.
> >
> > 5 drivers are updated to this new model: M1, QC, Tegra, pl061 and AMD
> > (as I actively use them) keeping a single irq_chip structure, marking
> > it const, and exposing the new flag.
> >
> > Nothing breaks, the volume of change is small, the memory usage goes
> > down and we have fewer callbacks that can be used as attack vectors.
> > What's not to love?
> >
> > Since there wasn't any objection in the previous round of review, I'm
> > going to take this series into -next to see if anything breaks at
> > scale.
>
> The series:
> Acked-by: Linus Walleij <linus.walleij@...aro.org>
>
> Bartosz: if you're happy with this can you apply it to an immutable branch
> from v5.18-rc1 and merge that into the GPIO for-next and then I can also
> pull that into pinctrl?
For what it is worth, I've pushed this branch into irqchip-next.
You can pick it up from:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=irq/gpio-immutable
but I can also drop it from the irqchip tree.
Just let me know.
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists