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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8300BC4332F for ; Thu, 22 Dec 2022 21:14:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbiLVVO5 (ORCPT ); Thu, 22 Dec 2022 16:14:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbiLVVO4 (ORCPT ); Thu, 22 Dec 2022 16:14:56 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6961414D1C for ; Thu, 22 Dec 2022 13:14:55 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id z26so4499669lfu.8 for ; Thu, 22 Dec 2022 13:14:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HW2+bjL5qcgLG9JdMLBo7XGDnVwRZtk+Ec2M0tEXUp8=; b=pSB8tZnCe08Sqg9lkNhtlglRmDf/Z7I+XnwHDLWGwn45nh89IgReiIWx95oH4RtONS kNo7+Bfz8ZgjeZvBoF64FJeC3VEUqUFLNUf4CAzJxw8B+jkLqPcVfMkA4Z3R4tyLbYcJ i7lxHlKJ25KaAZGUv5I77Q9mxncJV+5CI/bi7IqDDTbrFZP88mBtRqJl7xf5srlpdoUW +q63Mdsx5/43rXF/W22Eyo9UsOY1xid9i+wE5YEWAB8LVej6yNjaqrL+u2rYq9RUnsJL wHLLWiEkKCHAfCO8xu0Ore2yRkLaAEAd6BKDpKBN4+T5395BCcSNL/yXJLBxfjBdR0QM 5ZIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HW2+bjL5qcgLG9JdMLBo7XGDnVwRZtk+Ec2M0tEXUp8=; b=pNAZSyQSUFKyVAKBRnypYBrgLfIiNNHqykTHtLMr5r+kUv/8AqgZMt1dzo0OfEHdEj 0zuTluMl3OFUcdQstR3esWZdOgtGkn7PBz2rLVpztVbiiXnd8JheVzlHCx//c5/VqBJf y75XP6ZO3VKzEazB8+H4LQVPEWyXN/5YBja7n4kRU5xklO0vaSHI9p/a4eakwvMO4+eQ AvUrfQlRbM7zdjFo3u9m47MCEtejrbu1dUzmvBD4Zt2N84QEvOUEO1pf03IPHpxQE78F rZ+zp6pIMq7rVp1O1JBFzGIgHsXo70cJgO8Iwv7ZWUeAE6jF90pyg2iIkjjyo2hMJP7i EjlA== X-Gm-Message-State: AFqh2kodmpwkWnhOanrkem8u5ith/bGS1kkoecWflAYhb11uobiAW//W exP2uNyfnnoxftP3dABWUx8= X-Google-Smtp-Source: AMrXdXtrBKXawCl7/HCZlX1zZ4k9HkLiMK4L6fhINmlvAo5rK7FWVP6wuYlnXuG40+NPHGOOJ5DQug== X-Received: by 2002:a05:6512:b14:b0:4ca:f5a1:8896 with SMTP id w20-20020a0565120b1400b004caf5a18896mr78728lfu.37.1671743693633; Thu, 22 Dec 2022 13:14:53 -0800 (PST) Received: from curiosity ([5.188.167.245]) by smtp.gmail.com with ESMTPSA id q16-20020a194310000000b004b5634f9b9dsm208206lfa.115.2022.12.22.13.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 13:14:52 -0800 (PST) Date: Fri, 23 Dec 2022 00:14:51 +0300 From: Sergey Matyukevich To: "Lad, Prabhakar" Cc: linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, Anup Patel , Atish Patra , Albert Ou , Palmer Dabbelt , Paul Walmsley , Guo Ren , Alexandre Ghiti , Heiko Stuebner , Sergey Matyukevich , Geert Uytterhoeven , Conor Dooley Subject: Re: [RFC PATCH 1/1] riscv: mm: notify remote harts about mmu cache updates Message-ID: References: <20220829205219.283543-1-geomatsi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org Hi Prabhakar, > > > > From: Sergey Matyukevich > > > > > > > > Current implementation of update_mmu_cache function performs local TLB > > > > flush. It does not take into account ASID information. Besides, it does > > > > not take into account other harts currently running the same mm context > > > > or possible migration of the running context to other harts. Meanwhile > > > > TLB flush is not performed for every context switch if ASID support > > > > is enabled. > > > > > > > > Patch [1] proposed to add ASID support to update_mmu_cache to avoid > > > > flushing local TLB entirely. This patch takes into account other > > > > harts currently running the same mm context as well as possible > > > > migration of this context to other harts. > > > > > > > > For this purpose the approach from flush_icache_mm is reused. Remote > > > > harts currently running the same mm context are informed via SBI calls > > > > that they need to flush their local TLBs. All the other harts are marked > > > > as needing a deferred TLB flush when this mm context runs on them. > > > > > > > > [1] https://lore.kernel.org/linux-riscv/20220821013926.8968-1-tjytimi@163.com/ > > > > > > > > Signed-off-by: Sergey Matyukevich > > > > --- > > > > arch/riscv/include/asm/mmu.h | 2 ++ > > > > arch/riscv/include/asm/pgtable.h | 2 +- > > > > arch/riscv/include/asm/tlbflush.h | 18 ++++++++++++++++++ > > > > arch/riscv/mm/context.c | 10 ++++++++++ > > > > arch/riscv/mm/tlbflush.c | 28 +++++++++++----------------- > > > > 5 files changed, 42 insertions(+), 18 deletions(-) > > > > > > > > [ 133.008752] Hardware name: Renesas SMARC EVK based on r9a07g043f01 (DT) > > > [ 133.015338] Call Trace: > > > [ 133.017778] [] dump_backtrace+0x1c/0x24 > > > [ 133.023174] [] show_stack+0x2c/0x38 > > > [ 133.028214] [] dump_stack_lvl+0x3c/0x54 > > > [ 133.033597] [] dump_stack+0x14/0x1c > > > [ 133.038633] [] panic+0x102/0x29a > > > [ 133.043409] [] do_exit+0x704/0x70a > > > [ 133.048362] [] do_group_exit+0x24/0x70 > > > [ 133.053659] [] get_signal+0x68a/0x6dc > > > [ 133.058874] [] do_work_pending+0xd6/0x44e > > > [ 133.064427] [] resume_userspace_slow+0x8/0xa > > > [ 133.070249] ---[ end Kernel panic - not syncing: Attempted to kill > > > init! exitcode=0x0000000b ]--- > > > > > > If I revert this patch [0] bonnie++ works as expected. > > > > > > Any pointers on what could be the issue here? > > > > > > [0] https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/commit/?h=for-next&id=4bd1d80efb5af640f99157f39b50fb11326ce641 > > > > > > Cheers, > > > Prabhakar > > > > Good catch. Thanks for reporting ! Discussion around the issue and > > possible ways to fix it can be found in the following email thread: > > > > https://lore.kernel.org/linux-riscv/20221111075902.798571-1-guoren@kernel.org/ > > > > Could you please apply the patch from Guo Ren instead of [0] and check > > if you have any issues with your test ? Besides, could you please share > > your kernel configuration and the actual bonnie++ params from emmc_t_002.sh script ? > > > Thanks for the pointer, I'll undo my changes and test Guo's patch. > > I have pasted the script here [0] and attached config. > > [0] https://paste.debian.net/hidden/a7a769b5/ Thanks for the script and config. Could you please also share the following information: - how many cores your system has - does your system support ASID Regards, Sergey