From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
To: rusty@au1.ibm.com
Cc: lhcs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Module Observations
Date: Fri, 2 Jan 2004 18:55:09 +0530 [thread overview]
Message-ID: <20040102185509.A18154@in.ibm.com> (raw)
Hi,
I was going thr' module code and made some observations:
1. sys_init_module drops the module_mutex semaphore
before calling mod->init() function and later
reacquires it. After reacquiring, it marks
the module state as MODULE_STATE_LIVE.
In the window when mod->init() function is running,
isn't it possible that sys_delete_module (running
on some other CPU and trying to remove the _same_ module)
acquires the module_mutex sem and marks the module
state as MODULE_STATE_GOING?
Shouldn't sys_init_module check for
that possibility when it reacquires the semaphore after
calling mod->init function?
--- module.c.org Fri Jan 2 18:37:54 2004
+++ module.c Fri Jan 2 18:38:57 2004
@@ -1750,7 +1750,8 @@
/* Now it's a first class citizen! */
down(&module_mutex);
- mod->state = MODULE_STATE_LIVE;
+ if (likely(mod->state != MODULE_STATE_GOING))
+ mod->state = MODULE_STATE_LIVE;
/* Drop initial reference. */
module_put(mod);
module_free(mod, mod->module_init);
This off-course means that you are trying to insmod and rmmod
the same module simultaneously from different CPUs and hence
may not be practical.
2. try_module_get() and module_put()
try_module_get increments the local cpu's ref count for the module
and module_put decrements it.
Is it required that the caller call both these functions from the same CPU?
Otherwise, the total refcount for the module will be non-zero!
--
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
next reply other threads:[~2004-01-02 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-02 13:25 Srivatsa Vaddagiri [this message]
2004-01-03 5:02 ` Rusty Russell
2004-03-29 15:42 ` 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=20040102185509.A18154@in.ibm.com \
--to=vatsa@in.ibm.com \
--cc=lhcs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@au1.ibm.com \
/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
Powered by JetHome