Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1637041 > unrolled thread

Re: Race to power off harming SATA SSDs

Started byPavel Machek <pavel@ucw.cz>
First post2017-05-08 00:00 +0200
Last post2017-05-08 12:00 +0200
Articles 8 on this page of 28 — 9 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Race to power off harming SATA SSDs Pavel Machek <pavel@ucw.cz> - 2017-05-08 00:00 +0200
    Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 09:30 +0200
      Re: Race to power off harming SATA SSDs Ricard Wanderlof <ricard.wanderlof@axis.com> - 2017-05-08 09:40 +0200
        Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 10:20 +0200
          Re: Race to power off harming SATA SSDs Ricard Wanderlof <ricard.wanderlof@axis.com> - 2017-05-08 10:40 +0200
            Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 11:00 +0200
              Re: Race to power off harming SATA SSDs Ricard Wanderlof <ricard.wanderlof@axis.com> - 2017-05-08 11:10 +0200
                Re: Race to power off harming SATA SSDs Hans de Goede <hdegoede@redhat.com> - 2017-05-08 11:10 +0200
                  Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 12:20 +0200
                    Re: Race to power off harming SATA SSDs Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-08 14:00 +0200
                      Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 17:50 +0200
                        Re: Race to power off harming SATA SSDs Pavel Machek <pavel@ucw.cz> - 2017-05-08 23:40 +0200
                      Re: Race to power off harming SATA SSDs Pavel Machek <pavel@ucw.cz> - 2017-05-08 18:50 +0200
                        Re: Race to power off harming SATA SSDs Tejun Heo <tj@kernel.org> - 2017-05-08 19:50 +0200
                          Re: Race to power off harming SATA SSDs Pavel Machek <pavel@ucw.cz> - 2017-05-08 21:00 +0200
                            Re: Race to power off harming SATA SSDs Tejun Heo <tj@kernel.org> - 2017-05-08 21:10 +0200
                        RE: Race to power off harming SATA SSDs Atlant Schmidt <aschmidt@dekaresearch.com> - 2017-05-08 20:50 +0200
                Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 12:20 +0200
      Re: Race to power off harming SATA SSDs Pavel Machek <pavel@ucw.cz> - 2017-05-08 11:30 +0200
        Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 11:40 +0200
          Re: Race to power off harming SATA SSDs Pavel Machek <pavel@ucw.cz> - 2017-05-08 13:00 +0200
            Re: Race to power off harming SATA SSDs Richard Weinberger <richard.weinberger@gmail.com> - 2017-05-08 13:10 +0200
              Re: Race to power off harming SATA SSDs Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-08 14:00 +0200
              Re: Race to power off harming SATA SSDs Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-08 14:00 +0200
                Re: Race to power off harming SATA SSDs Richard Weinberger <richard@nod.at> - 2017-05-08 14:20 +0200
            Re: Race to power off harming SATA SSDs David Woodhouse <dwmw2@infradead.org> - 2017-05-08 13:20 +0200
              Re: Race to power off harming SATA SSDs Pavel Machek <pavel@ucw.cz> - 2017-05-08 14:40 +0200
        Re: Race to power off harming SATA SSDs Richard Weinberger <richard.weinberger@gmail.com> - 2017-05-08 12:00 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1637371

FromPavel Machek <pavel@ucw.cz>
Date2017-05-08 13:00 +0200
Message-ID<tEOyt-2Rv-7@gated-at.bofh.it>
In reply to#1637332
On Mon 2017-05-08 10:34:08, David Woodhouse wrote:
> On Mon, 2017-05-08 at 11:28 +0200, Pavel Machek wrote:
> > 
> > Are you sure you have it right in JFFS2? Do you journal block erases?
> > Apparently, that was pretty much non-issue on older flashes.
> 
> It isn't necessary in JFFS2. It is a *purely* log-structured file
> system (which is why it doesn't scale well past the 1GiB or so that we
> made it handle for OLPC).
> 
> So we don't erase a block until all its contents are obsolete. And if
> we fail to complete the erase... well the contents are either going to
> fail a CRC check, or... still be obsoleted by later entries elsewhere.
> 
> And even if it *looks* like an erase has completed and the block is all
> 0xFF, we erase it again and write a 'clean marker' to it to indicate
> that the erase was completed successfully. Because otherwise it can't
> be trusted.

