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 X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7822C433B4 for ; Wed, 7 Apr 2021 15:41:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83FB561262 for ; Wed, 7 Apr 2021 15:41:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344494AbhDGPlS (ORCPT ); Wed, 7 Apr 2021 11:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235715AbhDGPlR (ORCPT ); Wed, 7 Apr 2021 11:41:17 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52D9AC061756; Wed, 7 Apr 2021 08:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mnNg26720QrcvOj5pMl+lCkR+DJYA6RC8uuPt2+RH04=; b=dy1lADERjjlGZ2fEGGQ78+xBFZ OkGAC2y9rGJRqmf3k4wKbIY1R4qoAYHruHuWyaNfx4/wpGasRKMNiyG1QvtZYcDJAdOFuhgkZeemt zyuCBLghXqhPJJnY9pIX1YLHTYpTHNlcHbFr7F7Cq+MjIQeIkmRhy7ny6oGScgse3EZm2Fh2Lbo25 QHbJD9JRMrBIPE6249ZijiYvLccNV3bTSBhD7C2t0rmvKIScdZSESCe9GEuOGgtxBprjHoUaMlxpI 4iFTkrzZlL/T71e2SxceecbrnzAlib7ZyTbbR42lfzTI2ooZdvr05GHoLLZurNLqq2bpZUrF+2FIv OnbCuPWQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lUAIS-005IqW-CR; Wed, 07 Apr 2021 15:40:48 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 142B43001FB; Wed, 7 Apr 2021 17:40:48 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 06A4A2BF09264; Wed, 7 Apr 2021 17:40:48 +0200 (CEST) Date: Wed, 7 Apr 2021 17:40:47 +0200 From: Peter Zijlstra To: Like Xu Cc: Sean Christopherson , Paolo Bonzini , eranian@google.com, andi@firstfloor.org, kan.liang@linux.intel.com, wei.w.wang@intel.com, Wanpeng Li , Vitaly Kuznetsov , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Luwei Kang Subject: Re: [PATCH v4 09/16] KVM: x86/pmu: Add PEBS_DATA_CFG MSR emulation to support adaptive PEBS Message-ID: References: <20210329054137.120994-1-like.xu@linux.intel.com> <20210329054137.120994-10-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210329054137.120994-10-like.xu@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29, 2021 at 01:41:30PM +0800, Like Xu wrote: > @@ -3863,6 +3864,12 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) > arr[2].host = (unsigned long)ds; > arr[2].guest = pmu->ds_area; *nr = 3; > > + if (baseline) { > + arr[3].msr = MSR_PEBS_DATA_CFG; > + arr[3].host = cpuc->pebs_data_cfg; > + arr[3].guest = pmu->pebs_data_cfg; *nr = 4; > + } > + > /* > * If PMU counter has PEBS enabled it is not enough to > * disable counter on a guest entry since PEBS memory > @@ -3879,9 +3886,11 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) > else { > arr[1].guest = arr[1].host; > arr[2].guest = arr[2].host; > + if (baseline) > + arr[3].guest = arr[3].host; > } > > - *nr = 3; > + *nr = baseline ? 4 : 3; And you don't need yet another branch to determine a value you already know. > }