sata_sx4: speed up ECC initialization
PATCH 1/1 sata_sx4: speed up ECC initialization
ECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes to initialize 512Mb DIMM module. Change portion to 1Mb.
before:
[10857.207576] pdc20621_dimm_init: Start ECC initialization [11235.333118] pdc20621_dimm_init: Finish ECC initialization
after:
[ 1005.126437] pdc20621_dimm_init: Local DIMM Speed = 100 [ 1005.128111] pdc20621_dimm_init: Local DIMM Size = 512MB [ 1005.133508] Local DIMM ECC Enabled [ 1005.236482] pdc20621_dimm_init: Start ECC initialization [ 1031.278098] pdc20621_dimm_init: Finish ECC initialization
--- drivers/ata/sata_sx4.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/ata/sata_sx4.c +6 -4
@@ -1208,7 +1208,6 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) {int speed, size, length;u32 addr, spd0, pci_status; -u32 tmp =0 ;u32 time_period =0 ;u32 tcount =0 ;u32 ticks =0 ;
@@ -1323,14 +1322,17 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)pdc20621_i2c_read (host,PDC_DIMM0_SPD_DEV_ADDRESS ,PDC_DIMM_SPD_TYPE , &spd0);if (spd0 ==0x02 ) { +void *buf;VPRINTK ("Start ECC initialization\n" ); addr =0 ; length = size *1024 *1024 ; + buf =kzalloc (PDC_20621_PAGE_SIZE *32 ,GFP_KERNEL );while (addr < length) { -pdc20621_put_to_dimm (host, (void *) &tmp, addr, -sizeof (u32)); - addr +=sizeof (u32); +pdc20621_put_to_dimm (host, buf, addr, +PDC_20621_PAGE_SIZE *32 ); + addr +=PDC_20621_PAGE_SIZE *32 ; } +kfree (buf);VPRINTK ("Finish ECC initialization\n" ); }return 0 ;
Signature · 1 line
1.6.2.2
Quoted 40 lines · Alexander Beregalov
ECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes to initialize 512Mb DIMM module. Change portion to 1Mb.
before:
[10857.207576] pdc20621_dimm_init: Start ECC initialization [11235.333118] pdc20621_dimm_init: Finish ECC initializationafter:
[ 1005.126437] pdc20621_dimm_init: Local DIMM Speed = 100 [ 1005.128111] pdc20621_dimm_init: Local DIMM Size = 512MB [ 1005.133508] Local DIMM ECC Enabled [ 1005.236482] pdc20621_dimm_init: Start ECC initialization [ 1031.278098] pdc20621_dimm_init: Finish ECC initializationSigned-off-by Alexander Beregalov <[email protected]>--- drivers/ata/sata_sx4.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)drivers/ata/sata_sx4.c +1
-1@@ -1208,7 +1208,6 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) {int speed, size, length;u32 addr, spd0, pci_status; -u32 tmp =0 ;u32 time_period =0 ;u32 tcount =0 ;u32 ticks =0 ;@@ -1323,14 +1322,17 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)pdc20621_i2c_read (host,PDC_DIMM0_SPD_DEV_ADDRESS ,PDC_DIMM_SPD_TYPE , &spd0);if (spd0 ==0x02 ) { +void *buf;VPRINTK ("Start ECC initialization\n" ); addr =0 ; length = size *1024 *1024 ;
drivers/ata/sata_sx4.c static unsigned int pdc20621_dimm_init(struct ata_host *host) · line 1335
Quoted 10 lines
drivers/ata/sata_sx4.c +5
-3+ buf =kzalloc (PDC_20621_PAGE_SIZE *32 ,GFP_KERNEL );while (addr < length) { -pdc20621_put_to_dimm (host, (void *) &tmp, addr, -sizeof (u32)); - addr +=sizeof (u32); +pdc20621_put_to_dimm (host, buf, addr, +PDC_20621_PAGE_SIZE *32 ); + addr +=PDC_20621_PAGE_SIZE *32 ; } +kfree (buf);
Comments:
1) on an older machine, where these things might be found, 1MB might be a lot -- particularly if there is a lot of VM fragmentation. Please reduce the size a bit -- I suppose 128k is not unbearably slow?
2) Rather than repeating 'page size * 32' calculation multiple times, put it into a named constant somewhere.
Other than that, looks ok!
Jeff
Quoted 22 lines · Jeff Garzik
Quoted 8 lines · Alexander Beregalov
ECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes to initialize 512Mb DIMM module. Change portion to 1Mb.
before:
[10857.207576] pdc20621_dimm_init: Start ECC initialization [11235.333118] pdc20621_dimm_init: Finish ECC initializationQuoted 7 lines
after:
[ 1005.126437] pdc20621_dimm_init: Local DIMM Speed = 100 [ 1005.128111] pdc20621_dimm_init: Local DIMM Size = 512MB [ 1005.133508] Local DIMM ECC Enabled [ 1005.236482] pdc20621_dimm_init: Start ECC initialization [ 1031.278098] pdc20621_dimm_init: Finish ECC initializationComments:
1) on an older machine, where these things might be found, 1MB might be a lot -- particularly if there is a lot of VM fragmentation. Please reduce the size a bit -- I suppose 128k is not unbearably slow?
Quoted 7 lines
2) Rather than repeating 'page size * 32' calculation multiple times, put it into a named constant somewhere.
Other than that, looks ok!
From
00e980a4651ef12811fbe9a893a7e72510b955d1Mon Sep 17 00:00:00 2001
From: Alexander Beregalov <[email protected]>
Date: Tue, 14 Apr 2009 23:55:52 +0400
Subject: [PATCH v2] sata_sx4: speed up ECC initialization
ECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes on my machine to initialize 512Mb ECC DIMM module. Change portion to 128Kb - it significantly reduces initialization time.
--- drivers/ata/sata_sx4.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/ata/sata_sx4.c +7 -4
@@ -193,6 +193,7 @@ enum { PDC_TIMER_MASK_INT, }; +#define ECC_ERASE_BUF 128 * 1024;struct pdc_port_priv {u8 dimm_buf[(ATA_PRD_SZ *ATA_MAX_PRD ) +512 ];
@@ -1208,7 +1209,6 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) {int speed, size, length;u32 addr, spd0, pci_status; -u32 tmp =0 ;u32 time_period =0 ;u32 tcount =0 ;u32 ticks =0 ;
@@ -1323,14 +1323,17 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)pdc20621_i2c_read (host,PDC_DIMM0_SPD_DEV_ADDRESS ,PDC_DIMM_SPD_TYPE , &spd0);if (spd0 ==0x02 ) { +void *buf;VPRINTK ("Start ECC initialization\n" ); addr =0 ; length = size *1024 *1024 ; + buf =kzalloc (ECC_ERASE_BUF ,GFP_KERNEL );while (addr < length) { -pdc20621_put_to_dimm (host, (void *) &tmp, addr, -sizeof (u32)); - addr +=sizeof (u32); +pdc20621_put_to_dimm (host, buf, addr, +ECC_ERASE_BUF ); + addr +=ECC_ERASE_BUF ; } +kfree (buf);VPRINTK ("Finish ECC initialization\n" ); }return 0 ;
Signature · 1 line
1.6.2.3
Jeff Garzik
AppliedQuoted 36 lines · Alexander Beregalov
Quoted 18 lines · Jeff Garzik
Quoted 8 lines · Alexander Beregalov
ECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes to initialize 512Mb DIMM module. Change portion to 1Mb.
before:
[10857.207576] pdc20621_dimm_init: Start ECC initialization [11235.333118] pdc20621_dimm_init: Finish ECC initializationQuoted 7 lines
after:
[ 1005.126437] pdc20621_dimm_init: Local DIMM Speed = 100 [ 1005.128111] pdc20621_dimm_init: Local DIMM Size = 512MB [ 1005.133508] Local DIMM ECC Enabled [ 1005.236482] pdc20621_dimm_init: Start ECC initialization [ 1031.278098] pdc20621_dimm_init: Finish ECC initializationComments:
Quoted 8 lines
1) on an older machine, where these things might be found, 1MB might be a lot -- particularly if there is a lot of VM fragmentation. Please reduce the size a bit -- I suppose 128k is not unbearably slow?
2) Rather than repeating 'page size * 32' calculation multiple times, put it into a named constant somewhere.
Other than that, looks ok!
From
00e980a4651ef12811fbe9a893a7e72510b955d1Mon Sep 17 00:00:00 2001From: Alexander Beregalov <[email protected]>
Date: Tue, 14 Apr 2009 23:55:52 +0400
Subject: [PATCH v2]sata_sx4: speed up ECC initializationECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes on my machine to initialize 512Mb ECC DIMM module. Change portion to 128Kb - it significantly reduces initialization time.
Quoted 4 lines
Signed-off-by Alexander Beregalov <[email protected]>--- drivers/ata/sata_sx4.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
Applied, to libata-dev.git#upstream
Thanks!
So... the $64,000 question: does sata_sx4 work for you?
drivers/ata/sata_sx4.c enum { · line 196
Quoted 9 lines
drivers/ata/sata_sx4.c +1
-0@@ -193,6 +193,7 @@ enum { PDC_TIMER_MASK_INT, }; +#define ECC_ERASE_BUF_SZ (128 * 1024)
I made two minor edits:
1) Macros should always be guarded by parens
2) Added "_SZ" suffix to make purpose even more obvious
2009/4/15 Jeff Garzik <[email protected]>:
Quoted 50 lines
Quoted 43 lines · Alexander Beregalov
Quoted 24 lines · Jeff Garzik
Quoted 9 lines · Alexander Beregalov
ECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes to initialize 512Mb DIMM module. Change portion to 1Mb.
before:
[10857.207576] pdc20621_dimm_init: Start ECC initialization [11235.333118] pdc20621_dimm_init: Finish ECC initializationQuoted 7 lines
after:
[ 1005.126437] pdc20621_dimm_init: Local DIMM Speed = 100 [ 1005.128111] pdc20621_dimm_init: Local DIMM Size = 512MB [ 1005.133508] Local DIMM ECC Enabled [ 1005.236482] pdc20621_dimm_init: Start ECC initialization [ 1031.278098] pdc20621_dimm_init: Finish ECC initializationComments:
1) on an older machine, where these things might be found, 1MB might be a lot -- particularly if there is a lot of VM fragmentation. Please reduce the size a bit -- I suppose 128k is not unbearably slow?
Quoted 7 lines
2) Rather than repeating 'page size * 32' calculation multiple times, put it into a named constant somewhere.
Other than that, looks ok!
From
00e980a4651ef12811fbe9a893a7e72510b955d1Mon Sep 17 00:00:00 2001From: Alexander Beregalov <[email protected]>
Date: Tue, 14 Apr 2009 23:55:52 +0400
Subject: [PATCH v2]sata_sx4: speed up ECC initializationECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes on my machine to initialize 512Mb ECC DIMM module. Change portion to 128Kb - it significantly reduces initialization time.
Quoted 4 lines
Signed-off-by Alexander Beregalov <[email protected]>---
drivers/ata/sata_sx4.c | 11 +++++++----1 files changed, 7 insertions(+), 4 deletions(-)
Quoted 5 lines
Applied, to libata-dev.git#upstream
Thanks!
So... the $64,000 question: does
sata_sx4work for you?
No, not yet! :)
It works without disks ;)
It has found disks, but got timeout from them. Some specific functions should be added to ops structure.
At first I am trying to understand how to detect cable type. I have two examples: from Promise partial source code and from FreeBSD.
But PGuide says the chip automatically detects cable type. Does it mean the driver should not do anything with it? - I will try it.
Quoted 26 lines · Alexander Beregalov
Quoted 15 lines
Quoted 9 lines
From: Alexander Beregalov <[email protected]>
Date: Tue, 14 Apr 2009 23:55:52 +0400
Subject: [PATCH v2]sata_sx4: speed up ECC initializationECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes on my machine to initialize 512Mb ECC DIMM module. Change portion to 128Kb - it significantly reduces initialization time.
Quoted 4 lines
Signed-off-by Alexander Beregalov <[email protected]>---
 drivers/ata/sata_sx4.c |  11 +++++++----  1 files changed, 7 insertions(+), 4 deletions(-)Quoted 5 lines
