Skip to contentSkip to conversation

resolve collision of generic ATA_FLAG_LOWTAG and driver specific flag

PATCH In review Ronny Hegewald 4 participants 6 messages Apr 9, 2015 – Apr 15, 2015 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 resolve collision of generic ATA_FLAG_LOWTAG and driver specific flag

The patch "libata: allow sata_sil24 to opt-out of tag ordered submission" (72dd299d5039a336493993dcc63413cf31d0e662) introduces a regression with the sata_sil24 driver.

The new flag ATA_FLAG_LOWTAG accidentially uses the same bit as SIL24_FLAG_PCIX_IRQ_WOC in the driver. This activates code for Silicon Image 3132, which is only suppossed to run under 3124.

ATA_FLAG_LOWTAG is only used in sata_sil24 and is planned to be removed soon, so lets just use another bit for the flag in sata_sil24.

drivers/ata/sata_sil24.c renamed from drivers/ata/sata_sil24.c.org +1 -1
@@ -247,7 +247,7 @@
 	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_LOWTAG,
-	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 24), /* IRQ loss errata on PCI-X */
+	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 25), /* IRQ loss errata on PCI-X */
 
 	IRQ_STAT_4PORTS		= 0xf,
 };
#1 lore raw
Quoted 17 lines · Ronny Hegewald

The patch "libata: allow sata_sil24 to opt-out of tag ordered submission" (72dd299d5039a336493993dcc63413cf31d0e662) introduces a regression with the sata_sil24 driver.

The new flag ATA_FLAG_LOWTAG accidentially uses the same bit as SIL24_FLAG_PCIX_IRQ_WOC in the driver. This activates code for Silicon Image 3132, which is only suppossed to run under 3124.

ATA_FLAG_LOWTAG is only used in sata_sil24 and is planned to be removed soon, so lets just use another bit for the flag in sata_sil24.

drivers/ata/sata_sil24.c line 250

Quoted 5 lines
drivers/ata/sata_sil24.c renamed from drivers/ata/sata_sil24.c.org +1 -1
@@ -247,7 +247,7 @@
 	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_LOWTAG,
-	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 24), /* IRQ loss errata on PCI-X */
+	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 25), /* IRQ loss errata on PCI-X */

And this will clash as soon as the next flag is added. Please don't abuse the common flag space for driver specific ones, and add a separate flags field for driver specific flags.

#2 lore raw

Hello.

Quoted 14 lines · Christoph Hellwig
Quoted 14 lines

The patch "libata: allow sata_sil24 to opt-out of tag ordered submission" (72dd299d5039a336493993dcc63413cf31d0e662) introduces a regression with the sata_sil24 driver.

The new flag ATA_FLAG_LOWTAG accidentially uses the same bit as SIL24_FLAG_PCIX_IRQ_WOC in the driver. This activates code for Silicon Image 3132, which is only suppossed to run under 3124.

ATA_FLAG_LOWTAG is only used in sata_sil24 and is planned to be removed soon, so lets just use another bit for the flag in sata_sil24.

Quoted 8 lines

drivers/ata/sata_sil24.c line 250

Quoted 8 lines
drivers/ata/sata_sil24.c renamed from drivers/ata/sata_sil24.c.org +1 -1
@@ -247,7 +247,7 @@
  	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_LOWTAG,
-	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 24), /* IRQ loss errata on PCI-X */
+	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 25), /* IRQ loss errata on PCI-X */

This one also collides with ATA_FLAG_SAS_HOST.

Quoted 3 lines

And this will clash as soon as the next flag is added. Please don't abuse the common flag space for driver specific ones, and add a separate flags field for driver specific flags.

Actually, bits 24-31 are reserved for the low-level driver usage (see the
comment below ATA_FLAG_*), so it's the new ATA_FLAG_LOWTAG and ATA_FLAG_SAS_HOST that have violated the convention and should be moved (there's plenty of lower bits due to the removal of some obsolete flags).

WBR, Sergei

#3 lore raw
Quoted 5 lines · Sergei Shtylyov
Quoted 2 lines

drivers/ata/sata_sil24.c line 250

Quoted 2 lines
drivers/ata/sata_sil24.c renamed from drivers/ata/sata_sil24.c.org +1 -1
-	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 24), /* IRQ loss errata on PCI-X */
+	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 25), /* IRQ loss errata on PCI-X */

This one also collides with ATA_FLAG_SAS_HOST.

Quoted 8 lines
Quoted 3 lines

And this will clash as soon as the next flag is added. Please don't abuse the common flag space for driver specific ones, and add a separate flags field for driver specific flags.

Actually, bits 24-31 are reserved for the low-level driver usage (see the
comment below ATA_FLAG_*), so it's the new ATA_FLAG_LOWTAG and ATA_FLAG_SAS_HOST that have violated the convention and should be moved (there's plenty of lower bits due to the removal of some obsolete flags).

Yeah, this something dumb I did way back. Can we please add a separate field for per-controller flags in port_info and all related structs so that we don't do this sharing?

Thanks.

Signature · 1 line
tejun
#4 lore raw
In reply to Ronny Hegewald

Hello.

Quoted 5 lines · Ronny Hegewald

The patch "libata: allow sata_sil24 to opt-out of tag ordered submission" (72dd299d5039a336493993dcc63413cf31d0e662) introduces a regression with the sata_sil24 driver.

The new flag ATA_FLAG_LOWTAG accidentially uses the same bit as

Accidentally.

Quoted 2 lines

SIL24_FLAG_PCIX_IRQ_WOC in the driver. This activates code for Silicon Image 3132, which is only suppossed to run under 3124.

Supposed.

Quoted 2 lines

ATA_FLAG_LOWTAG is only used in sata_sil24 and is planned to be removed soon, so lets just use another bit for the flag in sata_sil24.

Actually, ATA_FLAG_LOWTAG has been removed in the 'for-next' branch, so
this patch is no longer needed. Moreover, the newly assigned flag clashes with the new ATA_FLAG_SATA_PORT.

Quoted 1 line

[...]

MBR, Sergei

#5 lore raw

On Friday 10 April 2015, you wrote

Quoted 2 lines

Actually, ATA_FLAG_LOWTAG has been removed in the 'for-next' branch, so this patch is no longer needed.

Its still needed for kernel <= 3.19, else the driver will malfunction for SI3132 based chipsets.

Quoted 1 line

Moreover, the newly assigned flag clashes with the new ATA_FLAG_SATA_PORT.

As far i can tell its not really a problem in practice for this driver, as they will not be used together. But its certainly better to keep the flags clash-free nonetheless. I will change it to bit 31 in the next version of the patch.