Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1588121ybt; Mon, 15 Jun 2020 04:24:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/go7JWgeCdv3DiyBHxYmR0zothu/fUhvDfjOsEoVOlmhgJAMJd6vI4dwyCEfW2XC76GIa X-Received: by 2002:a17:906:2e81:: with SMTP id o1mr23843577eji.362.1592220293873; Mon, 15 Jun 2020 04:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592220293; cv=none; d=google.com; s=arc-20160816; b=qO3YfaCQ0Sp+FbEReGiOiiVNVYK/MrpmUaiOmuTUbPiEAGO5e/J8wsnHlHTYUPZe2h yeGaKJrjTXq2Lt8krJzSSIgFdtDJzZzCntBNYLSKGmBojbxs9v67dbt60Y3Hhwi/7HMJ gDjQmX6ubMKQ2o+2eY4qLnO08USp2r9YRZCSpmxsjPbYXRcvb/2MhFGqV73GIiNZODgY tN3hb+B0EgTLj8bQeJUCSZY5eX45Nuk0DCwBaeX86ykWUUS2EFnzZHFBY+AN5AJPbUs7 qrPft+uLVdfVGB2B8g8sUGrpxMfI++9NUA9I3DexjI5wT+dRK2l9cTjoX1urNnN+7on4 RHUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=Dr/o3SG/R3xGhRi7MC9cwGk5jnwbYjm20FMsEf7RH80=; b=rHu9Rgqi34SqOC9eD7uiZiuerUtQqRW0HonCBIJH7YBfX6pLO3MkExFB8PmIqLMSE6 iYg0HkjWbSQ2QR59ygTYb7RuITU9U9mgJWbfszU5TdSV2OjQoV+10NLP+r/l2CLzxikz KLbnD+fgwTmY9RGI+yVC+gnZ38ETICfq4nbukbeXJz8IjAdk06V10ChG6GWANardm6+h eFm60j97aGdIsocLGgWHjXfvLzi7I1idbbaULwsU/VNsj0NBd74O8TguT1Px1vRBh0x/ JncNrVyGiIwtGUF1/Yw5LduTe4p7afKj/zhNoO1Gwf9bq8gmA9vgJhosU/33lseQ4XvD N1FQ== 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=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q9si8631258edb.473.2020.06.15.04.24.31; Mon, 15 Jun 2020 04:24:53 -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=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729097AbgFOLWl convert rfc822-to-8bit (ORCPT + 99 others); Mon, 15 Jun 2020 07:22:41 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:47223 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728285AbgFOLWl (ORCPT ); Mon, 15 Jun 2020 07:22:41 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-47-9KR430kxM7Czl-jMyYnSMw-1; Mon, 15 Jun 2020 12:22:36 +0100 X-MC-Unique: 9KR430kxM7Czl-jMyYnSMw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 15 Jun 2020 12:22:35 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 15 Jun 2020 12:22:35 +0100 From: David Laight To: 'Al Viro' , afzal mohammed CC: Arnd Bergmann , Russell King - ARM Linux admin , Linus Walleij , "linux-kernel@vger.kernel.org" , Linux-MM , Linux ARM , Nicolas Pitre , Catalin Marinas , Will Deacon Subject: RE: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Thread-Topic: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Thread-Index: AQHWQZeuKY4+jVw3gESBYOJARK44Q6jZh6/w Date: Mon, 15 Jun 2020 11:22:35 +0000 Message-ID: <3ef1b43f182041bc9585f5fd462a092f@AcuMS.aculab.com> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> <20200613120432.GA5319@afzalpc> <20200613125126.GE23230@ZenIV.linux.org.uk> <20200613125615.GF23230@ZenIV.linux.org.uk> <20200613134236.GA4086@afzalpc> <20200613153102.GG23230@ZenIV.linux.org.uk> In-Reply-To: <20200613153102.GG23230@ZenIV.linux.org.uk> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro > Sent: 13 June 2020 16:31 > On Sat, Jun 13, 2020 at 07:12:36PM +0530, afzal mohammed wrote: > > Hi, > > > > On Sat, Jun 13, 2020 at 01:56:15PM +0100, Al Viro wrote: > > > > > Incidentally, what about get_user()/put_user()? _That_ is where it's > > > going to really hurt... > > > > All other uaccess routines are also planned to be added, posting only > > copy_{from,to}_user() was to get early feedback (mentioned in the > > cover letter) > > Sure, but what I mean is that I'd expect the performance loss to be > dominated by that, not by copy_from_user/copy_to_user on large amounts > of data. Especially on the loads like kernel builds - a lot of stat() > and getdents() calls there. Or any network traffic where the number of usercopies involved in, for example, sendmsg() gives a measurable performance decrease when HARDENED_USERCOPY is enabled. Do you have issues with cache aliasing? (Is aliasing the right term?) Where potentially the temporary kernel map doesn't use the same cache lines as the user processes map. I'm not sure what problem you are trying to solve, but for 64bit systems it may be possible to map all of physical memory into the kernel address map, them you (loosely) only have to find the KVA that matches the user-VA to do the copy. IIRC our SYSV kernels used to do that - until we had 384MB of physical memory and ran out of kernel address space. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)