* [PATCH] sgiwd93.c fix for multiple disks
@ 2001-12-10 20:07 Florian Lohoff
2001-12-11 1:53 ` Florian Lohoff
0 siblings, 1 reply; 6+ messages in thread
From: Florian Lohoff @ 2001-12-10 20:07 UTC (permalink / raw)
To: linux-mips; +Cc: klaus, agx
[-- Attachment #1: Type: text/plain, Size: 5155 bytes --]
Hi,
the attached patch fixes part of the DMA problems we see with multiple
disks and the sgiwd93.c with DISCONNECTs. Klaus patch formerly just
disabled all DMA replacing it with PIO which is a major performance hit.
This patch simply deletes all the HPC Scatter/Gather stuff thus we will
see a couple more interrupts due to all segments beeing transferred
individually. The transfer itself still happens with the HPC DMA thus
the performance impact will not be that large. I am running a test right
now but it seems the error is gone.
This also touches the wd33c93.c generic part which brings us closer to
mainstream as these to lines are a difference between the sgi/mips tree
and the mainline kernel as we would need this kind of modification if
we would do the scatter-gather DMA.
Index: sgiwd93.c
===================================================================
RCS file: /cvs/linux/drivers/scsi/sgiwd93.c,v
retrieving revision 1.28
diff -u -r1.28 sgiwd93.c
--- sgiwd93.c 2001/11/06 07:56:05 1.28
+++ sgiwd93.c 2001/12/10 20:06:01
@@ -115,42 +115,16 @@
hdata->dma_dir = datainp;
- if(cmd->SCp.buffers_residual) {
- struct scatterlist *slp = cmd->SCp.buffer;
- int i, totlen = 0;
-
-#ifdef DEBUG_DMA
- printk("SCLIST<");
-#endif
- for(i = 0; i <= cmd->SCp.buffers_residual; i++) {
-#ifdef DEBUG_DMA
- printk("[%p,%d]", slp[i].address, slp[i].length);
-#endif
- fill_hpc_entries (&hcp, slp[i].address, slp[i].length);
- totlen += slp[i].length;
- }
-#ifdef DEBUG_DMA
- printk(">tlen<%d>", totlen);
-#endif
- hdata->dma_bounce_len = totlen; /* a trick... */
- write_wd33c93_count(regs, totlen);
- } else {
- /* Non-scattered dma. */
-#ifdef DEBUG_DMA
- printk("ONEBUF<%p,%d>", cmd->SCp.ptr, cmd->SCp.this_residual);
-#endif
- /*
- * wd33c93 shouldn't pass us bogus dma_setups, but
- * it does:-( The other wd33c93 drivers deal with
- * it the same way (which isn't that obvious).
- * IMHO a better fix would be, not to do these
- * dma setups in the first place
- */
- if (cmd->SCp.ptr == NULL)
- return 1;
- fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual);
- write_wd33c93_count(regs, cmd->SCp.this_residual);
- }
+ /*
+ * wd33c93 shouldn't pass us bogus dma_setups, but
+ * it does:-( The other wd33c93 drivers deal with
+ * it the same way (which isn't that obvious).
+ * IMHO a better fix would be, not to do these
+ * dma setups in the first place
+ */
+ if (cmd->SCp.ptr == NULL)
+ return 1;
+ fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual);
/* To make sure, if we trip an HPC bug, that we transfer
* every single byte, we tag on an extra zero length dma
@@ -196,44 +170,6 @@
}
hregs->ctrl = 0;
- /* See how far we got and update scatterlist state if necessary. */
- if(SCpnt->SCp.buffers_residual) {
- struct scatterlist *slp = SCpnt->SCp.buffer;
- int totlen, wd93_residual, transferred, i;
-
- /* Yep, we were doing the scatterlist thang. */
- totlen = hdata->dma_bounce_len;
- wd93_residual = read_wd33c93_count(regp);
- transferred = totlen - wd93_residual;
-
-#ifdef DEBUG_DMA
- printk("tlen<%d>resid<%d>transf<%d> ",
- totlen, wd93_residual, transferred);
-#endif
-
- /* Avoid long winded partial-transfer search for common case. */
- if(transferred != totlen) {
- /* This is the nut case. */
-#ifdef DEBUG_DMA
- printk("Jed was here...");
-#endif
- for(i = 0; i <= SCpnt->SCp.buffers_residual; i++) {
- if(slp[i].length >= transferred)
- break;
- transferred -= slp[i].length;
- }
- } else {
- /* This is the common case. */
-#ifdef DEBUG_DMA
- printk("did it all...");
-#endif
- i = SCpnt->SCp.buffers_residual;
- }
- SCpnt->SCp.buffer = &slp[i];
- SCpnt->SCp.buffers_residual = SCpnt->SCp.buffers_residual - i;
- SCpnt->SCp.ptr = (char *) slp[i].address;
- SCpnt->SCp.this_residual = slp[i].length;
- }
#ifdef DEBUG_DMA
printk("\n");
#endif
Index: wd33c93.c
===================================================================
RCS file: /cvs/linux/drivers/scsi/wd33c93.c,v
retrieving revision 1.19
diff -u -r1.19 wd33c93.c
--- wd33c93.c 2001/11/06 07:56:05 1.19
+++ wd33c93.c 2001/12/10 20:06:01
@@ -612,6 +612,7 @@
(is_dir_out(cmd))?DATA_OUT_DIR:DATA_IN_DIR))
write_wd33c93_count(regs, 0); /* guarantee a DATA_PHASE interrupt */
else {
+ write_wd33c93_count(regs, cmd->SCp.this_residual);
write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_DMA);
hostdata->dma = D_DMA_RUNNING;
}
@@ -733,6 +734,7 @@
hostdata->dma_cnt++;
#endif
write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_DMA);
+ write_wd33c93_count(regs, cmd->SCp.this_residual);
if ((hostdata->level2 >= L2_DATA) ||
(hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) {
Flo
--
Florian Lohoff flo@rfc822.org +49-5201-669912
Nine nineth on september the 9th Welcome to the new billenium
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sgiwd93.c fix for multiple disks
2001-12-10 20:07 [PATCH] sgiwd93.c fix for multiple disks Florian Lohoff
@ 2001-12-11 1:53 ` Florian Lohoff
2001-12-11 8:58 ` Guido Guenther
0 siblings, 1 reply; 6+ messages in thread
From: Florian Lohoff @ 2001-12-11 1:53 UTC (permalink / raw)
To: linux-mips; +Cc: klaus, agx
[-- Attachment #1: Type: text/plain, Size: 2570 bytes --]
On Mon, Dec 10, 2001 at 09:07:57PM +0100, Florian Lohoff wrote:
> Hi,
> the attached patch fixes part of the DMA problems we see with multiple
> disks and the sgiwd93.c with DISCONNECTs. Klaus patch formerly just
> disabled all DMA replacing it with PIO which is a major performance hit.
>
> This patch simply deletes all the HPC Scatter/Gather stuff thus we will
> see a couple more interrupts due to all segments beeing transferred
> individually. The transfer itself still happens with the HPC DMA thus
> the performance impact will not be that large. I am running a test right
> now but it seems the error is gone.
Ok - I am running the attached script right now which copies a kernel
source tree from one disk to another disk in a loop. I ran this on the a
133Mhz R4600 Indy with 2 SCSI Disks on the same SCSI bus. Without the
patch not a single cycle in this script made it through as on page in
the binarys would be corrupted. Also a whole bunch of files of the source
tree would be broken, mangled truncated - Whatever might happen. Nothing
of this now happened while running the test for the last 5 hours. The
machine is still up and running and kind of responsive.
I am unsure if we should put this into CVS as it brings us correctness
for the price of some performance penalty.
#!/bin/sh
TMP=`tempfile`
MD5OUT=`tempfile`
LOG=/home/flo/break/log
SRC=/home/flo/break/
DST=/mnt/break/
[ ! -d $DST ] && mkdir $DST
[ ! -d $DST ] && exit 1
while [ 1 ]; do
[ -d $DST/linux.bak ] && rm -rf $DST/linux.bak
[ -d $DST/linux ] && mv $DST/linux $DST/linux.bak
[ -d $DST/linux.bak.md5sum ] && rm -f $DST/linux.bak.md5sum
[ -f $DST/linux.md5sum ] && mv $DST/linux.md5sum $DST/linux.bak.md5sum
rm -f $TMP $MD5OUT
printf "Starting copy %s - " "`date +\"%y-%m-%d %H:%M:%S\"`" >$TMP
(cd $SRC ; tar -cf - linux* ) | ( cd /$DST ; tar -xf - ; sync )
printf "Finished %s\n" "`date +\"%y-%m-%d %H:%M:%S\"`" >>$TMP
printf "Checking md5sum %s - " "`date +\"%y-%m-%d %H:%M:%S\"`" >>$TMP
md5sum -cv $DST/linux.md5sum >$MD5OUT 2>&1
totlines=`wc -l $MD5OUT | awk '{ print $1 }'`
failedlines=`grep -v OK $MD5OUT | wc -l | awk '{ print $1 }'`
printf "Finished %s\n" "`date +\"%y-%m-%d %H:%M:%S\"`" >>$TMP
printf "%d files failed out of %d\n" $failedlines $totlines >>$TMP
grep -v OK $MD5OUT >>$TMP
cat $TMP >>$LOG
done
Flo
--
Florian Lohoff flo@rfc822.org +49-5201-669912
Nine nineth on september the 9th Welcome to the new billenium
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sgiwd93.c fix for multiple disks
2001-12-11 1:53 ` Florian Lohoff
@ 2001-12-11 8:58 ` Guido Guenther
2001-12-11 9:37 ` Klaus Naumann
0 siblings, 1 reply; 6+ messages in thread
From: Guido Guenther @ 2001-12-11 8:58 UTC (permalink / raw)
To: linux-mips; +Cc: flo, klaus
On Tue, Dec 11, 2001 at 02:53:41AM +0100, Florian Lohoff wrote:
> On Mon, Dec 10, 2001 at 09:07:57PM +0100, Florian Lohoff wrote:
> > Hi,
> > the attached patch fixes part of the DMA problems we see with multiple
> > disks and the sgiwd93.c with DISCONNECTs. Klaus patch formerly just
> > disabled all DMA replacing it with PIO which is a major performance hit.
> >
> > This patch simply deletes all the HPC Scatter/Gather stuff thus we will
> > see a couple more interrupts due to all segments beeing transferred
> > individually. The transfer itself still happens with the HPC DMA thus
> > the performance impact will not be that large. I am running a test right
> > now but it seems the error is gone.
>
> Ok - I am running the attached script right now which copies a kernel
> source tree from one disk to another disk in a loop. I ran this on the a
> 133Mhz R4600 Indy with 2 SCSI Disks on the same SCSI bus. Without the
> patch not a single cycle in this script made it through as on page in
> the binarys would be corrupted. Also a whole bunch of files of the source
> tree would be broken, mangled truncated - Whatever might happen. Nothing
> of this now happened while running the test for the last 5 hours. The
> machine is still up and running and kind of responsive.
>
> I am unsure if we should put this into CVS as it brings us correctness
> for the price of some performance penalty.
Can you very roughly estimate the performance hit - let's say the slow
down when copying the whole kernel-tree once?
-- Guido
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sgiwd93.c fix for multiple disks
2001-12-11 8:58 ` Guido Guenther
@ 2001-12-11 9:37 ` Klaus Naumann
2001-12-11 9:55 ` Florian Lohoff
0 siblings, 1 reply; 6+ messages in thread
From: Klaus Naumann @ 2001-12-11 9:37 UTC (permalink / raw)
To: Guido Guenther; +Cc: Linux/MIPS list, Florian Lohoff, klaus
[-- Attachment #1: Type: TEXT/PLAIN, Size: 678 bytes --]
> > I am unsure if we should put this into CVS as it brings us correctness
> > for the price of some performance penalty.
> Can you very roughly estimate the performance hit - let's say the slow
> down when copying the whole kernel-tree once?
> -- Guido
Hi all,
I've done some bonnie++ tests and everything looks good IMHO.
See attachments (new_speed is with lolo's patch and old_speed without).
I vote for commit. Cool work !
Cya, Klaus
--
Full Name : Klaus Naumann | (http://www.mgnet.de/) (Germany)
Nickname : Spock | Org.: Mad Guys Network
Phone / FAX : ++49/177/7862964 | E-Mail: (spock@mgnet.de)
PGP Key : www.mgnet.de/keys/key_spock.txt
[-- Attachment #2: Type: TEXT/PLAIN, Size: 755 bytes --]
Version 1.02 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
ivy 368M 1415 95 2437 7 1003 4 1208 81 2298 6 90.7 2
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 235 99 +++++ +++ 13871 98 242 99 +++++ +++ 898 99
ivy,368M,1415,95,2437,7,1003,4,1208,81,2298,6,90.7,2,16,235,99,+++++,+++,13871,98,242,99,+++++,+++,898,99
[-- Attachment #3: Type: TEXT/PLAIN, Size: 754 bytes --]
Version 1.02 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
ivy 368M 1348 91 2468 7 836 3 1297 87 2178 5 91.0 2
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 220 99 +++++ +++ 13440 98 232 99 +++++ +++ 780 99
ivy,368M,1348,91,2468,7,836,3,1297,87,2178,5,91.0,2,16,220,99,+++++,+++,13440,98,232,99,+++++,+++,780,99
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sgiwd93.c fix for multiple disks
2001-12-11 9:37 ` Klaus Naumann
@ 2001-12-11 9:55 ` Florian Lohoff
2001-12-11 10:06 ` Klaus Naumann
0 siblings, 1 reply; 6+ messages in thread
From: Florian Lohoff @ 2001-12-11 9:55 UTC (permalink / raw)
To: Klaus Naumann; +Cc: Guido Guenther, Linux/MIPS list, klaus
[-- Attachment #1: Type: text/plain, Size: 2278 bytes --]
On Tue, Dec 11, 2001 at 10:37:11AM +0100, Klaus Naumann wrote:
> Hi all,
>
> I've done some bonnie++ tests and everything looks good IMHO.
> See attachments (new_speed is with lolo's patch and old_speed without).
> I vote for commit. Cool work !
It looks like this is statistical distortion as some numbers went up.
It looks at least that there is no real difference ...
> Version 1.02 ------Sequential Output------ --Sequential Input- --Random-
> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
> ivy 368M 1415 95 2437 7 1003 4 1208 81 2298 6 90.7 2
> ------Sequential Create------ --------Random Create--------
> -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
> 16 235 99 +++++ +++ 13871 98 242 99 +++++ +++ 898 99
> ivy,368M,1415,95,2437,7,1003,4,1208,81,2298,6,90.7,2,16,235,99,+++++,+++,13871,98,242,99,+++++,+++,898,99
> Version 1.02 ------Sequential Output------ --Sequential Input- --Random-
> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
> ivy 368M 1348 91 2468 7 836 3 1297 87 2178 5 91.0 2
> ------Sequential Create------ --------Random Create--------
> -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
> 16 220 99 +++++ +++ 13440 98 232 99 +++++ +++ 780 99
> ivy,368M,1348,91,2468,7,836,3,1297,87,2178,5,91.0,2,16,220,99,+++++,+++,13440,98,232,99,+++++,+++,780,99
I would commit that too with some additional comments that the HPC
is capable of doing scatter-gather but this does not mix with the wd33
framwork which has no support for that.
Flo
--
Florian Lohoff flo@rfc822.org +49-5201-669912
Nine nineth on september the 9th Welcome to the new billenium
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sgiwd93.c fix for multiple disks
2001-12-11 9:55 ` Florian Lohoff
@ 2001-12-11 10:06 ` Klaus Naumann
0 siblings, 0 replies; 6+ messages in thread
From: Klaus Naumann @ 2001-12-11 10:06 UTC (permalink / raw)
To: Florian Lohoff; +Cc: Guido Guenther, Linux/MIPS list, klaus
On Tue, 11 Dec 2001, Florian Lohoff wrote:
> It looks like this is statistical distortion as some numbers went up.
> It looks at least that there is no real difference ...
Yeah it looks the same to me (BTW, before someone asks - the machine
was bootet freshly before each test ;) )
> I would commit that too with some additional comments that the HPC
> is capable of doing scatter-gather but this does not mix with the wd33
> framwork which has no support for that.
While you're at it could you also change the wrong comment in wd33c93
stating that the first interrupt after DMA init is always the DMA
complete int ?
Also killing the Amiga reference might be good as more drivers depend
on this framework - not only amiga (i.e. ppc-something).
Cya, Klaus
--
Full Name : Klaus Naumann | (http://www.mgnet.de/) (Germany)
Nickname : Spock | Org.: Mad Guys Network
Phone / FAX : ++49/177/7862964 | E-Mail: (spock@mgnet.de)
PGP Key : www.mgnet.de/keys/key_spock.txt
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2001-12-11 11:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-10 20:07 [PATCH] sgiwd93.c fix for multiple disks Florian Lohoff
2001-12-11 1:53 ` Florian Lohoff
2001-12-11 8:58 ` Guido Guenther
2001-12-11 9:37 ` Klaus Naumann
2001-12-11 9:55 ` Florian Lohoff
2001-12-11 10:06 ` Klaus Naumann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox