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=-2.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 342EBC433DF for ; Sun, 14 Jun 2020 13:06:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 01E15206D7 for ; Sun, 14 Jun 2020 13:06:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MLOOs4aj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="onBIBYT4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01E15206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.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=ivQc+Ej5l2hS0GUDsV/IONc1jDa2mBV6aXaWwyVSj7I=; b=MLOOs4aj8OERZL Km4WaUpzvVhrDv21Wj+EV4AJpBt9+Fj0fkFH9A2YqMazVTyWWtT38+EEilX45DK20TJwM7MLyYLeg U9tWqm0iGwXW6r0CyODjSLm3HXzXnwPbb/f6dYoZJeuFgB2aEdf/lEp6/ZAHCW9IS1LX8fOxXKHqe HWVXgVkcvK+p5NYXda+y3T8R6cqZn5qvft5TDFE1q9SkIrGMTjyIJzuBNpgp10URc5IAivYYeZx3B Yr3OwJh02v9WDn9M/bBP01nXfqD53PhxxVXUJlAb/pgy0aAUJlUfeCD2MZNgt9GXNge0R9rk3TlGL Bm6/Mmr2Ao2/hPzxwHnA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jkSLR-0006xW-2W; Sun, 14 Jun 2020 13:06:41 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jkSLO-0006wx-U6 for linux-arm-kernel@lists.infradead.org; Sun, 14 Jun 2020 13:06:40 +0000 Received: by mail-pf1-x441.google.com with SMTP id b201so6615654pfb.0 for ; Sun, 14 Jun 2020 06:06:38 -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:in-reply-to:user-agent; bh=tbNPHbcJdd9Zy5vpitc4It2x0QhJhg6ckwY09//qr6Y=; b=onBIBYT4ViSU7ygp5zYYYBkpUleSF5iOdLkVHxQBdUzs6HwG5FPU2AJIL94jiO1/3q e611vI3yaKJGxZt2s4y6snRpXKvWJq8OqYUJjwVNmgfG7HHqxMRpPNskzZb5sxAjWHjY xnRzeKS3IREF5B9/QGpTyAwqFLQY/nYBHWJAnL9xC8VVruuUd86ny7YZy0CwYO06X5JA S87sPGgfHf0Of2/wEO3Lf7D81x16zacDo1gKx/WP3icE0P4D0ZRLXudAyfnGbhm2eAFX FoESIv6H9gYq4R8Kg1xRHUcUxg6EpkTgR8UX8haSscXC6Q7aRYqatXBg5s4wlT6QdIlv AbXg== 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:in-reply-to:user-agent; bh=tbNPHbcJdd9Zy5vpitc4It2x0QhJhg6ckwY09//qr6Y=; b=fVrdJrz8Zc0RogaKsDXxvVlsC3CS61dwuy4+rI4HVvmuN/NZGIgJwl8oGgm3+YEWny bVYaURGuBT661v6B9ysBN7c8VvRqekq1c78xb12yysq3I3n1CHeXVLjsh1gsoqQ2LlPt ECZtu4lUE8ompntqnGDDsnvAO1mv6sioQFmJQsWWKDFElvccmH7h0WWh3diaIUPJKfGq caRRwLRNxZ19kOppwa0zQwkIWAx9T6UxESshUxiN9RNZH9/0LivgEZNH1jka9JH6XWNd irK2gq1DsUZijBAWtIxz102DXYhksjAJCo1PJq4a+Sr5If/9L1Qn2XTxHo0sxTrqNmzL XzoA== X-Gm-Message-State: AOAM5323gX0Q0PYqQSXZCBT5Yi332vS7f2D0joaSYFOOGrz2IIN8ADz+ ZBfmujOv41HPHCheYn4jDgA= X-Google-Smtp-Source: ABdhPJzSwp75HDSJw1OL5kd4Rpdjmi7CLAzvE7VPRCs+dMV7al78Ke9fy4XDN78px0l2mL6bUhjXnw== X-Received: by 2002:a63:4861:: with SMTP id x33mr109880pgk.448.1592139997958; Sun, 14 Jun 2020 06:06:37 -0700 (PDT) Received: from localhost ([49.207.199.244]) by smtp.gmail.com with ESMTPSA id y10sm9811760pgi.54.2020.06.14.06.06.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Jun 2020 06:06:37 -0700 (PDT) Date: Sun, 14 Jun 2020 18:36:35 +0530 From: afzal mohammed To: Russell King - ARM Linux admin Subject: Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Message-ID: <20200614130635.GA5037@afzalpc> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> <20200613120432.GA5319@afzalpc> <20200613131552.GL1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200613131552.GL1551@shell.armlinux.org.uk> User-Agent: Mutt/1.9.3 (2018-01-21) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200614_060638_988045_1EDE9CC3 X-CRM114-Status: GOOD ( 13.50 ) 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: Arnd Bergmann , Nicolas Pitre , Catalin Marinas , Linus Walleij , "linux-kernel@vger.kernel.org" , Linux-MM , Will Deacon , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Sat, Jun 13, 2020 at 02:15:52PM +0100, Russell King - ARM Linux admin wrote: > On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > > i think C > > library cuts any size read, write to page size (if it exceeds) & > > invokes the system call. > You can't make that assumption about read(2). stdio in the C library > may read a page size of data at a time, but programs are allowed to > call read(2) directly, and the C library will pass such a call straight > through to the kernel. So, if userspace requests a 16k read via > read(2), then read(2) will be invoked covering 16k. > > As an extreme case, for example: > > $ strace -e read dd if=/dev/zero of=/dev/null bs=1048576 count=1 > read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576 Okay. Yes, observed that dd is passing whatever is the 'bs' to Kernel and from the 'dd' sources (of busybox), it is invoking read system call directly passing 'bs', so it is the tmpfs read that is splitting it to page size as mentioned by Arnd. Regards afzal _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 98FD6C433E0 for ; Sun, 14 Jun 2020 13:06:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5DDFA206D7 for ; Sun, 14 Jun 2020 13:06:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="onBIBYT4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DDFA206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DFA086B002E; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAB276B002F; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C99626B0030; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id AF3CD6B002E for ; Sun, 14 Jun 2020 09:06:39 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 67CDC181ABE89 for ; Sun, 14 Jun 2020 13:06:39 +0000 (UTC) X-FDA: 76927841718.30.jelly53_0b0bfe226ded Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 41B90180B3C83 for ; Sun, 14 Jun 2020 13:06:39 +0000 (UTC) X-HE-Tag: jelly53_0b0bfe226ded X-Filterd-Recvd-Size: 4659 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Sun, 14 Jun 2020 13:06:38 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id j6so2467488pgh.4 for ; Sun, 14 Jun 2020 06:06:38 -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:in-reply-to:user-agent; bh=tbNPHbcJdd9Zy5vpitc4It2x0QhJhg6ckwY09//qr6Y=; b=onBIBYT4ViSU7ygp5zYYYBkpUleSF5iOdLkVHxQBdUzs6HwG5FPU2AJIL94jiO1/3q e611vI3yaKJGxZt2s4y6snRpXKvWJq8OqYUJjwVNmgfG7HHqxMRpPNskzZb5sxAjWHjY xnRzeKS3IREF5B9/QGpTyAwqFLQY/nYBHWJAnL9xC8VVruuUd86ny7YZy0CwYO06X5JA S87sPGgfHf0Of2/wEO3Lf7D81x16zacDo1gKx/WP3icE0P4D0ZRLXudAyfnGbhm2eAFX FoESIv6H9gYq4R8Kg1xRHUcUxg6EpkTgR8UX8haSscXC6Q7aRYqatXBg5s4wlT6QdIlv AbXg== 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:in-reply-to:user-agent; bh=tbNPHbcJdd9Zy5vpitc4It2x0QhJhg6ckwY09//qr6Y=; b=qx+eul75ScH7jBtnmw5W/vTv6pzbyz7EwQORrUhox3fI0UG71OzA969s0OEXpF7rRk YcJyXKei1B7V3ubfUfw3XRz6i4gVEi7UKhTdf03+0Im91kc6HOTCQ37k2Te5w29YMQlR D3mke+C7Vn9JSRS5ckP3fjYXDnGr4J2I/r0fUghiZpY+pYO9f+YQDUxmzhqKCyHrzQuN yxDuc4aKaqW+YEvTgKctiRgUNliu+a7WN9lCzv3eIRneJL6jYKB683qytbH4FBKCupx/ OK+Xv4QDb08ex1BHBvF1snw+JZxAc45HrEvQuHTggUwXxWmNNKQYdNUQSzEylq4o/meo kixg== X-Gm-Message-State: AOAM5338m+oR4LA5lLwQKeNsodPJk9mmU/BNiAI7brGVziLnLuJqbefc 73Tg0mFlZyeMBqzaB4d7rKM= X-Google-Smtp-Source: ABdhPJzSwp75HDSJw1OL5kd4Rpdjmi7CLAzvE7VPRCs+dMV7al78Ke9fy4XDN78px0l2mL6bUhjXnw== X-Received: by 2002:a63:4861:: with SMTP id x33mr109880pgk.448.1592139997958; Sun, 14 Jun 2020 06:06:37 -0700 (PDT) Received: from localhost ([49.207.199.244]) by smtp.gmail.com with ESMTPSA id y10sm9811760pgi.54.2020.06.14.06.06.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Jun 2020 06:06:37 -0700 (PDT) Date: Sun, 14 Jun 2020 18:36:35 +0530 From: afzal mohammed To: Russell King - ARM Linux admin Cc: Arnd Bergmann , Nicolas Pitre , Catalin Marinas , Linus Walleij , "linux-kernel@vger.kernel.org" , Linux-MM , Will Deacon , Linux ARM Subject: Re: [RFC 1/3] lib: copy_{from,to}_user using gup & kmap_atomic() Message-ID: <20200614130635.GA5037@afzalpc> References: <9e1de19f35e2d5e1d115c9ec3b7c3284b4a4e077.1591885760.git.afzal.mohd.ma@gmail.com> <20200612135538.GA13399@afzalpc> <20200613120432.GA5319@afzalpc> <20200613131552.GL1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200613131552.GL1551@shell.armlinux.org.uk> User-Agent: Mutt/1.9.3 (2018-01-21) X-Rspamd-Queue-Id: 41B90180B3C83 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, On Sat, Jun 13, 2020 at 02:15:52PM +0100, Russell King - ARM Linux admin wrote: > On Sat, Jun 13, 2020 at 05:34:32PM +0530, afzal mohammed wrote: > > i think C > > library cuts any size read, write to page size (if it exceeds) & > > invokes the system call. > You can't make that assumption about read(2). stdio in the C library > may read a page size of data at a time, but programs are allowed to > call read(2) directly, and the C library will pass such a call straight > through to the kernel. So, if userspace requests a 16k read via > read(2), then read(2) will be invoked covering 16k. > > As an extreme case, for example: > > $ strace -e read dd if=/dev/zero of=/dev/null bs=1048576 count=1 > read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1048576) = 1048576 Okay. Yes, observed that dd is passing whatever is the 'bs' to Kernel and from the 'dd' sources (of busybox), it is invoking read system call directly passing 'bs', so it is the tmpfs read that is splitting it to page size as mentioned by Arnd. Regards afzal