Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2728707ybl; Thu, 29 Aug 2019 12:03:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD+1wmbRLZag6zm/f5kAyS6ZAl0YRDC0yRb9WhtxOzGc73TILPZeIB3GPik0z6dMF48eNG X-Received: by 2002:a17:902:e311:: with SMTP id cg17mr11182695plb.183.1567105409594; Thu, 29 Aug 2019 12:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567105409; cv=none; d=google.com; s=arc-20160816; b=Dl9AGp/rstmK3rUMqaPNGHkIQqKd3aKmhTpqjd8PR6hQUsxuNdk98n/W1XLRRXmYrs XrUo7exrK49l6O5JA7+uah5y+P7NbdY25tqguYGv36n/MojUrx1E7ppe1vHLOsaIu43S D9I6Kb3/LWe129KkxX/2VRLITL4MIadUSi35FSp/5DoEbegQP5GGSlv8ZjOICaABcRnn 8P7wKTGzL+6OOf/sPGTy8AVA2L7+0bAWHhC7LsH5IM6fAqw6EJXb+KESPL/LWinJu0Sw 93kZvHI+uwBj3tZRyErTt8T+s00eGTV8n+XC3Rqq6ausoH2Wj7WZt/c7kifRbuv6Kd7T UUFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=C0GoqTcetNrsUYVAfNmMyDqTNMHiKZd1X2n4rg0Xzqw=; b=LLzo/cMDelSf8F+B7YdKLTsUqK87VcI/iFdFgunkVwiJXYcj6VGzUmv3z1lcvJ7fGA F28bnG7VOBwDJmecYEQp4ivhBemK7KQOlyE/dYeiOmtjgPtHIjQBf2+nGJa5AfnZPSBC bB3+TRpd4QR7kgT5zl+89V1C4ayHp5UTNxkdk1aTuiIdU+wa92bazMYP55UqZGOFyFko 6eNTub2+xuHJfjdECc58z1Ljti3kCYDQOhHH0s4l50qj7L0u3bTXWdSIlPt0laNxjMd4 Do7Ax9Pc3GJxtIXSqEjaMv0zOiH9LUTx9ZJ1dO0y4Bu3R/y+Q3TTwmnu8fLG56mv3M3u kV7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XzU33u+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a63si2637833pge.113.2019.08.29.12.03.10; Thu, 29 Aug 2019 12:03:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XzU33u+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728137AbfH2TBr (ORCPT + 99 others); Thu, 29 Aug 2019 15:01:47 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:43183 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727437AbfH2TBr (ORCPT ); Thu, 29 Aug 2019 15:01:47 -0400 Received: by mail-io1-f68.google.com with SMTP id u185so5258723iod.10 for ; Thu, 29 Aug 2019 12:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C0GoqTcetNrsUYVAfNmMyDqTNMHiKZd1X2n4rg0Xzqw=; b=XzU33u+W1B0k9YCWc5RlZojrPzqvliMOZTJajeaB1y7KqVJuusocLKxgHiaNO1/QB4 hAxEnYxtc81Lz9kkcPpJICN2SpCCFR2TEihyt7eVSLUADJhMQvJAXRBN0XwoRjBsQSsO 3iu5LbmRvzsM5DjCuQsVlJaiCbcWdAqJYl+idwcfVXMhI7aWqMoy5SQv0BnG/DPimIoD QYYUXdzpkn8Vd7p85TZ5ATinFawqlUJN6Gpx29OJ7EzNEJC9yMJZe5oUZGpqxZ2EVPzB 7PjEYSdvQA3EamflN9hXPebOSjyyMqyo41yciS2NqD/n2G7F72q/roZ5Y+Y57DuMkHTf cPTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C0GoqTcetNrsUYVAfNmMyDqTNMHiKZd1X2n4rg0Xzqw=; b=aiQOJOT7bEgl5tr3Rt2vnhQkHGBGAPDxRYIt/ma01nbIXwbrH4ZUvuwFun9L6N5Ub6 /vW3uNni3/9XpUha/JhaVPpDoW+ps6sNRDOVVFDZXJbnb6J5Oy5HAKdXyF6y31nplf8A oHAmZekiy1lbh5+1nijWsuydre4SDYPLM2F42NnsaCcwAOQ1qf+aoBPcNqiKRkPSDFUT FktPACR03hJ731rwiaxWSi27QFL8lGB+x7YANxQfM+udBuQaQGR42kmww0kYbrkjpAl+ mTiuGCo/c3fImpKUZLV2GQ+WiAttJQtoCfOGMyGpAvK2WRGO7u1hRV9YrNj6FvdJfowt Khog== X-Gm-Message-State: APjAAAUdKHNdjBMEh67TkjW+b5y3qacDD/SNKj8Kf/CNryEzjHWrbJI3 tCKk8VtipBoYcTtpFchSd0G+SG9qP9X73NO06I9TJQ== X-Received: by 2002:a5d:8e15:: with SMTP id e21mr6809020iod.296.1567105306039; Thu, 29 Aug 2019 12:01:46 -0700 (PDT) MIME-Version: 1.0 References: <1567056849-14608-1-git-send-email-luwei.kang@intel.com> <1567056849-14608-2-git-send-email-luwei.kang@intel.com> In-Reply-To: <1567056849-14608-2-git-send-email-luwei.kang@intel.com> From: Jim Mattson Date: Thu, 29 Aug 2019 12:01:34 -0700 Message-ID: Subject: Re: [RFC v1 1/9] KVM: x86: Add base address parameter for get_fixed_pmc function To: Luwei Kang Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , "the arch/x86 maintainers" , Andi Kleen , kvm list , LKML , Stephane Eranian Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 28, 2019 at 10:38 PM Luwei Kang wrote: > > PEBS output Inte PT introduces some new MSRs (MSR_RELOAD_FIXED_CTRx) > for fixed function counters that use for autoload the preset value > after writing out a PEBS event. > > Introduce base MSRs address parameter to make this function can get > performance monitor counter structure by MSR_RELOAD_FIXED_CTRx registers. > > Signed-off-by: Luwei Kang > --- > arch/x86/kvm/pmu.h | 5 ++--- > arch/x86/kvm/vmx/pmu_intel.c | 14 +++++++++----- > 2 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h > index 58265f7..c62a1ff 100644 > --- a/arch/x86/kvm/pmu.h > +++ b/arch/x86/kvm/pmu.h > @@ -93,10 +93,9 @@ static inline struct kvm_pmc *get_gp_pmc(struct kvm_pmu *pmu, u32 msr, > } > > /* returns fixed PMC with the specified MSR */ > -static inline struct kvm_pmc *get_fixed_pmc(struct kvm_pmu *pmu, u32 msr) > +static inline struct kvm_pmc *get_fixed_pmc(struct kvm_pmu *pmu, u32 msr, > + int base) > { > - int base = MSR_CORE_PERF_FIXED_CTR0; > - > if (msr >= base && msr < base + pmu->nr_arch_fixed_counters) > return &pmu->fixed_counters[msr - base]; IIUC, these new MSRs aren't new fixed PMCs, but are values to be reloaded into the existing fixed PMCs when a PEBS event has been written. This change makes it look like you are introducing an additional set of fixed PMCs.