Hello,

On Mon, Mar 31, 2008 at 4:19 AM, TakashiYamamoto
<[EMAIL PROTECTED]> wrote:
> Hello,
>  Thanks for your reply.
>
>
>  > 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?
>
>  No.
>  In this patch, I want to avoid setting TIF_PERFMON_CTXSW to the task flag
>  when cell_spe_follow flag is set.
>  I couln't hide this change in pfmon_arch_load_context(),
>  because it is called before set_task_thread_flag().
>
Ok, I see your problem now.

We have 2 solutions:
   - move pfm_arch_load_context() AFTER the TIF_PERFMON_CTXSW
   - add a generic flag (context_flags) that pfm_arch_load_context()
can set to tell the generic code NOT to set TIF_PERFMON_CTXSW

I'd rather not move pfm_arch_load_context() because there would be
more  code to undo if it ever fails.

The 2nd solution is not too pretty either because it relies on the
position of pfm_arch_load_context(). However, we could move
setting that flag to pfm_arch_create_context() given that you've added
the context-level flag for SPE_FOLLOW. Could you try that?

Thanks.


>  Can I add a parameter which control to set TIF_PERFMON_CTXSW to the task flag
>  to pfmon_arch_load_context()?
>  OR
>  Can I add pfmon_arch_set_task_thread_flag()?
>
>
>  > There is an arch-specific portion to the context. You get to it with
>  > ctx_arch =pfm_ctx_arch(ctx).
>
>  OK,
>  I can move cell_spe_follow flag to ctx_arch,
>  If I can control to set TIF_PERFMON_CTXSW to the task flag from
>  the arch specific code.
>
>  Thanks.
>  Takashi Yamamoto.
>
>
>
>  >
>  > 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

Reply via email to