From: Greg KH <gregkh@linuxfoundation.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Christian Brauner <brauner@kernel.org>,
Miklos Szeredi <mszeredi@redhat.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Linux API <linux-api@vger.kernel.org>,
linux-man <linux-man@vger.kernel.org>,
LSM <linux-security-module@vger.kernel.org>,
Karel Zak <kzak@redhat.com>, Ian Kent <raven@themaw.net>,
David Howells <dhowells@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <christian@brauner.io>,
Amir Goldstein <amir73il@gmail.com>,
James Bottomley <James.Bottomley@hansenpartnership.com>
Subject: Re: [RFC PATCH] getvalues(2) prototype
Date: Wed, 23 Mar 2022 14:38:07 +0100 [thread overview]
Message-ID: <Yjsiv2XesJRzoeTW@kroah.com> (raw)
In-Reply-To: <CAJfpegsCKEx41KA1S2QJ9gX9BEBG4_d8igA0DT66GFH2ZanspA@mail.gmail.com>
On Wed, Mar 23, 2022 at 02:24:40PM +0100, Miklos Szeredi wrote:
> On Wed, 23 Mar 2022 at 12:43, Christian Brauner <brauner@kernel.org> wrote:
>
> > Yes, we really need a way to query for various fs information. I'm a bit
> > torn about the details of this interface though. I would really like if
> > we had interfaces that are really easy to use from userspace comparable
> > to statx for example.
>
> The reason I stated thinking about this is that Amir wanted a per-sb
> iostat interface and dumped it into /proc/PID/mountstats. And that is
> definitely not the right way to go about this.
>
> So we could add a statfsx() and start filling in new stuff, and that's
> what Linus suggested. But then we might need to add stuff that is not
> representable in a flat structure (like for example the stuff that
> nfs_show_stats does) and that again needs new infrastructure.
>
> Another example is task info in /proc. Utilities are doing a crazy
> number of syscalls to get trivial information. Why don't we have a
> procx(2) syscall? I guess because lots of that is difficult to
> represent in a flat structure. Just take the lsof example: tt's doing
> hundreds of thousands of syscalls on a desktop computer with just a
> few hundred processes.
>
> So I'm trying to look beyond fsinfo and about how we could better
> retrieve attributes, statistics, small bits and pieces within a
> unified framework.
>
> The ease of use argument does not really come into the picture here,
> because (unlike stat and friends) most of this info is specialized and
> will be either consumed by libraries, specialized utilities
> (util-linux, procos) or with a generic utility application that can
> query any information about anything that is exported through such an
> interface. That applies to plain stat(2) as well: most users will
> not switch to statx() simply because that's too generic. And that's
> fine, for info as common as struct stat a syscall is warranted. If
> the info is more specialized, then I think a truly generic interface
> is a much better choice.
>
> > I know having this generic as possible was the
> > goal but I'm just a bit uneasy with such interfaces. They become
> > cumbersome to use in userspace. I'm not sure if the data: part for
> > example should be in this at all. That seems a bit out of place to me.
>
> Good point, reduction of scope may help.
>
> > Would it be really that bad if we added multiple syscalls for different
> > types of info? For example, querying mount information could reasonably
> > be a more focussed separate system call allowing to retrieve detailed
> > mount propagation info, flags, idmappings and so on. Prior approaches to
> > solve this in a completely generic way have gotten us not very far too
> > so I'm a bit worried about this aspect too.
>
> And I fear that this will just result in more and more ad-hoc
> interfaces being added, because a new feature didn't quite fit the old
> API. You can see the history of this happening all over the place
> with multiple new syscall versions being added as the old one turns
> out to be not generic enough.
>
> I think a new interface needs to
>
> - be uniform (a single utility can be used to retrieve various
> attributes and statistics, contrast this with e.g. stat(1),
> getfattr(1), lsattr(1) not to mention various fs specific tools).
>
> - have a hierarchical namespace (the unix path lookup is an example
> of this that stood the test of time)
>
> - allow retrieving arbitrary text or binary data
>
> And whatever form it takes, I'm sure it will be easier to use than the
> mess we currently have in various interfaces like the mount or process
> stats.
This has been proposed in the past a few times. Most recently by the
KVM developers, which tried to create a "generic" api, but ended up just
making something to work for KVM as they got tired of people ignoring
their more intrusive patch sets. See virt/kvm/binary_stats.c for what
they ended up with, and perhaps you can just use that same type of
interface here as well?
thanks,
greg k-h
next prev parent reply other threads:[~2022-03-23 13:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 19:27 [RFC PATCH] getvalues(2) prototype Miklos Szeredi
2022-03-22 19:30 ` Miklos Szeredi
2022-03-22 20:36 ` Casey Schaufler
2022-03-22 20:53 ` Casey Schaufler
2022-03-23 7:14 ` Greg KH
2022-03-23 7:16 ` Greg KH
2022-03-23 10:26 ` Bernd Schubert
2022-03-23 11:42 ` Greg KH
2022-03-23 12:06 ` Bernd Schubert
2022-03-23 12:13 ` Greg KH
2022-03-23 19:29 ` J. Bruce Fields
2022-03-23 11:42 ` Christian Brauner
2022-03-23 13:24 ` Miklos Szeredi
2022-03-23 13:38 ` Greg KH [this message]
2022-03-23 15:23 ` Miklos Szeredi
2022-03-24 6:56 ` Greg KH
2022-03-23 13:51 ` Casey Schaufler
2022-03-23 14:00 ` Miklos Szeredi
2022-03-23 22:39 ` Casey Schaufler
2022-03-23 22:19 ` Theodore Ts'o
2022-03-24 6:34 ` Christoph Hellwig
2022-03-24 8:44 ` Miklos Szeredi
2022-03-24 16:15 ` Eric W. Biederman
2022-03-25 8:46 ` Karel Zak
2022-03-25 8:54 ` Greg KH
2022-03-25 9:25 ` Karel Zak
2022-03-26 4:19 ` Theodore Ts'o
2022-03-25 18:40 ` Linus Torvalds
2022-03-25 11:02 ` Cyril Hrubis
2022-03-23 22:58 ` Dave Chinner
2022-03-23 23:17 ` Casey Schaufler
2022-03-24 8:57 ` Miklos Szeredi
2022-03-24 10:34 ` Amir Goldstein
2022-03-24 20:31 ` Dave Chinner
2022-03-25 9:10 ` Karel Zak
2022-03-25 16:42 ` Trond Myklebust
2022-03-27 21:03 ` Dave Chinner
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=Yjsiv2XesJRzoeTW@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=kzak@redhat.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mszeredi@redhat.com \
--cc=raven@themaw.net \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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