All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, thenzl@redhat.com,
	jejb@linux.vnet.ibm.com, kashyap.desai@broadcom.com,
	sumit.saxena@broadcom.com, hare@suse.com,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Subject: [PATCH 12/39] megaraid_sas: raid 1 write performance for large io
Date: Mon,  6 Feb 2017 01:59:45 -0800	[thread overview]
Message-ID: <1486375212-17329-13-git-send-email-shivasharan.srikanteshwara@broadcom.com> (raw)
In-Reply-To: <1486375212-17329-1-git-send-email-shivasharan.srikanteshwara@broadcom.com>

Avoid Host side PCI bandwidth bottleneck and hint FW to do Write buffering using
RaidFlag MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT.
Once IO is landed in FW with MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT,
it will do single DMA from host and buffer the Write operation. On back end,
FW will DMA same buffer to the Mirror and Data Arm.
This will improve large block IO performance which bottleneck due to Host side PCI bandwidth limitation.

Consistent ~4000MB T.P for 256K Block size is expected performance numbers.
IOPS for small Block size should be on par with Disk performance.
(E.g 42 SAS Disk in JBOD mode gives 3700MB T.P.
Same Drive used in R1 WT mode, should give ~1800MB T.P)

Using this patch 24 R1 VDs (HDD) gives below performance for Sequential Write.
Without this patch, we cannot reach above 3200MB (Throughput is in MB. )

Block Size   	50% 256K and 50% 4K          100% 256K
4K                 3100                        2030
8K                 3140                        2740
16K                3140                        3140
32K                3400                        3240
64K                3500                        3700
128K               3870                        3870
256K               3920                        3920

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas.h        |  5 +++++
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 32 +++++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index fb3ee17..6e7cb0b 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1409,6 +1409,8 @@ struct megasas_ctrl_info {
 #define SCAN_VD_CHANNEL	0x2
 
 #define MEGASAS_KDUMP_QUEUE_DEPTH               100
+#define MR_LARGE_IO_MIN_SIZE			(32 * 1024)
+#define MR_R1_LDIO_PIGGYBACK_DEFAULT		4
 
 enum MR_SCSI_CMD_TYPE {
 	READ_WRITE_LDIO = 0,
@@ -1875,6 +1877,7 @@ union megasas_frame {
 struct MR_PRIV_DEVICE {
 	bool is_tm_capable;
 	bool tm_busy;
+	atomic_t r1_ldio_hint;
 	u8   interface_type;
 };
 struct megasas_cmd;
@@ -2235,6 +2238,8 @@ struct megasas_instance {
 	bool is_ventura;
 	bool msix_combined;
 	u16 max_raid_mapsize;
+	/* preffered count to send as LDIO irrspective of FP capable.*/
+	u8  r1_ldio_hint_default;
 	u32 nvme_page_size;
 };
 struct MR_LD_VF_MAP {
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 80bfb11..83b8482 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1380,6 +1380,7 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
 	}
 
 	instance->flag_ieee = 1;
+	instance->r1_ldio_hint_default =  MR_R1_LDIO_PIGGYBACK_DEFAULT;
 	fusion->fast_path_io = 0;
 
 	fusion->drv_map_pages = get_order(fusion->drv_map_sz);
@@ -2107,7 +2108,7 @@ static void megasas_stream_detect(struct megasas_instance *instance,
 static void
 megasas_set_raidflag_cpu_affinity(union RAID_CONTEXT_UNION *praid_context,
 				  struct MR_LD_RAID *raid, bool fp_possible,
-				  u8 is_read)
+				  u8 is_read, u32 scsi_buff_len)
 {
 	u8 cpu_sel = MR_RAID_CTX_CPUSEL_0;
 	struct RAID_CONTEXT_G35 *rctx_g35;
@@ -2158,6 +2159,17 @@ megasas_set_raidflag_cpu_affinity(union RAID_CONTEXT_UNION *praid_context,
 	}
 
 	rctx_g35->routing_flags.bits.cpu_sel = cpu_sel;
+
+	/* Always give priority to MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT
+	 * vs MR_RAID_FLAGS_IO_SUB_TYPE_CACHE_BYPASS.
+	 * IO Subtype is not bitmap.
+	 */
+	if ((raid->level == 1) && (!is_read)) {
+		if (scsi_buff_len > MR_LARGE_IO_MIN_SIZE)
+			praid_context->raid_context_g35.raid_flags =
+				(MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT
+				<< MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT);
+	}
 }
 
 /**
@@ -2300,6 +2312,14 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
 		    io_info.isRead && io_info.ra_capable)
 			fp_possible = false;
 
+		/* FP for Optimal raid level 1.
+		 * All large RAID-1 writes (> 32 KiB, both WT and WB modes)
+		 * are built by the driver as LD I/Os.
+		 * All small RAID-1 WT writes (<= 32 KiB) are built as FP I/Os
+		 * (there is never a reason to process these as buffered writes)
+		 * All small RAID-1 WB writes (<= 32 KiB) are built as FP I/Os
+		 * with the SLD bit asserted.
+		 */
 		if (io_info.r1_alt_dev_handle != MR_DEVHANDLE_INVALID) {
 			mrdev_priv = scp->device->hostdata;
 
@@ -2307,13 +2327,21 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
 				(instance->host->can_queue)) {
 				fp_possible = false;
 				atomic_dec(&instance->fw_outstanding);
+			} else if ((scsi_buff_len > MR_LARGE_IO_MIN_SIZE) ||
+				   atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint)) {
+				fp_possible = false;
+				atomic_dec(&instance->fw_outstanding);
+				if (scsi_buff_len > MR_LARGE_IO_MIN_SIZE)
+					atomic_set(&mrdev_priv->r1_ldio_hint,
+						   instance->r1_ldio_hint_default);
 			}
 		}
 
 		/* If raid is NULL, set CPU affinity to default CPU0 */
 		if (raid)
 			megasas_set_raidflag_cpu_affinity(praid_context,
-				raid, fp_possible, io_info.isRead);
+				raid, fp_possible, io_info.isRead,
+				scsi_buff_len);
 		else
 			praid_context->raid_context_g35.routing_flags.bits.cpu_sel =
 				MR_RAID_CTX_CPUSEL_0;
