From patchwork Wed Oct 25 21:35:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uma Krishnan X-Patchwork-Id: 10027241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5596060381 for ; Wed, 25 Oct 2017 21:36:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45EDC28C04 for ; Wed, 25 Oct 2017 21:36:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38C7128C60; Wed, 25 Oct 2017 21:36:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4A6928C04 for ; Wed, 25 Oct 2017 21:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751837AbdJYVgT (ORCPT ); Wed, 25 Oct 2017 17:36:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40760 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbdJYVgS (ORCPT ); Wed, 25 Oct 2017 17:36:18 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9PLYNGX096476 for ; Wed, 25 Oct 2017 17:36:18 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2du0kdd9a7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 25 Oct 2017 17:36:17 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Oct 2017 15:36:16 -0600 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Oct 2017 15:36:15 -0600 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9PLaEnV9765120; Wed, 25 Oct 2017 14:36:14 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73587136043; Wed, 25 Oct 2017 15:36:14 -0600 (MDT) Received: from p8tul1-build.aus.stglabs.ibm.com (unknown [9.3.141.206]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP id DA09F13603C; Wed, 25 Oct 2017 15:36:13 -0600 (MDT) From: Uma Krishnan To: linux-scsi@vger.kernel.org, James Bottomley , "Martin K. Petersen" , "Matthew R. Ochs" , "Manoj N. Kumar" Cc: linuxppc-dev@lists.ozlabs.org, Andrew Donnellan , Frederic Barrat , Christophe Lombard Subject: [PATCH 1/3] cxlflash: Use derived maximum write same length Date: Wed, 25 Oct 2017 16:35:57 -0500 X-Mailer: git-send-email 2.1.0 In-Reply-To: <1508967302-54403-1-git-send-email-ukrishn@linux.vnet.ibm.com> References: <1508967302-54403-1-git-send-email-ukrishn@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102521-0012-0000-0000-0000153290C3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007950; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00936423; UDB=6.00471879; IPR=6.00716688; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017714; XFM=3.00000015; UTC=2017-10-25 21:36:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102521-0013-0000-0000-000050042B28 Message-Id: <1508967357-54439-1-git-send-email-ukrishn@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-25_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710250281 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Matthew R. Ochs" The existing write same routine within the cxlflash driver uses a statically defined value for the maximum write same transfer length. While this is close to the value reflected by the original device that was supported by cxlflash, newer devices are capable of much larger lengths. Supporting what the device is capable of offers substantial performance improvement as the scrub routine within cxlflash operates on 'chunk size' units (256MB with a 4K sector size). Instead of a #define, use the write same maximum length that is stored in the block layer in units of 512 byte sectors. This value is initially determined from the block limits VPD page during device discovery and can also be manipulated from sysfs. As a general cleanup, designate the timeout used when executing the write same command as constant. Signed-off-by: Matthew R. Ochs Signed-off-by: Uma Krishnan --- drivers/scsi/cxlflash/sislite.h | 3 --- drivers/scsi/cxlflash/vlun.c | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/cxlflash/sislite.h b/drivers/scsi/cxlflash/sislite.h index 09daa86..bedf1ce 100644 --- a/drivers/scsi/cxlflash/sislite.h +++ b/drivers/scsi/cxlflash/sislite.h @@ -548,7 +548,4 @@ struct sisl_rht_entry_f1 { #define TMF_LUN_RESET 0x1U #define TMF_CLEAR_ACA 0x2U - -#define SISLITE_MAX_WS_BLOCKS 512 - #endif /* _SISLITE_H */ diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c index 703bf1e..5deef57 100644 --- a/drivers/scsi/cxlflash/vlun.c +++ b/drivers/scsi/cxlflash/vlun.c @@ -428,12 +428,14 @@ static int write_same16(struct scsi_device *sdev, u8 *sense_buf = NULL; int rc = 0; int result = 0; - int ws_limit = SISLITE_MAX_WS_BLOCKS; u64 offset = lba; int left = nblks; - u32 to = sdev->request_queue->rq_timeout; struct cxlflash_cfg *cfg = shost_priv(sdev->host); struct device *dev = &cfg->dev->dev; + const u32 s = ilog2(sdev->sector_size) - 9; + const u32 to = sdev->request_queue->rq_timeout; + const u32 ws_limit = blk_queue_get_max_sectors(sdev->request_queue, + REQ_OP_WRITE_SAME) >> s; cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL); scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);