Skip to contentSkip to conversation

lpfc: Correct WQ creation for pagesize

PATCH Superseded James Smart 4 participants 7 messages Feb 12, 2017 – Mar 8, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/16 lpfc: Correct WQ creation for pagesize

Correct WQ creation for pagesize

The driver was calculating the adapter command pagesize indicator from the system pagesize. However, the buffers the driver allocates are only one size (SLI4_PAGE_SIZE), so no calculation was necessary.

Signed-off-by Dick Kennedy <dick.kennedy at broadcom.com>
Signed-off-by James Smart <james.smart at broadcom.com>
Reviewed-by Hannes Reinecke <hare at suse.com>
Reviewed-by Johannes Thumshirn <jthumshirn at suse.de>
Reviewed-by Christoph Hellwig <hch at lst.de>
---
 drivers/scsi/lpfc/lpfc_hw4.h | 2 ++
 drivers/scsi/lpfc/lpfc_sli.c | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_hw4.h +2 -0
index 5646699..964a1fd 100644
@@ -1186,6 +1186,7 @@ struct lpfc_mbx_wq_create {
 #define lpfc_mbx_wq_create_page_size_SHIFT	0
 #define lpfc_mbx_wq_create_page_size_MASK	0x000000FF
 #define lpfc_mbx_wq_create_page_size_WORD	word1
+#define LPFC_WQ_PAGE_SIZE_4096	0x1
 #define lpfc_mbx_wq_create_wqe_size_SHIFT	8
 #define lpfc_mbx_wq_create_wqe_size_MASK	0x0000000F
 #define lpfc_mbx_wq_create_wqe_size_WORD	word1
@@ -1257,6 +1258,7 @@ struct rq_context {
 #define lpfc_rq_context_page_size_SHIFT	0		/* Version 1 Only */
 #define lpfc_rq_context_page_size_MASK	0x000000FF
 #define lpfc_rq_context_page_size_WORD	word0
+#define	LPFC_RQ_PAGE_SIZE_4096	0x1
 	uint32_t reserved1;
 	uint32_t word2;
 #define lpfc_rq_context_cq_id_SHIFT	16
drivers/scsi/lpfc/lpfc_sli.c +5 -4
index 3a8470d..dbe9cb1 100644
@@ -13715,7 +13715,7 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
 			       LPFC_WQ_WQE_SIZE_128);
 			bf_set(lpfc_mbx_wq_create_page_size,
 			       &wq_create->u.request_1,
-			       (PAGE_SIZE/SLI4_PAGE_SIZE));
+			       LPFC_WQ_PAGE_SIZE_4096);
 			page = wq_create->u.request_1.page;
 			break;
 		}
@@ -13741,8 +13741,9 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
 			       LPFC_WQ_WQE_SIZE_128);
 			break;
 		}
-		bf_set(lpfc_mbx_wq_create_page_size, &wq_create->u.request_1,
-		       (PAGE_SIZE/SLI4_PAGE_SIZE));
+		bf_set(lpfc_mbx_wq_create_page_size,
+		       &wq_create->u.request_1,
+		       LPFC_WQ_PAGE_SIZE_4096);
 		page = wq_create->u.request_1.page;
 		break;
 	default:
