Re: ata_dmasetup: transfer active on this device!

2003-10-27 Thread David Schultz
On Mon, Oct 27, 2003, Robert Watson wrote:
> 
> Bumped into this panic on a kernel from Oct 4 running on my notebook. 
> Unfortunately, I don't have a good trace because I didn't have access to a
> serial console, or a debugging kernel :-(.  It might well already be
> fixed, but I figured I'd post about it just in case.  Basically, I was
> shutting down my notebook, and did a "shutdown -p NOW".  During the
> shutdown, the system panicked. 
> 
> panic: ata_dmasetup: transfer active on this device!
> ...
> ata_dmastart+0x26
> ata_pci_dmastart+0x29
> ata_transaction+0x999
> ata_start+0x1c9
> ata_completed+0x230
> taskqueue_run+...

I have had this problem since the day ATAng was committed.  I last
verified that it was still an issue about two weeks ago, but I'm
reluctant to continue testing on my main machine (the only one
that triggers the bug) because it leads to random data corruption.

The configuration that *consistently* produces this bug within
five minutes of operation involves two 36GB SATA disks mirrored
with ccd(4).  My best guess is that there's a race in the ATAng
code that is exacerbated by ccd(4).  By brief inspection, it
appears that there are a number of problems with the locking.  For
instance, ata_interrupt() does an ATA_UNLOCK_CH() with no matching
ATA_LOCK_CH().  (This is not detected by witness because ATAng
uses its own locking primitives, which have sleep/wakeup races
among other things...)  Unfortunately, I don't understand the code
well enough to fix it and I don't have the time to understand it.
If you ever find that this problem has gone away, please let me
know so I can sync the ATA driver in my tree.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


ata_dmasetup: transfer active on this device!

2003-10-27 Thread Robert Watson

Bumped into this panic on a kernel from Oct 4 running on my notebook. 
Unfortunately, I don't have a good trace because I didn't have access to a
serial console, or a debugging kernel :-(.  It might well already be
fixed, but I figured I'd post about it just in case.  Basically, I was
shutting down my notebook, and did a "shutdown -p NOW".  During the
shutdown, the system panicked. 

panic: ata_dmasetup: transfer active on this device!
...
ata_dmastart+0x26
ata_pci_dmastart+0x29
ata_transaction+0x999
ata_start+0x1c9
ata_completed+0x230
taskqueue_run+...

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Network Associates Laboratories

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


ATAng panic: ata_dmasetup: transfer active on this device!

2003-09-02 Thread David Schultz
I have a machine that panics reliably within ten minutes of
operation with ATAng.  It subsequently locks up, so I can't obtain
a dump, and I get a small amount of random filesystem corruption
upon rebooting.  Everything was fine with ATAog.

I don't have a serial cable handy at the moment, but the DDB
traceback looks like this:

    panic: ata_dmasetup: transfer active on this device!
cpuid = 0
[...]
panic [...]
ata_dmastart(d3075000,4000,0,101) [...]
ata_pci_dmastart(d3075000,4000,0,20) [...]
ata_transaction [...]
ata_start [...]
ata_completed [...]
taskq_run [...]
[...]

I can attach a serial cable and get some more information if
necessary.  The dual-processor machine in question has one 200GB
UATA 100 drive attached to ad0 and two 36GB SATA drives on ad4 and
ad6, mirrored through ccd(4).
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: panic: ata_dmasetup: transfer active on this device!

2003-03-05 Thread Yann Berthier
On Wed, 05 Mar 2003, Ruslan Ermilov wrote:

> A known issue.  Soren is working on that.

   Ok, I knew in fact that Soren was working on that. What strikes me is
   that, from what i see, the situation degrades from kernel to kernel.
   So I posted a backtrace in case of an interaction with other recent
   commits, beside Soren's work, not yet known

   But anyway, I will wait patiently until this issue is eradicated :)

   Thanks,

  - yann

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: panic: ata_dmasetup: transfer active on this device!

2003-03-05 Thread Ruslan Ermilov
A known issue.  Soren is working on that.

On Wed, Mar 05, 2003 at 10:14:34AM +0100, Yann Berthier wrote:
> 
>Hello,
> 
>My laptop freeze *systematically* while resuming from suspend mode
>(ACPI) with recent (as of yesterday) kernels. I experienced the same
>problem with old (January 25th) kernels, but only from time to time
>(once every 3-5 times I would say)
> 
>PS: there is no disk activity when i suspend the laptop (in the sense
>of: the disk led is off, and i stop all disk consuming activities).
>But seeing the panic message, it seems this is not actually true ;-)
>PPS: my world is not in sync with the new kernel, i'm a bit reluctant
>to sync with a kernel no more being able to resume. But perhaps this
>is the root of my problem
> 
>Anybody else experiencing that ?
> 
>Here is a backtrace:
> 
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i386-undermydesk-freebsd"...
> panic: bdwrite: buffer is not busy
> panic messages:
> ---
> panic: ata_dmasetup: transfer active on this device!
> 
> syncing disks, buffers remaining... panic: bdwrite: buffer is not busy
> Uptime: 3h16m31s
> Dumping 255 MB
> ata0: resetting devices ..
> done
>  16 32 48 64 80 96 112 128 144 160 176 192 208 224 240
> ---
> #0  doadump () at /usr/src/sys/kern/kern_shutdown.c:239
> 239   dumping++;
> (kgdb) where
> #0  doadump () at /usr/src/sys/kern/kern_shutdown.c:239
> #1  0xc02b6222 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:371
> #2  0xc02b6483 in panic () at /usr/src/sys/kern/kern_shutdown.c:542
> #3  0xc02fc43d in bdwrite (bp=0xc767d580) at /usr/src/sys/kern/vfs_bio.c:994
> #4  0xc03b85e1 in ffs_update (vp=0xc28af920, waitfor=0)
> at /usr/src/sys/ufs/ffs/ffs_inode.c:125
> #5  0xc03cdaef in ffs_fsync (ap=0xcd17dac8)
> at /usr/src/sys/ufs/ffs/ffs_vnops.c:314
> #6  0xc03cca47 in ffs_sync (mp=0xc2731000, waitfor=2, cred=0xc0eb2e80, 
> td=0xc04dd680) at vnode_if.h:612
> #7  0xc031269b in sync (td=0xc04dd680, uap=0x0)
> at /usr/src/sys/kern/vfs_syscalls.c:138
> #8  0xc02b5e0c in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:280
> #9  0xc02b6483 in panic () at /usr/src/sys/kern/kern_shutdown.c:542
> #10 0xc019c763 in ata_dmastart (atadev=0x0, data=0x0, count=0, dir=0)
> at /usr/src/sys/dev/ata/ata-dma.c:254
> #11 0xc019da21 in ad_transfer (request=0xc265e600)
> at /usr/src/sys/dev/ata/ata-disk.c:494
> #12 0xc018f569 in ata_start (ch=0xc2602300) at /usr/src/sys/dev/ata/ata-all.c:678
> #13 0xc019d3b2 in adstrategy (bp=0x0) at /usr/src/sys/dev/ata/ata-disk.c:300
> #14 0xc027b0dc in g_disk_start (bp=0xc2a1b000)
> at /usr/src/sys/geom/geom_disk.c:225
> #15 0xc027deb6 in g_io_schedule_down (tp=0xc0ec8000)
> at /usr/src/sys/geom/geom_io.c:427
> #16 0xc027e338 in g_down_procbody () at /usr/src/sys/geom/geom_kern.c:111
> #17 0xc02a0fd3 in fork_exit (callout=0xc027e310 , arg=0x0, 
> frame=0x0) at /usr/src/sys/kern/kern_fork.c:871
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message

