Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4917305pxj; Tue, 22 Jun 2021 10:46:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD1d1mXoymTdF8C5/pibFWkFxZk12vQGOhDMRvPyqsyp5lyq+YnkgFAhDIQIuSpgo/0rrZ X-Received: by 2002:a02:c7c4:: with SMTP id s4mr763922jao.71.1624384009147; Tue, 22 Jun 2021 10:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624384009; cv=none; d=google.com; s=arc-20160816; b=O0Pefu8lkNyX3ow2PyvK7xgbU5M0W6xxbB/1MaC1753Dbsy5946/n5vj5myf0HpaK9 t/QuDpkbtHJPgG4Y6nenlq1M+pk3PVb0/5/WVHVpMWwAtUdZoQOOsI4Rv6DfVer52PFl tV8JDi/PQoGfqLoG7uWwLF+LN70pfvXP2d6940emb619utJV5/Zw1qg52yPd7qIlaa/I 7kjQ6h3D3ow55AlmPD3AjgcGwq3MBwApTvH/scsDmcCwrVZGUT+myv6nwuKz5qPiEwQs xg9raePMr8HqKL2aHzkZOPYFxFs39Q2D0sknSEwK9PuZh7o4z/k7Kkane9HRsXiyJFPJ rpqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:to:subject; bh=WTD6X8/R5EK+BPyPzXgahyYE1f3UHGQyODi8Z9xfr6s=; b=kxcHXxs8g0+rJmrr42iNXwkOyDevdmzRxcHbmiM4ANB0HSevrqZCM29Ez+WEN54eTu kxpglLmG+bRvCBMd8bih/PmnHXjTd1YTOueoARmZx49jtEqbN6zs4ZDxsLbCyQI/DHBE 0MANXSQ9MOZGcx+RqWAKzXUEDPNGwaBbox/UrOzoY5pYZ1ua78Cz8NMhBpsglaIgwLs2 wXTDzHi4GWNvOebEia/SRddVDSQAkCPaIHaILcaLy/bLFwcoG71shWdybGxjVjE7a+t/ rCGQAwq4607qT94+n9ivyBgn6etLm3tYZwHc2uJN5E1iW0j1DKguOmpWEvWPXIVi+Dmy MiKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si11399054ill.117.2021.06.22.10.46.37; Tue, 22 Jun 2021 10:46:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232504AbhFVRsL (ORCPT + 99 others); Tue, 22 Jun 2021 13:48:11 -0400 Received: from imap2.colo.codethink.co.uk ([78.40.148.184]:58636 "EHLO imap2.colo.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232536AbhFVRr6 (ORCPT ); Tue, 22 Jun 2021 13:47:58 -0400 Received: from cpc152649-stkp13-2-0-cust121.10-2.cable.virginm.net ([86.15.83.122] helo=[192.168.0.18]) by imap2.colo.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1lvkSw-0000OM-AE; Tue, 22 Jun 2021 18:45:38 +0100 Subject: Re: [PATCH v2 0/5] riscv: improving uaccess with logs from network bench To: Akira Tsukamoto , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org References: <5a5c07ac-8c11-79d3-46a3-a255d4148f76@gmail.com> From: Ben Dooks Organization: Codethink Limited. Message-ID: Date: Tue, 22 Jun 2021 18:45:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/06/2021 13:05, Akira Tsukamoto wrote: > On 6/22/2021 5:30 PM, Ben Dooks wrote: >> On 19/06/2021 12:21, Akira Tsukamoto wrote: >>> Optimizing copy_to_user and copy_from_user. >>> >>> I rewrote the functions in v2, heavily influenced by Garry's memcpy >>> function [1]. >>> The functions must be written in assembler to handle page faults manually >>> inside the function. >>> >>> With the changes, improves in the percentage usage and some performance >>> of network speed in UDP packets. >>> Only patching copy_user. Using the original memcpy. >>> >>> All results are from the same base kernel, same rootfs and same >>> BeagleV beta board. >>> >>> Comparison by "perf top -Ue task-clock" while running iperf3. >> >> I did a quick test on a SiFive Unmatched with IO to an NVME. >> >> before: cached-reads=172.47MB/sec, buffered-reads=135.8MB/sec >> with-patch: cached-read=s177.54Mb/sec, buffered-reads=137.79MB/sec >> >> That was just one test run, so there was a small improvement. I am >> sort of surprised we didn't get more of a win from this. >> >> perf record on hdparm shows that it spends approx 15% cpu time in >> asm_copy_to_user. Does anyone have a benchmark for this which just >> looks at copy/to user? if not should we create one? > > Thanks for the result on the Unmatched with hdparm. Have you tried > iperf3? I will see if there is iperf3 installed. I've not done much other than try booting it and then try booting it with a kernel i've built from upstream. > The 15% is high, is it before or with-patch? Can't remember, I did this more to find out if the copy to/from user was going to show up in the times for hdparm. > Akira > -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html