Skip to contentSkip to conversation

block/blk-zoned.c:579:5-24: WARNING: atomic_dec_and_test variation before object free at line 583.

DISCUSSION kernel test robot 4 participants 6 messages Nov 4, 2024 – Nov 6, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   557329bcecc2f55e134db8974953b32b69db9d15
commit: dd291d77cc90eb6a86e9860ba8e6e38eebd57d12 block: Introduce zone write plugging
date:   7 months ago
config: alpha-randconfig-r064-20241105 (https://download.01.org/0day-ci/archive/20241105/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.3.0

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

cocci warnings: (new ones prefixed by >>)

>> block/blk-zoned.c:579:5-24: WARNING: atomic_dec_and_test variation before object free at line 583.

vim +579 block/blk-zoned.c

576
577 static inline void disk_put_zone_wplug(struct blk_zone_wplug *zwplug)
578 {

 > 579		if (atomic_dec_and_test(&zwplug->ref)) {
   580			WARN_ON_ONCE(!bio_list_empty(&zwplug->bio_list));
   581			WARN_ON_ONCE(!list_empty(&zwplug->link));
   582	
 > 583			call_rcu(&zwplug->rcu_head, disk_free_zone_wplug_rcu);

584 }
585 }
586

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 1 line · kernel test robot
Quoted 1 line
Quoted 1 line

block/blk-zoned.c:579:5-24: WARNING: atomic_dec_and_test variation before object free at line 583.

Does anyone know what this warning is supposed to mean?

#2 lore raw
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · kernel test robot
Quoted 1 line
Quoted 1 line

block/blk-zoned.c:579:5-24: WARNING: atomic_dec_and_test variation before object free at line 583.

Does anyone know what this warning is supposed to mean?

It's supposed to mean "use refcount_t for things like this".

Signature · 1 line
Jens Axboe
#3 lore raw
Quoted 7 lines · Jens Axboe
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · kernel test robot
Quoted 1 line
Quoted 1 line

block/blk-zoned.c:579:5-24: WARNING: atomic_dec_and_test variation before object free at line 583.

Does anyone know what this warning is supposed to mean?

It's supposed to mean "use refcount_t for things like this".

Have we finally resolved the performance problems with refcount_t for fast path operations?

#4 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Jens Axboe
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · kernel test robot
Quoted 1 line
Quoted 1 line

block/blk-zoned.c:579:5-24: WARNING: atomic_dec_and_test variation before object free at line 583.

Does anyone know what this warning is supposed to mean?

It's supposed to mean "use refcount_t for things like this".

Have we finally resolved the performance problems with refcount_t for fast path operations?

I mean it's closer, but it's still slower. Will always be so. Does it matter for zoned devices? Probably not.

I don't think it matters for this case. It's not like the ref itself is something that is user controllable in terms of being able to get anywhere near an overflow.

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 13 lines · Jens Axboe
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Jens Axboe
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · kernel test robot
Quoted 1 line
Quoted 1 line

block/blk-zoned.c:579:5-24: WARNING: atomic_dec_and_test variation before object free at line 583.

Does anyone know what this warning is supposed to mean?

It's supposed to mean "use refcount_t for things like this".

Have we finally resolved the performance problems with refcount_t for fast path operations?

Quoted 6 lines

I mean it's closer, but it's still slower. Will always be so. Does it matter for zoned devices? Probably not.

I don't think it matters for this case. It's not like the ref itself is something that is user controllable in terms of being able to get anywhere near an overflow.

OK. Will work on a patch to switch to refcount.

Signature · 2 lines
Damien Le Moal
Western Digital Research