Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp97372ybr; Fri, 22 May 2020 01:51:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+wTy9wiRy6Y52kuudPCVExkXbpPA61y+DZiNvo9d8ZKXsvkegHYh9PRPVQRkt7jKNo5JR X-Received: by 2002:a05:6402:128d:: with SMTP id w13mr2265350edv.0.1590137462694; Fri, 22 May 2020 01:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590137462; cv=none; d=google.com; s=arc-20160816; b=VQRjp0SxLQYRQu0Qi/TiCqvanJ9umJuBhS8exquP10TkpmT6WssGwg5chuQaX+8sVV Kc2ccZERs9cfROBtTxGq9o/RTl2J3cZTM5i8C5rDzWfjVfV2aNomzvv6Sk8aN/iijtdq 9pEOQ0x3KaDhdGM3kRoF5rXDU7s28DEspuQ6D9HcpBjwaVzU17xrcRP8JYOFERJst+gO ARTPhdBfHOeRfglWYrDsoRKVml5Eq76hLTx0LKSpOKWoLC9NpYHofaqB3kzzyJTCyDjE rBknfs+5v89fbOh0tS3ZJ/WGmTR5YYCVGuwCSYxWxoFasfJ2z2swB7byKtghVfNxvgAw 9Rqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=zbay43LsIaU+1wuD6fAMv/DZeRmHIGggpcBWscsBKhQ=; b=EB9eO1Jk++VwWeq/AH6m7eICdFBIJRuoe8NYmzAsFZ9NjSg1NpGeRhrLaqT9r92acE VSgemKtJHqAJoZGn8ArPHqAwYaUmV4OFMkj8WbXaJjMavV6d9iSOE8dIf0lpjOY1V5y7 bYPibM5P0cdpOIlddmUDOLJ3kyuOZjIKNAGT/Xasjj30E4dI8tVp5xPFZNASQBTEGr9q k+/9E2IXUIT9IdntBI3rtsDDiA/wQvJjT347cdaGPZVC41/TJ2VirjD6aXVdLOzLR5RH A8c9bywZ7cBTPHAV4XndAHzmndBRH0YWF97ibtn8/vByaE6O17v6g9sEcXJASTbVQric y7DQ== 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 cc2si4412366edb.598.2020.05.22.01.50.38; Fri, 22 May 2020 01:51:02 -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 S1729148AbgEVIsn (ORCPT + 99 others); Fri, 22 May 2020 04:48:43 -0400 Received: from fgw20-4.mail.saunalahti.fi ([62.142.5.107]:24063 "EHLO fgw20-4.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbgEVIsn (ORCPT ); Fri, 22 May 2020 04:48:43 -0400 X-Greylist: delayed 963 seconds by postgrey-1.27 at vger.kernel.org; Fri, 22 May 2020 04:48:41 EDT Received: from imac.makisara.private (85-131-115-176.bb.dnainternet.fi [85.131.115.176]) by fgw20.mail.saunalahti.fi (Halon) with ESMTPSA id ca2c9ed3-9c06-11ea-ba22-005056bd6ce9; Fri, 22 May 2020 11:32:36 +0300 (EEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH] scsi: st: convert convert get_user_pages() --> pin_user_pages() From: =?utf-8?B?IkthaSBNw6RraXNhcmEgKEtvbHVtYnVzKSI=?= In-Reply-To: <494478b6-9a8c-5271-fc9f-fd758af850c0@acm.org> Date: Fri, 22 May 2020 11:32:36 +0300 Cc: John Hubbard , LKML , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <20200519045525.2446851-1-jhubbard@nvidia.com> <494478b6-9a8c-5271-fc9f-fd758af850c0@acm.org> To: Bart Van Assche X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 21. May 2020, at 22.47, Bart Van Assche wrote: > > 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. > The reason is that the blk_ functions were not available when that part of the code was done. Nobody has converted that to use the more modern functions because the old method still works. Thanks, Kai