From: Greg KH <greg@kroah.com>
To: Kyle Moffett <mrmacman_g4@mac.com>, Kay Sievers <kay.sievers@vrfy.org>
Cc: Michael Holzheu <holzheu@de.ibm.com>,
akpm@osdl.org, schwidefsky@de.ibm.com, penberg@cs.helsinki.fi,
ioe-lkml@rameria.de, joern@wohnheim.fh-wedel.de,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] s390: Hypervisor File System
Date: Tue, 2 May 2006 14:30:43 -0700 [thread overview]
Message-ID: <20060502213043.GB30957@kroah.com> (raw)
In-Reply-To: <13D6E299-061B-46A5-A3CD-12E1075B9451@mac.com>
On Tue, May 02, 2006 at 04:48:42AM -0400, Kyle Moffett wrote:
> On May 2, 2006, at 00:00:53, Greg KH wrote:
> >On Mon, May 01, 2006 at 07:29:23PM -0400, Kyle Moffett wrote:
> >>So my question stands: What is the _recommended_ way to handle
> >>simple data types in low-bandwidth/frequency multiple-valued
> >>transactions to hardware? Examples include reading/modifying
> >>framebuffer settings (currently done through IOCTLS), s390 current
> >>state (up for discussion), etc. In these cases there needs to be
> >>an atomic snapshot or write of multiple values at the same time.
> >>Given the situation it would be _nice_ to use sysfs so the admin
> >>can do it by hand; makes things shell scriptable and reduces the
> >>number of binary compatibility issues.
> >
> >I really don't know of a way to use sysfs for this currently, and
> >hence, am not complaining too much about the different /proc files
> >that have this kind of information in it at the moment.
> >
> >If you or someone else wants to come up with some kind of solution
> >for it, I'm sure that many people would be very happy to see it.
>
> Hmm, ok; I'll see what I can come up with. Would anybody object to
> this kind of API (as in my previous email) that uses an open fd as a
> transaction "handle"?
No, I think Kay played around with something like using the open fd of
the directory as such a lock (or was he using flock on it, I can't
remember now...)
> Example script:
> >## Associate this process with an atomic snapshot
> >## of the /sys/hypervisor/s390 filesystem tree.
> >exec 3>/sys/hypervisor/s390/transaction
> >
> >## Read data from /sys/hypervisor/s390 without
> >## worrying about atomicity; as that's guaranteed
> >## by the open FD 3.
> >ls /sys/hypervisor/s390/cpus
> >cat /sys/hypervisor/s390/some_data_file
> >
> >## Create another reference in this process to the
> >## _same_ atomic snapshot
> >exec 4>&3
> >
> >## Does *not* close out the atomic snapshot
> >exec 3>&-
> >
> >## Yet another ref; still the _same_ snapshot
> >exec 6>/sys/hypervisor/s390/transaction
> >exec 4>&-
> >
> >## Regardless of what has changed in the meantime,
> >## our filesystem tree still looks the same
> >ls /sys/hypervisor/s390/cpus
> >
> >## Write out values
> >echo some_state >/sys/hypervisor/s390/statefile
> >
> >## Decide we don't like the changes and abort
> >echo reset >&6
> >
> >## Release the last copy of the snapshot and
> >## commit modified values
> >exec 6>&-
>
>
> This would allow usages like the following:
> >exec 3>/sys/hypervisor/s390/transaction
> >/bin/s390_change_hypervisor_state
> >## Look at new state; decide if we like it or not
> >if [ -z "$I_LIKE_THE_STATE" ]; then
> > echo reset >&3
> >fi
> >exec 3>&-
>
>
> For actually implementing this; I'm considering a design which hangs
> a transaction off of a "struct file" such that fork() and clone()
> preserve the same transaction. When a new process obtains an FD with
> the given transaction it would add that process' current pointer to a
> hash-table referencing the transaction data structure so that the open
> () call could look up the transaction for a given task in the hash
> table and use the data specified in the transaction. When a
> transaction is opened it would read the data atomically from the
> hardware or in-kernel data structures and store an "initial" copy as
> well as a "current" copy in per-transaction memory. As a user could
> theoretically pin NPROC * size_of_transaction_data * 2 of kernel
> memory, transaction files should have fairly strict file modes or
> some sort of resource-accounting semantic. On a "reset" operation
> the "initial" copy would be used to overwrite the "current" copy
> again, and a changed bit would be unset. Changes would result in the
> changed bit being set. When the transaction is closed, if the
> changed bit is set then the data would be committed atomically, then
> all the memory would be freed and the transaction removed from the
> hash table.
>
> Anything that sounds broken/fishy/"No that's impossible because..."
> in there? I appreciate your input; if this sounds feasable I'll try
> to hack up a patch.
Sounds a bit complex. Try looking at flock and see if you can pass that
info back to the sysfs attribute owners.
thanks,
greg k-h
next prev parent reply other threads:[~2006-05-02 21:32 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-28 9:22 [PATCH] s390: Hypervisor File System Michael Holzheu
2006-04-28 9:43 ` Jörn Engel
2006-04-28 11:53 ` Michael Holzheu
2006-04-28 15:48 ` Jörn Engel
2006-04-28 9:56 ` Andrew Morton
2006-04-28 17:36 ` Michael Holzheu
2006-04-28 17:43 ` Jörn Engel
2006-05-02 8:06 ` Michael Holzheu
2006-04-28 19:44 ` Andrew Morton
2006-04-28 10:36 ` Pekka J Enberg
2006-04-28 13:14 ` Michael Holzheu
2006-04-29 6:44 ` Andrew Morton
2006-04-29 7:51 ` Greg KH
2006-04-29 8:14 ` Andrew Morton
2006-05-03 8:48 ` Michael Holzheu
2006-05-03 22:10 ` Greg KH
2006-05-04 10:22 ` Michael Holzheu
2006-05-04 14:42 ` Greg KH
2006-05-04 15:01 ` Michael Holzheu
2006-05-04 15:34 ` Greg KH
2006-04-29 7:53 ` Greg KH
2006-04-29 8:41 ` Kyle Moffett
2006-04-29 21:55 ` Greg KH
2006-04-30 5:18 ` Kyle Moffett
2006-05-01 20:38 ` Greg KH
2006-05-01 23:29 ` Kyle Moffett
2006-05-02 4:00 ` Greg KH
2006-05-02 5:23 ` Kay Sievers
2006-05-02 5:37 ` Greg KH
2006-05-02 11:46 ` Kay Sievers
2006-05-02 21:28 ` Greg KH
2006-05-02 21:33 ` Kay Sievers
2006-05-02 21:54 ` Greg KH
2006-05-02 8:48 ` Kyle Moffett
2006-05-02 21:30 ` Greg KH [this message]
2006-05-02 21:49 ` Kay Sievers
2006-05-02 23:18 ` Kyle Moffett
2006-05-03 9:33 ` Michael Holzheu
2006-05-03 9:42 ` Pekka J Enberg
2006-05-03 12:11 ` Michael Holzheu
2006-05-03 12:33 ` Jörn Engel
2006-05-03 12:51 ` Michael Holzheu
2006-05-03 13:00 ` Jörn Engel
2006-05-03 13:18 ` Michael Holzheu
2006-05-03 13:22 ` Jörn Engel
2006-05-03 13:38 ` Michael Holzheu
2006-05-03 14:17 ` Martin Schwidefsky
2006-05-03 14:23 ` Michael Holzheu
2006-05-03 14:58 ` Martin Schwidefsky
2006-05-03 15:22 ` Michael Holzheu
2006-05-03 15:54 ` Valdis.Kletnieks
2006-05-03 10:01 ` Jörn Engel
2006-05-02 10:12 ` Michael Holzheu
2006-05-02 13:00 ` Michael Holzheu
2006-05-03 8:45 ` Michael Holzheu
-- strict thread matches above, loose matches on Subject: below --
2006-04-28 17:37 Michael Holzheu
2006-04-28 17:47 ` Jörn Engel
2006-05-02 7:25 ` Michael Holzheu
2006-05-05 13:22 Michael Holzheu
2006-05-05 21:14 ` Greg KH
2006-05-08 12:24 Michael Holzheu
2006-05-09 5:01 ` Greg KH
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=20060502213043.GB30957@kroah.com \
--to=greg@kroah.com \
--cc=akpm@osdl.org \
--cc=holzheu@de.ibm.com \
--cc=ioe-lkml@rameria.de \
--cc=joern@wohnheim.fh-wedel.de \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mrmacman_g4@mac.com \
--cc=penberg@cs.helsinki.fi \
--cc=schwidefsky@de.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox