From: Joel Becker <Joel.Becker@oracle.com>
To: Avi Kivity <avi@redhat.com>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
Ingo Molnar <mingo@elte.hu>,
Anthony Liguori <anthony@codemonkey.ws>,
kvm@vger.kernel.org, alacrityvm-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
"Ira W. Snyder" <iws@ovro.caltech.edu>
Subject: Re: configfs/sysfs
Date: Thu, 20 Aug 2009 15:48:28 -0700 [thread overview]
Message-ID: <20090820224828.GC10558@mail.oracle.com> (raw)
In-Reply-To: <4A8CE891.2010502@redhat.com>
On Thu, Aug 20, 2009 at 09:09:21AM +0300, Avi Kivity wrote:
> On 08/20/2009 01:16 AM, Joel Becker wrote:
> > With an ioctl() that isn't (well) documented, you have to go
> >read the structure and probably even read the code that uses the
> >structure to be sure what you are doing.
>
> An ioctl structure and a configfs/sysfs readdir provide similar
> information (the structure also provides the types of fields and
> isn't able to hide some of these fields).
With an ioctl structure, I can't take a look at what the values
look like unless I read the code or write up a C program. With a
configfs file, I can just cat the thing.
> "Looking at the values" is what I meant by discouraging
> documentation. That implies looking at a self-documenting live
> system. But that tells you nothing about which fields were added in
> which versions, or fields which are hidden because your hardware
> doesn't support them or because you didn't echo 1 > somewhere.
Most ioctls don't tell you that either. It certainly won't let
you know that field foo_arg1 is ignored unless foo_arg2 is set to 2, or
things like that.
The problem of versioning requires discipline either way. It's
not obvious from many ioctls. Conversely, you can create versioned
configfs items via attributes or directories (same for sysfs, etc).
> The maintainer of the subsystem should provide a library that talks
> to the binary interface and a CLI program that talks to the library.
> Boring nonkernely work. Alternatively a fuse filesystem to talk to
> the library, or an IDL can replace the library.
Again, that helps the user nothing. I don't know it exists. I
don't have it installed. Unless it ships with the kernel, I have no
idea about it.
> Many things start oriented at people and then, if they're useful,
> cross the lines to machines. You can convert a machine interface to
> a human interface at the cost of some work, but it's difficult to
> undo the deficiencies of a human oriented interface so it can be
> used by a program.
It's work to convert either way. Outside of fast-path things,
the time it takes to strtoll() is unimportant. Don't use configfs/sysfs
for fast-path things.
> I disagree. If it's useful for a human, it's useful for a machine.
And if it's useful for a machine, a human might want to peek at
it by hand someday to debug it.
> Moreover, *fs+bash is a user interface. It happens that bash is
> good at processing files, and filesystems are easily discoverable,
> so we code to that. But we make it more difficult to provide other
> interfaces to the same controls.
Not really. Writing a sane CLI to a binary interface takes
about as much work as writing a sane API library to a text interface.
The hard part is not the conversion, in either direction. The hard part
is defining the interface.
> >Configfs, as its name implies,
> >really does exist for that second case. It turns out that it's quite
> >nice to use for the first case too, but if folks wanted to go the
> >syscall route, no worries.
>
> Eventually everything is used in the first case. For example in the
> virtualization space it is common to have a zillion nodes running
> virtual machine that are only accessed by a management node.
Everything is eventually used in the second case, and admin or a
developer debugging why the daemon is going wrong. Much easier from a
shell or other generic accessor. Much faster than having to download
your library's source, learn how to build it, add some printfs, discover
you have the wrong printfs...
> __u64 says everything about the type and space requirements of a
> field. It doesn't describe everything (like the name of the field
> or what it means) but it does provide a bunch of boring information
> that people rarely document in other ways.
>
> If my program reads a *fs field into a u32 and it later turns out
> the field was a u64, I'll get an overflow. It's a lot harder to get
> that wrong with a typed interface.
And if you send the wrong thing to configfs or sysfs you'll get
an EINVAL or the like.
It doesn't look like configfs and sysfs will work for you.
Don't use 'em! Write your interfaces with ioctls and syscalls. Write
your libraries and CLIs. In the end, you're the one who has to maintain
them. I don't ever want anyone thinking I want to force configfs on
them. I wrote it because it solves its class of problem well, and many
people find it fits them too. So I'll use configfs, you'll use ioctl,
and our users will be happy either way because we make it work!
Joel
--
Life's Little Instruction Book #396
"Never give anyone a fruitcake."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
next prev parent reply other threads:[~2009-08-20 22:50 UTC|newest]
Thread overview: 120+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-14 15:42 [PATCH v3 0/6] AlacrityVM guest drivers Gregory Haskins
2009-08-14 15:42 ` [PATCH v3 1/6] shm-signal: shared-memory signals Gregory Haskins
2009-08-14 15:43 ` [PATCH v3 2/6] ioq: Add basic definitions for a shared-memory, lockless queue Gregory Haskins
2009-08-14 15:43 ` [PATCH v3 3/6] vbus: add a "vbus-proxy" bus model for vbus_driver objects Gregory Haskins
2009-08-15 10:32 ` Ingo Molnar
2009-08-15 19:15 ` Anthony Liguori
2009-08-16 7:16 ` Ingo Molnar
2009-08-17 13:54 ` Anthony Liguori
2009-08-17 14:23 ` Ingo Molnar
2009-08-17 14:14 ` Gregory Haskins
2009-08-17 14:58 ` Avi Kivity
2009-08-17 15:05 ` Ingo Molnar
2009-08-17 17:41 ` Michael S. Tsirkin
2009-08-17 20:17 ` Gregory Haskins
2009-08-18 8:46 ` Michael S. Tsirkin
2009-08-18 15:19 ` Gregory Haskins
2009-08-18 16:25 ` Michael S. Tsirkin
2009-08-18 15:53 ` [Alacrityvm-devel] " Ira W. Snyder
2009-08-18 16:51 ` Avi Kivity
2009-08-18 17:27 ` Ira W. Snyder
2009-08-18 17:47 ` Avi Kivity
2009-08-18 18:27 ` Ira W. Snyder
2009-08-18 18:52 ` Avi Kivity
2009-08-18 20:59 ` Ira W. Snyder
2009-08-18 21:26 ` Avi Kivity
2009-08-18 22:06 ` Avi Kivity
2009-08-19 0:44 ` Ira W. Snyder
2009-08-19 5:26 ` Avi Kivity
2009-08-19 0:38 ` Ira W. Snyder
2009-08-19 5:40 ` Avi Kivity
2009-08-19 15:28 ` Ira W. Snyder
2009-08-19 15:37 ` Avi Kivity
2009-08-19 16:29 ` Ira W. Snyder
2009-08-19 16:38 ` Avi Kivity
2009-08-19 21:05 ` Hollis Blanchard
2009-08-20 9:57 ` Stefan Hajnoczi
2009-08-20 10:08 ` Avi Kivity
2009-08-18 20:35 ` Michael S. Tsirkin
2009-08-18 21:04 ` Arnd Bergmann
2009-08-18 20:39 ` Michael S. Tsirkin
2009-08-18 20:57 ` Michael S. Tsirkin
2009-08-18 23:24 ` Ira W. Snyder
2009-08-18 1:08 ` Anthony Liguori
2009-08-18 7:38 ` Avi Kivity
2009-08-18 8:54 ` Michael S. Tsirkin
2009-08-18 13:16 ` Gregory Haskins
2009-08-18 13:45 ` Avi Kivity
2009-08-18 15:51 ` Gregory Haskins
2009-08-18 16:14 ` Ingo Molnar
2009-08-19 4:27 ` Gregory Haskins
2009-08-19 5:22 ` Avi Kivity
2009-08-19 13:27 ` Gregory Haskins
2009-08-19 14:35 ` Avi Kivity
2009-08-18 16:47 ` Avi Kivity
2009-08-18 16:51 ` Michael S. Tsirkin
2009-08-19 5:36 ` Gregory Haskins
2009-08-19 5:48 ` Avi Kivity
2009-08-19 6:40 ` Gregory Haskins
2009-08-19 7:13 ` Avi Kivity
2009-08-19 11:40 ` Gregory Haskins
2009-08-19 11:49 ` Avi Kivity
2009-08-19 11:52 ` Gregory Haskins
2009-08-19 14:33 ` Michael S. Tsirkin
2009-08-20 12:12 ` Michael S. Tsirkin
2009-08-16 8:30 ` Avi Kivity
2009-08-17 14:16 ` Gregory Haskins
2009-08-17 14:59 ` Avi Kivity
2009-08-17 15:09 ` Gregory Haskins
2009-08-17 15:14 ` Ingo Molnar
2009-08-17 19:35 ` Gregory Haskins
2009-08-17 15:18 ` Avi Kivity
2009-08-17 13:02 ` Gregory Haskins
2009-08-17 14:25 ` Ingo Molnar
2009-08-17 15:05 ` Gregory Haskins
2009-08-17 15:08 ` Ingo Molnar
2009-08-17 19:33 ` Gregory Haskins
2009-08-18 8:33 ` Avi Kivity
2009-08-18 14:46 ` Gregory Haskins
2009-08-18 16:27 ` Avi Kivity
2009-08-19 6:28 ` Gregory Haskins
2009-08-19 7:11 ` Avi Kivity
2009-08-19 18:23 ` Nicholas A. Bellinger
2009-08-19 18:39 ` Gregory Haskins
2009-08-19 19:19 ` Nicholas A. Bellinger
2009-08-19 19:34 ` Nicholas A. Bellinger
2009-08-19 20:12 ` configfs/sysfs Avi Kivity
2009-08-19 20:48 ` configfs/sysfs Ingo Molnar
2009-08-19 20:53 ` configfs/sysfs Avi Kivity
2009-08-19 21:19 ` configfs/sysfs Nicholas A. Bellinger
2009-08-19 22:15 ` configfs/sysfs Gregory Haskins
2009-08-19 22:16 ` configfs/sysfs Joel Becker
2009-08-19 23:48 ` [Alacrityvm-devel] configfs/sysfs Alex Tsariounov
2009-08-19 23:54 ` configfs/sysfs Nicholas A. Bellinger
2009-08-20 6:09 ` configfs/sysfs Avi Kivity
[not found] ` <4A8CE891.2010502@redhat.com>
2009-08-20 22:48 ` Joel Becker [this message]
2009-08-21 4:14 ` configfs/sysfs Avi Kivity
2009-08-19 18:26 ` [PATCH v3 3/6] vbus: add a "vbus-proxy" bus model for vbus_driver objects Gregory Haskins
2009-08-19 20:37 ` Avi Kivity
2009-08-19 20:53 ` Ingo Molnar
2009-08-20 17:25 ` Muli Ben-Yehuda
2009-08-20 20:58 ` Caitlin Bestler
2009-08-18 18:20 ` Arnd Bergmann
2009-08-18 19:08 ` Avi Kivity
2009-08-19 5:36 ` Gregory Haskins
2009-08-18 9:53 ` Michael S. Tsirkin
2009-08-18 10:00 ` Avi Kivity
2009-08-18 10:09 ` Michael S. Tsirkin
2009-08-18 10:13 ` Avi Kivity
2009-08-18 10:28 ` Michael S. Tsirkin
2009-08-18 10:45 ` Avi Kivity
2009-08-18 11:07 ` Michael S. Tsirkin
2009-08-18 11:15 ` Avi Kivity
2009-08-18 11:49 ` Michael S. Tsirkin
2009-08-18 11:54 ` Avi Kivity
2009-08-18 15:39 ` Gregory Haskins
2009-08-18 16:39 ` Michael S. Tsirkin
2009-08-17 15:13 ` Avi Kivity
2009-08-14 15:43 ` [PATCH v3 4/6] vbus-proxy: add a pci-to-vbus bridge Gregory Haskins
2009-08-14 15:43 ` [PATCH v3 5/6] ioq: add driver-side vbus helpers Gregory Haskins
2009-08-14 15:43 ` [PATCH v3 6/6] net: Add vbus_enet driver Gregory Haskins
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=20090820224828.GC10558@mail.oracle.com \
--to=joel.becker@oracle.com \
--cc=alacrityvm-devel@lists.sourceforge.net \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=iws@ovro.caltech.edu \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mst@redhat.com \
--cc=nab@linux-iscsi.org \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).