All of lore.kernel.org
 help / color / mirror / Atom feed
* Stop SSD from waiting for "Spinning up disk..."
@ 2015-06-22  7:25 Jeff Chua
  2015-06-22 15:36 ` Greg Kroah-Hartman
  2015-06-25 16:21 ` Henrique de Moraes Holschuh
  0 siblings, 2 replies; 15+ messages in thread
From: Jeff Chua @ 2015-06-22  7:25 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Christoph Hellwig, Greg Kroah-Hartman


There's no need to wait for disk spin-up for USB SSD devices. This 
patch allow the SSD to skip waiting disk spin-up by passing sd_mod.ssd=1 
during boot-up.

If there's a better way to handle this, please share.


Thanks,
Jeff

--- linux/drivers/scsi/sd.c	2015-05-25 07:29:44.000000000 +0800
+++ linux/drivers/scsi/sd.c	2015-06-19 22:17:35.000000000 +0800
@@ -92,6 +92,9 @@
     MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
     MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);

+static int ssd = 0;
+module_param(ssd, int, 0);
+
     #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT)
     #define SD_MINORS	16
     #else
@@ -2738,7 +2741,9 @@
     		goto out;
     	}

-	sd_spinup_disk(sdkp);
+	sd_printk(KERN_NOTICE, sdkp, "ssd %s\n", ssd == 0 ? "off" : "on");
+	if(!ssd)
+		sd_spinup_disk(sdkp);

     	/*
     	 * Without media there is no reason to ask; moreover, some devices
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Stop SSD from waiting for "Spinning up disk..."
@ 2015-06-23 18:26 Andreas Mohr
  2015-06-23 18:55 ` Martin Steigerwald
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Mohr @ 2015-06-23 18:26 UTC (permalink / raw)
  To: Jeff Chua; +Cc: Greg Kroah-Hartman, linux-kernel, Christoph Hellwig

Hi,

[proper In-Reply-To trail missing since lkml.org now fails to provide it]

> On Mon, Jun 22, 2015 at 11:36 PM, Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Mon, Jun 22, 2015 at 03:25:29PM +0800, Jeff Chua wrote:
> >>
> >> There's no need to wait for disk spin-up for USB SSD devices. This
> >> patch
> >> allow the SSD to skip waiting disk spin-up by passing sd_mod.ssd=1
> >> during
> >> boot-up.
> >>
> >> If there's a better way to handle this, please share.
> >
> > Module parameters are never a solution for a device-specific property,
> > sorry.

This statement, while somewhat harsh, seems about correct,
from a data attribute structure/organization POV.

> 
> Greg,
> 
> SSD is coming mainstream and it doesn't make sense wasting time
> spinning up "disk" ...

...which probably is not truly being achieved
by providing a *custom* kernel parameter
which does apply to only those disk instances
which some users *specifically* care about.

Some things come to mind:

- at this scope, generally spoken
  one shouldn't be concerned with whether "we are SSD",
  but rather whether "we (do not) need spinup"
  (which might apply to a ton of different SCSI-based storage devices,
  even some SAN-based platter-based ones)
  *This* is what this is about
  (and this could then have been reflected in kernel parameter naming)

- AFAIR SCSI mode info pages might contain hints
  as to whether a disk is "rotating"
  (but possibly these are not fully reliably accessible pre-spinup,
  and mode info page content probably is unreliable, too)

- projects such as smartmontools might be able to provide some hints
  as to how to reliably detect *certain* non-rotating types (i.e., SSD)

- the kernel must already have some mechanisms to discern between (non-)platters
  (e.g. perhaps for knowing whether to support SSD TRIM command)

- if we want to avoid doing spinup handling (I guess we do),
  then that handling should be implemented *within* the function
  that is doing that (sd_spinup_disk(),
  or perhaps an outer wrapper of it, sd_try_spinup_disk())
  rather than at one specific callsite of that function only
  (think sd_spinup_disk() *will* be allowed to "pretend" a "success" result
  for all storage types which simply do not need spinup)

- finally, it might be questionable *why* (whether) at certain points
  we currently need (decide) to do spinup requests -
  I guess it's in order to ensure in advance
  that the disk will be ready once it actually will be needed, or so

Thank you very much for having come up with this issue & HTH,

Andreas Mohr

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-06-25 16:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22  7:25 Stop SSD from waiting for "Spinning up disk..." Jeff Chua
2015-06-22 15:36 ` Greg Kroah-Hartman
2015-06-23 15:02   ` Jeff Chua
2015-06-23 18:27     ` Frans Klaver
2015-06-23 18:51     ` Marc Burkhardt
2015-06-25 16:21 ` Henrique de Moraes Holschuh
2015-06-25 16:47   ` Joe Perches
2015-06-23 18:26 Andreas Mohr
2015-06-23 18:55 ` Martin Steigerwald
2015-06-24 16:22   ` Jeff Chua
2015-06-24 16:28     ` Greg Kroah-Hartman
2015-06-24 23:55       ` Jeff Chua
2015-06-25  1:41         ` Greg Kroah-Hartman
2015-06-25  6:08           ` Martin Steigerwald
2015-06-25  8:52             ` Jeff Chua

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.