Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2594613pxu; Mon, 14 Dec 2020 06:28:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDkHFcj+SlaJXqHnQx7TOl+IGkJQNzFzZMJU3hUkKX2ItaQb8OJekXh/mdb6f7E7ZLE937 X-Received: by 2002:a17:907:1010:: with SMTP id ox16mr22985250ejb.439.1607956100295; Mon, 14 Dec 2020 06:28:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607956100; cv=none; d=google.com; s=arc-20160816; b=yVlUSQujQI3GWxolIaz7GWQGk6M7BRDWW9e73mWHPy5q/2SAKtI8506YlOjD+Mwuwl R10nv/GBMcWUD269YBNG6PDzAvTAFDNGd5I1eC9jH69YY1dGzEeyCSNqkqH0QAXidPi0 pj+OTpqLescM8Cq3mf2hsEf79Xx+Gvuv4cHSeCZoEorPup/CtfQFh1lZt31/Hwxvok6d yvOACFd6wk1URphW8qpi3u3wslXxx237BkeDFkZJmBEiew5w5QAIKUnF/zOFg/1aBwN1 nWArXUzqcQivI7uhNH5xHd1HwwIgukLh0Cmp6pYhKZwEx78RUlooN5ha7/HfgZE44Xry 2Wbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XpESKO02w6ZjJ3XVe/NMaGFRvLkrDVszd+fnve2B+C4=; b=PQrCPCtE3Jnv8ApluebAsqbNo4foPXUU+KXn4Xnc7cXOoVjBvNfYPP1+6vdTIZdidc QRSrHLdNpFEIqjSlDrOE1pBiNMcaED14unJXS2otKx6y0SpRLdXU5KZ2UCOrGatXrgdE y3LnhhY0GU82l5tO/3GQm9RvCFKNSq11IBvJ4OKorfUnbygAn6m5++W5nbP/K1OJdowH j0tMG4905toaIkdv/SdsJPzd9s+B2TdrQqojSRBfAFEYmT/q8/yoq9dq3TlEg7l53LKQ l4qrcwQqUZvhq084lPT+4Am2DsRcVmNVf/SvdBw90pdo0u3X4hTLScfgey6PYB1tbu2d f+uQ== ARC-Authentication-Results: i=1; mx.google.com; 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 y14si2987605edm.451.2020.12.14.06.27.56; Mon, 14 Dec 2020 06:28:20 -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; 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 S2388406AbgLNK52 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 14 Dec 2020 05:57:28 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:48491 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393359AbgLNK4f (ORCPT ); Mon, 14 Dec 2020 05:56:35 -0500 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-208-KYOu8ZO1OU6V4Gajy3BR0A-1; Mon, 14 Dec 2020 05:55:40 -0500 X-MC-Unique: KYOu8ZO1OU6V4Gajy3BR0A-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 4CEA7800D53; Mon, 14 Dec 2020 10:55:38 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89DDD70481; Mon, 14 Dec 2020 10:55:30 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , Ian Rogers , Stephane Eranian , Alexei Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 05/15] perf tools: Do not swap mmap2 fields in case it contains build id Date: Mon, 14 Dec 2020 11:54:47 +0100 Message-Id: <20201214105457.543111-6-jolsa@kernel.org> In-Reply-To: <20201214105457.543111-1-jolsa@kernel.org> References: <20201214105457.543111-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If PERF_RECORD_MISC_MMAP_BUILD_ID misc bit is set, mmap2 event carries build id, placed in following union: union { struct { u32 maj; u32 min; u64 ino; u64 ino_generation; }; struct { u8 build_id_size; u8 __reserved_1; u16 __reserved_2; u8 build_id[20]; }; }; In this case we can't swap above fields. Signed-off-by: Jiri Olsa --- tools/perf/util/session.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 3b3c50b12791..29593494b67c 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -592,10 +592,13 @@ static void perf_event__mmap2_swap(union perf_event *event, event->mmap2.start = bswap_64(event->mmap2.start); event->mmap2.len = bswap_64(event->mmap2.len); event->mmap2.pgoff = bswap_64(event->mmap2.pgoff); - event->mmap2.maj = bswap_32(event->mmap2.maj); - event->mmap2.min = bswap_32(event->mmap2.min); - event->mmap2.ino = bswap_64(event->mmap2.ino); - event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation); + + if (!(event->header.misc & PERF_RECORD_MISC_MMAP_BUILD_ID)) { + event->mmap2.maj = bswap_32(event->mmap2.maj); + event->mmap2.min = bswap_32(event->mmap2.min); + event->mmap2.ino = bswap_64(event->mmap2.ino); + event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation); + } if (sample_id_all) { void *data = &event->mmap2.filename; -- 2.26.2