Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp686748pxu; Thu, 26 Nov 2020 09:04:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjZgEIxcfUKBCp173NzL7Dg5zlqiybhmdtri1+KigCPCoSwjYlVdZo9+cfzU9hdBT2mR1e X-Received: by 2002:aa7:ce12:: with SMTP id d18mr3459464edv.241.1606410272853; Thu, 26 Nov 2020 09:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606410272; cv=none; d=google.com; s=arc-20160816; b=Sfw+GL8RqNMpvyuI2QFJ3hQqRbD1g8MUPIEUykuslDIMoJPUMeV/QPGlOrsG+PdGL3 jTQW8nhBS+S2xG5K/hTygEMkorUNLQ/N3MRde20IiuDYOBUM+1TLhPJ3+V79hvzGKG5i DxqPgiDGzj3rynq7w/lBxrb4YBh9YcyY72UcYe0QaYWS8duEb461726wcRojMNjv7NgC sfsVVFggQO7HJO8goEkQeC+hHRVQqr80lNHG9NjnaD1+IeTtTG2AaNC74uQhjDS9cXym 9w9UpbHcaSB7y3eLoA0itwwG4ehwKGnuKiSJvXwBZrN5E0SODgbfHP9fmQfp2kphXAMf MoOw== 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=Ff5L9mU5S4akrw0bicOpvpNH4WmPSyxHdHJ1Zyel7/s=; b=jYAyDG/SzvXnGRyhwot/q6irUCfd2L6lVdAFi05vTxq/cQjB0yc0YhnkPAaOFek6EM UIkr+WVwLwzIezdLLYygU65TDl7xM7bNgRIFUaCY2D4AV8vkz7sr/z5418ESOlINsyLO MqPU9gwwd688LfVoV/9pGPYE5obRVPNA29RoKVLVOxeua618pvLUDUbPoNiyzrqW1mKh Hnp3YOcifcnjSNKHhXSPfnGuexEA2ASLRlQsb/xkLEiqaWUQdf0lIDFW/oLt4QILFRJB VAkYEnvk/OgFW92XFw4Ah66DtU5JtiQwMG2lacHQSwQ54NweBqBkKvI8JCxHNT7cwRd6 Vqlg== 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 1si3412972ejy.385.2020.11.26.09.04.05; Thu, 26 Nov 2020 09:04:32 -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 S2404036AbgKZRBI convert rfc822-to-8bit (ORCPT + 99 others); Thu, 26 Nov 2020 12:01:08 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:56129 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403995AbgKZRBI (ORCPT ); Thu, 26 Nov 2020 12:01:08 -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-320-6PdLvvN0Nc6h-cH4kJcvZQ-1; Thu, 26 Nov 2020 12:01:01 -0500 X-MC-Unique: 6PdLvvN0Nc6h-cH4kJcvZQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 465DF104ED6C; Thu, 26 Nov 2020 17:00:59 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.133]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4358560BFA; Thu, 26 Nov 2020 17:00:56 +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 , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 06/25] perf tools: Do not swap mmap2 fields in case it contains build id Date: Thu, 26 Nov 2020 18:00:07 +0100 Message-Id: <20201126170026.2619053-7-jolsa@kernel.org> In-Reply-To: <20201126170026.2619053-1-jolsa@kernel.org> References: <20201126170026.2619053-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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[20]; u8 build_id_size; u8 __reserved_1; u16 __reserved_2; }; }; 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 5cc722b6fe7c..cc1c11ca94fd 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