Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8981917ybi; Tue, 23 Jul 2019 19:25:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxbbjj7ioRgo1jyl1kIZiSnp0nvukbZRYJjS2uKaj5/Wk07Z/afC840dcf05P3fGv6pV9Z X-Received: by 2002:a17:90a:3463:: with SMTP id o90mr87103683pjb.15.1563935109434; Tue, 23 Jul 2019 19:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563935109; cv=none; d=google.com; s=arc-20160816; b=FsrAz3+uFqLVuRash+C2ixIHNebgdnHaAXTiuk5bFsOXtn+XYJIo+qmfVHmL1OSUgp v1WbS2c98srDd2LPSk77JfSYaVFRDE7dmTNyOet2dLe5LnY1yemiI3ZyPhlY2+87tqtm 5Tu2WrKNp/I7HzdA2C1r30lp0G78LFlDA7rOEueal527X1evLalSevyEKpCqxUjy4GLT 5D2LwXOO9hFHbI15HFgHMp0abgOAsp8HsZGYWsBIzia5fhSJFmFz/YRbfyM4YkwYOWQG 5oNYfqbBK1IutL19batsvaOgR+9L1EBXk8xv2hS3V2MRl07g9xJAG/Zp4JNWC1EN6VSS 9n/Q== 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=RbhpiDasw1Ewe5g+7weE9TXbMjL8KAWk+B3qwXxWc/M=; b=g9O3zmt2nScWjw2a94LbALuQvV1FUd9pw7YO/mPqv5y5ItNJ1uu2HJN1zI70J9+1pR HeOXX6G3RugLq2pllnU8/1x6CDbAsJiHF7ClfHWq/hAqx9Aqj6SpzDu8lR36NThd2A4W /w/SIpYZLcH6hAI0NJ5KpfPy9HRMFs62Kd4Oeicpthfhrf7ax+gDyDiaQfgp+96dcnUj z5PNmgXVSx/70DV5vm3vYSFuhi/ETDETf1yUd56QRddxUsWZxV3H/wfbk7QT1l51EoG6 JnMiEynA1CbhwoEzIsdLneNaAGyii4HdvBQ10cqUleT5Qm9YVU5Q+gjYKL9BzvP3eYlb nHXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=O9hWpCDR; 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 h25si14472600pfn.56.2019.07.23.19.24.53; Tue, 23 Jul 2019 19:25:09 -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=O9hWpCDR; 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 S2391093AbfGWRae (ORCPT + 99 others); Tue, 23 Jul 2019 13:30:34 -0400 Received: from mail-ua1-f66.google.com ([209.85.222.66]:36118 "EHLO mail-ua1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732740AbfGWRae (ORCPT ); Tue, 23 Jul 2019 13:30:34 -0400 Received: by mail-ua1-f66.google.com with SMTP id v20so17272261uao.3 for ; Tue, 23 Jul 2019 10:30:33 -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=RbhpiDasw1Ewe5g+7weE9TXbMjL8KAWk+B3qwXxWc/M=; b=O9hWpCDR380rbhw90TNwrzp28pNffEoS4Us5UckcJaWEOyzBJaUbrQSE98N+ymjxQW oiBk973xZ6ORiEBiV9Zx6YM5f6Q32IYj0/SyGtmDoGFY8uMFYwt3mdlZ97s5C49fnMui 2OTpVNIjIGGJAlPoeE+X847UupJo0ZA8rnMsUoH0URd6UnZ19b2YDamDSx3OJSe3EMOb Kt2uJ7zSPkpnVExd29sGDon2CJhSCEdXgWKiUUomK2L0M/1EIgZbY6L4agXTd7JVcj3V AkElcQgYYmWIkQrV6d6fmuAyO9EgG8sewHhTtRGw4oqVCiwsjjyyZ/Ue6PsPkX8h/K78 iXYw== 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=RbhpiDasw1Ewe5g+7weE9TXbMjL8KAWk+B3qwXxWc/M=; b=DYKN9QROEG0B1KBftWvnbY6MkRdcKt3APQKs8rlFzJBldn+Gwy8aam0YD3ivKoVfQr 0UokkQJVX1RWnOh3W7bYt6MvvAh+BmH8ttHJlB53x3VINowILY7yndn/3MZcGC8wLPbq 9CsiKTycAyNFzcuylDLFTQQZDNt2f1h7WXejgHKrtJyqdJRHhHJAs4We+tD477KDtxiM KlZdIBfQ6HqQUjHDsilKwA2PXgonPuDN+hCfDcWLo65BtRwJhqCl6Da9tA8fSxnkJRv3 EGBATxBULEhFp7Z3MuX/JVSQ8Jsl34GEjaydOR+wKeUxYSfpPMDM2n++Tj0grAeChQwK bKmQ== X-Gm-Message-State: APjAAAV3jKBUgWFVQoNgi+hmtHT/ZYAeKqfWu+4SH+rF9CK20nwZe3yA nPzIkH/EptETqnJrZbuvsqgGzg== X-Received: by 2002:ab0:60ad:: with SMTP id f13mr37669182uam.129.1563903033250; Tue, 23 Jul 2019 10:30:33 -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 d3sm4771548uaq.20.2019.07.23.10.30.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2019 10:30:32 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hpycS-0002gy-4J; Tue, 23 Jul 2019 14:30:32 -0300 Date: Tue, 23 Jul 2019 14:30:32 -0300 From: Jason Gunthorpe To: Christoph Hellwig Cc: =?utf-8?B?SsOpcsO0bWU=?= Glisse , Ben Skeggs , Ralph Campbell , "linux-mm@kvack.org" , "nouveau@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 4/6] nouveau: unlock mmap_sem on all errors from nouveau_range_fault Message-ID: <20190723173032.GF15357@ziepe.ca> References: <20190722094426.18563-1-hch@lst.de> <20190722094426.18563-5-hch@lst.de> <20190723151824.GL15331@mellanox.com> <20190723163048.GD1655@lst.de> <20190723171731.GD15357@ziepe.ca> <20190723172335.GA2846@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190723172335.GA2846@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 Tue, Jul 23, 2019 at 07:23:35PM +0200, Christoph Hellwig wrote: > On Tue, Jul 23, 2019 at 02:17:31PM -0300, Jason Gunthorpe wrote: > > That reminds me, this code is also leaking hmm_range_unregister() in > > the success path, right? > > No, that is done by hmm_vma_range_done / nouveau_range_done for the > success path. .. which is done with the mmap_sem held :( > > I think the right way to structure this is to move the goto again and > > related into the nouveau_range_fault() so the whole retry algorithm is > > sensibly self contained. > > Then we'd take svmm->mutex inside the helper and let the caller > unlock that. Either way it is a bit of a mess, and I'd rather prefer > if someone has the hardware would do a grand rewrite of this path > eventually. Alternatively if no one signs up to mainain this code > we should eventually drop it given the staging status. I tend to agree with the sentiment, it just makes me sad that all the examples we have of these APIs are so troubled. Jason