Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp560060imm; Fri, 15 Jun 2018 02:27:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLsBQZjRJZ4vSev2VTQRV1ZzIMuyIFVlxRv7ypfC4I2zFvMEg89XgCuKhml5hU/cpMFTUAU X-Received: by 2002:a65:4841:: with SMTP id i1-v6mr846158pgs.75.1529054864093; Fri, 15 Jun 2018 02:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529054864; cv=none; d=google.com; s=arc-20160816; b=yxKsyKJ5g8jH9EUTej1r4dnr4zDJAFuB1dMnd/kT70o7wZ/kO0FAHlNFu9+e+yMr8D Gc7Sy++csLLNFPSq2Ed1/b24gQJt9vdy7hG8vj6BqvcAaDuQ3CBpyN0GueGvMiHjVOyR vJ5cwl4I/0NvMq6QelBp/o/s6hoXIuHIq9zlQ2Qi0Q8tKFE28SKyDx6u3/psqWpOyub4 HPBE+QGxCiDv2QM4AmJj/ymDsCzDujB+tZmzOelNJdoJSUw0SclfhanmG9Edrr4QHa8l zoYTx26Q8uZaRSSTNFqV4Jtdd+irjiRx6zUV4l5D6UuI/kH6v7YBchYoXp7/Ipe7gAQc ZcBw== 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:arc-authentication-results; bh=hlmGeOAL1QS9//acTt9w26PRxyrTHnM6u8ofaISupbk=; b=r4w9fW3sNV+/3dAk+Ujel9jRfb52HYLPT6o2aoETF0ruwCCA+TDpawRc+qKFLbbuSg vmD991yMNTqlTa3ULa8WhHSpvYRqQlraYMVT+SyopgAZeI9V3TB6//Ts/+YudZKHHotx 1FIXdqFJh3ORPLY7W80hqgD/Rtm51+fq0x0FM6q84ftKVBOG2eIQeRigBj3LzrzDiVah ToliLpIcbTdvinceLhxfYSaDhYRZLhlq8Xq7SzrbiretrErXf1z+izfwnJsrNftZhHXY YU5qAsyR8s3umSW0i3at5aPvbqLTVp3JdDr94h2T4G/XiENrHw4e5uJUCafKgM9ucFve PD3A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13-v6si7143265pfh.215.2018.06.15.02.27.29; Fri, 15 Jun 2018 02:27:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755816AbeFOJ1D (ORCPT + 99 others); Fri, 15 Jun 2018 05:27:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60366 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755597AbeFOJ1C (ORCPT ); Fri, 15 Jun 2018 05:27:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 266DEF68B9; Fri, 15 Jun 2018 09:27:02 +0000 (UTC) Received: from krava (unknown [10.43.17.64]) by smtp.corp.redhat.com (Postfix) with SMTP id D0DDE20284D6; Fri, 15 Jun 2018 09:27:00 +0000 (UTC) Date: Fri, 15 Jun 2018 11:27:00 +0200 From: Jiri Olsa To: Thomas-Mich Richter Cc: Paul Clarke , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Subject: Re: [PATCH 2/3] perf alias: Rebuild alias expression string to make it comparable Message-ID: <20180615092700.GH5082@krava> References: <20180614114845.41221-1-tmricht@linux.ibm.com> <20180614114845.41221-2-tmricht@linux.ibm.com> <809ff562-511d-26e9-bac3-e8f7b84666e5@us.ibm.com> <20180615081242.GF5082@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 15 Jun 2018 09:27:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 15 Jun 2018 09:27:02 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 15, 2018 at 11:09:05AM +0200, Thomas-Mich Richter wrote: > On 06/15/2018 10:12 AM, Jiri Olsa wrote: > > On Thu, Jun 14, 2018 at 08:53:14AM -0500, Paul Clarke wrote: > > > > SNIP > > > >>> + if (ret) > >>> + ret += scnprintf(newval + ret, sizeof(newval) - ret, > >>> + ","); > >>> + if (term->type_val == PARSE_EVENTS__TERM_TYPE_NUM) > >>> + ret += scnprintf(newval + ret, sizeof(newval) - ret, > >>> + "%s=%#x", term->config, term->val.num); > >>> + else if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR) > >>> + ret += scnprintf(newval + ret, sizeof(newval) - ret, > >>> + "%s=%s", term->config, term->val.str); > >> > >> If we exceed 256, we just suddenly terminate the rebuilding without reporting any issues. > >> > >>> + } > >>> + > >>> alias->name = strdup(name); > >>> if (dir) { > >>> /* > >>> @@ -285,7 +308,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, > >>> snprintf(alias->unit, sizeof(alias->unit), "%s", unit); > >>> } > >>> alias->per_pkg = perpkg && sscanf(perpkg, "%d", &num) == 1 && num == 1; > >>> - alias->str = strdup(val); > >>> + alias->str = strdup(newval); > > > > hum, how is newval different from val? AFAICS it's the same > > > > Not really, depends on the platform, here is some debug output from s390: > root@s35lp76 perf]# ./perf stat -e tx_nc_tend -- ~/mytesttx 1 >/tmp/111 > > Performance counter stats for '/root/mytesttx 1': > > 1 tx_nc_tend > > 0.001050150 seconds time elapsed > > [root@s35lp76 perf]# fgrep -i tx_nc_tend /tmp/111 > __perf_pmu__new_alias TX_NC_TEND val:event=0x008d newval:event=0x8d > __perf_pmu__new_alias tx_nc_tend val:event=0x8d newval:event=0x8d > TX_NC_TEND 1 rc 8 > [root@s35lp76 perf]# > > On s390 the events in the PMU sysfs file are printed with leading zeroes. > This means the strcmp() of alias->str differs, but the contents is logically > identical. (Same of some files contains spaces). > > Thats why I do the rewrite of val into newval. > > The alias name does not match too, but we use strcasecmp() to ignore case. > > Hope this helps. yep.. should have read the full change log ;-) thanks jirka