megaraid_sas : Use Block layer tag support for internal command indexing
Subsystems (2)
PATCH RESEND 6/18 megaraid_sas : Use Block layer tag support for internal command indexing
megaraid_sas driver will use block layer provided tag for indexing internal MPT frames to get any unique MPT frame tied with tag. Each IO request submitted from SCSI mid layer will get associated MPT frame from MPT framepool (retrieved and return back using spinlock inside megaraid_sas driver's submission/completion call back). Getting MPT frame from MPT Frame pool is very expensive operation because of associated spin lock operation (spinlock overhead increase on multi NUMA node). This type of locking in driver is very expensive call considering each IO request need - Acquire and Release of the same lock.
With this support, in IO path driver will directly provide the unique command index(which is based on block layer tag) and will get the MPT frame tied to the tag and this way driver can get rid off lock, which synchronizes the access to MPT frame pool while fetching and returning MPT frame from the pool.
This support in driver provides siginificant performance improvement(on multi NUMA node system)on latest upstream with SCSI.MQ as well as on existing linux distributions.
Here is the data for test executed at Avago-
- IO Tool- FIO
- 4 Socket SMC server. (4 NUMA node server)
- 12 SSDs in JBOD mode .
- 4K Rand READ, QD=32
- SCSI MQ x86_64 (Latest Upstream kernel)
- upto 300% Performance Improvement.
If IOs are running on single Node, perfromance gain is less, but as soon as increase number of nodes, performance improvement is significant. IOs running on all 4 NUMA nodes, with this patch applied IOPs observed was 1170K vs 344K IOPs seen without this patch.
--- drivers/scsi/megaraid/megaraid_sas.h | 15 +-- drivers/scsi/megaraid/megaraid_sas_base.c | 182 +++++++++--------------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 199 ++++++++++++--------------- drivers/scsi/megaraid/megaraid_sas_fusion.h | 6 +- 4 files changed, 165 insertions(+), 237 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +6 -9
@@ -153,6 +153,11 @@#define MFI_FRAME_DIR_BOTH 0x0018#define MFI_FRAME_IEEE 0x0020 +/* Driver internal */ +#define DRV_DCMD_POLLED_MODE 0x1 +#define BLK_TAG_DEBUG 0 +#define BLK_TAG_REFCOUNT 0 +/* * Definition for cmd_status */
@@ -1042,11 +1047,6 @@ struct megasas_ctrl_info {#define VD_EXT_DEBUG 0 -enum MR_MFI_MPT_PTHR_FLAGS { -MFI_MPT_DETACHED =0 , -MFI_LIST_ADDED =1 , -MFI_MPT_ATTACHED =2 , -};enum MR_SCSI_CMD_TYPE {READ_WRITE_LDIO =0 ,
@@ -1888,10 +1888,7 @@ struct megasas_cmd {struct list_head list;struct scsi_cmnd *scmd; - -void *mpt_pthr_cmd_blocked; -atomic_t mfi_mpt_pthr; -u8 is_wait_event; +u8 flags;struct megasas_instance *instance;union {
drivers/scsi/megaraid/megaraid_sas_base.c +67 -115
351 lines not on this page · raw message
drivers/scsi/megaraid/megaraid_sas_fusion.c +91 -108
350 lines not on this page · raw message
drivers/scsi/megaraid/megaraid_sas_fusion.h +1 -5
@@ -679,8 +679,8 @@ struct megasas_cmd_fusion {*/ u32 sync_cmd_idx;u32 index; -u8 flags;u8 pd_r1_lb; +atomic_t refcount; };struct LD_LOAD_BALANCE_INFO {
@@ -792,10 +792,6 @@ struct MR_FW_RAID_MAP_EXT {struct fusion_context {struct megasas_cmd_fusion **cmd_list; -struct list_head cmd_pool; - -spinlock_t mpt_pool_lock; -dma_addr_t req_frames_desc_phys;u8 *req_frames_desc;
Signature · 1 line
1.7.1
Quoted 20 lines · On 04/20/2015 02:33 PM, [email protected] wrote:
megaraid_sasdriver will use block layer provided tag for indexing internal MPT frames to get any unique MPT frame tied with tag. Each IO request submitted from SCSI mid layer will get associated MPT frame from MPT framepool (retrieved and return back using spinlock insidemegaraid_sasdriver's submission/completion call back). Getting MPT frame from MPT Frame pool is very expensive operation because of associated spin lock operation (spinlock overhead increase on multi NUMA node). This type of locking in driver is very expensive call considering each IO request need - Acquire and Release of the same lock.With this support, in IO path driver will directly provide the unique command index(which is based on block layer tag) and will get the MPT frame tied to the tag and this way driver can get rid off lock, which synchronizes the access to MPT frame pool while fetching and returning MPT frame from the pool.
This support in driver provides siginificant performance improvement(on multi NUMA node system)on latest upstream with SCSI.MQ as well as on existing linux distributions.
Here is the data for test executed at Avago-
- IO Tool- FIO
- 4 Socket SMC server. (4 NUMA node server)
- 12 SSDs in JBOD mode .
- 4K Rand READ, QD=32
- SCSI MQx86_64(Latest Upstream kernel)
- upto 300% Performance Improvement.
Quoted 6 lines
If IOs are running on single Node, perfromance gain is less, but as soon as increase number of nodes, performance improvement is significant. IOs running on all 4 NUMA nodes, with this patch applied IOPs observed was 1170K vs 344K IOPs seen without this patch.
Signed-off-by Kashyap Desai <[email protected]>Signed-off-by Sumit Saxena <[email protected]>---
Cheers,
Hannes
Signature · 8 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
This patch needs to be split up: the return_cmd calling convenion changes should be a pach on it's own, the various new debug printks should be a patch on their own, or better jsut be dropped.
Also please drop the BLK_TAG_REFCOUNT/DEBUG code that shouldn't be ina production driver.
Quoted 8 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Tuesday, April 21, 2015 4:12 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH RESEND 6/18]megaraid_sas: Use Block layer tag
support
Quoted 3 lines
for internal command indexing
This patch needs to be split up: the
return_cmdcalling convenion
changes
Quoted 1 line
should be a pach on it's own, the various new debug printks should be a
patch
Quoted 1 line
on their own, or better jsut be dropped.
I can work on this. Logically, there can be two patches- 1) BLK tag support 2) changes in calling convention of return_cmd (this patch will revert the changes done by patch- 90dc9d9 megaraid_sas : MFI MPT linked list corruption fix).
So patch #2 will be very much dependent on patch #1. If someone applies patch #2 without applying patch#1, then bug fixed by "90dc9d9 megaraid_sas : MFI MPT linked list corruption fix " will be exposed again. That's why I club these two patches in a single patch. Regarding debug prints, that can be removed.
Quoted 3 lines
Also please drop the BLK_TAG_REFCOUNT/DEBUG code that shouldn't be ina production driver.
Quoted 7 lines
-----Original Message-----
From: Sumit Saxena [mailto:[email protected]]
Sent: Tuesday, April 21, 2015 6:03 PM
To: 'Christoph Hellwig'
Cc: '[email protected]'; '[email protected]'; '[email protected]'; '[email protected]'; Kashyap Desai
Subject: RE: [PATCH RESEND 6/18]megaraid_sas: Use Block layer tag
support
Quoted 14 lines
for internal command indexing
Quoted 10 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Tuesday, April 21, 2015 4:12 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH RESEND 6/18]megaraid_sas: Use Block layer tag support for internal command indexing
Quoted 5 lines
Quoted 3 lines
This patch needs to be split up: the
return_cmdcalling convenion changes should be a pach on it's own, the various new debug printks should be a patch on their own, or better jsut be dropped.I can work on this. Logically, there can be two patches- 1) BLK tag
support 2)
Quoted 1 line
changes in calling convention of
return_cmd(this patch will revert the
changes
Quoted 1 line
done by patch- 90dc9d9
megaraid_sas: MFI MPT linked list corruption
fix).
Quoted 2 lines
So patch #2 will be very much dependent on patch #1. If someone applies patch #2 without applying patch#1, then bug fixed by "90dc9d9
megaraid_sas
Quoted 2 lines
: MFI MPT linked list corruption fix " will be exposed again. That's why I club these two patches in a single patch. Regarding debug
prints,
Quoted 1 line
that can be removed.
Christoph,
I have started rework for the patches. I will remove debug printks. Can you please let me know should I go for separate patch for change in calling convention return_cmd?
Thanks,
Sumit
Quoted 4 lines
Quoted 2 lines
Also please drop the BLK_TAG_REFCOUNT/DEBUG code that shouldn't be
ina
Quoted 1 line
production driver.
Quoted 4 lines · Sumit Saxena
Christoph,
I have started rework for the patches. I will remove debug printks. Can you please let me know should I go for separate patch for change in calling conventionreturn_cmd?
If it makes a huge difference for you feel free to keep it as-is and document the rationale for it in the changelog.
Quoted 7 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Wednesday, April 22, 2015 5:10 PM
To: Sumit Saxena
Cc: Christoph Hellwig; [email protected]; [email protected]; [email protected]; [email protected]; Kashyap Desai
Subject: Re: [PATCH RESEND 6/18]megaraid_sas: Use Block layer tag
support
Quoted 9 lines
for internal command indexing
Quoted 4 lines · Sumit Saxena
Christoph,
I have started rework for the patches. I will remove debug printks. Can you please let me know should I go for separate patch for change in calling conventionreturn_cmd?If it makes a huge difference for you feel free to keep it as-is and
document
Quoted 1 line
the rationale for it in the changelog.
Ok, I will create single patch and update the rationale for it in changelog.