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 DD6C1C25B0E for ; Wed, 17 Aug 2022 00:31:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D94C48D0002; Tue, 16 Aug 2022 20:31:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D503E8D0001; Tue, 16 Aug 2022 20:31:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE46F8D0002; Tue, 16 Aug 2022 20:31:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AEDA98D0001 for ; Tue, 16 Aug 2022 20:31:23 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 84BAD1A064B for ; Wed, 17 Aug 2022 00:31:23 +0000 (UTC) X-FDA: 79807205646.16.5EAB24F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id D88BB401A3 for ; Wed, 17 Aug 2022 00:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660696282; 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=EuI50tpNraRR40jMmrfH90NbS+qrzYBwLBwfeWEmRwI=; b=dSNeIng6SYb5KN5ZTwoorvJVOvRCaFff0x2pg4jvlz94jYu9xXl/DQHH9fPbiCrAsryQ40 4T7AKs9Xi4K50vAdDWefB8Pveg2jbylaSHLbsCKQBofRXo/brEnygs80ve50f5J3YBf2Bp /JVwjJ5oQYRoPcBOeqovjwZ/j3MphEY= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-373-OqE-UJI7MLyqqEOaSmj0qg-1; Tue, 16 Aug 2022 20:31:21 -0400 X-MC-Unique: OqE-UJI7MLyqqEOaSmj0qg-1 Received: by mail-qk1-f200.google.com with SMTP id u15-20020a05620a0c4f00b006b8b3f41303so10411355qki.8 for ; Tue, 16 Aug 2022 17:31:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=EuI50tpNraRR40jMmrfH90NbS+qrzYBwLBwfeWEmRwI=; b=vdZM3DjnohrskLmu787rOVx6Nh+Z5qFnM2fenbiN8zgoGBTagCVmsUycFiXbxMO+06 c7fuUhLHuqHGbEOI5W7F1sUzEXGJ1RxJBnY+zE7tU/3YQekEpSO91wXSFog8qncYDpe/ SARochJ+NZBrmmWCVxsGmH59nJtqf4tQIrPQdJvgLxwqmDa3SESzjycfkYnL1BoWqg8m nbQxaPgcdfJRDmz+Pghzdq9bnyzqkznJdm7xH8g2M/TQtIlP/AOb6IQ2eGKCYl0xIIcp isXxOSyTJB8KoZ0aawEM4tGpHCftXcDTBqs57jW2mCiKywVVRceUtQozwkAqm734LOz2 1UoQ== X-Gm-Message-State: ACgBeo01IQ86gwI4fCKkSjlrDA2Bt+SJY0fLwwJAL32ZUyf61oSqft0d J1tgDGanZw1LlyQWJNayQ334Uwu/1j3TKRRy7OQrIT9MuEWN5yaya1vGoNUkq1dbx6DBE8o8s2H X0GnwTKtBQq8= X-Received: by 2002:a05:622a:178c:b0:31e:f628:f4ab with SMTP id s12-20020a05622a178c00b0031ef628f4abmr21278838qtk.82.1660696280719; Tue, 16 Aug 2022 17:31:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ovI7vWCAOjaXmB/+1IJM/6+VevOElHyLda9cMiC8rUUPGz1pprMfvMwqBOuvxuKgPgQtH6w== X-Received: by 2002:a05:622a:178c:b0:31e:f628:f4ab with SMTP id s12-20020a05622a178c00b0031ef628f4abmr21278810qtk.82.1660696280478; Tue, 16 Aug 2022 17:31:20 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id bs19-20020a05620a471300b006bb9381aee4sm19425qkb.30.2022.08.16.17.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 17:31:19 -0700 (PDT) Date: Tue, 16 Aug 2022 20:31:18 -0400 From: Peter Xu To: David Matlack Cc: Sean Christopherson , LKML , kvm list , David Hildenbrand , "Dr . David Alan Gilbert" , John Hubbard , Linux MM Mailing List , Andrew Morton , Paolo Bonzini , Andrea Arcangeli Subject: Re: [PATCH v2 3/3] kvm/x86: Allow to respond to generic signals during slow page faults Message-ID: References: <20220721000318.93522-1-peterx@redhat.com> <20220721000318.93522-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-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dSNeIng6; spf=pass (imf04.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660696283; a=rsa-sha256; cv=none; b=cOVVMqXOtIS6dK1NaxYgpQoFsS15BjTdYmVFdUnWqdkDsJybcL7N4AR99lAEBVNnjP3TGA YDia/PZnVvS9H/DNz8VM2wc51Y8zEnXcWizMrGZjkIWstk3IZElJad335WoBFhXntesjeC KCfxaH+HYjd5fTMZlNajOVDe9gaPxOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660696283; 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=EuI50tpNraRR40jMmrfH90NbS+qrzYBwLBwfeWEmRwI=; b=8fo8MYz9lo3uWOT3eZrxQiviqE0wSYG5vUYzP5bgqxSrlHWq3iA36+ondEqpKD//nhBwd2 vbgYnGI4X/ixs9Oo4tEi9eIv+fJGHxAXuZmaskXNS9aV1imGNSf0BVtOUNqoHj6u1iDHLe ICXVBTaJhBRub1v1Yf7Fvts8ZvR1z7Y= Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dSNeIng6; spf=pass (imf04.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: f3rsoxikrh744fisd13hw8qopens87ee X-Rspamd-Queue-Id: D88BB401A3 X-HE-Tag: 1660696282-251371 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 Tue, Aug 16, 2022 at 03:51:16PM -0700, David Matlack wrote: > On Tue, Aug 16, 2022 at 1:48 PM Peter Xu wrote: > > > > On Mon, Aug 15, 2022 at 09:26:37PM +0000, Sean Christopherson wrote: > > > On Thu, Aug 11, 2022, Peter Xu wrote: > > > > On Thu, Aug 11, 2022 at 08:12:38PM +0000, Sean Christopherson wrote: > > > > > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > > > > > index 17252f39bd7c..aeafe0e9cfbf 100644 > > > > > > --- a/arch/x86/kvm/mmu/mmu.c > > > > > > +++ b/arch/x86/kvm/mmu/mmu.c > > > > > > @@ -3012,6 +3012,13 @@ static int kvm_handle_bad_page(struct kvm_vcpu *vcpu, gfn_t gfn, kvm_pfn_t pfn) > > > > > > static int handle_abnormal_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault, > > > > > > unsigned int access) > > > > > > { > > > > > > + /* NOTE: not all error pfn is fatal; handle sigpending pfn first */ > > > > > > + if (unlikely(is_sigpending_pfn(fault->pfn))) { > > > > > > > > > > Move this into kvm_handle_bad_page(), then there's no need for a comment to call > > > > > out that this needs to come before the is_error_pfn() check. This _is_ a "bad" > > > > > PFN, it just so happens that userspace might be able to resolve the "bad" PFN. > > > > > > > > It's a pity it needs to be in "bad pfn" category since that's the only > > > > thing we can easily use, but true it is now. > > > > > > Would renaming that to kvm_handle_error_pfn() help? I agree that "bad" is poor > > > terminology now that it handles a variety of errors, hence the quotes. > > > > It could be slightly helpful I think, at least it starts to match with how > > we name KVM_PFN_ERR_*. Will squash the renaming into the same patch. > > +1 to kvm_handle_error_pfn(). Weirdly I proposed the same as part of > another series yesterday [1]. That being said I'm probably going to > drop my cleanup patch (specifically patches 7-9) since it conflicts > with your changes and there is a bug in the last patch. > > [1] https://lore.kernel.org/kvm/20220815230110.2266741-8-dmatlack@google.com/ Thanks for the heads-up. Please still feel free to keep working on new versions since I'm still not sure which one will land earlier. I'll repost very soon on this one (I just added hugetlb support which I overlooked; it's a touch up in patch 1 only though). I can always rebase on top too. -- Peter Xu