All of lore.kernel.org
 help / color / mirror / Atom feed
* Merge Question on asm-ppc*/rwsem.h
@ 2005-09-13 17:06 Jon Loeliger
  2005-09-18 23:22 ` Paul Mackerras
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Loeliger @ 2005-09-13 17:06 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org, linuxppc64-dev

Paul (or anyone, really),

I am not too familiar with some of the low-level machine
details that might (do!) influence some of the semaphore
implementations.  I was hoping I might get you to give
me a quick nudge in the right direction here.

Here is a brief example of the differences found in
the ppc and pp64 versions of asm-ppc*/rwsem.h:

    (ppc is -, and ppc64 is + here)

    @@ -69,9 +74,7 @@
      */
     static inline void __down_read(struct rw_semaphore *sem)
     {
    -       if (atomic_inc_return((atomic_t *)(&sem->count)) > 0)
    -               smp_wmb();
    -       else
    +       if (unlikely(atomic_inc_return((atomic_t *)(&sem->count)) <= 0))
                    rwsem_down_read_failed(sem);
     }

If we add likely() to the PPC version, and then invert it,
we can get effectively this:

    static inline void __down_read(struct rw_semaphore *sem)
    {
            if (unlikely(atomic_inc_return((atomic_t *)(&sem->count)) <= 0))
                    rwsem_down_read_failed(sem);
    #ifndef __powerpc64__
            else
                    smp_wmb();
    #endif
    }

Which begs the question, what is the "else smp_wmb();" clause
really doing for us in the ppc32 case, and can we either
get rid of it, or is it safe to add to the ppc64 case?

Thanks,
jdl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-19  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-13 17:06 Merge Question on asm-ppc*/rwsem.h Jon Loeliger
2005-09-18 23:22 ` Paul Mackerras
2005-09-19  2:20   ` Jon Loeliger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.