Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lu@intel.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Oliver Neukum <oneukum@suse.de>,
	'James Bottomley' <James.Bottomley@hansenpartnership.com>,
	Jeff Garzik <jgarzik@pobox.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-pm@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-ide@vger.kernel.org
Subject: Re: [PATCH v7 2/6] scsi: sr: support runtime pm
Date: Sun, 30 Sep 2012 20:38:40 +0800	[thread overview]
Message-ID: <20120930123839.GB2412@localhost.localdomain> (raw)
In-Reply-To: <201209300027.41533.rjw@sisk.pl>

On Sun, Sep 30, 2012 at 12:27:41AM +0200, Rafael J. Wysocki wrote:
> On Saturday, September 29, 2012, Aaron Lu wrote:
> > [Adding more people and list back in]
> > 
> > On 09/29/2012 05:46 AM, Rafael J. Wysocki wrote:
> > > On Friday, September 28, 2012, Aaron Lu wrote:
> > >> On 09/28/2012 07:15 AM, Rafael J. Wysocki wrote:
> > >>> On Thursday, September 27, 2012, Aaron Lu wrote:
> > >>>> On 09/27/2012 05:37 AM, Rafael J. Wysocki wrote:
> > >>>>>
> > >>>>> Say the user has pressed the eject button.  What does need to happen so that
> > >>>>> the tray is physically ejected?
> > >>>>
> > >>>> The tray is ejected by the ODD itself, host does not have to do anything.
> > >>>>
> > >>>> There is a command(PREVENT_MEDIUM_REMOVAL) to lock the door so that when
> > >>>> user presses the eject button, the tray will not be ejected. This command
> > >>>> is usually sent when we have a disc inside and a user space program
> > >>>> opened the underlying block device(e.g. /dev/sr0) to read/write data.
> > >>>>
> > >>>> And host can also eject the tray by sending a START_STOP_UNIT command
> > >>>> with param LoEj set to 1 and we have a function called sr_tray_move to
> > >>>> do just this. And this is also what I've used to eject the tray after
> > >>>> user wakes up the ODD, as when user presses the eject button when the
> > >>>> ODD is in zero power state, it can't eject the tray as usual, so host
> > >>>> software will need to do this, that's the reason I need to know such
> > >>>> information:
> > >>>> When ODD is resumed, is it because user wakes it up?
> > >>>
> > >>> But START_STOP_UNIT eventually causes ata_scsi_start_stop_xlat() to be
> > >>
> > >> You are following ata case, while the ODD is an atapi device :-)
> > >> The translation function is atapi_xlat, but that doesn't affect the idea
> > >> here.
> > >>
> > >>> executed, so I wonder if we really need to go up through the SCSI stack
> > >>> to send that command to the drive from there?  It should be possible
> > >>> to issue STANDBY/READ VERIFY to the device directly from libata if
> > >>> an eject event is signaled through a GPE.
> > >>
> > >> Yes, this is possible.
> > >> Though it doesn't feel very cool, since I have no idea if the ODD is a
> > >> tray type or slot type in ATA layer and I'll blindly send this command
> > >> to it then, not a problem maybe.
> > > 
> > > It would be good to verify if that works for slot devices, if possible.
> > 
> > The ACPI GPE event is triggered when user inserts a disc into a slot
> > type ODD, and if I send an eject command to it, the disc will be
> > ejected, which is wrong.
> > 
> > I need to know the loading mechanism(tray type or slot type) of the ODD
> > to decide if I should send this command.
> > 
> > > 
> > >> And what do you think of moving the acpi notification code to sr?
> > >> http://marc.info/?l=linux-pm&m=134873904332704&w=4
> > > 
> > > I don't think this is a good idea, quite frankly.  sr seems to be a too
> > > generic place for that.
> > 
> > Does this mean sr can only have code that is useful to all devices it
> > manages? i.e. If a piece of code enables a feature for a special kind of
> > ODD(like the sata based ZPODD), it shouldn't be done in sr?
> 
> If the feature is specific to one special kind of ODD only, then I don't
> think sr is the right place to add support for it.
> 
> > > Ideally, the whole ZPODD handling should not be visible to the SCSI layer,
> > 
> > I can see 2 problems:
> > - Don't know its loading machanism so we have the problem above;
> 
> Does using the need_eject flag address this problem somehow?

The need_eject flag is used to give sr a hint that on resume, please
eject its tray. And sr knows what loading mechanism this ODD is.

> 
> > - Need to send command to find out if ODD is zero power ready somewhere
> >   in ata layer, this implies the device is doing IO after it is runtime
> >   suspended in scsi layer.
> 
> There's nothing wrong with accessig suspended devices as long as we know
> that they will respond. :-)

Oh, I was reading the comments above the struct dev_pm_ops in
/include/linux/pm.h and thought that was a requirement :-)

Thanks,
Aaron

