Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp84473rwo; Fri, 21 Jul 2023 08:52:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlE8PtsD8okiX3gweXxXOhSOz3zWai5LqUKUWpnLz7HfZVydK3BHGTsp+veUTxRCGQAUSi3T X-Received: by 2002:a05:6808:2392:b0:3a3:f289:8205 with SMTP id bp18-20020a056808239200b003a3f2898205mr3373905oib.35.1689954773182; Fri, 21 Jul 2023 08:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689954773; cv=none; d=google.com; s=arc-20160816; b=AUDhFNUupV7WwscbbVvxyczXOEM9cy/1qGOpQMcEZ3/vBhjDlywnVtP9EEr/YLXXvB JW97mLb/jZxja5f20QAPje6JioK6rvibCa4+wkhleKGxkTMSteZSTsU4nGOcxEKni631 9prW8p9buT63Rz9X7YqB7Z3jMfcdRcqYGGrHpimclfg3IRL5tGDxKAvZRdd+vakc6eS7 takiTnZ/cXJiSpZVpU8DV3UoOQwhl6NaJSAClla0MHovY3BmphGF1Gs6EXbD/L6MkmZR /Szt1NYgK+7rZCrS7fMCQbeQDRicSyw8uvRFEUAssZHr1xcG4CInNxx4DnT6Ibt6vWnk Yliw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=XwQlrn0DZJ9+1y+QieC1hYZ82W8gHtS5gvgRdq68+QI=; fh=E8o3RS7ID98D822CXYnigpZkQl9WKwQos8YVyvpInqQ=; b=VGyS41o5PD/j/0attrPIoc+VBRSMKAwBnx/PflaXc0yrQzgHu/klhBx10kIVEjO6WV F04KkleEHULulIBLilCTg5cZGpkgtV0Enu+7PML8Nr4iJdCvlvN2RCtf75+9A7GHQ5nD OCMsUnuBcUNrIOwdImq47S/zpZf85gMhAqSdOKsW6d+XmidsdMcprJpEHVDYF4HziRU7 +W4aVYyLrwKISgrpCRFS7nMBKZpQWRzqpapc4tYWHLaSBDZY0oy/i3hKjm/Y3uQAJLCF VZkpFzkAjtaEOM/jw1jGsiFr/xlacoFz95evQj3XeLaczBW2FwISy6eCzoVmnh+M6UX4 IKTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cl14-20020a17090af68e00b0025be9c5858dsi3462234pjb.88.2023.07.21.08.52.40; Fri, 21 Jul 2023 08:52:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbjGUPUM (ORCPT + 99 others); Fri, 21 Jul 2023 11:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231963AbjGUPT3 (ORCPT ); Fri, 21 Jul 2023 11:19:29 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E28D13A97; Fri, 21 Jul 2023 08:19:03 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8058E60004; Fri, 21 Jul 2023 15:18:58 +0000 (UTC) Message-ID: <5e5be2d4-c563-6beb-b5f5-df47edeebc83@ghiti.fr> Date: Fri, 21 Jul 2023 17:18:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] riscv: mm: Fixup spurious fault of kernel vaddr Content-Language: en-US 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 References: <20230721145121.1854104-1-guoren@kernel.org> From: Alexandre Ghiti In-Reply-To: <20230721145121.1854104-1-guoren@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/07/2023 16:51, guoren@kernel.org wrote: > From: Guo Ren > > 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 > Signed-off-by: Guo Ren > --- > 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.