From: kernel test robot <lkp@intel.com>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [rcu:boqun-dev/hazptr 1/1] kernel/rcu/hazptr_test.c:18:8: warning: incompatible integer to pointer conversion assigning to 'struct callback_head *' from 'int'
Date: Tue, 21 May 2024 07:20:12 +0800 [thread overview]
Message-ID: <202405210704.NDdG0x1S-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git boqun-dev/hazptr
head: ca2ab86d71c6d322c87127363aa4b665012a0ac2
commit: ca2ab86d71c6d322c87127363aa4b665012a0ac2 [1/1] WIP
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240521/202405210704.NDdG0x1S-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240521/202405210704.NDdG0x1S-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/202405210704.NDdG0x1S-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/rcu/hazptr_test.c:8:2: error: implicit declaration of function 'kfree' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
kfree(head);
^
kernel/rcu/hazptr_test.c:18:10: error: implicit declaration of function 'kzalloc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
dummy = kzalloc(sizeof(*dummy), GFP_KERNEL);
^
>> kernel/rcu/hazptr_test.c:18:8: warning: incompatible integer to pointer conversion assigning to 'struct callback_head *' from 'int' [-Wint-conversion]
dummy = kzalloc(sizeof(*dummy), GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/rcu/hazptr_test.c:19:8: warning: incompatible integer to pointer conversion assigning to 'struct callback_head *' from 'int' [-Wint-conversion]
other = kzalloc(sizeof(*dummy), GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
vim +18 kernel/rcu/hazptr_test.c
10
11 static void simple(void)
12 {
13 struct hazptr_context ctx;
14 struct callback_head *dummy, *tmp, *other;
15 hazptr_t *hptr;
16 hazptr_t *hptr2;
17
> 18 dummy = kzalloc(sizeof(*dummy), GFP_KERNEL);
19 other = kzalloc(sizeof(*dummy), GFP_KERNEL);
20
21 if (!dummy || !other) {
22 printk("allocation failed, skip test\n");
23 return;
24 }
25
26 init_hazptr_context(&ctx);
27 hptr = hazptr_alloc(&ctx);
28 BUG_ON(!hptr);
29
30 // Get a second hptr.
31 hptr2 = hazptr_alloc(&ctx);
32 BUG_ON(!hptr2);
33
34 // No one is modifying 'dummy', protection must succeed.
35 BUG_ON(!__hazptr_tryprotect(hptr, (void **)&dummy, 0));
36
37 // Simulate changing a global pointer.
38 tmp = dummy;
39 WRITE_ONCE(dummy, other);
40
41 // Callback will run after no active readers.
42 printk("callback added, %px\n", tmp);
43 call_hazptr(tmp, simple_func);
44
45 // Simulate changing a global pointer.
46 tmp = dummy;
47 WRITE_ONCE(dummy, other);
48
49 // No one is modifying 'dummy', protection must succeed.
50 BUG_ON(!__hazptr_tryprotect(hptr2, (void **)&dummy, 0));
51
52 // The above callback should run after this.
53 hazptr_clear(hptr);
54 printk("first reader is out\n");
55
56 for (int i = 0; i < 10; i++)
57 schedule(); // yield a few times.
58
59 printk("callback added, %px\n", tmp);
60 call_hazptr(tmp, simple_func);
61
62 cleanup_hazptr_context(&ctx);
63 printk("no reader here\n");
64
65 for (int i = 0; i < 10; i++)
66 schedule(); // yield a few times.
67 }
68
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-05-20 23:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202405210704.NDdG0x1S-lkp@intel.com \
--to=lkp@intel.com \
--cc=boqun.feng@gmail.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/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.