Applied, to libata-dev.git#upstream
Thanks!
So... Â the $64,000 question: Â does
sata_sx4work for you?No, not yet! :)
It works without disks ;)
It has found disks, but got timeout from them. Some specific functions should be added to ops structure.
Quoted 5 lines
At first I am trying to understand how to detect cable type. I have two examples: from Promise partial source code and from FreeBSD.
But PGuide says the chip automatically detects cable type. Does it mean the driver should not do anything with it? - I will try it.
No, it means you query the chip and report what it detected to libata. The cable type affects speed settings.
Quoted 56 lines · Alexander Beregalov
2009/4/15 Jeff Garzik <[email protected]>:
Quoted 44 lines
Quoted 38 lines · Alexander Beregalov
Quoted 22 lines · Jeff Garzik
Quoted 8 lines · Alexander Beregalov
ECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes to initialize 512Mb DIMM module. Change portion to 1Mb.
before:
[10857.207576] pdc20621_dimm_init: Start ECC initialization [11235.333118] pdc20621_dimm_init: Finish ECC initializationQuoted 7 lines
after:
[ 1005.126437] pdc20621_dimm_init: Local DIMM Speed = 100 [ 1005.128111] pdc20621_dimm_init: Local DIMM Size = 512MB [ 1005.133508] Local DIMM ECC Enabled [ 1005.236482] pdc20621_dimm_init: Start ECC initialization [ 1031.278098] pdc20621_dimm_init: Finish ECC initializationComments:
1) on an older machine, where these things might be found, 1MB might be a lot -- particularly if there is a lot of VM fragmentation. Please reduce the size a bit -- I suppose 128k is not unbearably slow?
Quoted 6 lines
2) Rather than repeating 'page size * 32' calculation multiple times, put it into a named constant somewhere.
Other than that, looks ok!
From
00e980a4651ef12811fbe9a893a7e72510b955d1Mon Sep 17 00:00:00 2001From: Alexander Beregalov <[email protected]>
Date: Tue, 14 Apr 2009 23:55:52 +0400
Subject: [PATCH v2]sata_sx4: speed up ECC initializationECC initialization takes too long. It writes zeroes by portions of 4 byte, it takes more than 6 minutes on my machine to initialize 512Mb ECC DIMM module. Change portion to 128Kb - it significantly reduces initialization time.
Quoted 4 lines
Signed-off-by Alexander Beregalov <[email protected]>--- drivers/ata/sata_sx4.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)Quoted 5 lines
Applied, to libata-dev.git#upstream
Thanks!
So... the $64,000 question: does
sata_sx4work for you?No, not yet! :)
It works without disks ;)
It has found disks, but got timeout from them. Some specific functions should be added to ops structure.
Quoted 5 lines
At first I am trying to understand how to detect cable type. I have two examples: from Promise partial source code and from FreeBSD.
But PGuide says the chip automatically detects cable type. Does it mean the driver should not do anything with it? - I will try it.
Check out 2.6.30-rc6, sata_sx4 received several major bug fixes...
Jeff
Quoted 1 line · Jeff Garzik
Check out 2.6.30-rc6,
sata_sx4received several major bug fixes...
Thanks, but it still does not work.
bus: 'pci': add driver sata_sx4
bus: 'pci': driver_probe_device: matched device 0000:02:04.0 with driver sata_sx4
bus: 'pci': really_probe: probing driver sata_sx4 with device 0000:02:04.0sata_sx4 0000:02:04.0: version 0.12
PCI: Enabling device: (0000:02:04.0), cmd 3pdc20621_dimm_init: Time Period Register (0x40): 0xffffffffpdc20621_dimm_init: Time Counter Register (0x44): 0xf71a3f65pdc20621_dimm_init: Num counters 0x8e5c09a (149274778)pdc20621_dimm_init: 10 * Internal clk = 0x1f1 (497)pdc20621_dimm_init: 10 * Internal clk * 33 = 0x4011 (16401)pdc20621_dimm_init: PLL F Param: 0x53 (83)pdc20621_dimm_init: pci_status: 0x8a531824pdc20621_dimm_init: Local DIMM Speed = 100pdc20621_dimm_init: Local DIMM Size = 512MB
Local DIMM ECC Enabled
ff, 0,
ff, 0,
ff, 0,pdc20621_dimm_init: Start ECC initializationpdc20621_dimm_init: Finish ECC initializationsata_sx4 0000:02:04.0: enabling bus masteringpdc20621_interrupt: ENTERpdc20621_interrupt: mask == 0x0pdc20621_interrupt: QUICK EXIT 3
scsi2 : sata_sx4
device: 'host2': device_add
bus: 'scsi': add device host2
device: 'host2': device_add
scsi3 : sata_sx4
device: 'host3': device_add
bus: 'scsi': add device host3
device: 'host3': device_add
scsi4 : sata_sx4
device: 'host4': device_add
bus: 'scsi': add device host4
device: 'host4': device_add
scsi5 : sata_sx4
device: 'host5': device_add
bus: 'scsi': add device host5
device: 'host5': device_add
ata3: PATA max UDMA/133 mmio m1048576@0x1ff00300000 dimm m32768@0x1ff00400000 port 0x1ff00300200 irq 16
ata4: PATA max UDMA/133 mmio m1048576@0x1ff00300000 dimm m32768@0x1ff00400000 port 0x1ff00300280 irq 16
ata5: PATA max UDMA/133 mmio m1048576@0x1ff00300000 dimm m32768@0x1ff00400000 port 0x1ff00300300 irq 16
ata6: PATA max UDMA/133 mmio m1048576@0x1ff00300000 dimm m32768@0x1ff00400000 port 0x1ff00300380 irq 16
driver: '0000:02:04.0': driver_bound: bound to device 'sata_sx4'
bus: 'pci': really_probe: bound device 0000:02:04.0 to driver sata_sx4
ata3.00: ATA-5: ST320414A, 3.28, max UDMA/100
ata3.00: 39851760 sectors, multi 0: LBApdc20621_nodata_prep: ata3: ENTERpdc20621_ata_pkt: ENTER, dimm_sg == 0x200180, 2097536pdc20621_nodata_prep: ata pkt buf ofs 282, mmio copied
ata3.00: configured for UDMA/100
scsi 2:0:0:0: Direct-Access ATA ST320414A 3.28 PQ: 0 ANSI: 5
device: 'target2:0:0': device_add
bus: 'scsi': add device target2:0:0
device: '2:0:0:0': device_add
bus: 'scsi': add device 2:0:0:0
bus: 'scsi': driver_probe_device: matched device 2:0:0:0 with driver sd
bus: 'scsi': really_probe: probing driver sd with device 2:0:0:0
driver: '2:0:0:0': driver_bound: bound to device 'sd'
bus: 'scsi': really_probe: bound device 2:0:0:0 to driver sd
device: '2:0:0:0': device_add
device: 'sg1': device_add
sd 2:0:0:0: Attached scsi generic sg1 type 0
device: '2:0:0:0': device_add
sd 2:0:0:0: [sdb] 39851760 512-byte hardware sectors: (20.4 GB/19.0 GiB)
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
device: 'sdb': device_add
sdb:<3>pdc20621_dma_prep: ata3: ENTERpdc20621_host_sg: HOST PSG @ 200080 == (0x2100, 0x200080)pdc20621_host_pkt: ENTER, dimm_sg == 0x200080, 2097280pdc20621_host_pkt: host_sg == 0x201800, 2103296pdc20621_host_pkt: HOST PKT @ 200000 == (0x40005ff 0x182000 0x80002000 0x0)pdc20621_ata_sg: ATA sg addr 0x210000, 2162688pdc20621_ata_sg: ATA PSG @ 200180 == (0x2100, 0x200080)pdc20621_ata_pkt: ENTER, dimm_sg == 0x200180, 2097536pdc20621_dma_prep: ata pkt buf ofs 282, prd size 8, mmio copiedpdc20621_packet_start: ata3: ENTERpdc20621_packet_start: submitted ofs 0x200100 (2097408), seq 1
ata3.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata3.00: cmd c8/00:10:00:00:00/00:00:00:00:00/e0 tag 0 dma 8192 in
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata3.00: status: { DRDY }
ata3: soft resetting linkpdc20621_nodata_prep: ata3: ENTERpdc20621_ata_pkt: ENTER, dimm_sg == 0x200180, 2097536pdc20621_nodata_prep: ata pkt buf ofs 282, mmio copied
ata3.00: configured for UDMA/100
ata3: EH completepdc20621_dma_prep: ata3: ENTERpdc20621_host_sg: HOST PSG @ 200080 == (0x2100, 0x200080)pdc20621_host_pkt: ENTER, dimm_sg == 0x200080, 2097280pdc20621_host_pkt: host_sg == 0x201800, 2103296pdc20621_host_pkt: HOST PKT @ 200000 == (0x40005ff 0x182000 0x80002000 0x0)pdc20621_ata_sg: ATA sg addr 0x210000, 2162688pdc20621_ata_sg: ATA PSG @ 200180 == (0x2100, 0x200080)pdc20621_ata_pkt: ENTER, dimm_sg == 0x200180, 2097536pdc20621_dma_prep: ata pkt buf ofs 282, prd size 8, mmio copiedpdc20621_packet_start: ata3: ENTERpdc20621_packet_start: submitted ofs 0x200100 (2097408), seq 1 ata3.00: limiting speed to UDMA/66:PIO4
ata3.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen ata3.00: cmd c8/00:10:00:00:00/00:00:00:00:00/e0 tag 0 dma 8192 in
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata3.00: status: { DRDY }
ata3: soft resetting link
Quoted 4 lines · Alexander Beregalov
Quoted 1 line · Jeff Garzik
Check out 2.6.30-rc6,
sata_sx4received several major bug fixes...Thanks, but it still does not work.
oh well... did behavior improve for you, at least? Did the driver make it farther than before?
Jeff
2009/5/16 Jeff Garzik <[email protected]>:
Quoted 10 lines
Quoted 6 lines · Alexander Beregalov
Quoted 2 lines · Jeff Garzik
Check out 2.6.30-rc6,
sata_sx4received several major bug fixes...Thanks, but it still does not work.
oh well... did behavior improve for you, at least? Did the driver make it farther than before?
No, the same behavior.
My modification is not enough for driver to work as PATA controller.