Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp3265926rdb; Thu, 7 Sep 2023 09:21:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFj4mhlJ6FO2+tCwgeaPiNLwDu7CuZNmjePlaHzKEy54+tiwx8pDXE01bGsBTgpUGAXoK1g X-Received: by 2002:a17:906:4ad1:b0:99c:55ac:3a61 with SMTP id u17-20020a1709064ad100b0099c55ac3a61mr5439037ejt.56.1694103683296; Thu, 07 Sep 2023 09:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694103683; cv=none; d=google.com; s=arc-20160816; b=e7Re5iou+alLkoIOBiH2elZh3QXSQPzpgKlXM4ke5oiKRTfCxyGfCUS8OhacYOBcsG 4wRUX+3vOXeV/Eb0egL5xMN2DSPsYra1EiypOil6iBj8sUtiRmlUTpOkIbJodRSd7U1u jWEWbwF8BiU3oaveLHqTYIyIRA4NWRqR3VNEn8XX8Dx3AYwlU4e6RJcwXEkVGVWegZ+J k+ApG4yFKnRJRTFF7WSH420wRY+rWKZRk41MECGH4uHkfXIzjazhNEoufHG12XIc85GE l0lsyio00Ka9NMYsWMI5w3rzh7OB5dt+DFsUBb2YiJzo4sjepllPvGMkMHR9C/BUgFlE ABQg== 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=3ANcm/KZECr4OHubYceH7czitWvi7yKhnae38dhGFNA=; fh=FQ3U3fCDwERyHHCsL2YSKv8RMSR4BHh9B3CZIELop7M=; b=Rr2pmU1Lts60WItZn0QNjXmkPYW2Qt/c9DofODfsq2ZVURSw1XlDVYHsyqvMVhIGYN xrOPgEH6kjk3NFBzI7047J2XW/1bYqZA1PN3UOamAn6urAEsffvCDKjRhxy2tEXr48yS rMTMIfcXA6u58T/7FCmancIwYlt+U0iTxveCU4La5sZeMKf8ZRHCL7kwAAVqwMwUtO0k TSmDumXTOLLx/4svaNypbTDRUTeR/A/njJz2lR/sjlMUpzF/2QBE4J/9VwVkhIt48fdN z64A11tgz6YJqD1FuwNjNK1ZaShbZx0PPFP7vZK4+TKtbjfK5+K760E6dy3kwgXSRyKN OPyQ== 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 a22-20020a170906469600b00997e1a4b954si10621590ejr.25.2023.09.07.09.20.43; Thu, 07 Sep 2023 09:21:23 -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 S244143AbjIGPcC (ORCPT + 99 others); Thu, 7 Sep 2023 11:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244599AbjIGP3J (ORCPT ); Thu, 7 Sep 2023 11:29:09 -0400 Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 162EEE7F; Thu, 7 Sep 2023 08:28:38 -0700 (PDT) Received: from relay2-d.mail.gandi.net (unknown [IPv6:2001:4b98:dc4:8::222]) by mslow1.mail.gandi.net (Postfix) with ESMTP id CA594C1BA0; Thu, 7 Sep 2023 13:48:19 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 1B6A040026; Thu, 7 Sep 2023 13:47:52 +0000 (UTC) Message-ID: <4c4bb7ec-9ad8-6b6a-cea0-a4c779db6ac3@ghiti.fr> Date: Thu, 7 Sep 2023 15:47:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v3 4/4] riscv: Improve flush_tlb_kernel_range() Content-Language: en-US To: Nadav Amit , "Lad, Prabhakar" Cc: Alexandre Ghiti , Geert Uytterhoeven , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Mayuresh Chitale , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-arch@vger.kernel.org, linux-mm , linux-riscv@lists.infradead.org, Linux Kernel Mailing List , Andrew Jones References: <20230801085402.1168351-1-alexghiti@rivosinc.com> <20230801085402.1168351-5-alexghiti@rivosinc.com> From: Alexandre Ghiti In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: alex@ghiti.fr X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS 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 Hi Nadav, On 06/09/2023 22:22, Nadav Amit wrote: > >> On Sep 6, 2023, at 4:48 AM, Lad, Prabhakar wrote: >> >> Hi Alexandre, >> >> On Tue, Aug 1, 2023 at 9:58 AM Alexandre Ghiti wrote: >>> This function used to simply flush the whole tlb of all harts, be more >>> subtile and try to only flush the range. >>> >>> The problem is that we can only use PAGE_SIZE as stride since we don't know >>> the size of the underlying mapping and then this function will be improved >>> only if the size of the region to flush is < threshold * PAGE_SIZE. >>> >>> Signed-off-by: Alexandre Ghiti >>> Reviewed-by: Andrew Jones >>> --- >>> arch/riscv/include/asm/tlbflush.h | 11 +++++----- >>> arch/riscv/mm/tlbflush.c | 34 +++++++++++++++++++++++-------- >>> 2 files changed, 31 insertions(+), 14 deletions(-) >>> >> After applying this patch, I am seeing module load issues on RZ/Five >> (complete log [0]). I am testing defconfig + [1] (rz/five related >> configs). >> >> Any pointers on what could be an issue here? > None of my business, but looking at your code, it seems that you do not memory > barrier before reading mm_cpumask() in __flush_tlb_range(). I believe you > would want to synchronize __flush_tlb_range with switch_mm() similarly to the > way it is done in x86. > Noted, I'll take a look at that, thanks for the advice! Alex