linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org, fsverity@lists.linux.dev,
	dm-devel@lists.linux.dev, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org, ardb@kernel.org,
	samitolvanen@google.com, bvanassche@acm.org
Subject: Re: [PATCH v3 6/8] fsverity: improve performance by using multibuffer hashing
Date: Fri, 31 May 2024 11:51:26 -0700	[thread overview]
Message-ID: <20240531185126.GA1153@sol.localdomain> (raw)
In-Reply-To: <ZlmPGEt68OyAfuWo@gondor.apana.org.au>

On Fri, May 31, 2024 at 04:49:28PM +0800, Herbert Xu wrote:
> On Thu, May 30, 2024 at 11:52:58PM -0700, Eric Biggers wrote:
> >
> > Looking at it again a bit more closely, both fsverity and dm-verity have
> > per-block information that they need to keep track of in the queue in addition
> > to the data buffers and hashes: the block number, and in dm-verity's case also a
> > bvec_iter pointing to that block.
> 
> Again I'm not asking you to make this API asynchronous at all.

What exactly are you suggesting, then?  It seems that you want multibuffer
hashing to be supported by the existing ahash API.  However, that only works if
it's made asynchronous, given how the messages would have to be queued up on a
global queue.  That has a huge number of issues which I've already explained.
(And it was even tried before, and it failed.)

> I was just commenting on the added complexity in fsverify due to
> the use of the linear shash API instead of the page-based ahash API.

It's the other way around.  The shash version is much simpler.  Just look at the
diff of commit 8fcd94add6c5 that changed from ahash to shash:

    4 files changed, 71 insertions(+), 200 deletions(-)

> This complexity was then compounded by the multi-buffer support.

fsverity and dm-verity will have to be updated to use multibuffer hashing
anyway, given that transparently supporting it in the existing API is not
viable.  If your concern is that in my current patchset fsverity and dm-verity
have separate code paths for multibuffer vs. single-buffer, as I mentioned I can
address that by restructuring them to operate on arrays (similar to what I
already did with the crypto API part).

> I think this would look a lot simpler if it moved back to ahash.
> 
> The original commit mentioned that ahash was bad for fsverify
> because of vmalloc.  But the only use of linear pointers in fsverify
> seems to be from kmalloc.  Where is the vmalloc coming from?

XFS is working on adding support for fsverity, and XFS was planning to provide
their Merkle tree blocks in vmalloced buffers.  Their plans have shifted several
times, and I think their latest plan no longer uses vmalloced buffers.  But in
any case it's still very convenient and much simpler to be able to just use
virtual addresses without having to worry about what type of memory it is.

- Eric

  reply	other threads:[~2024-05-31 18:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  0:23 [PATCH v3 0/8] Optimize dm-verity and fsverity using multibuffer hashing Eric Biggers
2024-05-07  0:23 ` [PATCH v3 1/8] crypto: shash - add support for finup_mb Eric Biggers
2024-05-07  0:23 ` [PATCH v3 2/8] crypto: testmgr - generate power-of-2 lengths more often Eric Biggers
2024-05-07  0:23 ` [PATCH v3 3/8] crypto: testmgr - add tests for finup_mb Eric Biggers
2024-05-07  0:23 ` [PATCH v3 4/8] crypto: x86/sha256-ni - add support " Eric Biggers
2024-05-07  0:23 ` [PATCH v3 5/8] crypto: arm64/sha256-ce " Eric Biggers
2024-05-07  0:23 ` [PATCH v3 6/8] fsverity: improve performance by using multibuffer hashing Eric Biggers
2024-05-31  4:50   ` Herbert Xu
2024-05-31  6:13     ` Eric Biggers
2024-05-31  6:52       ` Eric Biggers
2024-05-31  8:49         ` Herbert Xu
2024-05-31 18:51           ` Eric Biggers [this message]
2024-06-03 18:50             ` Eric Biggers
2024-06-04  9:39               ` Herbert Xu
2024-05-31  8:38       ` Herbert Xu
2024-05-07  0:23 ` [PATCH v3 7/8] dm-verity: hash blocks with shash import+finup when possible Eric Biggers
2024-05-07  0:23 ` [PATCH v3 8/8] dm-verity: improve performance by using multibuffer hashing Eric Biggers

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=20240531185126.GA1153@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=fsverity@lists.linux.dev \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).