-- 
2.8.3

  parent reply	other threads:[~2017-02-06 10:01 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06  9:59 [PATCH 00/39] megaraid_sas: Updates for scsi-next Shivasharan S
2017-02-06  9:59 ` [PATCH 01/39] Revert "scsi: megaraid_sas: Enable or Disable Fast path based on the PCI Threshold Bandwidth" Shivasharan S
2017-02-06 10:07   ` Shivasharan Srikanteshwara
2017-02-06 10:24   ` Hannes Reinecke
2017-02-06 13:08   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 02/39] megaraid_sas: cpu select rework Shivasharan S
2017-02-06 10:25   ` Hannes Reinecke
2017-02-06 13:08   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 03/39] megaraid_sas: raid 1 fast path code optimize Shivasharan S
2017-02-06 10:26   ` Hannes Reinecke
2017-02-06 13:12   ` Tomas Henzl
2017-02-06 13:27     ` Kashyap Desai
2017-02-06 13:38       ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 04/39] megaraid_sas: 32 bit descriptor fire cmd optimization Shivasharan S
2017-02-06 10:23   ` Hannes Reinecke
2017-02-06 10:38     ` Shivasharan Srikanteshwara
2017-02-06 10:38     ` Shivasharan Srikanteshwara
2017-02-06 13:40   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 05/39] megaraid_sas: Refactor MEGASAS_IS_LOGICAL macro using sdev Shivasharan S
2017-02-06 10:29   ` Hannes Reinecke
2017-02-06 13:44   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 06/39] megaraid_sas: RAID map is accessed for SYS PDs when use_seqnum_jbod_fp is not set Shivasharan S
2017-02-06 10:40   ` Hannes Reinecke
2017-02-06 13:16     ` Shivasharan Srikanteshwara
2017-02-06  9:59 ` [PATCH 07/39] megaraid_sas: Use DID_REQUEUE Shivasharan S
2017-02-06 10:41   ` Hannes Reinecke
2017-02-06 13:46   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 08/39] megaraid_sas: megasas_get_request_descriptor always return valid desc Shivasharan S
2017-02-06 10:43   ` Hannes Reinecke
2017-02-06 13:44     ` Shivasharan Srikanteshwara
2017-02-06 23:54       ` Martin K. Petersen
2017-02-07  0:02         ` Martin K. Petersen
2017-02-06 14:06   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 09/39] megaraid_sas: NVME Interface detection and prop settings Shivasharan S
2017-02-06 10:47   ` Hannes Reinecke
2017-02-06 13:55     ` Shivasharan Srikanteshwara
2017-02-06  9:59 ` [PATCH 10/39] megaraid_sas: NVME interface target prop added Shivasharan S
2017-02-06 10:15   ` Shivasharan Srikanteshwara
2017-02-06 10:48   ` Hannes Reinecke
2017-02-06 14:14   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 11/39] " Shivasharan S
2017-02-06 10:16   ` Shivasharan Srikanteshwara
2017-02-06 10:34   ` Shivasharan Srikanteshwara
2017-02-06 10:41   ` kbuild test robot
2017-02-06 10:51   ` Hannes Reinecke
2017-02-06 14:37   ` Tomas Henzl
2017-02-06  9:59 ` Shivasharan S [this message]
2017-02-06 10:54   ` [PATCH 12/39] megaraid_sas: raid 1 write performance for large io Hannes Reinecke
2017-02-06 14:39   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 13/39] megaraid_sas : set residual bytes count during IO compeltion Shivasharan S
2017-02-06 10:54   ` Hannes Reinecke
2017-02-06 14:39   ` Tomas Henzl
2017-02-06 23:52   ` Martin K. Petersen
2017-02-07 11:07     ` Kashyap Desai
2017-02-07 22:19       ` Martin K. Petersen
2017-02-06  9:59 ` [PATCH 14/39] megaraid_sas: enhance debug logs in OCR context Shivasharan S
2017-02-06 10:55   ` Hannes Reinecke
2017-02-06 14:44   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 15/39] megaraid_sas: add print in device removal path Shivasharan S
2017-02-06 10:55   ` Hannes Reinecke
2017-02-06 14:46   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 16/39] megaraid_sas: reduce size of fusion_context and use vmalloc if kmalloc fails Shivasharan S
2017-02-06 11:18   ` Hannes Reinecke
2017-02-06 15:40   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 17/39] megaraid_sas: In validate raid map, raid capability is not converted to cpu format for all lds Shivasharan S
2017-02-06 11:18   ` Hannes Reinecke
2017-02-06 15:42   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 18/39] megaraid_sas: MR_TargetIdToLdGet u8 to u16 and avoid invalid raid-map access Shivasharan S
2017-02-06 11:20   ` Hannes Reinecke
2017-02-07 11:54     ` Shivasharan Srikanteshwara
2017-02-06  9:59 ` [PATCH 19/39] megaraid_sas: Big endian RDPQ mode fix Shivasharan S
2017-02-06 11:21   ` Hannes Reinecke
2017-02-06 15:44   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 20/39] megaraid_sas: big endian support changes Shivasharan S
2017-02-06 11:22   ` Hannes Reinecke
2017-02-06 15:46   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 21/39] megaraid_sas: avoid unaligned access in ioctl path Shivasharan S
2017-02-06 11:22   ` Hannes Reinecke
2017-02-06 15:48   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 22/39] megaraid_sas: latest controller OCR capability from FW before sending shutdown DCMD Shivasharan S
2017-02-06 11:23   ` Hannes Reinecke
2017-02-06 15:50   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 23/39] megaraid_sas: set pd_after_lb from MR_BuildRaidContext and initialize pDevHandle to MR_DEVHANDLE_INVALID Shivasharan S
2017-02-06 11:23   ` Hannes Reinecke
2017-02-06 15:51   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 24/39] megaraid_sas: Change max_cmd from u32 to u16 in all functions Shivasharan S
2017-02-06 11:24   ` Hannes Reinecke
2017-02-06 15:51   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 25/39] megaraid_sas: update can_queue only if the new value is less Shivasharan S
2017-02-06 11:24   ` Hannes Reinecke
2017-02-06 15:52   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 26/39] megaraid_sas: max_fw_cmds are decremented twice, remove duplicate Shivasharan S
2017-02-06 11:24   ` Hannes Reinecke
2017-02-06 15:53   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 27/39] megaraid_sas: megasas_return_cmd does not memset IO frame to zero Shivasharan S
2017-02-06 11:25   ` Hannes Reinecke
2017-02-06 15:57   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 28/39] megaraid_sas: Remove unused pd_index from megasas_build_ld_nonrw_fusion Shivasharan S
2017-02-06 11:25   ` Hannes Reinecke
2017-02-06 15:58   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 29/39] megaraid_sas: Do not set fp_possible if TM capable for non-RW syspdIO, change fp_possible to bool Shivasharan S
2017-02-06 11:26   ` Hannes Reinecke
2017-02-06 15:58   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 30/39] megaraid_sas: During OCR, if get_ctrl_info fails do not continue with OCR Shivasharan S
2017-02-06 11:26   ` Hannes Reinecke
2017-02-06 15:59   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 31/39] megaraid_sas: Change build_mpt_mfi_pass_thru to return void Shivasharan S
2017-02-06 11:27   ` Hannes Reinecke
2017-02-06 16:00   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 32/39] megaraid_sas: Bail out the driver load if ld_list_query fails Shivasharan S
2017-02-06 11:28   ` Hannes Reinecke
2017-02-06 16:01   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 33/39] megaraid_sas: call flush_scheduled_work during controller shutdown/detach Shivasharan S
2017-02-06 11:28   ` Hannes Reinecke
2017-02-06 16:05   ` Tomas Henzl
2017-02-06 17:18     ` Kashyap Desai
2017-02-07  8:50     ` Kashyap Desai
2017-02-06 10:00 ` [PATCH 34/39] megaraid_sas: Use synchronize_irq to wait for IRQs to complete Shivasharan S
2017-02-06 11:29   ` Hannes Reinecke
2017-02-06 16:07   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 35/39] megaraid_sas: Increase internal command pool Shivasharan S
2017-02-06 11:29   ` Hannes Reinecke
2017-02-06 16:08   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 36/39] megaraid_sas: Cleanup VD_EXT_DEBUG and SPAN_DEBUG related debug prints Shivasharan S
2017-02-06 11:30   ` Hannes Reinecke
2017-02-06 16:09   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 37/39] megaraid_sas: Indentation and smatch warning fixes Shivasharan S
2017-02-06 11:30   ` Hannes Reinecke
2017-02-06 16:13   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 38/39] megaraid_sas: Change RAID_1_10_RMW_CMDS to RAID_1_PEER_CMDS and set value to 2 Shivasharan S
2017-02-06 11:31   ` Hannes Reinecke
2017-02-06 16:14   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 39/39] megaraid_sas: driver version upgrade Shivasharan S
2017-02-06 11:31   ` Hannes Reinecke
2017-02-06 16:14   ` Tomas Henzl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486375212-17329-13-git-send-email-shivasharan.srikanteshwara@broadcom.com \
    --to=shivasharan.srikanteshwara@broadcom.com \
    --cc=hare@suse.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sumit.saxena@broadcom.com \
    --cc=thenzl@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.