Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3535079pxb; Mon, 9 Nov 2020 13:56:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbZZEh+kv208bdNMToAKmfOgYGj0ZbT5DBm1VHO/uaECXOxbasz0fvS1pCRI2jJPMRth4F X-Received: by 2002:a17:906:398b:: with SMTP id h11mr17552719eje.277.1604959012496; Mon, 09 Nov 2020 13:56:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604959012; cv=none; d=google.com; s=arc-20160816; b=t7p4GrZsJzMuaf7JZ5d2UmD/G3MGDQM0r1aub2z6o4RzQGBbeSystQDVFrCyoH2eu9 OZWwH0wHS4WJBfUJltlMW9oMs1x+TzAgs1vMSneTps0bb8O0Y3P3a47922rPPJyoOxkq xWxeeOysXRe/auWYZw+WwFAtpYcyyC2EKdRxa5EEq2eRq+rZmteS/vqIUrC8sA970XbQ VHv9T+TZCPwycQvHy3iZtGOrjTMt5v3TSHaBowXh+REv6fhf4OtvmFGfNuYfECl71E+z rucIPCOZzfNPhpYNU8h5M0B2VRY3uw7+rKPOgdKbyZRbiSvjYm7omPOdJKW1Nbo7o2dn R2cw== 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=91nP1V0owCesLuJRBRy592ENTmmsPRHYSz8N8OXl4zg=; b=NwNDcV5b1mvlin24G+7YWNoea+Xr861ecMsuTTVC574/VI6wBYRSudKxINjrr+zpNj kIdxx9qJ8KQ1O1pLLYometB6b9F7iB8MmzGOFGfmsiAWGPwqeihPaT+No1kpm0TJBIde 1wfKYt6SJnXPjqYYjR4uqWRVcTb7f88qbn53hUKnabFKYfmgfOGMI6INL/NhgiiUYuVB +SWTm8Cs5hrsJGXYu845/EecTs8jXPCOuJX0LOtECq6LKgIi1TKx5h6pSIyE2ZgwOcc+ OYMqfTN4ZH4nkbDjk0Olo392g3oc9f1TgDCAwA2cn+xHWrZneVQDZ9g+3eNGdOGkUxSF LHBw== 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 w10si7848392ejz.5.2020.11.09.13.56.29; Mon, 09 Nov 2020 13:56:52 -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 S1731122AbgKIVyw convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Nov 2020 16:54:52 -0500 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:21193 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729336AbgKIVyt (ORCPT ); Mon, 9 Nov 2020 16:54:49 -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-405-OEjQulERP62TUenmAgnVxQ-1; Mon, 09 Nov 2020 16:54:44 -0500 X-MC-Unique: OEjQulERP62TUenmAgnVxQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E9041186DD37; Mon, 9 Nov 2020 21:54:41 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id E51696EF46; Mon, 9 Nov 2020 21:54:38 +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 05/24] perf tools: Do not swap mmap2 fields in case it contains build id Date: Mon, 9 Nov 2020 22:53:56 +0100 Message-Id: <20201109215415.400153-6-jolsa@kernel.org> In-Reply-To: <20201109215415.400153-1-jolsa@kernel.org> References: <20201109215415.400153-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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_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 098080287c68..2891a49d3fe1 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_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