From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07307C43334 for ; Tue, 21 Jun 2022 08:23:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 801F36B0072; Tue, 21 Jun 2022 04:23:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78AA16B0073; Tue, 21 Jun 2022 04:23:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 604608E0001; Tue, 21 Jun 2022 04:23:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4D1D16B0072 for ; Tue, 21 Jun 2022 04:23:38 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 25AFF60413 for ; Tue, 21 Jun 2022 08:23:38 +0000 (UTC) X-FDA: 79601554116.24.281BD39 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 91FEDA009F for ; Tue, 21 Jun 2022 08:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655799817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XGU7mDtKklVPCqn8Uk3bMEFXs2W9T3w03LpqwdG17/Y=; b=gGO1aDgYqdOwsKkrCMRJ5ZG5N9Br+8SqnRw8z+OrIPfX1XA8cUsrvwWnfgaOCsC7VMxX6D rVnpCcBA73U9bhNRDGnfXD1WN8/Rw5JrqRr0ZNUrNFjRnK+LI9SpXVDCay3ZG4AkDKXRSt k1EaOGUBuaeUCLLBKYlETSuk21+GLEE= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-596-SSfG9ie0Or6B3NbbVM21Yw-1; Tue, 21 Jun 2022 04:23:35 -0400 X-MC-Unique: SSfG9ie0Or6B3NbbVM21Yw-1 Received: by mail-wm1-f69.google.com with SMTP id l3-20020a05600c1d0300b0039c7efa2526so6065952wms.3 for ; Tue, 21 Jun 2022 01:23:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=XGU7mDtKklVPCqn8Uk3bMEFXs2W9T3w03LpqwdG17/Y=; b=lGtFkffecIr4rCs5GaTKP1GnvK9q3vy0iYsZ46FZHmWTNXX6tD4vWXmO7WEO/6jjqW mV+WN3WsE7u29uCXHVyY2Wa0KmAylAg3Dum6Gv3YMeodCKYKl7x8P6e8jrNCCa7X5myL QnrgDbZY4SG9gPxqnYmQQJWpKpqxJVeqk9QVyyUjQkQsl6ESi1XfGCxvJFpMbCpKlfND 6JPy3UdC5rXTOot7kEmqvv/mZCpLDGa+v9Eol6ziRP2kZ0ysex/0M0qZOo1uwneOY0Nq Tz1zZilY4B91gIq5WwFTuqO0B9m/64NikGXdxK3tDo2iLqJ6mDRTvzRMtNSkqfR7ZuWq CcyA== X-Gm-Message-State: AJIora+nToRr+eBYUbc5xjRM5Lr5Rz5Uig3tpOlaIbFSYNa1hiUa1yFV hSlEm1+hm4yikjue+SWuHH2L3NsqHR5OxPs7sWR0VFlKF+85MtKsCr79cY4VtnhFTBzUjnbbJC6 GJEq3ymaVSjk= X-Received: by 2002:a7b:c758:0:b0:39c:44ce:f00f with SMTP id w24-20020a7bc758000000b0039c44cef00fmr28512310wmk.167.1655799814490; Tue, 21 Jun 2022 01:23:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sUotCk+6rcFy05ZeXu+qAjpL3NaHybbZ2BoBeUtiL7/zNAYd2GvpjFdw35xlTwbym9LSrXXg== X-Received: by 2002:a7b:c758:0:b0:39c:44ce:f00f with SMTP id w24-20020a7bc758000000b0039c44cef00fmr28512300wmk.167.1655799814242; Tue, 21 Jun 2022 01:23:34 -0700 (PDT) Received: from ?IPV6:2003:d8:2f04:2500:cdb0:9b78:d423:43f? (p200300d82f042500cdb09b78d423043f.dip0.t-ipconnect.de. [2003:d8:2f04:2500:cdb0:9b78:d423:43f]) by smtp.gmail.com with ESMTPSA id j11-20020a05600c190b00b0039c5328ad92sm24367503wmq.41.2022.06.21.01.23.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jun 2022 01:23:33 -0700 (PDT) Message-ID: <212f8b31-e470-d62c-0090-537d0d60add9@redhat.com> Date: Tue, 21 Jun 2022 10:23:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH RFC 1/4] mm/gup: Add FOLL_INTERRUPTIBLE To: Peter Xu , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Dr . David Alan Gilbert" , Linux MM Mailing List , Sean Christopherson , Paolo Bonzini , Andrea Arcangeli , Andrew Morton References: <20220617014147.7299-1-peterx@redhat.com> <20220617014147.7299-2-peterx@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220617014147.7299-2-peterx@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655799817; a=rsa-sha256; cv=none; b=qz8PjZJxfpV9Qe8iF99WXURoDjLAI0z0O91JaMIgBCLeDhe4RcEZdcKXjsP/Mt029kQmVz sOjPH2Rl6/eXm6kfymFGuV6mAxcLs7AiT+IcnTounnPxyPNFHxmunHyxLhBb5gZJPOP65I fSl4soc1wJ49Z/9lO3/iZ0LXvjNI/vU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gGO1aDgY; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf15.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655799817; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XGU7mDtKklVPCqn8Uk3bMEFXs2W9T3w03LpqwdG17/Y=; b=UIl2JvYkAMK/f5CRjpwyxAl8o6Ez136A7ExfcJk9SMIz5r3JzIOLU9fHbO3SPkT8dzVF4C 4WyUtwS2InF41E95hXUuZD/a1t19f9nsAxIdmTBvcxy2FmsxsuUIkfFy4V5ly/M2iblCmo R8laOil/lWE1EGjgAlgtuPRlJW4t3zA= X-Rspamd-Queue-Id: 91FEDA009F X-Rspam-User: Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gGO1aDgY; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf15.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam06 X-Stat-Signature: 3ewj4g3qm51qb1x4fhk8wz1zby3ni8gs X-HE-Tag: 1655799817-936084 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 17.06.22 03:41, Peter Xu wrote: > We have had FAULT_FLAG_INTERRUPTIBLE but it was never applied to GUPs. One > issue with it is that not all GUP paths are able to handle signal delivers > besides SIGKILL. > > That's not ideal for the GUP users who are actually able to handle these > cases, like KVM. > > KVM uses GUP extensively on faulting guest pages, during which we've got > existing infrastructures to retry a page fault at a later time. Allowing > the GUP to be interrupted by generic signals can make KVM related threads > to be more responsive. For examples: > > (1) SIGUSR1: which QEMU/KVM uses to deliver an inter-process IPI, > e.g. when the admin issues a vm_stop QMP command, SIGUSR1 can be > generated to kick the vcpus out of kernel context immediately, > > (2) SIGINT: which can be used with interactive hypervisor users to stop a > virtual machine with Ctrl-C without any delays/hangs, > > (3) SIGTRAP: which grants GDB capability even during page faults that are > stuck for a long time. > > Normally hypervisor will be able to receive these signals properly, but not > if we're stuck in a GUP for a long time for whatever reason. It happens > easily with a stucked postcopy migration when e.g. a network temp failure > happens, then some vcpu threads can hang death waiting for the pages. With > the new FOLL_INTERRUPTIBLE, we can allow GUP users like KVM to selectively > enable the ability to trap these signals. This makes sense to me. I assume relevant callers will detect "GUP failed" but also "well, there is a signal to handle" and cleanly back off, correct? -- Thanks, David / dhildenb