Aha, nice, so it looks like ubifs is a step back here.

'clean marker' is a good idea... empty pages have plenty of space.

How do you handle the issue during regular write? Always ignore last
successfully written block?

Do you handle "paired pages" problem on MLC?

Best regards,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [prev] | [next] | [standalone]


#1637380

FromRichard Weinberger <richard.weinberger@gmail.com>
Date2017-05-08 13:10 +0200
Message-ID<tEOIb-39M-31@gated-at.bofh.it>
In reply to#1637371
On Mon, May 8, 2017 at 12:49 PM, Pavel Machek <pavel@ucw.cz> wrote:
> Aha, nice, so it looks like ubifs is a step back here.
>
> 'clean marker' is a good idea... empty pages have plenty of space.

If UBI (not UBIFS) faces an empty block, it also re-erases it.
The EC header is uses as clean marker.

> How do you handle the issue during regular write? Always ignore last
> successfully written block?

The last page of a block is inspected and allowed to be corrupted.

> Do you handle "paired pages" problem on MLC?

Nope, no MLC support in mainline so far.

-- 
Thanks,
//richard

[toc] | [prev] | [next] | [standalone]


#1637408

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2017-05-08 14:00 +0200
Message-ID<tEPux-3tj-9@gated-at.bofh.it>
In reply to#1637380
On Mon, 8 May 2017 13:48:07 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> On Mon, 8 May 2017 13:06:17 +0200
> Richard Weinberger <richard.weinberger@gmail.com> wrote:
> 
> > On Mon, May 8, 2017 at 12:49 PM, Pavel Machek <pavel@ucw.cz> wrote:  
> > > Aha, nice, so it looks like ubifs is a step back here.
> > >
> > > 'clean marker' is a good idea... empty pages have plenty of space.    
> > 
> > If UBI (not UBIFS) faces an empty block, it also re-erases it.  
> 
> Unfortunately, that's not the case, though UBI can easily be patched
> to do that (see below).

Sorry for the noise, I was wrong, UBI already re-erases empty blocks
[1].

[1]http://elixir.free-electrons.com/linux/latest/source/drivers/mtd/ubi/attach.c#L983

[toc] | [prev] | [next] | [standalone]


#1637410

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2017-05-08 14:00 +0200
Message-ID<tEPux-3tj-11@gated-at.bofh.it>
In reply to#1637380
On Mon, 8 May 2017 13:06:17 +0200
Richard Weinberger <richard.weinberger@gmail.com> wrote:

> On Mon, May 8, 2017 at 12:49 PM, Pavel Machek <pavel@ucw.cz> wrote:
> > Aha, nice, so it looks like ubifs is a step back here.
> >
> > 'clean marker' is a good idea... empty pages have plenty of space.  
> 
> If UBI (not UBIFS) faces an empty block, it also re-erases it.

Unfortunately, that's not the case, though UBI can easily be patched
to do that (see below).

> The EC header is uses as clean marker.

That is true. If the EC header has been written to a block, that means
this block has been correctly erased.

> 
> > How do you handle the issue during regular write? Always ignore last
> > successfully written block?  

I guess UBIFS can know what was written last, because of the log-based
approach + the seqnum stored along with FS nodes, but I'm pretty sure
UBIFS does not re-write the last written block in case of an unclean
mount. Richard, am I wrong?

> 
> The last page of a block is inspected and allowed to be corrupted.

Actually, it's not really about corrupted pages, it's about pages that
might become unreadable after a few reads.

