From: Stafford Horne <shorne@gmail.com>
To: Jann Horn <jannh@google.com>
Cc: Jonas Bonn <jonas@southpole.se>, openrisc@lists.librecores.org
Subject: Re: [PATCH] openrisc: Fix pagewalk usage in arch_dma_{clear,set}_uncached
Date: Sat, 8 Oct 2022 05:07:34 +0000 [thread overview]
Message-ID: <Y0EFllJ8uisQOWfv@oscomms1> (raw)
In-Reply-To: <20221006183301.1891131-1-jannh@google.com>
On Thu, Oct 06, 2022 at 08:33:01PM +0200, Jann Horn wrote:
> Since commit 8782fb61cc848 ("mm: pagewalk: Fix race between unmap and page
> walker"), walk_page_range() on kernel ranges won't work anymore,
> walk_page_range_novma() must be used instead.
>
> Note: I don't have an openrisc development setup, so this is completely
> untested.
>
> Fixes: 8782fb61cc848 ("mm: pagewalk: Fix race between unmap and page walker")
> Signed-off-by: Jann Horn <jannh@google.com>
This looks good to me, I will queue it for 6.1 fixes.
> ---
> Normally I would CC stable on a patch like this, but openrisc is mostly an
> in-development thing, so fixing stable kernels doesn't matter much, I assume?
In general we try to keep stable releases stable buy backporting OpenRISC patches
as well. Just having the 'Fixes' tag should trigger to get this patched
backported to stable. We should at least cc the LKML though.
-Stafford
> arch/openrisc/kernel/dma.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
> index a82b2caaa560d..b3edbb33b621d 100644
> --- a/arch/openrisc/kernel/dma.c
> +++ b/arch/openrisc/kernel/dma.c
> @@ -74,10 +74,10 @@ void *arch_dma_set_uncached(void *cpu_addr, size_t size)
> * We need to iterate through the pages, clearing the dcache for
> * them and setting the cache-inhibit bit.
> */
> - mmap_read_lock(&init_mm);
> - error = walk_page_range(&init_mm, va, va + size, &set_nocache_walk_ops,
> - NULL);
> - mmap_read_unlock(&init_mm);
> + mmap_write_lock(&init_mm);
> + error = walk_page_range_novma(&init_mm, va, va + size,
> + &set_nocache_walk_ops, NULL, NULL);
> + mmap_write_unlock(&init_mm);
>
> if (error)
> return ERR_PTR(error);
> @@ -88,11 +88,11 @@ void arch_dma_clear_uncached(void *cpu_addr, size_t size)
> {
> unsigned long va = (unsigned long)cpu_addr;
>
> - mmap_read_lock(&init_mm);
> + mmap_write_lock(&init_mm);
> /* walk_page_range shouldn't be able to fail here */
> - WARN_ON(walk_page_range(&init_mm, va, va + size,
> - &clear_nocache_walk_ops, NULL));
> - mmap_read_unlock(&init_mm);
> + WARN_ON(walk_page_range_novma(&init_mm, va, va + size,
> + &clear_nocache_walk_ops, NULL, NULL));
> + mmap_write_unlock(&init_mm);
> }
>
> void arch_sync_dma_for_device(phys_addr_t addr, size_t size,
>
> base-commit: 7e6739b9336e61fe23ca4e2c8d1fda8f19f979bf
> --
> 2.38.0.rc1.362.ged0d419d3c-goog
>
next prev parent reply other threads:[~2022-10-08 5:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 18:33 [PATCH] openrisc: Fix pagewalk usage in arch_dma_{clear, set}_uncached Jann Horn
2022-10-08 5:07 ` Stafford Horne [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-10-08 5:24 Stafford Horne
2022-10-08 5:26 ` Stafford Horne
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=Y0EFllJ8uisQOWfv@oscomms1 \
--to=shorne@gmail.com \
--cc=jannh@google.com \
--cc=jonas@southpole.se \
--cc=openrisc@lists.librecores.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