-- 
Ruslan Ermilov  Sysadmin and DBA,
[EMAIL PROTECTED]   Sunbay Software AG,
[EMAIL PROTECTED]   FreeBSD committer,
+380.652.512.251Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age


pgp0.pgp
Description: PGP signature


panic: ata_dmasetup: transfer active on this device!

2003-03-05 Thread Yann Berthier

   Hello,

   My laptop freeze *systematically* while resuming from suspend mode
   (ACPI) with recent (as of yesterday) kernels. I experienced the same
   problem with old (January 25th) kernels, but only from time to time
   (once every 3-5 times I would say)

   PS: there is no disk activity when i suspend the laptop (in the sense
   of: the disk led is off, and i stop all disk consuming activities).
   But seeing the panic message, it seems this is not actually true ;-)
   PPS: my world is not in sync with the new kernel, i'm a bit reluctant
   to sync with a kernel no more being able to resume. But perhaps this
   is the root of my problem

   Anybody else experiencing that ?

   Here is a backtrace:

Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-undermydesk-freebsd"...
panic: bdwrite: buffer is not busy
panic messages:
---
panic: ata_dmasetup: transfer active on this device!

syncing disks, buffers remaining... panic: bdwrite: buffer is not busy
Uptime: 3h16m31s
Dumping 255 MB
ata0: resetting devices ..
done
 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240
