Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp308455rdb; Mon, 29 Jan 2024 03:02:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4bSCAzXJSoyOtHMn8/6rbqppRII/R87VdumAvjiFJpb/1aRq/ZhCmBqOIucTVwusryGoO X-Received: by 2002:a17:902:9a4a:b0:1d7:7a87:89b8 with SMTP id x10-20020a1709029a4a00b001d77a8789b8mr5934260plv.64.1706526152733; Mon, 29 Jan 2024 03:02:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706526152; cv=pass; d=google.com; s=arc-20160816; b=lcrd8v183ukGVkJFkUbKS0BWiBotX//tN2wk8Pva90lm6rysw4rYjC2ehtv1nInM1u yuQopK3Ef6zJUyCnCj2I3yu4ei50x7zRFEEV/T+1YZL38Lrh7uwEkgBw/AsnkkE3VM5W hfbEe4n9xaULWOu3JU3SuDsVpWZq3PGywIF+LNkDSOznSOvEb8OVe98zg1WCXIx3rKXG opDH/i8Vo2+v9yMeDTCd+r30eVt9XdBjeLDWRoZyYab+NBwUHKG5UhtQZBMnE613SIGY YrwSW8rqz4V050bL7bYKYePVs0649CHJkGx35L9jwh4WuxzQ7Lvc9P3R82/EASWBfIUY 0GXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=sTJxbxSOrvcrYc8CLPfFyPhV1mIIGJ+doi7MTifU0M0=; fh=MsF2409OH6faWlI/440pjFW+/RXwYXCufx++oRJ3xWU=; b=JqCS9+Nvuu3cCi87/kP43iNfcrBSYK5hENUaFImICbAtQjRGyH6tu4eZtumPQHlK4I NgeUxXzFjViLfwUHJhPRqRY2lqT35I/Lz+BAT4V2GIdWW2P4no1hqOBkZ3As9m/RLbhR mtsruzVOzdoLY3p5S480UkwEPLsc2ipI+0yD6vssxVpPY7K0tpIOCMbWnca60XnHFpKO 1m0uOf5H5inX8ShRKbKvWiw23/81K26E4BQi3/E+PXWB+YXPsCmHyosx4nERid6POFUU dXFHPgrdxylzqmOi3mrsiN+pu6jveA2UbCQc18IsdkgiG5O13nEmzG2jO9N8IqNnEHbQ Foog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=LaP2dV6I; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-42579-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a21-20020a170902b59500b001d88bb0d2eesi5496150pls.108.2024.01.29.03.02.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 03:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42579-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=LaP2dV6I; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-42579-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 55B502846D8 for ; Mon, 29 Jan 2024 11:02:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD8AF5A7B9; Mon, 29 Jan 2024 11:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="LaP2dV6I" Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D057F56B67 for ; Mon, 29 Jan 2024 11:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706526144; cv=none; b=R1B3zxXiLLG+IDT6dBYwzMv7vql2ISXh/HCUsoKkhTSy5MaC79q5NrSZORt/CaUN6r+ueLSpj+20mnQqcH1DuREqO5Yzp6Y9U7TUt6CFck5r4Q5ki+GFIBwbT/GdUUWcBGP328OvasPQPXJywokSDsTBEKkdK8oqPxu7Xh1+aMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706526144; c=relaxed/simple; bh=sTJxbxSOrvcrYc8CLPfFyPhV1mIIGJ+doi7MTifU0M0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=n3lO3eAwV+XvkyUjFQ6EKX0+JfmKVOocSM5GLhOITWoLSDkNxoBEzsYYUFFfGgYVaCv6H+gWjV+kHz8kYtmPHbBO2MLa5PHq7kKkixcEVSp8NEPoCGJYq9X06KF/CTlN2VuWiEAm9YzeIuM7d3PtUZ2a4ao6ljmPeImJoZ0LQP0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=LaP2dV6I; arc=none smtp.client-ip=209.85.160.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-2185a9966bcso702190fac.0 for ; Mon, 29 Jan 2024 03:02:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1706526142; x=1707130942; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sTJxbxSOrvcrYc8CLPfFyPhV1mIIGJ+doi7MTifU0M0=; b=LaP2dV6IXWS97Y+VST93GD1q3QnR7g3BywIKvSUohWl4eHy5QPpiXI29/90OlWf+Id Sw+sVNkTZWyRszzrww45PDhhRT0A4MEniW2uHQwY+yT2/YXJDzdq2e59IZqdWlaM0N3S ZPzGTZNborrMx6NvBsdNOT03RDAqciFz9qG//3cm7fwZnOtIrQkUt2WH4aztgTZXYSnC VQ2v1YK5NGBb4eNbehYF4B6temnZ3drY714AmwMm/RbYjE/B00cNu7963sU2RfZ/YT0h VcoLecojEm4PKmUp5/jVf2zrRDnALdfp3L2+6iLvNJSWeMPWnUXpPzP65xfOv+CYofvG 6HJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706526142; x=1707130942; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sTJxbxSOrvcrYc8CLPfFyPhV1mIIGJ+doi7MTifU0M0=; b=UsQ0tHLs5GMUv9AAauodGkTCgu1T4GKXBHQdQNG0O5lBeczEvKKGrDiZh4Frnov9Ra tDemvtwPtbI+h3xz3P2ty5cKtS/Jemmps/D4qyNOub2FknrE80LtLLs58sL+0x+WR9d3 +CXf5VcJhD9PkloMvrNF/X4EjYIYk73fv+FcR71HT3g+jOGpT3NZRBaA7YN/LX9zUaTW dDtLK7ab6u+Sf37W8dZ0z5qXOsVq4DXJjx8N7SBLP3UvB+d8NYMzOHyWe6b/NIpUS8da g8r2ushJODsHYEMxaNzId7fsviTSxlt6Y3afSKoOBUKaPRRkT6pJZP7YfaC0edXQD3Gu 5+fw== X-Gm-Message-State: AOJu0YyCV++ewoHepT9WO2P95iD3SMzQTxtf/ByuekZNryhZrRasaS1B ROyLU0mHjohvDrIGFwZDowxxf+8bBccpcXE0zNk4/SWVIN7FbM0OefyRSbLEgNPrn/dx4dow7jd uYXthA1/Ww6Hz3/psr13H3Fx4kmEXNweJkejkhw== X-Received: by 2002:a05:6870:d611:b0:214:76ce:3877 with SMTP id a17-20020a056870d61100b0021476ce3877mr2253435oaq.16.1706526141790; Mon, 29 Jan 2024 03:02:21 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240125062044.63344-1-cuiyunhui@bytedance.com> In-Reply-To: From: yunhui cui Date: Mon, 29 Jan 2024 19:02:10 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] RISC-V: add uniprocessor flush_tlb_range() support To: Jisheng Zhang Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alexghiti@rivosinc.com, samuel.holland@sifive.com, ajones@ventanamicro.com, mchitale@ventanamicro.com, dylan@andestech.com, sergey.matyukevich@syntacore.com, prabhakar.mahadev-lad.rj@bp.renesas.com, apatel@ventanamicro.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Jisheng, On Mon, Jan 29, 2024 at 5:51=E2=80=AFPM Jisheng Zhang = wrote: > > On Mon, Jan 29, 2024 at 04:26:57PM +0800, yunhui cui wrote: > > Hi Jisheng, > > > > On Mon, Jan 29, 2024 at 4:02=E2=80=AFPM Jisheng Zhang wrote: > > > > > > On Thu, Jan 25, 2024 at 02:20:44PM +0800, Yunhui Cui wrote: > > > > Add support for flush_tlb_range() to improve TLB performance for > > > > UP systems. In order to avoid the mutual inclusion of tlbflush.h > > > > and hugetlb.h, the UP part is also implemented in tlbflush.c. > > > > > > Hi Yunhui, > > > > > > IIRC, Samuel sent similar patch series a few weeks ago. > > > > > > https://lore.kernel.org/linux-riscv/20240102220134.3229156-1-samuel.h= olland@sifive.com/ > > > > > > After that series, do you still need this patch? > > > > Thank you for your reminder. I didn't find it before I mailed my > > patch. I just looked at the content of this patch. I understand that > > my patch is needed. For a single core, a more concise TLB flush logic > > is needed, and it is helpful to improve performance. > > Currently, riscv UP flush_tlb_range still use flush all TLB entries, > obviously it's is a big hammer, this is what your patch is trying to > optimize. I'm not sure whether I understand your code correctly or not. > Let me know if I misunderstand your code. > > After patch5 of the Samuel's series, __flush_tlb_range is unified for > SMP and UP, so that UP can also benefit from recent improvements, such > as range flush rather than all. In my opinion, UP does not need to combine some SMP if... else, on_each_cpu(...) logic, which is also a manifestation of performance improvement. what do you think? Thanks, Yunhui