[PATCH 4/4] wifi: mt76: connac: synchronize token_count access in mt76_connac_skip_fw_pmctrl

Mingyen Hsieh (謝明諺) Mingyen.Hsieh at mediatek.com
Thu Sep 4 19:14:46 PDT 2025


On Thu, 2025-09-04 at 14:54 +0200, Felix Fietkau wrote:
> 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 04.09.25 05:06, Mingyen Hsieh wrote:
> > From: Ming Yen Hsieh <mingyen.hsieh at mediatek.com>
> > 
> > Read dev->token_count under token_lock to prevent race conditions
> > with
> > concurrent token updates, ensuring accurate power management
> > decisions.
> > 
> > Signed-off-by: Ming Yen Hsieh <mingyen.hsieh at mediatek.com>
> 
> I don't understand what kind of race you're trying to solve with this
> patch. Are you trying to fix entering powersave while a badly timed
> tx
> is started? Or are you trying to make it go to sleep more reliably
> during concurrent cleanup of pending tx?
> What context does this race against, and is taking the token lock
> really
> enough to fully close the race?
> 
> Thanks,
> 
> - Felix

Hi Felix,

I haven't seen a real race so far, but during my observation, I noticed
that some functions using token_count are protected by a lock. That's
why i added the protection in this patch. These are just my thoughts,
and maybe i might have missed something-perhaps the protection isn't
needed here.

Thanks.

Yen.




More information about the Linux-mediatek mailing list