Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754766AbaJUE2y (ORCPT ); Tue, 21 Oct 2014 00:28:54 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:61942 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754486AbaJUE2v (ORCPT ); Tue, 21 Oct 2014 00:28:51 -0400 MIME-Version: 1.0 In-Reply-To: References: From: Andy Lutomirski Date: Mon, 20 Oct 2014 21:28:29 -0700 Message-ID: Subject: Re: [RFC 0/5] CR4 handling improvements To: Vince Weaver Cc: Peter Zijlstra , Valdis Kletnieks , "linux-kernel@vger.kernel.org" , Paul Mackerras , Arnaldo Carvalho de Melo , Ingo Molnar , Kees Cook , Andrea Arcangeli , Erik Bosman Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 20, 2014 at 9:06 PM, Vince Weaver wrote: > On Tue, 14 Oct 2014, Andy Lutomirski wrote: > >> This little series tightens up rdpmc permissions. With it applied, >> rdpmc can only be used if a perf_event is actually mmapped. For now, >> this is only really useful for seccomp. > > So just to be difficult... > > I am aware of at least one group who is doing low-latency performance > measures using rdpmc on Linux. > > They start the counters manually by poking the MSRs directly (bypassing > perf_event_open()). > > They use rdpmc, grateful for the fact that currently CR4 is set up so they > can do this w/o patching the kernel. > > These patches of course would break this use case... ISTM it would be a lot better to use the perf subsystem for this. You can probably pin an event to a pmu. I don't know whether you can pin an event systemwide. I also don't know whether pinning an event will prevent perf from changing its value periodically, and it certainly doesn't magically make wraparound issues go away. It would be easy to add a new setting for rdpmc to deal with the PCE part. E.g. rdpmc = 2 could allow all tasks to use rdpmc regardless of whether they have an event mapped. (And I would have to re-add the static key. Sigh.) --Andy P.S. Hey, Intel, you forgot to add rdpmcp :-/ -- 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/