mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: dtor_core@ameritech.net
Cc: dmitry.torokhov@gmail.com, Christoph Hellwig <hch@infradead.org>,
	Andrew Morton <akpm@osdl.org>,
	greg@kroah.com, linux-kernel@vger.kernel.org
Subject: Re: 2.6.11-rc2-mm1
Date: Wed, 26 Jan 2005 23:07:12 +0300	[thread overview]
Message-ID: <20050126230712.1dd63589@zanzibar.2ka.mipt.ru> (raw)
In-Reply-To: <d120d5000501261026700e37c0@mail.gmail.com>

On Wed, 26 Jan 2005 13:26:38 -0500
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:

> > > > > > Since each logical device does not know who use it, it can not be,
> > > > > > for example, removed optimally.
> > > > > > You need to run through whole superio device set to find those one that
> > > > > > has reference to logical device being removed.
> > > > >
> > > > > What do you mean by removing optimally? Consider teher 2 scenarios:
> > > > >  - you unload logical device driver which knows all the logical
> > > > > devices (interfaces) it is bound to and it releases those devices.
> > > >
> > > > It does not know chip drivers, which reference it.
> > >
> > > Of course it does, every logical device has one parent. Individual
> > > GPIO pins are not spread across your motherboard. Every one of them
> > > lives on some chip. They can all be driven by the same driver but they
> > > are different devices. It is like all your IDE drives are driven by
> > > the same driver but (unless LVM which is diffrent layer comes to play)
> > > they are still different drives.
> > 
> > No, there is no "parent".
> > Each logical device is "shared" between several superio chips.
> > It is presented design.
> 
> Ok, I presume that userspace although you saying that logical device
> is "shared" between chips different GPIO pins still visible to
> userspace as separate entities (correct me if I am wrong). That means
> that you chose in your implementation not to abstract out individual
> parts of SuperIO container as individual devices and instead have
> several logical drivers bound directly to a same chip. And that is why
> you need n-m relationship and inability to fit to the driver model and
> potential issues with power management. Instead of this

Userspace has access to GPIO logical device by it's name 
and name of the superio chip it is connected to.
 
>                                                       / <ldev>
>  <base-dev (PCI|ISA|other)> - <sdev> - <ldev>
>                                                      \ <ldev>
> 
> you need this
> 
>                                         /<sdev> - <ldev>
> <base-dev (PCI|ISA|other)> - <sdev> - <ldev>
>                                         \ <sdev> - <ldev>
> 
> This will decouple chip drivers from the logical drivers.
> 
> I argue that present design is sub-optimal and will hurt in the long run.


This picture is somewhat better presents superio design:

sdev           sdev
  |-----| |-----|
ldev   ldev   ldev

Where |---| links are bidirectional.

Probably you are right, but I doubt :)

> > > > We need to scan all superio chips to find that.
> > > >
> > > > > - you unload chip driver which knows what logical devices it has
> > > > > registered and removes them. Logical devices in turn unbind themselves
> > > > > from the logical drivers thay are bound to (only one for each device
> > > > > and they have link).
> > > > > Seems pretty clean to me.
> > > >
> > > > Yes, since there is sc->ldev relation.
> > > >
> > > > > > And situation become much worse, when we have so called logical device
> > > > > > clones -
> > > > > > it is virtual logical device that emulates standard one, but inside
> > > > > > performs
> > > > > > in a different way. Clone creates inside superio device(for example such
> > > > > > device
> > > > > > can live at different address).
> > > > > > When you do not have ldev->sc relation, you must traverse through each
> > > > > > logical device
> > > > > > in each superio chip to find clones.
> > > > > > Thus you will need to traverse through each superio chip,
> > > > > > then through each logical device it references, just to remove one
> > > > > > logical device.
> > > > >
> > > > > I am confused and need a concrete example. I would think that cases
> > > > > such as these should not require eny special handling, hardware access
> > > > > should be hidden from logical drivers by the chip driver. Or if only
> > > > > difference is the port address then it probably should be set by the
> > > > > chip driver as attribute of logical device.
> > > >
> > > > Consider sc.c and GPIO logical device in SC1100 (scx driver).
> > > >
> > > >                /*
> > > >                 * SuperIO core is registering logical device.
> > > >                 * SuperIO chip knows where it must live.
> > > >                 * If logical device being registered lives at the different location
> > > >                 * (for example when it was registered for all devices,
> > > >                 * but has address(index) corresponding to only one SuperIO chip)
> > > >                 * then we will register new logical device with the same name
> > > >                 * but with the different location(index).
> > > >                 *
> > > >                 * It is called clone.
> > > >                 */
> > > >
> > >
> > > In this sense every device is a clone. Consider I have 2 EtherExpress
> > > cards in my box. They surely live at different addresses but PCI
> > > system does not mess with "clones". And network layer does not care
> > > whether both of them driven by e100 or one is e100 and the other is
> > > RTL.
> > 
> > It is not the same as two different devices on the bus.
> > 
> > Consider sc1100 - GPIO lives in PCI aperture, absolutely not where
> > superio lives.
> > (And it is actully not logical device in this case, but it fits well
> > into design).
> 
> It does not matter where it "lives". The chip driver should not expose
> these details to interface driver. Although you said serio examples
> are not applicable here let's take another look there: i8042 and
> pcips2 modules. One provides serio ports that live in legacy IO space,
> the other is PCI-based. psmouse would not care less which one is
> behind the port it is bound to.

