From: Ingo Molnar <mingo@elte.hu>
To: Christoph Hellwig <hch@infradead.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: ioctls vs syscalls once again
Date: Fri, 21 Aug 2009 22:35:10 +0200 [thread overview]
Message-ID: <20090821203510.GB15439@elte.hu> (raw)
In-Reply-To: <20090821181823.GA29918@infradead.org>
* Christoph Hellwig <hch@infradead.org> wrote:
> [ chaged the subject and droped the cc list down as this is not
> about discard support anymore]
( it was a good example though, showing where a new ioctl gets
introduced/proposed. )
> On Fri, Aug 21, 2009 at 02:46:38PM +0200, Ingo Molnar wrote:
> > > ioctl is per defintion a multiplexer.
> >
> > Yes, and? There's two variants of multiplexing:
> >
> > - multiplex something rather straightforward and related
> > - multiplex unrelated fields, data, structures
> >
> > I consider the second one 'ugly', the first one 'ok-ish'. YMMV.
>
> Exactly. And ioctl is per defintion the latter. [...]
Just to nitpick: not necessarily. A single-purpose ioctl with no
parameter is obviously not going to multiplex anything - and we have
some (although not typical - ioctls are addictive and quickly
attract messy extensions).
( it might still be considered slightly bad style simply due to the
generic suckiness of type-opaque ioctls as an interface - but
that's another matter. )
> [...] sys_ioctl is a way to give drivers (and in Linux
> filesystem, too) a way to implement their own syscall table
> extension for file descritors they control. While there might be
> a few "ok-ish" or "nice" ioctl handlers most of them are ugly.
> That's why people don't like them too much, btw :)
Can you name a single ok-ish ioctl from the kernel source?
> > I'd like to understand the technical basis of your critisism and
> > i'd like to address any deficiencies of the perfcounters code.
> > You said you dont like the ioctl solution we have, but that
> > you'd like a separate syscall even less.
>
> I really don't like any ioctl solution very much. But sometimes
> it's the lesser of the evils, often by a bug margin.
Well if something is the best possible technical solution, how can
it be evil? (even if lesser than another evil)
That's what i dont understand about your position: i've yet to see
you react _positively_ to any perfcounters interface, be that
syscall, ioctl or any proposed imaginery API. Is there _anything_
you would react positively to? :-)
> > Perfcounters are a kernel-wide concept, encompassing 100% of all
> > Linux installations, not just some special hardware.
>
> That doesn't really matter. The tty code is also used by 100% of
> the Linux installation, and still it implements the tty controls
> as ioctls.
I consider the tty ioctls rather ugly: they have multiple demux
layers often hiding important details deep in the bowels of the Nth
level of obfuscation. The variants go into the several dozens.
But ... the ioctl interface for TTYs was really inherited as an
external compatibility constraint early on, used by a ton of
applications, so there was not much to be done about that.
Hindsight is always easy but it might have lead to a cleaner TTY
subsystem in general, had it gotten its own system calls (i mean,
controlling/setting details of terminal output and input is
certainly important enough to be raised to the level of system
calls), nicely abstracted out.
Not possible for TTY - but for new code there's no such excuse
though.
> Generally having system calls that don't operate on file
> descriptor genericly (that doesn't mean implemented everywhere,
> but beeing a generic concept dispatched through file operations)
> is pretty ugly. We have a lot of them anyway, e.g. the socket
> system calls, eventfd, inotify. They don't really buy us anything
> over ioctls, but they are accepted. So if you design a clean
> system call working on perfcounters file descriptor no one could
> have hard objection (as in actually saying no). But if you really
> just do another stupid muliplexer just go for ioctl instead of
> reinventing the dispatching and multiplexing.
Well, but that's what we have for perfcounters really: there's a
clean system call plus an ioctl that multiplexes very simple
IO-alike ops. (which borderline passes as an 'IO control' as well)
I'm trying to figure out where the boundary is - how long should we
extend the ioctls and when should we start shuffling that
functionality into new system calls (cleanly designed and done of
course).
Ingo
next prev parent reply other threads:[~2009-08-21 20:35 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-16 0:47 [PATCH, RFC] xfs: batched discard support Christoph Hellwig
2009-08-16 1:35 ` Mark Lord
2009-08-16 2:19 ` Mark Lord
2009-08-16 2:25 ` Christoph Hellwig
2009-08-16 2:49 ` Mark Lord
2009-08-16 3:25 ` Mark Lord
2009-08-16 13:00 ` Mark Lord
2009-08-16 13:53 ` Christoph Hellwig
2009-08-16 13:59 ` Mark Lord
2009-08-16 14:06 ` Mark Lord
2009-08-16 14:23 ` Christoph Hellwig
2009-08-16 14:26 ` Mark Lord
2009-08-19 20:39 ` Ingo Molnar
2009-08-20 1:05 ` Christoph Hellwig
2009-08-20 1:10 ` Jamie Lokier
2009-08-20 1:38 ` Douglas Gilbert
2009-08-20 1:38 ` Mark Lord
2009-08-21 12:46 ` Ingo Molnar
2009-08-21 18:18 ` ioctls vs syscalls once again Christoph Hellwig
2009-08-21 20:35 ` Ingo Molnar [this message]
2009-08-20 1:39 ` [PATCH, RFC] xfs: batched discard support Mark Lord
2009-08-20 13:48 ` Ric Wheeler
2009-08-20 14:38 ` Mark Lord
2009-08-20 14:42 ` Ric Wheeler
2009-08-20 17:19 ` Greg Freemyer
2009-08-20 14:42 ` James Bottomley
2009-08-20 15:43 ` Rolf Eike Beer
2009-08-20 17:00 ` Ric Wheeler
2009-08-20 14:58 ` Douglas Gilbert
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=20090821203510.GB15439@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=torvalds@linux-foundation.org \
/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®