From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750893Ab2FGEBd (ORCPT ); Thu, 7 Jun 2012 00:01:33 -0400 Received: from mga03.intel.com ([143.182.124.21]:33183 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750695Ab2FGEBK (ORCPT ); Thu, 7 Jun 2012 00:01:10 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="152708446" Message-ID: <4FD02784.3080302@intel.com> Date: Thu, 07 Jun 2012 12:01:08 +0800 From: "Yan, Zheng" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Stephane Eranian CC: Peter Zijlstra , "Yan, Zheng" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf: Fix intel shared extra msr allocation References: <1338520856-21020-1-git-send-email-zheng.z.yan@intel.com> <1338891271.28282.155.camel@twins> <1338892071.28282.157.camel@twins> <1338898024.28282.160.camel@twins> <1338899999.28282.164.camel@twins> <1338901490.28282.167.camel@twins> <1338903164.28282.177.camel@twins> <1338904039.28282.180.camel@twins> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/06/2012 06:12 PM, Stephane Eranian wrote: > There is something wrong with this patch, I instrumented the code > and I can see: > [ 1377.324575] 1. idx=1 reg_idx=1 ref=-1 config=0xff01 era->config=0xff01 > ^^^^^^ > The test case on WSM (RSP0, RSP1): > > $ perf stat -a -C13 -e > offcore_response_1:dmnd_data_rd,offcore_response_1:dmnd_data_rd sleep > 100 & > $ perf stat -a -C1 -e offcore_response_1:dmnd_rfo sleep 1 > > I think this happens during scheduling of the events, i.e., during the > run and not on initial > programming. That could happen with cgroups, for instance. > The bug is in intel_fixup_er(), it should be: static void intel_fixup_er(struct perf_event *event, int idx) { if (idx == EXTRA_REG_RSP_0) { event->hw.config &= ~INTEL_ARCH_EVENT_MASK; event->hw.config |= 0x01b7; event->hw.extra_reg.idx = EXTRA_REG_RSP_0; event->hw.extra_reg.reg = MSR_OFFCORE_RSP_0; } else if (idx == EXTRA_REG_RSP_1) { event->hw.config &= ~INTEL_ARCH_EVENT_MASK; event->hw.config |= 0x01bb; event->hw.extra_reg.idx = EXTRA_REG_RSP_1; event->hw.extra_reg.reg = MSR_OFFCORE_RSP_1; } } Regards Yan, Zheng