Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5693115imw; Wed, 20 Jul 2022 10:29:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v93KBzoBPkGH14QJ/XR5NmyrKqYpjR1KKrVkh8znNYr+bcH2R5kjk6nuLgnIU70zPQ1EDo X-Received: by 2002:a17:907:2c6b:b0:72b:2eb9:6673 with SMTP id ib11-20020a1709072c6b00b0072b2eb96673mr37075973ejc.71.1658338195096; Wed, 20 Jul 2022 10:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658338195; cv=none; d=google.com; s=arc-20160816; b=MEpkA+N3DBKRQ1KrBgR+UGQ0WfiTTfVJajrBFOFmNjmd8awD8dWOVlUJ+YwGm66B4o 26PpwMtOZozFkbBmcTo0oiDX1qxnpUEUiGYW4F98CO4G466yVi0yebnYc+4pvvyQcGeD ItwCVMIVb4ngt2Gwu44d2lPbXyqu4pBYCsofOxpNd1pN1gL1+b5IneI4NGgeV98jXXUe TVGemevBhUEWkO1qWJLBMlkt4D3ZryXf/eCoO3Yh+m+jsyJ6+p5Lt8EUH3Gn4I+UF8W+ gZ7ibuRPCS12gT4Onhn4ti9pilIaN9P0VolM8u0tpzfZkgZPfOb5H+/XEzJVJzYzhsZm UYMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0A7Vop3JLb1LjbZM57vszyAHhwMfMivUkOyzRnB3v4k=; b=P0AGvSB8Spjq3HcL8PUMCNLCLEMiY/630snODYREXLHdLvr7JY4w7uKv1b4e+K+9sm a0Sn9qo+oCrwLhHPHvp1Jllu6yME/EhQ9VTgtjkaUZhRMXPy3BAupvRKV73ERF0NMZCf uzH8vfzYeDlitdMFUIDE3ZZ+kEj/YZjr8ANhPBNFj5BRosw1zrCf62k9T5X9nZ6n+egx iRwNc0MjTuFtubWALA7hFLXq0TkiUcoR6lfeYe2q2+BfKQHNsnlZR3Z2WszuyOtX26C1 Fp1Og9PcUY8LZ7Q3zDAs6/DUxDqJx9wzW5JC3VyURCNFo8TyG0kD32E1KLho8q9V500+ whnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=OMPem98G; 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 ji18-20020a170907981200b0072f267eeba3si13832582ejc.677.2022.07.20.10.29.29; Wed, 20 Jul 2022 10:29:55 -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=OMPem98G; 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 S232220AbiGTRS0 (ORCPT + 99 others); Wed, 20 Jul 2022 13:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235324AbiGTRSZ (ORCPT ); Wed, 20 Jul 2022 13:18:25 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58F483AB3B for ; Wed, 20 Jul 2022 10:18:24 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id p6-20020a17090a680600b001f2267a1c84so1014033pjj.5 for ; Wed, 20 Jul 2022 10:18:24 -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=0A7Vop3JLb1LjbZM57vszyAHhwMfMivUkOyzRnB3v4k=; b=OMPem98GHTwpACFqIppAYiEcB9A98T6HaqNgfFg6loCE9C2If5iTTOylYF/LdCO3j7 wWRWVsrG1G9zL67r49dHTzEKiDpOBggC4Vq8U6GsaMa3hTOMEhXKfPUWNt9lDzmzq3dX se2X1rKBZXrPcAaIRqNAdVGJS/1HEeYwDpKF0DVY7JfZHQSbNoTBy8oKCNXslNZjfFaQ r7fsrHGZWmkTKOzZh1i6CSgPkrRfd1uGss9EYUoGOwndxI3YdGWbHocM3ZUNgPrraVCK hT2hHCcpX7iD91UczKNWjeIirCaWA8nw0HPpkuy2fm0xJ4K00zGe/VnRSgoWzaRJDYa3 eKpg== 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=0A7Vop3JLb1LjbZM57vszyAHhwMfMivUkOyzRnB3v4k=; b=nLBw5ABUsAQddJcRnsZD98NelK6AORyQaL4rsR5pUJl4H1SIYPbEFOafauunfpCCBA x1r3q1s9sL5WyqqilH9ctrwRiJTl+bZuyVhIxs3WT3E5LqY+bdcdbhvxwBY0zbGPupB4 rA74BjpoeMF9USV/qBNuGBUcoFzQjcD30+zDZk5Jm6LaGh+wClVGMSGOjqVbw0BVklNn jbPjSHJqOoYH4LOwwgO7caqjGUAS0AZmgGUCHnBLeoLdQbBiZQxvo1Vm4UBRDeE5naCk ZUjjTPF+k/MNZn8h0DXIB7e61WsPULkngX7gNHr6LPaqq5OcQxommOCQGQd3Zit2qDPP dH+Q== X-Gm-Message-State: AJIora8aGHA9cm53+whJaqIxstt/1/f0jMBwYN8IzwNtlpaQNU8a2nm1 uNnfP9B4akqSTc4EjHDe+fNC3Q== X-Received: by 2002:a17:902:e945:b0:16a:1c41:f66 with SMTP id b5-20020a170902e94500b0016a1c410f66mr39507484pll.129.1658337503742; Wed, 20 Jul 2022 10:18:23 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id f15-20020aa7968f000000b00528c22fbb45sm14095091pfk.141.2022.07.20.10.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 10:18:23 -0700 (PDT) Date: Wed, 20 Jul 2022 17:18:19 +0000 From: Sean Christopherson To: Chao Gao Cc: Kechen Lu , kvm@vger.kernel.org, pbonzini@redhat.com, vkuznets@redhat.com, somduttar@nvidia.com, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v3 4/7] KVM: x86: Let userspace re-enable previously disabled exits Message-ID: References: <20220615011622.136646-1-kechenl@nvidia.com> <20220615011622.136646-5-kechenl@nvidia.com> <20220615025114.GB7808@gao-cwp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220615025114.GB7808@gao-cwp> 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, 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 Wed, Jun 15, 2022, Chao Gao wrote: > On Tue, Jun 14, 2022 at 06:16:19PM -0700, Kechen Lu wrote: > > 7.14 KVM_CAP_S390_HPAGE_1M > >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > >index f31ebbb1b94f..7cc8ac550bc7 100644 > >--- a/arch/x86/kvm/x86.c > >+++ b/arch/x86/kvm/x86.c > >@@ -4201,11 +4201,10 @@ static inline bool kvm_can_mwait_in_guest(void) > > > > static u64 kvm_get_allowed_disable_exits(void) > > { > >- u64 r = KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE | > >- KVM_X86_DISABLE_EXITS_CSTATE; > >+ u64 r = KVM_X86_DISABLE_VALID_EXITS; > > > >- if(kvm_can_mwait_in_guest()) > >- r |= KVM_X86_DISABLE_EXITS_MWAIT; > >+ if (!kvm_can_mwait_in_guest()) > >+ r &= ~KVM_X86_DISABLE_EXITS_MWAIT; > > This hunk looks like a fix to patch 3; it can be squashed into that patch. It's not a fix, just an inversion of the logic to make it easier to maintain going forward. I intentionally made the change in patch 4 so that adding the kvm_get_allowed_disable_exits() is a more "pure" movement of code from the "check" path to a common helper. I agree it's kinda odd, but I still think splitting the changes is desirable.