From patchwork Thu Sep 11 23:38:19 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Detsch X-Patchwork-Id: 256 X-Patchwork-Delegate: jk@ozlabs.org Return-Path: X-Original-To: patchwork@ozlabs.org Delivered-To: patchwork@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 251E7DE91D for ; Fri, 12 Sep 2008 09:40:28 +1000 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from igw1.br.ibm.com (igw1.br.ibm.com [32.104.18.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A82CFDE006; Fri, 12 Sep 2008 09:39:12 +1000 (EST) Received: from mailhub3.br.ibm.com (mailhub3 [9.18.232.110]) by igw1.br.ibm.com (Postfix) with ESMTP id 2395E32C103; Thu, 11 Sep 2008 20:08:31 -0300 (BRT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m8BNd8LG606254; Thu, 11 Sep 2008 20:39:08 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m8BNd1Qj024361; Thu, 11 Sep 2008 20:39:01 -0300 Received: from [9.8.10.86] ([9.8.10.86]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m8BNd0xd024351; Thu, 11 Sep 2008 20:39:01 -0300 From: Andre Detsch To: cbe-oss-dev@ozlabs.org Date: Thu, 11 Sep 2008 20:38:19 -0300 User-Agent: KMail/1.9.6 References: <200809111955.28780.adetsch@br.ibm.com> In-Reply-To: <200809111955.28780.adetsch@br.ibm.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200809112038.19772.adetsch@br.ibm.com> Cc: LukeBrowning@us.ibm.com, Jeremy Kerr Subject: [Cbe-oss-dev] [PATCH 08/11] powerpc/spufs: Add zombie statistics for gang scheduling X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org Harvest statistics for contexts when they terminate so that perf tools may show lifetime statistics for gangs. Active statistics must be obtained from the context structures as before. It is too expensive from a locking perspective to add these statistics to the gang structure when they are incremented, so just collect them for terminated contexts. Signed-off-by: Luke Browning Signed-off-by: Andre Detsch diff --git a/arch/powerpc/platforms/cell/spufs/gang.c b/arch/powerpc/platforms/cell/spufs/gang.c index 3fcbdc7..c64d0ad 100644 --- a/arch/powerpc/platforms/cell/spufs/gang.c +++ b/arch/powerpc/platforms/cell/spufs/gang.c @@ -82,6 +82,22 @@ void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx) mutex_unlock(&gang->mutex); } +void update_gang_stats(struct spu_gang *gang, struct spu_context *ctx) +{ + int i; + + for (i = 0; i < SPU_UTIL_MAX; i++) + gang->stats.times[i] += ctx->stats.times[i]; + gang->stats.vol_ctx_switch += ctx->stats.vol_ctx_switch; + gang->stats.invol_ctx_switch += ctx->stats.invol_ctx_switch; + gang->stats.min_flt += ctx->stats.min_flt; + gang->stats.maj_flt += ctx->stats.maj_flt; + gang->stats.hash_flt += ctx->stats.hash_flt; + gang->stats.slb_flt += ctx->stats.slb_flt; + gang->stats.class2_intr += ctx->stats.class2_intr; + gang->stats.libassist += ctx->stats.libassist; +} + void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx) { mutex_lock(&gang->mutex); @@ -92,6 +108,7 @@ void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx) } list_del_init(&ctx->gang_list); gang->contexts--; + update_gang_stats(gang, ctx); atomic_dec(&gang->nstarted); if (spu_gang_runnable(gang)) { ctx = list_first_entry(&gang->list, diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index bc3b499..de436f2 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h @@ -179,6 +179,23 @@ struct spu_gang { int aff_flags; struct spu *aff_ref_spu; atomic_t aff_sched_count; + + /* spu scheduler statistics for zombie ctxts */ + struct { + enum spu_utilization_state util_state; /* N/A */ + unsigned long long tstamp; /* N/A */ + unsigned long long times[SPU_UTIL_MAX]; + unsigned long long vol_ctx_switch; + unsigned long long invol_ctx_switch; + unsigned long long min_flt; + unsigned long long maj_flt; + unsigned long long hash_flt; + unsigned long long slb_flt; + unsigned long long slb_flt_base; /* N/A */ + unsigned long long class2_intr; + unsigned long long class2_intr_base; /* N/A */ + unsigned long long libassist; + } stats; }; static inline int spu_gang_runnable(struct spu_gang *g)