Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031052AbbD1WoD (ORCPT ); Tue, 28 Apr 2015 18:44:03 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:35013 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030978AbbD1WoA (ORCPT ); Tue, 28 Apr 2015 18:44:00 -0400 MIME-Version: 1.0 In-Reply-To: <1A7043D5F58CCB44A599DFD55ED4C9484686CC03@fmsmsx115.amr.corp.intel.com> References: <2c37309d20afadf88ad4a82cf0ce02b9152801e2.1430256154.git.luto@kernel.org> <1A7043D5F58CCB44A599DFD55ED4C9484686CC03@fmsmsx115.amr.corp.intel.com> From: Andy Lutomirski Date: Tue, 28 Apr 2015 15:43:38 -0700 Message-ID: Subject: Re: [RFC] x86, perf: Add an aperfmperf driver To: "Brown, Len" Cc: Andy Lutomirski , Peter Zijlstra , "linux-kernel@vger.kernel.org" , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1307 Lines: 33 On Tue, Apr 28, 2015 at 3:29 PM, Brown, Len wrote: >> 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:-) > True. This would only get the average turbo ratio. Of course, I think that can be done using cpu-cycles as well. >> 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? I think that the perf core takes care of that for us, but I'm not entirely sure. --Andy -- 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/