All of lore.kernel.org
 help / color / mirror / Atom feed
* unlocked_ioctl explanation
@ 2011-05-18  3:23 Ezequiel García
  2011-05-18  6:20 ` Dave Hylands
  0 siblings, 1 reply; 4+ messages in thread
From: Ezequiel García @ 2011-05-18  3:23 UTC (permalink / raw)
  To: kernelnewbies

I am aware that ioctl has been superseeded by unlocked_ioctl. I've been looking through patches and this seems to be BKL related.

Could someone explain further the differences and reasons for the new ioctl prototype and name?

I guess 'unlocked' means BKL is no longer held inside ioctl, right? 

What precautions should we take when using unlocked_ioctl ?

Greetings,
Ezequiel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110517/c5eeba97/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* unlocked_ioctl explanation
  2011-05-18  3:23 unlocked_ioctl explanation Ezequiel García
@ 2011-05-18  6:20 ` Dave Hylands
  2011-05-19 17:53   ` Ezequiel García
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Hylands @ 2011-05-18  6:20 UTC (permalink / raw)
  To: kernelnewbies

Hi Ezequiel,

2011/5/17 Ezequiel Garc?a <elezegarcia@yahoo.com.ar>
>
> I am aware that ioctl has been superseeded by unlocked_ioctl. I've been looking through patches and this seems to be BKL related.
>
> Could someone explain further the differences and reasons for the new ioctl prototype and name?
>
> I guess 'unlocked' means BKL is no longer held inside ioctl, right?

Exaclty.

> What precautions should we take when using unlocked_ioctl ?

Well, since there is no BKL, your ioctl can get preempted by another
process and that other process just might happen to make an ioctl call
to your driver.

So your driver has to protect itself from being called by 2 threads
simultaneously, if that's a problem.

Some drivers won't need any extra protection. Unfortunately, it really
depends on exactly what your driver code does.

--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* unlocked_ioctl explanation
  2011-05-18  6:20 ` Dave Hylands
@ 2011-05-19 17:53   ` Ezequiel García
  2011-05-19 19:11     ` Daniel Baluta
  0 siblings, 1 reply; 4+ messages in thread
From: Ezequiel García @ 2011-05-19 17:53 UTC (permalink / raw)
  To: kernelnewbies

Thanks Dave for your answer. I guess the same question has been answered several times before. For the interest reader, I've found these:

http://unix.stackexchange.com/questions/4711/what-is-the-difference-between-ioctl-unlocked-ioctl-and-compat-ioctl

http://lwn.net/Articles/119652/

http://www.mail-archive.com/kernelnewbies at nl.linux.org/msg00269.html

I have a remaining question, though. In the lwn article I read this:

"The ioctl() system call has long been out of favor among the
kernel developers, who see it as a completely uncontrolled entry point into
the kernel".

Is this pointing that ioctl() is planning to get removed from the kernel ? In that case what's the currently preferred mechanism for giving 'control commands' to device drivers ?

Thanks again and greetings,
Ezequiel.

--- El mi? 18-may-11, Dave Hylands <dhylands@gmail.com> escribi?:

De: Dave Hylands <dhylands@gmail.com>
Asunto: Re: unlocked_ioctl explanation
Para: "Ezequiel Garc?a" <elezegarcia@yahoo.com.ar>
Cc: kernelnewbies at kernelnewbies.org
Fecha: mi?rcoles, 18 de mayo de 2011, 3:20

Hi Ezequiel,

2011/5/17 Ezequiel Garc?a <elezegarcia@yahoo.com.ar>
>
> I am aware that ioctl has been superseeded by unlocked_ioctl. I've been looking through patches and this seems to be BKL related.
>
> Could someone explain further the differences and reasons for the new ioctl prototype and name?
>
> I guess 'unlocked' means BKL is no longer held inside ioctl, right?

Exaclty.

> What precautions should we take when using unlocked_ioctl ?

Well, since there is no BKL, your ioctl can get preempted by another
process and that other process just might happen to make an ioctl call
to your driver.

So your driver has to protect itself from being called by 2 threads
simultaneously, if that's a problem.

Some drivers won't need any extra protection. Unfortunately, it really
depends on exactly what your driver code does.

--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110519/4d8baec5/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* unlocked_ioctl explanation
  2011-05-19 17:53   ` Ezequiel García
@ 2011-05-19 19:11     ` Daniel Baluta
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2011-05-19 19:11 UTC (permalink / raw)
  To: kernelnewbies

2011/5/19 Ezequiel Garc?a <elezegarcia@yahoo.com.ar>
>
> Thanks Dave for your answer. I guess the same question has been answered several times before. For the interest reader, I've found these:
>
> http://unix.stackexchange.com/questions/4711/what-is-the-difference-between-ioctl-unlocked-ioctl-and-compat-ioctl
>
> http://lwn.net/Articles/119652/
>
> http://www.mail-archive.com/kernelnewbies at nl.linux.org/msg00269.html
>
> I have a remaining question, though. In the lwn article I read this:
>
> "The ioctl() system call has long been out of favor among the kernel developers, who see it as a completely uncontrolled entry point into the kernel".
>
> Is this pointing that ioctl() is planning to get removed from the kernel ? In that case what's the currently preferred mechanism for giving 'control commands' to device drivers ?

I would bet for 'sysfs'.

thanks,
Daniel.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-19 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18  3:23 unlocked_ioctl explanation Ezequiel García
2011-05-18  6:20 ` Dave Hylands
2011-05-19 17:53   ` Ezequiel García
2011-05-19 19:11     ` Daniel Baluta

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.