Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp504063ybx; Tue, 29 Oct 2019 23:43:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLCDKphheuVu2CDf19mighcO8nMv8SmxMHVzW/S6f6jnCcGdK1yi9lKMpGfRx5dmy4mFkG X-Received: by 2002:a17:906:494e:: with SMTP id f14mr7552115ejt.42.1572417806485; Tue, 29 Oct 2019 23:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572417806; cv=none; d=google.com; s=arc-20160816; b=kde+mIDi1CD2ZeZ5pyCnzKKiKYu6CZ55f+NDeZ1KQozzRQaJCFoBzf3+cTB5GGVdy0 Ind/SuKi5UqX7t5u8/zijXsq8SAFVyHQ1zGvzscGAE6oDukeHr9y0jeok0B/sZNw28Eh X1D4LyifulYGusAp7kRdQdrhXG39mQcmNRLPL9UWMIrZLf729lzKjGQC7YPXv9yxD4JZ S0iHIvfivsoBRSd76VBWygTlv3GOqthBzfom0cgvFZ2RPkKpwZFQ0CEbinBqXw1ApglL NAG2sqGbXH+iWk+akNwu9Vjs/FM/JCUeUPJVqgG3Cq3D7k/b6ePQpU1d1BYDOJu3Ac2I 31xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=zkOpm2Ytnizdu9mVwmnjJ4Fsrbrc9PzcWAR1Rdc1zKE=; b=fGWGbqm5ySXw0Az020rWGt5lvQFI8IhNEtavfOfwjs1w/vT0AQWIyYowpavwFVd9rq IhfvKSxAJWISjdJE7KRN342lXskcokEXouySc5OMqDXBL7MGdB0pI7+nopvLp+9tqnWi wVMrYaXDhcJKGNu5MF3kY28IaqTx2R1KuqwxIQdVQg7xuUecNx3SU5DLha32pMd5PtIC w+JDjnxqMZxjOzRswmFs2vBId+Ba1oUNsXNxz62EQJ333YuPewhc34t7qv25VFmHvO66 nhIXQvlWkrMzewJxAVVFUoI+FDy8Sc2xGRoyJQ1XsRZf0fH9JReIzIj/P2jqPzafzy7M RTgQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c24si859098edb.328.2019.10.29.23.43.02; Tue, 29 Oct 2019 23:43:26 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727228AbfJ3GmS (ORCPT + 99 others); Wed, 30 Oct 2019 02:42:18 -0400 Received: from mga11.intel.com ([192.55.52.93]:28720 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbfJ3GmR (ORCPT ); Wed, 30 Oct 2019 02:42:17 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2019 23:42:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,246,1569308400"; d="scan'208";a="374797609" Received: from um.fi.intel.com (HELO um) ([10.237.72.57]) by orsmga005.jf.intel.com with ESMTP; 29 Oct 2019 23:42:11 -0700 From: Alexander Shishkin To: "Kang\, Luwei" , Peter Zijlstra Cc: "kvm\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" , "pbonzini\@redhat.com" , "rkrcmar\@redhat.com" , "Christopherson\, Sean J" , "vkuznets\@redhat.com" , "wanpengli\@tencent.com" , "jmattson\@google.com" , "joro\@8bytes.org" , "tglx\@linutronix.de" , "mingo\@redhat.com" , "bp\@alien8.de" , "hpa\@zytor.com" , "x86\@kernel.org" , "ak\@linux.intel.com" , "thomas.lendacky\@amd.com" , "acme\@kernel.org" , "mark.rutland\@arm.com" , "jolsa\@redhat.com" , "namhyung\@kernel.org" , alexander.shishkin@linux.intel.com Subject: RE: [PATCH v1 3/8] KVM: x86: Allocate performance counter for PEBS event In-Reply-To: <82D7661F83C1A047AF7DC287873BF1E173835B1A@SHSMSX104.ccr.corp.intel.com> References: <1572217877-26484-1-git-send-email-luwei.kang@intel.com> <1572217877-26484-4-git-send-email-luwei.kang@intel.com> <20191029144612.GK4097@hirez.programming.kicks-ass.net> <82D7661F83C1A047AF7DC287873BF1E173835B1A@SHSMSX104.ccr.corp.intel.com> Date: Wed, 30 Oct 2019 08:42:10 +0200 Message-ID: <87o8xyg2f1.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Kang, Luwei" writes: >> > static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, >> > unsigned config, bool exclude_user, >> > bool exclude_kernel, bool intr, >> > - bool in_tx, bool in_tx_cp) >> > + bool in_tx, bool in_tx_cp, bool pebs) >> > { >> > struct perf_event *event; >> > struct perf_event_attr attr = { >> > @@ -111,9 +111,12 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, >> > .exclude_user = exclude_user, >> > .exclude_kernel = exclude_kernel, >> > .config = config, >> > + .precise_ip = pebs ? 1 : 0, >> > + .aux_output = pebs ? 1 : 0, >> >> srsly? > > Hi Peter, > Thanks for review. For aux_output, I think it should be set 1 when the guest wants to enabled PEBS by Intel PT. attr.aux_output==1 means your group leader should be an intel_pt event for this to succeed. Luckily for this instance, perf_event_create_kernel_counter() doesn't actually check the attr.aux_output. Also, does 'bool pebs' mean PEBS-via-PT or just a PEBS counter? Or does it mean that in kvm it's the same thing? Regards, -- Alex