Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp890859pxb; Wed, 27 Oct 2021 14:34:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUX5kxeGjxXDlKHJ/Rn53k7bnqT+FuTV6vgKMy8GCYTRNUCEHXD82j9h9YMxpY6s9y+mKc X-Received: by 2002:a17:90b:3791:: with SMTP id mz17mr899337pjb.107.1635370440197; Wed, 27 Oct 2021 14:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370440; cv=none; d=google.com; s=arc-20160816; b=xu3w/sTQ9t5/DTFkNgXf56c6vlQm2vcganelU5zrk++q4o1DpHOcM9I0dRqJPQd3c/ lOzmGU7I52EX3sJWCnBw2iENJvKCclbmR5yk2kS8nq5CAvX6AcrhVbUBN+Rb+2bICWmh B9Uq6+Oc8tJlOkZP0QdJIkKEGtRq1kh8xj50QLnVRlqnqJiFk7uBwp95SRET8b0w3jOr WdxvsrjFNP9ZAFt58UKOPLYlDHOjJ1qwBhtfTWolk4CxK3DZ2p7TmKxujRBYRVOQkxSN vsYI5ey/xpGA069iH6u5oftnu5E/zUU8zu0OPM/llqCLSM3qdiR0lZI+dt0x2fg9TVn+ FpRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RwIDyJh1kggvbfypZhTzR101vxpvox835kfX640RCZo=; b=Mgy9JVCAPMmR8MwI03MXlWcIfjwEdEXxSIoInRC+K1LSgHGPzlOgz2ILeJqE231f9P GfxdZzN15pAIRBptcYr3CZGMFx2oYR/DSIs9mtInRdqZLQGVLb3zvFhNVDYS0noGEp8M 3fJ6ozS73ra2A1PuSvGebWHoUE0pUQXOKsrZjH0edzg9yj24qWp5SwVJ1a3LsB0bC4gl sm8+M+KNHW5m30vrfq+KjTOQcHd+8vq8MvWs/GZzZINpjvavBd6CFHDLxotewqn6AHqT teAy/fIINzzCK1cxWTCxIdqZQMySPP/KhdFANPPgjCMdxeOz9PonF4cwAoD7L4dH+RmC I1uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P0UsPowv; 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 q18si1571877pgb.565.2021.10.27.14.33.47; Wed, 27 Oct 2021 14:34:00 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P0UsPowv; 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 S243809AbhJ0UMb (ORCPT + 97 others); Wed, 27 Oct 2021 16:12:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:53936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238558AbhJ0UMa (ORCPT ); Wed, 27 Oct 2021 16:12:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF06D60234; Wed, 27 Oct 2021 20:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635365405; bh=VZhKaZXZL7K0N14lsWIM3QhuQSV7O/5fTZ0QwvhhwJI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P0UsPowv+CE3ElhKSBnCWZvuvMhyozq65PdADxyynXmHJTZcnMCsCSNVBM3ZWlGbg vk87ig0TgTk2YXwW54bivJu0kPQTOSjHGk5SdWDkUn2ubf6uQIhnBWl4TAP2ptY4aX qE/0bmQji10yLs6eiznbJ076IWOLgU4pByNTlAViWgojW59Olti1h5XLCYDi7BtWFV n2+q0J6f0NEox1TFs65znu0BvrXF64sDQW5WNnySzfvBtuS6oMvyVq/Oh8oqUMHFCs 1TC7zhe/lM8wp42uRCGDD1ME4CKoAhZ7nYMwtch2XKHTGJ9oYYnqnekG8S+hFtU8wU mTxqHU+qq4dCQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 1DA8D410A1; Wed, 27 Oct 2021 17:10:03 -0300 (-03) Date: Wed, 27 Oct 2021 17:10:03 -0300 From: Arnaldo Carvalho de Melo To: Joe Mario Cc: kan.liang@linux.intel.com, linux-kernel@vger.kernel.org, Andi Kleen , Jiri Olsa Subject: Re: [PATCH 1/2] perf script: Fix PERF_SAMPLE_WEIGHT_STRUCT support Message-ID: References: <1632929894-102778-1-git-send-email-kan.liang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Sep 29, 2021 at 04:22:19PM -0400, Joe Mario escreveu: > > > On 9/29/21 2:42 PM, Jiri Olsa wrote: > > On Wed, Sep 29, 2021 at 01:54:39PM -0300, Arnaldo Carvalho de Melo wrote: > >> Em Wed, Sep 29, 2021 at 08:38:13AM -0700, kan.liang@linux.intel.com escreveu: > >>> From: Kan Liang > >>> > >>> -F weight in perf script is broken. > >>> > >>> # ./perf mem record > >>> # ./perf script -F weight > >>> Samples for 'dummy:HG' event do not have WEIGHT attribute set. Cannot > >>> print 'weight' field. > >>> > >>> The sample type, PERF_SAMPLE_WEIGHT_STRUCT, is an alternative of the > >>> PERF_SAMPLE_WEIGHT sample type. They share the same space, weight. The > >>> lower 32 bits are exactly the same for both sample type. The higher 32 > >>> bits may be different for different architecture. For a new kernel on > >>> x86, the PERF_SAMPLE_WEIGHT_STRUCT is used. For an old kernel or other > >>> ARCHs, the PERF_SAMPLE_WEIGHT is used. > >>> > >>> With -F weight, current perf script will only check the input string > >>> "weight" with the PERF_SAMPLE_WEIGHT sample type. Because the commit > >>> ea8d0ed6eae3 ("perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT") didn't > >>> update the PERF_SAMPLE_WEIGHT_STRUCT sample type for perf script. For a > >>> new kernel on x86, the check fails. > >>> > >>> Use PERF_SAMPLE_WEIGHT_TYPE, which supports both sample types, to > >>> replace PERF_SAMPLE_WEIGHT. > >>> > >>> Reported-by: Joe Mario > >>> Fixes: ea8d0ed6eae3 ("perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT") > >> > >> Hey Joe, Jiri, > >> > >> Can I have your Tested-by? > > > > Acked/Tested-by: Jiri Olsa > > > > thanks, > > jirka > > Acked/Tested-by: Joe Mario > > The "perf script -F weight" command works correctly. > > And I also verified that when just issuing "perf script", that the weight (cycle latency) > column that was missing with this bug, is now fixed and working properly. Thanks, applied. - Arnaldo > Thanks, > Joe > > > >> > >> Thanks, > >> > >> - Arnaldo > >> > >>> Signed-off-by: Kan Liang > >>> --- > >>> tools/perf/builtin-script.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c > >>> index 6211d0b..9f62ac6 100644 > >>> --- a/tools/perf/builtin-script.c > >>> +++ b/tools/perf/builtin-script.c > >>> @@ -459,7 +459,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) > >>> return -EINVAL; > >>> > >>> if (PRINT_FIELD(WEIGHT) && > >>> - evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT, "WEIGHT", PERF_OUTPUT_WEIGHT)) > >>> + evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT)) > >>> return -EINVAL; > >>> > >>> if (PRINT_FIELD(SYM) && > >>> -- > >>> 2.7.4 > >> > >> -- > >> > >> - Arnaldo > >> > > -- - Arnaldo