dd and 2k transfers on A500
Hi all,
2k transfers w/dd don't work. I think it was Richard Hirst who indicated the same problem existed on 32-bit w/C3k. A500/c3k have the same I/O MMU. I haven't been able to verify to problem with 32-bit kernel on c3k yet.
Half the attempts to "dd bs=2k" result in "garbage" data.
I'm using local disks on the A500 to do the following:
for i in 0 1 2 3 4 5 6 7 8 9; do dd if=/dev/sdd of=t$i \
bs=2k count=1; od -A x -t xC t$i > x$i; done
And then varied bs:
bs count corruption?
512 1 n
1k 1 n
2k 1 y
4k 1 n
6k 1 n
8k 1 n
1k 2 n
2k 2 y
Here's cksum output from 2k (count=1) output:
2984123064 7047 x0
3362192344 3584 x1
2984123064 7047 x2
3362192344 3584 x3
...
x0 compares correctly with the original data I pushed out to disk (skipped the first 1k of vmlinux and then wrote 20k to /dev/sdd):
000000 20 34 18 05 e0 20 2e 22 20 34 28 05 e0 20 20 72 000010 20 34 38 05 e0 20 2f 2a 20 33 c8 03 e0 20 24 8a 000020 20 21 98 03 e0 20 2b fa 20 34 38 05 e0 20 24 9a 000030 20 34 38 05 e0 20 2b f2 20 24 78 03 e0 20 2a 3a 000040 20 35 18 05 e0 20 29 12 20 2c a8 05 e0 20 21 0a
...
x1 starts with data that matches x0 at +0x400:
000000 08 01 02 56 0b 93 0a 13 62 da 01 00 0e 93 12 80 000010 00 00 0d 64 00 01 0e 60 22 60 08 01 2b 66 40 00 000020 4a 77 07 88 22 a0 08 00 4a 7a 07 90 34 14 07 50 000030 4a 79 07 80 36 d3 01 00 0a b3 0a 13 34 18 00 06 000040 6b d4 3f 99 34 21 00 00 0a a1 0a 01 6b dc 3f 79 000050 6b c0 3f 89 6b c1 3f 91 6b c0 3f 71 e8 46 09 38
...
from x0 again:
000400 08 01 02 56 0b 93 0a 13 62 da 01 00 0e 93 12 80 000410 00 00 0d 64 00 01 0e 60 22 60 08 01 2b 66 40 00 000420 4a 77 07 88 22 a0 08 00 4a 7a 07 90 34 14 07 50 000430 4a 79 07 80 36 d3 01 00 0a b3 0a 13 34 18 00 06 000440 6b d4 3f 99 34 21 00 00 0a a1 0a 01 6b dc 3f 79 000450 6b c0 3f 89 6b c1 3f 91 6b c0 3f 71 e8 46 09 38 000460 6b d3 3f 81 00 04 18 60 4b c2 3e d9 e8 40 c0 00
If SBA code mangled the address offset bits when it contructed the virtual DMA, this could happen. But then I would expect a similar behavior for 1k blocks and we don't see that.
It seems like we start reading from the wrong 1k block on the disk - assuming the data is really coming from disk. If so, I should be able to capture this with a SCSI analyzer. I'll try that next week.
I very suspicous of generic kernel since the data is placed wrong by a 1k offset, the same size linux uses internally. SBA code deals with stuff in 4k (PAGESIZE) chunks and is unlikely candidate for misplacing data by 1k.
Any ideas on what might be wrong?
Anyone have a 2.4.0-test10 x86 box running? Could you try the above dd command out with 2k blocks?
thanks,
grant
Grant Grundler
Unix Systems Enablement Lab
+1.408.447.7253
So I'm able to reproduce the problem on c3k/32-bit.
Quoted 4 lines · Grant Grundler
It seems like we start reading from the wrong 1k block on the disk - assuming the data is really coming from disk. If so, I should be able to capture this with a SCSI analyzer. I'll try that next week.
Captured the incoming data w/SCSI analyzer and it's correct. We are reading the correct data from disk but doesn't match what ends up in the "bad" versions of the destination file.
Another data point: while every other dd bs=2k gets corrupted, it's every fourth transfer for dd bs=2560/3k/3584.
data corruption seems to occur when size hits/crosses 4k alignment.
Quoted 2 lines
I very suspicous of generic kernel since the data is placed wrong by a 1k offset, the same size linux uses internally.
1k could just be an artifact of the scatter/gather list handed to SBA code and SBA code is botching the merging of entries somehow. I don't want to say this is an SBA bug until I find it. But it looks alot more like it now. :^(
SCSI analyser output is appended in case anyone is curious. Note I've programmed the analyzer to only capture the first 8 DATA and ignore the rest. Also note there are *no* filesystem writes. The filesystem I'm dumping the data to is on the same SCSI bus.
grant
Grant Grundler
Unix Systems Enablement Lab
+1.408.447.7253
SCSI STATE - State Listing
Label > DATA_ Time Phase SCSI mnemonic
Base > Hex Relative Hex
__________ _____ _________ ________________________________________________
-131 0080 Arbitrate ID=07
-130 00A0 2.592 us Select Atn ID=05
-129 00C0 3.520 us Msgout Atn Identify Disconnect, Logical=0
-128 0020 1.424 us Msgout Atn Simple Queue Tag=37H
-127 0037 1.000 us Msgout 37H
-126 0028 3.472 us Commd Read (10 byte)
-125 0000 624 ns Commd Lu=0
-124 0000 432 ns Commd Logical Block Addr=00000000H
-123 0000 424 ns Commd
-122 0000 424 ns Commd
-121 0000 424 ns Commd
-120 0000 424 ns Commd
-119 0000 424 ns Commd Transfer Length=0004H
-118 0004 424 ns Commd
-117 0000 424 ns Commd
-116 0004 5.344 us Msg_in Disconnect
-115 0000 856 ns Bus Free
-114 0020 16.76 ms Arbitrate ID=05
-113 00A0 1.536 us Reselect ID=07
-112 0080 13.62 us Msg_in Identify No Disconnect Logical=0
-111 0020 864 ns Msg_in Simple Queue Tag=37H
-110 0037 4.976 us Msg_in 37H
-109 3420 2.192 us Dat_in 3420H DBP1=0 DBP=0
-108 0518 56 ns Dat_in 0518H DBP1=1 DBP=1
-107 20E0 48 ns Dat_in 20E0H DBP1=0 DBP=0
-106 222E 48 ns Dat_in 222EH DBP1=1 DBP=1
-105 3420 48 ns Dat_in 3420H DBP1=0 DBP=0
-104 0528 56 ns Dat_in 0528H DBP1=1 DBP=1
-103 20E0 48 ns Dat_in 20E0H DBP1=0 DBP=0
-102 7220 48 ns Dat_in 7220H DBP1=1 DBP=0
-101 0000 67.28 us Status Good
-100 0000 4.336 us Msg_in Command Complete
-99 0000 856 ns Bus Free
-98 0080 356.4 ms Arbitrate ID=07
-97 00A0 2.616 us Select Atn ID=05
-96 00C0 3.592 us Msgout Atn Identify Disconnect, Logical=0
-95 0020 1.352 us Msgout Atn Simple Queue Tag=39H
-94 0039 976 ns Msgout 39H
-93 0028 3.472 us Commd Read (10 byte)
-92 0000 552 ns Commd Lu=0
-91 0000 424 ns Commd Logical Block Addr=00000000H
-90 0000 424 ns Commd
-89 0000 424 ns Commd
-88 0000 424 ns Commd
-87 0000 432 ns Commd
-86 0000 424 ns Commd Transfer Length=0004H
-85 0004 424 ns Commd
-84 0000 424 ns Commd
-83 0004 5.440 us Msg_in Disconnect
-82 0000 856 ns Bus Free
-81 0020 3.001 ms Arbitrate ID=05
-80 00A0 1.488 us Reselect ID=07
-79 0080 13.59 us Msg_in Identify No Disconnect Logical=0
-78 0020 832 ns Msg_in Simple Queue Tag=39H
-77 0039 4.992 us Msg_in 39H
-76 3420 2.184 us Dat_in 3420H DBP1=0 DBP=0
-75 0518 48 ns Dat_in 0518H DBP1=1 DBP=1
-74 20E0 56 ns Dat_in 20E0H DBP1=0 DBP=0
-73 222E 48 ns Dat_in 222EH DBP1=1 DBP=1
-72 3420 48 ns Dat_in 3420H DBP1=0 DBP=0
-71 0528 48 ns Dat_in 0528H DBP1=1 DBP=1
-70 20E0 56 ns Dat_in 20E0H DBP1=0 DBP=0
-69 7220 48 ns Dat_in 7220H DBP1=1 DBP=0
-68 0000 67.21 us Status Good
-67 0000 4.312 us Msg_in Command Complete
-66 0000 856 ns Bus Free
-65 0080 350.4 ms Arbitrate ID=07
-64 00A0 2.592 us Select Atn ID=05
-63 00C0 3.512 us Msgout Atn Identify Disconnect, Logical=0
-62 0020 1.424 us Msgout Atn Simple Queue Tag=3BH
-61 003B 1.000 us Msgout 3BH
-60 0028 3.480 us Commd Read (10 byte)
-59 0000 624 ns Commd Lu=0
-58 0000 424 ns Commd Logical Block Addr=00000000H
-57 0000 424 ns Commd
-56 0000 424 ns Commd
-55 0000 424 ns Commd
-54 0000 432 ns Commd
-53 0000 424 ns Commd Transfer Length=0004H
-52 0004 424 ns Commd
-51 0000 424 ns Commd
-50 0004 5.336 us Msg_in Disconnect
-49 0000 856 ns Bus Free
-48 0020 8.956 ms Arbitrate ID=05
-47 00A0 1.544 us Reselect ID=07
-46 0080 13.62 us Msg_in Identify No Disconnect Logical=0
-45 0020 880 ns Msg_in Simple Queue Tag=3BH
-44 003B 5.064 us Msg_in 3BH
-43 3420 2.184 us Dat_in 3420H DBP1=0 DBP=0
-42 0518 56 ns Dat_in 0518H DBP1=1 DBP=1
-41 20E0 48 ns Dat_in 20E0H DBP1=0 DBP=0
-40 222E 48 ns Dat_in 222EH DBP1=1 DBP=1
-39 3420 48 ns Dat_in 3420H DBP1=0 DBP=0
-38 0528 56 ns Dat_in 0528H DBP1=1 DBP=1
-37 20E0 48 ns Dat_in 20E0H DBP1=0 DBP=0
-36 7220 48 ns Dat_in 7220H DBP1=1 DBP=0
-35 0000 67.48 us Status Good
-34 0000 4.312 us Msg_in Command Complete
-33 0000 784 ns Bus Free
-32 0080 354.2 ms Arbitrate ID=07
-31 00A0 2.592 us Select Atn ID=05
-30 00C0 3.536 us Msgout Atn Identify Disconnect, Logical=0
-29 0020 1.400 us Msgout Atn Simple Queue Tag=3DH
-28 003D 1.000 us Msgout 3DH
-27 0028 3.472 us Commd Read (10 byte)
-26 0000 632 ns Commd Lu=0
-25 0000 424 ns Commd Logical Block Addr=00000000H
-24 0000 424 ns Commd
-23 0000 424 ns Commd
-22 0000 424 ns Commd
-21 0000 424 ns Commd
-20 0000 424 ns Commd Transfer Length=0004H
-19 0004 432 ns Commd
-18 0000 424 ns Commd
-17 0004 5.312 us Msg_in Disconnect
-16 0000 776 ns Bus Free
-15 0020 5.147 ms Arbitrate ID=05
-14 00A0 1.496 us Reselect ID=07
-13 0080 13.67 us Msg_in Identify No Disconnect Logical=0
-12 0020 848 ns Msg_in Simple Queue Tag=3DH
-11 003D 4.968 us Msg_in 3DH
-10 3420 2.208 us Dat_in 3420H DBP1=0 DBP=0
-9 0518 48 ns Dat_in 0518H DBP1=1 DBP=1
-8 20E0 48 ns Dat_in 20E0H DBP1=0 DBP=0
-7 222E 48 ns Dat_in 222EH DBP1=1 DBP=1
-6 3420 56 ns Dat_in 3420H DBP1=0 DBP=0
-5 0528 48 ns Dat_in 0528H DBP1=1 DBP=1
-4 20E0 48 ns Dat_in 20E0H DBP1=0 DBP=0
-3 7220 48 ns Dat_in 7220H DBP1=1 DBP=0
-2 0000 67.51 us Status Good
-1 0000 4.304 us Msg_in Command Complete
0 0000 864 ns Bus FreeTime Printed: 26 Dec 2000 14:30:36 --- Time Acquired: 26 Dec 2000 14:26:37
Quoted 3 lines · Grant Grundler
I'm using local disks on the A500 to do the following:
for i in 0 1 2 3 4 5 6 7 8 9; do dd if=/dev/sdd of=t$i \
bs=2k count=1; od -A x -t xC t$i > x$i; done
Problem solved. Loosing page offset bits in the last "chunk" of a scatter-gather list. We end up DMAing to the wrong part of the page. Fix was tested on 32-bit/C3k and should work on A500 as well now.
my apologies for the stupid mistake,
grant