Re: [PATCH 1/5] debugobjects: Fix the misuse of global variables in fill_pool()

From: Thomas Gleixner
Date: Tue Sep 03 2024 - 05:38:51 EST


On Tue, Sep 03 2024 at 15:00, Leizhen wrote:
>>> @@ -84,10 +85,7 @@ static int __data_racy debug_objects_fixups __read_mostly;
>>> static int __data_racy debug_objects_warnings __read_mostly;
>>> static int __data_racy debug_objects_enabled __read_mostly
>>> = CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT;
>>> -static int __data_racy debug_objects_pool_size __read_mostly
>>> - = ODEBUG_POOL_SIZE;
>>> -static int __data_racy debug_objects_pool_min_level __read_mostly
>>> - = ODEBUG_POOL_MIN_LEVEL;
>>> +static int __data_racy obj_pool_min_free = ODEBUG_POOL_SIZE;
>
> Sorry, I rechecked it again. After this patch, obj_pool_min_free is referenced in the
> same way as obj_pool_max_used. The only race point is located in debug_stats_show().
> However, this reference point does not need to be included in the race analysis. So
> there is no need to add __data_racy for obj_pool_min_free.

The read races against the write, so KCSAN can detect it and complain, no?

Thanks,

tglx