Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a20 sunxi - write speed improvement. Need testings.
- Loading branch information
1 parent
067160b
commit c4281e5
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
patch/kernel/sunxi-dev/RFC-drivers-ata-ahci_sunxi-Increased-SATA-AHCI-DMA-TX-RX-FIFOs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Increasing the SATA/AHCI DMA TX/RX FIFOs (P0DMACR.TXTS and .RXTS) from | ||
default 0x0 each to 0x3 each gives a write performance boost of 120MB/s | ||
from lame 36MB/s to 45MB/s previously. Read performance is about 200MB/s | ||
[tested on SSD using dd bs=4K count=512K]. | ||
|
||
Tested on the Banana Pi R1 (aka Lamobo R1) and Banana Pi M1 SBCs | ||
with Allwinner A20 32bit-SoCs (ARMv7-a / arm-linux-gnueabihf). | ||
These devices are RaspberryPi-like small devices. | ||
|
||
RFC: Since more than about 25 similar SBC/SoC models do use the | ||
ahci_sunxi driver, users are encouraged to test it on all the | ||
affected boards and give feedback. | ||
|
||
List of the affected sunxi and other boards and SoCs with SATA using | ||
the ahci_sunxi driver: | ||
$ grep -i -e "^&ahci" arch/arm/boot/dts/sun*dts | ||
and http://linux-sunxi.org/Category:Devices_with_SATA_port | ||
|
||
Signed-off-by: Uenal Mutlu <um@mutluit.com> | ||
--- | ||
drivers/ata/ahci_sunxi.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c | ||
index 911710643305..257986431c79 100644 | ||
--- a/drivers/ata/ahci_sunxi.c | ||
+++ b/drivers/ata/ahci_sunxi.c | ||
@@ -158,7 +158,7 @@ static void ahci_sunxi_start_engine(struct ata_port *ap) | ||
struct ahci_host_priv *hpriv = ap->host->private_data; | ||
|
||
/* Setup DMA before DMA start */ | ||
- sunxi_clrsetbits(hpriv->mmio + AHCI_P0DMACR, 0x0000ff00, 0x00004400); | ||
+ sunxi_clrsetbits(hpriv->mmio + AHCI_P0DMACR, 0x0000ffff, 0x00004433); | ||
|
||
/* Start DMA */ | ||
sunxi_setbits(port_mmio + PORT_CMD, PORT_CMD_START); |
36 changes: 36 additions & 0 deletions
36
patch/kernel/sunxi-next/RFC-drivers-ata-ahci_sunxi-Increased-SATA-AHCI-DMA-TX-RX-FIFOs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Increasing the SATA/AHCI DMA TX/RX FIFOs (P0DMACR.TXTS and .RXTS) from | ||
default 0x0 each to 0x3 each gives a write performance boost of 120MB/s | ||
from lame 36MB/s to 45MB/s previously. Read performance is about 200MB/s | ||
[tested on SSD using dd bs=4K count=512K]. | ||
|
||
Tested on the Banana Pi R1 (aka Lamobo R1) and Banana Pi M1 SBCs | ||
with Allwinner A20 32bit-SoCs (ARMv7-a / arm-linux-gnueabihf). | ||
These devices are RaspberryPi-like small devices. | ||
|
||
RFC: Since more than about 25 similar SBC/SoC models do use the | ||
ahci_sunxi driver, users are encouraged to test it on all the | ||
affected boards and give feedback. | ||
|
||
List of the affected sunxi and other boards and SoCs with SATA using | ||
the ahci_sunxi driver: | ||
$ grep -i -e "^&ahci" arch/arm/boot/dts/sun*dts | ||
and http://linux-sunxi.org/Category:Devices_with_SATA_port | ||
|
||
Signed-off-by: Uenal Mutlu <um@mutluit.com> | ||
--- | ||
drivers/ata/ahci_sunxi.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c | ||
index 911710643305..257986431c79 100644 | ||
--- a/drivers/ata/ahci_sunxi.c | ||
+++ b/drivers/ata/ahci_sunxi.c | ||
@@ -158,7 +158,7 @@ static void ahci_sunxi_start_engine(struct ata_port *ap) | ||
struct ahci_host_priv *hpriv = ap->host->private_data; | ||
|
||
/* Setup DMA before DMA start */ | ||
- sunxi_clrsetbits(hpriv->mmio + AHCI_P0DMACR, 0x0000ff00, 0x00004400); | ||
+ sunxi_clrsetbits(hpriv->mmio + AHCI_P0DMACR, 0x0000ffff, 0x00004433); | ||
|
||
/* Start DMA */ | ||
sunxi_setbits(port_mmio + PORT_CMD, PORT_CMD_START); |
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greetings and thanks.
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need a sunxi next branch with a freshly built kernel. I've no idea whether Igor already rolled out the patched kernel via Armbian's apt repo.
An awful lot of testing is required (since what if Allwinner set the register contents by intention and not by accident since they experienced data corruption back then?!) and the focus needs to be on data integrity. As such testing with a btrfs on a SATA disk is the most simple way to test correctly for potential data corruption issues: https://irclog.whitequark.org/linux-sunxi/2019-05-13#24595322;
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juanesf It could work also on M2U, but DEV kernel only, IIRC NEXT is broken for this board. You only need to download latest images and switch to nightly builds, run apt update/upgrade and see if it works.
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already have the latest version installed and updates, what would be the fortitude of doing a test?
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Report to this thread (even this is not A20 but its successor) https://forum.armbian.com/topic/10352-a20-sata-write-speed-improvement and report numbers with the same iozone command. Numbers from before should also be somewhere.
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The risk of potential DATA CORRUPTION (that's why testing with data integrity in mind is needed as already mentioned above. The more testers the better).
It would be insane to roll out such a patch without any further testing but according to the Twitter filter bubble it seems that's exactly what has already happened in 'Armbian headquarters'.
@igorpecovnik did you really pushed the patched kernels on apt.armbian.com already?
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not after I ran many tests and found no signs of data corruption. I can put update on hold if you think it was too quick and leave only in 5.1.y DEV branch for testing.
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's way too early to push this fix to user installations and on the other hand a 'call for testers' asking for volunteers would've been a great idea.
Without filesystems that checksum not only metadata but also each and every data block it's hard to impossible to spot infrequent data corruption, especially if we're talking about corner cases. That's why I will run an iozone loop on top of btrfs on the only sunxi device I've lying around for tests for the next three days.
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was surely not covered. Let's do more tests. Repository update was reverted on NEXT kernel.
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My test setup survived 24 hours without data corruption. Also no performance degradation. But it's just one single A10 board.
But who else is testing? There's no 'call for testers' in the forum and you clearly communicated the patch would already be part of Armbian at various locations. Why should anybody help testing?
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the best way for an average Joe?
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, to do a try with this patch in my cubieboard1.eos
only I've to build a kernel/uboot DEV with armbian ./compile.sh script and install this result kernel?
or build with next is also posible and this patch will work?
thanks, I'll try iozone before and after.
c4281e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, i think that i see this patch in sunxi-next and sunxi-dev folder, i'll try to compile and try. thanks