From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBE98C43461 for ; Mon, 7 Sep 2020 10:11:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79CD0207C3 for ; Mon, 7 Sep 2020 10:11:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="v6UyMdSR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="wTjARGHH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79CD0207C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xtkl3fFpyUYWdXd31mrvv35BGlXlPNYleH/+q6T6i3o=; b=v6UyMdSRlakmedNLA0K5xYzxJ 8js90yXROtQN0h8Euc1I9YtUlE5+AFu1ZeDMCqOnmzYZEMof26llEG/3n1UmwuXXaLrhVFD03yfkz HI7NvxihKVtY1WD/u7qDJYlNeh5pgeY96ZspGEIUE7GewPkbZ/s08XYj7XX7oDdAzLOw1evriusnC CUva05BKLyd61Qj0cRRssXuQB1v0dYy5uoRnLHnOM3/iHRjUqzFL1hIp+5hdByV7mKSfPxc3O7JX7 OWD35Qce+j4iOcrwVnMCwlcENozs+qqLnIhTs6+tLj2Gcex9H/w0dHv/MbubHQ+LyyZkgEH/0OgLG QN4bxNbbA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFE6F-0000r3-4d; Mon, 07 Sep 2020 10:10:11 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFE6C-0000qZ-TD for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2020 10:10:09 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E7856207C3; Mon, 7 Sep 2020 10:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599473408; bh=DdyKvDduyIm5+OD9DDXx1sFF7tQydimT+2MR9Bk8azY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wTjARGHH8jiZcyHd46LUsbd3HkMbc5+QZspww7sL89c1XY8KxDrHWUE5ViYX7oj2E OBv5Mub8sM2uw46ba0922NnR6v8cSmKALYTVlgj8OeYRYVEA5XEt3IvsjQWWctgs+O WnsE2DOQr+M+9a6IY2uBULDHSPtTT7hXIP7bNPv0= Date: Mon, 7 Sep 2020 11:10:03 +0100 From: Will Deacon To: Oli Swede Subject: Re: [PATCH v4 00/14] arm64: Optimise and update memcpy, user copy and string routines Message-ID: <20200907101003.GA11970@willie-the-truck> References: <20200630194822.1082-1-oli.swede@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_061009_017769_5670B900 X-CRM114-Status: GOOD ( 23.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Robin Murphy , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Oli, Thanks for this. Just a few high-level comments below. On Wed, Jul 01, 2020 at 09:12:49AM +0100, Oli Swede wrote: > > Version 3 addressed this but I later found some issues with the fixup > > correctness after further testing, and have partially re-written them > > here, and addressed some other behaviours of the copy algorithm. [...] > I am waiting on access to the relevant machine before posting the benchmark > results for this optimized memcpy, but Sam reported the following with the > similar (but now slightly older) cortex-strings version: > * copy_from_user: 13.17% > * copy_to_user: 4.8% > * memcpy: 27.88% > * copy_in_user: Didn't appear in the test results. > This machine will also be used to check the fixups are accurate on a system > with UAO - they appear to be exact on a non-UAO system with PAN that I've > been working on locally. I'm inclined to say that cortex-strings is probably not a good basis for our uaccess routines. The code needs to be adapted in a non-straightforward way so that we lose pretty much all of the benefits we'd usually get from adopted an existing implementation; we can't pull in fixes or improvements without a lot of manual effort, we can't reuse existing testing infrastructure (see below) and we end up being a "second-class" user of the routines because of the discrepancies in implementation. So why don't we use cortex-strings as a basis for the in-kernel routines only, preferably in a form where the code can be used directly and updated with a script (e.g. similar to how we pull in arch/arm64/crypto routines from OpenSSL). We can then roll our own uaccess routines, using a slightly more straight-forward implementation which is more amenable to handling user faults and doesn't do things like over copying. > I should also mention that the correctness of these routines were tested > using a selftest test module akin to lib/test_user_copy.c (whose usercopy > functionality checks these patches do pass) but which is more specific to > the fixup accuracy, in that it compares the return value with the true > number of bytes remaining in the destination buffer at the point of a fault. Can we put this test module into the kernel source tree, please, maybe as part of lkdtm? Given the control flow of these optimised functions, I think we absolutely need targetted testing to make sure we're getting complete coverage. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel