Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932465AbbHYIwc (ORCPT ); Tue, 25 Aug 2015 04:52:32 -0400 Received: from s3.sipsolutions.net ([5.9.151.49]:37859 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932203AbbHYIw3 (ORCPT ); Tue, 25 Aug 2015 04:52:29 -0400 Message-ID: <1440492739.2192.7.camel@sipsolutions.net> Subject: Re: [PATCH v2 0/6] perf: Introduce extended syscall error reporting From: Johannes Berg To: Alexander Shishkin , Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, adrian.hunter@intel.com, Arnaldo Carvalho de Melo , Vince Weaver , Stephane Eranian Date: Tue, 25 Aug 2015 10:52:19 +0200 In-Reply-To: <1440426780-27227-1-git-send-email-alexander.shishkin@linux.intel.com> References: <1440426780-27227-1-git-send-email-alexander.shishkin@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1692 Lines: 36 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. It would be absolutely necessary to support modules, however that could get tricky: unless we pass a THIS_MODULE through in some way to netlink_ack() (in the nl80211 case) we'd have to store the actual index inside the err_site and assign it on module load somehow. Passing the module pointer seems better, but has even more wrinkles like what to do when the error came from a nested call (e.g. nla_parse()) that's in a different modules ... Unrelated to all that - maybe perf_errno_to_site() should have some range checking? johannes -- 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/