Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7631762rdb; Thu, 4 Jan 2024 02:47:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYcT1LlDO7XNWV0oKwrHNEPEw/rZpX6Iv8VzOUssO+gi11E8z9M9d9XeqMo+681Mn5w8e8 X-Received: by 2002:a05:6a20:7484:b0:199:1938:4f5e with SMTP id p4-20020a056a20748400b0019919384f5emr305735pzd.94.1704365264346; Thu, 04 Jan 2024 02:47:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704365264; cv=none; d=google.com; s=arc-20160816; b=rGqV+rG9ybyStUClK9lf/vvoR+b83ewPujJujahGXNLhN33CfgojCPdoUGtfH/Aur5 cq2w7pop2Zvh07VuVSdG+OFFMIM/byWC+eXS8Py05ZsetQt55tdJCq1lRhO8cwqBfehV 3yxwKG8rH+Vc9LnN2Fvs/6S9DeOHjohdDysgw65VbXbj6y4DtqBrn6FocipLzLAMTtyv 9gw8gC8UcXAvNO5ovy2stjvaDB3SbJQx+AF1ALrv9lhD2x6ssm0WNOUhHbHTaNLqXKoK LUSHaQ6hscrSViAIWAdvIjf1M5T9PDU5b1Dt/x7I9MjFqTE/dXdyKlbSUZWBXFdu4CZ5 2+OA== ARC-Message-Signature: i=1; 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=tOk+lz6pRgxQuAqK8zLJas5GXEM9ORg8NhOP03qnMUo=; fh=y97ZUpV7aaD5e/LE0wNYJXEESgTNGPgPTZ5JPWZzwec=; b=Gj+FgeUsmjbYlgBkSD6adnETuTQDgbu3PIfSW1abZTzTMGKX0AnAwhsCRliKtACYgg iBdZXHkl6MX8EHEmbe0XmOMQiEskyazGHmJcgyOXTuNBJ1O5xe7K0qmfAUuxc/mlawvT E2snKw6lrxLjRWCw3ivJWiXsasfEpf2WSjoPpWNvfnaozN2OKa31YKzDfncldQo7BTT+ HC51K5DZY5qRJlFBGBddkryXcBtgcz4tA8DxzkGeKroT9nXP+4JIgYXgozTn7Bzo37xH 4L70Fls+r6oNuIlf5EFXRu+ncX5S5rysuaIUeN0v+r1kqzwJArSDjDm5qEANXCBCzvyG pgsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16534-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bd12-20020a056a00278c00b006d9e3d26615si15023708pfb.154.2024.01.04.02.47.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 02:47:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16534-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 46574B21B6A for ; Thu, 4 Jan 2024 10:47:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A2B820B3F; Thu, 4 Jan 2024 10:46:20 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 A9BC020DDD; Thu, 4 Jan 2024 10:46:17 +0000 (UTC) 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 8D55FC0006; Thu, 4 Jan 2024 10:46:14 +0000 (UTC) Message-ID: <509f3dd7-1c38-4b98-b21b-28d50399a344@ghiti.fr> Date: Thu, 4 Jan 2024 11:46:14 +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: [PATCH 4/4] riscv: enable HAVE_FAST_GUP if MMU Content-Language: en-US To: Jisheng Zhang Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org References: <20231219175046.2496-1-jszhang@kernel.org> <20231219175046.2496-5-jszhang@kernel.org> <3d36ca3c-9a91-41a7-9e68-288982c2c8a8@ghiti.fr> From: Alexandre Ghiti In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr On 02/01/2024 04:25, Jisheng Zhang wrote: > On Sun, Dec 31, 2023 at 07:37:33AM +0100, Alexandre Ghiti wrote: >> On 19/12/2023 18:50, Jisheng Zhang wrote: >>> Activate the fast gup for riscv mmu platforms. Here are some >>> GUP_FAST_BENCHMARK performance numbers: >>> >>> Before the patch: >>> GUP_FAST_BENCHMARK: Time: get:53203 put:5085 us >>> >>> After the patch: >>> GUP_FAST_BENCHMARK: Time: get:17711 put:5060 us >> >> On which platform did you run this benchmark? > T-HEAD th1520(cpufreq isn't enabled since the clk/pll isn't upstreamed, > so cpu is running at the default freq set by u-boot) >> >>> The get time is reduced by 66.7%! IOW, 3x get speed! >> >> Well done! >> >> Thanks, >> >> Alex >> >> >>> Signed-off-by: Jisheng Zhang >>> --- >>> arch/riscv/Kconfig | 1 + >>> arch/riscv/include/asm/pgtable.h | 6 ++++++ >>> 2 files changed, 7 insertions(+) >>> >>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig >>> index d3555173d9f4..04df9920282d 100644 >>> --- a/arch/riscv/Kconfig >>> +++ b/arch/riscv/Kconfig >>> @@ -119,6 +119,7 @@ config RISCV >>> select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER >>> select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION >>> select HAVE_EBPF_JIT if MMU >>> + select HAVE_FAST_GUP if MMU >>> select HAVE_FUNCTION_ARG_ACCESS_API >>> select HAVE_FUNCTION_ERROR_INJECTION >>> select HAVE_GCC_PLUGINS >>> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h >>> index ab00235b018f..c6eb214139e6 100644 >>> --- a/arch/riscv/include/asm/pgtable.h >>> +++ b/arch/riscv/include/asm/pgtable.h >>> @@ -673,6 +673,12 @@ static inline int pmd_write(pmd_t pmd) >>> return pte_write(pmd_pte(pmd)); >>> } >>> +#define pud_write pud_write >>> +static inline int pud_write(pud_t pud) >>> +{ >>> + return pte_write(pud_pte(pud)); >>> +} >>> + >>> static inline int pmd_dirty(pmd_t pmd) >>> { >>> return pte_dirty(pmd_pte(pmd)); Thanks, you can add: Reviewed-by: Alexandre Ghiti Thanks, Alex > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv