From: kernel test robot <lkp@intel.com>
To: Menglong Dong <menglong8.dong@gmail.com>,
rostedt@goodmis.org, mark.rutland@arm.com,
alexei.starovoitov@gmail.com
Cc: oe-kbuild-all@lists.linux.dev, catalin.marinas@arm.com,
will@kernel.org, mhiramat@kernel.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, hpa@zytor.com, mathieu.desnoyers@efficios.com,
nathan@kernel.org, ndesaulniers@google.com, morbo@google.com,
justinstitt@google.com, dongml2@chinatelecom.cn,
akpm@linux-foundation.org, rppt@kernel.org, graf@amazon.com,
dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
bpf@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH bpf-next v2] add function metadata support
Date: Fri, 28 Feb 2025 01:48:52 +0800 [thread overview]
Message-ID: <202502280123.BNaCYT2A-lkp@intel.com> (raw)
In-Reply-To: <20250226121537.752241-1-dongml2@chinatelecom.cn>
Hi Menglong,
kernel test robot noticed the following build warnings:
[auto build test WARNING on bpf-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Menglong-Dong/add-function-metadata-support/20250226-202312
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20250226121537.752241-1-dongml2%40chinatelecom.cn
patch subject: [PATCH bpf-next v2] add function metadata support
config: i386-randconfig-062-20250227 (https://download.01.org/0day-ci/archive/20250228/202502280123.BNaCYT2A-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250228/202502280123.BNaCYT2A-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/202502280123.BNaCYT2A-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
kernel/trace/kfunc_md.c:12:23: sparse: sparse: symbol 'kfunc_mds' redeclared with different type (different address spaces):
kernel/trace/kfunc_md.c:12:23: sparse: struct kfunc_md [noderef] __rcu *[addressable] [toplevel] kfunc_mds
kernel/trace/kfunc_md.c: note: in included file:
include/linux/kfunc_md.h:16:24: sparse: note: previously declared as:
include/linux/kfunc_md.h:16:24: sparse: struct kfunc_md *extern [addressable] [toplevel] kfunc_mds
kernel/trace/kfunc_md.c:186:20: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct kfunc_md *md @@ got struct kfunc_md [noderef] __rcu * @@
kernel/trace/kfunc_md.c:186:20: sparse: expected struct kfunc_md *md
kernel/trace/kfunc_md.c:186:20: sparse: got struct kfunc_md [noderef] __rcu *
>> kernel/trace/kfunc_md.c:98:25: sparse: sparse: non size-preserving pointer to integer cast
vim +98 kernel/trace/kfunc_md.c
10
11 static u32 kfunc_md_count = ENTRIES_PER_PAGE, kfunc_md_used;
> 12 struct kfunc_md __rcu *kfunc_mds;
13 EXPORT_SYMBOL_GPL(kfunc_mds);
14
15 static DEFINE_MUTEX(kfunc_md_mutex);
16
17
18 void kfunc_md_unlock(void)
19 {
20 mutex_unlock(&kfunc_md_mutex);
21 }
22 EXPORT_SYMBOL_GPL(kfunc_md_unlock);
23
24 void kfunc_md_lock(void)
25 {
26 mutex_lock(&kfunc_md_mutex);
27 }
28 EXPORT_SYMBOL_GPL(kfunc_md_lock);
29
30 static u32 kfunc_md_get_index(void *ip)
31 {
32 return *(u32 *)(ip - KFUNC_MD_DATA_OFFSET);
33 }
34
35 static void kfunc_md_init(struct kfunc_md *mds, u32 start, u32 end)
36 {
37 u32 i;
38
39 for (i = start; i < end; i++)
40 mds[i].users = 0;
41 }
42
43 static int kfunc_md_page_order(void)
44 {
45 return fls(DIV_ROUND_UP(kfunc_md_count, ENTRIES_PER_PAGE)) - 1;
46 }
47
48 /* Get next usable function metadata. On success, return the usable
49 * kfunc_md and store the index of it to *index. If no usable kfunc_md is
50 * found in kfunc_mds, a larger array will be allocated.
51 */
52 static struct kfunc_md *kfunc_md_get_next(u32 *index)
53 {
54 struct kfunc_md *new_mds, *mds;
55 u32 i, order;
56
57 mds = rcu_dereference(kfunc_mds);
58 if (mds == NULL) {
59 order = kfunc_md_page_order();
60 new_mds = (void *)__get_free_pages(GFP_KERNEL, order);
61 if (!new_mds)
62 return NULL;
63 kfunc_md_init(new_mds, 0, kfunc_md_count);
64 /* The first time to initialize kfunc_mds, so it is not
65 * used anywhere yet, and we can update it directly.
66 */
67 rcu_assign_pointer(kfunc_mds, new_mds);
68 mds = new_mds;
69 }
70
71 if (likely(kfunc_md_used < kfunc_md_count)) {
72 /* maybe we can manage the used function metadata entry
73 * with a bit map ?
74 */
75 for (i = 0; i < kfunc_md_count; i++) {
76 if (!mds[i].users) {
77 kfunc_md_used++;
78 *index = i;
79 mds[i].users++;
80 return mds + i;
81 }
82 }
83 }
84
85 order = kfunc_md_page_order();
86 /* no available function metadata, so allocate a bigger function
87 * metadata array.
88 */
89 new_mds = (void *)__get_free_pages(GFP_KERNEL, order + 1);
90 if (!new_mds)
91 return NULL;
92
93 memcpy(new_mds, mds, kfunc_md_count * sizeof(*new_mds));
94 kfunc_md_init(new_mds, kfunc_md_count, kfunc_md_count * 2);
95
96 rcu_assign_pointer(kfunc_mds, new_mds);
97 synchronize_rcu();
> 98 free_pages((u64)mds, order);
99
100 mds = new_mds + kfunc_md_count;
101 *index = kfunc_md_count;
102 kfunc_md_count <<= 1;
103 kfunc_md_used++;
104 mds->users++;
105
106 return mds;
107 }
108
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-02-27 17:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 12:15 [PATCH bpf-next v2] add function metadata support Menglong Dong
2025-02-27 15:18 ` kernel test robot
2025-02-27 16:32 ` kernel test robot
2025-02-27 16:53 ` Peter Zijlstra
2025-02-28 9:53 ` Menglong Dong
2025-02-28 10:26 ` Peter Zijlstra
2025-02-28 10:29 ` Peter Zijlstra
2025-02-28 13:01 ` Menglong Dong
2025-02-27 17:48 ` kernel test robot [this message]
2025-02-28 0:43 ` kernel test robot
2025-03-04 6:25 ` kernel test robot
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=202502280123.BNaCYT2A-lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dongml2@chinatelecom.cn \
--cc=graf@amazon.com \
--cc=hpa@zytor.com \
--cc=justinstitt@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=menglong8.dong@gmail.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/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.