<html><body>
<p><tt>linuxppc-dev-bounces+lukebrowning=us.ibm.com@ozlabs.org wrote on 12/04/2006 10:26:57:<br>
<br>
> linuxppc-dev-bounces+lukebrowning=us.ibm.com@ozlabs.org wrote on <br>
> 01/12/2006 06:01:15 PM:<br>
> <br>
> > <br>
> > Subject: Enable SPU switch notification to detect currently activeSPU tasks.<br>
> > <br>
> > From: Maynard Johnson <maynardj@us.ibm.com><br>
> > <br>
> > This patch adds to the capability of spu_switch_event_register to notify the<br>
> > caller of currently active SPU tasks. It also exports <br>
> > spu_switch_event_register<br>
> > and spu_switch_event_unregister.<br>
> > <br>
> > Signed-off-by: Maynard Johnson <mpjohn@us.ibm.com><br>
> > <br>
> > <br>
> > Index: linux-2.6.19-rc6-<br>
> > arnd1+patches/arch/powerpc/platforms/cell/spufs/sched.c<br>
> > ===================================================================<br>
> > --- linux-2.6.19-rc6-arnd1+patches.<br>
> > orig/arch/powerpc/platforms/cell/spufs/sched.c 2006-11-24 11:34:<br>
> > 44.884455680 -0600<br>
> > +++ linux-2.6.19-rc6-<br>
> > arnd1+patches/arch/powerpc/platforms/cell/spufs/sched.c 2006-12-01<br>
> > 13:57:21.864583264 -0600<br>
> > @@ -84,15 +84,37 @@<br>
> > ctx ? ctx->object_id : 0, spu);<br>
> > }<br>
> > <br>
> > +static void notify_spus_active(void)<br>
> > +{<br>
> > + int node;<br>
> > + for (node = 0; node < MAX_NUMNODES; node++) {<br>
> > + struct spu *spu;<br>
> > + mutex_lock(&spu_prio->active_mutex[node]);<br>
> > + list_for_each_entry(spu, &spu_prio->active_list[node], list) {<br>
> > + struct spu_context *ctx = spu->ctx;<br>
> > + blocking_notifier_call_chain(&spu_switch_notifier,<br>
> > + ctx ? ctx->object_id : 0, spu);<br>
> > + }<br>
> > + mutex_unlock(&spu_prio->active_mutex[node]);<br>
> > + }<br>
> > +<br>
> > +}<br>
> > +<br>
> > int spu_switch_event_register(struct notifier_block * n)<br>
> > {<br>
> > - return blocking_notifier_chain_register(&spu_switch_notifier, n);<br>
> > + int ret;<br>
> > + ret = blocking_notifier_chain_register(&spu_switch_notifier, n);<br>
> > + if (!ret)<br>
> > + notify_spus_active();<br>
> > + return ret;<br>
> > }<br>
> > +EXPORT_SYMBOL_GPL(spu_switch_event_register);<br>
> > <br>
> > int spu_switch_event_unregister(struct notifier_block * n)<br>
> > {<br>
> > return blocking_notifier_chain_unregister(&spu_switch_notifier, n);<br>
> > }<br>
> > +EXPORT_SYMBOL_GPL(spu_switch_event_unregister);<br>
> > <br>
> > <br>
> > static inline void bind_context(struct spu *spu, struct spu_context *ctx)<br>
> <br>
> Is this really the right strategy? First, it serializes all spu context <br>
> switching at the node level. Second, it performs 17 callouts for <br>
> every context<br>
> switch. Can't oprofile internally derive the list of active spus from the <br>
> context switch callout. <br>
> <br>
> Also, the notify_spus_active() callout is dependent on the return code of <br>
> spu_switch_notify(). Should notification be hierarchical? If I <br>
> only register <br>
> for the second one, should my notification be dependent on the return code<br>
> of some non-related subsystem's handler. <br>
> <br>
> Does blocking_callchain_notifier internally check for the presence <br>
> of registered<br>
> handlers before it takes locks ...? We should ensure that there is <br>
> minimal overhead<br>
> when there are no registered handlers.<br>
> <br>
> Regards,<br>
> Luke___________________</tt><br>
<br>
<tt>Any comments to my questions above. Seems like oprofile / pdt could derive the </tt><br>
<tt>list of active spus from a single context switch callout. This patch will have</tt><br>
<tt>a large impact on the performance of the system. </tt><br>
<br>
<tt>Luke</tt></body></html>