Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp560068ybg; Tue, 9 Jun 2020 07:22:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy16+4c6tqTtyDCeluBNhrX2Rf2n4TTLC68VwcaT8v8AU2hIDvzLAQtnhntEIvLY9E7f/27 X-Received: by 2002:a50:fd19:: with SMTP id i25mr26801376eds.248.1591712552140; Tue, 09 Jun 2020 07:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591712552; cv=none; d=google.com; s=arc-20160816; b=j80ZK4xeXUg8Gpq2+K37yTrtlnoGwi7FTn6lQQdMpn9GkZ/adBwJudbAxFBZtVaiK8 LRWkNS86c6KEFvCt8v0WcXVEATl+l5blKQfbbPvbkyXLjyRK0bNNhmzSABUvx/ELaQ0G VlHBgHR8JqTo2lOtnuIiLN5z3911qyIUgC0sX97W9qDNLRLUloKDKCPxXK7JMdKRXERp EaIIOYCMz2O1XcRWTtSxJ+Rbcq+nHmz6JzqEFIBlnD05cyV95GKGYTevJ6rzzU1iM3IB Lw5wqAbgTgRxNA4SWpPhY1HyBYWkizHXsOzki+0P/x+fpn7pdzdFHT5x49Y0LDRP1EjM v8IQ== 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; bh=YVbTooBt4UUkS5UYs7zdbnUxyfMbXNuMElqnNvrjHoA=; b=POIfE8u33RYMlBIG/j3rSuKVJK6k3Lo19fI/wz2d8h0h3TItWxtAmBhIEqBzrecPT0 nbGXxrZayTvu+47SnJmOQBS5NqVVMxKnOFIVhhXjjaLhxDtdmZCj5+Nwkhq8Gawkw/Qb R9xx2jFozKvZwdOR6QfFysBex93ofXE2cBNGNosx8lVB4evNWy6CkmIcMkKCWUp6aRwI 3K3I6H5U/xm1poCCgLoTIFLUb+vYZbNWCW1gLFBvkOqZYyvPoupsT3607lfzup76+Plw rAIdUImtuSH1jp4zoVz+7cqN/UGiB5Z6zThLMzP4Qw3+kJFIIk4tpzcKPqmLEw3Vs0J0 tB2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LdBf5J1S; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oi20si11213519ejb.571.2020.06.09.07.22.07; Tue, 09 Jun 2020 07:22:32 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=LdBf5J1S; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730177AbgFIOQ4 (ORCPT + 99 others); Tue, 9 Jun 2020 10:16:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34674 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728338AbgFIOQz (ORCPT ); Tue, 9 Jun 2020 10:16:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591712214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YVbTooBt4UUkS5UYs7zdbnUxyfMbXNuMElqnNvrjHoA=; b=LdBf5J1Sxe4DKl63+fNvwNimaGGlh5NmNB8xkPzwK4bABrtD93iDLyKBoJ7Nf/giIauACg mmcWQlLdx0NYiq5enPOpjaIS1xYjWbd8HYeV95hRb/LAw43Rm2qJMBmxk+DdQyeS+Uj6mt G/5qYAzMpi2VrP6zWb5jpBNrIvg3MrQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-510-ZhSurra8O_2w3QnNQbqLZQ-1; Tue, 09 Jun 2020 10:16:51 -0400 X-MC-Unique: ZhSurra8O_2w3QnNQbqLZQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CF2BA464; Tue, 9 Jun 2020 14:16:50 +0000 (UTC) Received: from sandy.ghostprotocols.net (unknown [10.3.128.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 690AF8202B; Tue, 9 Jun 2020 14:16:50 +0000 (UTC) Received: by sandy.ghostprotocols.net (Postfix, from userid 1000) id 378671D1; Tue, 9 Jun 2020 11:16:47 -0300 (BRT) Date: Tue, 9 Jun 2020 11:16:47 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Stephane Eranian , LKML , Jiri Olsa , Peter Zijlstra , mingo@elte.hu Subject: Re: [PATCH] perf headers: fix processing of pmu_mappings Message-ID: <20200609141647.GA10172@redhat.com> References: <20200608161805.65841-1-eranian@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Jun 08, 2020 at 09:52:43AM -0700, Ian Rogers escreveu: > On Mon, Jun 8, 2020 at 9:18 AM Stephane Eranian wrote: > > This patch fixes a bug in process_pmu_mappings() where the code > > would not produce an env->pmu_mappings string that was easily parsable. > > The function parses the PMU_MAPPING header information into a string > > consisting of value:name pairs where value is the PMU type identifier > > and name is the PMU name, e.g., 10:ibs_fetch. As it was, the code > > was producing a truncated string with only the first pair showing > > even though the rest was there but after the \0. > > This patch fixes the problem byt adding a proper white space between > > pairs and moving the \0 termination to the end. With this patch applied, > > all pairs appear and are easily parsed. > > Before: > > 14:amd_iommu_1 > > After: > > 14:amd_iommu_1 7:uprobe 5:breakpoint 10:amd_l3 19:amd_iommu_6 8:power 4:cpu 17:amd_iommu_4 15:amd_iommu_2 1:software 6:kprobe 13:amd_iommu_0 9:amd_df 20:amd_iommu_7 18:amd_iommu_5 2:tracepoint 21:msr 12:ibs_op 16:amd_iommu_3 11:ibs_fetch Please check print_pmu_mappings() in tools/perf/util/header.c Before your patch: [root@five ~]# perf report --header-only | grep "pmu mappings" # pmu mappings: amd_df = 8, software = 1, ibs_op = 11, ibs_fetch = 10, uprobe = 7, cpu = 4, amd_iommu_0 = 12, breakpoint = 5, amd_l3 = 9, tracepoint = 2, kprobe = 6, msr = 13 [root@five ~]# After your patch: [root@five ~]# perf report --header-only | grep "pmu mappings" # pmu mappings: amd_df 1:software 11:ibs_op 10:ibs_fetch 7:uprobe 4:cpu 12:amd_iommu_0 5:breakpoint 9:amd_l3 2:tracepoint 6:kprobe 13:msr = 8# pmu mappings: unable to read [root@five ~]# I think having it space separated, as you propose, is best, but haven't checked if there are other cases that process ff->ph->env.pmu_mappings and expect it to be \0 separated, like print_pmu_mappings(). Regards, - Arnaldo