Skip to contentSkip to conversation

scsi: arcmsr: Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2

PATCH Superseded Ching Huang 2 participants 7 messages Jan 17, 2019 – Jan 22, 2019 SCSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 scsi: arcmsr: Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2

Quoted 1 line

From Ching Huang <[email protected]>

Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2.

---

drivers/scsi/arcmsr/arcmsr.h +2 -2
index a94c513..b98c632 100755
@@ -508,9 +508,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
 	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+	volatile uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
 	uint32_t	postq_index;
-	uint32_t	doneq_index;
+	volatile uint32_t	doneq_index;
 	uint32_t	__iomem *drv2iop_doorbell;
 	uint32_t	__iomem *drv2iop_doorbell_mask;
 	uint32_t	__iomem *iop2drv_doorbell;
drivers/scsi/arcmsr/arcmsr_hba.c +5 -1
index 5736434..88053b1 100755
@@ -1113,7 +1113,11 @@ static int arcmsr_resume(struct pci_dev *pdev)
 	switch (acb->adapter_type) {
 	case ACB_ADAPTER_TYPE_B: {
 		struct MessageUnit_B *reg = acb->pmuB;
-		reg->post_qbuffer[0] = 0;
+		uint32_t i;
+		for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) {
+			reg->post_qbuffer[i] = 0;
+			reg->done_qbuffer[i] = 0;
+		}
 		reg->postq_index = 0;
 		reg->doneq_index = 0;
 		break;
#1 lore raw
Quoted 4 lines · Ching Huang
Quoted 1 line

From Ching Huang <[email protected]>

Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2.

What does this look like from a user perspective? Does it fail every time or does it only fail sometimes?

What's the bug exactly?

There is no Fixes tag...

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 511

Quoted 13 lines

---

drivers/scsi/arcmsr/arcmsr.h +1 -1
index a94c513..b98c632 100755
@@ -508,9 +508,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
 	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+	volatile uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];

There is a well known rule of thumb that when someone uses "volatile" in the kernel it means there is a locking problem... Is this __iomem or something?

Quoted 11 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
 	uint32_t	postq_index;
-	uint32_t	doneq_index;
+	volatile uint32_t	doneq_index;
 	uint32_t	__iomem *drv2iop_doorbell;
 	uint32_t	__iomem *drv2iop_doorbell_mask;
 	uint32_t	__iomem *iop2drv_doorbell;
drivers/scsi/arcmsr/arcmsr_hba.c +0 -0
index 5736434..88053b1 100755

drivers/scsi/arcmsr/arcmsr_hba.c static int arcmsr_resume(struct pci_dev *pdev) · line 1120

Quoted 9 lines
drivers/scsi/arcmsr/arcmsr_hba.c +5 -1
@@ -1113,7 +1113,11 @@ static int arcmsr_resume(struct pci_dev *pdev)
 	switch (acb->adapter_type) {
 	case ACB_ADAPTER_TYPE_B: {
 		struct MessageUnit_B *reg = acb->pmuB;
-		reg->post_qbuffer[0] = 0;
+		uint32_t i;
+		for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) {
+			reg->post_qbuffer[i] = 0;
+			reg->done_qbuffer[i] = 0;
+		}

Is this cause by patch 1 changing the zalloc to regular alloc?? If so then it should be folded into that patch instead of sent separately.

regards,
dan carpenter

#2 lore raw
Quoted 6 lines · Dan Carpenter
Quoted 4 lines · Ching Huang
Quoted 1 line

From Ching Huang <[email protected]>

Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2.

Quoted 7 lines

What does this look like from a user perspective? Does it fail every time or does it only fail sometimes?

What's the bug exactly?

There is no Fixes tag...
From user's perspective, hibernate/resume are OK.

But following IO may cause 'isr get an illegal ccb command' in log/messages sometime.

Quoted 4 lines
Quoted 4 lines

---

Quoted 14 lines

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 511

Quoted 10 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
index a94c513..b98c632 100755
@@ -508,9 +508,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
 	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+	volatile uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];

There is a well known rule of thumb that when someone uses "volatile" in the kernel it means there is a locking problem... Is this __iomem or something?

The done_qbuffer was a command completion queue, it was an area written by IO processor and read by device driver. So, ...

Quoted 16 lines
Quoted 16 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
 	uint32_t	postq_index;
