All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org,
	Rob Herring <rob.herring@calxeda.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 1/2] of: Make device nodes kobjects so they show up in sysfs
Date: Wed, 20 Mar 2013 09:56:20 -0700	[thread overview]
Message-ID: <20130320165620.GB28307@kroah.com> (raw)
In-Reply-To: <1363791432.12701.8.camel@pasglop>

On Wed, Mar 20, 2013 at 03:57:12PM +0100, Benjamin Herrenschmidt wrote:
> On Wed, 2013-03-20 at 14:51 +0000, Grant Likely wrote:
> > Device tree nodes are already treated as objects, and we already want to
> > expose them to userspace which is done using the /proc filesystem today.
> > Right now the kernel has to do a lot of work to keep the /proc view in
> > sync with the in-kernel representation. If device_nodes are switched to
> > be kobjects then the device tree code can be a whole lot simpler. It
> > also turns out that switching to using /sysfs from /proc results in
> > smaller code and data size, and the userspace ABI won't change if
> > /proc/device-tree symlinks to /sys/device-tree
> > 
> > Switching to sysfs does introduce two limitations however. First, normal
> > sysfs attributes have a maximum size of PAGE_SIZE. Any properties larger
> > than 4k will still show up in sysfs, but attempting to read them will
> > result in truncated data. Practically speaking this should not be an
> > issue assuming large binary blobs aren't encoded into the device tree.
> 
> Unfortunately they occasionally are... VPDs can be pretty big for
> example.

If the attributes are binary blobs, use the binary file capability of
sysfs to properly handle them.

> > Second, all normal sysfs attributes report their size as 4096 bytes
> > instead of the actual property size reported in /proc/device-tree. It is
> > possible that this change will cause some userspace tools to break.
> 
> This is btw a complete idiocy of sysfs and should/could be fixed.

How can sysfs change this?  It doesn't know the size of the attribute
ahead of time, and it can change depending on what happens in the
system.  So we default to a page size, which is the largest size an
attribute can be.

thanks,

greg k-h

  reply	other threads:[~2013-03-20 16:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 14:51 [PATCH 0/2] of: Create sysfs view of device tree nodes Grant Likely
2013-03-20 14:51 ` [PATCH 1/2] of: Make device nodes kobjects so they show up in sysfs Grant Likely
     [not found]   ` <1363791074-16415-2-git-send-email-grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
2013-03-20 14:57     ` Benjamin Herrenschmidt
2013-03-20 14:57       ` Benjamin Herrenschmidt
2013-03-20 16:56       ` Greg Kroah-Hartman [this message]
2013-03-20 17:46         ` Benjamin Herrenschmidt
2013-03-20 21:28       ` Grant Likely
     [not found] ` <1363791074-16415-1-git-send-email-grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
2013-03-20 14:51   ` [PATCH 2/2] of: remove /proc/device-tree Grant Likely
2013-03-20 14:51     ` Grant Likely
2013-03-20 14:57     ` Benjamin Herrenschmidt
2013-03-20 21:38       ` Grant Likely
2013-03-21  4:19         ` Benjamin Herrenschmidt
2013-03-21  7:35           ` Grant Likely
2013-03-21  7:43             ` Benjamin Herrenschmidt
2013-03-21  8:16               ` Grant Likely
2013-03-21  8:16                 ` Grant Likely
2013-03-21 12:36                 ` Benjamin Herrenschmidt
2013-03-21 12:42                   ` Grant Likely
2013-03-21 12:42                     ` Grant Likely
2013-11-16 20:09                   ` Geert Uytterhoeven
2013-03-20 15:19     ` Rob Herring
2013-03-20 16:24       ` Daniel Mack
2013-03-20 16:40         ` Grant Likely
2013-03-21  4:03         ` Rob Landley

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=20130320165620.GB28307@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.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.