From nobody@FreeBSD.org  Sat Aug 25 03:30:17 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 616E216A418
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 25 Aug 2007 03:30:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 536B513C469
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 25 Aug 2007 03:30:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l7P3UHEO037002
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 25 Aug 2007 03:30:17 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l7P3UHFF037001;
	Sat, 25 Aug 2007 03:30:17 GMT
	(envelope-from nobody)
Message-Id: <200708250330.l7P3UHFF037001@www.freebsd.org>
Date: Sat, 25 Aug 2007 03:30:17 GMT
From: Arthur Hartwig <arthur.hartwig@nokia.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Writing of crash dumps is unreliable
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         115801
>Category:       kern
>Synopsis:       [ata] [patch] Writing of crash dumps is unreliable
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mav
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 25 03:40:01 GMT 2007
>Closed-Date:    Mon Mar 09 20:39:03 UTC 2009
>Last-Modified:  Mon Mar 09 20:39:03 UTC 2009
>Originator:     Arthur Hartwig
>Release:        6.2
>Organization:
Nokia
>Environment:
>Description:
In ata_start() in ata-queue.c if the variable dumping is non-zero the
code loops calling ata_interrupt() until it returns non-zero. Unfortunately
it is possible for hardware interrupt to occur while in this loop and
process the completion with the consequence that the completion is not
seen in the loop in ata_start().






>How-To-Repeat:

>Fix:
Suggested fix: On initiating a dump, remove the device interrupt handler
to ensure that ata_interrupt() is not called as a consequence of a hardware
interrupt while in the afore mentioned loop in ata_start(). Note it is not
sufficient to disable interrupts on the device because the device interrupt
line might be shared by other devices (particularly true with recent Intel
chipsets) and the ATA interrupt handler will be called when other devices
interrupt. This fix has proved reliable on a number of systems based on
Intel E7520 and P5000 chipsets.