> 
> > Do you handle "paired pages" problem on MLC?  
> 
> Nope, no MLC support in mainline so far.

Richard and I have put a lot of effort to reliably support MLC NANDs in
mainline, unfortunately this projects has been paused. You can access
the last version of our work here [1] if you're interested (it's
clearly not in a shippable state ;-)).

[1]https://github.com/bbrezillon/linux-sunxi/commits/bb/4.7/ubi-mlc

--->8---
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 93ceea4f27d5..3d76941c9570 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -1121,21 +1121,20 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
                        return err;
                goto adjust_mean_ec;
        case UBI_IO_FF_BITFLIPS:
+       case UBI_IO_FF:
+               /*
+                * Always erase the block if the EC header is empty, even if
+                * no bitflips were reported because otherwise we might
+                * expose ourselves to the 'unstable bits' issue described
+                * here:
+                *
+                * http://www.linux-mtd.infradead.org/doc/ubifs.html#L_unstable_bits
+                */
                err = add_to_list(ai, pnum, UBI_UNKNOWN, UBI_UNKNOWN,
                                  ec, 1, &ai->erase);
                if (err)
                        return err;
                goto adjust_mean_ec;
-       case UBI_IO_FF:
-               if (ec_err || bitflips)
-                       err = add_to_list(ai, pnum, UBI_UNKNOWN,
-                                         UBI_UNKNOWN, ec, 1, &ai->erase);
-               else
-                       err = add_to_list(ai, pnum, UBI_UNKNOWN,
-                                         UBI_UNKNOWN, ec, 0, &ai->free);
-               if (err)
-                       return err;
-               goto adjust_mean_ec;
        default:
                ubi_err(ubi, "'ubi_io_read_vid_hdr()' returned unknown code %d",
                        err);

[toc] | [prev] | [next] | [standalone]


#1637417

FromRichard Weinberger <richard@nod.at>
Date2017-05-08 14:20 +0200
Message-ID<tEPNT-3OI-3@gated-at.bofh.it>
In reply to#1637410
Boris,

Am 08.05.2017 um 13:48 schrieb Boris Brezillon:
>>> How do you handle the issue during regular write? Always ignore last
>>> successfully written block?  
> 
> I guess UBIFS can know what was written last, because of the log-based
> approach + the seqnum stored along with FS nodes, but I'm pretty sure
> UBIFS does not re-write the last written block in case of an unclean
> mount. Richard, am I wrong?

Yes. UBIFS has the machinery but uses it differently. When it faces ECC
errors while replying the journal it can recover good data from the LEB.
It assumes that an interrupted write leads always to ECC errors.

>>
>> The last page of a block is inspected and allowed to be corrupted.
> 
> Actually, it's not really about corrupted pages, it's about pages that
> might become unreadable after a few reads.

As stated before, it assumes an ECC error from an interrupted read.

We could automatically re-write everything in UBIFS that was written last
but we don't have this information for data UBI itself wrote since UBI has
no journal.

If unstable bit can be triggered with current systems we can think of a clever
trick to deal with that. So far nobody was able to show me the problem.

Thanks,
//richard

[toc] | [prev] | [next] | [standalone]


#1637385

FromDavid Woodhouse <dwmw2@infradead.org>
Date2017-05-08 13:20 +0200
Message-ID<tEORP-3cT-1@gated-at.bofh.it>
In reply to#1637371

[Multipart message — attachments visible in raw view] — view raw

