fix sil24 regression and muddy the ata tag allocation waters
cover fix sil24 regression and muddy the ata tag allocation waters
The last we left the fix for the reported sil24 regression [1], Tejun had asked that I simplify the patch to just a flag [2].
Patch1 incorporates that feedback. Patch2 tries to make the ata tag allocator implementation slightly better than its current worst case implementation. I'm fine with replacing it with something better from the block layer, but that implementation had better address the quirk that patch1 does.
[1]: https://bugzilla.kernel.org/show_bug.cgi?id=87101
[2]: http://marc.info/?l=linux-ide&m=141511124009903&w=2
---
Dan Williams (2):
libata: allow sata_sil24 to opt-out of tag ordered submission
libata: micro-optimize tag allocation
drivers/ata/libahci.c | 2 +- drivers/ata/libata-core.c | 56 ++++++++++++++++++++++++++------------------- drivers/ata/libata-sff.c | 2 +- drivers/ata/sata_sil24.c | 2 +- include/linux/libata.h | 4 ++- 5 files changed, 37 insertions(+), 29 deletions(-)
PATCH 1/2 libata: allow sata_sil24 to opt-out of tag ordered submission
Ronny reports: https://bugzilla.kernel.org/show_bug.cgi?id=87101
"Since commit 8a4aeec8d "libata/ahci: accommodate tag ordered controllers" the access to the harddisk on the first SATA-port is failing on its first access. The access to the harddisk on the second port is working normal.
When reverting the above commit, access to both harddisks is working fine again."
Maintain tag ordered submission as the default, but allow sata_sil24 to continue with the old behavior.
--- drivers/ata/libata-core.c | 5 ++++- drivers/ata/sata_sil24.c | 2 +- include/linux/libata.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/ata/libata-core.c +4 -1
@@ -4748,7 +4748,10 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)return NULL ;for (i =0 , tag = ap->last_tag +1 ; i < max_queue; i++, tag++) { - tag = tag < max_queue ? tag :0 ; +if (ap->flags &ATA_FLAG_LOWTAG ) + tag = i; +else + tag = tag < max_queue ? tag :0 ;/* the last tag is reserved for internal command. */ if (tag ==ATA_TAG_INTERNAL )
drivers/ata/sata_sil24.c +1 -1
@@ -246,7 +246,7 @@ enum {/* host flags */ SIL24_COMMON_FLAGS =ATA_FLAG_SATA |ATA_FLAG_PIO_DMA |ATA_FLAG_NCQ |ATA_FLAG_ACPI_SATA | -ATA_FLAG_AN |ATA_FLAG_PMP , +ATA_FLAG_AN |ATA_FLAG_PMP |ATA_FLAG_LOWTAG ,SIL24_FLAG_PCIX_IRQ_WOC = (1 <<24 ),/* IRQ loss errata on PCI-X */ IRQ_STAT_4PORTS = 0xf,
include/linux/libata.h +1 -0
@@ -231,6 +231,7 @@ enum {ATA_FLAG_SW_ACTIVITY = (1 <<22 ),/* driver supports sw activity * led */ ATA_FLAG_NO_DIPM = (1 <<23 ),/* host not happy with DIPM */ + ATA_FLAG_LOWTAG = (1 << 24), /* host wants lowest available tag *//* bits 24:31 of ap->flags are reserved for LLD specific flags */
Re: [PATCH 1/2] libata: allow sata_sil24 to opt-out of tag ordered submission
Hello.
Quoted 27 lines · Dan Williams
Ronny reports: https://bugzilla.kernel.org/show_bug.cgi?id=87101
"Since commit8a4aeec8d"libata/ahci: accommodate tag ordered controllers" the access to the harddisk on the first SATA-port is failing on its first access. The access to the harddisk on the second port is working normal.When reverting the above commit, access to both harddisks is working fine again."
Maintain tag ordered submission as the default, but allow
sata_sil24to continue with the old behavior.Cc <[email protected]>Cc Tejun Heo <[email protected]>Reported-by Ronny Hegewald <[email protected]>Signed-off-by Dan Williams <[email protected]>--- drivers/ata/libata-core.c | 5 ++++- drivers/ata/sata_sil24.c | 2 +- include/linux/libata.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)drivers/ata/libata-core.c +0
-0
drivers/ata/libata-core.c static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) · line 4754
Quoted 8 lines
drivers/ata/libata-core.c +4
-1@@ -4748,7 +4748,10 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)return NULL ;for (i =0 , tag = ap->last_tag +1 ; i < max_queue; i++, tag++) { - tag = tag < max_queue ? tag :0 ; +if (ap->flags &ATA_FLAG_LOWTAG ) + tag = i; +else + tag = tag < max_queue ? tag :0 ;
Ugh, this is clear abuse of the ?: operator... Why not simply:
else if (tag >= max_queue) tag = 0;
[...]
MBR, Sergei
A message that is not in the archive (sent off-list or not yet received): CAPcyv4h3n+cnvADiEbGgi1EFCqEwhzZ7gt_6XUmSC62aOf2Dzw@mail.gmail.com
Re: [PATCH 1/2] libata: allow sata_sil24 to opt-out of tag ordered submission
Quoted 37 lines · Dan Williams
Quoted 22 lines
Quoted 21 lines
Ronny reports: https://bugzilla.kernel.org/show_bug.cgi?id=87101
"Since commit8a4aeec8d"libata/ahci: accommodate tag ordered controllers" the access to the harddisk on the first SATA-port is failing on its first access. The access to the harddisk on the second port is working normal.When reverting the above commit, access to both harddisks is working fine again."
Maintain tag ordered submission as the default, but allow
sata_sil24to continue with the old behavior.Cc <[email protected] <mailto:[email protected]>>Cc Tejun Heo <[email protected] <mailto:[email protected]>>Reported-by Ronny Hegewald <[email protected]>Signed-off-by Dan Williams <[email protected]>--- drivers/ata/libata-core.c | 5 ++++- drivers/ata/sata_sil24.c | 2 +- include/linux/libata.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)Quoted 5 lines
drivers/ata/libata-core.c static struct ata_queued_cmd *ata_qc_new(struct
Quoted 5 lines
drivers/ata/libata-core.c +0
-0@@ -4748,7 +4748,10 @@ static struct ata_queued_cmd *ata_qc_new(struct
ata_port*ap)Quoted 8 lines
Quoted 8 lines
drivers/ata/libata-core.c +4
-1return NULL ;for (i =0 , tag = ap->last_tag +1 ; i < max_queue; i++, tag++) { - tag = tag < max_queue ? tag :0 ; +if (ap->flags &ATA_FLAG_LOWTAG ) + tag = i; +else + tag = tag < max_queue ? tag :0 ;
Quoted 7 lines
Quoted 4 lines
Ugh, this is clear abuse of the ?: operator... Why not simply:
else if (tag >=
max_queue)
tag = 0;"Abuse"!? Let's just call it "creative differences adding in a minimal quirk while neglecting to refactor" ;-).
In fact, the old code had the same abuse, I didn't notice that...
Quoted 1 line
Sure, that's cleaner.
Thanks. :-)
MBR, Sergei
Re: [PATCH 1/2] libata: allow sata_sil24 to opt-out of tag ordered submission
In reply to Sergei ShtylyovQuoted 11 lines · Sergei Shtylyov
drivers/ata/libata-core.c static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) · line 4754
Quoted 6 lines
drivers/ata/libata-core.c +4
-1for (i =0 , tag = ap->last_tag +1 ; i < max_queue; i++, tag++) { - tag = tag < max_queue ? tag :0 ; +if (ap->flags &ATA_FLAG_LOWTAG ) + tag = i; +else + tag = tag < max_queue ? tag :0 ;Ugh, this is clear abuse of the ?: operator... Why not simply:
else if (tag >= max_queue) tag = 0;
Why is that a clear abuse? Seems like a pretty typical use to me.
Thanks.
Signature · 1 line
tejun
Re: [PATCH 1/2] libata: allow sata_sil24 to opt-out of tag ordered submission
Hello.
Quoted 9 lines · Tejun Heo
Quoted 8 lines
drivers/ata/libata-core.c static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) · line 4754
Quoted 6 lines
for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) {drivers/ata/libata-core.c +4
-1- tag = tag < max_queue ? tag :0 ; +if (ap->flags &ATA_FLAG_LOWTAG ) + tag = i; +else + tag = tag < max_queue ? tag :0 ;Ugh, this is clear abuse of the ?: operator... Why not simply:
Quoted 4 lines
Quoted 2 lines
else if (tag >= max_queue) tag = 0;Why is that a clear abuse? Seems like a pretty typical use to me.
This is my first reaction to statements like 'x = x < M ? x : 0'. I really
prefer two-liners with *if* to them.
Quoted 1 line
Thanks.
MBR, Sergei
Re: [PATCH 1/2] libata: allow sata_sil24 to opt-out of tag ordered submission
Quoted 4 lines · Sergei Shtylyov
Quoted 1 line
Why is that a clear abuse? Seems like a pretty typical use to me.
This is my first reaction to statements like 'x = x < M ? x : 0'. I really
prefer two-liners with *if* to them.
But that doesn't justify the "clear abuse" part at all. I get that different people may have different preferences but that's not what you expressed.
Thanks.
Signature · 1 line
tejun
Tejun Heo
AppliedRe: [PATCH 1/2] libata: allow sata_sil24 to opt-out of tag ordered submission
In reply to Dan WilliamsQuoted 9 lines · Dan Williams
Ronny reports: https://bugzilla.kernel.org/show_bug.cgi?id=87101
"Since commit8a4aeec8d"libata/ahci: accommodate tag ordered controllers" the access to the harddisk on the first SATA-port is failing on its first access. The access to the harddisk on the second port is working normal.When reverting the above commit, access to both harddisks is working fine again."
Quoted 7 lines
Maintain tag ordered submission as the default, but allow
sata_sil24to continue with the old behavior.Cc <[email protected]>Cc Tejun Heo <[email protected]>Reported-by Ronny Hegewald <[email protected]>Signed-off-by Dan Williams <[email protected]>
Applied to libata/for-3.18-fixes.
Thanks.
Signature · 1 line
tejun
PATCH 2/2 libata: micro-optimize tag allocation
In reply to Dan WilliamsJens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (ATA_FLAG_LOWTAG) [2].
[1]: http://marc.info/?l=linux-ide&m=142137195324687&w=2
[2]: https://bugzilla.kernel.org/show_bug.cgi?id=87101
--- drivers/ata/libahci.c | 2 +- drivers/ata/libata-core.c | 59 ++++++++++++++++++++++++--------------------- drivers/ata/libata-sff.c | 2 +- include/linux/libata.h | 3 +- 4 files changed, 35 insertions(+), 31 deletions(-)
drivers/ata/libahci.c +1 -1
@@ -2423,7 +2423,7 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host, int irq, {int i, rc; - rc =ata_host_start (host); + rc =ata_host_start (host, sht->can_queue);if (rc)return rc;
drivers/ata/libata-core.c +32 -27
124 lines not on this page · raw message
drivers/ata/libata-sff.c +1 -1
@@ -2419,7 +2419,7 @@ int ata_pci_sff_activate_host(struct ata_host *host,const char *drv_name =dev_driver_string (host->dev);int legacy_mode =0 , rc; - rc =ata_host_start (host); + rc =ata_host_start (host, sht->can_queue);if (rc)return rc;
include/linux/libata.h +1 -2
@@ -595,7 +595,6 @@ struct ata_host {struct device *dev;void __iomem *const *iomap;unsigned int n_ports; -unsigned int n_tags;/* nr of NCQ tags */ void *private_data;struct ata_port_operations *ops;unsigned long flags;
@@ -1111,7 +1110,7 @@ extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);extern struct ata_host *ata_host_alloc_pinfo (struct device *dev,const struct ata_port_info *const * ppi,int n_ports);extern int ata_slave_link_init (struct ata_port *ap); -extern int ata_host_start (struct ata_host *host); +extern int ata_host_start (struct ata_host *host,int can_queue);extern int ata_host_register (struct ata_host *host,struct scsi_host_template *sht); extern int ata_host_activate(struct ata_host *host, int irq,
Re: [PATCH 2/2] libata: micro-optimize tag allocation
Quoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."
Quoted 4 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].
That's trivial to do, it's just always having '0' in the cache and that's where the search would start.
Signature · 1 line
Jens Axboe
Re: [PATCH 2/2] libata: micro-optimize tag allocation
Quoted 11 lines · Jens Axboe
Quoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."
Quoted 8 lines
Quoted 4 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].That's trivial to do, it's just always having '0' in the cache and that's where the search would start.
Cool.
Re: [PATCH 2/2] libata: micro-optimize tag allocation
In reply to Jens AxboeQuoted 11 lines · Jens Axboe
Quoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."
Quoted 7 lines
Quoted 4 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].That's trivial to do, it's just always having '0' in the cache and that's where the search would start.
BTW, I'm still puzzled by why sil24 fails with different tags, I can't shake the feeling that some other bug is the cause of this.
Signature · 1 line
Jens Axboe
Re: [PATCH 2/2] libata: micro-optimize tag allocation
Quoted 17 lines · Jens Axboe
Quoted 16 lines · Jens Axboe
Quoted 14 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].
Quoted 6 lines
Quoted 2 lines
That's trivial to do, it's just always having '0' in the cache and that's where the search would start.
BTW, I'm still puzzled by why sil24 fails with different tags, I can't shake the feeling that some other bug is the cause of this.
Yes, a silicon bug :-).
Until "8a4aeec8d2d6 libata/ahci: accommodate tag ordered controllers" never saw a different tag order besides the lowest available. But even "lowest available" will race with completions sometimes.
In any event, it's a puzzle that needs hardware to solve and I'm not in a position to do anything outside of reverting the new behavior.
Re: [PATCH 2/2] libata: micro-optimize tag allocation
In reply to Dan WilliamsQuoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."
Quoted 7 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].[1]: https://urldefense.proofpoint.com/v1/url?u=http://marc.info/?l%3Dlinux-ide%26m%3D142137195324687%26w%3D2&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=cea914a77883ea668400a1f19621d1241cab16f6a4c0e68d0749de4c2448cdb1
[2]: https://urldefense.proofpoint.com/v1/url?u=https://bugzilla.kernel.org/show_bug.cgi?id%3D87101&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=82d11bc720e9f0cbd0ad6aa7e8ece18315ac1e4f97cb02d49460893e5006228e
with my patch, we can fix this as:
drivers/ata/sata_sil24.c +1 -0
@@ -388,6 +388,7 @@ static struct scsi_host_template sil24_sht = { .can_queue = SIL24_MAX_CMDS, .sg_tablesize = SIL24_MAX_SGE, .dma_boundary = ATA_DMA_BOUNDARY, + .tag_alloc_policy = BLK_TAG_ALLOC_FIFO, };static struct ata_port_operations sil24_ops = {
Re: [PATCH 2/2] libata: micro-optimize tag allocation
Quoted 27 lines · Shaohua Li
Quoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."Quoted 7 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].[1]: https://urldefense.proofpoint.com/v1/url?u=http://marc.info/?l%3Dlinux-ide%26m%3D142137195324687%26w%3D2&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=cea914a77883ea668400a1f19621d1241cab16f6a4c0e68d0749de4c2448cdb1
[2]: https://urldefense.proofpoint.com/v1/url?u=https://bugzilla.kernel.org/show_bug.cgi?id%3D87101&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=82d11bc720e9f0cbd0ad6aa7e8ece18315ac1e4f97cb02d49460893e5006228ewith my patch, we can fix this as:
drivers/ata/sata_sil24.c +0
-0
drivers/ata/sata_sil24.c static struct scsi_host_template sil24_sht = { · line 394
Quoted 7 lines
drivers/ata/sata_sil24.c +1
-0@@ -388,6 +388,7 @@ static struct scsi_host_template sil24_sht = { .can_queue = SIL24_MAX_CMDS, .sg_tablesize = SIL24_MAX_SGE, .dma_boundary = ATA_DMA_BOUNDARY, + .tag_alloc_policy = BLK_TAG_ALLOC_FIFO, };static struct ata_port_operations sil24_ops = {
Ok, thanks for that.
We still need patch1 as the minimal fix for the regression, agreed?
Re: [PATCH 2/2] libata: micro-optimize tag allocation
Quoted 34 lines · Dan Williams
Quoted 33 lines · Shaohua Li
Quoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."Quoted 7 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].[1]: https://urldefense.proofpoint.com/v1/url?u=http://marc.info/?l%3Dlinux-ide%26m%3D142137195324687%26w%3D2&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=cea914a77883ea668400a1f19621d1241cab16f6a4c0e68d0749de4c2448cdb1
[2]: https://urldefense.proofpoint.com/v1/url?u=https://bugzilla.kernel.org/show_bug.cgi?id%3D87101&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=82d11bc720e9f0cbd0ad6aa7e8ece18315ac1e4f97cb02d49460893e5006228ewith my patch, we can fix this as:
drivers/ata/sata_sil24.c +1
-0@@ -388,6 +388,7 @@ static struct scsi_host_template sil24_sht = { .can_queue = SIL24_MAX_CMDS, .sg_tablesize = SIL24_MAX_SGE, .dma_boundary = ATA_DMA_BOUNDARY, + .tag_alloc_policy = BLK_TAG_ALLOC_FIFO, };
Quoted 5 lines
drivers/ata/sata_sil24.c static struct scsi_host_template sil24_sht = { · line 394
Quoted 1 line
drivers/ata/sata_sil24.c +0
-0static struct ata_port_operations sil24_ops = {Ok, thanks for that.
We still need patch1 as the minimal fix for the regression, agreed?
The BLK_TAG_ALLOC_FIFO will make blk/blk-mq tag allocation allocates lowest tag (eg, FIFO). So I thought it already fixes the sil24 bug, if I understand the bug clearly.
Thanks,
Shaohua
Re: [PATCH 2/2] libata: micro-optimize tag allocation
Quoted 39 lines · Shaohua Li
Quoted 38 lines · Dan Williams
Quoted 27 lines · Shaohua Li
Quoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."Quoted 7 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].[1]: https://urldefense.proofpoint.com/v1/url?u=http://marc.info/?l%3Dlinux-ide%26m%3D142137195324687%26w%3D2&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=cea914a77883ea668400a1f19621d1241cab16f6a4c0e68d0749de4c2448cdb1
[2]: https://urldefense.proofpoint.com/v1/url?u=https://bugzilla.kernel.org/show_bug.cgi?id%3D87101&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=82d11bc720e9f0cbd0ad6aa7e8ece18315ac1e4f97cb02d49460893e5006228ewith my patch, we can fix this as:
drivers/ata/sata_sil24.c +0
-0drivers/ata/sata_sil24.c static struct scsi_host_template sil24_sht = { · line 394
Quoted 7 lines
drivers/ata/sata_sil24.c +1
-0@@ -388,6 +388,7 @@ static struct scsi_host_template sil24_sht = { .can_queue = SIL24_MAX_CMDS, .sg_tablesize = SIL24_MAX_SGE, .dma_boundary = ATA_DMA_BOUNDARY, + .tag_alloc_policy = BLK_TAG_ALLOC_FIFO, };static struct ata_port_operations sil24_ops = {Ok, thanks for that.
Quoted 6 lines
Quoted 1 line
We still need patch1 as the minimal fix for the regression, agreed?
The
BLK_TAG_ALLOC_FIFOwill make blk/blk-mq tag allocation allocates lowest tag (eg, FIFO). So I thought it already fixes the sil24 bug, if I understand the bug clearly.
It looks like it does, but converting to blk-mq tagging is not suitable for a -stable patch.
Re: [PATCH 2/2] libata: micro-optimize tag allocation
Quoted 42 lines · Dan Williams
Quoted 41 lines · Shaohua Li
Quoted 39 lines · Dan Williams
Quoted 27 lines · Shaohua Li
Quoted 10 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."Quoted 7 lines
So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].[1]: https://urldefense.proofpoint.com/v1/url?u=http://marc.info/?l%3Dlinux-ide%26m%3D142137195324687%26w%3D2&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=cea914a77883ea668400a1f19621d1241cab16f6a4c0e68d0749de4c2448cdb1
[2]: https://urldefense.proofpoint.com/v1/url?u=https://bugzilla.kernel.org/show_bug.cgi?id%3D87101&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=3RFlL12A7nwmLRXunVJq2g%3D%3D%0A&m=5iyIBsm0XLUeBFFdEfPvaP6LL8KiN2TcuEGgJH6RzTc%3D%0A&s=82d11bc720e9f0cbd0ad6aa7e8ece18315ac1e4f97cb02d49460893e5006228ewith my patch, we can fix this as:
drivers/ata/sata_sil24.c +0
-0drivers/ata/sata_sil24.c static struct scsi_host_template sil24_sht = { · line 394
Quoted 7 lines
drivers/ata/sata_sil24.c +1
-0@@ -388,6 +388,7 @@ static struct scsi_host_template sil24_sht = { .can_queue = SIL24_MAX_CMDS, .sg_tablesize = SIL24_MAX_SGE, .dma_boundary = ATA_DMA_BOUNDARY, + .tag_alloc_policy = BLK_TAG_ALLOC_FIFO, };static struct ata_port_operations sil24_ops = {Ok, thanks for that.
We still need patch1 as the minimal fix for the regression, agreed?
Quoted 7 lines
Quoted 4 lines
The
BLK_TAG_ALLOC_FIFOwill make blk/blk-mq tag allocation allocates lowest tag (eg, FIFO). So I thought it already fixes the sil24 bug, if I understand the bug clearly.It looks like it does, but converting to blk-mq tagging is not suitable for a -stable patch.
don't need converting to blk-mq, I added FIFO allocation for legacy tag too, but right, it might not suitable for -stable
Re: [PATCH 2/2] libata: micro-optimize tag allocation
In reply to Dan WilliamsQuoted 15 lines · Dan Williams
Jens notes, "libata tag allocator sucks. Like seriously sucks, it's almost a worst case implementation." Previously I thought SATA mmio latency dominated performance profiles, but as Tejun notes:
"Hmmm... one problem with the existing tag allocator in ata is that
it's not very efficient which actually shows up in profile when libata is used with a very zippy SSD. Given that ata needs a different allocation policies anyway maybe the right thing to do is making the existing allocator suck less."So replace it with a naive enhancement that also supports the existing quirks. Hopefully, soon to be replaced by Shaohua's patches [1], but those do not yet support the quirk needed by sil24 (
ATA_FLAG_LOWTAG) [2].
Quoted 8 lines
[1]: http://marc.info/?l=linux-ide&m=142137195324687&w=2
[2]: https://bugzilla.kernel.org/show_bug.cgi?id=87101Cc Jens Axboe <[email protected]>Cc Tejun Heo <[email protected]>Cc Shaohua Li <[email protected]>Cc Christoph Hellwig <[email protected]>Signed-off-by Dan Williams <[email protected]>
Hmmm... if libata using blk-tag isn't ugly, I think that prolly is the better way to proceed. Let's see how that develops.
Thanks.
Signature · 1 line
tejun