All of lore.kernel.org
 help / color / mirror / Atom feed
From: "zhao, forrest" <forrest.zhao@intel.com>
To: Tejun Heo <htejun@gmail.com>
Cc: jgarzik@pobox.com, lkml@rtr.ca, axboe@suse.de,
	alan@lxorguk.ukuu.org.uk, linux-ide@vger.kernel.org
Subject: Re: [PATCH 06/10] libata: implement new Power Management framework
Date: Thu, 15 Jun 2006 09:33:41 +0800	[thread overview]
Message-ID: <1150335221.7132.71.camel@forrest26.sh.intel.com> (raw)
In-Reply-To: <44900F41.8020602@gmail.com>

On Wed, 2006-06-14 at 22:29 +0900, Tejun Heo wrote:
> zhao, forrest wrote:
> > On Tue, 2006-06-13 at 00:50 +0900, Tejun Heo wrote:
> >> + */
> >> +static void ata_eh_handle_resume(struct ata_port *ap)
> >> +{
> >> +	unsigned long flags;
> >> +	int rc = 0;
> >> +
> >> +	spin_lock_irqsave(&ap->host_set->lock, flags);
> >> +	if (!(ap->flags & ATA_FLAG_PM_PENDING) ||
> >> +	    !(ap->flags & ATA_FLAG_SUSPENDED) ||
> >> +	    ap->pm_mesg.event != PM_EVENT_ON) {
> >> +		spin_unlock_irqrestore(&ap->host_set->lock, flags);
> >> +		return;
> >> +	}
> >> +	ap->flags &= ~ATA_FLAG_PM_PENDING;
> >> +	spin_unlock_irqrestore(&ap->host_set->lock, flags);
> >> +
> >> +	if (ap->host_set->dev->power.power_state.event == PM_EVENT_SUSPEND) {
> >> +		struct ata_eh_context *ehc = &ap->eh_context;
> >> +
> >> +		ehc->i.action |= ATA_EH_SPINUP;
> >> +		ata_ehi_hotplugged(&ehc->i);
> >> +	}
> >> +
> >> +	if (ap->ops->resume)
> >> +		rc = ap->ops->resume(ap);
> >> +
> >> +	spin_lock_irqsave(&ap->host_set->lock, flags);
> >> +	ap->flags &= ~ATA_FLAG_SUSPENDED;
> >> +	ap->pm_result = rc;
> >> +	spin_unlock_irqrestore(&ap->host_set->lock, flags);
> >> +}
> > 
> > I ported AHCI suspend/resume patches against your new PM framework. At
> > first resume from memsleep took 65 seconds to go through soft-reset,
> > hard-reset; then after I removed line 
> > "if (ap->host_set->dev->power.power_state.event == PM_EVENT_SUSPEND)" in
> > ata_eh_handle_resume(), AHCI can resume from memsleep in a few seconds.
> > After inserting a printk(), I found the "ap->host_set->dev->power.
> > power_state.event" is always 0(PM_EVENT_ON).
> 
> Can you post the AHCI patch you did?  The suspend routine is supposed to 
> set power state to PM_EVENT_SUSPEND on memsleep such that resume can 
> notice it's resuming from actual suspend.

Yeah, on memsleep host_set->dev->power.power_state is set to
PM_EVENT_SUSPEND in ata_host_set_suspend(). Then during resume process,
firstly ata_host_set_resume() is called, in which host_set->dev->power.
power_state is set to PMSG_ON, then ata_eh_handle_resume() is called
later. This is the reason why ap->host_set->dev->power.power_state.event
is 0 in ata_eh_handle_resume(). This is a race condition.

Thanks,
Forrest

  reply	other threads:[~2006-06-15  1:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 15:50 [PATCHSET] new Power Management for libata Tejun Heo
2006-06-12 15:50 ` [PATCH 04/10] libata: update ata_do_simple_cmd() Tejun Heo
2006-06-12 15:50 ` [PATCH 02/10] libata: kill per-device PM Tejun Heo
2006-06-12 15:50 ` [PATCH 01/10] libata: power down controller only on PMSG_SUSPEND Tejun Heo
2006-06-12 16:32   ` Jeff Garzik
2006-06-13  2:20     ` Tejun Heo
2006-06-12 15:50 ` [PATCH 03/10] libata: move ata_do_simple_cmd() right below ata_exec_internal() Tejun Heo
2006-06-12 15:50 ` [PATCH 10/10] sata_sil24: add suspend/sleep support Tejun Heo
2006-06-12 15:50 ` [PATCH 05/10] libata: implement new EH action ATA_EH_SPINUP Tejun Heo
2006-06-14  1:18   ` Jeff Garzik
2006-06-14 15:02     ` Tejun Heo
2006-06-14 15:25       ` Alan Cox
2006-06-12 15:50 ` [PATCH 09/10] sata_sil24: separate out sil24_init_controller() Tejun Heo
2006-06-12 15:50 ` [PATCH 06/10] libata: implement new Power Management framework Tejun Heo
2006-06-12 16:34   ` Alan Cox
2006-06-13  2:08     ` Tejun Heo
2006-06-13  6:25   ` zhao, forrest
2006-06-13  8:56     ` Tejun Heo
2006-06-13 11:59       ` Jeff Garzik
2006-06-13  8:17   ` zhao, forrest
2006-06-13  9:00     ` Tejun Heo
2006-06-13  8:54       ` zhao, forrest
2006-06-13  9:15         ` Tejun Heo
2006-06-13  8:37   ` zhao, forrest
2006-06-14  7:56   ` zhao, forrest
2006-06-14 13:29     ` Tejun Heo
2006-06-15  1:33       ` zhao, forrest [this message]
2006-06-15  3:41         ` Tejun Heo
2006-06-12 15:50 ` [PATCH 08/10] sata_sil: add suspend/sleep support Tejun Heo
2006-06-12 15:50 ` [PATCH 07/10] sata_sil: separate out sil_init_controller() Tejun Heo
2006-06-12 15:57 ` [PATCHSET] new Power Management for libata Tejun Heo
2006-06-13  6:28 ` zhao, forrest
2006-06-13  9:09 ` rolled up patch for " Tejun Heo
2006-06-13 10:38   ` Jens Axboe
2006-06-19  5:46     ` Jens Axboe
2006-06-14  1:25 ` [PATCHSET] " Jeff Garzik
2006-06-14 13:46   ` Tejun Heo
2006-06-19  5:18     ` zhao, forrest
2006-06-19  8:46       ` Tejun Heo

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=1150335221.7132.71.camel@forrest26.sh.intel.com \
    --to=forrest.zhao@intel.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=axboe@suse.de \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=lkml@rtr.ca \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.