---
#0  doadump () at /usr/src/sys/kern/kern_shutdown.c:239
239 dumping++;
(kgdb) where
#0  doadump () at /usr/src/sys/kern/kern_shutdown.c:239
#1  0xc02b6222 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:371
#2  0xc02b6483 in panic () at /usr/src/sys/kern/kern_shutdown.c:542
#3  0xc02fc43d in bdwrite (bp=0xc767d580) at /usr/src/sys/kern/vfs_bio.c:994
#4  0xc03b85e1 in ffs_update (vp=0xc28af920, waitfor=0)
at /usr/src/sys/ufs/ffs/ffs_inode.c:125
#5  0xc03cdaef in ffs_fsync (ap=0xcd17dac8)
at /usr/src/sys/ufs/ffs/ffs_vnops.c:314
#6  0xc03cca47 in ffs_sync (mp=0xc2731000, waitfor=2, cred=0xc0eb2e80, 
td=0xc04dd680) at vnode_if.h:612
#7  0xc031269b in sync (td=0xc04dd680, uap=0x0)
at /usr/src/sys/kern/vfs_syscalls.c:138
#8  0xc02b5e0c in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:280
#9  0xc02b6483 in panic () at /usr/src/sys/kern/kern_shutdown.c:542
#10 0xc019c763 in ata_dmastart (atadev=0x0, data=0x0, count=0, dir=0)
at /usr/src/sys/dev/ata/ata-dma.c:254
#11 0xc019da21 in ad_transfer (request=0xc265e600)
at /usr/src/sys/dev/ata/ata-disk.c:494
#12 0xc018f569 in ata_start (ch=0xc2602300) at /usr/src/sys/dev/ata/ata-all.c:678
#13 0xc019d3b2 in adstrategy (bp=0x0) at /usr/src/sys/dev/ata/ata-disk.c:300
#14 0xc027b0dc in g_disk_start (bp=0xc2a1b000)
at /usr/src/sys/geom/geom_disk.c:225
#15 0xc027deb6 in g_io_schedule_down (tp=0xc0ec8000)
at /usr/src/sys/geom/geom_io.c:427
#16 0xc027e338 in g_down_procbody () at /usr/src/sys/geom/geom_kern.c:111
#17 0xc02a0fd3 in fork_exit (callout=0xc027e310 , arg=0x0, 
frame=0x0) at /usr/src/sys/kern/kern_fork.c:871

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: panic: ata_dmasetup: transfer active on this device!

2002-12-04 Thread Soeren Schmidt
It seems Ian Dowse wrote:
> 
> Hi Søren,
> 
> I get the above panic every few days when resuming, especially if
> the disk was active while the laptop was suspending - it's easy to
> reproduce by starting some disk-intensive activity and then hitting
> the suspend button. I see that IWASAKI-san posted patches for this
> a few months ago - do you have any plans to incorporate his work?

