Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1689797ybk; Thu, 21 May 2020 12:49:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAyGQL4PYLQMgBx7FKbeUxhVn/EDNjitR1xLk8pKn9UJfyfXHYn3o02Co2YSCM+b3Ghqt/ X-Received: by 2002:a17:906:39c3:: with SMTP id i3mr5326924eje.417.1590090557181; Thu, 21 May 2020 12:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590090557; cv=none; d=google.com; s=arc-20160816; b=uM5cHOR5N8hDQgXbC2X6iMMbS5gjMBuoTV1O5ylJ9CfcnNrMQl1J9ivVk6zkeBC9ne XS1uQMHlQ+PhfclqPkcNv3RApOndhW0sDBUO8egTLAYcXmpnXoyiOc12T03OeYiY6yuq iGo61VuKY/8IhBdZmxvYNXWaCux3DhXfEi6PEr8dkosX6UitBkaaUvHMFlKo5euCPIuk Q9wd7zDDHYgwopQyCueZTucmC/vnkszijFxlgx1FWW4rmn8K/aKv2TUZeT7h4qnb7+nE 0fUJiUoNolCzdnlHxxGRdmPCDpF6yQMMrTXbzZjx6KP+EyAmyyfJ9pG2LT7NrqW9C5LF vk0A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=foeJlyVbhHBxd2p0ZoCNpnTcxIWCYuViSyIENFIMaWU=; b=XY1dybvXNXMMpAO1ztOw2L8mkyMUm7r5arLDYAcLiKYqmso6SzQgR1OL2Vewwp7V07 piHC5HhZKSQ8S7z8iYbrjjPZiBaXfQVgtNyGdm5dWj5hdMBjPCifnK+jVrkrzwX3XMV3 HFHOc9F9NGc+ivhR+4kHWTLNuBX1MEeAZ42+5kbttmefpeg1YiaB/MyCPGGLpg+nYRH7 sWVuRvjQzwFu7eUWlRzr/MGW9l6oIVki+c3l3JSz3rISqC5uIMDEwtd3Zrc9+at9nV7a D4cjo8xDvVCk1Frc+Rely9PlHUQS3HGx6oXHmcM7pR4rmEJDK2Y6BJ2b0ril7WFXNmlY qUtw== 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 a23si3932747ejk.653.2020.05.21.12.48.52; Thu, 21 May 2020 12:49:17 -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 S1729754AbgEUTrO (ORCPT + 99 others); Thu, 21 May 2020 15:47:14 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42801 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728635AbgEUTrN (ORCPT ); Thu, 21 May 2020 15:47:13 -0400 Received: by mail-pg1-f193.google.com with SMTP id n11so3709099pgl.9; Thu, 21 May 2020 12:47:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=foeJlyVbhHBxd2p0ZoCNpnTcxIWCYuViSyIENFIMaWU=; b=H4AMG/sSIZs2IO9bcj3oTb2+Rho16xRGbewPjJ7FYq5i4ZH/uK7JUSi1jH2fJbMR/K 8MU8EVXXjA2o/df9FVjyUK9FlWmplPp1i6EDKx8Z/C1JvjuxZYMcTytYoNbzUFdME+i5 hJOeJ4TA95pQGYEyQYdcfFx5kyuNrphWwJDEFRlnapwdQ97EB4u+tN1ZxObdEnI39E/U t9vqKoHcbTUAF+pNrekUT8bYPQZNGUdEcoKypRWLooTiO8eQa7YQyNEdbpwALN8ckCLd Ncy6p6PD+xLifrtv9NxFow4Y7/QyXxBNx7Iu1o29/h4aVUxD7ZqqwlJML7Qn2mv6oNSL 2Ntw== X-Gm-Message-State: AOAM533dGrD8OXJguH7t44vI9pNGUqzNGmJvNPedxWVjciv4H8mdtxhl HQHhi2QsWanuHbydNSPAsyxefRVW X-Received: by 2002:a63:e804:: with SMTP id s4mr10597494pgh.260.1590090431859; Thu, 21 May 2020 12:47:11 -0700 (PDT) Received: from ?IPv6:2601:647:4000:d7:50cc:4329:ba49:7ab1? ([2601:647:4000:d7:50cc:4329:ba49:7ab1]) by smtp.gmail.com with ESMTPSA id x10sm4344548pgr.65.2020.05.21.12.47.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2020 12:47:10 -0700 (PDT) Subject: Re: [PATCH] scsi: st: convert convert get_user_pages() --> pin_user_pages() To: John Hubbard , LKML Cc: =?UTF-8?Q?Kai_M=c3=a4kisara?= , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org References: <20200519045525.2446851-1-jhubbard@nvidia.com> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU447Bts8TJNa3lZKS1 AvW1ZklbvJfAJJAwzDih35LxU2fcWbmhPa7EO2DCv/LM1B10GBB/oQB5kvlq4aA2PSIWkqz4 3SI5kCPSs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x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <494478b6-9a8c-5271-fc9f-fd758af850c0@acm.org> Date: Thu, 21 May 2020 12:47:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200519045525.2446851-1-jhubbard@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-18 21:55, John Hubbard wrote: > This code was using get_user_pages*(), in a "Case 2" scenario > (DMA/RDMA), using the categorization from [1]. That means that it's > time to convert the get_user_pages*() + put_page() calls to > pin_user_pages*() + unpin_user_pages() calls. > > There is some helpful background in [2]: basically, this is a small > part of fixing a long-standing disconnect between pinning pages, and > file systems' use of those pages. > > Note that this effectively changes the code's behavior as well: it now > ultimately calls set_page_dirty_lock(), instead of SetPageDirty().This > is probably more accurate. > > As Christoph Hellwig put it, "set_page_dirty() is only safe if we are > dealing with a file backed page where we have reference on the inode it > hangs off." [3] > > Also, this deletes one of the two FIXME comments (about refcounting), > because there is nothing wrong with the refcounting at this point. > > [1] Documentation/core-api/pin_user_pages.rst > > [2] "Explicit pinning of user-space pages": > https://lwn.net/Articles/807108/ > > [3] https://lore.kernel.org/r/20190723153640.GB720@lst.de Kai, why is the st driver calling get_user_pages_fast() directly instead of calling blk_rq_map_user()? blk_rq_map_user() is already used in st_scsi_execute(). I think that the blk_rq_map_user() implementation is also based on get_user_pages_fast(). See also iov_iter_get_pages_alloc() in lib/iov_iter.c. John, why are the get_user_pages_fast() calls in the st driver modified but not the blk_rq_map_user() call? Are you sure that the modified code is a "case 2" scenario and not a "case 1" scenario? Thanks, Bart.