Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755455AbbHYJDA (ORCPT ); Tue, 25 Aug 2015 05:03:00 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:33100 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754951AbbHYJC4 (ORCPT ); Tue, 25 Aug 2015 05:02:56 -0400 Date: Tue, 25 Aug 2015 11:02:52 +0200 From: Ingo Molnar To: Johannes Berg Cc: Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, adrian.hunter@intel.com, Arnaldo Carvalho de Melo , Vince Weaver , Stephane Eranian Subject: Re: [PATCH v2 0/6] perf: Introduce extended syscall error reporting Message-ID: <20150825090252.GB22414@gmail.com> References: <1440426780-27227-1-git-send-email-alexander.shishkin@linux.intel.com> <1440492739.2192.7.camel@sipsolutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1440492739.2192.7.camel@sipsolutions.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1727 Lines: 35 * Johannes Berg wrote: > On Mon, 2015-08-24 at 17:32 +0300, Alexander Shishkin wrote: > > > This time around, I employed a linker trick to convert the structures > > containing extended error information into integers, which are then > > made to look just like normal error codes so that IS_ERR_VALUE() and > > friends would still work correctly on them. So no extra pointers in > > the struct perf_event or anywhere else; the extended error codes are > > passed around like normal error codes. They only need to be converted > > in syscalls' topmost return statements. This is done in 1/6. > > For the record, as we discussed separately, I'd love to see this move to more > general infrastructure. In wireless (nl80211), for example, we have a few > hundred (!) callsites returning -EINVAL, mostly based on malformed netlink > attributes, and it can be very difficult to figure out what went wrong; > debugging mostly employs a variation of Hugh's trick. Absolutely, I suggested this as well earlier today, as the scheduler would like to make use of it in syscalls with extensible ABIs, such as sched_setattr(). If people really like this then we could go farther as well and add a standalone 'extended errors system call' as well (SyS_errno_extended_get()), which would allow the recovery of error strings even for system calls that are not easily extensible. We could cache the last error description in the task struct. 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/