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.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.c
+++ b/perfmon/perfmon.c
@@ -1289,8 +1289,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 {
@@ -1312,8 +1321,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


Attachment: cell-add-spe-follow-flag.patch
Description: Binary data

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
perfmon2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to