mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Holden <aciddeath@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu
Subject: Re: BKL still required for what functions?
Date: Tue, 7 Oct 2008 11:55:27 -0600	[thread overview]
Message-ID: <786804A2-4288-46F5-82B8-3FF9B6FD196C@gmail.com> (raw)
In-Reply-To: <20081007173515.1c161dce@lxorguk.ukuu.org.uk>


On Oct 7, 2008, at 10:35 AM, Alan Cox wrote:
>
> Its never so simple - a lot of the functions it depends what data  
> you are
> using or passing to them whether they are BKL safe.
>
> Which bits use the BKL and what do you need to know is safe ?

Actually, it looks like I was looking at 2 different places, the  
simple removal is in phonedev.c that you authored, as far as I can  
tell the only thing the BKL is protecting is a call to request_module,  
it may be some nesting rules that I don't understand but I think if it  
is still needed there we could push the lock_kernel call down to the  
site of the request_module call. See patch below.

Thanks,
Richard Holden

Signed-off-by: Richard Holden <aciddeath@gmail.com>

diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
index 4d74ba3..fd1424c 100644
--- a/drivers/telephony/phonedev.c
+++ b/drivers/telephony/phonedev.c
@@ -54,14 +54,16 @@ static int phone_open(struct inode *inode, struct  
file *file)
  	if (minor >= PHONE_NUM_DEVICES)
  		return -ENODEV;

-	lock_kernel();
+	
  	mutex_lock(&phone_lock);
  	p = phone_device[minor];
  	if (p)
  		new_fops = fops_get(p->f_op);
  	if (!new_fops) {
  		mutex_unlock(&phone_lock);
+		lock_kernel();
  		request_module("char-major-%d-%d", PHONE_MAJOR, minor);
+		unlock_kernel();
  		mutex_lock(&phone_lock);
  		p = phone_device[minor];
  		if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL)
@@ -81,7 +83,6 @@ static int phone_open(struct inode *inode, struct  
file *file)
  	fops_put(old_fops);
  end:
  	mutex_unlock(&phone_lock);
-	unlock_kernel();
  	return err;
  }



  reply	other threads:[~2008-10-07 17:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-07  4:24 Richard Holden
2008-10-07  6:28 ` Andi Kleen
2008-10-07 16:35 ` Alan Cox
2008-10-07 17:55   ` Richard Holden [this message]
2008-10-07 18:14     ` Alan Cox

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=786804A2-4288-46F5-82B8-3FF9B6FD196C@gmail.com \
    --to=aciddeath@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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