From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F3D4EC8724 for ; Thu, 7 Sep 2023 13:48:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2879280037; Thu, 7 Sep 2023 09:48:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD8218D0021; Thu, 7 Sep 2023 09:48:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC6A3280037; Thu, 7 Sep 2023 09:48:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B15F48D0021 for ; Thu, 7 Sep 2023 09:48:03 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7F0C6B4355 for ; Thu, 7 Sep 2023 13:48:03 +0000 (UTC) X-FDA: 81209930046.04.8F926A5 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by imf08.hostedemail.com (Postfix) with ESMTP id BA43516002F for ; Thu, 7 Sep 2023 13:48:00 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf08.hostedemail.com: domain of alex@ghiti.fr designates 217.70.183.194 as permitted sender) smtp.mailfrom=alex@ghiti.fr ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694094480; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3ANcm/KZECr4OHubYceH7czitWvi7yKhnae38dhGFNA=; b=ybU6MzOxur4DuHl9Pdx0a+PpNd8pzK5k64fVSNDLLGaSkHxeO24RGXNebsvDL70B/aaTJP +3FS4hhyNBCkn1MgaQpZtq7NY2LrPw8WVbqYJQIdNRjEjIj7ZdpEyqwYU5g5RURdHcDdHz n2Ukde2kTo49kRzaJ+Yxa2aCmjg+DLo= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf08.hostedemail.com: domain of alex@ghiti.fr designates 217.70.183.194 as permitted sender) smtp.mailfrom=alex@ghiti.fr ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694094481; a=rsa-sha256; cv=none; b=32mr041PVXvPnWxxT6Imtwt1FzqNrH7n2tIjPOhQjvySyUzieOpbqlUDJL5naEfrkEF7TF Ml4M4EdNnsf1qsvkt+ZFRHEjxk64Duf4ISfhTWfQVLAbyqn5Bgs+f2gnSQX3klHVnOI9dQ SnjFYFUeIxQRjsHdo3oVNimS0qUbugM= 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-Rspam-User: X-Stat-Signature: dpw8igai79897k5d3brp4cr8ectx73bc X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: BA43516002F X-HE-Tag: 1694094480-198296 X-HE-Meta: U2FsdGVkX1+fQY6Y0UzifcPV+8Q9834hu7ncABmQWJGMOoxwx8AnRKYKQ4lTcI1yfJ+y5DJsQnmEmAjaglWtWLZ4aDHpJp7+kMNRHmVySVnj527l4HuZcaLyHw6xTQULQVK2d7JBvavzSA/7EM1e8bUs/WULpbOFPB29i1vWSO3x2RFK9PalSVNgF9EvkAfvcIFMJ9qmd8gMjq8Ag1uFH2PfHjbYL+2zUI3L8DHn9UnRAU1oJP1LkoZ5aPvxK+UkPQb9SC1vEQsKH1xDhWhYrSLCbLZfsEC4ILESu3nZEEO+NK0o//xOEETVApVcg3kNrT7s2LC5Yu8Ey1pR/3n4vojJ4JQSeCIWDtnpQMtCu3NK/sPFaF5ehCwApNCwJc1+rS8wwOVQa07pbBotwftrffSLyorGZ1ddl7LGgNOyxzjSMERjvQTJvPGd3yjNb+BWITFMmjsUmLqqPrhxPglxIFA9ofvwiWhmp9ffWGveFQVQngugmBV5t8HjtXQs311/NVk4lsh5aL9Gv6APQqTJ1/bucMdSS7QClPYIbvb+kXEuA9ToWT+6uG1d9LkVIZUNTdY/7Ua/pb7IoaedN17oXesG4tJqSWxl4zWc2bPjhEGs/vhuZJqSZ3fRCWBbduijmgiQKlIbsiZbfwCbPnwm5knMLTEwBv42TbzQuAxyNR7V7nmjfm5nFpsMiQHkdlZfyphBPF0BotrJyxEj4mSfAuXL0Vx55rUit9Qst4SrN2dRYJACjFOnoP0ltf4b1uM1jrbHURIBKIyjnGqA7FFESXfw39+IoCKO+ie6nMQnZRuwruD34TTvPMeRD7M3jrcsmBf9vHxMc1GCtyPBodZmuXfnb6+RH6J6U6VkKGyU5f6FMAmZDzpoNCRI/e43mlNHweA6ey4QZKRdDfwCAM+LKNr1SWB7/d/Jfa5rdjdWWCqgXg7A5jFU7+EdH4dhMSq6V69mIemkeA3Ml+VvhZ/ m3C2hgHs PybQKoBBgqgt2b33V9Lx6XMxewrJNsHyu8//uzYJoeTguxSz6Nhs7JN1C3iLgbGzJVmS2AmLP9EwVX9Ms6AV507gyzZZZ40cQdLKUqKgiJakkAywH3NG6GxIPvGzrZhkzDK33yOCZMwwj7TEelpra8LL6E1aPU21YlrS8dff7kX5ZFF93CcVJHhzZETIA6jGVVVvHjc7gJQda2eq4wRvnDyHpxQUgvfYSeUlwzQ6v+3YR//cVI7D2emO6NTi21HR6Eo/qJxKR1GZqp9w6rD07E9booTpMFWehPh3MuwNp1uCZrqaH4/gfSSlrFJyP4NDQ5wbb X-Bogosity: Ham, tests=bogofilter, spamicity=0.000021, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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