Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031264AbbD1W37 (ORCPT ); Tue, 28 Apr 2015 18:29:59 -0400 Received: from mga02.intel.com ([134.134.136.20]:9939 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030978AbbD1W35 convert rfc822-to-8bit (ORCPT ); Tue, 28 Apr 2015 18:29:57 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,666,1422950400"; d="scan'208";a="717397715" From: "Brown, Len" To: Andy Lutomirski , Peter Zijlstra , "linux-kernel@vger.kernel.org" CC: Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo Subject: RE: [RFC] x86, perf: Add an aperfmperf driver Thread-Topic: [RFC] x86, perf: Add an aperfmperf driver Thread-Index: AQHQgfnnEIGVX2Nv3kmasul8yg1L+51i/vOg Date: Tue, 28 Apr 2015 22:29:53 +0000 Message-ID: <1A7043D5F58CCB44A599DFD55ED4C9484686CC03@fmsmsx115.amr.corp.intel.com> References: <2c37309d20afadf88ad4a82cf0ce02b9152801e2.1430256154.git.luto@kernel.org> In-Reply-To: <2c37309d20afadf88ad4a82cf0ce02b9152801e2.1430256154.git.luto@kernel.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.106] 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: 1305 Lines: 34 > I think that turbostat could do some of its work without being > root if we had a driver like this. Note that turbostat can be run as non-root this way: # setcap cap_sys_rawio=ep ./turbostat # chmod +r /dev/cpu/*/msr For the debug case, there are a number of MSRs that turbostat must access, so would still need permission for that case (which is the only case I use:-) > Thoughts? Would it make sense at all? Did I wire it up right? This is > the only PMU driver I've ever written, and it could have any number of > issues. APERF/MPERF, as with all per-thread MSRs, must be accessed from the local processor. I didn't see where this driver distinguishes the CPU. Also, I assume the intent is to return a snapshot, rather than sampling, yes? Note that turbostat binds itself to a remote CPU so that MSR reads are all local, then it binds to the next CPU etc. In the old days, we read everything without this binding, and the kernel overhead of the remote reads was too high, making it difficult to measure profoundly idle systems. cheers, -Len -- 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/