-	uint32_t	doneq_index;
+	volatile uint32_t	doneq_index;
 	uint32_t	__iomem *drv2iop_doorbell;
 	uint32_t	__iomem *drv2iop_doorbell_mask;
 	uint32_t	__iomem *iop2drv_doorbell;
drivers/scsi/arcmsr/arcmsr_hba.c +0 -1
index 5736434..88053b1 100755
@@ -1113,7 +1113,11 @@ static int arcmsr_resume(struct pci_dev *pdev)
 	switch (acb->adapter_type) {
 	case ACB_ADAPTER_TYPE_B: {
 		struct MessageUnit_B *reg = acb->pmuB;
-		reg->post_qbuffer[0] = 0;
Quoted 8 lines

drivers/scsi/arcmsr/arcmsr_hba.c static int arcmsr_resume(struct pci_dev *pdev) · line 1120

Quoted 5 lines
drivers/scsi/arcmsr/arcmsr_hba.c +5 -0
+		uint32_t i;
+		for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) {
+			reg->post_qbuffer[i] = 0;
+			reg->done_qbuffer[i] = 0;
+		}

Is this cause by patch 1 changing the zalloc to regular alloc?? If so then it should be folded into that patch instead of sent separately.

These fully clear delivery and completion queues are for fixing 'isr get an illegal ccb command'. It is nothing related to Zalloc or alloc.

Quoted 5 lines

regards,
dan carpenter

#3 lore raw
Quoted 10 lines · Ching Huang
Quoted 9 lines · Dan Carpenter
Quoted 4 lines · Ching Huang
Quoted 1 line

From Ching Huang <[email protected]>

Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2.

What does this look like from a user perspective? Does it fail every time or does it only fail sometimes?

Quoted 7 lines
Quoted 4 lines

What's the bug exactly?

There is no Fixes tag...
From user's perspective, hibernate/resume are OK.

But following IO may cause 'isr get an illegal ccb command' in log/messages sometime.

Quoted 1 line

You will need to resend with that information included in the commit message.

Quoted 17 lines
Quoted 17 lines

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 511

Quoted 13 lines

---

drivers/scsi/arcmsr/arcmsr.h +1 -1
index a94c513..b98c632 100755
@@ -508,9 +508,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
 	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+	volatile uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];

There is a well known rule of thumb that when someone uses "volatile" in the kernel it means there is a locking problem... Is this __iomem or something?

Quoted 2 lines

The done_qbuffer was a command completion queue, it was an area written by IO processor and read by device driver. So, ...

I'm not totally positive I understand this sentence. I can find a bunch of places which read from this buffer, but I haven't immediately found which place writes to it. Can you give me a function name that I should read?

Quoted 4 lines
Quoted 4 lines

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 513

Quoted 4 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
 	uint32_t	postq_index;
-	uint32_t	doneq_index;
+	volatile uint32_t	doneq_index;

The volatile here is not right. It's just normal memory.

regards,
dan carpenter

#4 lore raw
Quoted 15 lines · Dan Carpenter
Quoted 14 lines · Ching Huang
Quoted 13 lines · Dan Carpenter
Quoted 4 lines · Ching Huang
Quoted 1 line

From Ching Huang <[email protected]>

Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2.

What does this look like from a user perspective? Does it fail every time or does it only fail sometimes?

What's the bug exactly?

There is no Fixes tag...
From user's perspective, hibernate/resume are OK.

Quoted 7 lines
Quoted 3 lines

But following IO may cause 'isr get an illegal ccb command' in log/messages sometime.

Quoted 1 line

You will need to resend with that information included in the commit message.

OK. I will resend this patch later.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 9 lines

---

drivers/scsi/arcmsr/arcmsr.h +0 -0
index a94c513..b98c632 100755

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 511

Quoted 5 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
@@ -508,9 +508,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
 	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+	volatile uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];

There is a well known rule of thumb that when someone uses "volatile" in the kernel it means there is a locking problem... Is this __iomem or something?

Quoted 7 lines
Quoted 2 lines

The done_qbuffer was a command completion queue, it was an area written by IO processor and read by device driver. So, ...

I'm not totally positive I understand this sentence. I can find a bunch of places which read from this buffer, but I haven't immediately found which place writes to it. Can you give me a function name that I should read?

Well, we allocate memory for struct MessageUnit_B in arcmsr_alloc_ccb_pool(), by assign to acb->dma_coherent_handle2. Then we tell IO controller its DMA address in arcmsr_iop_confirm(). When a command was completed, controller's firmware program will write a completion ccb in done_qbuffer through DMA. So, you can't see any driver funtion write to it.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 513

