All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH 2/2] nvmem: expose NVMEM cells in sysfs
Date: Tue, 21 Dec 2021 15:27:23 +0100	[thread overview]
Message-ID: <YcHkS0iDUhplbqUc@kroah.com> (raw)
In-Reply-To: <d626c2c2-5071-522f-330f-688254087d74@gmail.com>

On Tue, Dec 21, 2021 at 02:52:05PM +0100, Rafał Miłecki wrote:
> > How are nvmem devices named?
> 
> $ ls /sys/bus/nvmem/devices/
> brcm-nvram0
> mtd0
> mtd1
> u-boot-envvar0

So no naming scheme at all.

{sigh}

> > > Example:
> > > $ cat /sys/bus/nvmem/devices/foo/cells/bootcmd
> > > tftp
> > > $ cat /sys/bus/nvmem/devices/foo/cells/bootdelay
> > > 5
> > > 
> > > As you can see above NVMEM cells are not known at compilation time.
> > 
> > Why do you want to expose these in a way that forces the kernel to parse
> > these key/value pairs?  Why not just do it all in userspace like you can
> > today?  What forces the kernel to do it and not a perl script?
> > 
> > > So I believe the question is: how can I expose cells in sysfs?
> > 
> > You can do this by dynamically creating the attributes on the fly, but
> > your show function is going to be rough and it's not going to be simple
> > to do so.  One example will be the code that creates the
> > /sys/devices/system/machinecheck/machinecheckXX/bank* files.
> > 
> > But I will push back again, why not just do it all in userspace?  What
> > userspace tool is requiring the kernel to do this work for it?
> 
> Environment data contains info that may be required by kernel.
> 
> For example some home routers store two firmwares on flash. Kernel needs
> to read index of currently booted firmware to make sure MTD subsystem
> creates partitions correctly.

You are talking about a kernel<->kernel api here, that's not what sysfs
is for at all.

> Another example: MAC address. Ethernet subsystem supports reading MAC
> from NVMEM cell.

Again, internal kernel api, nothing sysfs is ever involved in.

> One could argue those tasks could be handled from userspace but that
> would get tricky. Sure - we have API for setting MAC address. However
> other cases (like setting active firmware partition and asking MTD to
> parse it into subpartitions) would require new user <-> kernel
> interfaces.

Ok, but again, sysfs is for userspace to get access to these values.
That's what I'm concerned about.  If you want to make an in-kernel api
for other subsystems to get these key/value pairs, wonderful, that has
nothing to do with sysfs.

So I ask again, why do you want to expose these to userspace through
sysfs in a new format from what you have today.  Who is going to use
that information and what is it going to be used for.

thanks,

greg k-h

  reply	other threads:[~2021-12-21 15:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20  6:47 [PATCH 1/2] sysfs: add sysfs_add_bin_file_to_group() Rafał Miłecki
2021-12-20  6:47 ` [PATCH 2/2] nvmem: expose NVMEM cells in sysfs Rafał Miłecki
2021-12-20  8:00   ` Greg Kroah-Hartman
2021-12-20 20:39     ` Rafał Miłecki
2021-12-21  6:33       ` Greg Kroah-Hartman
2021-12-21  6:39         ` Rafał Miłecki
2021-12-21  6:45           ` Greg Kroah-Hartman
2021-12-21  6:53             ` Rafał Miłecki
2021-12-21  7:13               ` Greg Kroah-Hartman
2021-12-21 12:24                 ` Rafał Miłecki
2021-12-21 12:56                   ` Greg Kroah-Hartman
2021-12-21 13:05                     ` Rafał Miłecki
2021-12-21 13:27                       ` Greg Kroah-Hartman
2021-12-21 13:52                         ` Rafał Miłecki
2021-12-21 14:27                           ` Greg Kroah-Hartman [this message]
2021-12-21 15:09                             ` Rafał Miłecki
2021-12-21 15:18                               ` Greg Kroah-Hartman
2021-12-21 15:33                                 ` Rafał Miłecki
2021-12-20 14:07   ` kernel test robot
2021-12-20 14:07     ` kernel test robot
2021-12-22  0:11   ` John Thomson
2021-12-20  8:01 ` [PATCH 1/2] sysfs: add sysfs_add_bin_file_to_group() Greg Kroah-Hartman
2021-12-20 14:07 ` kernel test robot
2021-12-20 14:07   ` kernel test robot
2021-12-20 14:18 ` kernel test robot
2021-12-20 14:18   ` kernel test robot
2021-12-20 20:16 ` [RFC PATCH] sysfs: __sysfs_add_file_to_group() can be static kernel test robot
2021-12-20 20:16   ` kernel test robot
2021-12-20 20:26 ` [PATCH 1/2] sysfs: add sysfs_add_bin_file_to_group() kernel test robot
2021-12-20 20:26   ` kernel test robot

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=YcHkS0iDUhplbqUc@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bhelgaas@google.com \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=hkallweit1@gmail.com \
    --cc=kw@linux.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rafal@milecki.pl \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=zajec5@gmail.com \
    /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 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.