All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: Milan Broz <mbroz@redhat.com>,
	device-mapper development <dm-devel@redhat.com>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Mandeep Baines <msb@chromium.org>, Will Drewry <wad@chromium.org>,
	Kees Cook <keescook@chromium.org>,
	linux-kernel@vger.kernel.org, Alasdair Kergon <agk@redhat.com>,
	Mark Salyzyn <salyzyn@google.com>
Subject: Re: [PATCH 0/4] dm verity: add support for error correction
Date: Mon, 9 Nov 2015 14:58:31 -0500	[thread overview]
Message-ID: <20151109195831.GA29996@redhat.com> (raw)
In-Reply-To: <20151109191925.GA29185@google.com>

On Mon, Nov 09 2015 at  2:19pm -0500,
Sami Tolvanen <samitolvanen@google.com> wrote:

> On Mon, Nov 09, 2015 at 11:37:35AM -0500, Mike Snitzer wrote:
> > I'm left wondering: can the new error correction code be made an
> > optional feature that is off by default? -- so as to preserve some
> > isolation of this new code from the old dm-verity behaviour.
> 
> It's optional in the sense that you must specify error correction
> parameters in the table to turn it on. Otherwise, verity_dec_decode
> returns -1 and dm-verity handles errors as before.
> 
> > might be good to add a wrapper like verity_fec_is_enabled().
> 
> Sure. I can do this in v2 and address the other feedback and build
> issues as well.

Thanks.

> > Also, the 2 other big questions from Mikulas need answering:
> > 1) why aren't you actually adjustng error codes, returning success, if
> >    dm-verity was able to trap/correct the corruption?
> 
> We don't see actual I/O errors very often. Most corruption we've seen
> is caused by flaky hardware that doesn't return errors. However, I can
> certainly change to code to attempt recovery in this case too.

OK, might be worthwhile to simulate underlying storage errors using the
dm-flakey target underneath dm-verity just to validate your changes work
as expected.

> > 2) please fix the code to preallocate all required memory -- so that
> >    verity_fec_alloc_buffers() isn't called in map.
> 
> I tried to avoid preallocating the buffers because they are relatively
> large (up to 1 MiB depending on the Reed-Solomon parameters) and not
> required unless we have errors to correct. I suppose there's no way to
> safely do this in the middle of I/O?

Basically you want to be able to ensure forward progress of dm-verity
IO even in the face of no system memory being generally available.

Hopefully this doesn't seem like make-work for you.  This one of the
design considerations imposed on DM targets because otherwise you run
the risk of failing IO in the face of low memory.  Which results in
users experiencing failures.

1MB is quite large, especially if it is unlikely to be used.  dm-cache
does cope with the need for memory in the IO path, see 'struct
prealloc', prealloc_data_structs() and other related functions in
drivers/md/dm-cache-target.c

But in the dm-cache case a worker thread is processing work and needs
memory for each work item.  So it isn't the .map function that directly
needs the memory.

DM-thinp also pre-allocates memory using a mempool, e.g. see
drivers/md/dm-thin.c:bio_detain().  But again, this portion of dm-thinp
is being run from a worker thread and _not_ the .map functons.

Could you architect the FEC code such that it punts IO to a worker
thread only if errors need correcting?  And have that worker thread's
additional memory allocations be backed by a mempool?

  reply	other threads:[~2015-11-09 19:58 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05  2:02 [PATCH 0/4] dm verity: add support for error correction Sami Tolvanen
2015-11-05  2:02 ` Sami Tolvanen
2015-11-05  2:02 ` [PATCH 1/4] dm verity: clean up duplicate hashing code Sami Tolvanen
2015-11-17 22:32   ` Kees Cook
2015-11-05  2:02 ` [PATCH 2/4] dm verity: separate function for parsing opt args Sami Tolvanen
2015-11-05  2:02   ` Sami Tolvanen
2015-11-17 22:33   ` Kees Cook
2015-12-02 20:16   ` Mike Snitzer
2015-11-05  2:02 ` [PATCH 3/4] dm verity: add support for forward error correction Sami Tolvanen
2015-11-05  5:36   ` kbuild test robot
2015-11-05  5:36     ` kbuild test robot
2015-11-05 22:06   ` kbuild test robot
2015-11-05 22:06     ` kbuild test robot
2015-11-05  2:02 ` [PATCH 4/4] dm verity: ignore zero blocks Sami Tolvanen
2015-11-05 22:13   ` kbuild test robot
2015-11-05 22:13     ` kbuild test robot
2015-11-05  7:34 ` [PATCH 0/4] dm verity: add support for error correction Milan Broz
2015-11-05 17:33   ` Sami Tolvanen
2015-11-09 16:37     ` Mike Snitzer
2015-11-09 19:19       ` Sami Tolvanen
2015-11-09 19:58         ` Mike Snitzer [this message]
2015-11-12 10:30         ` Milan Broz
2015-12-03  9:36           ` Sami Tolvanen
2015-11-12 18:50         ` Mikulas Patocka
2015-12-03  9:33           ` Sami Tolvanen
2015-12-02 20:22         ` Mike Snitzer
2015-12-03  9:11           ` Sami Tolvanen
2015-11-06 17:23   ` Mikulas Patocka
2015-11-06 19:06     ` Sami Tolvanen
2015-11-06 19:20       ` [dm-devel] " Zdenek Kabelac
2015-11-06 20:27         ` Sami Tolvanen
2015-11-06 21:05           ` Zdenek Kabelac
2015-11-06 21:23             ` Sami Tolvanen
2015-11-07 15:29               ` Mikulas Patocka
2015-11-07 15:20           ` Mikulas Patocka
2015-11-07 15:18       ` Mikulas Patocka
2015-11-09 15:06         ` Austin S Hemmelgarn
2015-12-03 14:26 ` [PATCH v2 0/2] " Sami Tolvanen
2015-12-03 14:26   ` [PATCH v2 1/2] dm verity: add support for forward " Sami Tolvanen
2015-12-03 14:26   ` [PATCH v2 2/2] dm verity: ignore zero blocks Sami Tolvanen
2015-12-03 19:54   ` [PATCH v2 0/2] dm verity: add support for error correction Mike Snitzer
2015-12-03 23:05     ` Mike Snitzer
2015-12-04 10:03       ` Sami Tolvanen
2015-12-04 21:09         ` Mike Snitzer
2015-12-07 13:21           ` Sami Tolvanen
2015-12-07 14:58             ` Mike Snitzer
2015-12-07 14:58               ` Mike Snitzer
2015-12-07 16:31               ` Sami Tolvanen
2015-12-07 18:07                 ` Milan Broz
2015-12-07 19:07                   ` Mike Snitzer
2015-12-08 10:18                     ` Sami Tolvanen

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=20151109195831.GA29996@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbroz@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=msb@chromium.org \
    --cc=salyzyn@google.com \
    --cc=samitolvanen@google.com \
    --cc=wad@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.