Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3545254pxb; Sun, 31 Jan 2021 20:27:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBpbM6ML6b5ch9FdunPfNR1HmloBw/SWq/78d4FPX9/4ua9uHGJUiFF2JxXnO4z1L9dC/4 X-Received: by 2002:a50:ef0a:: with SMTP id m10mr17364694eds.38.1612153648868; Sun, 31 Jan 2021 20:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612153648; cv=none; d=google.com; s=arc-20160816; b=YgZdfju+cWCRrZpP9/Z0xW/ccGpuG5l2HacQBXBv/0T3ZGEtGcJ+STIwbSSvXqrflV /2ABftxZai6F2PTR1QeN/8pIu8fOB9ptZmLfaxDuoFcEuliShfWpz90Q0yUvrJ70p9I/ hr6ijJe+jkfMXN15LogNmZYzvPcD1282AQd656YQ/5yiIUR3tHAkHeH4fFcmK0TLOBWk wbAsFCjONBay7DWAxekfkkjR0lIbaAwlvm7lqh3tTerR7qTViMT/vHT851VEVRKV/F4L TdB5hCT9z7HhJpiu53DxAIhc929EQLnAS0Vl/DnZB1OEPxAQqxxLPi8zdQwUuA2+BiWX /wYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding:date :message-id:in-reply-to:cc:to:from:sender:reply-to:subject :mime-version:dkim-signature:dkim-filter; bh=4CaMWmOxTRQ4Yvh5Egmq/VowEgz2jyK7bRflwWVi//g=; b=H/Z/YaalILKU3B0fKG0ToOUYQIlzzy5tPSDtctUFNcijbkkYcodPtgbz6zTzjWM8pI OmL34wKLORXilaIs7WaJ9Lb39ZQlV1xgpeUYl0OGn4HAmx7rNplCbFNYBuH95Qb9g9XR x4jaKnOX0anhDX2zQTAJgjjVDW75Rz5cnQwe1mwMzUbiP2+4oO5ZyozGCb5zwB0uB5XR cCiE5nLI5eLaj/MS2B+zlVbKuvuLZ9vLhYNyfep1XB0azJNuJo6wOBg8AilQNNxQ7cOR LenUmRLQKX8smRFQfyTL38I7YS1r/tIqhErgV/zLOpk107/bETinhfO1yquDk7bth1xU tBog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VP7cOWaO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si9744584edq.173.2021.01.31.20.27.05; Sun, 31 Jan 2021 20:27:28 -0800 (PST) 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=pass header.i=@samsung.com header.s=mail20170921 header.b=VP7cOWaO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231171AbhBAE0A (ORCPT + 99 others); Sun, 31 Jan 2021 23:26:00 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:56523 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbhBAEZu (ORCPT ); Sun, 31 Jan 2021 23:25:50 -0500 Received: from epcas3p3.samsung.com (unknown [182.195.41.21]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210201042502epoutp046fe5d973c9ddae7a7c1e95e8b7abd545~fhRGhOKj71663116631epoutp04j for ; Mon, 1 Feb 2021 04:25:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210201042502epoutp046fe5d973c9ddae7a7c1e95e8b7abd545~fhRGhOKj71663116631epoutp04j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612153502; bh=4CaMWmOxTRQ4Yvh5Egmq/VowEgz2jyK7bRflwWVi//g=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=VP7cOWaOIgG3nQaGUVL5/gtwTr3yEG2NfDy2tspxFvR66j6p3owX6kBzYDmOz9i6x GGUNTEAVX7wmDlH5XwBgB7vs98xv7BsgJ6bH4E37+q4ZkpSNRLvMrrMDHXnhzJAuDM DJmCcmqCz/o7G5XRSUKtu7/sL2PUGlHeFg3b1JYA= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas3p3.samsung.com (KnoxPortal) with ESMTP id 20210201042501epcas3p324f93d079b2b4cbe46209d413bc811f7~fhRGC5IB91510715107epcas3p3d; Mon, 1 Feb 2021 04:25:01 +0000 (GMT) Received: from epcpadp3 (unknown [182.195.40.17]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4DTZbx5xfjz4x9Q0; Mon, 1 Feb 2021 04:25:01 +0000 (GMT) Mime-Version: 1.0 Subject: RE: [PATCH 3/8] scsi: ufshpb: Add region's reads counter Reply-To: daejun7.park@samsung.com Sender: Daejun Park From: Daejun Park 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 , "asutoshd@codeaurora.org" , Zang Leigang , Avi Shchislowski , Bean Huo , "cang@codeaurora.org" , "stanley.chu@mediatek.com" , Avri Altman X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20210127151217.24760-4-avri.altman@wdc.com> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <1891546521.01612153501819.JavaMail.epsvc@epcpadp3> Date: Mon, 01 Feb 2021 12:51:36 +0900 X-CMS-MailID: 20210201035136epcms2p2c245b5fc97d5ecdf0c1ca96496d6e0c6 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y X-Hop-Count: 3 X-CMS-RootMailID: 20210127151311epcas2p1696c2b73f3b4777ac0e7f603790b552f References: <20210127151217.24760-4-avri.altman@wdc.com> <20210127151217.24760-1-avri.altman@wdc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Avri, Thanks for adding HCM support on HPB. I have some opinion for this patch. > +#define WORK_PENDING 0 > +#define ACTIVATION_THRSHLD 4 /* 4 IOs */ Rather than fixing it with macro, how about using sysfs and make it configurable? > @@ -306,12 +325,39 @@ void ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) > ufshpb_set_ppn_dirty(hpb, rgn_idx, srgn_idx, srgn_offset, > transfer_len); > spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); > + > + if (ufshpb_mode == HPB_HOST_CONTROL) > + atomic64_set(&rgn->reads, 0); > + > return; > } > > + if (ufshpb_mode == HPB_HOST_CONTROL) > + reads = atomic64_inc_return(&rgn->reads); > + > if (!ufshpb_is_support_chunk(transfer_len)) > return; <- *this* > > + if (ufshpb_mode == HPB_HOST_CONTROL) { > + /* > + * in host control mode, reads are the main source for > + * activation trials. > + */ > + if (reads == ACTIVATION_THRSHLD) { If the chunk size is not supported, we can not active this region permanently. It may be returned before get this statement. > diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h > index 8a34b0f42754..b0e78728af38 100644 > --- a/drivers/scsi/ufs/ufshpb.h > +++ b/drivers/scsi/ufs/ufshpb.h > @@ -115,6 +115,9 @@ struct ufshpb_region { > /* below information is used by lru */ > struct list_head list_lru_rgn; > unsigned long rgn_flags; > + > + /* region reads - for host mode */ > + atomic64_t reads; I think 32 bits are suitable, because it is normalized by worker on every specific time. Thanks, Daejun