From: Eric Sesterhenn <snakebyte@gmx.de>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [Patch] use dynamic spinlock initialisation in
Date: Tue, 18 Apr 2006 17:04:19 +0000 [thread overview]
Message-ID: <1145379859.11834.5.camel@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]
hi,
according to http://lwn.net/Articles/2.6-kernel-api/ spin locks should be
initialized during runtime instead of compile time.
"Run-time initialization of spinlocks is being converted away from the
assignment form (using SPIN_LOCK_UNLOCKED) to explicit spin_lock_init()
calls. No noises have yet been made about removing SPIN_LOCK_INIT,
but the writing should be considered to be on the wall. If and when
the real-time preemption patches are merged, the assignment form
may no longer be possible."
So here is a patch to convert drivers/char/random.c to spin_lock_init()
its boot tested, i was able to generate a gpg key and work some days
without noticing anything strange.
I did not move the init into init_std_data() because it also gets called,
when the entropy pool gets cleared, so it should match the original behaviour.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.17-rc1-git5/drivers/char/random.c.orig 2006-04-12 16:02:02.000000000 +0200
+++ linux-2.6.17-rc1-git5/drivers/char/random.c 2006-04-12 16:02:41.000000000 +0200
@@ -417,7 +417,6 @@ static struct entropy_store input_pool =
.poolinfo = &poolinfo_table[0],
.name = "input",
.limit = 1,
- .lock = SPIN_LOCK_UNLOCKED,
.pool = input_pool_data
};
@@ -426,7 +425,6 @@ static struct entropy_store blocking_poo
.name = "blocking",
.limit = 1,
.pull = &input_pool,
- .lock = SPIN_LOCK_UNLOCKED,
.pool = blocking_pool_data
};
@@ -434,7 +432,6 @@ static struct entropy_store nonblocking_
.poolinfo = &poolinfo_table[1],
.name = "nonblocking",
.pull = &input_pool,
- .lock = SPIN_LOCK_UNLOCKED,
.pool = nonblocking_pool_data
};
@@ -894,6 +891,9 @@ static void init_std_data(struct entropy
static int __init rand_initialize(void)
{
+ spin_lock_init(&input_pool.lock);
+ spin_lock_init(&blocking_pool.lock);
+ spin_lock_init(&nonblocking_pool.lock);
init_std_data(&input_pool);
init_std_data(&blocking_pool);
init_std_data(&nonblocking_pool);
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
reply other threads:[~2006-04-18 17:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1145379859.11834.5.camel@localhost \
--to=snakebyte@gmx.de \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.