Hello,
Why do you need to expose this Cell-specific feature into generic code?
Can't you hide this inside the arch code by using the pfm_arch_*() callbacks?
There is an arch-specific portion to the context. You get to it with
ctx_arch =pfm_ctx_arch(ctx).
2008/3/28 TakashiYamamoto <[EMAIL PROTECTED]>:
> Hello,
> I updated the patch for the latest perfmon2 git tree.
>
> ---------------------------------------------------------------
>
> This patch adds cell_spe_follow flag to context flags.
> This flag is used for following the Cell SPE context switch.
>
> Signed-off-by: Takashi Yamamoto <[EMAIL PROTECTED]>
> ---
> arch/powerpc/perfmon/perfmon_cell.c | 2 ++
> include/asm-powerpc/perfmon.h | 8 ++++++++
> include/linux/perfmon_kern.h | 3 ++-
> perfmon/perfmon_attach.c | 26 ++++++++++++++++++++++----
>
>
> 4 files changed, 34 insertions(+), 5 deletions(-)
>
> --- a/arch/powerpc/perfmon/perfmon_cell.c
> +++ b/arch/powerpc/perfmon/perfmon_cell.c
> @@ -1220,6 +1220,8 @@ static void pfm_cell_get_ovfl_pmds(struc
> **/
> static int pfm_cell_create_context(struct pfm_context *ctx, u32 ctx_flags)
> {
> + ctx->flags.cell_spe_follow =
> + (ctx_flags & PFM_FL_CELL_SPE_FOLLOW) ? 1:0;
> return 0;
> }
>
> --- a/include/asm-powerpc/perfmon.h
> +++ b/include/asm-powerpc/perfmon.h
> @@ -31,4 +31,12 @@
> #define PFM_ARCH_MAX_PMCS (256+64) /* 256 HW 64 SW */
> #define PFM_ARCH_MAX_PMDS (256+64) /* 256 HW 64 SW */
>
> +/*
> + * context flags (ctx_flags)
> + *
> + * bits[00-15]: generic flags
> + * bits[16-31]: arch-specific flags
> + */
> +#define PFM_FL_CELL_SPE_FOLLOW 0x10000
> +
> #endif /* _ASM_POWERPC_PERFMON_H_ */
> --- a/include/linux/perfmon_kern.h
> +++ b/include/linux/perfmon_kern.h
> @@ -118,7 +118,8 @@ struct pfm_context_flags {
> unsigned int can_restart:8; /* allowed to issue a PFM_RESTART */
> unsigned int reset_count:8; /* number of pending resets */
> unsigned int is_self:1; /* per-thread and self-montoring */
> - unsigned int reserved:5; /* for future use */
> + unsigned int cell_spe_follow:1; /* cell spe ctx follow */
> + unsigned int reserved:4; /* for future use */
> };
>
> /*
> --- a/perfmon/perfmon_attach.c
> +++ b/perfmon/perfmon_attach.c
> @@ -148,8 +148,17 @@ int __pfm_load_context(struct pfm_contex
>
> ctx->last_cpu = -1;
> set->priv_flags |= PFM_SETFL_PRIV_MOD_BOTH;
>
> - set_tsk_thread_flag(task, TIF_PERFMON_CTXSW);
> - PFM_DBG("[%d] set TIF", task->pid);
> + /*
> + * If cell_spe_follow is true, the task is not marked by
> + * TIF_PERFMON_CTXSW and pfm_ctxsw() is not called
> + * from the task scheduler.
> + * pfm_ctxsw() is called from SPU notifier in perfmon_cell.c
> + *
> + */
> + if (!ctx->flags.cell_spe_follow) {
> + set_tsk_thread_flag(task, TIF_PERFMON_CTXSW);
> + PFM_DBG("[%d] set TIF", task->pid);
> + }
>
> PFM_DBG("context loaded next ctxswin for [%d]", task->pid);
> } else {
> @@ -171,8 +180,17 @@ int __pfm_load_context(struct pfm_contex
>
>
>
> ctx->flags.is_self = 1;
>
> - set_tsk_thread_flag(task, TIF_PERFMON_CTXSW);
> - PFM_DBG("[%d] set TIF", task->pid);
> + /*
> + * If cell_spe_follow is true, the task is not marked by
> + * TIF_PERFMON_CTXSW and pfm_ctxsw() is not called
> + * from the task scheduler.
> + * pfm_ctxsw() is called from SPU notifier in perfmon_cell.c
> + *
> + */
> + if (!ctx->flags.cell_spe_follow) {
> + set_tsk_thread_flag(task, TIF_PERFMON_CTXSW);
> + PFM_DBG("[%d] set TIF", task->pid);
> + }
>
> /*
> * load PMD from set
>
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> perfmon2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/perfmon2-devel
>
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
perfmon2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel