This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix parisc atomic locking builtins for libgomp


On Sun, Nov 23, 2008 at 3:57 PM, Helge Deller <deller@gmx.de> wrote:
> 2008-11-23  Helge Deller  <deller@gmx.de>
>
>        * pa/linux-atomic.c (EBUSY): Define if not _LP64.
>        (__kernel_cmpxchg): Return -EBUSY if the kernel LWS call
>        succeeded and lws_ret is not equal to oldval.
>
> Index: config/pa/linux-atomic.c
> ===================================================================
> --- config/pa/linux-atomic.c    (revision 142140)
> +++ config/pa/linux-atomic.c    (working copy)
> @@ -33,8 +33,9 @@
>  #ifndef _LP64
>  #include <errno.h>
>  #else
> +#define EFAULT  14
> +#define EBUSY   16
>  #define ENOSYS 251
> -#define EFAULT 14
>  #endif
>
>  /* All PA-RISC implementations supported by linux have strongly
> @@ -74,6 +75,13 @@
>   );
>   if (__builtin_expect (lws_errno == -EFAULT || lws_errno == -ENOSYS, 0))
>     ABORT_INSTRUCTION;
> +
> +  /* If the kernel LWS call succeeded (lws_errno == 0), lws_ret contains
> +     the old value from memory.  If this value is equal to OLDVAL, the
> +     new value was written to memory.  If not, return -EBUSY.  */
> +  if (!lws_errno && lws_ret != oldval)
> +    lws_errno = -EBUSY;
> +
>   return lws_errno;
>  }

If lws_errno is zero then the write to memory succeeded.

This patch implies a bug in the kernel code.

Under what condition is lws_errno == 0 and lws_ret != oldval?

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]