> 
> > > perhaps except the "no_polling" flag disabling the polling that may be
> > > useful for other purposes in principle.
> > 
> > I hope so, let's hear what other people has to say.
> > 
> > > 
> > > I'm not sure if it's possible at this point, but if not we need to know
> > > very precisely why not.
> > 
> > There is nothing in theory stopping us from doing this in ata layer.
> > For the loading mechanism, we can always send an ATAPI command to figure
> > it out.
> > 
> > So gentlemen, I need your opinions on where this ZPODD code should live
> > before I can continue this work, thanks.
> 
> I would _try_ to add it at the ATA level.
> 
> Thanks,
> Rafael
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ide" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2012-09-30 12:38 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12  8:29 [PATCH v7 0/6] ZPODD patches Aaron Lu
2012-09-12  8:29 ` [PATCH v7 1/6] block: genhd: add an interface to set disk poll interval Aaron Lu
2012-09-20 20:35   ` Rafael J. Wysocki
2012-09-12  8:29 ` [PATCH v7 2/6] scsi: sr: support runtime pm Aaron Lu
2012-09-20 20:48   ` Rafael J. Wysocki
2012-09-20 20:54     ` Alan Stern
2012-09-21  1:02     ` Aaron Lu
2012-09-21 20:49       ` Rafael J. Wysocki
2012-09-24  1:20         ` Aaron Lu
2012-09-24 12:55           ` Rafael J. Wysocki
2012-09-24 14:52             ` Aaron Lu
2012-09-24 21:40               ` Rafael J. Wysocki
2012-09-25  8:01                 ` Aaron Lu
2012-09-25 11:47                   ` Rafael J. Wysocki
2012-09-25 14:20                     ` Aaron Lu
2012-09-25 14:23                       ` Oliver Neukum
2012-09-25 14:46                         ` Aaron Lu
2012-09-25 21:45                           ` Rafael J. Wysocki
2012-09-26  1:03                             ` Aaron Lu
2012-09-26 11:18                               ` Rafael J. Wysocki
2012-09-26 14:52                                 ` Aaron Lu
2012-09-26  7:20                           ` Oliver Neukum
2012-09-27 10:46                   ` Oliver Neukum
2012-09-28  8:20                     ` Aaron Lu
2012-09-12  8:29 ` [PATCH v7 3/6] scsi: sr: support zero power ODD(ZPODD) Aaron Lu
2012-09-20 22:07   ` Rafael J. Wysocki
2012-09-21  1:39     ` Aaron Lu
2012-09-21 21:02       ` Rafael J. Wysocki
2012-09-27  9:26         ` Aaron Lu
2012-09-27 14:42           ` Alan Stern
2012-09-27 14:55             ` Aaron Lu
2012-09-27 23:29               ` Rafael J. Wysocki
2012-09-24 21:55   ` Jeff Garzik
2012-09-12  8:29 ` [PATCH v7 4/6] scsi: pm: add may_power_off flag Aaron Lu
2012-09-12  8:29 ` [PATCH v7 5/6] scsi: sr: use may_power_off Aaron Lu
2012-09-12  8:29 ` [PATCH v7 6/6] libata: acpi: respect may_power_off flag Aaron Lu
2012-09-24 21:55   ` Jeff Garzik
2012-09-19  8:03 ` [PATCH v7 0/6] ZPODD patches Aaron Lu
2012-09-19 12:27   ` James Bottomley
2012-09-19 12:50     ` Rafael J. Wysocki
2012-09-19 14:19       ` Aaron Lu
2012-09-20 20:00         ` Rafael J. Wysocki
2012-09-21  5:48           ` Aaron Lu
2012-09-21 21:18             ` Rafael J. Wysocki
2012-09-22  7:32               ` Oliver Neukum
2012-09-22 11:28                 ` Rafael J. Wysocki
2012-09-22 15:38                   ` Alan Stern
2012-09-22 19:46                     ` Rafael J. Wysocki
2012-09-22 20:23                       ` Alan Stern
2012-09-22 21:48                         ` Rafael J. Wysocki
2012-09-24  2:55               ` Aaron Lu
2012-09-24 13:06                 ` Rafael J. Wysocki
2012-09-24 15:04                   ` Aaron Lu
2012-09-24 21:46                     ` Rafael J. Wysocki
2012-09-25  8:18                       ` Aaron Lu
2012-09-25 11:02                         ` James Bottomley
2012-09-25 13:56                           ` Aaron Lu
2012-09-27  9:43                           ` Aaron Lu
2012-09-19 14:52       ` James Bottomley
2012-09-20 21:46         ` Rafael J. Wysocki
2012-09-19 13:05     ` Oliver Neukum
2012-09-19 15:19     ` David Woodhouse
2012-09-20  0:34       ` Jack Wang
     [not found] ` <201209280115.06964.rjw@sisk.pl>
     [not found]   ` <5064FA08.6030005@intel.com>
     [not found]     ` <201209282346.15872.rjw@sisk.pl>
2012-09-29  2:10       ` [PATCH v7 2/6] scsi: sr: support runtime pm Aaron Lu
2012-09-29 14:29         ` Alan Stern
2012-09-29 15:03           ` Aaron Lu
2012-09-29 22:44             ` Rafael J. Wysocki
2012-09-30 12:32               ` Aaron Lu
2012-09-30 14:47                 ` Alan Stern
2012-09-30 15:39                   ` Aaron Lu
2012-09-30 19:15                   ` Jeff Garzik
2012-09-30 19:08               ` Jeff Garzik
2012-09-29 22:31           ` Rafael J. Wysocki
2012-09-30 19:03             ` Jeff Garzik
2012-09-30 19:43               ` Alan Stern
2012-10-01  4:57                 ` Jeff Garzik
2012-10-08  9:27                 ` Aaron Lu
2012-10-08 10:21                   ` James Bottomley
2012-10-09  7:20                     ` Aaron Lu
2012-10-09 14:58                       ` James Bottomley
2012-10-11  7:49                         ` Aaron Lu
2012-10-09 23:26                       ` Rafael J. Wysocki
2012-09-29 22:27         ` Rafael J. Wysocki
2012-09-30 12:38           ` Aaron Lu [this message]

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=20120930123839.GB2412@localhost.localdomain \
    --to=aaron.lu@intel.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=oneukum@suse.de \
    --cc=rjw@sisk.pl \
    --cc=stern@rowland.harvard.edu \
    /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