Uhm, its somewhere on my list, but IIRC there was something not quite
right with that patch, I'll underline it on my whiteboard :)

-Søren

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



panic: ata_dmasetup: transfer active on this device!

2002-12-03 Thread Ian Dowse

Hi Søren,

I get the above panic every few days when resuming, especially if
the disk was active while the laptop was suspending - it's easy to
reproduce by starting some disk-intensive activity and then hitting
the suspend button. I see that IWASAKI-san posted patches for this
a few months ago - do you have any plans to incorporate his work?


http://docs.freebsd.org/cgi/getmsg.cgi?fetch=814727+0+archive/2002/freebsd-current/20020908.freebsd-current

http://docs.freebsd.org/cgi/getmsg.cgi?fetch=822137+0+archive/2002/freebsd-current/20020908.freebsd-current

ata0: resetting devices ..
done
ata1: resetting devices ..
done
panic: ata_dmasetup: transfer active on this device!

Ian

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: [PATCH] 'ata_dmasetup: transfer active on this device!' problem on resume

2002-09-05 Thread Hajimu UMEMOTO

Hi,

>>> Thu, 05 Sep 2002 11:40:39 +0900 (JST),
>>> Mitsuru IWASAKI <[EMAIL PROTECTED]> said:

iwasaki> My patches will do those things during suspend time;
iwasaki>  - wait for DMA transfer completion if it is on the way.
iwasaki>  - cancel new requests (yes, it's possible even during suspend
iwasaki>time) for ATA disks and remain them in ATA queue.

Oh, it's great.  My problem was gone.  Thanks!

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
[EMAIL PROTECTED]  [EMAIL PROTECTED]  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: [PATCH] 'ata_dmasetup: transfer active on this device!'problem on resume

2002-09-04 Thread Mitsuru IWASAKI

Sorry, typo...

