Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1129933ybs; Mon, 25 May 2020 07:50:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwklZ1zM2VfdlWDs3izMN+ZZ8x1PrnXnRzNZU+4R6ig+RD2UuiBMrCuU+w7336sylGiUBji X-Received: by 2002:a05:6402:14d5:: with SMTP id f21mr15788739edx.327.1590418224440; Mon, 25 May 2020 07:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590418224; cv=none; d=google.com; s=arc-20160816; b=Zxio+Ps9b/6kgln7bciuWXwnEL70FbLRx9zsJhKcrvhBHXilfZXaI6CRXwKupWfATa TOs6nDqc9SHrvYR3o0M96oQ3bQGaOp9TtIzQnMtp01N6Z0wRzUSfCJkwr1dDtl6rp6Ad PWHsQGDbML6l0Kg3LnN6jE4ukZmmvot5Bcr68XhMibYYmS1BHQTZrQnE5URwty0aEAGs 4GlQ/LclQQ0b8np8Lr2DHUTXvVXOiElA5zkaNT//ONx/BYShbOG5LHvruQPoFuEmLucg DKmyaYMvqmOOofMWGv9zonrsSgebld7X6/6NenCw5J0tyxib43bAOFdaOm8+jyA+grMm 3bRw== 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=wNdLBHvbkTrwN+yv/sWMGmtXLBwALXBbwKYXu5aEHds=; b=tC8MZuzz5PKo6CgNKBb1MBRtYbfLVYZzAokQfepHU60KLiDOd45OngY2E3Ww+nwM3g clqdn6vwfGx8FGu7OVSqpYQUskomJoBNYX2UiXLX9Rn2zZVODY8V6T81Uyv9eECmo4Pp nJCo/MY8LmS9eGXjGekMNk1UxzUnBVNDl7V6YrzihmH0tqZHTJ7Jaq3LJHIxArNKms89 TiaDOEAsyI+0h9uOnmtH4GomCdk010StrD0/q8iDuIAEOIu5G16tT/SzNKUtmudoNsxm kpQhVZU8ZnyWRfhlSuQ9jA6K9s+BUER1XAPHPyZnW99ndeM4WUVx2+e+qcEP1rJDJLOX 9BmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=jUsF++no; 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 o25si11018785edz.324.2020.05.25.07.50.01; Mon, 25 May 2020 07:50:24 -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; dkim=pass header.i=@ziepe.ca header.s=google header.b=jUsF++no; 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 S2391023AbgEYOqy (ORCPT + 99 others); Mon, 25 May 2020 10:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403961AbgEYOqx (ORCPT ); Mon, 25 May 2020 10:46:53 -0400 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A947BC061A0E for ; Mon, 25 May 2020 07:46:53 -0700 (PDT) Received: by mail-qv1-xf44.google.com with SMTP id z9so8082472qvi.12 for ; Mon, 25 May 2020 07:46:53 -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=wNdLBHvbkTrwN+yv/sWMGmtXLBwALXBbwKYXu5aEHds=; b=jUsF++no9yX2fF8uzTtI9oj/C9thJExJqPCGhhaD4fJTlBwO/ZBSx4onZJ/fZfzXWj 80T4kbcru+tTX41qGg3Pe6vW/3QOf01HzpY+r0+WYykWJt3Z2YFJhT9v0sAFpXepyWM9 BW+gnEBpBtxROJG9e5ZQysyeI4Y9AIe/VJ5AAAB5MCyt5l+0XZn00gLNei0pcHcvqhsu pzHq6j6UGldrXe0kGezNIprVuagZjfuaS7Sct0nu8IFtPsunWaFDNMmbl76it5XvBLjn Q5SwCGijPD6wU+5MSunv9HIjZLzdHDF0Z5+hEGDMH5Fto54g+NmbmDBtkkgfrK7FFQm3 LmgQ== 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=wNdLBHvbkTrwN+yv/sWMGmtXLBwALXBbwKYXu5aEHds=; b=YgmlNMeY2SdoFrbimi+uW3M+wx5tF2kflHz0NJ+lOQuQtfFkDScbnTeqbmP7SdW6iv fSE5wwMye079ftS6332vAY6Dl5htu4GinZRtvz/QACrlDFG9GxbxYl4XzAJzZOaR3JZ2 dxb7I+4iMNd7pyCwpsX9r9BrjbYCxm6iTCgn3a21H4IgMBiDk55bQGwEtgap4dNBKdYb +l8zpHvb3zhQphC6AAUmmglV3vYLMFLHiRLfC4F4oVfDcJ8sXjshUXeqgb5eauZ92rnK zXOMQqonx2KIdLzIK2w73RWmn2sIVX4NazwJJWgySU2sGI2Dtz+h4AA7A9yY1KLmUlru je7A== X-Gm-Message-State: AOAM532GlSkFv8fzxluTuz9UzkXTxFTvHUT+iIp+s3Jo5g36Cwsl9wPl kHySudz2nsq5rd90yNaWcJSNdw== X-Received: by 2002:ad4:57a1:: with SMTP id g1mr15119941qvx.27.1590418012932; Mon, 25 May 2020 07:46:52 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id z3sm1070743qkl.111.2020.05.25.07.46.51 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 May 2020 07:46:52 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jdENP-0005qy-HO; Mon, 25 May 2020 11:46:51 -0300 Date: Mon, 25 May 2020 11:46:51 -0300 From: Jason Gunthorpe To: Peter Xu Cc: Alex Williamson , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, cohuck@redhat.com, cai@lca.pw Subject: Re: [PATCH v3 3/3] vfio-pci: Invalidate mmaps and block MMIO access on disabled memory Message-ID: <20200525144651.GE744@ziepe.ca> References: <159017449210.18853.15037950701494323009.stgit@gimli.home> <159017506369.18853.17306023099999811263.stgit@gimli.home> <20200523193417.GI766834@xz-x1> <20200523170602.5eb09a66@x1.home> <20200523235257.GC939059@xz-x1> <20200525122607.GC744@ziepe.ca> <20200525142806.GC1058657@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200525142806.GC1058657@xz-x1> 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 Mon, May 25, 2020 at 10:28:06AM -0400, Peter Xu wrote: > On Mon, May 25, 2020 at 09:26:07AM -0300, Jason Gunthorpe wrote: > > On Sat, May 23, 2020 at 07:52:57PM -0400, Peter Xu wrote: > > > > > For what I understand now, IMHO we should still need all those handlings of > > > FAULT_FLAG_RETRY_NOWAIT like in the initial version. E.g., IIUC KVM gup will > > > try with FOLL_NOWAIT when async is allowed, before the complete slow path. I'm > > > not sure what would be the side effect of that if fault() blocked it. E.g., > > > the caller could be in an atomic context. > > > > AFAICT FAULT_FLAG_RETRY_NOWAIT only impacts what happens when > > VM_FAULT_RETRY is returned, which this doesn't do? > > Yes, that's why I think we should still properly return VM_FAULT_RETRY if > needed.. because IMHO it is still possible that the caller calls with > FAULT_FLAG_RETRY_NOWAIT. > > My understanding is that FAULT_FLAG_RETRY_NOWAIT majorly means: > > - We cannot release the mmap_sem, and, > - We cannot sleep Sleeping looks fine, look at any FS implementation of fault, say, xfs. The first thing it does is xfs_ilock() which does down_write(). I can't say when VM_FAULT_RETRY comes into play, but it is not so simple as just sleeping.. Jason