From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Rusty Russell <rusty@rustcorp.com.au>,
Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-modules@vger.kernel.org,
Josh Poimboeuf <jpoimboe@redhat.com>
Subject: [RFC PATCH 1/2] libkmod: support lockup module option
Date: Tue, 26 Aug 2014 12:04:49 +0000 [thread overview]
Message-ID: <20140826120449.8223.6053.stgit@kbuild-fedora.novalocal> (raw)
In-Reply-To: <20140826120442.8223.80618.stgit@kbuild-fedora.novalocal>
Add lockup option support to load an unloadable module.
Since unloadable module is not removed normally, module refcounting
is skipped. That will improve multi-core scalability on big machine.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
libkmod/libkmod-module.c | 3 +++
libkmod/libkmod.h | 4 +++-
libkmod/missing.h | 4 ++++
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index b81b451..557e637 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -789,6 +789,7 @@ extern long init_module(const void *mem, unsigned long len, const char *args);
* behavior of this function, valid flags are
* KMOD_INSERT_FORCE_VERMAGIC: ignore kernel version magic;
* KMOD_INSERT_FORCE_MODVERSION: ignore symbol version hashes.
+ * KMOD_INSERT_LOCKUP_MODULE: make module unloadable.
* @options: module's options to pass to Linux Kernel.
*
* Insert a module in Linux kernel. It opens the file pointed by @mod,
@@ -830,6 +831,8 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
kernel_flags |= MODULE_INIT_IGNORE_VERMAGIC;
if (flags & KMOD_INSERT_FORCE_MODVERSION)
kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS;
+ if (flags & KMOD_INSERT_LOCKUP_MODULE)
+ kernel_flags |= MODULE_INIT_LOCKUP;
err = finit_module(kmod_file_get_fd(mod->file), args, kernel_flags);
if (err == 0 || errno != ENOSYS)
diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
index a7ea221..69a3237 100644
--- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h
@@ -143,10 +143,11 @@ enum kmod_remove {
KMOD_REMOVE_NOWAIT = O_NONBLOCK, /* always set */
};
-/* Insertion flags */
+/* Insertion flags: must be same as KMOD_PROBE_* */
enum kmod_insert {
KMOD_INSERT_FORCE_VERMAGIC = 0x1,
KMOD_INSERT_FORCE_MODVERSION = 0x2,
+ KMOD_INSERT_LOCKUP_MODULE = 0x40,
};
/* Flags to kmod_module_probe_insert_module() */
@@ -157,6 +158,7 @@ enum kmod_probe {
KMOD_PROBE_IGNORE_LOADED = 0x00008,
KMOD_PROBE_DRY_RUN = 0x00010,
KMOD_PROBE_FAIL_ON_LOADED = 0x00020,
+ KMOD_PROBE_LOCKUP_MODULE = 0x00040,
/* codes below can be used in return value, too */
KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000,
diff --git a/libkmod/missing.h b/libkmod/missing.h
index 8d47af8..c38f588 100644
--- a/libkmod/missing.h
+++ b/libkmod/missing.h
@@ -15,6 +15,10 @@
# define MODULE_INIT_IGNORE_VERMAGIC 2
#endif
+#ifndef MODULE_INIT_LOCKUP
+# define MODULE_INIT_LOCKUP 4
+#endif
+
#ifndef __NR_finit_module
# define __NR_finit_module -1
#endif
next prev parent reply other threads:[~2014-08-26 12:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140825105520.21089.26870.stgit@kbuild-fedora.novalocal>
[not found] ` <20140825105548.21089.42883.stgit@kbuild-fedora.novalocal>
2014-08-26 5:30 ` [RFC PATCH 4/5] module: Lock up a module when loading with a LOCLUP flag Lucas De Marchi
2014-08-26 9:26 ` Masami Hiramatsu
2014-08-26 12:04 ` [RFC PATCH 0/2] kmod: Support lockup option to make module un-removable Masami Hiramatsu
2014-08-26 12:04 ` Masami Hiramatsu [this message]
2014-08-26 12:04 ` [RFC PATCH 2/2] modprobe: Add --lockup option to make module unremovable Masami Hiramatsu
2014-09-01 22:17 ` [RFC PATCH 0/2] kmod: Support lockup option to make module un-removable Lucas De Marchi
2014-10-13 4:41 ` Rusty Russell
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=20140826120449.8223.6053.stgit@kbuild-fedora.novalocal \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=rusty@rustcorp.com.au \
/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