Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp217775rwi; Wed, 2 Nov 2022 11:06:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6aceGz7JFZJzt3l+MCvRcWDWkTYPvgjkYU7Gd6cbGXPWFGUa529M3BtBqL+y93iR3wYOlW X-Received: by 2002:a17:907:3f26:b0:78d:9c30:4529 with SMTP id hq38-20020a1709073f2600b0078d9c304529mr24757775ejc.195.1667412391122; Wed, 02 Nov 2022 11:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667412391; cv=none; d=google.com; s=arc-20160816; b=YdUEqOa2BSRqd6udfZ6DQJTX8sB6ZKr9ynQ4pOUpPP0iePHxwxCRnewo64efSukV11 k3aJBKHKi3RSKpGHGowtyOGZPg6Y2H3Z0K2hkRxUPYBX57utLKbRlkpgNH7vBqiuUL8k rC38gWJQIOtv/57k3hg6VA3JoAd6oSZT8mUHnk50nixYTb61DcDUlgp2gjBiws+vUMlg E6UhjJSLxeRNK5gRYJxhg5lwTW//FZPTtt68xn+BVYWIPhazh0A0o9aUPGSVF2rPn5Ja uUxYRqip30YuwHgTcklTSAZlEzI4iWcB6NNH9ePsaUm4HylQdBIl3r9KbTMOc5TfsJrh /42g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6bHZ6RhzwZqcFqy+ASS3SxP9gnDv328z5/6b9PXyycI=; b=kzumcBeAHNE6n6iVhSHhB4Z7/IG1S5iruHeebundvCVwGrgQcV1Pc9+WIKNmh81nCV 1fUJ4pgDvaBFBEOH8jE6O+9AiaPIsyUrEoUH1WIAoye8UWIbp42xDtNdgbM1gtmy63r1 kM+Zd+mEcbhKFsNvNTEC1IT+JLCCoA0ZQNQPTiOOrowMdP+lPYP8JATUVRTL78Wka2if 2uX1io1LisR64hksh+88cLDxLg/JJMPODU8T3YIUfp7ta/smud30uEz6JAjd2oTu0do6 9HgjYkxEopeyeOHR8D/ek5jSYFfdXHFHr6nwJE+/NKBkYSk+F2e0pAn+0tVNPeg8mH8L Oaag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y7aAyWVO; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i42-20020a0564020f2a00b004610f91a242si15307956eda.300.2022.11.02.11.06.00; Wed, 02 Nov 2022 11:06:31 -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=@redhat.com header.s=mimecast20190719 header.b=Y7aAyWVO; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbiKBRTn (ORCPT + 98 others); Wed, 2 Nov 2022 13:19:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbiKBRTj (ORCPT ); Wed, 2 Nov 2022 13:19:39 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 390912316F for ; Wed, 2 Nov 2022 10:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667409522; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6bHZ6RhzwZqcFqy+ASS3SxP9gnDv328z5/6b9PXyycI=; b=Y7aAyWVOOrYvBbCk4BjCxTMfFOPgtXsIoIYezsW4ctl6CpFpvv00ED6HNRZ1vSc1ElUODh OHpPIj5F6Pevq1pZySZPVQkA6pu3/nAuWstUYGqg4UV3qnBIY5JV8wwXsYszWh00WGNpzz nFFfDcafV2NcoEa4e52psJ6EJgxTPl8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-348-9yGJfBLhPT6v_ZzSz7lDYw-1; Wed, 02 Nov 2022 13:18:41 -0400 X-MC-Unique: 9yGJfBLhPT6v_ZzSz7lDYw-1 Received: by mail-ed1-f69.google.com with SMTP id z15-20020a05640240cf00b00461b253c220so12525251edb.3 for ; Wed, 02 Nov 2022 10:18:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6bHZ6RhzwZqcFqy+ASS3SxP9gnDv328z5/6b9PXyycI=; b=tAG0NVya+7yhmoE+3ZVC133/8XziR2gC4tbPErT19QSwz8j3/bTq6r74IIM/3mTDcA DpPHa7gf5WozdeWj72LdlI0VnFZbF6Mq2PUNwqJZn9FlEbtKFMRaWNy7Ektzrg4isUkA Tcqo3uN02N2P16LVyJ/oN+gyB+ZvCYbZ3uYVjEhHWCCy0GJ3Z1LFEnZTFFwGxhByWfGV FZsBIQdzJG9tXziQ18+QrZRmiOBpiMn60wrXLOyNXbwtPmOC0SXNf4ik8UnVF3D6g4Zk QN6kKN9eMsrWVhGiaZxYuCuYUiqZSkBbgjvI60pej+GXsytF4qtsTEyjh6bxuG/E3+HX NQPw== X-Gm-Message-State: ACrzQf078Q8QZK6Hw/Jv3nFfJ6BKJ5qeHtEy7BuXXM/R4A3OH1QGylI6 Wo5F2sBED7SHOyzYqJvwrmXmJxvAPgwPwQNdUdw8YIuELvKUgxcAQIYul+dTxroDG/lwyYOFQv8 HvU6qUuz4tEF/DUQuYLxI859t X-Received: by 2002:aa7:ce8d:0:b0:461:50fd:e358 with SMTP id y13-20020aa7ce8d000000b0046150fde358mr25568800edv.194.1667409518908; Wed, 02 Nov 2022 10:18:38 -0700 (PDT) X-Received: by 2002:aa7:ce8d:0:b0:461:50fd:e358 with SMTP id y13-20020aa7ce8d000000b0046150fde358mr25568766edv.194.1667409518634; Wed, 02 Nov 2022 10:18:38 -0700 (PDT) Received: from ?IPV6:2001:b07:add:ec09:c399:bc87:7b6c:fb2a? ([2001:b07:add:ec09:c399:bc87:7b6c:fb2a]) by smtp.googlemail.com with ESMTPSA id d7-20020aa7ce07000000b004589da5e5cesm6056704edv.41.2022.11.02.10.18.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Nov 2022 10:18:37 -0700 (PDT) Message-ID: Date: Wed, 2 Nov 2022 18:18:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v5 0/8] KVM: x86: Intel LBR related perf cleanups Content-Language: en-US To: Sean Christopherson , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Like Xu References: <20221006000314.73240-1-seanjc@google.com> From: Paolo Bonzini In-Reply-To: <20221006000314.73240-1-seanjc@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 10/6/22 02:03, Sean Christopherson wrote: > PeterZ, I dropped your ACK from v4 because the perf patches were completely > broken. > > Fix a bug where KVM incorrectly advertises PMU_CAP_LBR_FMT to userspace if > perf has disabled LBRs, e.g. because probing one or more LBR MSRs during > setup hit a #GP. > > The non-KVM patch cleans up a KVM-specific perf API to fix a benign bug > where KVM ignores the error return from the API. > > The remaining patches clean up KVM's PERF_CAPABILITIES mess, which makes > everything far more complex than it needs to be by > > v5: > - Drop perf patches that removed stubs. The stubs are sadly necessary > when CPU_SUP_INTEL=n && KVM_INTEL={m,y}, which is possible due to > KVM_INTEL effectively depending on INTEL || CENTAUR || ZHAOXIN. > [hint provided by kernel test robot]. > - Add a patch to ignore guest CPUID on host userspace MSR writes. > - Add supported PERF_CAPABILITIES to kvm_caps to simplify code for all > parties. > > v4 > - https://lore.kernel.org/all/20220901173258.925729-1-seanjc@google.com: > - Make vmx_get_perf_capabilities() non-inline to avoid references to > x86_perf_get_lbr() when CPU_SUP_INTEL=n. [kernel test robot] > > v3: > - https://lore.kernel.org/all/20220831000051.4015031-1-seanjc@google.com > - Drop patches for bug #1 (already merged). > - Drop misguided "clean up the capability check" patch. [Like] > > v2: > - https://lore.kernel.org/all/20220803192658.860033-1-seanjc@google.com > - Add patches to fix bug #2. [Like] > - Add a patch to clean up the capability check. > - Tweak the changelog for the PMU refresh bug fix to call out that > KVM should disallow changing feature MSRs after KVM_RUN. [Like] > > v1: https://lore.kernel.org/all/20220727233424.2968356-1-seanjc@google.com > > Sean Christopherson (8): > perf/x86/core: Zero @lbr instead of returning -1 in x86_perf_get_lbr() > stub > KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs > KVM: VMX: Fold vmx_supported_debugctl() into vcpu_supported_debugctl() > KVM: VMX: Ignore guest CPUID for host userspace writes to DEBUGCTL > KVM: x86: Track supported PERF_CAPABILITIES in kvm_caps > KVM: x86: Init vcpu->arch.perf_capabilities in common x86 code > KVM: x86: Handle PERF_CAPABILITIES in common x86's > kvm_get_msr_feature() > KVM: x86: Directly query supported PERF_CAPABILITIES for WRMSR checks > > arch/x86/events/intel/lbr.c | 6 +--- > arch/x86/include/asm/perf_event.h | 6 ++-- > arch/x86/kvm/svm/svm.c | 3 +- > arch/x86/kvm/vmx/capabilities.h | 37 ---------------------- > arch/x86/kvm/vmx/pmu_intel.c | 1 - > arch/x86/kvm/vmx/vmx.c | 51 +++++++++++++++++++++++-------- > arch/x86/kvm/x86.c | 14 ++++----- > arch/x86/kvm/x86.h | 1 + > 8 files changed, 52 insertions(+), 67 deletions(-) > > > base-commit: e18d6152ff0f41b7f01f9817372022df04e0d354 Queued, with patches 2-4 destined to kvm/master. Paolo