[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1200049691.3844.44.camel@nikanth-laptop.blr.novell.com>
Date: Fri, 11 Jan 2008 16:38:11 +0530
From: Nikanth Karthikesan <knikanth@...e.de>
To: linux-kernel@...r.kernel.org, mpm@...enic.com
Subject: Query on lock protection in random number driver
A query on locks used to protect entropy_store
struct entropy_store {
/* mostly-read data: */
struct poolinfo *poolinfo;
__u32 *pool;
const char *name;
int limit;
struct entropy_store *pull;
/* read-write data: */
spinlock_t lock ____cacheline_aligned_in_smp;
unsigned add_ptr;
int entropy_count;
int input_rotate;
};
Is this lock meant to protect all the data within the structure?
The lock is being taken whenever entropy_count is modified, but it is
not so when it is read, see random_poll(), random_read(). Either it
should be lock protected or made as atomic_t, right?
Also the globals random_read_wakeup_thresh and
random_write_wakeup_thresh are not at all protected by any locks! Why
locks are not needed for these?
Sorry, if that was a stupid question.
Thanks
Nikanth Karthikesan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists