Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp975932pxb; Wed, 29 Sep 2021 13:58:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1BlZSW+DsYT85ByGyGDrnUCov/ljuj7A6UvuIrSXsbD7kWr956JiKKMdiq+9RasKNbGkn X-Received: by 2002:a17:902:7e8a:b0:13d:95e2:d9c2 with SMTP id z10-20020a1709027e8a00b0013d95e2d9c2mr557106pla.8.1632949106765; Wed, 29 Sep 2021 13:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632949106; cv=none; d=google.com; s=arc-20160816; b=sZmTm9v0JTAJqv1rID+d9fl+7GKTFQwWOPdKzxrDUkh2HbhAnOWRrF9S+PdVekU9sj PJzdvr9vz0bnwFZQ7S9xhquAv2JvQ+nswdkho8rMc5vMSUKNdWz29lcbuil/DhzEIieq +CNC0sVbK/uqEJ6ZEb0AGAUhaX83JzJTvidOe7oAhMhPfjYYkp1M8RoDdP1BAOSQkBQ+ jsOtAR5fqnV2EyBp09Kz1KOZUrhMhLgiQ2yCp9oIbi+rD741435o5L43h/XBM5jvs20H brWSUGk44jZ4neqHSqEiJOmOf7GvS+YHFVRTp1QMPELwpmb6TidEZHDHwxM5ud5oytmW Hqdw== 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=Gtn2I76VslSAzgMAP3RFM+vt52ILQ5GnKfw53Y1RY3c=; b=PtbNWKY+Lbcp8e1ZN9rkL/iWRXyuIvdRt/mVV1c2912U8j/atFVMWaKEMqYnIUJliG ry092uJZ8B8sJZabZxxa0ZOXNCTd+7ZxMLnbbRR5w4gWY8ExSOlAmTnBkjbzUR11Q9P+ TSwKn/AnGy7vsjh46g9VAR1tlexp0qMnTI3dZ8TSPwzMHHLbII7g/bc4KKk3GtaZxK0I kHq8j4apbSwQaJVTiasR/HfCTiblJqBjFaALf6BInX7AaedYtDSoM569Gm3aQta7PskE A5+0eFO1/YNL/JvKb20lwfccnhk5JkxI4/TWIJ1+GYX8G+ItWWbcqnretDLKptP/6bJi 9D9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mCafMlLt; 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 p1si990459pgb.425.2021.09.29.13.58.10; Wed, 29 Sep 2021 13:58:26 -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=mCafMlLt; 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 S1344472AbhI2Q4Y (ORCPT + 99 others); Wed, 29 Sep 2021 12:56:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:50360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344142AbhI2Q4X (ORCPT ); Wed, 29 Sep 2021 12:56:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3DB256142A; Wed, 29 Sep 2021 16:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632934482; bh=MC/H1E8TSLJ2TbZMhpk0E7SEx/R2oV68ZKQQ3Ig/N5w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mCafMlLtcX+JlQkGqvM5QA5BDba/hrxBVJw0zfIbW9G6CFnGymGHs/qmIxxZ2meHk J19P5Q/DRLwKcWFwhVXKz3xGGnUB7sNRgVakiYd6m/I2mwuSOSgGiFdBwFi/oa4ipG evmk/Ho1rec5mL1K2MPQjsDwzfw7WVw/C+ogFmBRSMhbSOxRB7fkJqi4xgGDKvNl0E SbQkpYO7DSmtxN3tq3ckn9mYAl6QYZd8V7WIUDQsECxclsKIkOqBDvKquorKh1/1iA AEWYnqh1kndy6S5iNeeBN4HJn0C0TbIlI9D87STTmbu6caukATy3XvBXTno1Nuv7kV RPyFDTidtDY7w== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 4C433410A1; Wed, 29 Sep 2021 13:54:39 -0300 (-03) Date: Wed, 29 Sep 2021 13:54:39 -0300 From: Arnaldo Carvalho de Melo To: Joe Mario , kan.liang@linux.intel.com Cc: Jiri Olsa , linux-kernel@vger.kernel.org, Andi Kleen 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: <1632929894-102778-1-git-send-email-kan.liang@linux.intel.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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