Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [v2 PATCH 1/2] crypto: scatterwalk - Use nth_page instead of doing it by hand
Date: Thu, 13 Mar 2025 03:13:55 +0000	[thread overview]
Message-ID: <20250313031355.GB2806970@google.com> (raw)
In-Reply-To: <Z9I4VBZ4hTWJYFw2@gondor.apana.org.au>

On Thu, Mar 13, 2025 at 09:43:48AM +0800, Herbert Xu wrote:
> On Wed, Mar 12, 2025 at 12:56:22PM -0700, Eric Biggers wrote:
> >
> > This change is unrelated and seems incorrect.  lowmem_page_address() is a mm
> > implementation detail.  page_address() is the right one to use.
> 
> lowmem_page_address is obviously linear, while page_address is not.
> For example, arch/loongarch does something funky with kfence and
> page->virtual so that page_address is non-linear even on 64-bit
> without HIGHMEM.
> 
> Sigh, it seems that they've overridden page_to_virt too so even
> lowmem_page_address is non-linear.  But that's probably just a
> result of people abusing page_to_virt.

Well, it looks like the intention of !HIGHMEM && WANT_PAGE_VIRTUAL was for
page->virtual to contain the linear address, as an optimization for
architectures where multiplication and division are slow and sizeof(struct page)
is not a power of 2.  So the resulting address would be the same, just gotten in
a different way.  __init_single_page() in mm/mm_init.c indeed sets page->virtual
that way.  But if there are now cases where it does not actually contain the
linear address as expected, then such configurations need to be excluded from
the linear sg entry optimization...

- Eric

  reply	other threads:[~2025-03-13  3:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12  4:29 [v2 PATCH 0/2] crypto: Use nth_page instead of doing it by hand Herbert Xu
2025-03-12  4:29 ` [v2 PATCH 1/2] crypto: scatterwalk - " Herbert Xu
2025-03-12 19:56   ` Eric Biggers
2025-03-13  1:43     ` Herbert Xu
2025-03-13  3:13       ` Eric Biggers [this message]
2025-03-12  4:30 ` [v2 PATCH 2/2] crypto: hash " Herbert Xu
2025-03-12 20:09   ` Eric Biggers
2025-03-13  2:36     ` Herbert Xu
2025-03-13  3:07       ` Eric Biggers
2025-03-13  4:04         ` Herbert Xu

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=20250313031355.GB2806970@google.com \
    --to=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.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