Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8949647ybi; Tue, 23 Jul 2019 18:43:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKAPUv8QIXv0lE8kbVTjbmAbD4Yjcfd5JV+qByGzcgSUulhjFPsiqAAP7Who97QgZpALyo X-Received: by 2002:a63:e54f:: with SMTP id z15mr78852930pgj.4.1563932603151; Tue, 23 Jul 2019 18:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563932603; cv=none; d=google.com; s=arc-20160816; b=IuLpbR2AmdLwKV4ztUOQ6a1Xin+B5wJiOX49IlnWIUnLlU6RWqGx6eUFVW+ols1Ozb +MkvLPdEuLdMc6/r4qcDcOYSfz7iaySKaYWqvRFBsb8bVb3Xqgzel2zcPD/hh7TJgBD9 dYmwnRERjO2+7r61wCE/vtIFiZChc+hvRdtB4A9ACMVh8G65bsiES6G5xT9fxKFtOwjG ve0bg5+54NIttGcpWRVfuym5gK7lJu3kW736bzk8Jc2NURQWCAS7ZN8OHeh1UkiT1fEt Q8NAceFf6OubQ9wZVMdC0Yz50IZ9FWjtodYAMyWGd+jo+w8BDuhO9SuDKT1FJzYuTrF4 Ymlw== 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; bh=Zs8bXuZfeKkQ3YIUIjU1SAG8QG0cqI/PLt5qxITP56w=; b=vsv8uUvJBMYIkIptk/tIbfTMVbg6kJxjo4aVtCXau+omYr+sRr7zT5Y22+FK6vQ0F1 zEGeQI9XwOrZAJLUzHwqs5H4eu5ReC9cytho5u9GR78UBxqpLQgqaqq3koir3Gr7DUKG pMrwQYboGGGzoTOm3zG2xjYRBpqyEyfyAKuQpp3srTq90nrDctwXnFu+R3lH862LUTYQ zQvojyzWqrmNK8JbJ1vjGrEyjYq5QujgEZZ9DcB6QQFHKwInuZs2aAkGwwUM0EqY+3GI rzu/VvoMrroDIbK8jHdlAogo/x8IqqMO36YVAdgwuP9HJaP34Zj+h6wPeX5BivkMc9+U 9xLw== ARC-Authentication-Results: i=1; mx.google.com; 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 59si13233653plc.425.2019.07.23.18.43.07; Tue, 23 Jul 2019 18:43: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; 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 S2391000AbfGWRXi (ORCPT + 99 others); Tue, 23 Jul 2019 13:23:38 -0400 Received: from verein.lst.de ([213.95.11.211]:43461 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732675AbfGWRXh (ORCPT ); Tue, 23 Jul 2019 13:23:37 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 4F84E68B02; Tue, 23 Jul 2019 19:23:35 +0200 (CEST) Date: Tue, 23 Jul 2019 19:23:35 +0200 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , =?iso-8859-1?B?Suly9G1l?= 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: <20190723172335.GA2846@lst.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190723171731.GD15357@ziepe.ca> User-Agent: Mutt/1.5.17 (2007-11-01) 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 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. > > 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.