Chip driver provides access methods to the attached logical devices.
It probes and activates them, if appropriate module is loaded.

Your example again is not suitable for superio case.

With superio you have several identical logical devices, access to which
is absolutely standard in second level(logic befind access), 
but in first one(physicall access) it can differ.

So here is the real example of superio usage:

     userspace
        |
    superio core
      ......

       GPIO
  |----|  |--|
pc87366     sc1100
  |----| |---|
       WDT

Logical device GPIO is accessed by read/write methods, which only have
pin number(it is not how this methods are exactly implemeted though)
as parameter.

For example userspace accesses GPIO at sc1100 - it will be translated
into read methods called from appropriate superio chip with appropriate
parameters.

When we have multiple GPIO logical devices(each in it's own superio chip)
it is more convenient to use just the same object.


I did not understand you from the beginning...
It can be turned into device model quite well, only individual objects
should have backward references to allow easier manipulation with it's
"owners". Your above schema with device model is quite right, just add
invisible links from each device to/from it's "masters".

> 
> -- 
> Dmitry


	Evgeniy Polyakov

Only failure makes us experts. -- Theo de Raadt

  reply	other threads:[~2005-01-26 23:53 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-18  7:21 [PATCH] Some fixes for compat ioctl Andi Kleen
2005-01-18 10:34 ` Michael S. Tsirkin
2005-01-18 10:45   ` [PATCH 1/5] compat_ioctl call seems to miss a security hook Michael S. Tsirkin
2005-01-18 19:22     ` Chris Wright
2005-01-20  0:28       ` Michael S. Tsirkin
2005-01-20  0:43         ` Chris Wright
2005-01-20  1:06           ` Michael S. Tsirkin
2005-01-20  1:16             ` Chris Wright
2005-01-20  1:42               ` Michael S. Tsirkin
2005-01-18 10:48 ` [PATCH 2/5] socket ioctl fix (from Andi) Michael S. Tsirkin
2005-01-18 10:55   ` Christoph Hellwig
2005-01-18 11:01     ` Andi Kleen
2005-01-18 10:52 ` [PATCH 3/5] make common ioctls apply for compat Michael S. Tsirkin
2005-01-18 10:57 ` [PATCH 4/5] reminder comment about register_ioctl32_conversion Michael S. Tsirkin
2005-01-18 11:04 ` [PATCH 5/5] symmetry between compat_ioctl and unlocked_ioctl Michael S. Tsirkin
2005-01-24 10:15   ` 2.6.11-rc2-mm1 Andrew Morton
2005-01-24 10:36     ` 2.6.11-rc2-mm1 Adrian Bunk
2005-01-24 11:17     ` 2.6.11-rc2-mm1: v4l-saa7134-module compile error Adrian Bunk
2005-01-24 13:57       ` Gerd Knorr
2005-01-24 17:45         ` Adrian Bunk
2005-01-25 10:15           ` Gerd Knorr
2005-01-25 10:38             ` Adrian Bunk
2005-01-24 11:56     ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-24 13:41       ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-24 14:35         ` 2.6.11-rc2-mm1 Florian Bohrer
2005-01-24 18:52       ` 2.6.11-rc2-mm1 Dave Jones
2005-01-24 20:44         ` 2.6.11-rc2-mm1 Dave Jones
2005-01-24 21:31           ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-25 19:38             ` 2.6.11-rc2-mm1 Dave Jones
2005-01-25 19:58               ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-25 20:29                 ` 2.6.11-rc2-mm1 Dave Jones
2005-01-24 12:12     ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-24 20:36       ` 2.6.11-rc2-mm1 Karsten Keil
2005-01-24 23:26         ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-25  0:35           ` 2.6.11-rc2-mm1 Karsten Keil
2005-01-24 23:32         ` 2.6.11-rc2-mm1 Bartlomiej Zolnierkiewicz
2005-01-24 21:03       ` 2.6.11-rc2-mm1 Andrew Morton
2005-01-24 12:17     ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-31 22:42       ` [patch] generic notification layer Robert Love
2005-02-07 11:57       ` 2.6.11-rc2-mm1 Ingo Molnar
2005-02-07 17:30         ` 2.6.11-rc2-mm1 Robert Love
2005-02-07 21:02           ` 2.6.11-rc2-mm1 John McCutchan
2005-01-24 12:25     ` [-mm patch] fix SuperIO compilation Adrian Bunk
2005-01-24 12:34       ` Christoph Hellwig
2005-01-24 13:04         ` Evgeniy Polyakov
2005-01-24 13:56           ` Evgeniy Polyakov
2005-01-24 14:14             ` [1/1] superio: remove unneded exports and make some functions static Evgeniy Polyakov
2005-01-25  6:19               ` Greg KH
2005-01-24 12:48     ` 2.6.11-rc2-mm1: DVB compile error Adrian Bunk
2005-01-24 23:56       ` [linux-dvb-maintainer] " Johannes Stezenbach
2005-01-24 13:52     ` 2.6.11-rc2-mm1 Roman Zippel
2005-01-24 14:24     ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-24 14:58     ` 2.6.11-rc2-mm1 Benoit Boissinot
2005-01-24 15:11     ` 2.6.11-rc2-mm1 [compile fix] Benoit Boissinot
2005-01-24 17:25       ` Adrian Bunk
2005-01-24 17:54     ` 2.6.11-rc2-mm1: SuperIO scx200 breakage Adrian Bunk
2005-01-24 18:43       ` Evgeniy Polyakov
2005-01-24 18:29         ` Adrian Bunk
2005-01-24 19:19           ` Evgeniy Polyakov
2005-01-24 19:03             ` Adrian Bunk
2005-01-24 19:46               ` Evgeniy Polyakov
2005-01-24 18:41         ` Jurriaan
2005-01-24 19:23           ` Evgeniy Polyakov
2005-01-24 19:05             ` Adrian Bunk
2005-01-24 19:39               ` Evgeniy Polyakov
2005-01-24 19:32                 ` Dmitry Torokhov
2005-01-24 20:28                   ` Evgeniy Polyakov
2005-01-27 15:19         ` Bill Davidsen
2005-01-27 16:21           ` Evgeniy Polyakov
2005-01-27 23:12             ` Bill Davidsen
2005-01-24 20:33       ` Christoph Hellwig
2005-01-24 21:10         ` Evgeniy Polyakov
2005-01-24 21:34       ` Greg KH
2005-01-24 21:47         ` Christoph Hellwig
2005-01-25  6:02           ` Greg KH
2005-01-25  7:11             ` Christoph Hellwig
2005-01-25 18:59             ` Jean Delvare
2005-01-25 21:39               ` Evgeniy Polyakov
2005-01-25 21:40                 ` Jean Delvare
2005-01-25 22:35                   ` Evgeniy Polyakov
2005-01-26  9:55                     ` Jean Delvare
2005-01-26 10:55                       ` Evgeniy Polyakov
2005-01-26 14:34                         ` Jean Delvare
2005-01-26 16:10                           ` Evgeniy Polyakov
2005-01-26 19:20                             ` Jean Delvare
2005-01-26 20:21                               ` Evgeniy Polyakov
2005-01-26 10:14                     ` Christoph Hellwig
2005-01-26 10:59                       ` Evgeniy Polyakov
2005-01-26 14:00                         ` Dmitry Torokhov
2005-01-26 16:38                           ` Evgeniy Polyakov
2005-01-26 18:19                             ` Adrian Bunk
2005-01-26 19:27                               ` Evgeniy Polyakov
2005-01-27 10:20                                 ` Adrian Bunk
2005-01-27 11:53                                   ` Evgeniy Polyakov
2005-01-26 18:06                         ` Adrian Bunk
2005-01-26 13:12                       ` Russell King
2005-01-26 20:01                         ` Christoph Hellwig
2005-01-24 18:58     ` 2.6.11-rc2-mm1 Benoit Boissinot
2005-01-24 19:09       ` 2.6.11-rc2-mm1 Adrian Bunk
2005-01-24 19:44     ` 2.6.11-rc2-mm1 - fix a typo in nfs3proc.c Benoit Boissinot
2005-01-24 20:24     ` 2.6.11-rc2-mm1 - compile fix Benoit Boissinot
2005-01-24 20:26     ` [PATCH] move common compat ioctls to hash Michael S. Tsirkin
2005-01-25  6:17       ` Andi Kleen
2005-01-26  8:40         ` Michael S. Tsirkin
2005-01-25  0:03     ` 2.6.11-rc2-mm1: fuse patch needs new libs Sytse Wielinga
2005-01-25  7:31       ` Miklos Szeredi
2005-01-27 15:45       ` Bill Davidsen
2005-01-27 15:56         ` Sytse Wielinga
2005-01-27 16:11           ` Miklos Szeredi
2005-01-27 18:09       ` Christoph Hellwig
2005-01-25  1:01     ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-25  1:30       ` 2.6.11-rc2-mm1 (AE_AML_NO_OPERAND) Len Brown
2005-01-25 18:41       ` 2.6.11-rc2-mm1 Pavel Machek
2005-01-25 19:10         ` 2.6.11-rc2-mm1 Espen Fjellvær Olsen
2005-01-25 12:53     ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-25 14:11       ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 14:23         ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-25 15:24           ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 15:34             ` 2.6.11-rc2-mm1 Bartlomiej Zolnierkiewicz
2005-01-25 16:04               ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 18:21                 ` 2.6.11-rc2-mm1 Jörn Engel
2005-01-25 21:17                   ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26  2:20                     ` 2.6.11-rc2-mm1 Jörn Engel
2005-01-25 15:36             ` 2.6.11-rc2-mm1 Paulo Marques
2005-01-25 21:08               ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 16:11             ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-25 21:14               ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26  4:57                 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26  8:25                   ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 13:46                     ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 14:59                       ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 15:26                         ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 15:54                           ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 16:25                             ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 16:46                               ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 16:55                                 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 17:39                                   ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 18:26                                     ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 20:07                                       ` Evgeniy Polyakov [this message]
2005-01-26 20:22                                         ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-27 17:33                                           ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 22:42             ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-26  8:31               ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 13:32                 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 14:44                   ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 19:35       ` 2.6.11-rc2-mm1 Pavel Machek
2005-01-25 19:12     ` 2.6.11-rc2-mm1 Marcos D. Marado Torres
2005-01-25 23:07       ` 2.6.11-rc2-mm1 Barry K. Nathan
2005-01-26  2:40     ` 2.6.11-rc2-mm1 William Lee Irwin III
2005-01-26  4:44     ` [PATCH] ppc64: fix use kref for device_node refcounting Nathan Lynch
2005-01-27  6:18     ` 2.6.11-rc2-mm1 William Lee Irwin III
2005-01-27  9:14       ` 2.6.11-rc2-mm1 William Lee Irwin III

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=20050126230712.1dd63589@zanzibar.2ka.mipt.ru \
    --to=johnpol@2ka.mipt.ru \
    --cc=akpm@osdl.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dtor_core@ameritech.net \
    --cc=greg@kroah.com \
    --cc=hch@infradead.org \
    --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

all inboxes | Powered by JetHome®