From: Rusty Russell <rusty@rustcorp.com.au>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>,
Jon Masters <jonathan@jonmasters.org>
Subject: module: test code for waiting.
Date: Fri, 14 Sep 2012 16:42:17 +0930 [thread overview]
Message-ID: <87ipbhrsby.fsf@rustcorp.com.au> (raw)
In-Reply-To: <87obl9rsg2.fsf@rustcorp.com.au>
From: Rusty Russell <rusty@rustcorp.com.au>
Subject: module: dummy module to test loading race.
---
kernel/Makefile | 1 +
kernel/test-mod.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/kernel/Makefile b/kernel/Makefile
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -131,3 +131,4 @@ quiet_cmd_timeconst = TIMEC $@
targets += timeconst.h
$(obj)/timeconst.h: $(src)/timeconst.pl FORCE
$(call if_changed,timeconst)
+obj-m += test-mod.o
diff --git a/kernel/test-mod.c b/kernel/test-mod.c
new file mode 100644
--- /dev/null
+++ b/kernel/test-mod.c
@@ -0,0 +1,21 @@
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/delay.h>
+
+static bool fail;
+module_param(fail, bool, 0644);
+
+int init(void)
+{
+ printk("Module %p init start...\n", THIS_MODULE);
+ ssleep(10);
+ printk("...%p init %s\n", THIS_MODULE, fail ? "fail" : "succeed");
+ return fail ? -EINVAL : 0;
+}
+
+void fini(void)
+{
+}
+
+module_init(init);
+module_exit(fini);
next prev parent reply other threads:[~2012-09-14 7:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-14 7:09 [PATCH 1/2] module: fix symbol waiting when module fails before init Rusty Russell
2012-09-14 7:11 ` [PATCH 2/2] module: wait when loading a module which is currently initializing Rusty Russell
2012-09-14 16:37 ` Lucas De Marchi
2012-09-17 4:36 ` Rusty Russell
2012-09-17 17:37 ` Lucas De Marchi
2012-09-14 7:12 ` Rusty Russell [this message]
2012-09-14 16:41 ` [PATCH 1/2] module: fix symbol waiting when module fails before init 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=87ipbhrsby.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=jonathan@jonmasters.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@profusion.mobi \
/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).