Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1732955lqm; Fri, 3 May 2024 05:14:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQT3pLox6KAPmVpVly+lq9DCFYjhgocKJxrdQP2aPiLzTJRigbX7PD3wk4D94e8IU1K/PwTGVyoW00mr0oyJInXWTKuQkfbZFllWDzMQ== X-Google-Smtp-Source: AGHT+IGkaCXVtPWFD88sQsZ3dP2c5QtrQjGJWCww6wjSimI5ZQyM2ptBSfW23+VLw+Q0yLeyAu6j X-Received: by 2002:a25:8e03:0:b0:deb:3b7c:5268 with SMTP id p3-20020a258e03000000b00deb3b7c5268mr2195011ybl.29.1714738491141; Fri, 03 May 2024 05:14:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714738491; cv=pass; d=google.com; s=arc-20160816; b=sod70xXVqVpQovpi7xfWQZuSZn2laEZbVZf8+EUyG279mzUbCLzaldzs5BQPHhckON 4mN7E8rQWf63nWYiib2qYWmapiq+Ng0vuVzM3VJz6bXQ2v2UGp9vMr9zNH4VRUr2iT9M mwGzh2+aUW5JCsJSpQScakdTeVHFAzspqRXPCeVeMKZ2nPfI1VIwFujJWgXz386gas4i 73PiwO6UpuGrW9angzJE3zOgBoePhiPxsOHKjebG6JJMRv8PPW0u3Ow10+SLO762HiVJ O2cDoCqF/5uslVvX8U7HoPmPz2f1umoMb4WRb4sOBrwTVzqtXN4uc0C5alXAxWnZI0PC yGvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Kc1BtAxBZn188Ck4/w08rRnF5GML0hKNFPw/To8Utuw=; fh=cwYc3pcvmH5pPH089CZyAcmi2ym7o2U5ggfdqiSESwE=; b=kRtDnZFQ/7v/kXePlLTdz8yQWG8YyFLRMERQrPnbGfDrU7j33ZA+C7pDpzuHpd/0v3 Y2b1OFFl3d8XNMp5duURXC0rdsRIQo/EAEPn1ymxaEV69nESavA23RTbVO/01Q10/1/a OazatYuf2tdOBvta4vYhJE9oAHmPKJGwrILja8XX2uKappXiso8mHjmXODjfzedWK5ri KYJ5gj1Wq7HWiRaY3U2lQ6/BlUJRVCqrY0+O2nw8SJDI3g1scQbl9KB08eBCquyU/kqe IKUIdDDrZo/QQ5wmSO7xbOYZkDsPcYR+XFz/eTIZjdU75q0Geg7XzFfrT2jsuloWIdqM L8MQ==; dara=google.com 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-167626-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167626-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z8-20020a05620a08c800b00790ec393f1fsi2944365qkz.65.2024.05.03.05.14.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 05:14:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167626-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-167626-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167626-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D70D31C2203E for ; Fri, 3 May 2024 12:14:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B3D3152E17; Fri, 3 May 2024 12:14:44 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 43B312E620 for ; Fri, 3 May 2024 12:14:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714738484; cv=none; b=r7n+xuXy/JuZ3KwgO8l8XzRuAaPHMdEcaRjgkGAuLwp8KBluJn4lN8nTydrbJCDMyHhky5v+x3L9ZYwRHDzBS9gCOc7xagHig5FSZlYyvWiQHhfHPj680UW3ql9r/saNSQW0dM85fAlmUi8QP+0+HDmkD25eYInkXchLJy03zNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714738484; c=relaxed/simple; bh=6ngDTEgKxo+5a3rSwfnFVQeuP2TjbUKFSm/lkEa/4y8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=roQZ8OweqiSqHkBbOF7ycvCnPKklp3ph444B1UvfIo1nz4et1EekhZsXq1yiKvOIHR/rzOzhNPixrlESdEekz9UTz4g4T+xUrRjvswvAyGaROUq775siWgytn0+OcdtQnMF9EHW96JBhmBtEvUIbyPbHX+vTeOKB83YHgeZT+C4= 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.200 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 7CEA420012; Fri, 3 May 2024 12:14:35 +0000 (UTC) Message-ID: <20798b97-fa19-46fa-abce-54f7931c9210@ghiti.fr> Date: Fri, 3 May 2024 14:14:34 +0200 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: [PATCH] riscv: uaccess: Relax the threshold for fast path Content-Language: en-US To: Xiao Wang , paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: jerry.shih@sifive.com, nick.knight@sifive.com, ajones@ventanamicro.com, bjorn@rivosinc.com, andy.chiu@sifive.com, viro@zeniv.linux.org.uk, cleger@rivosinc.com, alexghiti@rivosinc.com, haicheng.li@intel.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240313091929.4029960-1-xiao.w.wang@intel.com> From: Alexandre Ghiti In-Reply-To: <20240313091929.4029960-1-xiao.w.wang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr Hi Xiao, On 13/03/2024 10:19, Xiao Wang wrote: > The bytes copy for unaligned head would cover at most SZREG-1 bytes, so > it's better to set the threshold as >= (SZREG-1 + word_copy stride size) > which equals to 9*SZREG-1. > > Signed-off-by: Xiao Wang > --- > arch/riscv/lib/uaccess.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/lib/uaccess.S b/arch/riscv/lib/uaccess.S > index bc22c078aba8..2e665f8f8fcc 100644 > --- a/arch/riscv/lib/uaccess.S > +++ b/arch/riscv/lib/uaccess.S > @@ -44,7 +44,7 @@ SYM_FUNC_START(fallback_scalar_usercopy) > * Use byte copy only if too small. > * SZREG holds 4 for RV32 and 8 for RV64 > */ > - li a3, 9*SZREG /* size must be larger than size in word_copy */ > + li a3, 9*SZREG-1 /* size must >= (word_copy stride + SZREG-1) */ > bltu a2, a3, .Lbyte_copy_tail > > /* This looks good to me: Reviewed-by: Alexandre Ghiti Thanks, Alex