[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdbdo=Es8VU_td6S3LCVCsYpcWC=pW1SGDXEAe2Gp8uZcA@mail.gmail.com>
Date: Tue, 19 Apr 2022 23:56:17 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Marc Zyngier <maz@...nel.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>,
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 v2 00/10] gpiolib: Handle immutable irq_chip structures
On Tue, Apr 5, 2022 at 3:55 PM Marc Zyngier <maz@...nel.org> wrote:
> 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?
>
> * From v1 [1]:
> - pl061 and AMD drivers converted
> - New helpers to keep the changes small
> - New warning for non-converted drivers
> - Documentation and TODO updates
>
> [1] https://lore.kernel.org/r/20220223154405.54912-1-maz@kernel.org
>
> Marc Zyngier (10):
> gpio: Don't fiddle with irqchips marked as immutable
> gpio: Expose the gpiochip_irq_re[ql]res helpers
> gpio: Add helpers to ease the transition towards immutable irq_chip
> gpio: tegra186: Make the irqchip immutable
> gpio: pl061: Make the irqchip immutable
> pinctrl: apple-gpio: Make the irqchip immutable
> pinctrl: msmgpio: Make the irqchip immutable
> pinctrl: amd: Make the irqchip immutable
> gpio: Update TODO to mention immutable irq_chip structures
> Documentation: Update the recommended pattern for GPIO irqchips
Acked-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
Powered by blists - more mailing lists