On Mon, 2017-05-08 at 12:49 +0200, Pavel Machek wrote:
> On Mon 2017-05-08 10:34:08, David Woodhouse wrote:
> > 
> > On Mon, 2017-05-08 at 11:28 +0200, Pavel Machek wrote:
> > > 
> > > 
> > > Are you sure you have it right in JFFS2? Do you journal block erases?
> > > Apparently, that was pretty much non-issue on older flashes.
> > It isn't necessary in JFFS2. It is a *purely* log-structured file
> > system (which is why it doesn't scale well past the 1GiB or so that we
> > made it handle for OLPC).
> > 
> > So we don't erase a block until all its contents are obsolete. And if
> > we fail to complete the erase... well the contents are either going to
> > fail a CRC check, or... still be obsoleted by later entries elsewhere.
> > 
> > And even if it *looks* like an erase has completed and the block is all
> > 0xFF, we erase it again and write a 'clean marker' to it to indicate
> > that the erase was completed successfully. Because otherwise it can't
> > be trusted.
> Aha, nice, so it looks like ubifs is a step back here.
> 
> 'clean marker' is a good idea... empty pages have plenty of space.

Well... you lose that space permanently. Although I suppose you could
do things differently and erase a block immediately prior to using it.
But in that case why ever write the cleanmarker? Just maintain a set of
blocks that you *will* erase and re-use.

> How do you handle the issue during regular write? Always ignore last
> successfully written block?

Log nodes have a CRC. If you get interrupted during a write, that CRC
should fail.

> Do you handle "paired pages" problem on MLC?

No. It would theoretically be possible, by not considering a write to
the first page "committed" until the second page of the pair is also
written. Essentially, it's not far off expanding the existing 'wbuf'
which we use to gather writes into full pages for NAND, to cover the
*whole* of the set of pages which are affected by MLC.

But we mostly consider JFFS2 to be obsolete these days, in favour of
UBI/UBIFS or other approaches.

[toc] | [prev] | [next] | [standalone]


#1637426

FromPavel Machek <pavel@ucw.cz>
Date2017-05-08 14:40 +0200
Message-ID<tEQ7h-3UW-31@gated-at.bofh.it>
In reply to#1637385
Hi!

> > 'clean marker' is a good idea... empty pages have plenty of space.
> 
> Well... you lose that space permanently. Although I suppose you could
> do things differently and erase a block immediately prior to using it.
> But in that case why ever write the cleanmarker? Just maintain a set of
> blocks that you *will* erase and re-use.

Yes, but erase is slow so that would hurt performance...?

> > How do you handle the issue during regular write? Always ignore last
> > successfully written block?
> 
> Log nodes have a CRC. If you get interrupted during a write, that CRC
> should fail.

Umm. That is not what "unstable bits" issue is about, right?

If you are interrupted during write, you can get into state where
readback will be correct on next boot (CRC, ECC ok), but then the bits
will go back few hours after that. You can't rely on checksums to
detect that.. because the bits will have the right values -- for a while.

> > Do you handle "paired pages" problem on MLC?
> 
> No. It would theoretically be possible, by not considering a write to
> the first page "committed" until the second page of the pair is also
> written. Essentially, it's not far off expanding the existing 'wbuf'
> which we use to gather writes into full pages for NAND, to cover the
> *whole* of the set of pages which are affected by MLC.
> 
> But we mostly consider JFFS2 to be obsolete these days, in favour of
> UBI/UBIFS or other approaches.

Yes, I guess MLC NAND chips are mostly too big for jjfs2.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [prev] | [next] | [standalone]


#1637341

FromRichard Weinberger <richard.weinberger@gmail.com>
Date2017-05-08 12:00 +0200
Message-ID<tENCp-2jk-9@gated-at.bofh.it>
In reply to#1637326
Pavel,

On Mon, May 8, 2017 at 11:28 AM, Pavel Machek <pavel@ucw.cz> wrote:
> Are you sure you have it right in JFFS2? Do you journal block erases?
> Apparently, that was pretty much non-issue on older flashes.

This is what the website says, yes. Do you have hardware where you can
trigger it?
If so, I'd love to get access to it.

So far I never saw the issue, sometimes people claim to suffer from it
but when I
inspect the problems in detail it is always something else.

-- 
Thanks,
//richard

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web