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?
> >
> >  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?

How about this?
Is this the change which you expected?

-----------------------------------------------
This patch adds not_dflt_ctxsw flag to context flags.
This flag is used not to set TIF_PERFMON_CTXSW. 

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            |    4 +++-
 4 files changed, 15 insertions(+), 2 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.not_dflt_ctxsw =
+               (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 not_dflt_ctxsw:1;  /* TIF_PERFMON_CTXSW is not set */
+       unsigned int reserved:4;        /* for future use */
 };
 
 /*
--- a/perfmon/perfmon_attach.c
+++ b/perfmon/perfmon_attach.c
@@ -240,7 +240,9 @@ static int pfm_load_ctx_thread(struct pf
                 */
                pfm_set_pmu_owner(ctx->task, ctx);
        }
-       set_tsk_thread_flag(task, TIF_PERFMON_CTXSW);
+
+       if (!ctx->flags.not_dflt_ctxsw)
+               set_tsk_thread_flag(task, TIF_PERFMON_CTXSW);
 
        /*
         * reset pending work





-------------------------------------------------------------------------
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