Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp978202ybt; Sun, 14 Jun 2020 06:24:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJP0IyUmFIoFVHiSQ7Pv8qi/9tvPwZdLIvUwEnsEzkFbAnKmGhwukgZ8opTJFdbBTh/wZ5 X-Received: by 2002:aa7:c682:: with SMTP id n2mr19272055edq.18.1592141048617; Sun, 14 Jun 2020 06:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592141048; cv=none; d=google.com; s=arc-20160816; b=XQy31+dPApk9Rrg7wijUcW4ApRIMxm8CK+eGlqlkzkSQOvsQJsGlz345CNN1f9Hn28 uM2zU6Rzs/Y1KN8QC6dPov4sUZ8S890N8tO7piYRQn6ttj0RzcTJCJMYVvX4Dws1n/Mz S/ZhmE6ZcohdX1gEbV8sqTlATCpsz5sDruk29WMt5h/po0VbpwyZ7MUMjv6vIo1YxIi3 11QIAI5d4/ZiXgi7PZyAEJ2bYeUB148f6e96CyOgorCCT5eLXcA7y20czB4+Ttm8MRSu nHWMJmOJg7NeikrRqfUlLhQ8PtZsCbCozJzlcn2z5IjE7WNJZQ5b1uzPIjC99JEgORom zL6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7cP+mQI0zQhwvMzCwzM1g6my9t24Zv77a3K2bh1EtiQ=; b=LmtZiXUekWPwVhfSEA4H7d7yr784mcqB0uLSr91g/PuHNSbNSrzm/PwsS1NOyZ9smw LO3uaDJ96GpoBsCSHJxh4HU1osWoSoyTQqJG/vzhNeg9YZv1zxiqW9TjU5pe7nUzryLQ I+jwaxmzWU/adSedwNr00kSgmBak1pnrwuvN8W/9ubWS0o4k5OBlPjrvoTk/0hSqUt7B A3ACix/q7xVZ9u1s2qOHIWrik3ziIGVS/0vnIe0khzJ9kbVvRpmcUJU/IOpWccd2a4V6 reQMc1mBjoC0E1Ftk9jkmIcgt1Fmpea5i19ECRxcTQ9g2mzUXXrpw3rUZ4M0BiyVBD0P LS7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j2fAIXnY; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf20si6925851edb.66.2020.06.14.06.23.46; Sun, 14 Jun 2020 06:24:08 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j2fAIXnY; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727113AbgFNNVr (ORCPT + 99 others); Sun, 14 Jun 2020 09:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726925AbgFNNVq (ORCPT ); Sun, 14 Jun 2020 09:21:46 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E91C05BD43 for ; Sun, 14 Jun 2020 06:21:46 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id m2so5894517pjv.2 for ; Sun, 14 Jun 2020 06:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=7cP+mQI0zQhwvMzCwzM1g6my9t24Zv77a3K2bh1EtiQ=; b=j2fAIXnY31BJIK/Ksr6sAZdLsdL3/LaYUdn/acBEVQ4zcC2z06yKrYQlvbFJWZS4S9 eiReDtqSO96Hrm/W+k/l9StZi5Htbp/JWOIAWmyr5AH4jKW92uBRlISV6IAuHOspIZDE v1fwN3089NBrHQJsM5sTaKnKmIerNZLfCS+8d/ok6BeMnCWC8m0PKdcOcfJXuycwhFq+ XRpbfeHl3YbTKtJq9mDs3EAvhoeoKLlsKF+DGB6kOjAqnF7ZFDzUSETcFvY/ISEH5Aun nyl0lsAgfr2nvdZaqG0/+NRqRv2WNQpIHQ0iQKs344JCSIpwBC04/TCms5OAXaxxLVaC aETg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=7cP+mQI0zQhwvMzCwzM1g6my9t24Zv77a3K2bh1EtiQ=; b=pB0pZ0Os7AeYu0uXk53Wv6UalXKBZYEsspvOJAKy4G4a0gcFt9OgqNz3Gcj41g1ote Bakfw2mbdJlPV6uwTSuZUtwDeQpt+GUBZjvQfIX9OrYklwmLIacmnSj+FOiChYdRRUfd ThwPYZROAV8pKfGIIlVmadCIBodyi3F6k+4M542QTEhdEW4b+PBMTY0UV6Ki3v5GrDWt SMoQog8qrQTrRi5zLcflbtwOzbz7yNa0WSTDoGry925cRa2IXKzHEtpougGjVorYZbwK DO4lz78xsmNQOEMgPKTA0yWJcw7ftEzbc3zFFZ88CSqI6z5ciISu21glM2DrniDONIqA vG9g== X-Gm-Message-State: AOAM531vn7ZsjjtvXCRjBv+fnm0qhtly7v0zOxQwvNLMv9A4Y84ibLqK uHORO42Ze2SrBKB+H9RVC2s= X-Received: by 2002:a17:90a:e288:: with SMTP id d8mr7936307pjz.173.1592140905737; Sun, 14 Jun 2020 06:21:45 -0700 (PDT) Received: from localhost ([49.207.199.244]) by smtp.gmail.com with ESMTPSA id y9sm11333111pfr.184.2020.06.14.06.21.44 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Jun 2020 06:21:45 -0700 (PDT) Date: Sun, 14 Jun 2020 18:51:43 +0530 From: afzal mohammed To: Arnd Bergmann Cc: Russell King - ARM Linux admin , Linus Walleij , "linux-kernel@vger.kernel.org" , Linux-MM , Linux ARM , Nicolas Pitre , Catalin Marinas , Will Deacon , Matthew Wilcox , Al Viro Subject: Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Message-ID: <20200614132143.GA599@afzalpc> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> <20200613120432.GA5319@afzalpc> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sat, Jun 13, 2020 at 10:45:33PM +0200, Arnd Bergmann wrote: > 4% boot time increase sounds like a lot, especially if that is only for > copy_from_user/copy_to_user. In the end it really depends on how well > get_user()/put_user() and small copies can be optimized in the end. i mentioned the worst case(happened only once), normally it was in the range 2-3% > From the numbers you > measured, it seems the beaglebone currently needs an extra ~6?s or > 3?s per copy_to/from_user() call with your patch, depending on what > your benchmark was (MB/s for just reading or writing vs MB/s for > copying from one file to another through a user space buffer). It is MB/s for copying one file to another via user space buffer, i.e. the value coreutils 'dd' shows w/ status=progress (here it was busybox 'dd', so instead it was enabling a compile time option) > but if you want to test what the overhead is, you could try changing > /dev/zero (or a different chardev like it) to use a series of > put_user(0, u32uptr++) in place of whatever it has, and then replace the > 'str' instruction with dummy writes to ttbr0 using the value it already > has, like: > > mcr p15, 0, %0, c2, c0, 0 /* set_ttbr0() */ > isb /* prevent speculative access to kernel table */ > str %1, [%2],0 /* write 32 bit to user space */ > mcr p15, 0, %0, c2, c0, 0 /* set_ttbr0() */ > isb /* prevent speculative access to user table */ > It would be interesting to compare it to the overhead of a > get_user_page_fast() based implementation. i have to relocate & be on quarantine couple of weeks, so i will temporarily stop here, otherwise might end up in roadside. Reading feedbacks from everyone, some of it i could grasp only bits & pieces, familiarizing more w/ mm & vfs would help me add value better to the goal/discussion. Linus Walleij, if you wish to explore things, feel free, right now don't know how my connectivity would be for next 3 weeks. Regards afzal