In ad_dump() in ata-disk.c, change 
*** 953,963 ****
--- 953,975 ----
  ad_dump(void *arg, void *virtual, vm_offset_t physical,
        off_t offset, size_t length)
  {
      struct disk *dp = arg;
      struct bio bp;
+     static int first_call = 1;
+     int ret;

+
+     if (first_call) {
+       device_t dev = device_get_parent((device_t)(dp->d_drv1));
+       struct ata_channel *ch = device_get_softc(dev);
+
+       if ((ret = bus_teardown_intr(dev, ch->r_irq, ch->ih))) {
+               printf("Failed to deregister interrupt handler: %d\n", ret);
+       }
+       first_call--;
+     }
      /* length zero is special and really means flush buffers to media */
      if (!length) {
        struct ata_device *atadev = device_get_softc(dp->d_drv1);
        int error = 0;



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Aug 25 22:01:26 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115801 

From: "Dorr H. Clark" <dclark@engr.scu.edu>
To: bug-followup@FreeBSD.org
Cc: yrao@force10networks.com, Arthur Hartwig <Arthur.Hartwig@nokia.com>,
        smp@FreeBSD.org, bugs@FreeBSD.org, dclark@applmath.scu.edu,
        Free BSD <freebsd@the-irc.org>
Subject: Re: kern/115801: [ata] [patch] Writing of crash dumps is unreliable
Date: Tue, 20 May 2008 18:49:01 -0700 (PDT)

 We believe that this bug is a duplicate of 114370, based on experimental
 results.
 
 Please see 114370 for more details.
 
 Thanks,
 
 Chitti Nimmagadda
 Engineer
 
 Dorr H. Clark
 Advisor
 
 Graduate School of Engineering
 Santa Clara University
 Santa Clara, CA
  
 
State-Changed-From-To: open->patched 
State-Changed-By: mav 
State-Changed-When: Mon Feb 16 22:33:35 UTC 2009 
State-Changed-Why:  
Alternative patch committed to -CURRENT. 


Responsible-Changed-From-To: sos->mav 
Responsible-Changed-By: mav 
Responsible-Changed-When: Mon Feb 16 22:33:35 UTC 2009 
Responsible-Changed-Why:  
Alternative patch committed to -CURRENT. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115801 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/115801: commit references a PR
Date: Tue,  3 Mar 2009 08:15:04 +0000 (UTC)

 Author: mav
 Date: Tue Mar  3 08:14:43 2009
 New Revision: 189299
 URL: http://svn.freebsd.org/changeset/base/189299
 
 Log:
   MFC rev. 188700, 188731, 188733.
   
   Make core dumping to ad not to freeze even if interrupts, not disabled
   for some reason (noticed on SMP), stealing our events.
   
   ata_interrupt() does not need to return anything. It is not it's business
   to report request completion, expecially when it is not reliable.
   
   PR:		kern/114370, kern/115801
 
 Modified:
   stable/7/sys/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
   stable/7/sys/dev/ata/ata-all.c
   stable/7/sys/dev/ata/ata-all.h
   stable/7/sys/dev/ata/ata-queue.c
   stable/7/sys/dev/ath/ath_hal/   (props changed)
   stable/7/sys/dev/cxgb/   (props changed)
 
 Modified: stable/7/sys/dev/ata/ata-all.c
 ==============================================================================
 --- stable/7/sys/dev/ata/ata-all.c	Tue Mar  3 07:58:01 2009	(r189298)
 +++ stable/7/sys/dev/ata/ata-all.c	Tue Mar  3 08:14:43 2009	(r189299)
 @@ -140,7 +140,7 @@ ata_attach(device_t dev)
  	return ENXIO;
      }
      if ((error = bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL,
 -				(driver_intr_t *)ata_interrupt, ch, &ch->ih))) {
 +				ata_interrupt, ch, &ch->ih))) {
  	device_printf(dev, "unable to setup interrupt\n");
  	return error;
      }
 @@ -312,7 +312,7 @@ ata_resume(device_t dev)
      return error;
  }
  
 -int
 +void
  ata_interrupt(void *data)
  {
      struct ata_channel *ch = (struct ata_channel *)data;
 @@ -347,11 +347,10 @@ ata_interrupt(void *data)
  	    mtx_unlock(&ch->state_mtx);
  	    ATA_LOCKING(ch->dev, ATA_LF_UNLOCK);
  	    ata_finish(request);
 -	    return 1;
 +	    return;
  	}
      } while (0);
      mtx_unlock(&ch->state_mtx);
 -    return 0;
  }
  
  /*
 
 Modified: stable/7/sys/dev/ata/ata-all.h
 ==============================================================================
 --- stable/7/sys/dev/ata/ata-all.h	Tue Mar  3 07:58:01 2009	(r189298)
 +++ stable/7/sys/dev/ata/ata-all.h	Tue Mar  3 08:14:43 2009	(r189299)
 @@ -534,7 +534,7 @@ int ata_detach(device_t dev);
  int ata_reinit(device_t dev);
  int ata_suspend(device_t dev);
  int ata_resume(device_t dev);
 -int ata_interrupt(void *data);
 +void ata_interrupt(void *data);
  int ata_device_ioctl(device_t dev, u_long cmd, caddr_t data);
  int ata_identify(device_t dev);
  void ata_default_registers(device_t dev);
 
 Modified: stable/7/sys/dev/ata/ata-queue.c
 ==============================================================================
 --- stable/7/sys/dev/ata/ata-queue.c	Tue Mar  3 07:58:01 2009	(r189298)
 +++ stable/7/sys/dev/ata/ata-queue.c	Tue Mar  3 08:14:43 2009	(r189299)
 @@ -214,8 +214,10 @@ ata_start(device_t dev)
  		if (dumping) {
  		    mtx_unlock(&ch->state_mtx);
  		    mtx_unlock(&ch->queue_mtx);
 -		    while (!ata_interrupt(ch))
 +		    while (ch->running) {
 +			ata_interrupt(ch);
  			DELAY(10);
 +		    }
  		    return;
  		}       
  	    }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: mav 
State-Changed-When: Mon Mar 9 20:37:57 UTC 2009 
State-Changed-Why:  
Patch merged to 7-STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115801 
>Unformatted:
