NetBSD Problem Report #46547

From www@NetBSD.org  Tue Jun  5 17:02:11 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 4D90F63BEE1
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  5 Jun 2012 17:02:11 +0000 (UTC)
Message-Id: <20120605170209.C17AD63BA27@www.NetBSD.org>
Date: Tue,  5 Jun 2012 17:02:09 +0000 (UTC)
From: nathanialsloss@yahoo.com.au
Reply-To: nathanialsloss@yahoo.com.au
To: gnats-bugs@NetBSD.org
Subject: umass: sd crashes when synchronizing cache while trying to suspend
X-Send-Pr-Version: www-1.0

>Number:         46547
>Category:       kern
>Synopsis:       umass: sd crashes when synchronizing cache while trying to suspend
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 05 17:05:00 +0000 2012
>Closed-Date:    Wed Jun 01 05:01:43 +0000 2016
>Last-Modified:  Wed Jun 01 05:01:43 +0000 2016
>Originator:     Nat Sloss
>Release:        NetBSD Current 6.99.7
>Organization:
>Environment:
NetBSD beast 6.99.7 NetBSD 6.99.7 (LOCKDEBUG) #64: Tue Jun  5 17:42:52 EST 2012  build@beast:/usr/src/sys/arch/i386/compile/obj/LOCKDEBUG i386

>Description:
If booted up from a usb flash drive and then attempting to sleep (acpi state 3) the kernel crashes whilst trying to synchronize the cache.

The following was obtained from the crash:

Flushing disk caches done.
umass generic HBA error.
sd0 cache synchronization failed.

It then drops into ddb where I obtained the following back trace:

page fault type 6 code 0 eip 0 invalid address
0:
umass_bbb_state:0x193
usb_transfer_complete:0x18a
ehci_idone:0x131
softintr...

This problem has been bugging me for a while.  It did not occur in NetBSD 5.0.1.

The usb device still has power to it whilst this occurs (there is an indicator light).

I can shutdown ok, it just crashes while attempting to suspend.

>How-To-Repeat:
Boot up from an installation on a usb flash drive and try to suspend (acpi state 3).
>Fix:

>Release-Note:

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: kern/46547: umass: sd crashes when synchronizing cache while trying to suspend
Date: Wed, 06 Jun 2012 04:06:26 +1000

 this smells like what i did to amd64 cpu_reboot() to make it not crash
 when rebooting when usb disks are present.  this ended up trying to 
 perform a sync. operation from a softint handler, which triggers
 checks in cv_wait() or tsleep

 note that i didn't say "fix".  :-(  i'm not really sure what the right
 solution here is.  can you try a kernel with LOCKDEBUG enabled and
 show us the full output?

 i did try having these events run from the USB task thread but that
 just left me with a soft-hung system at reboot.  it was about then
 that i noticed i386 and amd64 cpu_reboot() were pretty different and
 when i made amd64 like i386, i had no more crashes.  however, that
 really only happens because cpu_reboot() arranges it, not that the
 problem was actually fixed.


 .mrg.

From: Nat Sloss <nathanialsloss@yahoo.com.au>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/46547: umass: sd crashes when synchronizing cache while trying to suspend
Date: Thu, 30 Aug 2012 02:52:23 +1000

 Hi.

 Sorry for taking so long to respond.  I was trying to suspend on usb with a 
 new usb flash drive and a new laptop.

 I was running a i386 build so changes relating to amd64 should not apply 
 hopefully and I was running a lockdebug kernel no messages about locks or 
 condvars, no messages from lockdebug at all.

 I did manage to fix it by adding my usbkey to the quirks file.

 Here are my patches:

 Index: usb/usbdevs
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
 retrieving revision 1.622
 diff -u -r1.622 usbdevs
 --- usb/usbdevs 31 May 2012 12:29:15 -0000      1.622
 +++ usb/usbdevs 29 Aug 2012 16:50:05 -0000
 @@ -2603,6 +2603,7 @@
  product SANDISK SDDR09         0x0200  ImageMate SDDR-09
  product SANDISK SDDR86         0x0621  ImageMate SDDR-86
  product SANDISK SDDR75         0x0810  ImageMate SDDR-75
 +product SANDISK CRUZER         0x5530  Cruzer
  product SANDISK SANSA_CLIP     0x7433  Sansa Clip

  /* Sanwa Supply products */

 ===================================================================
 RCS file: /cvsroot/src/sys/dev/usb/umass_quirks.c,v
 retrieving revision 1.93
 diff -u -r1.93 umass_quirks.c
 --- usb/umass_quirks.c  3 Mar 2012 21:35:32 -0000       1.93
 +++ usb/umass_quirks.c  29 Aug 2012 16:52:32 -0000
 @@ -274,6 +274,17 @@
         },

         /*
 +        * SanDisk Cruzer rejects cache sync.
 +        */
 +       { { USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_CRUZER },
 +         UMASS_WPROTO_UNSPEC, UMASS_CPROTO_UNSPEC,
 +         0,
 +         PQUIRK_NOSYNCCACHE,
 +         UMATCH_VENDOR_PRODUCT,
 +         NULL, NULL
 +       },
 +
 +       /*
          * SanDisk Sansa Clip rejects cache sync in unconventional way.
          * However, unlike some other devices listed in this table,
          * this is does not cause the device firmware to stop responding.

 Note:  These patches are my own work which I submit under the NetBSD license.

 This fixed the problem and it sleeps, but usb power is lost whilst sleeping so 
 the drive detaches and attaches upon resuming it would be good if drives were 
 unmounted when entering sleep and remounted as they are reattached after 
 resuming.

 Regards,

 Nat.

From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46547 CVS commit: src/sys/dev/usb
Date: Wed, 1 Jun 2016 04:47:02 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Wed Jun  1 04:47:02 UTC 2016

 Modified Files:
 	src/sys/dev/usb: usbdevs

 Log Message:
 Add Sandisk Cruzer - from PR kern/46547


 To generate a diff of this commit:
 cvs rdiff -u -r1.714 -r1.715 src/sys/dev/usb/usbdevs

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46547 CVS commit: src/sys/dev/usb
Date: Wed, 1 Jun 2016 04:54:59 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Wed Jun  1 04:54:59 UTC 2016

 Modified Files:
 	src/sys/dev/usb: umass_quirks.c

 Log Message:
 Add quick for Sandisk Cruzer - from PR kern/46547


 To generate a diff of this commit:
 cvs rdiff -u -r1.97 -r1.98 src/sys/dev/usb/umass_quirks.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Wed, 01 Jun 2016 05:01:43 +0000
State-Changed-Why:
USB quirk added to avoid failing cache-sync operation.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.