public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Vipin Kumar <vipin.kumar@st.com>
To: "Artem.Bityutskiy@nokia.com" <Artem.Bityutskiy@nokia.com>
Cc: Viresh KUMAR <viresh.kumar@st.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"David.Woodhouse@intel.com" <David.Woodhouse@intel.com>
Subject: Re: [PATCH] Newly erased page read workaround
Date: Fri, 1 Apr 2011 14:03:06 +0530	[thread overview]
Message-ID: <4D958DC2.5000607@st.com> (raw)
In-Reply-To: <1301640710.2789.11.camel@localhost>

On 4/1/2011 12:21 PM, Artem Bityutskiy wrote:
> On Fri, 2011-04-01 at 11:58 +0530, Vipin Kumar wrote:
>> On 3/31/2011 7:21 PM, Artem Bityutskiy wrote:
>>> Hi,
>>>
>>
>> Hello Artem,
>>

Hello Artem,

>>> sorry for late reply, was too busy and also missed your patch somehow.
>>>
>>> On Thu, 2011-02-24 at 11:40 +0530, Viresh Kumar wrote:
>>>> From: Vipin Kumar <vipin.kumar@st.com>
>>>>
>>>> A newly erased page contains ff in data as well as spare area. While reading an
>>>> erased page, the read out ecc from spare area does not match the ecc generated
>>>> by fsmc ecc hardware accelarator. This is because ecc of data ff ff is not ff
>>>> ff. This leads to errors when jffs2 fs erases and reads back the pages to
>>>> ensure consistency.
>>>>
>>>> This patch adds a software workaround to ensure that the ecc check is not
>>>> performed for erased pages. An erased page is checked by checking data as ff ff.
>>>>
>>>> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
>>>> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
>>>> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
>>>
>>> ...
>>>
>>>> +		/*
>>>> +		 * This is a temporary erase check. A newly erased page read
>>>> +		 * would result in an ecc error because the oob data is also
>>>> +		 * erased to FF and the calculated ecc for an FF data is not
>>>> +		 * FF..FF.
>>>> +		 * This is a workaround to skip performing correction in case
>>>> +		 * data is FF..FF
>>>> +		 */
>>>> +		for (k = 0; k < eccsize; k++) {
>>>> +			if (*(p + k) != 0xff)
>>>> +				break;
>>>> +		}
>>>> +
>>>
>>> So eccsize is 512, and you are going to compare 512 bytes on every read?
>>> Isn't it a very bad and wasteful solution? May be you could invent
>>> something less straight-forward but more optimal?
>>>
>>> Let's suppose ECC corresponding to all 0xFFs is P. May be you could do
>>> this wasteful check only if ECC == P, not all the time?
>>>
>>
>> Basically, the hardware only reports the flipped bit offset and not the actual ecc 
>> at the time of reading. It reports ecc only at the time of writing. So, comparing 
>> ECCs is not a possibility while reading.
> 
> Sorry, my suggestion was stupid.
> 
> But can you do like this?
> 
> 1. Read ECC.
> 2. Compare it to all 0xFFs
> 3. If all 0xFFs, then check the page contents against 0xFF.
> 4. If not all 0xFFs, then this is not an erased page for sure, because
> erased pages have to have all 0xFFs in OOB.
> 

Yes, OK

>> The other solution can be to write P into OOB every time a page is erased. In that 
>> case we put a hook in erase.
> 
> You cannot write anything to the ECC positions in OOB after erasure
> because if you do this, how are you going to store real ECC in the
> subsequent writes?
> 

Yes, you are right...This is not a feasible solution

>>> Also, Ivan pointed you the right thing - you might have bit-flips on an
>>> erased eraseblock. If not on freshly, then on an erasblock which was
>>> erased and then not used for long time. If this is not of your concern,
>>
>> In that case an ecc error would be reported since the ecc wont match the stored 
>> ecc i.e FFFF and the driver would mark it as a normal corrupted page
> 
> I'm confused. So you erased eraseblock A. Everything there contains
> 0xFFs, including the OOB area.
> 
> Now you have one of the modern lashes. You gen bit-flips in the page.
> Say, a couple of bits flip. You read this page. You compare the contents
> of the page with 0xFF and find out that the contends in not all 0xFFs.
> What do you do then?
> 

Then, the normal driver takes over and it reports an error because the 
number of errors in the page are beyond 8 bits (maximum the FSMC ecc 
logic can correct). Effectively speaking, the read page returns an error 
indicating that the page could not be read properly

Ideally, any filesystem would mark it as a bad block

Regards
Vipin

  reply	other threads:[~2011-04-01  8:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24  6:10 [PATCH] Newly erased page read workaround Viresh Kumar
2011-02-24  9:38 ` Ivan Djelic
2011-02-24 10:20   ` Vipin Kumar
2011-02-24 11:10     ` Ivan Djelic
2011-02-24 11:36       ` Vipin Kumar
2011-03-22  4:36 ` viresh kumar
2011-03-31 13:51 ` Artem Bityutskiy
2011-04-01  6:28   ` Vipin Kumar
2011-04-01  6:51     ` Artem Bityutskiy
2011-04-01  8:33       ` Vipin Kumar [this message]
2011-04-01  8:39         ` Artem Bityutskiy
2011-04-01  9:06           ` Vipin Kumar
2011-04-01  9:42             ` Artem Bityutskiy
2011-04-01 12:14             ` Ivan Djelic
2011-04-01 13:04               ` Artem Bityutskiy
2011-04-01 14:04                 ` Ivan Djelic
2011-04-01 14:16                   ` Artem Bityutskiy
2011-04-01 14:49                     ` Ivan Djelic
2011-04-01 14:58                       ` Ricard Wanderlof
2011-04-01 15:46                         ` Ivan Djelic
2011-04-01 16:09                     ` Ivan Djelic
2011-04-01 16:16                       ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D958DC2.5000607@st.com \
    --to=vipin.kumar@st.com \
    --cc=Artem.Bityutskiy@nokia.com \
    --cc=David.Woodhouse@intel.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=viresh.kumar@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox