From: Aaron Lu <aaron.lu@intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
Tejun Heo <tj@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
linux-pm@vger.kernel.org, Jeff Garzik <jgarzik@pobox.com>,
Alan Stern <stern@rowland.harvard.edu>, Jeff Wu <jeff.wu@amd.com>,
Aaron Lu <aaron.lwe@gmail.com>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-acpi@vger.kernel.org
Subject: Re: [PATCH v9 06/10] ata: zpodd: check zero power ready status
Date: Mon, 3 Dec 2012 16:59:38 +0800 [thread overview]
Message-ID: <20121203085937.GA29898@aaronlu.sh.intel.com> (raw)
In-Reply-To: <1354523143.2307.2.camel@dabdike.int.hansenpartnership.com>
On Mon, Dec 03, 2012 at 08:25:43AM +0000, James Bottomley wrote:
> On Mon, 2012-12-03 at 16:13 +0800, Aaron Lu wrote:
> > On Wed, Nov 28, 2012 at 08:56:09AM +0000, James Bottomley wrote:
> > > On Tue, 2012-11-27 at 17:39 -0800, Tejun Heo wrote:
> > > > Hey, Rafael.
> > > >
> > > > On Wed, Nov 28, 2012 at 01:51:00AM +0100, Rafael J. Wysocki wrote:
> > > > > Having considered that a bit more I'm now thinking that in fact the power state
> > > > > the device is in at the moment doesn't really matter, so the polling code need
> > > > > not really know what PM is doing. What it needs to know is that the device
> > > > > will generate a hardware event when something interesting happens, so it is not
> > > > > necessary to poll it.
> > > > >
> > > > > In this particular case it is related to power management (apparently, hardware
> > > > > events will only be generated after the device has been put into ACPI D3cold,
> > > > > or so Aaron seems to be claiming), but it need not be in general, at least in
> > > > > principle.
> > > > >
> > > > > It looks like we need an "event driven" flag that the can be set in the lower
> > > > > layers and read by the upper layers. I suppose this means it would need to be
> > > > > in struct device, but not necessarily in the PM-specific part of it.
> > > >
> > > > We already have that. That's what gendisk->async_events is for (as
> > > > opposed to gendisk->events). If all events are async_events, block
> > > > won't poll for events, but I'm not sure that's the golden bullet.
> > > >
> > > > * None implements async_events yet and an API is missing -
> > > > disk_check_events() - which is trivial to add, but it's the same
> > > > story. We'll need a mechanism to shoot up notification from libata
> > > > to block layer. It's admittedly easier to justify routing through
> > > > SCSI tho. So, we're mostly shifting the problem. Given that async
> > > > events is nice to have, so it isn't a bad idea.
> > >
> > > Could we drive it in the polling code? As in, if we set a flag to say
> > > we're event driven and please don't bother us, we could just respond to
> > > the poll with the last known state (this would probably have to be in
> > > SCSI somewhere since most polls are Test Unit Readys). That way ZPODD
> > > sets this flag when the device powers down and unsets it when it powers
> > > up.
> >
> > Does it mean I can do something like this:
> >
> > diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
> > index 5fc97d2..219820c 100644
> > --- a/drivers/scsi/sr.c
> > +++ b/drivers/scsi/sr.c
> > @@ -578,7 +578,10 @@ static unsigned int sr_block_check_events(struct gendisk *disk,
> > unsigned int clearing)
> > {
> > struct scsi_cd *cd = scsi_cd(disk);
> > - return cdrom_check_events(&cd->cdi, clearing);
> > + if (!cd->device->event_driven)
> > + return cdrom_check_events(&cd->cdi, clearing);
> > + else
> > + return 0;
> > }
> >
> > static int sr_block_revalidate_disk(struct gendisk *disk)
> > diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
> > index e65c62e..1756151 100644
> > --- a/include/scsi/scsi_device.h
> > +++ b/include/scsi/scsi_device.h
> > @@ -160,6 +160,7 @@ struct scsi_device {
> > unsigned can_power_off:1; /* Device supports runtime power off */
> > unsigned wce_default_on:1; /* Cache is ON by default */
> > unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
> > + unsigned event_driven:1; /* No need to poll the device */
> >
> > DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
> > struct list_head event_list; /* asserted events */
>
> Yes, but if we can get away with doing that, it should be in genhd
> because it's completely generic.
>
> I was imagining we'd have to fake the reply to the test unit ready or
> some other commands, which is why it would need to be in sr.c
>
> The check events code is Tejun's baby, if he's OK with it then just do
> it in genhd.c
I agree that it better be done in genhd, the only concern is, in that
case, this flag will need to be in struct device. I'm not sure if this
is acceptible though, since the whole events checking thing is for block
based devices only.
Ideally, it should be in struct disk_events, but I don't see a way for
libata to access that structure... so any suggestion of doing this? or
it is OK to add such a field to struct device?
Thanks,
Aaron
>
> > Then when ZPODD is powered off, it will set this flag; and unset it when
> > it is powered up.
>
> Right.
>
> James
>
>
next prev parent reply other threads:[~2012-12-03 8:59 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-09 6:51 [PATCH v9 00/10] ZPODD Patches Aaron Lu
2012-11-09 6:51 ` [PATCH v9 01/10] scsi: sr: support runtime pm Aaron Lu
2012-11-09 6:51 ` [PATCH v9 02/10] ata: zpodd: Add CONFIG_SATA_ZPODD Aaron Lu
2012-11-09 6:51 ` [PATCH v9 03/10] ata: zpodd: identify and init ZPODD devices Aaron Lu
2012-11-12 18:53 ` Tejun Heo
2012-11-14 1:32 ` Aaron Lu
2012-11-18 14:38 ` Tejun Heo
2012-11-19 2:15 ` Aaron Lu
2012-11-09 6:51 ` [PATCH v9 04/10] libata: acpi: move acpi notification code to zpodd Aaron Lu
2012-11-12 18:55 ` Tejun Heo
2012-11-14 1:36 ` Aaron Lu
2012-11-09 6:51 ` [PATCH v9 05/10] libata: separate ATAPI code Aaron Lu
2012-11-12 18:57 ` Tejun Heo
2012-11-13 12:49 ` Aaron Lu
2012-11-18 15:01 ` Tejun Heo
2012-11-19 2:21 ` Aaron Lu
2012-11-19 14:51 ` Tejun Heo
2012-11-09 6:51 ` [PATCH v9 06/10] ata: zpodd: check zero power ready status Aaron Lu
2012-11-12 19:13 ` Tejun Heo
2012-11-13 13:20 ` Aaron Lu
2012-11-14 2:18 ` Aaron Lu
2012-11-18 15:00 ` Tejun Heo
2012-11-19 3:09 ` Aaron Lu
2012-11-19 14:56 ` Tejun Heo
2012-11-19 15:06 ` James Bottomley
2012-11-26 0:33 ` Rafael J. Wysocki
2012-11-26 0:45 ` Aaron Lu
2012-11-26 5:03 ` James Bottomley
2012-11-26 5:09 ` Aaron Lu
2012-11-26 7:32 ` James Bottomley
2012-11-26 8:27 ` Aaron Lu
2012-11-26 13:17 ` James Bottomley
2012-11-26 16:21 ` Alan Stern
2012-11-26 19:15 ` James Bottomley
2012-11-27 1:41 ` Aaron Lu
2012-11-28 0:51 ` Rafael J. Wysocki
2012-11-28 1:39 ` Tejun Heo
2012-11-28 2:24 ` Aaron Lu
2012-11-28 8:56 ` James Bottomley
2012-12-03 8:13 ` Aaron Lu
2012-12-03 8:25 ` James Bottomley
2012-12-03 8:59 ` Aaron Lu [this message]
2012-12-03 16:23 ` Tejun Heo
2012-12-03 18:56 ` Jeff Garzik
2012-12-04 5:04 ` Aaron Lu
2012-12-04 12:11 ` James Bottomley
2012-12-07 6:13 ` Aaron Lu
2012-12-10 3:26 ` Aaron Lu
2012-12-11 5:10 ` Tejun Heo
2012-12-18 8:30 ` Aaron Lu
2012-12-20 6:07 ` Aaron Lu
2012-12-25 17:17 ` Tejun Heo
2012-12-26 1:42 ` Aaron Lu
2012-12-28 21:16 ` Tejun Heo
2013-01-04 1:04 ` Aaron Lu
2012-11-30 8:55 ` Aaron Lu
2012-11-30 11:15 ` Rafael J. Wysocki
2012-11-20 6:00 ` Aaron Lu
2012-11-20 8:59 ` Aaron Lu
2012-11-26 0:50 ` Rafael J. Wysocki
2012-11-26 0:48 ` Aaron Lu
2012-11-26 1:03 ` Rafael J. Wysocki
2012-11-26 1:05 ` Aaron Lu
2012-11-26 1:11 ` Rafael J. Wysocki
2012-11-26 1:09 ` Aaron Lu
2012-11-26 1:22 ` Rafael J. Wysocki
2012-11-26 1:22 ` Aaron Lu
2012-11-26 1:17 ` Aaron Lu
2012-11-09 6:51 ` [PATCH v9 07/10] block: add a new interface to block events Aaron Lu
2012-11-12 19:14 ` Tejun Heo
2012-11-12 19:18 ` Alan Stern
2012-11-12 19:21 ` Tejun Heo
2012-11-12 19:34 ` Alan Stern
2012-11-18 15:05 ` Tejun Heo
2012-11-18 17:41 ` Alan Stern
2012-11-18 21:56 ` Tejun Heo
2012-11-18 21:58 ` Tejun Heo
2012-11-18 23:28 ` Alan Stern
2012-11-18 23:35 ` Tejun Heo
2012-11-19 2:07 ` Alan Stern
2012-11-19 3:21 ` Aaron Lu
2012-11-19 14:50 ` Tejun Heo
2012-11-09 6:52 ` [PATCH v9 08/10] scsi: sr: support (un)block events Aaron Lu
2012-11-09 6:52 ` [PATCH v9 09/10] ata: zpodd: handle power transition of ODD Aaron Lu
2012-11-09 6:52 ` [PATCH v9 10/10] ata: expose pm qos flags to user space for ata device Aaron Lu
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=20121203085937.GA29898@aaronlu.sh.intel.com \
--to=aaron.lu@intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=aaron.lwe@gmail.com \
--cc=jeff.wu@amd.com \
--cc=jgarzik@pobox.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
--cc=tj@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).