Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1223426pxu; Mon, 23 Nov 2020 15:09:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJx02OHGSqHyFiTaVMi7B4E3wq7lAVRX9zVjAM/vd+zZ0ZdMrHE61qGa8pGcKTDvtjPSOXQT X-Received: by 2002:a05:6402:150d:: with SMTP id f13mr1411880edw.119.1606172965979; Mon, 23 Nov 2020 15:09:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606172965; cv=none; d=google.com; s=arc-20160816; b=wjKgb7G7bamZxweBiM1oa2ppL5P8gDFkjQt1G9XBxx51/60gAKQ3YgYCpX5gQ5KRmx Xot8OVDKflKlAj3h3toNVfzLcrI4plUDzHqNd4yKgIS7zc+kO0BeOhyi2ToDQIbRaCl4 3wg0zz6qlfozdp/ydl01/214rmnTw1SNxIiBrjkqMSvoeybYqqACRVoP5J409dnolhDi pOcPWYJAJKbu33Eo20Dnqn+mtyA7n6oQVQjWBtJ22FiNqSuvuOx8bsuxojwXzx4DKxx6 bj4p8XwQT5rY/Cv8RH4w976y9B0RXoLID4PKn4wW6ILNozDFcsxAgcCoAj4AEI8I/gha d7TA== 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=iaQQGvYTQseETpRhaQZDnVOn3qGLfOd8EkHDft2jNG2VX9+cPFAwkouLBn+R82awWL mVqjYUB8sfG2IzgTzzZJQg8WoUVwqoawzUuxzji/d2XN+yBXs6vPp2ss6OM/NIqMgoAG DAXs9hriGBjOHmW3H6+U9PPdoK5hhY5xAGoCIZenRvMQ0THw2AyWwFaGrm2JTB9SbKYF j6OwsZFdnP6MN5AxR2PSwns73SvwHBRdV6ZocwxZioeharqT+P7bo+9obG6laadP74oF W8cnMpxbQn02FWHbbfVzmIF/EDD6RWAe6T/mauIOOG1lpHOfR8xShLwPSZQ6M5hiTmhP O4AA== 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 g14si6515732edv.147.2020.11.23.15.09.03; Mon, 23 Nov 2020 15:09:25 -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 S2387594AbgKWXFx convert rfc822-to-8bit (ORCPT + 99 others); Mon, 23 Nov 2020 18:05:53 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:37829 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733150AbgKWXFu (ORCPT ); Mon, 23 Nov 2020 18:05:50 -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-286-yIffSHEZMwq6x5GH3ysMiw-1; Mon, 23 Nov 2020 18:05:45 -0500 X-MC-Unique: yIffSHEZMwq6x5GH3ysMiw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B07381CBE1; Mon, 23 Nov 2020 23:05:43 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.195.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56C0A5D9CA; Mon, 23 Nov 2020 23:05:40 +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: Tue, 24 Nov 2020 00:04:53 +0100 Message-Id: <20201123230512.2097312-7-jolsa@kernel.org> In-Reply-To: <20201123230512.2097312-1-jolsa@kernel.org> References: <20201123230512.2097312-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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