public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: Athira Rajeev <atrajeev@linux•vnet.ibm.com>
Cc: kjain@linux•ibm.com, maddy@linux•vnet.ibm.com,
	linuxppc-dev@lists•ozlabs.org, rnsastry@linux•ibm.com
Subject: Re: [PATCH] powerpc/perf: Fix task context setting for trace imc
Date: Wed, 19 Jan 2022 21:56:12 +1100	[thread overview]
Message-ID: <87fspkt2nn.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20211124024600.18509-1-atrajeev@linux.vnet.ibm.com>

Athira Rajeev <atrajeev@linux•vnet.ibm.com> writes:
> Trace IMC (In-Memory collection counters) in powerpc is
> useful for application level profiling. For trace_imc,
> presently task context (task_ctx_nr) is set to
> perf_hw_context. But perf_hw_context is to be used for
> cpu PMU. So for trace_imc, even though it is per thread
> PMU, it is preferred to use sw_context inorder to be able
> to do application level monitoring. Hence change the
> task_ctx_nr to use perf_sw_context.

It's not a software event though, so this is not obviously correct.

Can you explain more why this is OK, I guess perf_sw_context is misnamed
these days? And can you add a comment in the code explaining why this
hardware PMU is using perf_sw_context.

cheers

> Fixes: 012ae244845f ("powerpc/perf: Trace imc PMU functions")
> Signed-off-by: Athira Rajeev <atrajeev@linux•vnet.ibm.com>
> Reviewed-by: Madhavan Srinivasan <maddy@linux•vnet.ibm.com>
> ---
>  arch/powerpc/perf/imc-pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
> index e106909ff9c3..f3b3262bdf02 100644
> --- a/arch/powerpc/perf/imc-pmu.c
> +++ b/arch/powerpc/perf/imc-pmu.c
> @@ -1457,7 +1457,7 @@ static int trace_imc_event_init(struct perf_event *event)
>  
>  	event->hw.idx = -1;
>  
> -	event->pmu->task_ctx_nr = perf_hw_context;
> +	event->pmu->task_ctx_nr = perf_sw_context;
>  	event->destroy = reset_global_refc;
>  	return 0;
>  }
> -- 
> 2.33.0

      reply	other threads:[~2022-01-19 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  2:46 [PATCH] powerpc/perf: Fix task context setting for trace imc Athira Rajeev
2022-01-19 10:56 ` Michael Ellerman [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=87fspkt2nn.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=atrajeev@linux$(echo .)vnet.ibm.com \
    --cc=kjain@linux$(echo .)ibm.com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=maddy@linux$(echo .)vnet.ibm.com \
    --cc=rnsastry@linux$(echo .)ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox