Skip to contentSkip to conversation

esp-pci: fixup deadlock with linux

PATCH Applied Hannes Reinecke 4 participants 8 messages Nov 7, 2014 – Nov 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 esp-pci: fixup deadlock with linux

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

---
 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
hw/scsi/esp-pci.c +2 -0
index 82795e6..77b8647 100644
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }
 
 static void esp_pci_dma_memory_read(void *opaque, uint8_t *buf, int len)
Signature · 1 line
1.7.12.4
#1 lore raw
Quoted 10 lines · Hannes Reinecke

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

Applied, thanks.

Paolo

Quoted 19 lines

---

 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
hw/scsi/esp-pci.c +2 -0
index 82795e6..77b8647 100644
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }
 
 static void esp_pci_dma_memory_read(void *opaque, uint8_t *buf, int len)
#2 lore raw
In reply to Hannes Reinecke
Quoted 19 lines · Hannes Reinecke

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

---
 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
hw/scsi/esp-pci.c +0 -0
index 82795e6..77b8647 100644

hw/scsi/esp-pci.c static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len, · line 273

Quoted 6 lines
hw/scsi/esp-pci.c +2 -0
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }

Missing braces on the if statement here?

hw/scsi/esp-pci.c static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len, · line 275

Quoted 1 line
hw/scsi/esp-pci.c +0 -0
 static void esp_pci_dma_memory_read(void *opaque, uint8_t *buf, int len)

ATB,

Mark.

#3 lore raw
Quoted 16 lines · Mark Cave-Ayland
Quoted 14 lines · Hannes Reinecke

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

---
 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

hw/scsi/esp-pci.c static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len, · line 273

Quoted 11 lines
hw/scsi/esp-pci.c +2 -0
index 82795e6..77b8647 100644
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }

Missing braces on the if statement here?

Sigh.

If you insist ...

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
#4 lore raw
Quoted 31 lines · Hannes Reinecke
Quoted 16 lines · Mark Cave-Ayland
Quoted 14 lines · Hannes Reinecke

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

---
 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

hw/scsi/esp-pci.c static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len, · line 273

Quoted 11 lines
hw/scsi/esp-pci.c +2 -0
index 82795e6..77b8647 100644
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }

Missing braces on the if statement here?

Quoted 7 lines

Sigh.

If you insist ...

Cheers,

Hannes

That's the Qemu coding style.
And you will fail ./script/checkpatch.pl.

Best regards,
-Gonglei

#5 lore raw
Quoted 35 lines · Gonglei
Quoted 33 lines · Hannes Reinecke
Quoted 16 lines · Mark Cave-Ayland
Quoted 14 lines · Hannes Reinecke

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

---
 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

hw/scsi/esp-pci.c static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len, · line 273

Quoted 11 lines
hw/scsi/esp-pci.c +2 -0
index 82795e6..77b8647 100644
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }

Missing braces on the if statement here?

Sigh.

Quoted 9 lines
Quoted 5 lines

If you insist ...

Cheers,

Hannes

That's the Qemu coding style.
And you will fail ./script/checkpatch.pl.

I know. After all, it's not the first patch I've sent.

But I always get the various codingstyle thingies
mixed up.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
#6 lore raw
Quoted 42 lines · Hannes Reinecke
Quoted 41 lines · Gonglei
Quoted 38 lines · Hannes Reinecke
Quoted 16 lines · Mark Cave-Ayland
Quoted 14 lines · Hannes Reinecke

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

---
 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

hw/scsi/esp-pci.c static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len, · line 273

Quoted 11 lines
hw/scsi/esp-pci.c +2 -0
index 82795e6..77b8647 100644
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }

Missing braces on the if statement here?

Sigh.

If you insist ...

Cheers,

Hannes

Quoted 8 lines
Quoted 3 lines

That's the Qemu coding style.
And you will fail ./script/checkpatch.pl.

I know. After all, it's not the first patch I've sent.

But I always get the various codingstyle thingies
mixed up.

Hum. Each community has its own rules :)

Best regards,
-Gonglei

#7 lore raw
In reply to Hannes Reinecke
Quoted 31 lines · Hannes Reinecke
Quoted 16 lines · Mark Cave-Ayland
Quoted 14 lines · Hannes Reinecke

A linux guest will be issuing messages:

[   32.124042] DC390: Deadlock in DataIn_0: DMA aborted unfinished: 000000 bytes remain!!
[   32.126348] DC390: DataIn_0: DMA State: 0

and the HBA will fail to work properly.
Reason is the emulation is not setting the 'DMA transfer done' status correctly.

---
 hw/scsi/esp-pci.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 14 lines

hw/scsi/esp-pci.c static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len, · line 273

Quoted 11 lines
hw/scsi/esp-pci.c +2 -0
index 82795e6..77b8647 100644
@@ -268,6 +268,8 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t *buf, int len,
     /* update status registers */
     pci->dma_regs[DMA_WBC] -= len;
     pci->dma_regs[DMA_WAC] += len;
+    if (pci->dma_regs[DMA_WBC] == 0)
+        pci->dma_regs[DMA_STAT] |= DMA_STAT_DONE;
 }

Missing braces on the if statement here?

Quoted 1 line

Sigh.

I'll fix this, no need to resend.

Paolo