Linux Modules
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.de.marchi@gmail.com>
To: linux-modules@vger.kernel.org
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
Subject: [PATCH 0/8] Add --wait to modprobe -r
Date: Fri,  3 Jun 2022 14:50:39 -0700	[thread overview]
Message-ID: <20220603215047.9607-1-lucas.de.marchi@gmail.com> (raw)

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


             reply	other threads:[~2022-06-03 21:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 21:50 Lucas De Marchi [this message]
2022-06-03 21:50 ` [PATCH 1/8] modprobe: Move -R to "Query options" Lucas De Marchi
2022-06-03 21:50 ` [PATCH 2/8] libkmod: Allow to ignore log message on module removal Lucas De Marchi
2022-06-03 21:50 ` [PATCH 3/8] module-playground: Add debugfs entry in mod-simple Lucas De Marchi
2022-06-03 21:50 ` [PATCH 4/8] util: Add time-related functions from testsuite Lucas De Marchi
2022-06-03 21:50 ` [PATCH 5/8] util: Add msec variants for time-related functions Lucas De Marchi
2022-06-03 21:50 ` [PATCH 6/8] util: Add exponential backoff sleep Lucas De Marchi
2022-06-03 21:50 ` [PATCH 7/8] testsuite: Add tests for sleep calculation Lucas De Marchi
2022-06-03 21:50 ` [PATCH 8/8] modprobe: Add --wait Lucas De Marchi
2022-06-15 16:31 ` [PATCH 0/8] Add --wait to modprobe -r Lucas De Marchi
2022-06-27 16:46   ` Lucas De Marchi

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=20220603215047.9607-1-lucas.de.marchi@gmail.com \
    --to=lucas.de.marchi@gmail.com \
    --cc=linux-modules@vger.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