Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp666886pxb; Fri, 14 Jan 2022 13:34:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXXgRi8pQnm5jBkpgHOaqsKGUkkAbnckHvIj0aktTnuEQXHAZHIIsxi2U5Lz2+UDIu9Gu7 X-Received: by 2002:a17:90b:3910:: with SMTP id ob16mr7958113pjb.88.1642196052327; Fri, 14 Jan 2022 13:34:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642196052; cv=none; d=google.com; s=arc-20160816; b=qJWJEEYejk61IJJ+alz3kTofH7kBcypgrK/4JusGZY6nUK16d6BI7fwfiJs4nfbWf6 TQCbXp+LP9THzup5xMEx26b0Bnoanlw2AlP5P3OLAg5wYNUKr86KxTeYbDvGfxV2ZrO8 oBZ2uRjjIPpofJkcJe4fclJB0C6QRIPQd/0uit7nr+JMbkJnxpqL8ymAXIkFBD0Qb6Fu /iJ69TJyAD8RqbyWMyjKpp67cNVaqh5xC0X8p9fRJYfxPlO5pauR7eq3rk2H/DPfrsOj B3C+Q8Ka4Gf5qOWj0L7Sgqe8U5mRtktJps03Bo+HhoNH57DdP5YPTM7syrJa5lZYyOoD EG9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ogW1WUCRemv6NhgW34kbuO+FJz8dTiPzNnuNp5biSEc=; b=JKSOQGqmIsMjhJMlL5Is5CIUFoF3YDDtIacCWLNvfEr+hcZ+JgkhndE8pIdkUq2a9L YkzJ40o7P9B86xqRn1tPVSbhIfUkq9JhGYf80kR2mg+0Q+/tZH4wj2CGYvleCbfDK5+7 VVHi4xHwD1Z05oc5iqUbk8FTrfC/cm7bIe/95U5MMB6V/GUcUOdxuYBd9/O+0ocUjWpc wtdOQbidGYXm4EK1aVLA7sZUGooa0zzawHhb5++EPKwzJZTXNXVor6JyxmONxljbpIY+ 3pm4WGa47aui4jjl6xb4bsT8ighy7u3Ggvy8WweNKjyex7SxZ3jZaSSpRxH2BP1X1nCs 2hBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CQuyq2Xe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id c9si6926891pgp.674.2022.01.14.13.34.00; Fri, 14 Jan 2022 13:34:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CQuyq2Xe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242043AbiANOvp (ORCPT + 99 others); Fri, 14 Jan 2022 09:51:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237563AbiANOvo (ORCPT ); Fri, 14 Jan 2022 09:51:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC83DC061574; Fri, 14 Jan 2022 06:51:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A650EB8262B; Fri, 14 Jan 2022 14:51:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C758C36AE5; Fri, 14 Jan 2022 14:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642171901; bh=yaOizYp7PqICnKbARXVt6Mn6FZ+YHOUAoV2+IK4tmiw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CQuyq2XeyO/ZVqqJ03lbcrYTW49tCagXH8m5AOyKHsEuwIt8xWcTnM9/Ai9OzlYPX bwRngRNMxKIEIOof2lpqsWdXoOj0pOD9qujfiWx3xlxDQXFNX67IegUzuCGVIZe6dr 1PYgjk+7Jx4jmTie63tel8L4G9FDADGCmCOnp3koxVslgMSBB4NME2VOoraDpoZ0VB vLW8YQzYe4+cgJgIBeZMV+YXzGptqbbkHkWyzrJZLW4pwu1/vNSr/W+Dr4b8ZPa2OG dKCjsswx2/sM3qnKuJ2LUFG6aqmXkz+TrPeW9mUyipMG2qbTojT3k1CfY05+A1fBJY zn9ddk0iGUCRQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id CC62840714; Fri, 14 Jan 2022 11:51:38 -0300 (-03) Date: Fri, 14 Jan 2022 11:51:38 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Thomas Richter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, svens@linux.ibm.com, gor@linux.ibm.com, sumanthk@linux.ibm.com, hca@linux.ibm.com Subject: Re: [PATCH] tools/perf: Fix perf test 7 Simple expression parser on s390 Message-ID: References: <20211124090343.9436-1-tmricht@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Nov 24, 2021 at 07:41:40AM -0800, Ian Rogers escreveu: > On Wed, Nov 24, 2021 at 1:04 AM Thomas Richter wrote: > > > > Commit fdf1e29b6118 ("perf expr: Add metric literals for topology.") > > fails on s390: > > # ./perf test -Fv 7 > > ... > > # FAILED tests/expr.c:173 #num_dies >= #num_packages > > ---- end ---- > > Simple expression parser: FAILED! > > # > > > > Investigating this issue leads to these functions: > > build_cpu_topology() > > +--> has_die_topology(void) > > { > > struct utsname uts; > > > > if (uname(&uts) < 0) > > return false; > > if (strncmp(uts.machine, "x86_64", 6)) > > return false; > > .... > > } > > > > which always returns false on s390. The caller build_cpu_topology() > > checks has_die_topology() return value. On false the > > the struct cpu_topology::die_cpu_list is not contructed and has zero > > entries. This leads to the failing comparison: #num_dies >= #num_packages. > > s390 of course has a positive number of packages. > > > > Fix this by adding s390 architecture to support CPU die list. Thanks, applied. - Arnaldo > > Output after: > > # ./perf test -Fv 7 > > 7: Simple expression parser : > > --- start --- > > division by zero > > syntax error > > ---- end ---- > > Simple expression parser: Ok > > # > > Cc: Ian Rogers > > Fixes: fdf1e29b6118 ("perf expr: Add metric literals for topology.") > > > > Signed-off-by: Thomas Richter > > Reviewed-by: Ian Rogers > > Thanks! > Ian > > > --- > > tools/perf/util/cputopo.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c > > index 51b429c86f98..aad7a9e6e31b 100644 > > --- a/tools/perf/util/cputopo.c > > +++ b/tools/perf/util/cputopo.c > > @@ -165,7 +165,8 @@ static bool has_die_topology(void) > > if (uname(&uts) < 0) > > return false; > > > > - if (strncmp(uts.machine, "x86_64", 6)) > > + if (strncmp(uts.machine, "x86_64", 6) && > > + strncmp(uts.machine, "s390x", 5)) > > return false; > > > > scnprintf(filename, MAXPATHLEN, DIE_CPUS_FMT, > > -- > > 2.31.1 > > -- - Arnaldo