Re: [PATCH v1 1/5] riscv/cmpxchg: Deduplicate xchg() asm functions

From: kernel test robot
Date: Sat Jan 13 2024 - 01:54:48 EST


Hi Leonardo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 610a9b8f49fbcf1100716370d3b5f6f884a2835a]

url: https://github.com/intel-lab-lkp/linux/commits/Leonardo-Bras/riscv-cmpxchg-Deduplicate-xchg-asm-functions/20240104-003501
base: 610a9b8f49fbcf1100716370d3b5f6f884a2835a
patch link: https://lore.kernel.org/r/20240103163203.72768-3-leobras%40redhat.com
patch subject: [PATCH v1 1/5] riscv/cmpxchg: Deduplicate xchg() asm functions
config: riscv-randconfig-r111-20240112 (https://download.01.org/0day-ci/archive/20240113/202401131438.f8SELM0W-lkp@xxxxxxxxx/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 9bde5becb44ea071f5e1fa1f5d4071dc8788b18c)
reproduce: (https://download.01.org/0day-ci/archive/20240113/202401131438.f8SELM0W-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401131438.f8SELM0W-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> net/ipv4/tcp_cong.c:300:24: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct tcp_congestion_ops const [noderef] __rcu *__new @@ got struct tcp_congestion_ops *[assigned] ca @@
net/ipv4/tcp_cong.c:300:24: sparse: expected struct tcp_congestion_ops const [noderef] __rcu *__new
net/ipv4/tcp_cong.c:300:24: sparse: got struct tcp_congestion_ops *[assigned] ca
net/ipv4/tcp_cong.c:300:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct tcp_congestion_ops const *prev @@ got struct tcp_congestion_ops const [noderef] __rcu * @@
net/ipv4/tcp_cong.c:300:22: sparse: expected struct tcp_congestion_ops const *prev
net/ipv4/tcp_cong.c:300:22: sparse: got struct tcp_congestion_ops const [noderef] __rcu *
net/ipv4/tcp_cong.c: note: in included file (through include/linux/module.h):
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true

vim +300 net/ipv4/tcp_cong.c

317a76f9a44b43 Stephen Hemminger 2005-06-23 281
317a76f9a44b43 Stephen Hemminger 2005-06-23 282 /* Used by sysctl to change default congestion control */
6670e152447732 Stephen Hemminger 2017-11-14 283 int tcp_set_default_congestion_control(struct net *net, const char *name)
317a76f9a44b43 Stephen Hemminger 2005-06-23 284 {
317a76f9a44b43 Stephen Hemminger 2005-06-23 285 struct tcp_congestion_ops *ca;
6670e152447732 Stephen Hemminger 2017-11-14 286 const struct tcp_congestion_ops *prev;
6670e152447732 Stephen Hemminger 2017-11-14 287 int ret;
317a76f9a44b43 Stephen Hemminger 2005-06-23 288
6670e152447732 Stephen Hemminger 2017-11-14 289 rcu_read_lock();
6670e152447732 Stephen Hemminger 2017-11-14 290 ca = tcp_ca_find_autoload(net, name);
6670e152447732 Stephen Hemminger 2017-11-14 291 if (!ca) {
6670e152447732 Stephen Hemminger 2017-11-14 292 ret = -ENOENT;
0baf26b0fcd74b Martin KaFai Lau 2020-01-08 293 } else if (!bpf_try_module_get(ca, ca->owner)) {
6670e152447732 Stephen Hemminger 2017-11-14 294 ret = -EBUSY;
8d432592f30fcc Jonathon Reinhart 2021-05-01 295 } else if (!net_eq(net, &init_net) &&
8d432592f30fcc Jonathon Reinhart 2021-05-01 296 !(ca->flags & TCP_CONG_NON_RESTRICTED)) {
8d432592f30fcc Jonathon Reinhart 2021-05-01 297 /* Only init netns can set default to a restricted algorithm */
8d432592f30fcc Jonathon Reinhart 2021-05-01 298 ret = -EPERM;
6670e152447732 Stephen Hemminger 2017-11-14 299 } else {
6670e152447732 Stephen Hemminger 2017-11-14 @300 prev = xchg(&net->ipv4.tcp_congestion_control, ca);
6670e152447732 Stephen Hemminger 2017-11-14 301 if (prev)
0baf26b0fcd74b Martin KaFai Lau 2020-01-08 302 bpf_module_put(prev, prev->owner);
317a76f9a44b43 Stephen Hemminger 2005-06-23 303
6670e152447732 Stephen Hemminger 2017-11-14 304 ca->flags |= TCP_CONG_NON_RESTRICTED;
317a76f9a44b43 Stephen Hemminger 2005-06-23 305 ret = 0;
317a76f9a44b43 Stephen Hemminger 2005-06-23 306 }
6670e152447732 Stephen Hemminger 2017-11-14 307 rcu_read_unlock();
317a76f9a44b43 Stephen Hemminger 2005-06-23 308
317a76f9a44b43 Stephen Hemminger 2005-06-23 309 return ret;
317a76f9a44b43 Stephen Hemminger 2005-06-23 310 }
317a76f9a44b43 Stephen Hemminger 2005-06-23 311

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki