From patchwork Wed May 12 14:51:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 435679 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp5232822jao; Wed, 12 May 2021 15:03:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpub2BvynhWdhyyvKIW16GtXJ9jAt1DGCQxCyYcIISHImr3DAT1uS2TjLiwEB+H8xAmcg5 X-Received: by 2002:a17:906:1e0b:: with SMTP id g11mr39604594ejj.291.1620856991946; Wed, 12 May 2021 15:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620856991; cv=none; d=google.com; s=arc-20160816; b=UZuT4HW9vv1PIx1GKOIjQDemlv9/ucpVi9zMmZry9XlORmcReI0+d/GXgp/ZZnsc5K vKfSH5rya+iEMF8TfZDCFgQ6ZXtw3Ae1ieW7HxNEwLPerxtFG1a0G+qqfbsTJyAOWeu8 k2wFW0lso2rOnZvuxFMrixJ/UJG9zt443WL1OTMb0s7EYehM4VRSNxgqQhztk5IHgayU uMSm8jc4uSw1uwXp/6uccPskVTQJUMuEX4SJRLCYLsPXbl3LnhyNCv28+ndvdz7WBRxg 4BCgOGis9TafLLnET0jC+qOi/5SCt2lqhvdTBavy4jZbINv61LJgk6xjCerDoWQ5Sa7X VSlw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Aa0I/HsKnCmL33bsZ3dNPGXrZv5ku2jTVL0xOivkweg=; b=vnitjsGQs4/qZ2qFzKLYP685EV0o9fop//Qcd1J/n7Arv+tLGOF/DJT6c/AF7rZ8se mJ/FdY/K8h1vROyo+YvTdgQLUnp6JkECg5Ofh1w1olgwMPfSTzJ0DnpZlZo8VJ9m0gK5 COG1qOzqKcB331g4hkb5DDc0r1+MKlwOeNciWRk3+Y4vbpgMeZ2WpyYF9BahjEzFZT8i KL4+vwzVO7tZI3VRJgRV9Va/O9r2gw2Qa/lndG/ioBrmQXyvanBts8VR6/MTqtdbApYg yL/K8VLYq2sg1ijsmug45eV6EdwGDNSUs+kXBWYwWlMq48fuIhYeXUYZcpPyZRMFhzVX 5GTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EDVUHSlI; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si859013ejx.176.2021.05.12.15.03.11; Wed, 12 May 2021 15:03:11 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=EDVUHSlI; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241401AbhELRG6 (ORCPT + 12 others); Wed, 12 May 2021 13:06:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244618AbhELQuz (ORCPT ); Wed, 12 May 2021 12:50:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 532F761D62; Wed, 12 May 2021 16:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620836228; bh=qYzOQYvQRdsH5Vz40natoQqdoyc77/FzAM5ICUFfWMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDVUHSlIwv3XDlARhDjqDNvjrE/0inCUt2pYaO1HJf+Lju61bKHCoanEQLIwL3K01 JQmCH+5x0J0pbWAi2d+phr89/WhulEI1+GSDrUKRyuHARn+IMvrWgWmhkveu7ovEkv 6JZIFomblACxK4tyUP5d6QC6//cAAAvGowOe0vfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Adrian Hunter , Alexander Shishkin , "Gustavo A. R. Silva" , Ingo Molnar , Jiri Olsa , Kan Liang , Mark Rutland , Namhyung Kim , Peter Zijlstra , Steve MacLean , Yonatan Goldschmidt , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.12 662/677] perf session: Add swap operation for event TIME_CONV Date: Wed, 12 May 2021 16:51:48 +0200 Message-Id: <20210512144859.359413885@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leo Yan [ Upstream commit 050ffc449008eeeafc187dec337d9cf1518f89bc ] Since commit d110162cafc8 ("perf tsc: Support cap_user_time_short for event TIME_CONV"), the event PERF_RECORD_TIME_CONV has extended the data structure for clock parameters. To be backwards-compatible, this patch adds a dedicated swap operation for the event PERF_RECORD_TIME_CONV, based on checking if the event contains field "time_cycles", it can support both for the old and new event formats. Fixes: d110162cafc8 ("perf tsc: Support cap_user_time_short for event TIME_CONV") Signed-off-by: Leo Yan Acked-by: Adrian Hunter Cc: Alexander Shishkin Cc: Gustavo A. R. Silva Cc: Ingo Molnar Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Steve MacLean Cc: Yonatan Goldschmidt Link: https://lore.kernel.org/r/20210428120915.7123-4-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/session.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) -- 2.30.2 diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 859832a82496..e9d4e6f4bdf3 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -949,6 +949,19 @@ static void perf_event__stat_round_swap(union perf_event *event, event->stat_round.time = bswap_64(event->stat_round.time); } +static void perf_event__time_conv_swap(union perf_event *event, + bool sample_id_all __maybe_unused) +{ + event->time_conv.time_shift = bswap_64(event->time_conv.time_shift); + event->time_conv.time_mult = bswap_64(event->time_conv.time_mult); + event->time_conv.time_zero = bswap_64(event->time_conv.time_zero); + + if (event_contains(event->time_conv, time_cycles)) { + event->time_conv.time_cycles = bswap_64(event->time_conv.time_cycles); + event->time_conv.time_mask = bswap_64(event->time_conv.time_mask); + } +} + typedef void (*perf_event__swap_op)(union perf_event *event, bool sample_id_all); @@ -985,7 +998,7 @@ static perf_event__swap_op perf_event__swap_ops[] = { [PERF_RECORD_STAT] = perf_event__stat_swap, [PERF_RECORD_STAT_ROUND] = perf_event__stat_round_swap, [PERF_RECORD_EVENT_UPDATE] = perf_event__event_update_swap, - [PERF_RECORD_TIME_CONV] = perf_event__all64_swap, + [PERF_RECORD_TIME_CONV] = perf_event__time_conv_swap, [PERF_RECORD_HEADER_MAX] = NULL, };