* [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations
@ 2026-06-02 9:29 Lei Zhu
2026-06-02 20:18 ` kernel test robot
2026-06-02 20:49 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Lei Zhu @ 2026-06-02 9:29 UTC (permalink / raw)
To: kuba, sukhdeeps, davem, andrew+netdev; +Cc: netdev
From: Lei Zhu <zhulei@kylinos.cn>
Adopting atomic_try_cmpxchg() which is slightly more efficient.
Signed-off-by: Lei Zhu <zhulei@kylinos.cn>
---
drivers/net/ethernet/aquantia/atlantic/aq_utils.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
index d3a0b2ec0279..61cd08771385 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
@@ -15,20 +15,20 @@ static inline void aq_utils_obj_set(atomic_t *flags, u32 mask)
{
unsigned long flags_old, flags_new;
+ flags_old = atomic_read(flags);
do {
- flags_old = atomic_read(flags);
flags_new = flags_old | (mask);
- } while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
+ } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
}
static inline void aq_utils_obj_clear(atomic_t *flags, u32 mask)
{
unsigned long flags_old, flags_new;
+ flags_old = atomic_read(flags);
do {
- flags_old = atomic_read(flags);
flags_new = flags_old & ~(mask);
- } while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
+ } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
}
static inline bool aq_utils_obj_test(atomic_t *flags, u32 mask)
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations
2026-06-02 9:29 [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations Lei Zhu
@ 2026-06-02 20:18 ` kernel test robot
2026-06-02 20:49 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-06-02 20:18 UTC (permalink / raw)
To: Lei Zhu, kuba, sukhdeeps, davem, andrew+netdev; +Cc: oe-kbuild-all, netdev
Hi Lei,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Lei-Zhu/net-atlantic-aq_utils_obj_-set-clear-optimizations/20260602-174147
base: net-next/main
patch link: https://lore.kernel.org/r/20260602092949.263270-1-zhulei_szu%40163.com
patch subject: [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260602/202606022254.rqQVht0b-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606022254.rqQVht0b-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/202606022254.rqQVht0b-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/net/ethernet/aquantia/atlantic/aq_common.h:17,
from drivers/net/ethernet/aquantia/atlantic/aq_main.h:12,
from drivers/net/ethernet/aquantia/atlantic/aq_main.c:10:
drivers/net/ethernet/aquantia/atlantic/aq_utils.h: In function 'aq_utils_obj_set':
>> drivers/net/ethernet/aquantia/atlantic/aq_utils.h:21:45: error: passing argument 2 of 'atomic_try_cmpxchg' from incompatible pointer type [-Wincompatible-pointer-types]
21 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
| |
| long unsigned int *
In file included from include/linux/atomic.h:82,
from include/linux/cpumask.h:10,
from arch/x86/include/asm/paravirt.h:19,
from arch/x86/include/asm/irqflags.h:100,
from include/linux/irqflags.h:18,
from arch/x86/include/asm/special_insns.h:10,
from arch/x86/include/asm/processor.h:25,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/skbuff.h:15,
from include/linux/if_ether.h:19,
from include/linux/etherdevice.h:20,
from drivers/net/ethernet/aquantia/atlantic/aq_common.h:13:
include/linux/atomic/atomic-instrumented.h:1275:38: note: expected 'int *' but argument is of type 'long unsigned int *'
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ~~~~~^~~
drivers/net/ethernet/aquantia/atlantic/aq_utils.h: In function 'aq_utils_obj_clear':
drivers/net/ethernet/aquantia/atlantic/aq_utils.h:31:45: error: passing argument 2 of 'atomic_try_cmpxchg' from incompatible pointer type [-Wincompatible-pointer-types]
31 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
| |
| long unsigned int *
include/linux/atomic/atomic-instrumented.h:1275:38: note: expected 'int *' but argument is of type 'long unsigned int *'
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ~~~~~^~~
--
In file included from drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_common.h:17,
from drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_hw.h:15,
from drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c:10:
drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_utils.h: In function 'aq_utils_obj_set':
>> drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_utils.h:21:45: error: passing argument 2 of 'atomic_try_cmpxchg' from incompatible pointer type [-Wincompatible-pointer-types]
21 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
| |
| long unsigned int *
In file included from include/linux/atomic.h:82,
from include/linux/cpumask.h:10,
from arch/x86/include/asm/paravirt.h:19,
from arch/x86/include/asm/irqflags.h:100,
from include/linux/irqflags.h:18,
from arch/x86/include/asm/special_insns.h:10,
from arch/x86/include/asm/processor.h:25,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/skbuff.h:15,
from include/linux/if_ether.h:19,
from include/linux/etherdevice.h:20,
from drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_common.h:13:
include/linux/atomic/atomic-instrumented.h:1275:38: note: expected 'int *' but argument is of type 'long unsigned int *'
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ~~~~~^~~
drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_utils.h: In function 'aq_utils_obj_clear':
drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_utils.h:31:45: error: passing argument 2 of 'atomic_try_cmpxchg' from incompatible pointer type [-Wincompatible-pointer-types]
31 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
| |
| long unsigned int *
include/linux/atomic/atomic-instrumented.h:1275:38: note: expected 'int *' but argument is of type 'long unsigned int *'
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ~~~~~^~~
vim +/atomic_try_cmpxchg +21 drivers/net/ethernet/aquantia/atlantic/aq_utils.h
13
14 static inline void aq_utils_obj_set(atomic_t *flags, u32 mask)
15 {
16 unsigned long flags_old, flags_new;
17
18 flags_old = atomic_read(flags);
19 do {
20 flags_new = flags_old | (mask);
> 21 } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
22 }
23
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations
2026-06-02 9:29 [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations Lei Zhu
2026-06-02 20:18 ` kernel test robot
@ 2026-06-02 20:49 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-06-02 20:49 UTC (permalink / raw)
To: Lei Zhu, kuba, sukhdeeps, davem, andrew+netdev
Cc: llvm, oe-kbuild-all, netdev
Hi Lei,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Lei-Zhu/net-atlantic-aq_utils_obj_-set-clear-optimizations/20260602-174147
base: net-next/main
patch link: https://lore.kernel.org/r/20260602092949.263270-1-zhulei_szu%40163.com
patch subject: [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260602/202606022243.HUNSnMWR-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606022243.HUNSnMWR-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/202606022243.HUNSnMWR-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/net/ethernet/aquantia/atlantic/aq_main.c:10:
In file included from drivers/net/ethernet/aquantia/atlantic/aq_main.h:12:
In file included from drivers/net/ethernet/aquantia/atlantic/aq_common.h:17:
>> drivers/net/ethernet/aquantia/atlantic/aq_utils.h:21:38: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'int *' [-Werror,-Wincompatible-pointer-types]
21 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
include/linux/atomic/atomic-instrumented.h:1275:38: note: passing argument to parameter 'old' here
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ^
In file included from drivers/net/ethernet/aquantia/atlantic/aq_main.c:10:
In file included from drivers/net/ethernet/aquantia/atlantic/aq_main.h:12:
In file included from drivers/net/ethernet/aquantia/atlantic/aq_common.h:17:
drivers/net/ethernet/aquantia/atlantic/aq_utils.h:31:38: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'int *' [-Werror,-Wincompatible-pointer-types]
31 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
include/linux/atomic/atomic-instrumented.h:1275:38: note: passing argument to parameter 'old' here
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ^
2 errors generated.
--
In file included from drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c:10:
In file included from drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_hw.h:15:
In file included from drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_common.h:17:
>> drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_utils.h:21:38: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'int *' [-Werror,-Wincompatible-pointer-types]
21 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
include/linux/atomic/atomic-instrumented.h:1275:38: note: passing argument to parameter 'old' here
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ^
In file included from drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c:10:
In file included from drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_hw.h:15:
In file included from drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_common.h:17:
drivers/net/ethernet/aquantia/atlantic/hw_atl/../aq_utils.h:31:38: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'int *' [-Werror,-Wincompatible-pointer-types]
31 | } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
| ^~~~~~~~~~
include/linux/atomic/atomic-instrumented.h:1275:38: note: passing argument to parameter 'old' here
1275 | atomic_try_cmpxchg(atomic_t *v, int *old, int new)
| ^
2 errors generated.
vim +21 drivers/net/ethernet/aquantia/atlantic/aq_utils.h
13
14 static inline void aq_utils_obj_set(atomic_t *flags, u32 mask)
15 {
16 unsigned long flags_old, flags_new;
17
18 flags_old = atomic_read(flags);
19 do {
20 flags_new = flags_old | (mask);
> 21 } while (!atomic_try_cmpxchg(flags, &flags_old, flags_new));
22 }
23
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-02 20:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 9:29 [PATCH net-next] net: atlantic: aq_utils_obj_{set|clear} optimizations Lei Zhu
2026-06-02 20:18 ` kernel test robot
2026-06-02 20:49 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox