Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp226219ybm; Thu, 28 May 2020 21:29:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy0grH05hT/NeymBnueH+irdras09H8piRZMxth/aT1XmyE/qV3EiHbF1tOZNtX5y7f/pD X-Received: by 2002:a17:906:4815:: with SMTP id w21mr6291468ejq.533.1590726562409; Thu, 28 May 2020 21:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590726562; cv=none; d=google.com; s=arc-20160816; b=YiSh0pnkqqAsLpgSZdw+qmBiXsLholFfEFJWPDW03+bfzrvyxCG/SgrAEvA/KKJXvA u5AVHiWgnehsmhRJlTvhMXo5gZHMmc4C2xdRBcxbtMpXOaVf6gMfe4Y7Sfglq8Wi7CSb dObVUST+JTMRgq71TPldalx3B0dgA6QCEhDXUwIbiDxvqCEtQ3v3XENEp5HwLthY2gIt Zcs8yGO9JBCbj5U4JoGt5MDxzC7naV322aX5ygIMil/YCMS4Xpdo5ejjFDK3BscPyrge bQOnLA1TOKtguBv4iAvd8dYqaVxEDzP48QFfidGeWLrE4R7noL0tjBxU3snj/xsSUF5/ axOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=46O/kHxtk2wgqmDfvsw4xQNnnilZVPfYYcXinRgg0zI=; b=mMjP9/cs4qkOnYRi8DpUFHZtTECAIPPF7Iqt3J5/aVkLBEpdfX/0r8JO7FtOQ/outD pySma+Xpa6bPZx29ATjke8Jw4q6THmaxeJp/oXax44goulKvoRde+/S54QIhdl9pWoY8 fZOh916tcgvnnr8U7NF8WAPXddbz+UeAgC/tguuDG4fMv7DuWH7bowXLi7MbhN0nnhyz wLDpaRu2qDDZH0Xewqwc9Zg89dDunpryqc/N3v3jlhAmYNLUDCnZ6705hZ/tt9hRQhQS fHSEUIDSva8PLvCr7T36A1yhSSBueoIv+/7cxXx/edau+MCK34/Xip3JRWnZD8cnTd4c X0HA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si1518829edr.398.2020.05.28.21.28.59; Thu, 28 May 2020 21:29:22 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbgE2EYc (ORCPT + 99 others); Fri, 29 May 2020 00:24:32 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:46907 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbgE2EYV (ORCPT ); Fri, 29 May 2020 00:24:21 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 49YBKb2VVkz9sT6; Fri, 29 May 2020 14:24:17 +1000 (AEST) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: 17bc43367fc2a720400d21c745db641c654c1e6b In-Reply-To: To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , npiggin@gmail.com, segher@kernel.crashing.org From: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] powerpc/uaccess: Implement unsafe_copy_to_user() as a simple loop Message-Id: <49YBKb2VVkz9sT6@ozlabs.org> Date: Fri, 29 May 2020 14:24:17 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-04-17 at 17:08:52 UTC, Christophe Leroy wrote: > At the time being, unsafe_copy_to_user() is based on > raw_copy_to_user() which calls __copy_tofrom_user(). > > __copy_tofrom_user() is a big optimised function to copy big amount > of data. It aligns destinations to cache line in order to use > dcbz instruction. > > Today unsafe_copy_to_user() is called only from filldir(). > It is used to mainly copy small amount of data like filenames, > so __copy_tofrom_user() is not fit. > > Also, unsafe_copy_to_user() is used within user_access_begin/end > sections. In those section, it is preferable to not call functions. > > Rewrite unsafe_copy_to_user() as a macro that uses __put_user_goto(). > We first perform a loop of long, then we finish with necessary > complements. > > unsafe_copy_to_user() might be used in the near future to copy > fixed-size data, like pt_regs structs during signal processing. > Having it as a macro allows GCC to optimise it for instead when > it knows the size in advance, it can unloop loops, drop complements > when the size is a multiple of longs, etc ... > > Signed-off-by: Christophe Leroy Applied to powerpc topic/uaccess-ppc, thanks. https://git.kernel.org/powerpc/c/17bc43367fc2a720400d21c745db641c654c1e6b cheers