2018-02-20 14:50:50

by Christian König

[permalink] [raw]
Subject: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

amdgpu needs to verify if userspace sends us valid addresses and the simplest
way of doing this is to check if the buffer object is locked with the ticket
of the current submission.

Clean up the access to the ww_mutex internals by providing a function
for this and extend the check to the thread owning the underlying mutex.

v2: split amdgpu changes into separate patch as suggested by Alex
v3: change logic as suggested by Daniel
v4: fix test in case ctx is NULL

Signed-off-by: Christian König <[email protected]>
---
include/linux/ww_mutex.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
index 39fda195bf78..fea4acc0bcbc 100644
--- a/include/linux/ww_mutex.h
+++ b/include/linux/ww_mutex.h
@@ -358,4 +358,23 @@ static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
return mutex_is_locked(&lock->base);
}

+/**
+ * ww_mutex_is_owned_by - is the w/w mutex locked by this task in that context
+ * @lock: the mutex to be queried
+ * @ctx: the w/w acquire context to test
+ *
+ * If @ctx is not NULL test if the mutex is owned by this context.
+ * If @ctx is NULL test if the mutex is owned by the current thread and not
+ * locked in any context.
+ */
+static inline bool ww_mutex_is_owned_by(struct ww_mutex *lock,
+ struct ww_acquire_ctx *ctx)
+{
+ if (ctx)
+ return likely(READ_ONCE(lock->ctx) == ctx);
+
+ return likely(__mutex_owner(&lock->base) == current) &&
+ likely(READ_ONCE(lock->ctx) == NULL;
+}
+
#endif
--
2.14.1



2018-02-20 15:27:02

by Eric Engestrom

[permalink] [raw]
Subject: Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

On Tuesday, 2018-02-20 15:49:46 +0100, Christian König wrote:
> amdgpu needs to verify if userspace sends us valid addresses and the simplest
> way of doing this is to check if the buffer object is locked with the ticket
> of the current submission.
>
> Clean up the access to the ww_mutex internals by providing a function
> for this and extend the check to the thread owning the underlying mutex.
>
> v2: split amdgpu changes into separate patch as suggested by Alex
> v3: change logic as suggested by Daniel
> v4: fix test in case ctx is NULL
>
> Signed-off-by: Christian König <[email protected]>
> ---
> include/linux/ww_mutex.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
> index 39fda195bf78..fea4acc0bcbc 100644
> --- a/include/linux/ww_mutex.h
> +++ b/include/linux/ww_mutex.h
> @@ -358,4 +358,23 @@ static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
> return mutex_is_locked(&lock->base);
> }
>
> +/**
> + * ww_mutex_is_owned_by - is the w/w mutex locked by this task in that context
> + * @lock: the mutex to be queried
> + * @ctx: the w/w acquire context to test
> + *
> + * If @ctx is not NULL test if the mutex is owned by this context.
> + * If @ctx is NULL test if the mutex is owned by the current thread and not
> + * locked in any context.
> + */
> +static inline bool ww_mutex_is_owned_by(struct ww_mutex *lock,
> + struct ww_acquire_ctx *ctx)
> +{
> + if (ctx)
> + return likely(READ_ONCE(lock->ctx) == ctx);
> +
> + return likely(__mutex_owner(&lock->base) == current) &&
> + likely(READ_ONCE(lock->ctx) == NULL;
typo: )

> +}
> +
> #endif
> --
> 2.14.1
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

2018-02-20 16:33:13

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

