Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1601927 > unrolled thread

[mmotm] "x86/atomic: move __arch_atomic_add_unless out of line" build error

Started bySergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
First post2017-03-16 05:50 +0100
Last post2017-03-16 19:50 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [mmotm] "x86/atomic: move __arch_atomic_add_unless out of line"  build error Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-16 05:50 +0100
    Re: [mmotm] "x86/atomic: move __arch_atomic_add_unless out of line"  build error Dmitry Vyukov <dvyukov@google.com> - 2017-03-16 09:30 +0100
      Re: [mmotm] "x86/atomic: move __arch_atomic_add_unless out of line"  build error Andi Kleen <ak@linux.intel.com> - 2017-03-16 17:30 +0100
      Re: [mmotm] "x86/atomic: move __arch_atomic_add_unless out of line"  build error Andi Kleen <ak@linux.intel.com> - 2017-03-16 17:50 +0100
        Re: [mmotm] "x86/atomic: move __arch_atomic_add_unless out of line"  build error Andrew Morton <akpm@linux-foundation.org> - 2017-03-16 19:50 +0100

#1601927 — [mmotm] "x86/atomic: move __arch_atomic_add_unless out of line" build error

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-03-16 05:50 +0100
Subject[mmotm] "x86/atomic: move __arch_atomic_add_unless out of line" build error
Message-ID<tlvwl-1oS-3@gated-at.bofh.it>
Hello,

commit 4f86a82ff7df ("x86/atomic: move __arch_atomic_add_unless out of line")
moved __arch_atomic_add_unless() out atomic.h and new KASAN atomic
instrumentation [1] can't see it anymore


In file included from ./arch/x86/include/asm/atomic.h:257:0,
                 from ./include/linux/atomic.h:4,
                 from ./include/asm-generic/qspinlock_types.h:28,
                 from ./arch/x86/include/asm/spinlock_types.h:26,
                 from ./include/linux/spinlock_types.h:13,
                 from kernel/bounds.c:13:
./include/asm-generic/atomic-instrumented.h: In function ‘__atomic_add_unless’:
./include/asm-generic/atomic-instrumented.h:70:9: error: implicit declaration of function ‘__arch_atomic_add_unless’ [-Werror=implicit-function-declaration]
  return __arch_atomic_add_unless(v, a, u);
         ^~~~~~~~~~~~~~~~~~~~~~~~


so we need a declaration of __arch_atomic_add_unless() in arch/x86/include/asm/atomic.h


[1] lkml.kernel.org/r/7e450175a324bf93c602909c711bc34715d8e8f2.1489519233.git.dvyukov@google.com

	-ss

[toc] | [next] | [standalone]


#1602070

FromDmitry Vyukov <dvyukov@google.com>
Date2017-03-16 09:30 +0100
Message-ID<tlyXg-3YD-33@gated-at.bofh.it>
In reply to#1601927
On Thu, Mar 16, 2017 at 5:47 AM, Sergey Senozhatsky
<sergey.senozhatsky.work@gmail.com> wrote:
> Hello,
>
> commit 4f86a82ff7df ("x86/atomic: move __arch_atomic_add_unless out of line")
> moved __arch_atomic_add_unless() out atomic.h and new KASAN atomic
> instrumentation [1] can't see it anymore
>
>
> In file included from ./arch/x86/include/asm/atomic.h:257:0,
>                  from ./include/linux/atomic.h:4,
>                  from ./include/asm-generic/qspinlock_types.h:28,
>                  from ./arch/x86/include/asm/spinlock_types.h:26,
>                  from ./include/linux/spinlock_types.h:13,
>                  from kernel/bounds.c:13:
> ./include/asm-generic/atomic-instrumented.h: In function ‘__atomic_add_unless’:
> ./include/asm-generic/atomic-instrumented.h:70:9: error: implicit declaration of function ‘__arch_atomic_add_unless’ [-Werror=implicit-function-declaration]
>   return __arch_atomic_add_unless(v, a, u);
>          ^~~~~~~~~~~~~~~~~~~~~~~~
>
>
> so we need a declaration of __arch_atomic_add_unless() in arch/x86/include/asm/atomic.h
>
>
> [1] lkml.kernel.org/r/7e450175a324bf93c602909c711bc34715d8e8f2.1489519233.git.dvyukov@google.com
>
>         -ss


