From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Jonathan Corbet <corbet@lwn.net>, linux1394-devel@lists.sourceforge.net
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Alexander Viro <viro@ftp.linux.org.uk>,
linux-kernel@vger.kernel.org,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH, RFC] Char dev BKL pushdown v2
Date: Mon, 19 May 2008 22:07:28 +0200 (CEST) [thread overview]
Message-ID: <tkrat.4b36f75b3b22c54c@s5r6.in-berlin.de> (raw)
In-Reply-To: <4831D484.10505@s5r6.in-berlin.de>
On 19 May, Stefan Richter wrote at LKML:
> I wrote:
>> Jonathan Corbet wrote:
>>> drivers/ieee1394/dv1394.c | 6 +++-
>>> drivers/ieee1394/raw1394.c | 3 ++
>>> drivers/ieee1394/video1394.c | 18 +++++++++---
>> ...
>>> ieee1394: cdev lock_kernel() pushdown
>>
>> I have yet to look at these drivers in detail whether they need BKL or
>> not. They likely don't.
>
> video1394 needs it to serialize module init vs. open. The race
> condition there can be prevented by splitting hpsb_register_highlevel()
> into an _init and a _register function. I will follow up with a patch.
>
> dv1394 and raw1394 do not need the BKL in their open() methods AFAICS.
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: ieee1394: video1394: reorder module init, prepare BKL removal
This prepares video1394 for removal of the BKL (big kernel lock):
It allows video1394_open() to be called while video1394_init_module()
is still in progress.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/ieee1394/highlevel.c | 4 +---
drivers/ieee1394/highlevel.h | 13 ++++++++++++-
drivers/ieee1394/video1394.c | 2 ++
3 files changed, 15 insertions(+), 4 deletions(-)
Index: linux/drivers/ieee1394/highlevel.c
===================================================================
--- linux.orig/drivers/ieee1394/highlevel.c
+++ linux/drivers/ieee1394/highlevel.c
@@ -228,10 +228,8 @@ void hpsb_register_highlevel(struct hpsb
{
unsigned long flags;
+ hpsb_init_highlevel(hl);
INIT_LIST_HEAD(&hl->addr_list);
- INIT_LIST_HEAD(&hl->host_info_list);
-
- rwlock_init(&hl->host_info_lock);
down_write(&hl_drivers_sem);
list_add_tail(&hl->hl_list, &hl_drivers);
Index: linux/drivers/ieee1394/highlevel.h
===================================================================
--- linux.orig/drivers/ieee1394/highlevel.h
+++ linux/drivers/ieee1394/highlevel.h
@@ -2,7 +2,7 @@
#define IEEE1394_HIGHLEVEL_H
#include <linux/list.h>
-#include <linux/spinlock_types.h>
+#include <linux/spinlock.h>
#include <linux/types.h>
struct module;
@@ -103,6 +103,17 @@ int highlevel_lock64(struct hpsb_host *h
void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
void *data, size_t length);
+/**
+ * hpsb_init_highlevel - initialize a struct hpsb_highlevel
+ *
+ * This is only necessary if hpsb_get_hostinfo_bykey can be called
+ * before hpsb_register_highlevel.
+ */
+static inline void hpsb_init_highlevel(struct hpsb_highlevel *hl)
+{
+ rwlock_init(&hl->host_info_lock);
+ INIT_LIST_HEAD(&hl->host_info_list);
+}
void hpsb_register_highlevel(struct hpsb_highlevel *hl);
void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
Index: linux/drivers/ieee1394/video1394.c
===================================================================
--- linux.orig/drivers/ieee1394/video1394.c
+++ linux/drivers/ieee1394/video1394.c
@@ -1503,6 +1503,8 @@ static int __init video1394_init_module
{
int ret;
+ hpsb_init_highlevel(&video1394_highlevel);
+
cdev_init(&video1394_cdev, &video1394_fops);
video1394_cdev.owner = THIS_MODULE;
ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
--
Stefan Richter
-=====-==--- -=-= =--==
http://arcgraph.de/sr/
prev parent reply other threads:[~2008-05-19 20:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-18 22:15 Jonathan Corbet
2008-05-19 4:00 ` Roland Dreier
2008-05-19 13:37 ` Jonathan Corbet
2008-05-19 20:38 ` Roland Dreier
2008-05-19 20:42 ` Jonathan Corbet
2008-05-19 22:18 ` Roland Dreier
2008-05-19 22:56 ` Jonathan Corbet
2008-05-20 2:10 ` Jeff Dike
2008-05-20 8:26 ` Alan Cox
2008-05-19 4:03 ` Stephen Rothwell
2008-05-19 13:46 ` Jonathan Corbet
2008-05-19 13:17 ` Ingo Molnar
2008-05-19 17:46 ` Stefan Richter
2008-05-19 19:27 ` Stefan Richter
2008-05-19 20:07 ` Stefan Richter [this message]
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=tkrat.4b36f75b3b22c54c@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=mingo@elte.hu \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
/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
all inboxes | Powered by JetHome®