> @@ -674,6 +712,20 @@
>   ad_start(&ch->device[MASTER]);
>   if (ch->devices & (ATA_ATA_SLAVE) && ch->device[SLAVE].driver)
>   ad_start(&ch->device[SLAVE]);
> +}
> +if (ch->devices & (ATA_ATA_MASTER) && ch->device[MASTER].driver) {
> + if (ch->device[MASTER].suspended && ch->device[MASTER].mode >= ATA_DMA) {
> + printf("%s: going to suspend, ignoring.\n", __func__);
> + splx(s);
> + return;
> +  }
> +}
> +if (ch->devices & (ATA_ATA_SLAVE) && ch->device[SLAVE].driver) {
> + if (ch->device[SLAVE].suspended && ch->device[MASTER].mode >= ATA_DMA) {
  ^^^ SLAVE

Thanks

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



[PATCH] 'ata_dmasetup: transfer active on this device!' problem onresume

2002-09-04 Thread Mitsuru IWASAKI

Hi, Soren.  I got panics with 'ata_dmasetup: transfer active on this
device!' on resume, and have made patches for this.
Problem was that certain process is accessing ATA disk via DMA
transfer on suspend, however the transfer was not completed in most cases,
then ata_dmastart() (called by ata_reinit()) got panic on resume.

My patches will do those things during suspend time;
 - wait for DMA transfer completion if it is on the way.
 - cancel new requests (yes, it's possible even during suspend
   time) for ATA disks and remain them in ATA queue.

Could you review the patches and commit them if OK?

Thanks

Index: ata-all.c
===
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.153
diff -u -r1.153 ata-all.c
--- ata-all.c   9 Aug 2002 20:51:53 -   1.153
+++ ata-all.c   4 Sep 2002 10:21:22 -
@@ -279,8 +279,46 @@
 }
 
 int
+ata_suspend(device_t dev)
+{
+struct ata_channel *ch;
+
+ch = device_get_softc(dev);
+
+#ifdef DEV_ATADISK
+if (ch->devices & ATA_ATA_MASTER && ch->device[MASTER].driver) {
+   ch->device[MASTER].suspended = 1;
+   if (ch->device[MASTER].mode >= ATA_DMA) {
+   ata_waitdmadone(&ch->device[MASTER]);
+   }
+}
+if (ch->devices & ATA_ATA_SLAVE && ch->device[SLAVE].driver) {
+   ch->device[SLAVE].suspended = 1;
+   if (ch->device[SLAVE].mode >= ATA_DMA) {
+   ata_waitdmadone(&ch->device[SLAVE]);
+   }
+}
+#endif
+
+return 0;
+}
+
+int
 ata_resume(device_t dev)
 {
+struct ata_channel *ch;
+
+ch = device_get_softc(dev);
+
+#ifdef DEV_ATADISK
+if (ch->devices & ATA_ATA_MASTER && ch->device[MASTER].driver) {
+   ch->device[MASTER].suspended = 0;
+}
+if (ch->devices & ATA_ATA_SLAVE && ch->device[SLAVE].driver) {
+   ch->device[SLAVE].suspended = 0;
+}
+#endif
+
 return ata_reinit(device_get_softc(dev));
 }
 
@@ -674,6 +712,20 @@
ad_start(&ch->device[MASTER]);
if (ch->devices & (ATA_ATA_SLAVE) && ch->device[SLAVE].driver)
ad_start(&ch->device[SLAVE]);
+}
+if (ch->devices & (ATA_ATA_MASTER) && ch->device[MASTER].driver) {
+   if (ch->device[MASTER].suspended && ch->device[MASTER].mode >= ATA_DMA) {
+   printf("%s: going to suspend, ignoring.\n", __func__);
+   splx(s);
+   return;
+}
+}
+if (ch->devices & (ATA_ATA_SLAVE) && ch->device[SLAVE].driver) {
+   if (ch->device[SLAVE].suspended && ch->device[MASTER].mode >= ATA_DMA) {
+   printf("%s: going to suspend, ignoring.\n", __func__);
+   splx(s);
+   return;
+}
 }
 if ((ad_request = TAILQ_FIRST(&ch->ata_queue))) {
TAILQ_REMOVE(&ch->ata_queue, ad_request, chain);
Index: ata-all.h
===
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.h,v
retrieving revision 1.53
diff -u -r1.53 ata-all.h
--- ata-all.h   18 Apr 2002 19:11:43 -  1.53
+++ ata-all.h   4 Sep 2002 06:25:24 -
@@ -189,6 +189,7 @@
 intcmd;/* last cmd executed */
 void   *result;/* misc data */
 struct ata_dmastatedmastate;   /* dma state */
+intsuspended;  /* 0 = normal  1 = suspended */
 };
 
 /* structure describing an ATA channel */
@@ -252,6 +253,7 @@
 int ata_probe(device_t);
 int ata_attach(device_t);
 int ata_detach(device_t);
+int ata_suspend(device_t);
 int ata_resume(device_t);
 
 void ata_start(struct ata_channel *);
@@ -280,6 +282,7 @@
 int ata_dmasetup(struct ata_device *, caddr_t, int32_t);
 int ata_dmastart(struct ata_device *, caddr_t, int32_t, int);
 int ata_dmastatus(struct ata_channel *);
+void ata_waitdmadone(struct ata_device *);
 int ata_dmadone(struct ata_device *);
 
 /* macros for locking a channel */
Index: ata-dma.c
===
RCS file: /home/ncvs/src/sys/dev/ata/ata-dma.c,v
retrieving revision 1.100
diff -u -r1.100 ata-dma.c
--- ata-dma.c   19 Jul 2002 22:14:54 -  1.100
+++ ata-dma.c   4 Sep 2002 11:15:50 -
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include  
@@ -1284,8 +1285,11 @@
 struct ata_dmastate *ds = &atadev->dmastate;
 struct ata_dmasetup_data_cb_args cba;
 
-if (ds->flags & ATA_DS_ACTIVE)
-   panic("ata_dmasetup: transfer active on this device!");
+if (ds->flags & ATA_DS_ACTIVE) {
+   printf("ata_dmastart: transfer active on this device!\n");
+   Debugger("ata_dmastart&qu