Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752631AbbHZU4H (ORCPT ); Wed, 26 Aug 2015 16:56:07 -0400 Received: from fbr03.mfg.siteprotect.com ([64.26.60.138]:53467 "EHLO fbr03.mfg.siteprotect.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752110AbbHZU4F (ORCPT ); Wed, 26 Aug 2015 16:56:05 -0400 X-Greylist: delayed 426 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 Aug 2015 16:56:05 EDT Date: Wed, 26 Aug 2015 16:50:33 -0400 (EDT) From: Vince Weaver X-X-Sender: vince@pianoman.cluster.toy To: Andrew Morton cc: Peter Zijlstra , Ingo Molnar , Johannes Berg , Linus Torvalds , Thomas Gleixner , adrian.hunter@intel.com, Ingo Molnar , Borislav Petkov , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Alexander Shishkin , "H. Peter Anvin" , Stephane Eranian Subject: Re: [PATCH v2 0/6] perf: Introduce extended syscall error reporting In-Reply-To: <20150826132249.fbb2aa602525c7df4a1f86ed@linux-foundation.org> Message-ID: References: <20150825091740.GA23488@gmail.com> <1440495246.2192.13.camel@sipsolutions.net> <20150825100728.GA1820@gmail.com> <1440497981.2192.39.camel@sipsolutions.net> <20150826044948.GC14584@gmail.com> <1440572775.1932.1.camel@sipsolutions.net> <20150826072020.GA19081@gmail.com> <20150826072656.GA19305@gmail.com> <20150826114111.01675d8eadda78d82933d8a5@linux-foundation.org> <20150826200513.GX16853@twins.programming.kicks-ass.net> <20150826132249.fbb2aa602525c7df4a1f86ed@linux-foundation.org> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-CTCH-Spam: Unknown X-CTCH-RefID: str=0001.0A020206.55DE2639.01CB,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2310 Lines: 54 On Wed, 26 Aug 2015, Andrew Morton wrote: > On Wed, 26 Aug 2015 22:05:13 +0200 Peter Zijlstra wrote: > > > > Is this whole thing overkill? As far as I can see, the problem which is > > > being addressed only occurs in a couple of places (perf, wifi netlink > > > handling) and could be addressed with some local pr_debug statements. ie, > > > > > > #define err_str(e, s) ({ > > > if (debugging) > > > pr_debug("%s:%d: error %d (%s)", __FILE__, __LINE__, e, s); > > > e; > > > }) > > > > > > (And I suppose that if this is later deemed inadequate, err_str() could > > > be made more fancy). > > > > Not really. That is something that's limited to root. Whereas the > > problem is very much wider than that. > > > > If you set one bit wrong in the pretty large perf_event_attr you've got > > a fair chance of getting -EINVAL on trying to create the event. Good > > luck finding what you did wrong. > > > > Any user can create events (for their own tasks), this does not require > > root. > > > > Allowing users to flip your @debugging flag would be an insta DoS. > > > > Furthermore, its very unfriendly in that you have to (manually) go > > correlate random dmesg output with some program action. > > It depends on who the audience is. If it's developers who are writing > userspace perf tooling then all the above won't be an issue. If it's > aimed at end users of that tooling then yes. As a developer of tools that use the perf_event interface directly (PAPI and such) I can say this is a common problem (getting unexplained EINVAL results) and yes, telling the user to recompile their kernel to enable debugging is usually not an option. I often have to resort to sprinkling the kernel with printks to find the source of errors, which is a pain. It's even more fun when the user's setup is slightly different enough that I can't reproduce the issue on a local machine, which happens often (due to different kernels, distros backporting perf fixes, different hardware, different security settings, etc). Vince -- 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/