Re: [PATCH v4 2/2] add icswx support
flat view
From: Benjamin Herrenschmidt <hidden>
Date: 2011-03-04 22:40:44
On Fri, 2011-03-04 at 16:22 -0600, Tseng-Hui (Frank) Lin wrote:
quoted
Well, I don't know how you use icswx on P7+, but on Prism it's definitely issued directly by userspace.OK. You've got a point. I wasn't aware of Prism. HFI device driver is currently the only icswx user on P7. Could you point me to more information about how Prism uses icswx from user space?
Let's ignore that for now, there's a whole infrastructure for it and it hasn't been published yet, maybe later this year... We can look at exposing the feature to userspace then.
quoted
You don't need to. You allocate and initialize the structure, and you compare & swap the pointer. If somebody beat you, you trash your copy.Is atomic_cmpxchg() the one to do the trick?
No, just cmpxchg()
The lazy switching checks the shadow variable first before setting ACOP register. This saves mtspr() only if the new value is the same as current. If there are several coprocessors on the system, the ACOP register may have to be changed frequently. In that case, the lazy switching will not save time. In extreme case when the ACOP register needs to be changed every time, it actually slows down the execution by the additional shadow variable checking.
By how much ? Is it even measurable ? Cheers, Ben.