From: James Bottomley Subject: Re: [PATCH 1/2] scsi: sd: set ready_to_power_off for scsi disk Date: Thu, 13 Sep 2012 09:37:46 +0100 Message-ID: <1347525466.2720.10.camel@dabdike.int.hansenpartnership.com> References: <1347522049-1836-1-git-send-email-aaron.lu@intel.com> <1347522049-1836-2-git-send-email-aaron.lu@intel.com> <1347524092.2720.1.camel@dabdike.int.hansenpartnership.com> <50519801.6080502@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <50519801.6080502@intel.com> Sender: linux-scsi-owner@vger.kernel.org To: Aaron Lu Cc: Alan Stern , Jeff Garzik , Aaron Lu , Jack Wang , Shane Huang , Oliver Neukum , linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org, linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org List-Id: linux-acpi@vger.kernel.org On Thu, 2012-09-13 at 16:23 +0800, Aaron Lu wrote: > On 09/13/2012 04:14 PM, James Bottomley wrote: > > On Thu, 2012-09-13 at 15:40 +0800, Aaron Lu wrote: > >> The ready_to_power_off flag is used to give indication to ATA layer > >> if this device's power can be removed when runtime suspended. > >> > >> This flag is determined by individual SCSI driver like sr, sd. > >> > >> This flag is introduced to support zero power ODD. When ODD > >> is runtime suspended, it may not be OK to remove its power. > >> > >> But for disk, it is always OK to be powered off, so set this flag. > > > > It is? I may have missed this, but where do you flush the cache of write > > back cache devices you're about to power off? > > I suppose that is handled in sd_suspend callback, the power off happens > after a device is runtime suspended. Well that would mean something is wrong somewhere: For runtime power management using idle timers and forced standby, there's no need to flush the cache (if the drive goes into standby on its own as a result of an idle timeout, the cache will never flush). The cache needs to flush before we power off the device: that's before the system goes into S3, or now before you power it off at runtime. Flushing the cache on runtime transitions to standby will likely cause performance problems since that happens quite often. James