From: kernel test robot <lkp@intel.com>
To: Dan Williams <dan.j.williams@intel.com>, linux-cxl@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
David Lechner <dlechner@baylibre.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
"Fabio M. De Francesco"
<fabio.maria.de.francesco@linux.intel.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH 1/7] cleanup: Introduce DEFINE_ACQUIRE() a CLASS() for conditional locking
Date: Sat, 10 May 2025 03:10:50 +0800 [thread overview]
Message-ID: <202505100206.85k3mymM-lkp@intel.com> (raw)
In-Reply-To: <20250507072145.3614298-2-dan.j.williams@intel.com>
Hi Dan,
kernel test robot noticed the following build errors:
[auto build test ERROR on b4432656b36e5cc1d50a1f2dc15357543add530e]
url: https://github.com/intel-lab-lkp/linux/commits/Dan-Williams/cleanup-Introduce-DEFINE_ACQUIRE-a-CLASS-for-conditional-locking/20250507-152728
base: b4432656b36e5cc1d50a1f2dc15357543add530e
patch link: https://lore.kernel.org/r/20250507072145.3614298-2-dan.j.williams%40intel.com
patch subject: [PATCH 1/7] cleanup: Introduce DEFINE_ACQUIRE() a CLASS() for conditional locking
config: arm-randconfig-001-20250509 (https://download.01.org/0day-ci/archive/20250510/202505100206.85k3mymM-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250510/202505100206.85k3mymM-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505100206.85k3mymM-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
In file included from include/linux/irqflags.h:17,
from arch/arm/include/asm/bitops.h:28,
from include/linux/bitops.h:68,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4defs.h:40,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:36,
from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10,
from arch/arm/boot/compressed/decompress.c:60:
include/linux/mutex.h: In function 'class_mutex_intr_acquire_destructor':
>> include/linux/cleanup.h:476:13: error: implicit declaration of function 'IS_ERR_OR_NULL' [-Werror=implicit-function-declaration]
if (!IS_ERR_OR_NULL(_T)) _unlock(&_T->_locktype), ({ \
^~~~~~~~~~~~~~
include/linux/cleanup.h:246:18: note: in definition of macro 'DEFINE_CLASS'
{ _type _T = *p; _exit; } \
^~~~~
include/linux/mutex.h:216:1: note: in expansion of macro 'DEFINE_ACQUIRE'
DEFINE_ACQUIRE(mutex_intr_acquire, mutex, mutex_unlock,
^~~~~~~~~~~~~~
include/linux/mutex.h: In function 'class_mutex_intr_acquire_constructor':
>> include/linux/cleanup.h:481:24: error: implicit declaration of function 'ERR_PTR'; did you mean 'PERCPU_PTR'? [-Werror=implicit-function-declaration]
lock_result = ERR_PTR(ret); \
^~~~~~~
include/linux/cleanup.h:248:13: note: in definition of macro 'DEFINE_CLASS'
{ _type t = _init; return t; }
^~~~~
include/linux/mutex.h:216:1: note: in expansion of macro 'DEFINE_ACQUIRE'
DEFINE_ACQUIRE(mutex_intr_acquire, mutex, mutex_unlock,
^~~~~~~~~~~~~~
>> include/linux/cleanup.h:481:22: warning: assignment to 'struct mutex_acquire *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
lock_result = ERR_PTR(ret); \
^
include/linux/cleanup.h:248:13: note: in definition of macro 'DEFINE_CLASS'
{ _type t = _init; return t; }
^~~~~
include/linux/mutex.h:216:1: note: in expansion of macro 'DEFINE_ACQUIRE'
DEFINE_ACQUIRE(mutex_intr_acquire, mutex, mutex_unlock,
^~~~~~~~~~~~~~
include/linux/mutex.h: In function 'class_mutex_try_acquire_constructor':
>> include/linux/cleanup.h:481:22: warning: assignment to 'struct mutex_acquire *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
lock_result = ERR_PTR(ret); \
^
include/linux/cleanup.h:248:13: note: in definition of macro 'DEFINE_CLASS'
{ _type t = _init; return t; }
^~~~~
include/linux/mutex.h:226:1: note: in expansion of macro 'DEFINE_ACQUIRE'
DEFINE_ACQUIRE(mutex_try_acquire, mutex, mutex_unlock,
^~~~~~~~~~~~~~
In file included from include/linux/rwsem.h:17,
from include/linux/mm_types.h:13,
from include/linux/mmzone.h:22,
from include/linux/gfp.h:7,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:17,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:38,
from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10,
from arch/arm/boot/compressed/decompress.c:60:
include/linux/err.h: At top level:
>> include/linux/err.h:39:35: error: conflicting types for 'ERR_PTR'
static inline void * __must_check ERR_PTR(long error)
^~~~~~~
In file included from include/linux/irqflags.h:17,
from arch/arm/include/asm/bitops.h:28,
from include/linux/bitops.h:68,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4defs.h:40,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:36,
from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10,
from arch/arm/boot/compressed/decompress.c:60:
include/linux/cleanup.h:481:24: note: previous implicit declaration of 'ERR_PTR' was here
lock_result = ERR_PTR(ret); \
^~~~~~~
include/linux/cleanup.h:248:13: note: in definition of macro 'DEFINE_CLASS'
{ _type t = _init; return t; }
^~~~~
include/linux/mutex.h:216:1: note: in expansion of macro 'DEFINE_ACQUIRE'
DEFINE_ACQUIRE(mutex_intr_acquire, mutex, mutex_unlock,
^~~~~~~~~~~~~~
In file included from include/linux/rwsem.h:17,
from include/linux/mm_types.h:13,
from include/linux/mmzone.h:22,
from include/linux/gfp.h:7,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:17,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:38,
from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10,
from arch/arm/boot/compressed/decompress.c:60:
>> include/linux/err.h:82:33: error: conflicting types for 'IS_ERR_OR_NULL'
static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
^~~~~~~~~~~~~~
In file included from include/linux/irqflags.h:17,
from arch/arm/include/asm/bitops.h:28,
from include/linux/bitops.h:68,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4defs.h:40,
from arch/arm/boot/compressed/../../../../lib/lz4/lz4_decompress.c:36,
from arch/arm/boot/compressed/../../../../lib/decompress_unlz4.c:10,
from arch/arm/boot/compressed/decompress.c:60:
include/linux/cleanup.h:476:13: note: previous implicit declaration of 'IS_ERR_OR_NULL' was here
if (!IS_ERR_OR_NULL(_T)) _unlock(&_T->_locktype), ({ \
^~~~~~~~~~~~~~
include/linux/cleanup.h:246:18: note: in definition of macro 'DEFINE_CLASS'
{ _type _T = *p; _exit; } \
^~~~~
include/linux/mutex.h:216:1: note: in expansion of macro 'DEFINE_ACQUIRE'
DEFINE_ACQUIRE(mutex_intr_acquire, mutex, mutex_unlock,
^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/IS_ERR_OR_NULL +476 include/linux/cleanup.h
416
417 #define DEFINE_LOCK_GUARD_1_COND(_name, _ext, _condlock) \
418 __DEFINE_CLASS_IS_CONDITIONAL(_name##_ext, true); \
419 EXTEND_CLASS(_name, _ext, \
420 ({ class_##_name##_t _t = { .lock = l }, *_T = &_t;\
421 if (_T->lock && !(_condlock)) _T->lock = NULL; \
422 _t; }), \
423 typeof_member(class_##_name##_t, lock) l) \
424 static inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \
425 { return class_##_name##_lock_ptr(_T); }
426
427 /*
428 * DEFINE_ACQUIRE(acquire_class_name, lock_type, unlock, cond_lock):
429 * Define a CLASS() that instantiates and acquires a conditional lock
430 * within an existing scope. In contrast to DEFINE_GUARD[_COND](), which
431 * hides the variable tracking the lock scope, CLASS(@acquire_class_name,
432 * @lock) instantiates @lock as either an ERR_PTR() or a cookie that drops
433 * the lock when it goes out of scope. An "_acquire" suffix is appended to
434 * @lock_type to provide type-safety against mixing explicit and implicit
435 * (scope-based) cleanup.
436 *
437 * Ex.
438 *
439 * DEFINE_ACQUIRE(mutex_intr_acquire, mutex, mutex_unlock,
440 * mutex_lock_interruptible)
441 *
442 * int interruptible_operation(...)
443 * {
444 * ...
445 * CLASS(mutex_intr_acquire, lock)(&obj->lock);
446 * if (IS_ERR(lock))
447 * return PTR_ERR(lock);
448 * ...
449 * } <= obj->lock dropped here.
450 *
451 * Attempts to perform:
452 *
453 * mutex_unlock(&obj->lock);
454 *
455 * ...fail because obj->lock is a 'struct mutex_acquire' not 'struct mutex'
456 * instance.
457 *
458 * Also, attempts to use the CLASS() conditionally require the ambiguous
459 * scope to be clarified (compiler enforced):
460 *
461 * if (...)
462 * CLASS(mutex_intr_acquire, lock)(&obj->lock); // <-- "error: expected expression"
463 * if (IS_ERR(lock))
464 * return PTR_ERR(lock);
465 *
466 * vs:
467 *
468 * if (...) {
469 * CLASS(mutex_intr_acquire, lock)(&obj->lock);
470 * if (IS_ERR(lock))
471 * return PTR_ERR(lock);
472 * } // <-- lock released here
473 */
474 #define DEFINE_ACQUIRE(_name, _locktype, _unlock, _cond_lock) \
475 DEFINE_CLASS(_name, struct _locktype##_acquire *, \
> 476 if (!IS_ERR_OR_NULL(_T)) _unlock(&_T->_locktype), ({ \
477 struct _locktype##_acquire *lock_result; \
478 int ret = _cond_lock(&to_lock->_locktype); \
479 \
480 if (ret) \
> 481 lock_result = ERR_PTR(ret); \
482 else \
483 lock_result = \
484 (struct _locktype##_acquire \
485 *)&to_lock->_locktype; \
486 lock_result; \
487 }), \
488 struct _locktype##_acquire *to_lock)
489
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-05-09 19:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 7:21 [PATCH 0/7] Introduce DEFINE_ACQUIRE(), a scoped_cond_guard() replacement Dan Williams
2025-05-07 7:21 ` [PATCH 1/7] cleanup: Introduce DEFINE_ACQUIRE() a CLASS() for conditional locking Dan Williams
2025-05-07 9:32 ` Peter Zijlstra
2025-05-07 21:18 ` Dan Williams
2025-05-08 11:00 ` Peter Zijlstra
2025-05-09 5:04 ` Dan Williams
2025-05-09 10:40 ` Peter Zijlstra
2025-05-10 1:11 ` dan.j.williams
2025-05-12 10:50 ` Peter Zijlstra
2025-05-12 18:25 ` Peter Zijlstra
2025-05-12 18:58 ` Peter Zijlstra
2025-05-12 20:39 ` Linus Torvalds
2025-05-13 7:09 ` Peter Zijlstra
2025-05-13 8:50 ` Peter Zijlstra
2025-05-13 19:46 ` Linus Torvalds
2025-05-13 20:06 ` Al Viro
2025-05-13 20:31 ` Al Viro
2025-05-13 21:28 ` Linus Torvalds
2025-05-17 9:17 ` David Laight
2025-05-14 6:46 ` Peter Zijlstra
2025-05-13 3:32 ` dan.j.williams
2025-05-09 19:10 ` kernel test robot [this message]
2025-05-07 7:21 ` [PATCH 2/7] cxl/decoder: Move decoder register programming to a helper Dan Williams
2025-05-07 7:21 ` [PATCH 3/7] cxl/decoder: Drop pointless locking Dan Williams
2025-05-07 7:21 ` [PATCH 4/7] cxl/region: Split commit_store() into __commit() and queue_reset() helpers Dan Williams
2025-05-07 7:21 ` [PATCH 5/7] cxl/region: Move ready-to-probe state check to a helper Dan Williams
2025-05-07 7:21 ` [PATCH 6/7] cxl/region: Introduce CLASS(cxl_decoder_detach...) consolidate multiple paths Dan Williams
2025-05-08 7:44 ` kernel test robot
2025-05-07 7:21 ` [PATCH 7/7] cleanup: Create an rwsem conditional acquisition class Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202505100206.85k3mymM-lkp@intel.com \
--to=lkp@intel.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=dlechner@baylibre.com \
--cc=fabio.maria.de.francesco@linux.intel.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=peterz@infradead.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.