Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4155590rwb; Tue, 16 Aug 2022 15:56:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR46k9yhbs6qfo/Nxmsd2oVc9mXgzVwok0JxXzfO1aH9ohnTgb18g9o6x1IQ7+g3tXJOHyy2 X-Received: by 2002:a17:90b:3144:b0:1f5:2c6d:7dea with SMTP id ip4-20020a17090b314400b001f52c6d7deamr804060pjb.220.1660690598329; Tue, 16 Aug 2022 15:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660690598; cv=none; d=google.com; s=arc-20160816; b=1Aschza9Y9Zq08unfTVoNAu8OUxoWsPNp3Qq496T26giWYSzlbmoiQvM37AYSrPcO4 ghocRnXPLFEAkAqTEJbi9XkHG89dIFNlQg5/nAJPOjR9TDeF7+hasRWUWCM5rC+AtxaX f3yQzk5NxeTy4gS3boYVxhETeHjGDvL2Mtr6XZ/bsB3yOg6RfP96LntjZkR9k926leUZ TY5t6mIqSf1w3iXm5by+7uPCBamxPonpZimCO2FBQVVMIxO8+AsL+d9flFrlA+RN10A5 G8nQINSwFMF6g26RdyKVDze5+3ie/AmKGQkkjRUlOs5nGh0b6PurnxPFXjRkcFCCrG1r hHQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=C5zMKo6O1AIsX4SXPjK2YwIObu5P/amVe0VlPQFbfBE=; b=UAS3wkTW94dlLuPUuoW+VJZKwyhcj8dHZrhDcAOzMbgtVH77l0h0ateKL41oYm8U0k 0l9nb/OTM3RJR4wssduerkcqnR48CTv1f2rHSy5iR/VIMhFakh9cuyQixT/X+5mlBiGU j1a1BLpfrl5sVeWfln9iOpJYsBpXoz7t/74ZqN30JrOS6EMYc8FRs8w8mt6O1TrCrJSa u0O5MKtUbP06XzOqSxK6Gswxbo3BbL0yPNbHLTC62HrKqk2IdZ8Vac2k1UkkOYaAHkA+ pshgIKwtvLTb9pX3L89S6a5/NWhhBZS0JfJWLIv8rTbki74celqrWhVwiDKTkdY+WgMy BBeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=CynbWLTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m12-20020a170902db0c00b0017283063df2si3531266plx.334.2022.08.16.15.56.27; Tue, 16 Aug 2022 15:56:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=CynbWLTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237673AbiHPWvr (ORCPT + 99 others); Tue, 16 Aug 2022 18:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbiHPWvp (ORCPT ); Tue, 16 Aug 2022 18:51:45 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 556FF8B996 for ; Tue, 16 Aug 2022 15:51:44 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id f20so16830423lfc.10 for ; Tue, 16 Aug 2022 15:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=C5zMKo6O1AIsX4SXPjK2YwIObu5P/amVe0VlPQFbfBE=; b=CynbWLTVxPjEZ04QKDb+B7lkPK95HwhJrWBYD8Umnd5gBFVozIexI7kjFjy3r2cWVI AjjfGL1VpcpVr98f4taYq7I1iOqUTbGo5lm3Uu0yYTtIWdoxrVDfFpaxLElZdOXyT7m0 aiMCjqJR2PMhUoVBKSMXCkMRK0Gx/yTeDnl7YMF191o3c6f0x1FAGOO7BERvsL3xVN+o A0qAUwsA9Qh+wxb5jnD70v5Yk/rGYofQ6zvLyXvEmmuJUSIWlkv1o5Z6pX0szb6421++ wzWKMKZwo7Z+rNfo7KdzPUhkatfHdfEkIyzcv8dBV59sTvKQb3kxa3BdKq1JlJa+Y4j3 znJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=C5zMKo6O1AIsX4SXPjK2YwIObu5P/amVe0VlPQFbfBE=; b=0gNrjAGP5Yz1u7c7VX1TN7tFd5j7L49nelG0dAHsdU7us0icW4XCtIo/MkZSVI/yWL 6hZo79gmd4of00B+uAnF2DK+ujEcz3ZB3jRxLvvyndCrkgKgi6knKO2WMofBPlhdcTJ+ /VSl6F4ozMsePl8OG+ndvkqgo4F6z3uvsnCec/PbvFsIIulsAj1JLFj5XKSszy52mli2 3xm/RtdElZqHdFzz7O57gWo2Be/YOBF0xq5Oymz8TX/mFDKrJPRoreSz2h0LqdQuVeDI kDhidUi1R6vx/17yuncGrAzW9LktXAlbF1EIc0iwcNIVg0QJKt3/tIuQeI3narAbIuqd nTJg== X-Gm-Message-State: ACgBeo3vc8OYdKRHh/YPzucKioyX45sMTakh8M2JctB6HbE/y0rddEhq FlghAdmry2rlNPAy6vMtPa6M8TonlgWvHFmbloOt77Kcc/ODUw== X-Received: by 2002:ac2:4c4f:0:b0:48b:1358:67e3 with SMTP id o15-20020ac24c4f000000b0048b135867e3mr7555661lfk.441.1660690302541; Tue, 16 Aug 2022 15:51:42 -0700 (PDT) MIME-Version: 1.0 References: <20220721000318.93522-1-peterx@redhat.com> <20220721000318.93522-4-peterx@redhat.com> In-Reply-To: From: David Matlack Date: Tue, 16 Aug 2022 15:51:16 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] kvm/x86: Allow to respond to generic signals during slow page faults To: Peter Xu Cc: Sean Christopherson , LKML , kvm list , David Hildenbrand , "Dr . David Alan Gilbert" , John Hubbard , Linux MM Mailing List , Andrew Morton , Paolo Bonzini , Andrea Arcangeli Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, > > -- > Peter Xu >