2010-02-23 16:47:38

by Neshama Parhoti

[permalink] [raw]
Subject: sysfs vs. ioctl

hi all,

we are in the process of writing a new driver and we don't know
whether to choose a sysfs or ioctl interface to user space.

we know that sysfs is preferred, but we're concerned it will have bad
performance when compared to ioctl (our driver will have its interface
might be used many dozens of times per second, possible even more than
100 times per second).

so should we opt for ioctls if a usage is expected even every 5
miliseconds (in extreme scenarios) ?

thank you in advance for the help
~pnesh


2010-02-23 16:58:22

by Arnd Bergmann

[permalink] [raw]
Subject: Re: sysfs vs. ioctl

On Tuesday 23 February 2010, Neshama Parhoti wrote:
> we are in the process of writing a new driver and we don't know
> whether to choose a sysfs or ioctl interface to user space.
>
> we know that sysfs is preferred, but we're concerned it will have bad
> performance when compared to ioctl (our driver will have its interface
> might be used many dozens of times per second, possible even more than
> 100 times per second).
>
> so should we opt for ioctls if a usage is expected even every 5
> miliseconds (in extreme scenarios) ?

The question is not that easy to answer generally, there are many
aspects that influence what interface to use, and sysfs is not
generally slower than ioctl either.

Can you describe what your driver is doing? One rule of thumb
is that if you already require a character device, using ioctl
is the right answer, but you shouldn't create a character device
if all you want to do over it is a single ioctl operation.

Arnd

2010-02-24 05:28:47

by Neshama Parhoti

[permalink] [raw]
Subject: Re: sysfs vs. ioctl

On Tue, Feb 23, 2010 at 6:58 PM, Arnd Bergmann <[email protected]> wrote:
> One rule of thumb is that if you already require a character device, using ioctl
> is the right answer, but you shouldn't create a character device
> if all you want to do over it is a single ioctl operation.

thank you so much this really helped !

~pnesh

>
> ? ? ? ?Arnd
>