lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f3765db-842d-4568-9ac5-1bd9cab9e952@web.de>
Date: Fri, 5 Jul 2024 19:05:39 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Boy Wu <boy.wu@...iatek.com>, cgroups@...r.kernel.org,
 linux-block@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-mediatek@...ts.infradead.org, Jens Axboe <axboe@...nel.dk>,
 Josef Bacik <josef@...icpanda.com>, Tejun Heo <tj@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
 Angelo Gioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
 Boris Burkov <boris@....io>, Iverlin Wang (王苳霖)
 <Iverlin.Wang@...iatek.com>, Matthias Brugger <matthias.bgg@...il.com>
Subject: Re: [PATCH] blk-cgroup: add spin_lock for u64_stats_update

> In 32bit SMP systems, if the system is stressed on the sys node
> by processes, it may cause blkcg_fill_root_iostats to have a concurrent
> problem on the seqlock in u64_stats_update, which will cause a deadlock
> on u64_stats_fetch_begin in blkcg_print_one_stat.

Would you like to mark any references to functions with parentheses?


> To prevent this problem, add spin_locks.

Another wording suggestion:
  Thus use an additional spin lock.


How do you think about to use a summary phrase like “Add a spin lock for stats update
in blkcg_fill_root_iostats()”?


…
> +++ b/block/blk-cgroup.c
> @@ -1134,9 +1134,15 @@ static void blkcg_fill_root_iostats(void)
>  				cpu_dkstats->sectors[STAT_DISCARD] << 9;
>  		}
>
> +#if BITS_PER_LONG == 32
> +		spin_lock_irq(&blkg->q->queue_lock);
> +#endif
>  		flags = u64_stats_update_begin_irqsave(&blkg->iostat.sync);
>  		blkg_iostat_set(&blkg->iostat.cur, &tmp);
>  		u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags);
> +#if BITS_PER_LONG == 32
> +		spin_unlock_irq(&blkg->q->queue_lock);
> +#endif
…

Under which circumstances would you become interested to apply a statement
like “guard(spinlock_irq)(&blkg->q->queue_lock);”?
https://elixir.bootlin.com/linux/v6.10-rc6/source/include/linux/spinlock.h#L567

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