Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753823AbbF0Pwa (ORCPT ); Sat, 27 Jun 2015 11:52:30 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:36493 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753348AbbF0Pw2 (ORCPT ); Sat, 27 Jun 2015 11:52:28 -0400 MIME-Version: 1.0 In-Reply-To: <20150627083921.GA13074@gmail.com> References: <1435341131-3279-1-git-send-email-prarit@redhat.com> <20150627083354.GA12834@gmail.com> <20150627083921.GA13074@gmail.com> From: Andy Lutomirski Date: Sat, 27 Jun 2015 08:52:07 -0700 Message-ID: Subject: Re: [PATCH] x86, msr: Allow read access to /dev/cpu/X/msr To: Ingo Molnar Cc: Prarit Bhargava , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , X86 ML , Len Brown , Dasaratharaman Chandramouli , Peter Zijlstra , Borislav Petkov , Andy Lutomirski , Denys Vlasenko , Brian Gerst , 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: 1523 Lines: 40 On Sat, Jun 27, 2015 at 1:39 AM, Ingo Molnar wrote: > > * Ingo Molnar wrote: > >> So what's wrong with exposing them as a simplified PMU driver? >> >> That way we only expose the ones we want to - plus tooling can use all the rich >> perf features that can be used around this. (sampling, counting, call chains, >> etc.) > > See below code from Andy that exposes a single MSR via perf. At the core of the > PMU driver is a single rdmsrl(): > > +static void aperfmperf_event_start(struct perf_event *event, int flags) > +{ > + u64 now; > + > + rdmsrl(event->hw.event_base, now); > + local64_set(&event->hw.prev_count, now); > +} > > Now I think what we really want is to expose not a single MSR but multiple MSRs in > a single driver, i.e. don't have one PMU driver per MSR, but have a driver that > allows the exposure of select MSRs as counters. I'm way ahead of you: this driver can expose *two* MSRs as counters :) Seriously, though, it would be straightforward to make it handle a more general list, complete with non-architectural stuff (such as the upcoming PPERF in Skylake). This driver only knows how to handle counters, though. I'm not sure whether all of the MSRs that turbostat needs are counters. --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/