Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp982406rdb; Wed, 24 Jan 2024 00:42:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFB5fDVS+2KeptbF7pL3N//rxYy7KWz7UEshDeEdXFCwaFroW//TPR0ChUC+aLupQzBcN09 X-Received: by 2002:a05:6830:448b:b0:6e0:c044:232c with SMTP id r11-20020a056830448b00b006e0c044232cmr1621688otv.6.1706085751521; Wed, 24 Jan 2024 00:42:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706085751; cv=pass; d=google.com; s=arc-20160816; b=nrEjgYVOP2o11tzUIWj7Lv5R8JtGKOFOLSVkNva/FT6Vd27nG5/u9XKtTGxm3SoJGw yZRatZK5vdbcIUtkLIF8e+7TyEs3wWTunsBcxM9ipw+NYBRo15ZD916WSJwKlQCLsaWl kI724IVN7d6JgTuP/WfQr8wX4zKn9gqzDI+7ojuCEFett4Xa2DKtx4FCnpeHebhtKnFs VaNyXLkDhfWWuRmhZcIn7kKSJ6Z6lDzBIs3eI06voLxP0t597G5QpKVqfLytfTcIBC8O on9qHXa7r1+dY1R4sj+Th937s1jaWarUL5msmXhjjr/okN8LrOOC3sZMCgRneZfFy4fP IOzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=a9eaSWP302Nv6VG8HmEhqQb+0LDYheS89LbHyCObjAw=; fh=A30R7N3obBZzT+xLPcNmbIWAAwZ1/odhirK570QVd20=; b=J9atWze80w4lCZ/5b4mfwhaE70Vy1NUNs0GuYl0c0GZDHNsD8Ahep07+q0u3bwQqP0 Jy22FTsoNuuopBUYW0N72YyEfueZ0pDeYqd9qhJikQ8izVcQr5WR4tkRijuk8uesPFcs txrxEnK6/o8IDI21tNFozvt1jplpV59Ed1jCYzuPY/xAVZZdFatRioxaU46StDTuU3hz 8bK8dFeWvUi6fRsX0f5EnxgFrOge2s8t/CG8lhD2zVEj0wVmsnwcFkcuKBOUQ1+ofqQ6 hAsilQf1+lXtRUZEn7/1xHGdN1Mvp5vYRe99fgTdMeHyoeJHyqY7NmXgt5oPEoFrDCN+ WToA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-36651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36651-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e36-20020a635024000000b005cdfd48bfbesi11264337pgb.561.2024.01.24.00.42.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 00:42:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-36651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36651-linux.lists.archive=gmail.com@vger.kernel.org" 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 24F13285516 for ; Wed, 24 Jan 2024 08:41:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3BA117984; Wed, 24 Jan 2024 08:41:39 +0000 (UTC) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 996C117980 for ; Wed, 24 Jan 2024 08:41:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706085699; cv=none; b=dbDKu+Nf2TECpow7jo9lMghSblNub/0VOcT7OhTdPz+qPqNv1Y3qYUg+stHo+vOK3QsRXnnM0Zdv6WadBccvJ0bqY46f9CS+5n+f26GBbEV/kWsxiLPbPoIv3zZvEK945LDzVbGdLrNNCC260v4TxRzVr2du4DNWTiWxZWu6wUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706085699; c=relaxed/simple; bh=XxMuQK4sy8zBog+WozR/ALmgnT81qQ7cYO2LNGO2fLc=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=BJMuoh7aSujq4bhIzEMSE8kjt8DQH7oeAdNZTkYG9WN2wAu0MjhnHcAL6MQI+oN/iYpYokGGgGJjemD8fFonZgj82G+iYOZpBt+uWG0mJ3+AETpyUoHx76I5R6ZaK94HZl8VT7T3uwcN2jXzOcwzcX/tRhSSY98jWwKMYRCUuHw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr; spf=pass smtp.mailfrom=ghiti.fr; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id B8E3760002; Wed, 24 Jan 2024 08:41:27 +0000 (UTC) Message-ID: <65bd3d38-dcc0-4e64-b35b-8a2e697768ff@ghiti.fr> Date: Wed, 24 Jan 2024 09:41:27 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [External] [PATCH] riscv: Fix wrong size passed to local_flush_tlb_range_asid() Content-Language: en-US From: Alexandre Ghiti To: Dennis Zhou , yunhui cui , Alexandre Ghiti Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Geert Uytterhoeven , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240123132730.2297719-1-alexghiti@rivosinc.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: alex@ghiti.fr 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 PM 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 and >>>> 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 look >> 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 ;) > > Thanks, > > Alex > > >> Thanks, >> Dennis >> >> _______________________________________________ >> linux-riscv mailing list >> linux-riscv@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-riscv > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv