Skip to contentSkip to conversation

The evilness of struct usb_device->auto_pm

linux-usb-devel Alan Stern 4 participants 8 messages Sep 28, 2007 – Oct 5, 2007 6 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Alan Stern

author
#1 lore raw
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines

That's because the notifications go up the device tree, not down. When a child is suspended, the parent is notified. Then if the driver sees that all the children are suspended, the parent can be suspended as well.

Oliver has been trying to subvert this model by making usb-storage responsible for suspending the SCSI disk and CD/DVD drivers, which are located beneath it in the device tree. I've been trying to convince him that the proper way to handle things is to let the SCSI drivers decide for themselves when their devices can be suspended, and then have them inform usb-storage.

Quoted 3 lines

Yes, I think that the SCSI layer should decide.

I guess that the SCSI layer is not really autosuspend-aware, is it?

Not yet. I would like it to become autosuspend-aware. Oliver wants to avoid that by keeping all the awareness in usb-storage. (But then what about all the other SCSI host-adapter drivers? Will they each have their own way of deciding when a SCSI device can be suspended?)

Alan Stern

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 14 lines · Alan Stern
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines

That's because the notifications go up the device tree, not down. When a child is suspended, the parent is notified. Then if the driver sees that all the children are suspended, the parent can be suspended as well.

Oliver has been trying to subvert this model by making usb-storage responsible for suspending the SCSI disk and CD/DVD drivers, which are located beneath it in the device tree. I've been trying to convince him that the proper way to handle things is to let the SCSI drivers decide for themselves when their devices can be suspended, and then have them inform usb-storage.

Quoted 8 lines
Quoted 3 lines

Yes, I think that the SCSI layer should decide.

I guess that the SCSI layer is not really autosuspend-aware, is it?

Not yet. I would like it to become autosuspend-aware. Oliver wants to avoid that by keeping all the awareness in usb-storage. (But then what about all the other SCSI host-adapter drivers? Will they each have their own way of deciding when a SCSI device can be suspended?)

IMO, this is a more general issue.

The problem, as I see it, is which layer of drivers should be responsible of making autosuspend decisions if there are many layers stacked on top of one another.

I think that it should be the layer which communicates with processes, eg. via syscalls.

Greetings,
Rafael

#4 lore raw
In reply to a message not in the archive

Hi!

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

That's because the notifications go up the device tree, not down. When a child is suspended, the parent is notified. Then if the driver sees that all the children are suspended, the parent can be suspended as well.

Oliver has been trying to subvert this model by making usb-storage responsible for suspending the SCSI disk and CD/DVD drivers, which are located beneath it in the device tree. I've been trying to convince him that the proper way to handle things is to let the SCSI drivers decide for themselves when their devices can be suspended, and then have them inform usb-storage.

Quoted 8 lines
Quoted 3 lines

Yes, I think that the SCSI layer should decide.

I guess that the SCSI layer is not really autosuspend-aware, is it?

Not yet. I would like it to become autosuspend-aware. Oliver wants to avoid that by keeping all the awareness in usb-storage. (But then what about all the other SCSI host-adapter drivers? Will they each have their own way of deciding when a SCSI device can be suspended?)

I think I'd prefer to have autosuspending in SCSI layer. That way, we should be able to handle automatic disk spindowns nicely...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Am Montag 01 Oktober 2007 schrieb Pavel Machek:

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

I guess that the SCSI layer is not really autosuspend-aware, is it?

Not yet.  I would like it to become autosuspend-aware.  Oliver wants to avoid that by keeping all the awareness in usb-storage.  (But then what about all the other SCSI host-adapter drivers?  Will they each have their own way of deciding when a SCSI device can be suspended?)

I think I'd prefer to have autosuspending in SCSI layer. That way, we should be able to handle automatic disk spindowns nicely...

OK, so this is the consensus. Then the question arises, how does a driver learn that all it's children have gone into autosuspend?

Regards
Oliver

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 8 lines · Oliver Neukum

Am Montag 01 Oktober 2007 schrieb Pavel Machek:

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

I guess that the SCSI layer is not really autosuspend-aware, is it?

Not yet.  I would like it to become autosuspend-aware.  Oliver wants to avoid that by keeping all the awareness in usb-storage.  (But then what about all the other SCSI host-adapter drivers?  Will they each have their own way of deciding when a SCSI device can be suspended?)

Quoted 5 lines
Quoted 2 lines

I think I'd prefer to have autosuspending in SCSI layer. That way, we should be able to handle automatic disk spindowns nicely...

OK, so this is the consensus. Then the question arises, how does a driver learn that all it's children have gone into autosuspend?

atomic_t variable in the parent, with children updating it and calling parent's callback when it goes to 1->0 and 0->1?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Re: [linux-usb-devel] Re: The evilness of struct usb_device- >auto_pm

Am Donnerstag 04 Oktober 2007 schrieb Pavel Machek:

Quoted 9 lines · Oliver Neukum
Quoted 8 lines

Am Montag 01 Oktober 2007 schrieb Pavel Machek:

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

I guess that the SCSI layer is not really autosuspend-aware, is it?

Not yet.  I would like it to become autosuspend-aware.  Oliver wants to avoid that by keeping all the awareness in usb-storage.  (But then what about all the other SCSI host-adapter drivers?  Will they each have their own way of deciding when a SCSI device can be suspended?)

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I think I'd prefer to have autosuspending in SCSI layer. That way, we should be able to handle automatic disk spindowns nicely...

OK, so this is the consensus. Then the question arises, how does a driver learn that all it's children have gone into autosuspend?

atomic_t variable in the parent, with children updating it and calling parent's callback when it goes to 1->0 and 0->1?

That's a viable proposal, but it means moving part of the autosuspend code into the generic model. Are you all okay with that?

Regards
Oliver

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [linux-usb-devel] Re: The evilness of struct usb_device- >auto_pm

Quoted 13 lines · Oliver Neukum

Am Donnerstag 04 Oktober 2007 schrieb Pavel Machek:

Quoted 12 lines · Oliver Neukum
Quoted 11 lines

Am Montag 01 Oktober 2007 schrieb Pavel Machek:

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

I guess that the SCSI layer is not really autosuspend-aware, is it?

Not yet.  I would like it to become autosuspend-aware.  Oliver wants to avoid that by keeping all the awareness in usb-storage.  (But then what about all the other SCSI host-adapter drivers?  Will they each have their own way of deciding when a SCSI device can be suspended?)

I think I'd prefer to have autosuspending in SCSI layer. That way, we should be able to handle automatic disk spindowns nicely...

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

OK, so this is the consensus. Then the question arises, how does a driver learn that all it's children have gone into autosuspend?

atomic_t variable in the parent, with children updating it and calling parent's callback when it goes to 1->0 and 0->1?

That's a viable proposal, but it means moving part of the autosuspend code into the generic model. Are you all okay with that?

I am.

Greetings,
Rafael

#13 lore raw

Re: [linux-usb-devel] Re: The evilness of struct?usb_device->auto_pm

In reply to a message not in the archive

Hi!

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

OK, so this is the consensus. Then the question arises, how does a driver learn that all it's children have gone into autosuspend?

atomic_t variable in the parent, with children updating it and calling parent's callback when it goes to 1->0 and 0->1?

That's a viable proposal, but it means moving part of the autosuspend code into the generic model. Are you all okay with that?

Me? Yes.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html