Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp379044pxj; Wed, 16 Jun 2021 04:43:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW0zdlndsz7LneEUHYuK93/h5FtBjSWQqNabiAHLA9ChlkiwSTO7Zam7bcU+Pws0QbMSvc X-Received: by 2002:a05:6e02:1250:: with SMTP id j16mr3302828ilq.247.1623843817095; Wed, 16 Jun 2021 04:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623843817; cv=none; d=google.com; s=arc-20160816; b=U8NtI3FZ62kfkd4brBPKFg34/A5LhwL6XmE0fNsOaf45la2ITiGENKqlE/u4r+2YBu 4MgfR1oVbc5lNjqnCU67ZkAWZ3XfdanrgppY37/3urGxl8r6SjZwetzmcG9phY+gVw5o Q5bz3cMvifECezG6tk6q8vrtfBTYMqycmpk2+eZ+hnc80ZrSqYSgfT/jYwVRxJd37BBN 05BSBWEooR4kiUeIluXyLMdmPLBSQ64OJnR5YJeulltoKwQ0CfyLNMyHvwN3gx2+Dk5W Dnt13H0DtQXBFPWDTAg1/10KDvlaJ1Zb8AdX0i9eOB/JcQqlmosH/jcACp609uRC8Iwf 7rBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:wdcironportexception :ironport-sdr:ironport-sdr:ironport-sdr:dkim-signature; bh=P99cIfh3YaCf1iQ3p7paEldSyhC09XmRBSfA7jS/Q2I=; b=bqg/vS8OtFdTWTOVOQGLQjFLwjhzcualhDmL5JjxPQYB9fCMMQOHWa9jZamnqejSTZ 2hJQkvnNhReDoKBnnJn3pgU9RpuMoXjl4syk01QRS3743g65dzRNYr2rbkgH5IRXhqZq MHjf0uW57JRgniLYIsQtJA4mzeHCpTltVuu+VMfGYBtT5SZoe13ufx1D6OwRs/6NcaV7 bsEg8aoWIH1v50qPkrHX4zx3mXPAm2UpgKbXHLhMDmnmx5Hr2H70h7pIUlzhttgb6VxG xiGY84FS4BxWcR5r5v4A0kNTh3qILYFSsePbYc7FiqsCRjuUmLZUQR+BYfWJjeAEV8zf +ilw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=PBx74tyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si2151247jat.124.2021.06.16.04.43.22; Wed, 16 Jun 2021 04:43:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=PBx74tyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232202AbhFPLaY (ORCPT + 99 others); Wed, 16 Jun 2021 07:30:24 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:4711 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbhFPLaX (ORCPT ); Wed, 16 Jun 2021 07:30:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1623842898; x=1655378898; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tbTtiw8zzy4wrmL5TAZBZR8da7fd1xjZE8i5/2ffHgQ=; b=PBx74tyrVQlSWPZvYvX7gxDEOXtJPGWSU4IkGSDxS/gKaFc/WOto9Y6b bs/11B8Ody/f6EIwtSTFmRGu09hUfvKj5wIJMZMK1tDDjuCdnYhdTmNwh nI738uH/Lzu+BWbJzI+KhwduBwdmqW3M7y74lyQwNjiQGz5UJH/ryiRpv mHOodripdnKFNs3n4gUDm5QezxuQGkaudQpUkbQmY+lGni5hntNRsYuwv OxQp16aTtq1ObFLlren/gRBJzVPt/66gjxYoEQY64QYgftqtM+Q4BvDCl kGopby9NFzQwe8Dg3MfiykBLGzdqsDlQRzjHdjgKUScOsTdRqhw5VCGVS g==; IronPort-SDR: f2pBTdUOow6lI8+pX9+TjJ5lbOYoRYVbXvg5LFJcoSrHGmOnhw5G7kqauZnnlAXpXXIgtjrawe NeYEqIJKPuPbpsA+9m+00nEGljkUqdGpMcUEdOGRAWQ1DtXVxRaQqpwg4sU7CsjqudUwWAOkLu jv5d2lWsfVOzI+gYkIT4WNj8F+w8QXnNgtM+08bRvwpWvgz4fZxde6491WbToRERasdzswW1ql 2SRzqUIMmosCgpBLNlxPIj+KPbzN2cc59YlBaoAmYsceHL6cwCs4iRAXNK/nxBcjC4AIxPKWAF bPQ= X-IronPort-AV: E=Sophos;i="5.83,277,1616428800"; d="scan'208";a="172653636" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 16 Jun 2021 19:28:18 +0800 IronPort-SDR: EnQuJjchdSqKp0GnLZGALW2diLN8ajGTxzK6kcq+bzP6s8q7rQVXSGWuaxIzcTB3SV9ttA4wIf R376rg5GNMPOmUua4Lan3N3W+O3x8XtHdQPgKF9BKen0M8fbYmsCUQkzJpDzC1HvnQ4t/U1NDD OUtgDVLBCwae5HNFpnVcUES/M6DtuIU0RfPrxdzCacLlvPv6ot3YlEBqkqloSzIlBtzjGmYXp2 P7FOkPjAUveICC+Hw8r7p9xaWj6nES6lubtS4+vfeE9rnjNNwm/Ee6DrptLyrQ5gC/5gNpwmAb x1N+1DMywAwDoJBPRl98tVlq Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 04:07:07 -0700 IronPort-SDR: DZnpWzi9AryrB7acobPWPLEOtpDCjSy+yqAD8RFitxGVyz09jdBkhrVQOrqT9TcW4c3cRKSOhv NERtGLd/5okAbQTh02nwQbJUSIsrttBsJr4wh4vkulkDRGdl9rvn11Or4yQTAcW+v1cRvadAtD ziKAQiAaEd9JFxXfSVu83nXG3SzRdV2ap2AlSJWA2My6w1MJYHTAhxLnwL+134IZOCC3TdsVCx 7Cq/8GKThczRM68u3rsynN80MqkW8dxHeXQn2/sS2Wxp/oxEofkPWJRs5PbKCay8CzxXE34Vd0 QcQ= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip01.wdc.com with ESMTP; 16 Jun 2021 04:28:13 -0700 From: Avri Altman To: "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, Bart Van Assche , yongmyung lee , Daejun Park , alim.akhtar@samsung.com, asutoshd@codeaurora.org, Zang Leigang , Avi Shchislowski , Bean Huo , cang@codeaurora.org, stanley.chu@mediatek.com, Avri Altman Subject: [PATCH v11 00/12] Add Host control mode to HPB Date: Wed, 16 Jun 2021 14:27:48 +0300 Message-Id: <20210616112800.52963-1-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v10 -> v11: - rebase on Daejun's v38 v9 -> v10: - rebase on Daejun's v36 v8 -> v9: - Add one more patch: do not send unmap_all in host mode - rebase on Daejun's v35 - tested on one more platform - Galaxy S21 v7 -> v8: - restore Daejun atomic argument to ufshpb_get_req (v31) - Add Daejun's Reviewed-by tag v6 -> v7: - attend CanG's comments - add one more patch to transform set_dirty to iterate_rgn - rebase on Daejun's v32 v5 -> v6: - attend CanG's comments - rebase on Daejun's v29 v4 -> v5: - attend Daejun's comments - Control the number of inflight map requests v3 -> v4: - rebase on Daejun's v25 v2 -> v3: - Attend Greg's and Can's comments - rebase on Daejun's v21 v1 -> v2: - attend Greg's and Daejun's comments - add patch 9 making host mode parameters configurable - rebase on Daejun's v19 The HPB spec defines 2 control modes - device control mode and host control mode. In oppose to device control mode, in which the host obey to whatever recommendation received from the device - In host control mode, the host uses its own algorithms to decide which regions should be activated or inactivated. We kept the host managed heuristic simple and concise. Aside from adding a by-spec functionality, host control mode entails some further potential benefits: makes the hpb logic transparent and readable, while allow tuning / scaling its various parameters, and utilize system-wide info to optimize HPB potential. This series is based on Samsung's device-control HPB2.0 driver This version was tested on Galaxy S21, Galaxy S20, and Xiaomi Mi10 pro. Your meticulous review and testing is mostly welcome and appreciated. Thanks, Avri Avri Altman (12): scsi: ufshpb: Cache HPB Control mode on init scsi: ufshpb: Add host control mode support to rsp_upiu scsi: ufshpb: Transform set_dirty to iterate_rgn scsi: ufshpb: Add reads counter scsi: ufshpb: Make eviction depends on region's reads scsi: ufshpb: Region inactivation in host mode scsi: ufshpb: Add hpb dev reset response scsi: ufshpb: Add "Cold" regions timer scsi: ufshpb: Limit the number of inflight map requests scsi: ufshpb: Do not send umap_all in host control mode scsi: ufshpb: Add support for host control mode scsi: ufshpb: Make host mode parameters configurable Documentation/ABI/testing/sysfs-driver-ufs | 76 ++- drivers/scsi/ufs/ufshcd.h | 2 + drivers/scsi/ufs/ufshpb.c | 583 ++++++++++++++++++++- drivers/scsi/ufs/ufshpb.h | 44 ++ 4 files changed, 676 insertions(+), 29 deletions(-) -- 2.25.1