lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201802210231.IRtd7Bkg%fengguang.wu@intel.com>
Date:   Wed, 21 Feb 2018 02:33:47 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Christian König 
        <ckoenig.leichtzumerken@...il.com>
Cc:     kbuild-all@...org, peterz@...radead.org,
        amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
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 <maarten.lankhorst@...onical.com>
:::::: CC: Ingo Molnar <mingo@...nel.org>

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

Download attachment ".config.gz" of type "application/gzip" (6763 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