Andi, why did you completely remove __arch_atomic_add_unless() from
the header? Don't we need at least a declaration there?

[toc] | [prev] | [next] | [standalone]


#1602631

FromAndi Kleen <ak@linux.intel.com>
Date2017-03-16 17:30 +0100
Message-ID<tlGrM-X3-25@gated-at.bofh.it>
In reply to#1602070
> Andi, why did you completely remove __arch_atomic_add_unless() from
> the header? Don't we need at least a declaration there?

Yes the declaration should be there. I'll send a new patch.

-Andi

[toc] | [prev] | [next] | [standalone]


#1602648

FromAndi Kleen <ak@linux.intel.com>
Date2017-03-16 17:50 +0100
Message-ID<tlGL8-14c-21@gated-at.bofh.it>
In reply to#1602070
> Andi, why did you completely remove __arch_atomic_add_unless() from
> the header? Don't we need at least a declaration there?

Actually it's there in my git version:

I wonder where it disappeared.

-/**
- * __atomic_add_unless - add unless the number is already a given value
- * @v: pointer of type atomic_t
- * @a: the amount to add to v...
- * @u: ...unless v is equal to u.
- *
- * Atomically adds @a to @v, so long as @v was not already @u.
- * Returns the old value of @v.
- */
-static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u)
-{
-       int c, old;
-       c = atomic_read(v);
-       for (;;) {
-               if (unlikely(c == (u)))
-                       break;
-               old = atomic_cmpxchg((v), c, c + (a));
-               if (likely(old == c))
-                       break;
-               c = old;
-       }
-       return c;
-}
+int __atomic_add_unless(atomic_t *v, int a, int u);

[toc] | [prev] | [next] | [standalone]


#1602771

FromAndrew Morton <akpm@linux-foundation.org>
Date2017-03-16 19:50 +0100
Message-ID<tlIDf-2mJ-7@gated-at.bofh.it>
In reply to#1602648
On Thu, 16 Mar 2017 09:41:10 -0700 Andi Kleen <ak@linux.intel.com> wrote:

> > Andi, why did you completely remove __arch_atomic_add_unless() from
> > the header? Don't we need at least a declaration there?
> 
> Actually it's there in my git version:
> 
> I wonder where it disappeared.
> 
> -/**
> - * __atomic_add_unless - add unless the number is already a given value
> - * @v: pointer of type atomic_t
> - * @a: the amount to add to v...
> - * @u: ...unless v is equal to u.
> - *
> - * Atomically adds @a to @v, so long as @v was not already @u.
> - * Returns the old value of @v.
> - */
> -static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u)
> -{
> -       int c, old;
> -       c = atomic_read(v);
> -       for (;;) {
> -               if (unlikely(c == (u)))
> -                       break;
> -               old = atomic_cmpxchg((v), c, c + (a));
> -               if (likely(old == c))
> -                       break;
> -               c = old;
> -       }
> -       return c;
> -}
> +int __atomic_add_unless(atomic_t *v, int a, int u);

That was me fixing rejects (from
asm-generic-x86-wrap-atomic-operations.patch), incompletely.

--- a/arch/x86/include/asm/atomic.h~x86-atomic-move-__atomic_add_unless-out-of-line-fix
+++ a/arch/x86/include/asm/atomic.h
@@ -235,6 +235,8 @@ ATOMIC_OPS(xor, ^)
 #undef ATOMIC_FETCH_OP
 #undef ATOMIC_OP
 
+int __arch_atomic_add_unless(atomic_t *v, int a, int u);
+
 /**
  * arch_atomic_inc_short - increment of a short integer
  * @v: pointer to type int

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web