Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2276116pxm; Fri, 4 Mar 2022 12:55:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwT7ER41SAklrE/FdY51xAIA0ZLt4DU/fjT6DZo2/jqCf+hroQl8qRS453EFGi6WlYkZ8Ct X-Received: by 2002:a63:df0e:0:b0:378:4f83:496f with SMTP id u14-20020a63df0e000000b003784f83496fmr199685pgg.560.1646427333740; Fri, 04 Mar 2022 12:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646427333; cv=none; d=google.com; s=arc-20160816; b=WvNFbERKYeQ17tEWxitZ/8mHjrgVuBLqrJSSlSldG07qcZwtyLCj3FWWTYVDCBW9wJ RJ4KcXxIwDnzqZXyYM9PTPoU223VIiIZikgW2ze846A5QdK9mtSvN3KLC+8bQq6TLAa4 c+akXXiPdXGuS0v+c3VHjZLB3RlBrVpfT924H7KcmeNoPOazVA2b5a0nu9QdAuRvsLtD AujGHvO32BkU0t4xEblvZienxSKCVFIJfkL6drwKjYTBLXHl4xFFYtWgHLauraQLWsmP xckfBiyhQBFUYwXbaASTIu5GJR/PnOKeXSxtztuKgc0yBJKyqdSVK2iXwPLXsPSGyiv5 3+bw== 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=ltKgi/b1r6yAxpmHxcCWTc/P1+26ye9tRdej8H8cXjs=; b=1LDnM6Q6zH2HDxdew1AvT0Tix2SFKNVeS1ZgIep0NOSy6EwTRgkh21wqZwy1eBijWV ejLOfjva9Ygr+hHHhCVBjPfrtCd/EKFAiSzwKhq0QxAIg4VnR9rY6EBSjMdIWuYX3tRp xut8ClYaTxOfRMWoWdwEttvbB3DdhgFdkdTQgFGjqhPjw81Q33S0w2n8RGf+RP0IDCpd 0jgPCGCQKxc+FvbvKzdHfK6S3JRGBMKthuyNcfpBiCm3xzWpmfiFmjvYfcZq8wBy4nMP M9SU0E3gRrQpnvCPSt5PLgFGLNxsb0W4JbX57dhF5fvyCVQ/vQIDa4VIztIK/tBolGeB h7vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Mxecmohh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p17-20020a170902e75100b0015188454f36si5815395plf.567.2022.03.04.12.55.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:55:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Mxecmohh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CBAB631E067; Fri, 4 Mar 2022 11:49:27 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbiCDTHM (ORCPT + 99 others); Fri, 4 Mar 2022 14:07:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbiCDTHK (ORCPT ); Fri, 4 Mar 2022 14:07:10 -0500 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 610BF1EC982 for ; Fri, 4 Mar 2022 11:06:20 -0800 (PST) Received: by mail-ot1-x335.google.com with SMTP id w3-20020a056830060300b005ad10e3becaso8175463oti.3 for ; Fri, 04 Mar 2022 11:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ltKgi/b1r6yAxpmHxcCWTc/P1+26ye9tRdej8H8cXjs=; b=Mxecmohhv0kmsf7C0gnjBHSBoFcTtvYhyc8u+H5KbPJ556QuypU/WtrZebNVmuBLFg bg/RMTXk1ZY31givcLvvjNc9BZNwQPSUdLMlgw4PH6JfrgidQsZePqvdSCp0N/G04Jh+ hTcq7G4WTGqnygIk1C8U1Hc8qIcOlW3zlsZ1i6w9/WozmZ7M4NkW2ev7VpfoiDk+NuH+ hkHgTxIxJ7oG98BRDFvI0jQaCSQp3uhyUFabkQtPQa9YqnnXZwAovC0Nh+DdTGcwGOgj tYBH3wOMWzMjCRevR6Nix1UVpl7+msKD2kFxyJRrJFe9vl66rui+LM9Dha47i8sWNTak bFhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ltKgi/b1r6yAxpmHxcCWTc/P1+26ye9tRdej8H8cXjs=; b=PUK2u4nnBS0RYyVb5QY5Ato6Ji/4RjVB2VNWBbucaft+Qf/YjmZGtzxgFCNa/BPrfy SWrct03eBCtvmgXFKPBI2lTtl678Mo2Dbd+ml8MkXGNprJRvyU0b1IRreMvgvFJLaGwd KtMASgb3zmNKcJYhKRzQpNkNTRBwSLbzzFCG0KIACyBrru/D+eyVW13v6A+oTUn9kWQH De0dM7OLSIrtPIDWChMdeosj/3Cy45S1YLrhZ10/K9MoexAAsZQsSwTub6J3EdfGfmBS vjniWEdeZp/axTMmAN08MiTLej4yB9TESrbGbUjMsOBwrt+zu6upfFpV+rGEPR0XcGzz Vyrg== X-Gm-Message-State: AOAM533+hwWrexXGizRdHjhLFQq/U9xj3moa2DmFvYu+NU3MURkg/k51 KCS/qax5nFTvX08BdVBJHP3YVylKC0L3nOJZKGGbeQ== X-Received: by 2002:a9d:8b5:0:b0:5a4:9db6:92b4 with SMTP id 50-20020a9d08b5000000b005a49db692b4mr97683otf.14.1646420779509; Fri, 04 Mar 2022 11:06:19 -0800 (PST) MIME-Version: 1.0 References: <20220302111334.12689-1-likexu@tencent.com> <20220302111334.12689-13-likexu@tencent.com> <273a7631-188b-a7a9-a551-4e577dcdd8d1@gmail.com> In-Reply-To: <273a7631-188b-a7a9-a551-4e577dcdd8d1@gmail.com> From: Jim Mattson Date: Fri, 4 Mar 2022 11:06:08 -0800 Message-ID: Subject: Re: [PATCH v2 12/12] KVM: x86/pmu: Clear reserved bit PERF_CTL2[43] for AMD erratum 1292 To: Like Xu Cc: Paolo Bonzini , kvm@vger.kernel.org, Sean Christopherson , Wanpeng Li , Vitaly Kuznetsov , Joerg Roedel , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 Fri, Mar 4, 2022 at 1:47 AM Like Xu wrote: > > On 3/3/2022 1:52 am, Jim Mattson wrote: > > On Wed, Mar 2, 2022 at 3:14 AM Like Xu wrote: > >> > >> From: Like Xu > >> > >> The AMD Family 19h Models 00h-0Fh Processors may experience sampling > >> inaccuracies that cause the following performance counters to overcount > >> retire-based events. To count the non-FP affected PMC events correctly, > >> a patched guest with a target vCPU model would: > >> > >> - Use Core::X86::Msr::PERF_CTL2 to count the events, and > >> - Program Core::X86::Msr::PERF_CTL2[43] to 1b, and > >> - Program Core::X86::Msr::PERF_CTL2[20] to 0b. > >> > >> To support this use of AMD guests, KVM should not reserve bit 43 > >> only for counter #2. Treatment of other cases remains unchanged. > >> > >> AMD hardware team clarified that the conditions under which the > >> overcounting can happen, is quite rare. This change may make those > >> PMU driver developers who have read errata #1292 less disappointed. > >> > >> Reported-by: Jim Mattson > >> Signed-off-by: Like Xu > > > > This seems unnecessarily convoluted. As I've said previously, KVM > > should not ever synthesize a #GP for any value written to a > > PerfEvtSeln MSR when emulating an AMD CPU. > > IMO, we should "never synthesize a #GP" for all AMD MSRs, > not just for AMD PMU msrs, or keep the status quo. Then, why are you proposing this change? :-) We should continue to synthesize a #GP for an attempt to set "must be zero" bits or for rule violations, like "address must be canonical." However, we have absolutely no business making up our own hardware specification. This is a bug, and it should be fixed, like any other bug. > I agree with you on this AMD #GP transition, but we need at least one > kernel cycle to make a more radical change and we don't know Paolo's > attitude and more, we haven't received a tidal wave of user complaints. Again, if this is your stance, why are you proposing this change? :-) If you wait until you have a tidal wave of user complaints, you have waited too long. It's much better to be proactive than reactive.