linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"oleksandr.suvorov@toradex.com" <oleksandr.suvorov@toradex.com>,
	Will Deacon <will@kernel.org>, Anson Huang <anson.huang@nxp.com>,
	Jon Corbet <corbet@lwn.net>, Fabio Estevam <festevam@gmail.com>,
	Olof Johansson <olof@lixom.net>,
	Russell King <linux@armlinux.org.uk>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Andreas Kemnade <andreas@kemnade.info>,
	dl-linux-imx <linux-imx@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	John Stultz <john.stultz@linaro.org>,
	Adam Ford <aford173@gmail.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Leo Li <leoyang.li@nxp.com>, Vinod Koul <vkoul@kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
	Shawn Guo <shawnguo@kernel.org>
Subject: Re: [PATCH 1/3] gpio: mxc: Support module build
Date: Fri, 17 Jul 2020 15:02:54 +0200	[thread overview]
Message-ID: <CAK8P3a3Ds4O5yRtGSMbNN8R5dPcdb1HJTY=W5eyToFQ-UhzkBw@mail.gmail.com> (raw)
In-Reply-To: <20200717121436.GA2953399@kroah.com>

On Fri, Jul 17, 2020 at 2:16 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Jul 17, 2020 at 02:01:16PM +0200, Linus Walleij wrote:
> > While I am a big fan of the Android GKI initiative this needs to be aligned
> > with the Linux core maintainers, so let's ask Greg. I am also paging
> > John Stultz on this: he is close to this action.
> >
> > They both know the Android people very well.
> >
> > So there is a rationale like this going on: in order to achieve GKI goals
> > and have as much as possible of the Linux kernel stashed into loadable
> > kernel modules, it has been elevated to modus operandi amongst
> > the developers pushing this change that it is OK to pile up a load of
> > modules that cannot ever be unloaded.
>
> Why can't the module be unloaded?  Is it just because they never
> implement the proper "remove all resources allocated" logic in a remove
> function, or something else?

For the core kernel parts, it's usually for the lack of tracking of who
is using the resource provided by the driver, as the subsystems tend
to be written around x86's "everything is built-in" model.

For instance, a PCIe host bridge might rely on the IOMMU, a
clock controller, an interrupt controller, a pin controller and a reset
controller. The host bridge can still be probed at reduced functionality
if some of these are missing, or it can use deferred probing when
some others are missing at probe time.

If we want all of drivers to be unloaded again, we need to do one
of two things:

a) track dependencies, so that removing one of the devices
    underneath leads to everything depending on it to get removed
    as well or will be notified about it going away and can stop using
    it. This is the model used in the network subsystem, where
    any ethernet driver can be unloaded and everything using the
    device gets torn down.

b) use reference counting on the device or (at the minimum)
    try_module_get()/module_put() calls for all such resources
    so as long as the pci host bridge is there, so none of the devices
    it uses will go away when they are still used.

Traditionally, we would have considered the PCIe host bridge to
be a fundamental part of the system, implying that everything it
uses is also fundamental, and there was no need to track
usage at all, just to ensure the probing is done in the right order.

> > As a minimum requirement I would expect this to be marked by
> >
> > struct device_driver {
> >    (...)
> >     /* This module absolutely cannot be unbound */
> >    .suppress_bind_attrs = true;
> > };
>
> No, that's not what bind/unbind is really for.  That's a per-subsystem
> choice as to if you want to allow devices to be added/removed from
> drivers at runtime.  It has nothing to do with module load/unload.

It's a one-way dependency: If we can't allow the device to be
unbound, then we also should not allow module unloading because
that forces an unbind.

      Arnd

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

  parent reply	other threads:[~2020-07-17 13:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 23:25 [PATCH 1/3] gpio: mxc: Support module build Anson Huang
2020-07-07 23:25 ` [PATCH 2/3] arm64: defconfig: Build in CONFIG_GPIO_MXC by default Anson Huang
2020-07-07 23:25 ` [PATCH 3/3] ARM: imx_v6_v7_defconfig: " Anson Huang
2020-07-10 11:16   ` Andreas Kemnade
2020-07-10 13:29     ` Anson Huang
2020-07-11 21:17 ` [PATCH 1/3] gpio: mxc: Support module build Linus Walleij
2020-07-12  1:34   ` Anson Huang
2020-07-15  2:44     ` Anson Huang
2020-07-16 13:54       ` Linus Walleij
2020-07-16 14:37         ` Anson Huang
2020-07-17 12:01           ` Linus Walleij
2020-07-17 12:14             ` Greg KH
2020-07-17 12:27               ` Geert Uytterhoeven
2020-07-17 13:21                 ` Greg KH
2020-07-17 13:54                   ` Arnd Bergmann
2020-07-17 14:13                     ` Greg KH
2020-07-17 15:36                       ` Mark Brown
2020-07-17 13:02               ` Arnd Bergmann [this message]
2020-07-17 13:23                 ` Greg KH
2020-07-17 13:44               ` Linus Walleij
2020-07-21  0:04             ` John Stultz

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='CAK8P3a3Ds4O5yRtGSMbNN8R5dPcdb1HJTY=W5eyToFQ-UhzkBw@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=aford173@gmail.com \
    --cc=andreas@kemnade.info \
    --cc=anson.huang@nxp.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=john.stultz@linaro.org \
    --cc=kernel@pengutronix.de \
    --cc=leoyang.li@nxp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=oleksandr.suvorov@toradex.com \
    --cc=olof@lixom.net \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).