Fwd: Need help fixing DRM locking on Alpha

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ivan,

On Wed, Feb 11, 2009 at 10:48 AM, Ivan Kokshaysky
<ink@xxxxxxxxxxxxxxxxxxxx> wrote:
> Well, I've got slightly improved version, which saves one instruction
> for register-register move. Another instruction can be saved if we
> define DRM_CAS_RESULT(_result) as "long" (no need for sign extending then).
>
> Can you test this please?
>
> Ivan.
>
> --- libdrm-2.4.4/libdrm/xf86drm.h.orig  Wed Dec 17 21:28:24 2008
> +++ libdrm-2.4.4/libdrm/xf86drm.h       Wed Feb 11 03:07:05 2009
> @@ -325,28 +325,28 @@ typedef struct _drmSetVersion {
>
>  #elif defined(__alpha__)
>
> -#define        DRM_CAS(lock, old, new, ret)            \
> -       do {                                    \
> -               int old32;                      \
> -               int cur32;                      \
> -               __asm__ __volatile__(           \
> -               "       mb\n"                   \
> -               "       zap   %4, 0xF0, %0\n"   \
> -               "       ldl_l %1, %2\n"         \
> -               "       zap   %1, 0xF0, %1\n"   \
> -                "       cmpeq %0, %1, %1\n"    \
> -                "       beq   %1, 1f\n"                \
> -               "       bis   %5, %5, %1\n"     \
> -                "       stl_c %1, %2\n"                \
> -                "1:     xor   %1, 1, %1\n"     \
> -                "       stl   %1, %3"          \
> -                : "=r" (old32),                 \
> -                 "=&r" (cur32),                \
> -                   "=m" (__drm_dummy_lock(lock)),\
> -                   "=m" (ret)                  \
> -               : "r" (old),                    \
> -                 "r" (new));                   \
> -       } while(0)
> +#define        DRM_CAS(lock, old, new, ret)            \
> +       do {                                    \
> +               int tmp, old32;                 \
> +               __asm__ __volatile__(           \
> +               "       addl    $31, %5, %3\n"  \
> +               "1:     ldl_l   %0, %2\n"       \
> +               "       cmpeq   %0, %3, %1\n"   \
> +               "       beq     %1, 2f\n"       \
> +               "       mov     %4, %0\n"       \
> +               "       stl_c   %0, %2\n"       \
> +               "       beq     %0, 3f\n"       \
> +               "       mb\n"                   \
> +               "2:     cmpeq   %1, 0, %1\n"    \
> +               ".subsection 2\n"               \
> +               "3:     br      1b\n"           \
> +               ".previous"                     \
> +               : "=&r"(tmp), "=&r"(ret),       \
> +                 "=m"(__drm_dummy_lock(lock)), \
> +                 "=&r"(old32)                  \
> +               : "r"(new), "r"(old)            \
> +               : "memory");                    \
> +       } while (0)
>
>  #elif defined(__sparc__)
>
> @@ -429,7 +429,9 @@ do {        register unsigned int __old __asm("
>  #define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */
>  #endif
>
> -#if defined(__alpha__) || defined(__powerpc__)
> +#if defined(__alpha__)
> +#define DRM_CAS_RESULT(_result)                long _result
> +#elif defined(__powerpc__)
>  #define DRM_CAS_RESULT(_result)                int _result
>  #else
>  #define DRM_CAS_RESULT(_result)                char _result
>

I changed 'old32' to 'old' for the %3 output argument, but it fails to
compile with

> error: lvalue required in asm statement
> error: invalid lvalue in asm output 3

I saw this error with the first patch as well, but it was easily
avoided by changing old to an input. I'd fix it, but I don't know what
the appropriate thing is.

Thanks,

Matt Turner
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux