Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702AbcDVN0a (ORCPT ); Fri, 22 Apr 2016 09:26:30 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:42648 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751933AbcDVN03 (ORCPT ); Fri, 22 Apr 2016 09:26:29 -0400 From: Lada Trimasova To: "linux-perf-users@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , "peterz@infradead.org" , Alexey Brodkin , "linux-snps-arc@lists.infradead.org" Subject: Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT Thread-Topic: Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT Thread-Index: AQHRnJpsTIMVptKVlEi1yzoTFOg9aw== Date: Fri, 22 Apr 2016 13:25:23 +0000 Message-ID: <1461331523.3403.11.camel@synopsys.com> Reply-To: Lada Trimasova Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.8.149] Content-Type: text/plain; charset="utf-8" Content-ID: <5C805D6E99359D4BB0532FDF482A3121@internal.synopsys.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u3MDQZ3i017528 Content-Length: 1436 Lines: 32 I have a question about user-space perf handling error numbers. The problem is that PMU interrupts are not supported in arc700 architecture and it is impossible to evaluate `perf record` command. In our perf implementation we set PERF_PMU_CAP_NO_INTERRUPT flag so core perf infrastructure knows we don't have interrupts. Kernel `sys_perf_event_open` handler checks if PMU interrupts are supported and returns ENOTSUPP (524) error code. I'd expect that perf implementation checks the return value of syscalls and gives the user understandable error message. But now I see: --------------------------------->8----------------------------------- # perf record ls The sys_perf_event_open() syscall returned with 524 (Unknown error 524) for event (cycles:ppp). /bin/dmesg may provide additional information. No CONFIG_PERF_EVENTS=y kernel support configured? --------------------------------->8----------------------------------- As you can see the root cause of this error message is not obvious. CONFIG_PERF_EVENTS is selected but still there's a problem while existing suggestion barely makes any sense. So probably there could be a way to determine if CONFIG_PERF_EVENTS was selected or not. I am not sure about the correct way of solving this problem. Maybe I should add some checks of syscalls return values and give user a warning when not PMU interrupts are available.  Any suggestions are appreciated. Regards, Lada Trimasova.