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 DF4BFC433EF for ; Thu, 23 Jun 2022 19:32:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45CFA8E0186; Thu, 23 Jun 2022 15:32:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 40ABE8E0144; Thu, 23 Jun 2022 15:32:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2AC058E0186; Thu, 23 Jun 2022 15:32:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1BD1D8E0144 for ; Thu, 23 Jun 2022 15:32:46 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EADD734BF4 for ; Thu, 23 Jun 2022 19:32:45 +0000 (UTC) X-FDA: 79610497890.03.FF22BE3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 4F1F040037 for ; Thu, 23 Jun 2022 19:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656012764; 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: in-reply-to:in-reply-to:references:references; bh=cEzj9L77P8v8qoCIIdtw9E/V13id72lLb1/JCaB9X5o=; b=T8PD7VS4Mt14OLNaPx1i7aE5/aYwqgT/zKTly9N4D2xlC4dBzT3MpjH96yuljide0upx9E /bXagSDS66f4219AQeDaZH+uEHSL9Vfk2pANrFqOJQQbiU3O4jHAfXVQZBM7w2XTGqPT+k ivqR42bT27+AtYKM1aefLqae51hLzQQ= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-vn09gdtXPUCD72B2DrVvew-1; Thu, 23 Jun 2022 15:32:43 -0400 X-MC-Unique: vn09gdtXPUCD72B2DrVvew-1 Received: by mail-io1-f71.google.com with SMTP id i16-20020a6b3b10000000b00674d8768dc7so214515ioa.6 for ; Thu, 23 Jun 2022 12:32:43 -0700 (PDT) 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=cEzj9L77P8v8qoCIIdtw9E/V13id72lLb1/JCaB9X5o=; b=j9OWWj+yya3f58Q8E/lEd6wB20w41ZqP87gWB7x6jO5royrLRY2NrO4PTi0CbKwOWF lgFZCS2UcEFlkgT7Jv77uCX72cIDin6qrqfM5AGb2Namn4tWCbfhBCCLdraZAW2c0yBp sGqlVbpD6gf0ynAltqZPlrn9/JQG9rC5UxRGUHH0zjVVZdm06388xYOJ2PSnk6wCmh1Q 6UOiMlqTqg51aOR2zIA9dDp/LT/U9YoYXiG+32r4Jss91lgBvHri/raFaGo97f/0lcCY aU+4HuwVpDeWUzslcf6Y8xSEWbeEZv2Kf06p3C4qNzkQwc1A0hOP7ZHlyopgCCVvZIyW gTzw== X-Gm-Message-State: AJIora9R7syT/1w/xvAHo7Yy1+y8vO0z6uMJZd5Kx/iZwT1TH9+U+Uqm Kf/LW3TJ47l97IxY0NsZLXnQyqETi/XD/UzzBQWb3dK8NNoVw9gZM9kRMROdnlRE5BFelAvZzUT hCasxtstOkCo= X-Received: by 2002:a05:6638:1301:b0:331:f2f0:a17e with SMTP id r1-20020a056638130100b00331f2f0a17emr6002361jad.141.1656012762856; Thu, 23 Jun 2022 12:32:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s65EoE7PAH6kAoTAtGR4qw5bac4MpVebXW5cXpFV1QXeylyQ+L/Y/fNAavK3gdSfdi9iPExw== X-Received: by 2002:a05:6638:1301:b0:331:f2f0:a17e with SMTP id r1-20020a056638130100b00331f2f0a17emr6002319jad.141.1656012761972; Thu, 23 Jun 2022 12:32:41 -0700 (PDT) Received: from xz-m1.local (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id z7-20020a923207000000b002d1d3b1abbesm173633ile.80.2022.06.23.12.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 12:32:41 -0700 (PDT) Date: Thu, 23 Jun 2022 15:32:39 -0400 From: Peter Xu To: Sean Christopherson 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 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656012765; a=rsa-sha256; cv=none; b=g5Il87GrC3i/noxdOXO9DW1+7jeOLpwmz2Es0SBjDK/sy1P15aLWrknHwsCKyRgu0GF6UZ WdtmiHPnPHAM2OmgIw7vs+v6nVzhMtomL2+ny+vUgPhouGDRk3aIIzceZXouAW8x/iSuce CW5r0PR3QhDwPLDsXKkLpJUa4JXxPMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656012765; 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=cEzj9L77P8v8qoCIIdtw9E/V13id72lLb1/JCaB9X5o=; b=2q2QoK0/eqIhUlpl3vWYqvno5SqK27rimSGOPrunY0RE28YuhDNy96g7PFUJzdhA3vlkwh Cv0ec5NjZ0lmgV4rY7bYa65e5rMtYGJWTmGxHJDokrWd7KX9fVZnx9IzJAMOib/teoiGzP AQTF+PDNOWAtU/yhqts2EkpKqRHT6os= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T8PD7VS4; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf27.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Stat-Signature: 4zoewtmmjr5fgi7ghr5xq517i9dy4ka1 X-Rspamd-Queue-Id: 4F1F040037 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T8PD7VS4; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf27.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1656012765-168411 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 Thu, Jun 23, 2022 at 02:31:47PM +0000, Sean Christopherson wrote: > 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. Sounds good; INTR could be too general for KVM indeed. Thanks, -- Peter Xu