Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp131228rdb; Sun, 28 Jan 2024 17:43:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEawhyYLgDFTk13LphJDe5T+eX8pckGcGElPyVUU9gbh7HIYH0AQHsS9uS8nOejJypCJgo/ X-Received: by 2002:a05:6a20:8409:b0:19c:972d:3e9 with SMTP id c9-20020a056a20840900b0019c972d03e9mr1515152pzd.48.1706492616408; Sun, 28 Jan 2024 17:43:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706492616; cv=pass; d=google.com; s=arc-20160816; b=quYIvJmxQ1w2JvbQaeYtRpapPJhO4Hy0E7sId3Wa/+4jlDIJKvot8aWo2desqwfmCn BkfODnEnDb1p73wjx+AZALbHamTmQKiMVxQXTvHvMeRS9oJR4nuHCRFsNXthelyXotOv /aLwiR/1zhJhch9Hq9OnPnvtfqLAGmcqDKNW1Xu1QKBcglS2a0/yVtgbjFTKe9lKAY1D Q34cAOQwkTvt+zjZkQyuOMJU3bTxC4eIBL09gKf8fyx5d4RpQGSYvI5hMUiuXu7o+j+d eVkFsj9TkuHpYRTfvkNoJXRkWNLZH+bbF/xyvva2lsQYydxF5/YITrKJe8sVjuLsjTCu 1oeQ== 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=EdQUmqGdZQkSaRtssstol3Hg+wBOCg5SlEWZbS6wjcc=; fh=X21b7L2T1Bikfv4xjXJNZQY9YlqYYHwUVOaMrogvM50=; b=iy498nEzmUeemADu/C4D9zqmOt9ZC9+HGghpj1Gn9NyMaOSTeU0k0CLvVQxK82RhlT voljKoQu4mywpWjLhglBjIrtg+jnhoN2lQ8h+WmcRQqlOfLX+TLMzA/zX8YYWGuwleW4 42zsXXOkbGKOqWXoYj+W5GaTDTCPMO9lgC+keha0qL8BxFLbspeKf2Js3PHbjUJpYv6Q /xEWchUbkaHA3qKGQhUvD+JFNk9QHpFQeV3O8/Z1al9QPviOgVri6Jvknsxgy7mk3rXW eBRtIExLqGmrJkMr0kqHAj83Lp8MT63954Bih4/5podh1qebTmn1noNLqjnFBywmSBN9 sfpQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=e8iuOjNa; 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-42070-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42070-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 z20-20020a1709028f9400b001d7204a84ddsi4906366plo.499.2024.01.28.17.43.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 17:43:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42070-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=e8iuOjNa; 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-42070-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42070-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 134862827E0 for ; Mon, 29 Jan 2024 01:43:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C973F9F2; Mon, 29 Jan 2024 01:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="e8iuOjNa" Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (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 93856F9D6 for ; Mon, 29 Jan 2024 01:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706492610; cv=none; b=hQtKXKFan7eHMrYY9v1nm23H93PS1ayBGNWO3ZGoBs8Udf4cuQFvQzlL9mPa/vfCwB2pi1+c1paAosfzpxEiMoL7e8XDXxYux9qAJ6fosRF7Y+hgfkRslUHcqljUtPuXuAAoOIKnv52ZQD6zAhQ9xxTpCPtJ8mpXSkKB0cc4TUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706492610; c=relaxed/simple; bh=e5l7ZTxBAuhvL8BJjaJ0QXiYojG9CC69RFkwfv0aqgE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LmLCWPLc5XvY5G0sQdae2Ml0rYi9YZ/KHt7JhpiioAeeAtNBDf9qgOWbl57wWbqCPv9H6doMe6k9rRwiRTsCD7P7DEHlJbRZzS8jhsu5a3g76SX5M2Act3Da5yOsAmTBGuqfcY/IUVm4aaG4LeJqEJ4lzJsAVjYq/NpknCSzO7M= 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=e8iuOjNa; arc=none smtp.client-ip=209.85.160.45 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-f45.google.com with SMTP id 586e51a60fabf-204235d0913so1123449fac.1 for ; Sun, 28 Jan 2024 17:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1706492606; x=1707097406; 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=EdQUmqGdZQkSaRtssstol3Hg+wBOCg5SlEWZbS6wjcc=; b=e8iuOjNaGDRqvdu0lj1OW0IbFWeuc6xJO8LgAqznxwJgqTwhHV6LMzUWXj4sSg4esJ hcDt4pvEfrr7+ukjOIbv8PyEVRP9i8h3qFr5O/RV70N/7FIvw8ojkP1f4vYroJ0TwwkT +sWltJsjBYHd5j47XBdNHLH2ADvYMGCrpa9WZvdBCmEgGEnRu2YDBOalsqYhtQvLGFad dCwGF+JJ7dC+ploe34yQQFf5JLasl1kll+7crdxnVE6el2PVCILUYU5D5ABPFsN0VjMp eGxJX1khxZmodEn+vHuvXy3cwcXkqF/kkzeAnk+zAiSsacYwWk18BT1bGEW60K8iKiH/ v24A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706492606; x=1707097406; 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=EdQUmqGdZQkSaRtssstol3Hg+wBOCg5SlEWZbS6wjcc=; b=oBwMi1+ndnrkWZ3snFRexjrcaP4ssmem28xwdlMOfsESukd7oSY8DUjU/PEv1iCzfw TlzKzloJY7/vkDvPYICxXxQhH8+fvCdAJBJv2uTEBji73oI9ZjWlWyGiqYgABCTMYZML LcbNx5RWFF7hEaFqqoHafm3CNKjF9cVPRJbPMoeUSFhbdFmqcIhM3ar8ehlcrSgsVc9l pEidztVCyatmVJfSUflbGQRACRYNVVJPdjzL6TtNdJu3Ve33lIkRPgUI9/Y9GdCQQGM5 T0ZkFelUuOtyR9z0YIZodWUx/rZVK+SzrQem6AznADG+GTfzTxuyN+Z+kuwVi4CMCl8P JY2A== X-Gm-Message-State: AOJu0Ywrhh28bMUVtMSLxYA6hE6ZQtBrNUjTnGho6xCGC2HdsKk8yd8t vqpx/cOrzr6mWrYllKVbtdcc5eayPC23BbLLsMe2ohy5t++WvK+dm99H+10BOeNvcDo/V/x1hEU AvR01oeikWm384dqzX5grNKcjKz25/JAgN4XyKwY39VVMn+0QmpmJ4g== X-Received: by 2002:a05:6870:5d9a:b0:206:bbc9:be01 with SMTP id fu26-20020a0568705d9a00b00206bbc9be01mr2527073oab.41.1706492606614; Sun, 28 Jan 2024 17:43:26 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240123132730.2297719-1-alexghiti@rivosinc.com> <65bd3d38-dcc0-4e64-b35b-8a2e697768ff@ghiti.fr> In-Reply-To: <65bd3d38-dcc0-4e64-b35b-8a2e697768ff@ghiti.fr> From: yunhui cui Date: Mon, 29 Jan 2024 09:43:15 +0800 Message-ID: Subject: Re: [External] [PATCH] riscv: Fix wrong size passed to local_flush_tlb_range_asid() To: Alexandre Ghiti Cc: Dennis Zhou , Alexandre Ghiti , Paul Walmsley , Palmer Dabbelt , Albert Ou , Geert Uytterhoeven , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Alexandre, On Wed, Jan 24, 2024 at 4:41=E2=80=AFPM Alexandre Ghiti wro= te: > > On 24/01/2024 09:38, Alexandre Ghiti wrote: > > Hi Dennis, Yunhui, > > > > On 24/01/2024 09:19, Dennis Zhou wrote: > >> Hello, > >> > >> On Wed, Jan 24, 2024 at 10:44:12AM +0800, yunhui cui wrote: > >>> Hi Alexandre, > >>> > >>> On Tue, Jan 23, 2024 at 9:31=E2=80=AFPM Alexandre Ghiti > >>> wrote: > >>>> local_flush_tlb_range_asid() takes the size as argument, not the > >>>> end of > >>>> the range to flush, so fix this by computing the size from the end a= nd > >>>> the start of the range. > >>>> > >>>> Fixes: 7a92fc8b4d20 ("mm: Introduce flush_cache_vmap_early()") > >>>> Signed-off-by: Alexandre Ghiti > >>>> --- > >>>> arch/riscv/mm/tlbflush.c | 2 +- > >>>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>>> > >>>> diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c > >>>> index 8d12b26f5ac3..9619965f6501 100644 > >>>> --- a/arch/riscv/mm/tlbflush.c > >>>> +++ b/arch/riscv/mm/tlbflush.c > >>>> @@ -68,7 +68,7 @@ static inline void > >>>> local_flush_tlb_range_asid(unsigned long start, > >>>> > >>>> void local_flush_tlb_kernel_range(unsigned long start, unsigned > >>>> long end) > >>>> { > >>>> - local_flush_tlb_range_asid(start, end, PAGE_SIZE, > >>>> FLUSH_TLB_NO_ASID); > >>>> + local_flush_tlb_range_asid(start, end - start, PAGE_SIZE, > >>>> FLUSH_TLB_NO_ASID); > >>>> } > >> Well this was a miss during code review.. I'm going to take another lo= ok > >> tomorrow and then likely pull this into a fixes branch. > >> > >>> What makes me curious is that this patch has not been tested? > >>> BTW, It is best to keep the parameter order of all functions in > >>> tlbflush.c consistent: cpumask, start, size, stride, asid. > >>> > >> I can't speak to the riscv communities testing/regression suites, but > >> this would only be caught in a performance regression test. > >> > >> That being said, Alexandre, can you please lmk what level of testing > >> this has gone through? > > > > > > All my patches go through the same level of testing: > > > > * Build/boot an Ubuntu kernel with and without KASAN + a few simple > > testsuites (libhugetlbfs, riscv kselftests and other) > > * Build/boot a simple rootfs on ~40 different rv64 configs > > * Build/boot a simple rootfs on ~30 different rv32 configs > > > > And I run LTP/full kselftests/perf testsuite on a weekly basis on > > every rc. All this validation is done on qemu. > > > > The patch is functional, it "simply" flushes the whole TLB instead of > > a few entries, so the only way to catch that would have been a > > performance regression. But given it only runs on qemu, it would have > > been hard to catch any performance regression since that involves the > > TLB. > > > > @Yunhui: Please let me know how I should validate my patches better. > > > @Yunhui: And BTW, we lack reviewers, so feel free to help ;) Okay, if you don=E2=80=99t mind, I will also review the RISC-V TLB related patches later. BTW, I mailed a patch "RISC-V: add uniprocessor flush_tlb_range() support", and please help me review it, thank you ~ Thanks, Yunhui