This patch changes the check of PMU access in pfm_read_pmds().

In the cell-spe-follow mode, 
we need to call the special function to check 
whether the target SPU program is running.

Signed-off-by: Takashi Yamamoto <[EMAIL PROTECTED]>
---
 include/asm-powerpc/perfmon_kern.h |   13 +++++++++++++
 perfmon/perfmon_rw.c               |   14 +++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

--- a/include/asm-powerpc/perfmon_kern.h
+++ b/include/asm-powerpc/perfmon_kern.h
@@ -450,6 +450,19 @@ struct pfm_arch_context {
        void                    *arg;
 };
 
+/*
+ * This function returns whether the target SPU program is running.
+ */
+static inline int pfm_cell_can_access_pmu_in_cell_spe_follow(
+       struct pfm_context *ctx)
+{
+       struct pfm_arch_context *ctx_arch = pfm_ctx_arch(ctx);
+       if (ctx_arch->arg)
+               return 1;
+       else
+               return 0;
+}
+
 #define PFM_ARCH_CTX_SIZE sizeof(struct pfm_arch_context)
 /*
  * PowerPC does not need extra alignment requirements for the sampling buffer
--- a/perfmon/perfmon_rw.c
+++ b/perfmon/perfmon_rw.c
@@ -498,7 +498,19 @@ int __pfm_read_pmds(struct pfm_context *
 
        if (likely(ctx->state == PFM_CTX_LOADED)) {
                can_access_pmu = __get_cpu_var(pmu_owner) == ctx->task
-                              || ctx->flags.system;
+                       || ctx->flags.system;
+
+#ifdef CONFIG_PPC
+               /*
+                * In the cell_spe_follow mode,
+                * The target SPU program may run on the other CPU's SPU,
+                * So pfm_cell_can_access_pmu_in_cell_spe_follow(ctx)
+                * is used here.
+                */
+               if (ctx->flags.cell_spe_follow && !ctx->flags.system)
+                       can_access_pmu =
+                               pfm_cell_can_access_pmu_in_cell_spe_follow(ctx);
+#endif
 
                if (can_access_pmu)
                        pfm_arch_serialize();


Attachment: cell-change_read_pmds.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