Re: [patch 2/8] Implement always-locked bit ops, for memory shared with an SMP hypervisor.

Andi Kleen
2006-08-03T05:39:19Z

On Thursday 03 August 2006 07:32, Christoph Lameter wrote:
> On Thu, 3 Aug 2006, Andi Kleen wrote:
>
> > > As far as I can tell from this conversation there are special "Xen"
> > > drivers that need this not the rest of the system.
> >
> > Yes, but in general when a driver that runs on multiple architectures
> > (including IA64 btw) needs something architecture specific we usually
> > add it to asm, not add ifdefs.
>
> I still wonder why you are so focused on ifdefs. Why would we need those?

Because the Xen drivers will run on a couple of architectures, including
IA64 and PPC.

If IA64 or PPC didn't implement at least wrappers for the sync ops
then they would all need special ifdefs to handle this.

>
> > > What possible use could there be to someone else?
> >
> > e.g. for other hypervisors or possibly for special hardware access
> > (e.g. I could imagine it being used for some kind of cluster interconnect)
> > I remember Alan was using a similar hack in his EDAC drivers because
> > it was the only way to clear ECC errors.
>
> Maybe the best thing would be to have proper atomic ops in UP mode on
> i386? The current way of just dropping the lock bit is the source of the
> troubles.

It's a huge performance difference.

> > Just adding a single line #include for a wrapper asm-generic surely isn't
> > a undue burden for the other architectures, and it will save some
> > mess in the Xen drivers.
>
> Just adding a single line #include <asm/xen-bitops.h> to drivers that need
> this functionality is not an undue burden for the drivers that support
> Xen. They have to use special _xxx bitops anyways.

Ok it could be put into a separate file (although with a neutral name)

But you would still need to add that to IA64, PPC etc. too, so it
would only avoid adding a single to the other architectures.
-Andi