On Tue, Feb 20, 2018 at 03:49:46PM +0100, Christian K?nig wrote:
> amdgpu needs to verify if userspace sends us valid addresses and the simplest
> way of doing this is to check if the buffer object is locked with the ticket
> of the current submission.
>
> Clean up the access to the ww_mutex internals by providing a function
> for this and extend the check to the thread owning the underlying mutex.
>
> v2: split amdgpu changes into separate patch as suggested by Alex
> v3: change logic as suggested by Daniel
> v4: fix test in case ctx is NULL
>
> Signed-off-by: Christian K?nig <[email protected]>
> ---
> include/linux/ww_mutex.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
> index 39fda195bf78..fea4acc0bcbc 100644
> --- a/include/linux/ww_mutex.h
> +++ b/include/linux/ww_mutex.h
> @@ -358,4 +358,23 @@ static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
> return mutex_is_locked(&lock->base);
> }
>
> +/**
> + * ww_mutex_is_owned_by - is the w/w mutex locked by this task in that context
> + * @lock: the mutex to be queried
> + * @ctx: the w/w acquire context to test
> + *
> + * If @ctx is not NULL test if the mutex is owned by this context.
> + * If @ctx is NULL test if the mutex is owned by the current thread and not
> + * locked in any context.

Ok I think with the increased guarantees this needs a better kerneldoc, I
think we need to at least add ".... and not locked in any context, i.e.
acquired using either ww_mutex_trylock() or ww_mutex_lock() without
supplying a &ww_acquire_ctx."

I think with that we have a nice 1:1 mapping between the context you
supply to the ww_mutex_lock function and to this one. That means generic
code which takes a ctx (but can handle NULL) should dtrt no matter what.

With the kerneldoc augmented:

Reviewed-by: Daniel Vetter <[email protected]>

I'll probably regret this r-b too, but hey to err is human :-)

Cheers, Daniel

> + */
> +static inline bool ww_mutex_is_owned_by(struct ww_mutex *lock,
> + struct ww_acquire_ctx *ctx)
> +{
> + if (ctx)
> + return likely(READ_ONCE(lock->ctx) == ctx);
> +
> + return likely(__mutex_owner(&lock->base) == current) &&
> + likely(READ_ONCE(lock->ctx) == NULL;
> +}
> +
> #endif
> --
> 2.14.1
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2018-02-20 18:35:04

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

Hi Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc2 next-20180220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Christian-K-nig/locking-ww_mutex-add-ww_mutex_is_owned_by-function-v4/20180221-021317
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All error/warnings (new ones prefixed by >>):

In file included from kernel/locking/mutex.c:21:0:
include/linux/ww_mutex.h: In function 'ww_mutex_is_owned_by':
>> include/linux/ww_mutex.h:380:0: error: unterminated argument list invoking macro "likely"
#endif

>> include/linux/ww_mutex.h:377:3: error: 'likely' undeclared (first use in this function)
likely(READ_ONCE(lock->ctx) == NULL;
^~~~~~
include/linux/ww_mutex.h:377:3: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/thread_info.h:13:0,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> include/linux/restart_block.h:11:1: error: expected ';' before 'struct'
struct timespec;
^~~~~~
>> include/linux/restart_block.h:12:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct compat_timespec;
^~~~~~
In file included from include/linux/thread_info.h:38:0,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> arch/x86/include/asm/thread_info.h:170:19: error: invalid storage class for function 'arch_within_stack_frames'
static inline int arch_within_stack_frames(const void * const stack,
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/preempt.h:7:0,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> include/linux/thread_info.h:57:20: error: invalid storage class for function 'set_ti_thread_flag'
static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:62:20: error: invalid storage class for function 'clear_ti_thread_flag'
static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:67:19: error: invalid storage class for function 'test_and_set_ti_thread_flag'
static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:72:19: error: invalid storage class for function 'test_and_clear_ti_thread_flag'
static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:77:19: error: invalid storage class for function 'test_ti_thread_flag'
static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:115:20: error: invalid storage class for function 'check_object_size'
static inline void check_object_size(const void *ptr, unsigned long n,
^~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:125:20: error: invalid storage class for function 'copy_overflow'
static inline void copy_overflow(int size, unsigned long count)
^~~~~~~~~~~~~
>> include/linux/thread_info.h:131:1: error: invalid storage class for function 'check_copy_size'
check_copy_size(const void *addr, size_t bytes, bool is_source)
^~~~~~~~~~~~~~~
In file included from include/asm-generic/percpu.h:7:0,
from arch/x86/include/asm/percpu.h:543,
from arch/x86/include/asm/current.h:6,
from include/linux/mutex.h:14,
from kernel/locking/mutex.c:20:
>> arch/x86/include/asm/preempt.h:9:22: error: section attribute cannot be specified for local variables
DECLARE_PER_CPU(int, __preempt_count);
^
include/linux/percpu-defs.h:101:44: note: in definition of macro 'DECLARE_PER_CPU_SECTION'
extern __PCPU_ATTRS(sec) __typeof__(type) name
^~~~
>> arch/x86/include/asm/preempt.h:9:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(int, __preempt_count);
^~~~~~~~~~~~~~~
In file included from include/linux/preempt.h:81:0,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> arch/x86/include/asm/preempt.h:21:28: error: invalid storage class for function 'preempt_count'
static __always_inline int preempt_count(void)
^~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:26:29: error: invalid storage class for function 'preempt_count_set'
static __always_inline void preempt_count_set(int pc)
^~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:55:29: error: invalid storage class for function 'set_preempt_need_resched'
static __always_inline void set_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:60:29: error: invalid storage class for function 'clear_preempt_need_resched'
static __always_inline void clear_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:65:29: error: invalid storage class for function 'test_preempt_need_resched'
static __always_inline bool test_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from kernel//locking/mutex.c:21:0:
include/linux/ww_mutex.h: In function 'ww_mutex_is_owned_by':
>> include/linux/ww_mutex.h:380:0: error: unterminated argument list invoking macro "likely"
#endif

>> include/linux/ww_mutex.h:377:3: error: 'likely' undeclared (first use in this function)
likely(READ_ONCE(lock->ctx) == NULL;
^~~~~~
include/linux/ww_mutex.h:377:3: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/thread_info.h:13:0,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel//locking/mutex.c:22:
>> include/linux/restart_block.h:11:1: error: expected ';' before 'struct'
struct timespec;
^~~~~~
>> include/linux/restart_block.h:12:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct compat_timespec;
^~~~~~
In file included from include/linux/thread_info.h:38:0,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel//locking/mutex.c:22:
>> arch/x86/include/asm/thread_info.h:170:19: error: invalid storage class for function 'arch_within_stack_frames'
static inline int arch_within_stack_frames(const void * const stack,
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/preempt.h:7:0,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel//locking/mutex.c:22:
>> include/linux/thread_info.h:57:20: error: invalid storage class for function 'set_ti_thread_flag'
static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:62:20: error: invalid storage class for function 'clear_ti_thread_flag'
static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:67:19: error: invalid storage class for function 'test_and_set_ti_thread_flag'
static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:72:19: error: invalid storage class for function 'test_and_clear_ti_thread_flag'
static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:77:19: error: invalid storage class for function 'test_ti_thread_flag'
static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:115:20: error: invalid storage class for function 'check_object_size'
static inline void check_object_size(const void *ptr, unsigned long n,
^~~~~~~~~~~~~~~~~
>> include/linux/thread_info.h:125:20: error: invalid storage class for function 'copy_overflow'
static inline void copy_overflow(int size, unsigned long count)
^~~~~~~~~~~~~
>> include/linux/thread_info.h:131:1: error: invalid storage class for function 'check_copy_size'
check_copy_size(const void *addr, size_t bytes, bool is_source)
^~~~~~~~~~~~~~~
In file included from include/asm-generic/percpu.h:7:0,
from arch/x86/include/asm/percpu.h:543,
from arch/x86/include/asm/current.h:6,
from include/linux/mutex.h:14,
from kernel//locking/mutex.c:20:
>> arch/x86/include/asm/preempt.h:9:22: error: section attribute cannot be specified for local variables
DECLARE_PER_CPU(int, __preempt_count);
^
include/linux/percpu-defs.h:101:44: note: in definition of macro 'DECLARE_PER_CPU_SECTION'
extern __PCPU_ATTRS(sec) __typeof__(type) name
^~~~
>> arch/x86/include/asm/preempt.h:9:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(int, __preempt_count);
^~~~~~~~~~~~~~~
In file included from include/linux/preempt.h:81:0,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel//locking/mutex.c:22:
>> arch/x86/include/asm/preempt.h:21:28: error: invalid storage class for function 'preempt_count'
static __always_inline int preempt_count(void)
^~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:26:29: error: invalid storage class for function 'preempt_count_set'
static __always_inline void preempt_count_set(int pc)
^~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:55:29: error: invalid storage class for function 'set_preempt_need_resched'
static __always_inline void set_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:60:29: error: invalid storage class for function 'clear_preempt_need_resched'
static __always_inline void clear_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/preempt.h:65:29: error: invalid storage class for function 'test_preempt_need_resched'
static __always_inline bool test_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~~

vim +/likely +380 include/linux/ww_mutex.h

1b375dc3 Maarten Lankhorst 2013-07-05 360
6cb2b111 Christian K?nig 2018-02-20 361 /**
6cb2b111 Christian K?nig 2018-02-20 362 * ww_mutex_is_owned_by - is the w/w mutex locked by this task in that context
6cb2b111 Christian K?nig 2018-02-20 363 * @lock: the mutex to be queried
6cb2b111 Christian K?nig 2018-02-20 364 * @ctx: the w/w acquire context to test
6cb2b111 Christian K?nig 2018-02-20 365 *
6cb2b111 Christian K?nig 2018-02-20 366 * If @ctx is not NULL test if the mutex is owned by this context.
6cb2b111 Christian K?nig 2018-02-20 367 * If @ctx is NULL test if the mutex is owned by the current thread and not
6cb2b111 Christian K?nig 2018-02-20 368 * locked in any context.
6cb2b111 Christian K?nig 2018-02-20 369 */
6cb2b111 Christian K?nig 2018-02-20 370 static inline bool ww_mutex_is_owned_by(struct ww_mutex *lock,
6cb2b111 Christian K?nig 2018-02-20 371 struct ww_acquire_ctx *ctx)
6cb2b111 Christian K?nig 2018-02-20 372 {
6cb2b111 Christian K?nig 2018-02-20 373 if (ctx)
6cb2b111 Christian K?nig 2018-02-20 374 return likely(READ_ONCE(lock->ctx) == ctx);
6cb2b111 Christian K?nig 2018-02-20 375
6cb2b111 Christian K?nig 2018-02-20 376 return likely(__mutex_owner(&lock->base) == current) &&
6cb2b111 Christian K?nig 2018-02-20 @377 likely(READ_ONCE(lock->ctx) == NULL;
6cb2b111 Christian K?nig 2018-02-20 378 }
6cb2b111 Christian K?nig 2018-02-20 379
1b375dc3 Maarten Lankhorst 2013-07-05 @380 #endif

:::::: The code at line 380 was first introduced by commit
:::::: 1b375dc30710180c4b88cc59caba6e3481ec5c8b mutex: Move ww_mutex definitions to ww_mutex.h

:::::: TO: Maarten Lankhorst <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (14.59 kB)
.config.gz (6.60 kB)
Download all attachments

2018-02-20 19:16:18

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] locking/ww_mutex: add ww_mutex_is_owned_by function v4

Hi Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc2 next-20180220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Christian-K-nig/locking-ww_mutex-add-ww_mutex_is_owned_by-function-v4/20180221-021317
config: microblaze-mmu_defconfig (attached as .config)
compiler: microblaze-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=microblaze

All error/warnings (new ones prefixed by >>):

In file included from kernel/locking/mutex.c:21:0:
include/linux/ww_mutex.h: In function 'ww_mutex_is_owned_by':
include/linux/ww_mutex.h:380:0: error: unterminated argument list invoking macro "likely"
#endif

include/linux/ww_mutex.h:377:3: error: 'likely' undeclared (first use in this function)
likely(READ_ONCE(lock->ctx) == NULL;
^~~~~~
include/linux/ww_mutex.h:377:3: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/thread_info.h:13:0,
from include/asm-generic/preempt.h:5,
from ./arch/microblaze/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
include/linux/restart_block.h:11:1: error: expected ';' before 'struct'
struct timespec;
^~~~~~
include/linux/restart_block.h:12:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct compat_timespec;
^~~~~~
In file included from include/linux/thread_info.h:38:0,
from include/asm-generic/preempt.h:5,
from ./arch/microblaze/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> arch/microblaze/include/asm/thread_info.h:90:35: error: invalid storage class for function 'current_thread_info'
static inline struct thread_info *current_thread_info(void)
^~~~~~~~~~~~~~~~~~~
In file included from include/asm-generic/preempt.h:5:0,
from ./arch/microblaze/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
include/linux/thread_info.h:57:20: error: invalid storage class for function 'set_ti_thread_flag'
static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~
include/linux/thread_info.h:62:20: error: invalid storage class for function 'clear_ti_thread_flag'
static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~
include/linux/thread_info.h:67:19: error: invalid storage class for function 'test_and_set_ti_thread_flag'
static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/thread_info.h:72:19: error: invalid storage class for function 'test_and_clear_ti_thread_flag'
static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/thread_info.h:77:19: error: invalid storage class for function 'test_ti_thread_flag'
static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
^~~~~~~~~~~~~~~~~~~
include/linux/thread_info.h:96:19: error: invalid storage class for function 'arch_within_stack_frames'
static inline int arch_within_stack_frames(const void * const stack,
^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/thread_info.h:115:20: error: invalid storage class for function 'check_object_size'
static inline void check_object_size(const void *ptr, unsigned long n,
^~~~~~~~~~~~~~~~~
include/linux/thread_info.h:125:20: error: invalid storage class for function 'copy_overflow'
static inline void copy_overflow(int size, unsigned long count)
^~~~~~~~~~~~~
include/linux/thread_info.h:131:1: error: invalid storage class for function 'check_copy_size'
check_copy_size(const void *addr, size_t bytes, bool is_source)
^~~~~~~~~~~~~~~
include/linux/thread_info.h:148:20: error: invalid storage class for function 'arch_setup_new_exec'
static inline void arch_setup_new_exec(void) { }
^~~~~~~~~~~~~~~~~~~
In file included from ./arch/microblaze/include/generated/asm/preempt.h:1:0,
from include/linux/preempt.h:81,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
include/asm-generic/preempt.h:9:28: error: invalid storage class for function 'preempt_count'
static __always_inline int preempt_count(void)
^~~~~~~~~~~~~
include/asm-generic/preempt.h:14:38: error: invalid storage class for function 'preempt_count_ptr'
static __always_inline volatile int *preempt_count_ptr(void)
^~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:19:29: error: invalid storage class for function 'preempt_count_set'
static __always_inline void preempt_count_set(int pc)
^~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:35:29: error: invalid storage class for function 'set_preempt_need_resched'
static __always_inline void set_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:39:29: error: invalid storage class for function 'clear_preempt_need_resched'
static __always_inline void clear_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:43:29: error: invalid storage class for function 'test_preempt_need_resched'
static __always_inline bool test_preempt_need_resched(void)
^~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:52:29: error: invalid storage class for function '__preempt_count_add'
static __always_inline void __preempt_count_add(int val)
^~~~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:57:29: error: invalid storage class for function '__preempt_count_sub'
static __always_inline void __preempt_count_sub(int val)
^~~~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:62:29: error: invalid storage class for function '__preempt_count_dec_and_test'
static __always_inline bool __preempt_count_dec_and_test(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/preempt.h:75:29: error: invalid storage class for function 'should_resched'
static __always_inline bool should_resched(int preempt_offset)
^~~~~~~~~~~~~~
In file included from include/linux/rcupdate.h:41:0,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
include/linux/bottom_half.h:10:29: error: invalid storage class for function '__local_bh_disable_ip'
static __always_inline void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)
^~~~~~~~~~~~~~~~~~~~~
include/linux/bottom_half.h:17:20: error: invalid storage class for function 'local_bh_disable'
static inline void local_bh_disable(void)
^~~~~~~~~~~~~~~~
include/linux/bottom_half.h:25:20: error: invalid storage class for function 'local_bh_enable_ip'
static inline void local_bh_enable_ip(unsigned long ip)
^~~~~~~~~~~~~~~~~~
include/linux/bottom_half.h:30:20: error: invalid storage class for function 'local_bh_enable'
static inline void local_bh_enable(void)
^~~~~~~~~~~~~~~
In file included from include/linux/bitmap.h:9:0,
from include/linux/cpumask.h:12,
from include/linux/rcupdate.h:44,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
include/linux/string.h:71:34: error: invalid storage class for function 'strstrip'
static inline __must_check char *strstrip(char *str)
^~~~~~~~
--
^~~~~~~~~~~~~
include/linux/cpumask.h:637:19: error: invalid storage class for function 'cpulist_parse'
static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
^~~~~~~~~~~~~
include/linux/cpumask.h:645:28: error: invalid storage class for function 'cpumask_size'
static inline unsigned int cpumask_size(void)
^~~~~~~~~~~~
include/linux/cpumask.h:715:20: error: invalid storage class for function 'alloc_cpumask_var'
static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
^~~~~~~~~~~~~~~~~
include/linux/cpumask.h:720:20: error: invalid storage class for function 'alloc_cpumask_var_node'
static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
^~~~~~~~~~~~~~~~~~~~~~
include/linux/cpumask.h:726:20: error: invalid storage class for function 'zalloc_cpumask_var'
static inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
^~~~~~~~~~~~~~~~~~
include/linux/cpumask.h:732:20: error: invalid storage class for function 'zalloc_cpumask_var_node'
static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/cpumask.h:739:20: error: invalid storage class for function 'alloc_bootmem_cpumask_var'
static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/cpumask.h:743:20: error: invalid storage class for function 'free_cpumask_var'
static inline void free_cpumask_var(cpumask_var_t mask)
^~~~~~~~~~~~~~~~
include/linux/cpumask.h:747:20: error: invalid storage class for function 'free_bootmem_cpumask_var'
static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/cpumask.h:751:20: error: invalid storage class for function 'cpumask_available'
static inline bool cpumask_available(cpumask_var_t mask)
^~~~~~~~~~~~~~~~~
include/linux/cpumask.h:774:20: error: invalid storage class for function 'reset_cpu_possible_mask'
static inline void reset_cpu_possible_mask(void)
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/cpumask.h:780:1: error: invalid storage class for function 'set_cpu_possible'
set_cpu_possible(unsigned int cpu, bool possible)
^~~~~~~~~~~~~~~~
include/linux/cpumask.h:789:1: error: invalid storage class for function 'set_cpu_present'
set_cpu_present(unsigned int cpu, bool present)
^~~~~~~~~~~~~~~
include/linux/cpumask.h:798:1: error: invalid storage class for function 'set_cpu_online'
set_cpu_online(unsigned int cpu, bool online)
^~~~~~~~~~~~~~
include/linux/cpumask.h:807:1: error: invalid storage class for function 'set_cpu_active'
set_cpu_active(unsigned int cpu, bool active)
^~~~~~~~~~~~~~
include/linux/cpumask.h:830:19: error: invalid storage class for function '__check_is_bitmap'
static inline int __check_is_bitmap(const unsigned long *bitmap)
^~~~~~~~~~~~~~~~~
include/linux/cpumask.h:845:37: error: invalid storage class for function 'get_cpu_mask'
static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
^~~~~~~~~~~~
include/linux/cpumask.h:880:1: error: invalid storage class for function 'cpumap_print_to_pagebuf'
cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/rculist.h:11:0,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
include/linux/rcupdate.h:80:20: error: invalid storage class for function '__rcu_read_lock'
static inline void __rcu_read_lock(void)
^~~~~~~~~~~~~~~
include/linux/rcupdate.h:86:20: error: invalid storage class for function '__rcu_read_unlock'
static inline void __rcu_read_unlock(void)
^~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:92:20: error: invalid storage class for function 'synchronize_rcu'
static inline void synchronize_rcu(void)
^~~~~~~~~~~~~~~
include/linux/rcupdate.h:97:19: error: invalid storage class for function 'rcu_preempt_depth'
static inline int rcu_preempt_depth(void)
^~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:118:20: error: invalid storage class for function 'rcu_sysrq_start'
static inline void rcu_sysrq_start(void) { }
^~~~~~~~~~~~~~~
include/linux/rcupdate.h:119:20: error: invalid storage class for function 'rcu_sysrq_end'
static inline void rcu_sysrq_end(void) { }
^~~~~~~~~~~~~
include/linux/rcupdate.h:126:20: error: invalid storage class for function 'rcu_user_enter'
static inline void rcu_user_enter(void) { }
^~~~~~~~~~~~~~
include/linux/rcupdate.h:127:20: error: invalid storage class for function 'rcu_user_exit'
static inline void rcu_user_exit(void) { }
^~~~~~~~~~~~~
include/linux/rcupdate.h:133:20: error: invalid storage class for function 'rcu_init_nohz'
static inline void rcu_init_nohz(void) { }
^~~~~~~~~~~~~
include/linux/rcupdate.h:186:20: error: invalid storage class for function 'exit_tasks_rcu_start'
static inline void exit_tasks_rcu_start(void) { }
^~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:187:20: error: invalid storage class for function 'exit_tasks_rcu_finish'
static inline void exit_tasks_rcu_finish(void) { }
^~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/spinlock.h:90:0,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/ktime.h:24,
from include/linux/rcutiny.h:28,
from include/linux/rcupdate.h:211,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> include/linux/spinlock_up.h:29:20: error: invalid storage class for function 'arch_spin_lock'
static inline void arch_spin_lock(arch_spinlock_t *lock)
^~~~~~~~~~~~~~
>> include/linux/spinlock_up.h:35:19: error: invalid storage class for function 'arch_spin_trylock'
static inline int arch_spin_trylock(arch_spinlock_t *lock)
^~~~~~~~~~~~~~~~~
>> include/linux/spinlock_up.h:45:20: error: invalid storage class for function 'arch_spin_unlock'
static inline void arch_spin_unlock(arch_spinlock_t *lock)
^~~~~~~~~~~~~~~~
In file included from include/linux/spinlock.h:288:0,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/ktime.h:24,
from include/linux/rcutiny.h:28,
from include/linux/rcupdate.h:211,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> include/linux/spinlock_api_smp.h:86:19: error: invalid storage class for function '__raw_spin_trylock'
static inline int __raw_spin_trylock(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:104:29: error: invalid storage class for function '__raw_spin_lock_irqsave'
static inline unsigned long __raw_spin_lock_irqsave(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:124:20: error: invalid storage class for function '__raw_spin_lock_irq'
static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:132:20: error: invalid storage class for function '__raw_spin_lock_bh'
static inline void __raw_spin_lock_bh(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:139:20: error: invalid storage class for function '__raw_spin_lock'
static inline void __raw_spin_lock(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:148:20: error: invalid storage class for function '__raw_spin_unlock'
static inline void __raw_spin_unlock(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:155:20: error: invalid storage class for function '__raw_spin_unlock_irqrestore'
static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:164:20: error: invalid storage class for function '__raw_spin_unlock_irq'
static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:172:20: error: invalid storage class for function '__raw_spin_unlock_bh'
static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock_api_smp.h:179:19: error: invalid storage class for function '__raw_spin_trylock_bh'
static inline int __raw_spin_trylock_bh(raw_spinlock_t *lock)
^~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/spinlock_api_smp.h:190:0,
from include/linux/spinlock.h:288,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/ktime.h:24,
from include/linux/rcutiny.h:28,
from include/linux/rcupdate.h:211,
from include/linux/rculist.h:11,
from include/linux/sched/signal.h:5,
from kernel/locking/mutex.c:22:
>> include/linux/rwlock_api_smp.h:117:19: error: invalid storage class for function '__raw_read_trylock'
static inline int __raw_read_trylock(rwlock_t *lock)
^~~~~~~~~~~~~~~~~~
>> include/linux/rwlock_api_smp.h:128:19: error: invalid storage class for function '__raw_write_trylock'
static inline int __raw_write_trylock(rwlock_t *lock)
^~~~~~~~~~~~~~~~~~~
>> include/linux/rwlock_api_smp.h:146:20: error: invalid storage class for function '__raw_read_lock'
static inline void __raw_read_lock(rwlock_t *lock)
^~~~~~~~~~~~~~~
>> include/linux/rwlock_api_smp.h:153:29: error: invalid storage class for function '__raw_read_lock_irqsave'
static inline unsigned long __raw_read_lock_irqsave(rwlock_t *lock)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rwlock_api_smp.h:165:20: error: invalid storage class for function '__raw_read_lock_irq'
static inline void __raw_read_lock_irq(rwlock_t *lock)
^~~~~~~~~~~~~~~~~~~
>> include/linux/rwlock_api_smp.h:173:20: error: invalid storage class for function '__raw_read_lock_bh'
static inline void __raw_read_lock_bh(rwlock_t *lock)
^~~~~~~~~~~~~~~~~~
..

vim +/current_thread_info +90 arch/microblaze/include/asm/thread_info.h

4684dade Michal Simek 2009-03-27 88
4684dade Michal Simek 2009-03-27 89 /* how to get the thread information struct from C */
4684dade Michal Simek 2009-03-27 @90 static inline struct thread_info *current_thread_info(void)
4684dade Michal Simek 2009-03-27 91 {
4684dade Michal Simek 2009-03-27 92 register unsigned long sp asm("r1");
4684dade Michal Simek 2009-03-27 93
4684dade Michal Simek 2009-03-27 94 return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
4684dade Michal Simek 2009-03-27 95 }
4684dade Michal Simek 2009-03-27 96

:::::: The code at line 90 was first introduced by commit
:::::: 4684dadec6ca3f310b0d9ff1860ca6b6f11ffd2d microblaze_v8: string.h thread_info.h

:::::: TO: Michal Simek <[email protected]>
:::::: CC: Michal Simek <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (21.67 kB)
.config.gz (12.73 kB)
Download all attachments