From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 727D5C433EF for ; Tue, 28 Sep 2021 20:38:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5774D6136F for ; Tue, 28 Sep 2021 20:38:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242752AbhI1Uk1 (ORCPT ); Tue, 28 Sep 2021 16:40:27 -0400 Received: from mga02.intel.com ([134.134.136.20]:29978 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242604AbhI1Uk1 (ORCPT ); Tue, 28 Sep 2021 16:40:27 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10121"; a="212053187" X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="212053187" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 13:38:47 -0700 X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="616914082" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.212.132.2]) ([10.212.132.2]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 13:38:46 -0700 Subject: Re: problem with 'perf script -F weight' To: Jiri Olsa , Kan Liang Cc: linux-perf-users@vger.kernel.org, Peter Zijlstra , Joe Mario , Jin Yao , Arnaldo Carvalho de Melo References: From: Andi Kleen Message-ID: <5f182be7-1e6e-b864-66db-c5588601784a@linux.intel.com> Date: Tue, 28 Sep 2021 13:38:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On 9/28/2021 12:20 PM, Jiri Olsa wrote: > hi, > Joe reported broken -F weight in perf script with (on x86): > > # ./perf mem record > # ./perf script -F weight > Samples for 'dummy:HG' event do not have WEIGHT attribute set. Cannot print 'weight' field. > > the problem seems to be introduced with the WEIGHT_STRUCT change: > ea8d0ed6eae3 perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT > > which enables WEIGHT_STRUCT sample_type on x86 instead of WEIGHT, > and leaves 'perf script -F weight' in the dark > > I'm not sure what the fix should look like.. should we allow user > to use just 'WEIGHT' sample type? or is there a way to get original > weight from 'WEIGHT_STRUCT' data, so we could fix just perf script? We would need to support both in perf script, to handle both perf.data generated by old and new kernels on both big and little endian So probably try one first and then the other while parsing The same is true for all other users, so probably there needs to be a library function for this somewhere. -Andi