From: Chris Metcalf <cmetcalf@tilera.com>
To: Eric Biederman <ebiederm@aristanetworks.com>
Cc: Arnd Bergmann <arnd@arndb.de>, <linux-kernel@vger.kernel.org>,
Chris Wright <chrisw@sous-sol.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
Benjamin Thery <benjamin.thery@bull.net>,
Phil Carmody <ext-phil.2.carmody@nokia.com>
Subject: Re: [PATCH] arch/tile: add arch/tile/drivers/ directory with SROM driver
Date: Fri, 20 May 2011 19:39:10 -0400 [thread overview]
Message-ID: <4DD6FB9E.2050604@tilera.com> (raw)
In-Reply-To: <BANLkTimMndGzjZJ0xUNgStY7kwM0aW7Ojg@mail.gmail.com>
On 5/20/2011 6:40 PM, Eric Biederman wrote:
> Please do not make sysfs the direct access method to your device.
> I may be wrong but I don't think any other driver relies exclusively on sysfs.
I'm basing my implementation on drivers/misc/eeprom/. All the drivers
there use the same sysfs model.
> Certainly with the introduction of a flush you are introducing an completely
> different usage paradigm from current users and will need an entirely different
> set of tools.
I don't think using my proposed implementation will be detectably different
for most user tools. The addition of the flush() method just allows my
implementation to defer the final sector's write until the device is closed
(sectors are in fact still written to hardware as one does seek() or
write() from one sector to another; only the "current" sector is cached by
the hypervisor). I suppose some third-party tool that kept the eeprom file
descriptor open indefinitely and did multiple writes to the same sector
might not work as expected with this implementation. But it seems hard to
imagine a use case for such a tool.
The direct motivation for this case is to "impedance match" to the
hypervisor driver for this device, which handles sector management
internally, so the Linux device doesn't have to. Having a 'flush' method
avoids excessive re-writes of the same sector for certain access patterns.
The only alternatives that I see are to rewrite the tile userspace tools,
but they are the way they are because the current model gives good
consistency guarantees for writing the boot rom in the presence of
arbitrary failure modes; or, to add something like a delayed timer event
that allows the Linux driver to notify the hypervisor driver that writes
are likely complete and it can write out the last sector. Neither of these
are particularly attractive.
> You are vastly exceeding the one value per file rule of sysfs.
True, but bin_attribute has always been an exception to that rule anyway.
> Please look at the i2c core and if at all possible build a proper interface to
> your eeprom, that existing programs have a chance of utilizing rather than
> extending sysfs in ways that means cli tools can not work with it.
This driver is a paravirtualized hypervisor driver, so not really an I2C
driver at all (in fact it handles both SPI and I2C eeproms almost
identically within the Linux driver). And I think the driver's "eeprom"
file should be compatible with userspace cli tools, assuming they close
their file descriptor when they're done writing.
I apologize for not including more of the back story in this email when
adding the cc's, by the way. Originally I proposed a straightforward
character device for this role. Arnd Bergmann encouraged me to look at
kernel precedents like drivers/char/eeprom/, which is why I converted this
driver to sysfs. The first post in this thread is here:
https://lkml.org/lkml/2011/5/4/415 . Since then I've come around to
believing that it's more valuable to group this driver with the other
eeprom drivers, rather than with the other paravirtualized tile drivers.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
next prev parent reply other threads:[~2011-05-20 23:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 19:10 [PATCH] arch/tile: add arch/tile/drivers/ directory with SROM driver Chris Metcalf
2011-05-05 6:41 ` Arnd Bergmann
2011-05-06 19:37 ` Chris Metcalf
2011-05-20 18:05 ` Chris Metcalf
2011-05-20 18:46 ` Arnd Bergmann
2011-05-20 22:40 ` Eric Biederman
2011-05-20 23:39 ` Chris Metcalf [this message]
2011-05-21 3:21 ` Greg KH
2011-05-21 9:33 ` Arnd Bergmann
2011-05-21 13:52 ` Chris Metcalf
2011-05-21 15:02 ` Arnd Bergmann
2011-05-21 15:31 ` Chris Metcalf
2011-05-21 15:50 ` Eric Biederman
2011-05-23 20:10 ` Chris Metcalf
2011-05-21 7:46 ` Eric Biederman
2011-05-21 8:32 ` Arnd Bergmann
2011-05-22 0:54 ` Mike Frysinger
2011-05-28 15:13 ` [PATCH v2] arch/tile: add hypervisor-based character driver for SPI flash ROM Chris Metcalf
2011-05-28 21:23 ` Greg KH
2011-05-29 0:32 ` Chris Metcalf
2011-05-29 11:45 ` Greg KH
2011-05-29 12:18 ` Chris Metcalf
2011-05-29 13:47 ` Greg KH
2011-05-29 15:45 ` Arnd Bergmann
2011-05-29 18:23 ` Chris Metcalf
2011-06-02 15:04 ` [PATCH v3] " Chris Metcalf
2011-06-10 16:41 ` Arnd Bergmann
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=4DD6FB9E.2050604@tilera.com \
--to=cmetcalf@tilera.com \
--cc=arnd@arndb.de \
--cc=benjamin.thery@bull.net \
--cc=chrisw@sous-sol.org \
--cc=ebiederm@aristanetworks.com \
--cc=ext-phil.2.carmody@nokia.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@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).