Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756033AbbHFRol (ORCPT ); Thu, 6 Aug 2015 13:44:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:58436 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756010AbbHFRoh convert rfc822-to-8bit (ORCPT ); Thu, 6 Aug 2015 13:44:37 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,623,1432623600"; d="scan'208";a="763428427" From: "Liang, Kan" To: Peter Zijlstra CC: Andy Lutomirski , Thomas Gleixner , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" , "Andrew Lutomirski" , Linus Torvalds , Ingo Molnar , "linux-tip-commits@vger.kernel.org" Subject: RE: [tip:perf/core] perf/x86: Add an MSR PMU driver Thread-Topic: [tip:perf/core] perf/x86: Add an MSR PMU driver Thread-Index: AQHQzpQ65l/Dz0xJ8EeCrMA8u7d3Np37ZoGAgACIDlD//60vAIAAhnPA//99DICAAI7+8IACZbyAgACshOA= Date: Thu, 6 Aug 2015 17:44:25 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077018D3286@SHSMSX103.ccr.corp.intel.com> References: <1437407346-31186-1-git-send-email-kan.liang@intel.com> <37D7C6CF3E00A74B8858931C1DB2F077018D16F1@SHSMSX103.ccr.corp.intel.com> <37D7C6CF3E00A74B8858931C1DB2F077018D206A@SHSMSX103.ccr.corp.intel.com> <37D7C6CF3E00A74B8858931C1DB2F077018D2103@SHSMSX103.ccr.corp.intel.com> <20150806152151.GG25159@twins.programming.kicks-ass.net> In-Reply-To: <20150806152151.GG25159@twins.programming.kicks-ass.net> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 911 Lines: 33 > + /* Probe the MSRs. */ > + for (i = PERF_MSR_TSC + 1; i < PERF_MSR_EVENT_MAX; i++) { > + u64 val; > > - default: > - err = -ENOTSUPP; > + if (!msr[i].test() || rdmsrl_safe(msr[i].msr, &val)) > + msr[i].attr = NULL; > } > > - if (err != 0) { > - pr_cont("no msr PMU driver.\n"); > - return 0; > + /* List remaining MSRs in the sysfs attrs. */ > + for (i = 0; i < PERF_MSR_EVENT_MAX; i++) { i should start from PERF_MSR_TSC + 1. The tsc has already been inserted into events_attrs by default. > + if (msr[i].attr) > + events_attrs[j++] = &msr[i].attr->attr.attr; > } > + events_attrs[j] = NULL; > > perf_pmu_register(&pmu_msr, "msr", -1); > -- 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/