From: kernel test robot <lkp@intel.com>
To: "André Almeida" <andrealmeid@igalia.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"Shuah Khan" <skhan@linuxfoundation.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, kernel-dev@igalia.com,
"André Almeida" <andrealmeid@igalia.com>
Subject: Re: [PATCH v2] selftests/futex: Create test for robust list
Date: Sun, 8 Sep 2024 10:24:05 +0800 [thread overview]
Message-ID: <Zt0KxQlpXXGvugV9@rli9-mobl> (raw)
In-Reply-To: <20240903134033.816500-1-andrealmeid@igalia.com>
Hi André,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/locking/core]
[also build test WARNING on linus/master v6.11-rc6 next-20240906]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/selftests-futex-Create-test-for-robust-list/20240903-214428
base: tip/locking/core
patch link: https://lore.kernel.org/r/20240903134033.816500-1-andrealmeid%40igalia.com
patch subject: [PATCH v2] selftests/futex: Create test for robust list
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240907/202409071354.clW9RcwR-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/r/202409071354.clW9RcwR-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> robust_list.c:117:44: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
117 | if (atomic_compare_exchange_strong(futex, &zero, tid)) {
| ^~~~~
/opt/cross/clang-617a15a9ea/lib/clang/18/include/stdatomic.h:144:112: note: expanded from macro 'atomic_compare_exchange_strong'
144 | #define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
| ^~~~~~~~
1 warning generated.
vim +117 tools/testing/selftests/futex/functional/robust_list.c
32807b4449f353 André Almeida 2024-09-03 101
32807b4449f353 André Almeida 2024-09-03 102 /*
32807b4449f353 André Almeida 2024-09-03 103 * A basic (and incomplete) mutex lock function with robustness
32807b4449f353 André Almeida 2024-09-03 104 */
32807b4449f353 André Almeida 2024-09-03 105 static int mutex_lock(struct lock_struct *lock, struct robust_list_head *head, bool error_inject)
32807b4449f353 André Almeida 2024-09-03 106 {
32807b4449f353 André Almeida 2024-09-03 107 _Atomic(unsigned int) *futex = &lock->futex;
32807b4449f353 André Almeida 2024-09-03 108 int zero = 0, ret = -1;
32807b4449f353 André Almeida 2024-09-03 109 pid_t tid = gettid();
32807b4449f353 André Almeida 2024-09-03 110
32807b4449f353 André Almeida 2024-09-03 111 /*
32807b4449f353 André Almeida 2024-09-03 112 * Set list_op_pending before starting the lock, so the kernel can catch
32807b4449f353 André Almeida 2024-09-03 113 * the case where the thread died during the lock operation
32807b4449f353 André Almeida 2024-09-03 114 */
32807b4449f353 André Almeida 2024-09-03 115 head->list_op_pending = &lock->list;
32807b4449f353 André Almeida 2024-09-03 116
32807b4449f353 André Almeida 2024-09-03 @117 if (atomic_compare_exchange_strong(futex, &zero, tid)) {
32807b4449f353 André Almeida 2024-09-03 118 /*
32807b4449f353 André Almeida 2024-09-03 119 * We took the lock, insert it in the robust list
32807b4449f353 André Almeida 2024-09-03 120 */
32807b4449f353 André Almeida 2024-09-03 121 struct robust_list *list = &head->list;
32807b4449f353 André Almeida 2024-09-03 122
32807b4449f353 André Almeida 2024-09-03 123 /* Error injection to test list_op_pending */
32807b4449f353 André Almeida 2024-09-03 124 if (error_inject)
32807b4449f353 André Almeida 2024-09-03 125 return 0;
32807b4449f353 André Almeida 2024-09-03 126
32807b4449f353 André Almeida 2024-09-03 127 while (list->next != &head->list)
32807b4449f353 André Almeida 2024-09-03 128 list = list->next;
32807b4449f353 André Almeida 2024-09-03 129
32807b4449f353 André Almeida 2024-09-03 130 list->next = &lock->list;
32807b4449f353 André Almeida 2024-09-03 131 lock->list.next = &head->list;
32807b4449f353 André Almeida 2024-09-03 132
32807b4449f353 André Almeida 2024-09-03 133 ret = 0;
32807b4449f353 André Almeida 2024-09-03 134 } else {
32807b4449f353 André Almeida 2024-09-03 135 /*
32807b4449f353 André Almeida 2024-09-03 136 * We didn't take the lock, wait until the owner wakes (or dies)
32807b4449f353 André Almeida 2024-09-03 137 */
32807b4449f353 André Almeida 2024-09-03 138 struct timespec to;
32807b4449f353 André Almeida 2024-09-03 139
32807b4449f353 André Almeida 2024-09-03 140 clock_gettime(CLOCK_MONOTONIC, &to);
32807b4449f353 André Almeida 2024-09-03 141 to.tv_sec = to.tv_sec + FUTEX_TIMEOUT;
32807b4449f353 André Almeida 2024-09-03 142
32807b4449f353 André Almeida 2024-09-03 143 tid = atomic_load(futex);
32807b4449f353 André Almeida 2024-09-03 144 /* Kernel ignores futexes without the waiters flag */
32807b4449f353 André Almeida 2024-09-03 145 tid |= FUTEX_WAITERS;
32807b4449f353 André Almeida 2024-09-03 146 atomic_store(futex, tid);
32807b4449f353 André Almeida 2024-09-03 147
32807b4449f353 André Almeida 2024-09-03 148 ret = futex_wait((futex_t *) futex, tid, &to, 0);
32807b4449f353 André Almeida 2024-09-03 149
32807b4449f353 André Almeida 2024-09-03 150 /*
32807b4449f353 André Almeida 2024-09-03 151 * A real mutex_lock() implementation would loop here to finally
32807b4449f353 André Almeida 2024-09-03 152 * take the lock. We don't care about that, so we stop here.
32807b4449f353 André Almeida 2024-09-03 153 */
32807b4449f353 André Almeida 2024-09-03 154 }
32807b4449f353 André Almeida 2024-09-03 155
32807b4449f353 André Almeida 2024-09-03 156 head->list_op_pending = NULL;
32807b4449f353 André Almeida 2024-09-03 157
32807b4449f353 André Almeida 2024-09-03 158 return ret;
32807b4449f353 André Almeida 2024-09-03 159 }
32807b4449f353 André Almeida 2024-09-03 160
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2024-09-08 2:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 13:40 [PATCH v2] selftests/futex: Create test for robust list André Almeida
2024-09-04 16:46 ` Shuah Khan
2024-09-08 2:24 ` kernel test robot [this message]
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=Zt0KxQlpXXGvugV9@rli9-mobl \
--to=lkp@intel.com \
--cc=andrealmeid@igalia.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=peterz@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox