Subject: Re: [Cbe-oss-dev] [RFC, PATCH] CELL Oprofile SPU profiling updated patch

From: Arnd Bergmann <[email-masked]>
Date: Thu, 15 Feb 2007 19:13:52 +0100

On Thursday 15 February 2007 17:15, Maynard Johnson wrote:
> >>+void spu_set_profile_private(struct spu_context * ctx, void * profile_info,
> >>+                          struct kref * prof_info_kref,
> >>+                          void (* prof_info_release) (struct kref * kref))
> >>+{
> >>+     ctx->profile_private = profile_info;
> >>+     ctx->prof_priv_kref = prof_info_kref;
> >>+     ctx->prof_priv_release = prof_info_release;
> >>+}
> >>+EXPORT_SYMBOL_GPL(spu_set_profile_private);
> >>    
> >>
> >
> >I think you don't need the profile_private member here, if you just use
> >container_of with ctx->prof_priv_kref in all users.
> >  
> >
> Sorry, I don't follow. We want the profile_private to be stored in the 
> spu_context, don't we?  How else would I be able to do that?  And 
> besides, wouldn't container_of need the struct name of profile_private?  
> SPUFS doesn't have access to the type.

The idea was to have spu_get_profile_private return the kref pointer,
and then change the user of that to do

+       if (!spu_info[spu_num] && the_spu) {
+               spu_info[spu_num] = container_of(
+				spu_get_profile_private(the_spu->ctx),
+				struct cached_info, cache_kref);
+               if (spu_info[spu_num])
+                       kref_get(&spu_info[spu_num]->cache_ref);