Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1086669rwi; Fri, 14 Oct 2022 12:41:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YDJIRMT0g9FUlsX1xUnAelqzETslKKqBY+tI/zCO67q2+R6et8yEleI9zQDgOUOWwZpA9 X-Received: by 2002:a05:6402:90e:b0:443:ec4b:2b03 with SMTP id g14-20020a056402090e00b00443ec4b2b03mr5477978edz.71.1665776485724; Fri, 14 Oct 2022 12:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665776485; cv=none; d=google.com; s=arc-20160816; b=o4IwrHO+RfaWVEQr/5wofkLTucNV7Izy4VWLJ0ZumIp519hhWZCYlORukl6hrFgN4o JMl9XTjHpxb2s3oY1UnGdrm97JfW7f6Ylkhj1DzvFdy6pjnQaE5zISzBUnwDTIxLNMm/ p5y4+8NEWYSW9HarASJoRDv3R9g7IOMaEVoHclVrbjSROT1ZxysXSMj3w31i4CwOXC19 6C9kJ8wMbLGduoSDipjnAklT9uMwexaXyxHxReiaG824sohLQDWpZn7JNWWAdGLjZ9G/ QI0nidR5pgaluI5XnpzbQXR5lCMn6lLF30EaXDevRJEfIQyS5SY2BcZsdW9mbe2S9Q2m 7cdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:organization:references:in-reply-to:date :cc:to:from:subject:message-id:dkim-signature; bh=3oVx/XxSaraEYgXxlTdKz4mv75fSpJE+2vW+gdrQpsU=; b=gf/imowzhIYUDkZL8o0+yNEm/cWNRRuCqjw9DqRzzbHhM1hbpCS9z5hiWCo98AmTVF OQJuRLJHhUO62BzpwxwnAJqGE9wT+rzxs173QIyphAYPRN7PIXGNYwVWcsIMKFisDNMD +NjMfJK9FQg7/aIVssdu5y3+gIGUzuK/G6FkIjILuFtBp6CiewWxoajcwaPQEi9km37h nXnsDVW04BLgz6AMaHtZLfWK/P0bVs1yTIPMwD/ZQaUZgPzMSsvGx1XQ5iOAvfzOWs2z Uhsdkkf+g6lwMr10CAHyeD4mCxMF+oEV7myKVyi5RQjuZv8V80AEisUzaP9Y7cG2TKxb JNsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@iokpp.de header.s=strato-dkim-0002 header.b=HBC5oLym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk2-20020a170906b0c200b0077f2779c178si2791608ejb.254.2022.10.14.12.41.00; Fri, 14 Oct 2022 12:41:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@iokpp.de header.s=strato-dkim-0002 header.b=HBC5oLym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbiJNTU7 (ORCPT + 99 others); Fri, 14 Oct 2022 15:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbiJNTU5 (ORCPT ); Fri, 14 Oct 2022 15:20:57 -0400 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C112C11C6F6; Fri, 14 Oct 2022 12:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1665775245; s=strato-dkim-0002; d=iokpp.de; h=References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Cc:Date: From:Subject:Sender; bh=3oVx/XxSaraEYgXxlTdKz4mv75fSpJE+2vW+gdrQpsU=; b=HBC5oLym4tU2JiQcHQd/y0tfjGyZp9vv6KQMkZY2Zj/RuNRLYW2N6xXCvPc7fnNeWN Iofry4AW9BKD2emTUzZyyWnqK44LIGdXMRXlyUChqMN8lAGFgmfnuy6f/+O2UxsKuk80 QssjEcD6qLAtqvZMObFjvwlB82EK76Qq69MSmHJmChfBNYOjksHlD08uD6ev8DhTooug XPLextbtoDqg+gpfdOBPh9NbXp/TQTP+Mh4IVLrHgGT+J9PWcg1q//g6qp8DPjQ4OE7Q etBeKXoUEQl81o2Ez/5zkZmb+W+XiZvK+7/Nzgfxi3NtFzu1xU1huO7cnOY3SZfg9phi FheQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":LmkFe0i9dN8c2t4QQyGBB/NDXvjDB6pBSeBwhhSxarlUcu05IioW1izutXbo2gMUkZ35" X-RZG-CLASS-ID: mo00 Received: from [192.168.3.3] by smtp.strato.de (RZmta 48.2.0 DYNA|AUTH) with ESMTPSA id zad98cy9EJKiLdV (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 14 Oct 2022 21:20:44 +0200 (CEST) Message-ID: Subject: Re: [PATCH v2 1/2] scsi: ufs: core: Remove unnecessary if statement From: Bean Huo To: Bart Van Assche , alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, tomas.winkler@intel.com, cang@codeaurora.org, daejun7.park@samsung.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 14 Oct 2022 21:20:44 +0200 In-Reply-To: References: <20221010092937.520013-1-beanhuo@iokpp.de> <20221010092937.520013-2-beanhuo@iokpp.de> Organization: IOKPP Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2022-10-14 at 11:37 -0700, Bart Van Assche wrote: > > @@ -300,9 +300,6 @@ static inline bool > > ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0pr_err("Max General LU supported by UFS isn't > > initialized\n"); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0return false; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* WB is available only for = the logical unit from 0 to 7 */ > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (param_offset =3D=3D UNIT= _DESC_PARAM_WB_BUF_ALLOC_UNITS) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0return lun < UFS_UPIU_MAX_WB_LUN_ID; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return lun =3D=3D UFS_U= PIU_RPMB_WLUN || (lun < dev_info- > > >max_lu_supported); > > =C2=A0=C2=A0 } >=20 > Hi Bean, >=20 > I think the above patch reintroduces the stack overflow issue fixed > by > commit a2fca52ee640 ("scsi: ufs: WB is only available on LUN #0 to > #7"). >=20 > How about reverting commit a2fca52ee640 and fixing the stack overflow > issue in another way than by modifying ufs_is_valid_unit_desc_lun()? >=20 > Thanks, >=20 > Bart Hi Bart,=20 I knew that fix, it was because the user tried to poll dLUNumWriteBoosterBufferAllocUnits from RPMB LU, as you know, RPMB doesn't support WB, but the root cause is that we don't separate normal logical unit descriptors and RPMB unit descriptor when we create sysfs group, in ufshcd_driver_template { ... .sdev_groups =3D ufshcd_driver_groups, } ufshcd_driver_groups { ... &ufs_sysfs_unit_descriptor_group, ... } so all the logical units will have the unified unit descriptor sysfs node. This is wrong. =20 Another problem is that Boot and device LU don't have unit descriptors, but we still create a unit descriptor sysfs node group for boot and device LU. I am working on the Advanced RPMB, and trying to seperate normal unit descriptor and RPMB unit descriptor, will let you know if it is possible. or if you know the solution, please let me know, thanks. Kind regards, Bean