Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932790Ab1EJOsn (ORCPT ); Tue, 10 May 2011 10:48:43 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:40859 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756510Ab1EJOr6 (ORCPT ); Tue, 10 May 2011 10:47:58 -0400 Subject: Re: [PATCH 2/3] perf, x86: Use GO/HO bits in perf-ctr From: Peter Zijlstra To: Joerg Roedel Cc: Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, benh , Anton Blanchard , davem In-Reply-To: <1305038132-5080-3-git-send-email-joerg.roedel@amd.com> References: <1305038132-5080-1-git-send-email-joerg.roedel@amd.com> <1305038132-5080-3-git-send-email-joerg.roedel@amd.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 10 May 2011 16:48:20 +0200 Message-ID: <1305038900.2914.97.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1328 Lines: 33 On Tue, 2011-05-10 at 16:35 +0200, Joerg Roedel wrote: > The AMD perf-counters support counting in guest or host-mode > only. Make use of that feature when user-space specified > guest/host-mode only counting. Subject mentions x86, does Intel have anything similar so you can make it work for them too? Also, might be nice to ask the power and sparc64 people if their archs can also differentiate between guest and host thingies. > diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c > index cf4e369..afc21f3 100644 > --- a/arch/x86/kernel/cpu/perf_event_amd.c > +++ b/arch/x86/kernel/cpu/perf_event_amd.c > @@ -116,6 +116,12 @@ static int amd_pmu_hw_config(struct perf_event *event) > if (ret) > return ret; > > + if (event->attr.exclude_host) > + event->hw.config |= AMD_PERFMON_EVENTSEL_GUESTONLY; > + > + if (event->attr.exclude_guest) > + event->hw.config |= AMD_PERFMON_EVENTSEL_HOSTONLY; > + > if (event->attr.type != PERF_TYPE_RAW) > return 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/