Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3588129imm; Fri, 25 May 2018 08:11:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq0O7AqFtJ76REJ5S11YfG+squCIkRY78Ir88OUssLVPFFw6q6WH30G8TbrfYQGLMMGSPPb X-Received: by 2002:a62:4589:: with SMTP id n9-v6mr2986640pfi.158.1527261119159; Fri, 25 May 2018 08:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527261119; cv=none; d=google.com; s=arc-20160816; b=naIMBJ6iJSVsqBIDz2c2uOEnroyBR0nnRfI413helQxc1Z8mM0iPLI0RbTjduKTCLL je0/3tc/1fLBgpmkzfTi/yyFreYkDrq34AuxdpsMqmflASCOu0R2UqsnzSKohAHwLCI/ 6HC20joZb1ATC43tENQxhXJnmUYq6k6+M9MSwFqp8ze0wRw8rpHk7OG9vAcmMu5toOwd EyCPnp+kmz52HOKwnE5b7gxWQmOmTkudURKqgDDqz8IKCXnsvcQx9sN8mhCtvoNhsEQy +EClr/xFfxynpJvkBPJWgxZqRkY2VVHgiRAAAm2kQYsLsqKTVzgVMXRleGGRIWdJlCad qplA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=5zBM8SSpizcZl43q//o3iU44e69bIp4Ih6/WJrauv6U=; b=C9dRMlrjwtpk1jD0DJaEKeX7/kOW8LWcoDz1Ur1CC5gaZUOViS19k0skBH+GAhD5Ol hH7En08hIQga+4gw3hVREyD3ASdIdiZejyLBdz5TSfxrFQ7a4c9nY7etGGLnzNndq50V ropdDjrszhccnHVRxgu5U7L26V7vKoPrjPOnOqNjvv1zLAb0IeXFjmpaLB+kL6hgYKKU 5Y+ydNcdbHYIcmvdkF+eUtjBfYCz8IK3uOSa6UxO/wiHufLXG6p701ZuNjKuITW1fsAR QWV78+L272A2YPZVqa3zI0tGpgBuyusd8f/8i0TDdbvdbHcKuu43ibOUz85xYiB4Y1oO L1DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S7Ba2CrM; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5-v6si6973859pll.237.2018.05.25.08.11.23; Fri, 25 May 2018 08:11:59 -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=@kernel.org header.s=default header.b=S7Ba2CrM; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936295AbeEYPLL (ORCPT + 99 others); Fri, 25 May 2018 11:11:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:41092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936185AbeEYPLJ (ORCPT ); Fri, 25 May 2018 11:11:09 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB9DB20848; Fri, 25 May 2018 15:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527261069; bh=RbcaqeVUW4eulj9OknS88ofLRe2reF6MoLBvk0TI3Co=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S7Ba2CrMLidAm9UdFBPo7c8lNhksJzT8zZxBsWznhCUINr1c6r81+tZ4uHApx9mpQ GTYhS695LzIqFCAcviM4zLvl5212mIx2nKlrp8oFd1CvJ5m/ptfiaI5akRCzV6aArW 8DAm7Y0KtJBBiE32XuJkSvOh7hRZjdXEGSpAQCyE= Received: by jouet.infradead.org (Postfix, from userid 1000) id 8B5AF1468A6; Fri, 25 May 2018 12:11:06 -0300 (-03) Date: Fri, 25 May 2018 12:11:06 -0300 From: Arnaldo Carvalho de Melo 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 Subject: Re: [PATCH] perf test 39 (Session topology) dumps core on s390 Message-ID: <20180525151106.GB4091@kernel.org> References: <20180524135600.77128-1-tmricht@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180524135600.77128-1-tmricht@linux.ibm.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, May 24, 2018 at 03:56:00PM +0200, Thomas Richter escreveu: > perf test 39 fails with core dump on s390. The root cause > is a NULL pointer reference in function check_cpu_topology() > line 76 (or line 82 without -v). > The session->header.env.cpu variable is NULL because on s390 > function process_cpu_topology() returns with error: > socket_id number is too big. > You may need to upgrade the perf tool. > and releases the env.cpu variable via zfree() and sets it to NULL. > > Here is the gdb output: > (gdb) n > 76 pr_debug("CPU %d, core %d, socket %d\n", i, > (gdb) n > > Program received signal SIGSEGV, Segmentation fault. > 0x00000000010f4d9e in check_cpu_topology (path=0x3ffffffd6c8 > "/tmp/perf-test-J6CHMa", map=0x14a1740) at tests/topology.c:76 > 76 pr_debug("CPU %d, core %d, socket %d\n", i, > (gdb) > > Make sure the env.cpu variable is not used when its NULL. > Test for NULL pointer and return TEST_SKIP if so. Ok, but can you please add a comment just before the added lines: + if (!session->header.env.cpu) + return TEST_SKIP; + Informing that this is so due to some bug, i.e. why is that process_cpu_topology() returns with that "socked_id is too big" message? This way people interested in auditing the tests to figure out why some tests are being skipped can validate that comment and possibly come up with some fix or better warning message after the "Skip" after that 'perf test' entry? - Arnaldo > Output before: > [root@p23lp27 perf]# ./perf test -F 39 > 39: Session topology :Segmentation fault (core dumped) > [root@p23lp27 perf]# > > Output after: > [root@p23lp27 perf]# ./perf test -vF 39 > 39: Session topology : > --- start --- > templ file: /tmp/perf-test-Ajx59D > socket_id number is too big.You may need to upgrade the perf tool. > ---- end ---- > Session topology: Skip > [root@p23lp27 perf]# > > Signed-off-by: Thomas Richter > Reviewed-by: Hendrik Brueckner > --- > tools/perf/tests/topology.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c > index 17cb1bb3448c..5f366d650d2b 100644 > --- a/tools/perf/tests/topology.c > +++ b/tools/perf/tests/topology.c > @@ -70,6 +70,9 @@ static int check_cpu_topology(char *path, struct cpu_map *map) > session = perf_session__new(&data, false, NULL); > TEST_ASSERT_VAL("can't get session", session); > > + if (!session->header.env.cpu) > + return TEST_SKIP; > + > for (i = 0; i < session->header.env.nr_cpus_avail; i++) { > if (!cpu_map__has(map, i)) > continue; > @@ -95,7 +98,7 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybe > { > char path[PATH_MAX]; > struct cpu_map *map; > - int ret = -1; > + int ret; > > TEST_ASSERT_VAL("can't get templ file", !get_temp(path)); > > @@ -110,12 +113,9 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybe > goto free_path; > } > > - if (check_cpu_topology(path, map)) > - goto free_map; > - ret = 0; > - > -free_map: > + ret = check_cpu_topology(path, map); > cpu_map__put(map); > + > free_path: > unlink(path); > return ret; > -- > 2.14.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html