From patchwork Fri Jun 17 13:37:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 891402 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5HDcNpu029280 for ; Fri, 17 Jun 2011 13:38:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757622Ab1FQNhO (ORCPT ); Fri, 17 Jun 2011 09:37:14 -0400 Received: from va3ehsobe001.messaging.microsoft.com ([216.32.180.11]:33498 "EHLO VA3EHSOBE008.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755414Ab1FQNhI (ORCPT ); Fri, 17 Jun 2011 09:37:08 -0400 Received: from mail64-va3-R.bigfish.com (10.7.14.244) by VA3EHSOBE008.bigfish.com (10.7.40.28) with Microsoft SMTP Server id 14.1.225.22; Fri, 17 Jun 2011 13:37:07 +0000 Received: from mail64-va3 (localhost.localdomain [127.0.0.1]) by mail64-va3-R.bigfish.com (Postfix) with ESMTP id 5BCFCFC012C; Fri, 17 Jun 2011 13:37:07 +0000 (UTC) X-SpamScore: 1 X-BigFish: VPS1(zzzz1202hzz8275bhz32i668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:163.181.249.108; KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail64-va3 (localhost.localdomain [127.0.0.1]) by mail64-va3 (MessageSwitch) id 1308317827169887_29838; Fri, 17 Jun 2011 13:37:07 +0000 (UTC) Received: from VA3EHSMHS022.bigfish.com (unknown [10.7.14.248]) by mail64-va3.bigfish.com (Postfix) with ESMTP id 1CE1F6B804B; Fri, 17 Jun 2011 13:37:07 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by VA3EHSMHS022.bigfish.com (10.7.99.32) with Microsoft SMTP Server id 14.1.225.22; Fri, 17 Jun 2011 13:37:05 +0000 X-WSS-ID: 0LMXSHP-01-0NZ-02 X-M-MSG: Received: from sausexedgep02.amd.com (sausexedgep02-ext.amd.com [163.181.249.73]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Axway MailGate 3.8.1) with ESMTP id 2227810282AF; Fri, 17 Jun 2011 08:37:00 -0500 (CDT) Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep02.amd.com (163.181.36.59) with Microsoft SMTP Server (TLS) id 8.3.106.1; Fri, 17 Jun 2011 08:37:32 -0500 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 17 Jun 2011 08:37:02 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Fri, 17 Jun 2011 09:37:01 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id C38CA49C5E9; Fri, 17 Jun 2011 14:37:00 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id E6C85FFEAB; Fri, 17 Jun 2011 15:37:36 +0200 (CEST) From: Joerg Roedel To: Peter Zijlstra , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo CC: , , Joerg Roedel Subject: [PATCH 1/5] perf, core: Introduce attrs to count in either host or guest mode Date: Fri, 17 Jun 2011 15:37:30 +0200 Message-ID: <1308317854-27398-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1308317854-27398-1-git-send-email-joerg.roedel@amd.com> References: <1308317854-27398-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 17 Jun 2011 13:38:24 +0000 (UTC) The two new attributes exclude_guest and exclude_host can bes used by user-space to tell the kernel to setup performance counter to either only count while the CPU is in guest or in host mode. An additional check is also introduced to make sure user-space does not try to exclude guest and host mode from counting. Signed-off-by: Joerg Roedel --- include/linux/perf_event.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index e0786e3..9a27b5d 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -219,7 +219,10 @@ struct perf_event_attr { mmap_data : 1, /* non-exec mmap data */ sample_id_all : 1, /* sample_type all events */ - __reserved_1 : 45; + exclude_host : 1, /* don't count in host */ + exclude_guest : 1, /* don't count in guest */ + + __reserved_1 : 43; union { __u32 wakeup_events; /* wakeup every n events */