@@ -13928,7 +13929,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
 		       LPFC_RQE_SIZE_8);
 		bf_set(lpfc_rq_context_page_size,
 		       &rq_create->u.request.context,
-		       (PAGE_SIZE/SLI4_PAGE_SIZE));
+		       LPFC_RQ_PAGE_SIZE_4096);
 	} else {
 		switch (hrq->entry_count) {
 		default:
Signature · 1 line
2.5.0
#1 lore raw

PATCH v3 1/16 lpfc: Correct WQ creation for pagesize

Hi Martin and James,

Quoted 1 line · James Smart

Correct WQ creation for pagesize

Reviewed-by Mauricio Faria de Oliveira <mauricfo at linux.vnet.ibm.com>

Please flag this patch for stable.

This patch resolves a serious problem on IBM Power systems at least.

An (apparently constant) series of invalid iotags cause a series of SCSI command aborts that escalates into host reset, which fails too, bringing the adapter offline.

And it takes forever to boot, as udev waits on the initial SCSI I/O.

Thank you.

[   17.044690] lpfc 0000:01:00.1: 1:0372 iotag x0 is out off range: max 
iotag (x840)
...
[  723.680700] lpfc 0000:01:00.1: 1:(0):0714 SCSI layer issued Bus Reset 
Data: x2003
[  723.680873] lpfc 0000:01:00.1: 1:(0):3172 SCSI layer issued Host 
Reset Data:
[  724.052506] lpfc 0000:01:00.1: 1:0383 Error -5 during scsi sgl post 
operation
[  724.052701] lpfc 0000:01:00.1: 1:(0):3323 Failed host reset, bring it 

offline

Signature · 2 lines
Mauricio Faria de Oliveira
IBM Linux Technology Center
#2 lore raw

PATCH v3 1/16 lpfc: Correct WQ creation for pagesize

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Mauricio" == Mauricio Faria de Oliveira <mauricfo at linux.vnet.ibm.com> writes:

Mauricio,

Mauricio> Please flag this patch for stable.

Mauricio> This patch resolves a serious problem on IBM Power systems at Mauricio> least.

Both patches are already upstream so I can't tag them for stable. Either you or James should mail stable at vger.kernel.org and request for the patches to be queued up.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw

PATCH v3 1/16 lpfc: Correct WQ creation for pagesize

Hi Martin,

Quoted 5 lines · Martin K. Petersen

Mauricio> Please flag this patch for stable.

Both patches are already upstream so I can't tag them for stable. Either you or James should mail stable at vger.kernel.org and request for the patches to be queued up.

Right, sorry; I missed checking the right tree. Thanks for the pointers.

Signature · 2 lines
Mauricio Faria de Oliveira
IBM Linux Technology Center
#4 lore raw

PATCH v3 1/16 lpfc: Correct WQ creation for pagesize

In reply to Martin K. Petersen

Hello stable kernel maintainers,

Quoted 8 lines · Martin K. Petersen

Mauricio> Please flag this patch for stable.

Mauricio> This patch resolves a serious problem on IBM Power systems at Mauricio> least.

Both patches are already upstream so I can't tag them for stable. Either you or James should mail stable at vger.kernel.org and request for the patches to be queued up.

Can this commit be included on stable v4.4+ , please? (in Linus tree)

     8ea73db486cda442f0671f4bc9c03a76be398a28 "scsi: lpfc: Correct WQ 

creation for pagesize"

Thanks!

For documentation purposes, the resolved issue is described on [1].

Following is the rationale for the stable kernel version asked for, in case Broadcom/others would like to discuss/contribute.

These are the 3 commits which introduced the lines changed by the desired fix commit

     0c651878ba3018bb4bbfa2ccd0a876bebb618768 "[SCSI] lpfc 8.3.41: Fixed 
support for 128 byte WQEs"
     5a6f133eea2d0b4f8f75367b803fef0f03acf268 "[SCSI] lpfc 8.3.22: Add 
new mailbox command and new BSG fix"
     c31098cef5e091e22a02ff255f911e0ad71cc393 "[SCSI] lpfc 8.3.23: Fixes 

related to new hardware"

So, checking the oldest release git tag which contains the most recent commit (so the fix applies cleanly)

     $ git tag --contains 0c651878ba3018bb4bbfa2ccd0a876bebb618768 | 
grep -v rc | sort -V
     v3.12
     <...>
     v4.10

And it is cherry-picked/applies cleanly on v3.12:

     $ git checkout -b lpfc-v3.12 v3.12
     Switched to a new branch 'lpfc-v3.12'
     $ git cherry-pick 8ea73db486cda442f0671f4bc9c03a76be398a28
     [lpfc-v3.12 c2b0912e6135] scsi: lpfc: Correct WQ creation for pagesize
     Author: James Smart <jsmart2021 at gmail.com>
     2 files changed, 7 insertions(+), 4 deletions(-)

However, v3.12 seems too old to go back, and it's unclear whether there was any problem actually reported on these older kernel releases, or whether the hardware/configuration that reproduces this problem is supported on v3.12 at all.

On PowerPC (which is directly affected by the fix, as at least IBM Power servers uses a 64k page size by default on most distros), this fix is probably only required on v4.4+, so to cover a distro for which Broadcom doesn't ship inbox drivers to (w/ fix included).

So, I'll ask it for stable v4.4+, and Broadcom/others can expand the range if they see fit/required.

[1] http://www.spinics.net/lists/linux-scsi/msg105886.html

cheers,

Signature · 2 lines
Mauricio Faria de Oliveira
IBM Linux Technology Center
maintainer
#5 lore raw

PATCH v3 1/16 lpfc: Correct WQ creation for pagesize

Quoted 8 lines · Mauricio Faria de Oliveira

Hello stable kernel maintainers,

Quoted 5 lines · Martin K. Petersen

Mauricio> Please flag this patch for stable.

Mauricio> This patch resolves a serious problem on IBM Power systems at Mauricio> least.

Quoted 8 lines
Quoted 3 lines

Both patches are already upstream so I can't tag them for stable. Either you or James should mail stable at vger.kernel.org and request for the patches to be queued up.

Can this commit be included on stable v4.4+ , please? (in Linus tree)

    8ea73db486cda442f0671f4bc9c03a76be398a28 "scsi: lpfc: Correct WQ

creation for pagesize"

I need an ack from a scsi maintainer that this is an ok thing to do before I can do so.

thanks,

greg k-h

#6 lore raw

PATCH v3 1/16 lpfc: Correct WQ creation for pagesize

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Greg" == Greg KH <gregkh at linuxfoundation.org> writes:

Greg,

Quoted 4 lines
Quoted 4 lines

Can this commit be included on stable v4.4+ , please? (in Linus tree)

8ea73db486cda442f0671f4bc9c03a76be398a28 "scsi: lpfc: Correct WQ creation for pagesize"

Greg> I need an ack from a scsi maintainer that this is an ok thing to Greg> do before I can do so.

It's fine with me. This was merged as part of a bigger driver update. And as a result, the patch in question wasn't tagged as a fix/stable candidate.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering