Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp189866pxa; Tue, 11 Aug 2020 22:14:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa1hHsgKDAxJSYLY1A2Y98Y3PB30lg4pj1eIF18aRivDK3hEbEJjkkwP/5bJluhN++geS7 X-Received: by 2002:a05:6402:84e:: with SMTP id b14mr28592340edz.115.1597209241063; Tue, 11 Aug 2020 22:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597209241; cv=none; d=google.com; s=arc-20160816; b=kwQ3Sm/f8GmK/4/u8sKKfq630XX8zpn31ySdHdXz/frCBkHUBLrmdNGbi7WFHkuIKN 7TQpWU+VIn8tEe/eBcM5myRbImTr4IVdJKsga5jzFGd6ptIYkiPYc0ZnBafgG/4i8ULU y1NFMeXUtsChUkfzHRXwc1iRlXHCQi50jak+Pp/vx4Q/XwOi65L5DfevaVBzPGYa1LaA XfO2Km3cShatJLlk9wYU2SnRLCDQTEpr1dKJ2dlTb6iolt3k5kflCHvzi9igIub2DgKb ZvAqWPbnP6nr8g3AU9PDvUpUgD7P2Y1kJOulLzRITt/nCoQcUMIugZZhuESOEOhQp6mr 1ltg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=rLKtGgVFdml59Vz7WRH1ruOHDTRNeZV+tXU37llsUeU=; b=02f4BYVRHN2/6cPI1Ex0ExubvY8k0XU+t0iilmvHZF2MH1lYl9aEC7qPHILodi1Lql W5KDugvBGhI4jJBGkBL4Q4th55vXECAmXswP4DVaETI4QRCvPKW9hS42vI6fezVtjcBt hx/w1FkR+HyjBh+0IkTiftmv9khZd+useQCXjq5OEwgK5+oK9XHsAYmuS75ESNHgp4QS 87XuOuhBk9DlQBFze9Pl6EQkR0S8cU3wUS8Pt1ffxc8FamCOnMwq0UK9IYs99vzmpybw W+jPTVq1f4I3EE3mKCwPrpQ8XT3/k018zeS4ySHhgUGlHSBmLRhpFqS1wZ7tDjnqOIrQ VY4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b25si582068edy.296.2020.08.11.22.13.23; Tue, 11 Aug 2020 22:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726567AbgHLFJw (ORCPT + 99 others); Wed, 12 Aug 2020 01:09:52 -0400 Received: from mga02.intel.com ([134.134.136.20]:55625 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726264AbgHLFJv (ORCPT ); Wed, 12 Aug 2020 01:09:51 -0400 IronPort-SDR: 3VWtqI8RHhRNxYKPm6bz+5R2Q7LMoEygJNQLqsCALpcArhdSI/g1/WcSCE5XM4Dn3YY9bqB3yt k5Je4nCCZCXw== X-IronPort-AV: E=McAfee;i="6000,8403,9710"; a="141729292" X-IronPort-AV: E=Sophos;i="5.76,303,1592895600"; d="scan'208";a="141729292" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2020 22:09:51 -0700 IronPort-SDR: jV/u4H842sfXW8M/als+kPyHvjNbX23gNxcm6qen1ioionXCqgHWipvLZud5Fxj5v4NHS4f65y MWETPvQgc1pg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,303,1592895600"; d="scan'208";a="332706627" Received: from sqa-gate.sh.intel.com (HELO clx-ap-likexu.tsp.org) ([10.239.48.212]) by FMSMGA003.fm.intel.com with ESMTP; 11 Aug 2020 22:09:48 -0700 From: Like Xu To: Paolo Bonzini , Peter Zijlstra Cc: Jin@vger.kernel.org, Yao , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: x86/pmu: Add '.exclude_hv = 1' for guest perf_event Date: Wed, 12 Aug 2020 13:07:22 +0800 Message-Id: <20200812050722.25824-1-like.xu@linux.intel.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To emulate PMC counter for guest, KVM would create an event on the host with 'exclude_guest=0, exclude_hv=0' which simply makes no sense and is utterly broken. To keep perf semantics consistent, any event created by pmc_reprogram_counter() should both set exclude_hv and exclude_host in the KVM context. Message-ID: <20200811084548.GW3982@worktop.programming.kicks-ass.net> Signed-off-by: Like Xu --- arch/x86/kvm/pmu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 67741d2a0308..6a30763a10d7 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -108,6 +108,7 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, .exclude_host = 1, .exclude_user = exclude_user, .exclude_kernel = exclude_kernel, + .exclude_hv = 1, .config = config, }; -- 2.21.3