Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7457986ybi; Thu, 1 Aug 2019 08:28:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvqRwh27wfiUAgkpEMVRrsaks9y2HW20DI8wL/mDXYB0P+skI8Xbk7MjEIMZPTCEHmmFuS X-Received: by 2002:a62:7994:: with SMTP id u142mr54921386pfc.39.1564673303260; Thu, 01 Aug 2019 08:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564673303; cv=none; d=google.com; s=arc-20160816; b=Jq3IDXqP0Gryid07gqw2RjPUNcwEJLEZyzBcPMW+slaGwDsNIntVQosqTcbO5SI94b GdArNs56bIZE+03qCmPQVXfY5tYp93NvIihQjW5AgiXawMqd6n6htELq1F7XchPQb44y 02bU0lR04SHUz5arcJs9aozlTm0epK7cgNEG/9H0lOCZb98igOYDspRUxKF5mCV4RTKJ BWcc0t8UZsaTaOGgn6/N1J6l88jTKu6NKLrAvpWigpq1DG2EZ6wW3+9NtmuubenYvUQV 2h5oT935zxHiWBFBd5VFsqyitpl5zGQbNUdMCcVcexaMgvYnDAH8kbsCDfK1w8fSCKre G3HQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hMA7vlwUroWdb0REjDf2neAobLqIjEsoQepgHkXMGQc=; b=EJ8ZaYzWLY2cFIQiDLPVsPo3SRiSnqGpoGyVGiLjo3PDFiHzTSYke4WoRPl4J/6yIr ymOYDChuXMMWhVnOd7d2+npGPywLUnYCREfJFari1l986Bl2OEh2SlRNw2J3GkCf610o TXPHrQ7xvGvEBc3QS64XITSlxv8wk9yxglMlmDJiLhFBtO9aFceXl5gYo3oHtF4iPn/7 ZcLMULrXh3LVKA05hvY5d6xfC46OwMP0YAh8A5u2EXSohupMrSy8vYK4bpFkMBGovnYp hhAchXxkVS95Rvq0YU+AErGpg5d5J/6Dk7n/2pm4Y+ZclW5v0ZzBsSJwOLs8nDJDEKAt dJ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=M+yZ5LoJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k23si36683680pgb.228.2019.08.01.08.28.07; Thu, 01 Aug 2019 08:28:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=M+yZ5LoJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731923AbfHAOTJ (ORCPT + 99 others); Thu, 1 Aug 2019 10:19:09 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:45069 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731868AbfHAOTI (ORCPT ); Thu, 1 Aug 2019 10:19:08 -0400 Received: by mail-qt1-f194.google.com with SMTP id x22so65434852qtp.12 for ; Thu, 01 Aug 2019 07:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hMA7vlwUroWdb0REjDf2neAobLqIjEsoQepgHkXMGQc=; b=M+yZ5LoJGbhm7g0i1sIHAJmyeoJlxlLUxNMBipkE5Gk2KmuVJyj40RCbT2OMJyeUYM zJHmHpLP79mwX+1GU1gaWmI+ZgMsrzh906sNv8d/eg/a5Xw25HKRKuFNgKcyKLM02Ww0 rufqIlPpawx9cNcQ6Ahy2tSEtMjGQsDi0/1f8f63o7vcW+ionqvcAAZen0904J/Ypmil ZGhx4rO03KDS05ILM46VGBWJuCbsSKMR9WjJEMoOyUFc9cwx/Lc3OXwHZWF/4cg/Lo1f MMC8Huc/zfOSWQ3eMe0y7mSe9oVAGDhdbvvwgs3CG/GKyE01CIy0PPbv9CbdNkVNHI2q Ytxw== 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=hMA7vlwUroWdb0REjDf2neAobLqIjEsoQepgHkXMGQc=; b=aD7pC5meZwfcGTkt3FqUaF0dWVCpey0W8uhs+16uYqUN2XG3Ze1fhCSu/lk2Q8jbT9 EyIRo7bmpl68vfIQ+mGCLVQbvRlgBK4kYa2KkYZsYGNqQuOdxkN8jaIO4IVr7XhYYEcu BZ3ZtJf1yeg2JxkGQ0o3CsLoGeeBgcSfBq3ubVUBr7Jae1iplbQSx/tdsN5AOkn53A45 rQdcmB4/LJyihav5m208KmI1gziIOBuvajyO3t+Ka/pR8X6iU5Z9riohW8ezWNQrJJmh 22DZYvpk/ZViVxMbl0l1NawnqdSjI7Dbd33/wSXA6Ahkq1RntSUpvWq6eeKtUsGvTWVy NdUw== X-Gm-Message-State: APjAAAXbGZBT2J+9fBTbzIwWpUaPVHda/FKRCUvvfsywCm4hz9UgszMs 26ncJc/Zi/89PNk7olZsAMHHCg== X-Received: by 2002:a0c:aed0:: with SMTP id n16mr93783119qvd.101.1564669147681; Thu, 01 Aug 2019 07:19:07 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id s127sm30805414qkd.107.2019.08.01.07.19.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Aug 2019 07:19:07 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1htBv8-00084t-Lf; Thu, 01 Aug 2019 11:19:06 -0300 Date: Thu, 1 Aug 2019 11:19:06 -0300 From: Jason Gunthorpe To: Christoph Hellwig Cc: john.hubbard@gmail.com, Andrew Morton , Al Viro , Christian Benvenuti , Christoph Hellwig , Dan Williams , "Darrick J . Wong" , Dave Chinner , Ira Weiny , Jan Kara , Jens Axboe , Jerome Glisse , "Kirill A . Shutemov" , Matthew Wilcox , Michal Hocko , Mike Marciniszyn , Mike Rapoport , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, LKML , John Hubbard Subject: Re: [PATCH v4 1/3] mm/gup: add make_dirty arg to put_user_pages_dirty_lock() Message-ID: <20190801141906.GC23899@ziepe.ca> References: <20190730205705.9018-1-jhubbard@nvidia.com> <20190730205705.9018-2-jhubbard@nvidia.com> <20190801060755.GA14893@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190801060755.GA14893@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 01, 2019 at 08:07:55AM +0200, Christoph Hellwig wrote: > On Tue, Jul 30, 2019 at 01:57:03PM -0700, john.hubbard@gmail.com wrote: > > @@ -40,10 +40,7 @@ > > static void __qib_release_user_pages(struct page **p, size_t num_pages, > > int dirty) > > { > > - if (dirty) > > - put_user_pages_dirty_lock(p, num_pages); > > - else > > - put_user_pages(p, num_pages); > > + put_user_pages_dirty_lock(p, num_pages, dirty); > > } > > __qib_release_user_pages should be removed now as a direct call to > put_user_pages_dirty_lock is a lot more clear. > > > index 0b0237d41613..62e6ffa9ad78 100644 > > +++ b/drivers/infiniband/hw/usnic/usnic_uiom.c > > @@ -75,10 +75,7 @@ static void usnic_uiom_put_pages(struct list_head *chunk_list, int dirty) > > for_each_sg(chunk->page_list, sg, chunk->nents, i) { > > page = sg_page(sg); > > pa = sg_phys(sg); > > - if (dirty) > > - put_user_pages_dirty_lock(&page, 1); > > - else > > - put_user_page(page); > > + put_user_pages_dirty_lock(&page, 1, dirty); > > usnic_dbg("pa: %pa\n", &pa); > > There is a pre-existing bug here, as this needs to use the sg_page > iterator. Probably worth throwing in a fix into your series while you > are at it. Sadly usnic does not use the core rdma umem abstraction but open codes an old version of it. In this version each sge in the sgl is exactly one page. See usnic_uiom_get_pages - so I think this loop is not a bug? Jason