mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Ghiti <alex@ghiti.fr>
To: guoren@kernel.org, palmer@rivosinc.com, paul.walmsley@sifive.com,
	falcon@tinylab.org, bjorn@kernel.org, conor.dooley@microchip.com
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org,
	Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH] riscv: mm: Fixup spurious fault of kernel vaddr
Date: Fri, 21 Jul 2023 17:18:58 +0200	[thread overview]
Message-ID: <5e5be2d4-c563-6beb-b5f5-df47edeebc83@ghiti.fr> (raw)
In-Reply-To: <20230721145121.1854104-1-guoren@kernel.org>


On 21/07/2023 16:51, guoren@kernel.org wrote:
> From: Guo Ren <guoren@linux.alibaba.com>
>
> RISC-V specification permits the caching of PTEs whose V (Valid)
> bit is clear. Operating systems must be written to cope with this
> possibility, but implementers are reminded that eagerly caching
> invalid PTEs will reduce performance by causing additional page
> faults.
>
> So we must keep vmalloc_fault for the spurious page faults of kernel
> virtual address from an OoO machine.
>
> Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> Signed-off-by: Guo Ren <guoren@kernel.org>
> ---
>   arch/riscv/mm/fault.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
> index 85165fe438d8..f662c9eae7d4 100644
> --- a/arch/riscv/mm/fault.c
> +++ b/arch/riscv/mm/fault.c
> @@ -258,8 +258,7 @@ void handle_page_fault(struct pt_regs *regs)
>   	 * only copy the information from the master page table,
>   	 * nothing more.
>   	 */
> -	if ((!IS_ENABLED(CONFIG_MMU) || !IS_ENABLED(CONFIG_64BIT)) &&
> -	    unlikely(addr >= VMALLOC_START && addr < VMALLOC_END)) {
> +	if (unlikely(addr >= TASK_SIZE)) {
>   		vmalloc_fault(regs, code, addr);
>   		return;
>   	}


Can you share what you are trying to fix here?

I have a fix (that's currently running our CI) for commit 7d3332be011e 
("riscv: mm: Pre-allocate PGD entries for vmalloc/modules area") that 
implements flush_cache_vmap() since we lost the vmalloc_fault.


  reply	other threads:[~2023-07-21 15:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 14:51 guoren
2023-07-21 15:18 ` Alexandre Ghiti [this message]
2023-07-21 16:08   ` Guo Ren
2023-07-21 20:00     ` Alexandre Ghiti
2023-07-21 23:59       ` Guo Ren
2023-07-24  9:05         ` Alexandre Ghiti
2023-07-29  6:40           ` Guo Ren
2023-07-31  9:43             ` Alexandre Ghiti

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=5e5be2d4-c563-6beb-b5f5-df47edeebc83@ghiti.fr \
    --to=alex@ghiti.fr \
    --cc=bjorn@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=falcon@tinylab.org \
    --cc=guoren@kernel.org \
    --cc=guoren@linux.alibaba.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@rivosinc.com \
    --cc=paul.walmsley@sifive.com \
    /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

all inboxes | Powered by JetHome®