Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758059Ab2JXIPb (ORCPT ); Wed, 24 Oct 2012 04:15:31 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:55440 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755607Ab2JXIPY (ORCPT ); Wed, 24 Oct 2012 04:15:24 -0400 Date: Wed, 24 Oct 2012 10:15:19 +0200 From: Ingo Molnar To: Stephane Eranian Cc: Andi Kleen , Peter Zijlstra , LKML , "mingo@elte.hu" , Arnaldo Carvalho de Melo , Jiri Olsa Subject: Re: [PATCH 2/2] perf: SNB exclusive PMU access for INST_RETIRED:PREC_DIST Message-ID: <20121024081519.GA29182@gmail.com> References: <1350658326-14715-1-git-send-email-eranian@google.com> <1350658326-14715-3-git-send-email-eranian@google.com> <1350664077.2768.32.camel@twins> <1350665152.2768.41.camel@twins> <20121019172018.GA2095@tassilo.jf.intel.com> <20121021165523.GA29247@gmail.com> <20121021180341.GA4128@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2598 Lines: 76 * Stephane Eranian wrote: > On Sun, Oct 21, 2012 at 8:03 PM, Ingo Molnar wrote: > > > > * Stephane Eranian wrote: > > > >> On Sun, Oct 21, 2012 at 6:55 PM, Ingo Molnar wrote: > >> > > >> > * Andi Kleen wrote: > >> > > >> >> > > > This isn't limited to admin, right? So the above turns into a DoS on the > >> >> > > > console. > >> >> > > > > >> >> > > Ok, so how about a WARN_ON_ONCE() instead? > >> >> > > >> >> > That should be fine I guess ;-) > >> >> > >> >> imho there is need for a generic mechanism to return an error > >> >> string to the user program without such hacks. > >> > > >> > Agreed - we could return an 'extended errno' long error return > >> > value, which in reality is a pointer to an error string (in > >> > perf_attr::error_str), and copy that string to user-space at > >> > perf syscall return time. > >> > > >> I assume by perf_attr:error_str, you actually mean: > >> > >> struct perf_event_attr { > >> char error_str[PERF_ERR_LEN]; > >> }; > >> > >> Right? > > > > I don't think we should allocate space in the attr, instead we > > should use something like: > > > > u8 __user *err_str; > > u32 err_str_len; > > > > which would be filled in by tooling with a string and a max_len > > value, and strncpy_to_user() could do the rest on the kernel > > side. [ A minor complication is that we don't have a > > strncpy_to_user() method at the moment. ] > > > > Static strings could be handled this way. > > > > [ Dynamic strings could be supported too with a few tricks, > > although I doubt it matters in practice. ] > > > > Ok, but this still limits returning error string to the > perf_event_open() syscall, not read(), ioctl() and such. Yes - but this should be enough to handle most of the cases in practice - because the richness of the various perf components is mostly exposed via the perf syscall. By the time we get to read() and ioctl() we are in a pretty well defined domain. Also, I don't think people want the (small but nonzero) overhead of extended error reporting for read or ioctl. > I am fine with this change. However, I think it should be > added separately from my inst_retired:prec_dist patch. It has > a broader impact. Most definitely. Thanks, Ingo -- 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/