Quoted 5 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
 	uint32_t	postq_index;
-	uint32_t	doneq_index;
+	volatile uint32_t	doneq_index;

The volatile here is not right. It's just normal memory.

Right. this volatile is not necessary.

Quoted 3 lines

regards,
dan carpenter

#6 lore raw
In reply to Dan Carpenter
Quoted 50 lines · Dan Carpenter
Quoted 49 lines · Ching Huang
Quoted 15 lines · Dan Carpenter
Quoted 14 lines · Ching Huang
Quoted 13 lines · Dan Carpenter
Quoted 4 lines · Ching Huang
Quoted 1 line

From Ching Huang <[email protected]>

Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2.

What does this look like from a user perspective? Does it fail every time or does it only fail sometimes?

What's the bug exactly?

There is no Fixes tag...
From user's perspective, hibernate/resume are OK.

Quoted 7 lines
Quoted 3 lines

But following IO may cause 'isr get an illegal ccb command' in log/messages sometime.

Quoted 1 line

You will need to resend with that information included in the commit message.

OK. I will resend this patch later.

Quoted 25 lines
Quoted 18 lines
Quoted 4 lines
Quoted 4 lines

---

Quoted 14 lines

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 511

Quoted 10 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
index a94c513..b98c632 100755
@@ -508,9 +508,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
 	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+	volatile uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];

There is a well known rule of thumb that when someone uses "volatile" in the kernel it means there is a locking problem... Is this __iomem or something?

Quoted 2 lines

The done_qbuffer was a command completion queue, it was an area written by IO processor and read by device driver. So, ...

I'm not totally positive I understand this sentence. I can find a bunch of places which read from this buffer, but I haven't immediately found which place writes to it. Can you give me a function name that I should read?

Quoted 8 lines
Quoted 6 lines

Well, we allocate memory for struct MessageUnit_B in arcmsr_alloc_ccb_pool(), by assign to acb->dma_coherent_handle2. Then we tell IO controller its DMA address in arcmsr_iop_confirm(). When a command was completed, controller's firmware program will write a completion ccb in done_qbuffer through DMA. So, you can't see any driver funtion write to it.

DMA memory doesn't need to be marked as volatile.

I see. So I have removed the volatile in patch v2.

Quoted 4 lines

regards,
dan carpenter

#5 lore raw
In reply to Ching Huang
Quoted 49 lines · Ching Huang
Quoted 15 lines · Dan Carpenter
Quoted 14 lines · Ching Huang
Quoted 13 lines · Dan Carpenter
Quoted 4 lines · Ching Huang
Quoted 1 line

From Ching Huang <[email protected]>

Fix suspend/resume of ACB_ADAPTER_TYPE_B part 2.

What does this look like from a user perspective? Does it fail every time or does it only fail sometimes?

What's the bug exactly?

There is no Fixes tag...
From user's perspective, hibernate/resume are OK.

Quoted 7 lines
Quoted 3 lines

But following IO may cause 'isr get an illegal ccb command' in log/messages sometime.

Quoted 1 line

You will need to resend with that information included in the commit message.

OK. I will resend this patch later.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 9 lines

---

drivers/scsi/arcmsr/arcmsr.h +0 -0
index a94c513..b98c632 100755

drivers/scsi/arcmsr/arcmsr.h struct MessageUnit_A · line 511

Quoted 5 lines
drivers/scsi/arcmsr/arcmsr.h +1 -1
@@ -508,9 +508,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
 	uint32_t	post_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-	uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+	volatile uint32_t	done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];

There is a well known rule of thumb that when someone uses "volatile" in the kernel it means there is a locking problem... Is this __iomem or something?

Quoted 7 lines
Quoted 2 lines

The done_qbuffer was a command completion queue, it was an area written by IO processor and read by device driver. So, ...

I'm not totally positive I understand this sentence. I can find a bunch of places which read from this buffer, but I haven't immediately found which place writes to it. Can you give me a function name that I should read?

Quoted 6 lines

Well, we allocate memory for struct MessageUnit_B in arcmsr_alloc_ccb_pool(), by assign to acb->dma_coherent_handle2. Then we tell IO controller its DMA address in arcmsr_iop_confirm(). When a command was completed, controller's firmware program will write a completion ccb in done_qbuffer through DMA. So, you can't see any driver funtion write to it.

DMA memory doesn't need to be marked as volatile.

regards,
dan carpenter