LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: kajoljain <kjain@linux.ibm.com>
To: kan.liang@linux.intel.com, acme@kernel.org, jolsa@redhat.com,
	jmario@redhat.com, linux-kernel@vger.kernel.org
Cc: ak@linux.intel.com
Subject: Re: [PATCH 1/2] perf script: Fix PERF_SAMPLE_WEIGHT_STRUCT support
Date: Thu, 30 Sep 2021 16:18:13 +0530	[thread overview]
Message-ID: <43867afa-e8da-a932-f87b-5ac109057929@linux.ibm.com> (raw)
In-Reply-To: <1632929894-102778-1-git-send-email-kan.liang@linux.intel.com>



On 9/29/21 9:08 PM, kan.liang@linux.intel.com wrote:
> From: Kan Liang <kan.liang@linux.intel.com>
> 
> -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.

Hi Kan,
    This issue can also be reproduce in powerpc box.
Given patch fix the issue.

Reviewed-by: Kajol Jain<kjain@linux.ibm.com>

Thanks,
Kajol Jain

> 
> 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 <jmario@redhat.com>
> Fixes: ea8d0ed6eae3 ("perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT")
> Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
> ---
>  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) &&
> 

      parent reply	other threads:[~2021-09-30 10:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 15:38 kan.liang
2021-09-29 15:38 ` [PATCH 2/2] perf script: Support instruction latency kan.liang
2021-09-29 16:54 ` [PATCH 1/2] perf script: Fix PERF_SAMPLE_WEIGHT_STRUCT support Arnaldo Carvalho de Melo
2021-09-29 18:42   ` Jiri Olsa
2021-09-29 20:22     ` Joe Mario
2021-10-27 20:10       ` Arnaldo Carvalho de Melo
2021-09-30 10:48 ` kajoljain [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43867afa-e8da-a932-f87b-5ac109057929@linux.ibm.com \
    --to=kjain@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=jmario@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 1/2] perf script: Fix PERF_SAMPLE_WEIGHT_STRUCT support' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).