From: Peter Xu <peterx@redhat.com>
To: Hillf Danton <hdanton@sina.com>
Cc: Dimitris Siakavaras <jimsiak@cslab.ece.ntua.gr>,
Axel Rasmussen <axelrasmussen@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: Using userfaultfd with KVM's async page fault handling causes processes to hung waiting for mmap_lock to be released
Date: Thu, 20 Jul 2023 16:07:56 -0400 [thread overview]
Message-ID: <ZLmUHI+iyhj6QcYL@x1n> (raw)
In-Reply-To: <20230720103534.312-1-hdanton@sina.com>
On Thu, Jul 20, 2023 at 06:35:34PM +0800, Hillf Danton wrote:
> On Wed, Jul 19, 2023 at 2:16 PM Axel Rasmussen <axelrasmussen@google.com> wrote:
> >
> > I think perhaps the right thing to do is to have handle_userfault() release
> > mmap_lock when it returns VM_FAULT_NOPAGE, and to have GUP deal with that
> > appropriately? But, some investigation is required to be sure that's okay to do
> > in the other non-GUP ways we can end up in handle_userfault().
>
> See if making kworker special works.
>
> --- x/fs/userfaultfd.c
> +++ y/fs/userfaultfd.c
> @@ -457,6 +457,8 @@ vm_fault_t handle_userfault(struct vm_fa
> * close the uffd.
> */
> ret = VM_FAULT_NOPAGE;
> + if (current->flags & PF_WQ_WORKER)
> + ret = VM_FAULT_OOM;
> goto out;
> }
Sorry this won't work - we need userfault to work with all forms of
kworkers, especially including kvm async pf. Thanks.
--
Peter Xu
prev parent reply other threads:[~2023-07-20 20:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 14:33 Using userfaultfd with KVM's async page fault handling causes processes to hung waiting for mmap_lock to be released Dimitris Siakavaras
2023-07-19 21:16 ` Axel Rasmussen
2023-07-19 21:54 ` Axel Rasmussen
2023-07-20 20:06 ` Peter Xu
[not found] ` <20230720103534.312-1-hdanton@sina.com>
2023-07-20 20:07 ` Peter Xu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZLmUHI+iyhj6QcYL@x1n \
--to=peterx@redhat.com \
--cc=axelrasmussen@google.com \
--cc=hdanton@sina.com \
--cc=jimsiak@cslab.ece.ntua.gr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).