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 13DC4C43334 for ; Sat, 25 Jun 2022 00:35:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 230F78E0280; Fri, 24 Jun 2022 20:35:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B8C08E027E; Fri, 24 Jun 2022 20:35:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 081D68E0280; Fri, 24 Jun 2022 20:35:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E692B8E027E for ; Fri, 24 Jun 2022 20:35:56 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B41E8602DC for ; Sat, 25 Jun 2022 00:35:56 +0000 (UTC) X-FDA: 79614890712.28.85645EA Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by imf08.hostedemail.com (Postfix) with ESMTP id 3FAEE160026 for ; Sat, 25 Jun 2022 00:35:56 +0000 (UTC) Received: by mail-qv1-f45.google.com with SMTP id u14so4289569qvv.2 for ; Fri, 24 Jun 2022 17:35:56 -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; bh=NM0GgLb9K/faELYgxhv94xXavXWp8l4qd5OqY1giIjw=; b=U69OIV7CgPSGtm8OqOm28OWNbN1YRWzwmy/hcEHCQGaZhd1y9dxB1CdsEQfGzSsAin Orp+V/IpbecyMh2Bzikox1ViXds4pJms6PXjq8af4g5e3WIGmYC/OjyQCM+G61m0cDd+ QmtmnQR+oO2kccH/K0fLbbyptLFGbbubd4rKz0g62V2faqm19zOb9oCiW4pXEr/vjxQv iCU4Lcbrcv/RgW4CFzF5lA2cSnwDrvRYuINo+95BIStrIK6Vjncvibg/svSQwSW4gskf 2jzpzUCrpGkc9CzTQxcBsJDevFN9XC6qciUNraNguv21OfdSduVb8u+bWAuSCWj5/9ob khOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NM0GgLb9K/faELYgxhv94xXavXWp8l4qd5OqY1giIjw=; b=wFtdG17l8+MC8zC2BgIOuIj2w21Vg/InIIqQzcBhNXvzhKvb1SZ4BO+N1rfuPrgRTc bkXwm4g8rTEy5gSQaQFcJfHPjRFUsoRXoA2+ceWHgXgxrf3fJTpIgg1pTpWtIC1o3N+j Q0bnhwwXd0w4x18z9Q5IuHAKWpUKjlB79wL/SmqPj0jsKpQVMmMSw13cLvzQK9WdI/fs wqyGUUcQYiV2n9Ak/njxZiKHfDWTeZWvqKp6YiLK3JH7NQa2lVi2KFcY0qb4zjPqwY8l fIxmeNXesq+oqDUj/GFWgN7IuG7/mz+q15NRxFNNCqPUob8A8XDWdm4cieZ5BnzToKhr 6LoA== X-Gm-Message-State: AJIora/Xpa4vSJ/Yda7vxvSbltZhPHi72kCdKnu6YSTJfjPg+dJIkRck s2y1vQZJuxml+iIfzCl2kvm4kw== X-Google-Smtp-Source: AGRyM1tfYT/2a5qKqWVRQYrtWwn+8o/oCCmUXnhNTKR8+fV1gFV92jB4at1BOe2NSslr9MM375OOIA== X-Received: by 2002:ad4:5c68:0:b0:470:52b5:c85c with SMTP id i8-20020ad45c68000000b0047052b5c85cmr1538212qvh.3.1656117355520; Fri, 24 Jun 2022 17:35:55 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id bq11-20020a05620a468b00b006a700aad48bsm2977173qkb.91.2022.06.24.17.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 17:35:54 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1o4tmE-001Izr-B3; Fri, 24 Jun 2022 21:35:54 -0300 Date: Fri, 24 Jun 2022 21:35:54 -0300 From: Jason Gunthorpe To: Peter Xu Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Andrew Morton , David Hildenbrand , "Dr . David Alan Gilbert" , Andrea Arcangeli , Linux MM Mailing List , Sean Christopherson Subject: Re: [PATCH 1/4] mm/gup: Add FOLL_INTERRUPTIBLE Message-ID: <20220625003554.GJ23621@ziepe.ca> References: <20220622213656.81546-1-peterx@redhat.com> <20220622213656.81546-2-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220622213656.81546-2-peterx@redhat.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656117356; a=rsa-sha256; cv=none; b=rMiYscKa5ZOFZo2i+lNRBe7IkycWC76X6e1nWrz9E7vF91HqOhxygB4yZp2KJ2pUDCuPe1 dAtIbo11XG/SZHzzvndg37ErlzY6McfodPsfTvoH8/UhwphG+v109gYJOCBx1CRyCqmVDW i9ZDFGdo5lLSRfEqXZXxllsHSQjttnI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=U69OIV7C; dmarc=none; spf=pass (imf08.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.45 as permitted sender) smtp.mailfrom=jgg@ziepe.ca ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656117356; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NM0GgLb9K/faELYgxhv94xXavXWp8l4qd5OqY1giIjw=; b=cdaWTi1F3UJPWzcDYVXv7n9GVRm/k4bJss6mOHxsx+KOiZUHTWfG/qS/U58Rwq3JRGymGM gbSulSI1zx10hFfviXfx8Kr+up5adUJcb9adA2hG+NSk/DyipuBZpNynoP0WVtlQuaOAjd qWTfkJX7vdSDamtV02zsiC0A+yRDO18= X-Stat-Signature: u6wadqdz9me94qgueujcpfcmobpamxym X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3FAEE160026 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=U69OIV7C; dmarc=none; spf=pass (imf08.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.45 as permitted sender) smtp.mailfrom=jgg@ziepe.ca X-HE-Tag: 1656117356-444329 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 Wed, Jun 22, 2022 at 05:36:53PM -0400, 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. Can you talk abit about what is required to use this new interface correctly? Lots of GUP callers are in simple system call contexts (like ioctl), can/should they set this flag and if so what else do they need to do? Thanks, Jason