Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3451458yba; Mon, 29 Apr 2019 02:35:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeCqZf7FhBXmRyMV0+kpCbKvqE35Uf+ExKekkFxkMi2R2xhEF8YrYSCt9IIZAJLMK+LAbI X-Received: by 2002:a63:330e:: with SMTP id z14mr57347334pgz.4.1556530519311; Mon, 29 Apr 2019 02:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556530519; cv=none; d=google.com; s=arc-20160816; b=dQOiu6xyJBwepRx2gBInuROjlwcMQEa57MnP8CvCuFdB0jme+dvhKzSaTBiIXO32YL Vel6y3InLTvZCUw61o47mBcjWHenckuq7eSGI4eD96eurHQYtdUsoFKIY1tZOBWyXx/Z VpzRP3FR+l675GP955pJVQ+tNghKq4BxxWN84TBlZqltf+mP9xbhUcxL3KcDMEdJ1ByY unhFeNDHIP/KjitWvQMZ25G4eLjzBREHFIUXjloHgSl0O2mSCU+j9Lsk/7LwRnENf5me uddxE02ZXnexPyI9UmGhNTX2j9YorPe5U2Vvbuoamrx0HQfyIC8OeG2SDZ/kyUDOoarc oJtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=nt0ePNB5a5CJASdEuXsWHNJt2oAcXnzw/adcUmTYNlU=; b=TrizFd3oByjGrScRsnAmOXGaMT2NPLl26PbPa2boAwygRfQnkk+gOHqRyYiEzkLWN+ 2u77D6K+JCvHcTJuIQFPj7twXP3nCKUZPKtRM6c2v5+ffiIrHWELj84pJ5R6XLnQjdI8 EwrjCTjIYAKi/fJSqa3U5k3Tck/k5Qc80SGKZ+eW+UZr09UsS/KLsnwwPcmhc64nl8bC eCaxTzaXa62oZTRGpBtOB6025K8oh0PQNpON9iyOVJ6mvo5+rG3sy/0q3gG5Pw6RKzLq t2Zj9R6nArlDAxk6ARfPIZEUTmz0+9flnRtQtbX9LCA+T4tjCd86mf1wQayz9Ssf2wTT LOog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m79si33723874pfi.81.2019.04.29.02.35.03; Mon, 29 Apr 2019 02:35:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727639AbfD2JeO convert rfc822-to-8bit (ORCPT + 99 others); Mon, 29 Apr 2019 05:34:14 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:44111 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbfD2JeN (ORCPT ); Mon, 29 Apr 2019 05:34:13 -0400 X-Originating-IP: 90.88.147.33 Received: from xps13 (aaubervilliers-681-1-27-33.w90-88.abo.wanadoo.fr [90.88.147.33]) (Authenticated sender: miquel.raynal@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id BE49DFF825; Mon, 29 Apr 2019 09:34:07 +0000 (UTC) Date: Mon, 29 Apr 2019 11:34:06 +0200 From: Miquel Raynal To: masonccyang@mxic.com.tw Cc: bbrezillon@kernel.org, "Boris Brezillon" , computersforpeace@gmail.com, dwmw2@infradead.org, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, richard@nod.at, zhengxunli@mxic.com.tw Subject: Re: [PATCH] mtd: rawnand: Add Macronix NAND read retry and randomizer support Message-ID: <20190429113406.09d5b68f@xps13> In-Reply-To: References: <1554780172-23111-1-git-send-email-masonccyang@mxic.com.tw> <20190409090427.22de9917@collabora.com> <20190409114701.744c2c8c@collabora.com> <20190410092258.332ef399@collabora.com> <20190411085353.4c1af008@collabora.com> <20190411112943.1fecfa69@collabora.com> <20190417090817.7a0c4638@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mason, Boris, masonccyang@mxic.com.tw wrote on Thu, 18 Apr 2019 11:30:05 +0800: > Hi Miquel, > > > > > > > > > > > > > > > > > > > > > > Re: [PATCH] mtd: rawnand: Add Macronix NAND read retry > and > > > > > > > randomizer > > > > > > > > > support > > > > > > > > > > > > > > > > > > > > On Tue, 9 Apr 2019 17:35:39 +0800 > > > > > > > > > > masonccyang@mxic.com.tw wrote: > > > > > > > > > > > > > > > > > > > > > > > + > > > > > > > > > > > > > +static const struct kobj_attribute > sysfs_mxic_nand = > > > > > > > > > > > > > + __ATTR(nand_random, S_IRUGO | S_IWUSR, > > > > > > > > > > > > > + mxic_nand_rand_type_show, > > > > > > > > > > > > > + mxic_nand_rand_type_store); > > > > > > > > > > > > > > > > > > > > > > > > No, we don't want to expose that through a sysfs > file, > > > > > > > especially > > > > > > > > > since > > > > > > > > > > > > changing the randomizer config means making the NAND > > > > > > unreadable > > > > > > > for > > > > > > > > > > > > those that have used it before the change. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Our on-die randomizer is still readable from user > after > > > the > > > > > > > function > > > > > > > > > > > is enabled. > > > > > > > > > > > > > > > > > > > > You mean the memory is still readable no matter the > > > randomizer > > > > > > > state. > > > > > > > > > > Not sure how that's possible, but okay. > > > > > > > > > > > > > > > > > > > > > This randomizer is just like a internal memory cell > > > > > > > > > > > reliability enhanced. > > > > > > > > > > > > > > > > > > > > Why don't you enable it by default then? > > > > > > > > > > > > > > > > > > The penalty of randomizer is read/write performance down. > > > > > > > > > i.e,. tPROG 300 us to 340 us (randomizer enable) > > > > > > > > > therefore, disable it by default. > > > > > > > > > > > > > > > > I'm a bit puzzled. On the NAND I've seen that required data > > > > > > > > randomization it's not something you'd want to disable as > this > > > > > implied > > > > > > > > poor data retention. What's the use case here? Are we > talking > > > about > > > > > SLC > > > > > > > > or MLC NANDs? Should we enable this feature once we > > start seeing > > > > > > > > that > > > > > > > > the NAND starts being less reliable (basically when > read-retry > > > > > happens > > > > > > > > more often)? I really think this is something you > shoulddecide > > > > > > > > kernel > > > > > > > > side, because users have no clue when it's appropriate > > to switch > > > > > > > > this > > > > > > > > feature on/off. > > > > > > > > > > > > > > > > > > > > > > It's SLC NAND and seems to has nothing to do with read-retry > > > happens. > > > > > > > later, I will get more information for your concerns. > > > > > > > > > > > > Well, this feature is optional, and can be enabled to improve > > > > > > reliability. Sounds like a good reason to enable it when your > NAND > > > > > > device starts showing reliability issues, and the number of > > > read_retry > > > > > > attempts reflects the wear level pretty well. Alternatively, you > > > > could > > > > > > use the number of bitflips, but, in any case, don't expect the > user > > > to > > > > > > take this decision, because almost nobody knows what the > randomizer > > > > > > is needed for. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > It could be enable at any time with OTP bit function > and > > > > > that's > > > > > > > why > > > > > > > > > > > we patch it by sys-fs. > > > > > > > > > > > > > > > > > > > > Sorry, but that's not a good reason to expose that > through > > > > > sysfs. > > > > > > > > > > > > > > > > > > Any good way to expose randomizer function for user ? > > > > > > > > > > > > > > > > Don't expose it :P. > > > > > > > > > > > > > > oh, okay, I will remove sys-fs randomizer. > > > > > > > > > > > > > > Is it OK to keep set/get features for randomizer ? > > > > > > > > > > > > I don't think it's a good idea to have dead code, so no. But I'm > > > > pretty > > > > > > sure we'll find a way to use/expose this feature. > > > > > > > > > > okay, great! > > > > > Looking forward to hearing this feature use/expose. > > > > > > > > But for that to happen we are waiting for inputs about when this is > > > > supposed to be used... > > > > > > > > > The main reason to disable Randomizer in default is > > > NOP = 4 (default) change to NOP = 1 (Randomizer enable), > > > NOP: number of partial program cycles in same page > > > > I am not sure to understand, is this related to what we call 'subpages'? > > > yes, > > > > > > > Some OS file systems(or FTL) much concern NOP = 4 and > > > any better way than sys-fs to enable it? > > > > sysfs entry => user action > > The user has absolutely no way to know when it is relevant to enable > > the randomizer. The kernel must be in charge of it. So the question is: > > when is it relevant to enable the randomizer? What criteria? What > > threshold? > > > > Randomizer is according to users' demand that at least two different use > cases. > 1. a need for an operation mode/use case to take advantage of NOP of 4 > without turning on randomizer > 2. another use case for high data integrity by enabling randomizer and > sacrificing NOP > > If user application don't need subpage program (NOP = 1 is ok), > they could enable Randomizer from kernel driver > (i.e., chip->options |= NAND_NO_SUBPAGE_WRITE; & set feature to enable > randomizer) > or user space(i.e., sys-fs.). > > Therefore, default to disbale randomizer(for NOP=4). What about a DT property in the NAND chip node that would be checked in Macronix driver? Or maybe a defconfig entry? This cannot be changed at runtime. Thanks, Miquèl