Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp694772yba; Fri, 26 Apr 2019 07:17:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpvaz+JF3CMG5K2vPszhCdYvcFIA0eR39YyarDRLzuSefJ4m/7swDBhz+WKyR22FcRMtgC X-Received: by 2002:a63:3284:: with SMTP id y126mr44126716pgy.424.1556288255813; Fri, 26 Apr 2019 07:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556288255; cv=none; d=google.com; s=arc-20160816; b=MYnH+uWJDaay66+qpD9yE3HeKPAHUh3S+xrJSm8JjjO6cTgS7MLAy05boaEb8ZTsP1 wz/T2G1wJRwflSbHoB22BbTU570ixmQPSxPegutZf15oNrsKI0pygE7BT6fuPuJp076N FU31YKgViy6nMQ6iLfntb2e+KstMORGgzvDCo8ZEcyXtk9SQ+NJRwv7QwQSfYENU7Gbw hQ0w8LDaxY60d4wOZDZl49q5Td4dbVlb5GID2e2+9t73kUju3GXYSQtuI/rvhph/2lnF HfT8vqgcOErlr+prjcv0hx30ZbRd4wKf4Xr0vJBQAya+VnU3+yXKMiLhsAkgWlO3gqbF yOLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=dP7J+8nxZ+kjQW0DXZh/ipoOUjxFN2AVNPeNAiwfJxY=; b=ad6Mj8eoFuxAXwzvGMez6z1kZMR+IkyiKf2OOuq/ysXOtRXsHMF69iX+PzZFzYUHlZ FHVWk//Nl2dqSM4ZaxXgMgYbix5adW3G4KbEbR/uCPUb6yXcoZYQ2sSv1mXftApi09IZ WmMl4+bZJ+PWlc1lrMVhsHobpX4DHutWqyj6s+GboBBo3rCNkVhsCC57wCvhcPzQzzqT kAkXiKe0Q6sJFnEn/GSbd9f8njzjTkB0WI2BGFOgSK2sX1+rhVzWQfDb3EY6P9FNFxjR YvNnNIqT6C2/b78d9QRhLePKgPxQXiVuP52VvvfKlCxWLwKY8eogeFBm+LrmSB0REPpc U2Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OhUNbksF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a67si26352831pla.350.2019.04.26.07.17.20; Fri, 26 Apr 2019 07:17:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OhUNbksF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726322AbfDZOQR (ORCPT + 99 others); Fri, 26 Apr 2019 10:16:17 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:35577 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726138AbfDZOQR (ORCPT ); Fri, 26 Apr 2019 10:16:17 -0400 Received: by mail-qk1-f193.google.com with SMTP id n81so1970410qke.2; Fri, 26 Apr 2019 07:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=dP7J+8nxZ+kjQW0DXZh/ipoOUjxFN2AVNPeNAiwfJxY=; b=OhUNbksF262Q+nK/cgPWUTRrf8B1Ebw6XCxSNsHsyPLz9oLG+g4X7/gpW1teasMUlZ pEzRgilgCHx9we68ks8GLNAQC1+uv3BpxaSK2kFVvoyrTFSrMThHPdtyW2WO32JVbjrG +ZtNVeokJr8LK6iKoVhGlwVE+Pykrrb/yJcJBQWREjwXeV5TbfTkvEC/IUYBhkIt2xal 9x0lFa3EeFlwBYtqBeCwNywGOJkoHRHoNe+1SYXUC0KYQOdeBC3EtoxTDXLW98TiqREi T5rMVtM1PjRbX1pImMmYb/E46kHK0Nira0y9YRWMvUrMtiRwzZYwwIi8Z+vS7C1hUhKc lrGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=dP7J+8nxZ+kjQW0DXZh/ipoOUjxFN2AVNPeNAiwfJxY=; b=fUGAKqtI3xstoSJ6fNQEhNMjRO8EgcHBJ3awzdoX2exq5lYD8c9RqHZAzdMaLU/sPO K0IHLrXRSH5T4lkWLj5WiXOJNW6apoLHiLcJQoTvl/8HZpFQwy331Gki7X2lhmEoynXa M4lDBcKxPTkgGEpUUn/n6uKHHTdDvKgt5XnWWc/RP77p5iM5R6UKfGUYmlHQtPTcgkHw VxkKAaanYFRMgKPdB3AP4XokYCKarZTtzv1Z8lZmS0Sgz61vkYur9RVYlhR3xrQz4dnY +g39vzOTeDagaEQ2o8n6iWftdI/8vUznhMEg/xEkaq+RoMIZYROrUkxyfBIKgnIU+53s uKZA== X-Gm-Message-State: APjAAAVO/qYDPth7LrIeXN+49/b52xwEwvPlpy7TRo2OIod4SwrDtpDQ oJL5I8eh9xjoMuje4Z/rdSqdnhKJ X-Received: by 2002:a05:620a:1403:: with SMTP id d3mr7926683qkj.167.1556288175884; Fri, 26 Apr 2019 07:16:15 -0700 (PDT) Received: from quaco.ghostprotocols.net ([190.15.121.82]) by smtp.gmail.com with ESMTPSA id g50sm2625357qtg.83.2019.04.26.07.16.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Apr 2019 07:16:14 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E5A8341120; Fri, 26 Apr 2019 11:16:07 -0300 (-03) Date: Fri, 26 Apr 2019 11:16:07 -0300 To: Thomas Richter Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, jolsa@redhat.com Subject: Re: [PATCH] perf/report: Report OOM in perf report status line Message-ID: <20190426141607.GB23426@kernel.org> References: <20190423105303.61683-1-tmricht@linux.ibm.com> <20190426140907.GB22086@kernel.org> <20190426141032.GA23426@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190426141032.GA23426@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Apr 26, 2019 at 11:10:32AM -0300, Arnaldo Carvalho de Melo escreveu: > Em Fri, Apr 26, 2019 at 11:09:07AM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Tue, Apr 23, 2019 at 12:53:03PM +0200, Thomas Richter escreveu: > > > An -ENOMEM error is not reported in the GTK GUI. > > > Instead this error message pops up on the screen: > > > > > > [root@m35lp76 perf]# ./perf report -i perf.data.error68-1 > > > > > > Processing events... [974K/3M] > > > Error:failed to process sample > > > > > > 0xf4198 [0x8]: failed to process type: 68 > > > > Thanks, applied to perf/urgent. > > Well, I tried to, now trying to fix this... > > > [acme@quaco perf]$ m > make: Entering directory '/home/acme/git/perf/tools/perf' > BUILD: Doing 'make -j8' parallel build > INSTALL GTK UI > INSTALL trace_plugins > CC /tmp/build/perf/util/session.o > util/session.c: In function ‘perf_session__process_events’: > util/session.c:1936:7: error: ‘skip’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > err = skip; > ~~~~^~~~~~ > util/session.c:1874:6: note: ‘skip’ was declared here > s64 skip; > ^~~~ > cc1: all warnings being treated as errors > mv: cannot stat '/tmp/build/perf/util/.session.o.tmp': No such file or directory > make[4]: *** [/home/acme/git/perf/tools/build/Makefile.build:96: /tmp/build/perf/util/session.o] Error 1 > make[3]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2 > make[2]: *** [Makefile.perf:559: /tmp/build/perf/perf-in.o] Error 2 > make[1]: *** [Makefile.perf:215: sub-make] Error 2 > make: *** [Makefile:110: install-bin] Error 2 > make: Leaving directory '/home/acme/git/perf/tools/perf' So, here is your patch: diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index b17f1c9bc965..e89716175588 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1930,10 +1930,10 @@ reader__process_events(struct reader *rd, struct perf_session *session, if (size < sizeof(struct perf_event_header) || (skip = rd->process(session, event, file_pos)) < 0) { - pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", + pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n", file_offset + head, event->header.size, - event->header.type); - err = -EINVAL; + event->header.type, strerror(-skip)); + err = skip; goto out; } [acme@quaco perf]$ What happens if (size < sizeof(struct perf_event_header)) is true? size will have an undefined value, so the right thing is to have this patch on top of yours, so that err get, as before, set to -EINVAL when the size is less than the perf_event_header sizeof: diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index e89716175588..bad5f87ae001 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1928,6 +1928,8 @@ reader__process_events(struct reader *rd, struct perf_session *session, size = event->header.size; + skip = -EINVAL; + if (size < sizeof(struct perf_event_header) || (skip = rd->process(session, event, file_pos)) < 0) { pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n", --- With two Reviewed-by tags, I jumped to quickly at applying, please compile test next time guys ;-) :-) - Arnaldo