mbox series

[0/8] Add --wait to modprobe -r

Message ID 20220603215047.9607-1-lucas.de.marchi@gmail.com (mailing list archive)
Headers show
Series Add --wait to modprobe -r | expand

Message

Lucas De Marchi June 3, 2022, 9:50 p.m. UTC
Keep trying to remove the module if it's failing with EAGAIN. This is an
alternative to

v1: https://lore.kernel.org/linux-modules/20210803202417.462197-1-mcgrof@kernel.org/
v2: https://lore.kernel.org/linux-modules/20210810051602.3067384-1-mcgrof@kernel.org/

The v2 above or variand thereof would be probably a better way, but
unfortunately we can't poll the refcnt file in sysfs to get notified
when it reaches 0. The alternative in v1, with sleep(), uses an arbitrary
interval/maximum. It's not something I'm very  confortable to add to the
library side. So, add a quick implementation in modprobe to allow it
to remove the module and wait up until a maximum timeout. Intention is
to later migrate part of the logic in modprobe to libkmod, including for
example the holders removal recently fixed.

Lucas De Marchi (8):
  modprobe: Move -R to "Query options"
  libkmod: Allow to ignore log message on module removal
  module-playground: Add debugfs entry in mod-simple
  util: Add time-related functions from testsuite
  util: Add msec variants for time-related functions
  util: Add exponential backoff sleep
  testsuite: Add tests for sleep calculation
  modprobe: Add --wait

 libkmod/libkmod-module.c                 | 13 ++--
 libkmod/libkmod.h                        |  2 +
 man/modprobe.xml                         | 17 ++++++
 shared/util.c                            | 72 ++++++++++++++++++++++
 shared/util.h                            | 17 ++++++
 testsuite/module-playground/mod-simple.c | 18 +++++-
 testsuite/test-util.c                    | 41 +++++++++++++
 testsuite/testsuite.c                    | 14 +----
 tools/modprobe.c                         | 76 ++++++++++++++++++++----
 9 files changed, 240 insertions(+), 30 deletions(-)

Comments

Lucas De Marchi June 15, 2022, 4:31 p.m. UTC | #1
Luis, are you still interested in the --wait to modprobe? If so, could
you take a look in this series?

If there is still interest for the fs tests, I want to bring this in and
then do release. Otherwise I may just leave it for the next release when
I plan to move stuff from modprobe to the library, particularly related
to the module removal.

thanks
Lucas De Marchi

On Fri, Jun 03, 2022 at 02:50:39PM -0700, Lucas De Marchi wrote:
>Keep trying to remove the module if it's failing with EAGAIN. This is an
>alternative to
>
>v1: https://lore.kernel.org/linux-modules/20210803202417.462197-1-mcgrof@kernel.org/
>v2: https://lore.kernel.org/linux-modules/20210810051602.3067384-1-mcgrof@kernel.org/
>
>The v2 above or variand thereof would be probably a better way, but
>unfortunately we can't poll the refcnt file in sysfs to get notified
>when it reaches 0. The alternative in v1, with sleep(), uses an arbitrary
>interval/maximum. It's not something I'm very  confortable to add to the
>library side. So, add a quick implementation in modprobe to allow it
>to remove the module and wait up until a maximum timeout. Intention is
>to later migrate part of the logic in modprobe to libkmod, including for
>example the holders removal recently fixed.
>
>Lucas De Marchi (8):
>  modprobe: Move -R to "Query options"
>  libkmod: Allow to ignore log message on module removal
>  module-playground: Add debugfs entry in mod-simple
>  util: Add time-related functions from testsuite
>  util: Add msec variants for time-related functions
>  util: Add exponential backoff sleep
>  testsuite: Add tests for sleep calculation
>  modprobe: Add --wait
>
> libkmod/libkmod-module.c                 | 13 ++--
> libkmod/libkmod.h                        |  2 +
> man/modprobe.xml                         | 17 ++++++
> shared/util.c                            | 72 ++++++++++++++++++++++
> shared/util.h                            | 17 ++++++
> testsuite/module-playground/mod-simple.c | 18 +++++-
> testsuite/test-util.c                    | 41 +++++++++++++
> testsuite/testsuite.c                    | 14 +----
> tools/modprobe.c                         | 76 ++++++++++++++++++++----
> 9 files changed, 240 insertions(+), 30 deletions(-)
>
>-- 
>2.36.1
>
Lucas De Marchi June 27, 2022, 4:46 p.m. UTC | #2
On Wed, Jun 15, 2022 at 09:31:29AM -0700, Lucas De Marchi wrote:
>Luis, are you still interested in the --wait to modprobe? If so, could
>you take a look in this series?
>
>If there is still interest for the fs tests, I want to bring this in and
>then do release. Otherwise I may just leave it for the next release when
>I plan to move stuff from modprobe to the library, particularly related
>to the module removal.

I did some additional tests and pushed this as I plan to release a new
version of kmod this week. Next version we can improve and move things
to libkmod.

Lucas De Marchi