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 0D21EC43334 for ; Thu, 23 Jun 2022 14:32:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 375548E0154; Thu, 23 Jun 2022 10:32:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 324DB8E0144; Thu, 23 Jun 2022 10:32:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2144B8E0154; Thu, 23 Jun 2022 10:32:03 -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 136B48E0144 for ; Thu, 23 Jun 2022 10:32:03 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id DF57F3457A for ; Thu, 23 Jun 2022 14:32:02 +0000 (UTC) X-FDA: 79609740084.29.6835587 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf28.hostedemail.com (Postfix) with ESMTP id 13C08C00D1 for ; Thu, 23 Jun 2022 14:31:52 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id e63so17826679pgc.5 for ; Thu, 23 Jun 2022 07:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SdE1Q+FcIHNdzvHylki5AIGEmd7N5R8sBfbJlSX0V5M=; b=O3yF4t8UGVG0qmedo7bFOSVoLfU69kgt3uZgtLN+p298+LsaWx3piWWHvwrtOCrSmf MhNhoPdfi3sHp15DQhMbwRJVDE/Hi3TJt6RR5uuEn/372PZKCymelEOT3q1YqTDdiojO 3XCTJVYeKKeHpP5aMnagBgY7dMncCsNflyUdpXwqeEUIciwk5egWd+UyvhD3sL5LqALT RMTU8uzvchBw07rkiaruQbdcZcqEz3phXzVIDCzbhZPm+nTlWYqlFJmXGflDHO5VNMuB 9AhukAv5fUOamgiBwpRxFlVPKy1JeKxs26HMdTB3r6NqybVxC+gl4sbwuFKvWvTt1c+V t4VQ== 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=SdE1Q+FcIHNdzvHylki5AIGEmd7N5R8sBfbJlSX0V5M=; b=r6Vi912k5d2B9FoIQqvUTB3/wBz+C3bMlHTGQzrYCFkwOK235xigC0WJldlhjXrR/p 79XaCJhQaean97s/9E8JvuGi2xZHdo3yCujRunCzKr9trNRgbPEnfcGAAXA9FJNU4NbN hCG5jWuezrz48Hfl2/uB7nEJSi+h7Mop+6p5Il+E68LzQF7KWIod6C+kPoE4CL4PsN0W IElfbOH18sP0hi1nT9f94Su/CJQDcpjkAF5730xRdeXoRgJI5LFj+Q1ioaPBEuAkrVH/ HzK7DCPVL+DS+wNAiNiwxL7Z+3SGTei1ydSDaqFd0G58twq6BsulJKSkOpLMMboW/MZm ZhEQ== X-Gm-Message-State: AJIora9XRDGkufeCr28KBWhPerdC8BwM5UbpehzU7/0SyxuN7KDu0GHr LRfC5H5xRv+GeiFx3/WcKGsRQg== X-Google-Smtp-Source: AGRyM1s+/p15SaFZzmeOpC2GidYUhYH38ADbe6rtkG2Iae5V1dUrzuMDysKbpQPsePjwMEHt62hJRQ== X-Received: by 2002:a63:7946:0:b0:408:c6ac:939b with SMTP id u67-20020a637946000000b00408c6ac939bmr7834470pgc.349.1655994711761; Thu, 23 Jun 2022 07:31:51 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id jj9-20020a170903048900b0016a100c9a2esm11019125plb.112.2022.06.23.07.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 07:31:51 -0700 (PDT) Date: Thu, 23 Jun 2022 14:31:47 +0000 From: Sean Christopherson 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 Subject: Re: [PATCH 3/4] kvm: Add new pfn error KVM_PFN_ERR_INTR Message-ID: References: <20220622213656.81546-1-peterx@redhat.com> <20220622213656.81546-4-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220622213656.81546-4-peterx@redhat.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655994715; a=rsa-sha256; cv=none; b=B8f0UlRHDtGf33NEOuBY9/bez4NLp0D5ILSH+OgQoUQQbDF0oz8GuDl2ByYszt63OqCzIh wGenOpmBPGy3zgWIXv/rfPkrdmcQXbY/tBMTZgpgzcL6SzWtV+l72UU/hMb04R4UyWFLhh WYb8jxZZZtBj/IEejxH+0diubJR7KW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655994715; 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=SdE1Q+FcIHNdzvHylki5AIGEmd7N5R8sBfbJlSX0V5M=; b=ZBz8ugkizFCbMAo68xfO/EEMkRtns1t9rs18gY/WAVxg8hwesquHWVI4neRGqBy0XYESsa tO4sarnBysJcHHsIgBQ2ylRLaar934W64WWAXoBR24K6oHDnc+SBSo1WhQCWyF7g9zOpnn fGO+kapGBCuCVdvcil0gXMy/ZRfEFRY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=O3yF4t8U; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of seanjc@google.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=seanjc@google.com X-Rspam-User: X-Rspamd-Queue-Id: 13C08C00D1 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=O3yF4t8U; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of seanjc@google.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=seanjc@google.com X-Stat-Signature: f9b3mwgo65qjh8tfjsdfnunh3tg1j61w X-Rspamd-Server: rspam09 X-HE-Tag: 1655994712-394687 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, Peter Xu wrote: > Add one new PFN error type to show when we cannot finish fetching the PFN > due to interruptions. For example, by receiving a generic signal. > > This prepares KVM to be able to respond to SIGUSR1 (for QEMU that's the > SIGIPI) even during e.g. handling an userfaultfd page fault. > > Signed-off-by: Peter Xu > --- > include/linux/kvm_host.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index b646b6fcaec6..4f84a442f67f 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -96,6 +96,7 @@ > #define KVM_PFN_ERR_FAULT (KVM_PFN_ERR_MASK) > #define KVM_PFN_ERR_HWPOISON (KVM_PFN_ERR_MASK + 1) > #define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 2) > +#define KVM_PFN_ERR_INTR (KVM_PFN_ERR_MASK + 3) > > /* > * error pfns indicate that the gfn is in slot but faild to > @@ -106,6 +107,16 @@ static inline bool is_error_pfn(kvm_pfn_t pfn) > return !!(pfn & KVM_PFN_ERR_MASK); > } > > +/* > + * When KVM_PFN_ERR_INTR is returned, it means we're interrupted during > + * fetching the PFN (e.g. a signal might have arrived), so we may want to > + * retry at some later point and kick the userspace to handle the signal. > + */ > +static inline bool is_intr_pfn(kvm_pfn_t pfn) > +{ > + return pfn == KVM_PFN_ERR_INTR; What about is_sigpending_pfn() and KVM_PFN_ERR_SIGPENDING? "intr" is too close to a real thing KVM will encounter, and I think knowing that KVM is effectively responding to a pending signal is the most important detail for KVM developers encountering this code for this first time. E.g. from KVM_PFN_ERR_INTR alone, one might think that any interrupt during GUP will trigger this. > +} > + > /* > * error_noslot pfns indicate that the gfn can not be > * translated to pfn - it is not in slot or failed to > -- > 2.32.0 >