* Re: [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk
2026-11-05 19:17 [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk Konstantin Khorenko
@ 2026-11-12 18:06 ` Konstantin Khorenko
2026-11-12 18:06 ` Konstantin Khorenko
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 18:06 UTC (permalink / raw)
To: Pavel Tikhomirov, Andrey Zhadchenko; +Cc: devel
a kind ping :)
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
On 11/5/26 20:17, Konstantin Khorenko wrote:
> notify_delta_merged() and ploop_check_delta_before_flip() walk the live
> BAT together with the BAT of a delta that ploop_read_delta_metadata()
> read into a local md tree. For each page they take the md_lock of the
> live page and then the md_lock of the local one.
>
> Every md_lock is initialized in ploop_alloc_md_page(), so both locks
> share one lockdep class. With CONFIG_PROVE_LOCKING the first walk
> reports "possible recursive locking detected", and lockdep turns itself
> off for the rest of the boot.
>
> Only the cmd that read the local tree can reach it, and it frees the
> tree after the walk, so its md_lock protects nothing. Stop taking it.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-153709
>
> Fixes: 0d4b4d0a20a9 ("dm-ploop: introduce per-md page locking")
> Feature: dm-ploop: ploop target driver
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
> This obsoletes "[PATCH vz10 10/24] dm-ploop: annotate nested md_lock in
> ploop_check_delta_before_flip()" of the VSTOR-137234 selftests series.
> Pavel pointed out that the SINGLE_DEPTH_NESTING annotation works around
> a lock that is not needed at all, and that notify_delta_merged() has
> the same problem. This patch stops taking that lock in both walks.
>
> Assisted-by: LLM
> ---
> drivers/md/dm-ploop-cmd.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
> index 2d1fa449b052d..f6135e07c2737 100644
> --- a/drivers/md/dm-ploop-cmd.c
> +++ b/drivers/md/dm-ploop-cmd.c
> @@ -812,7 +812,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
> d_bat_entries = d_md->kmpage;
>
> spin_lock_irqsave(&md->md_lock, flags); /* write */
> - spin_lock(&d_md->md_lock); /* write */
> for (; i <= end; i++) {
> clu = ploop_page_clu_idx_to_bat_clu(md->id, i);
> if (clu == nr_be - 1)
> @@ -846,7 +845,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
> WRITE_ONCE(md->bat_levels[i], level);
> }
>
> - spin_unlock(&d_md->md_lock);
> spin_unlock_irqrestore(&md->md_lock, flags);
>
> if (stop)
> @@ -1147,7 +1145,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
> d_bat_entries = d_md->kmpage;
>
> spin_lock_irq(&md->md_lock); /* read */
> - spin_lock(&d_md->md_lock);
> for (; i <= end; i++) {
> if (ploop_md_page_cluster_is_in_top_delta(ploop, md, i) &&
> d_bat_entries[i] != BAT_ENTRY_NONE) {
> @@ -1156,7 +1153,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
> break;
> }
> }
> - spin_unlock(&d_md->md_lock);
> spin_unlock_irq(&md->md_lock);
> if (stop)
> break;
>
> ---
> base-commit: f0cff9cebdb0d481d05b02bdb7bdafe864adca1c
> change-id: 20261105-b4-prep-khorenko-vstor-153709-dm-ploop-drop-the-lock-of-local-md-pages-4f25ac778924
>
> Best regards,
> --
> Konstantin Khorenko,
> Virtuozzo Linux Kernel Team
>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk
2026-11-05 19:17 [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk Konstantin Khorenko
2026-11-12 18:06 ` Konstantin Khorenko
@ 2026-11-12 18:06 ` Konstantin Khorenko
2026-11-17 10:29 ` Andrey Zhadchenko
2026-11-17 14:43 ` Konstantin Khorenko
3 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 18:06 UTC (permalink / raw)
To: Pavel Tikhomirov, Andrey Zhadchenko; +Cc: devel
a kind ping :)
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
On 11/5/26 20:17, Konstantin Khorenko wrote:
> notify_delta_merged() and ploop_check_delta_before_flip() walk the live
> BAT together with the BAT of a delta that ploop_read_delta_metadata()
> read into a local md tree. For each page they take the md_lock of the
> live page and then the md_lock of the local one.
>
> Every md_lock is initialized in ploop_alloc_md_page(), so both locks
> share one lockdep class. With CONFIG_PROVE_LOCKING the first walk
> reports "possible recursive locking detected", and lockdep turns itself
> off for the rest of the boot.
>
> Only the cmd that read the local tree can reach it, and it frees the
> tree after the walk, so its md_lock protects nothing. Stop taking it.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-153709
>
> Fixes: 0d4b4d0a20a9 ("dm-ploop: introduce per-md page locking")
> Feature: dm-ploop: ploop target driver
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
> This obsoletes "[PATCH vz10 10/24] dm-ploop: annotate nested md_lock in
> ploop_check_delta_before_flip()" of the VSTOR-137234 selftests series.
> Pavel pointed out that the SINGLE_DEPTH_NESTING annotation works around
> a lock that is not needed at all, and that notify_delta_merged() has
> the same problem. This patch stops taking that lock in both walks.
>
> Assisted-by: LLM
> ---
> drivers/md/dm-ploop-cmd.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
> index 2d1fa449b052d..f6135e07c2737 100644
> --- a/drivers/md/dm-ploop-cmd.c
> +++ b/drivers/md/dm-ploop-cmd.c
> @@ -812,7 +812,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
> d_bat_entries = d_md->kmpage;
>
> spin_lock_irqsave(&md->md_lock, flags); /* write */
> - spin_lock(&d_md->md_lock); /* write */
> for (; i <= end; i++) {
> clu = ploop_page_clu_idx_to_bat_clu(md->id, i);
> if (clu == nr_be - 1)
> @@ -846,7 +845,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
> WRITE_ONCE(md->bat_levels[i], level);
> }
>
> - spin_unlock(&d_md->md_lock);
> spin_unlock_irqrestore(&md->md_lock, flags);
>
> if (stop)
> @@ -1147,7 +1145,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
> d_bat_entries = d_md->kmpage;
>
> spin_lock_irq(&md->md_lock); /* read */
> - spin_lock(&d_md->md_lock);
> for (; i <= end; i++) {
> if (ploop_md_page_cluster_is_in_top_delta(ploop, md, i) &&
> d_bat_entries[i] != BAT_ENTRY_NONE) {
> @@ -1156,7 +1153,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
> break;
> }
> }
> - spin_unlock(&d_md->md_lock);
> spin_unlock_irq(&md->md_lock);
> if (stop)
> break;
>
> ---
> base-commit: f0cff9cebdb0d481d05b02bdb7bdafe864adca1c
> change-id: 20261105-b4-prep-khorenko-vstor-153709-dm-ploop-drop-the-lock-of-local-md-pages-4f25ac778924
>
> Best regards,
> --
> Konstantin Khorenko,
> Virtuozzo Linux Kernel Team
>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk
2026-11-05 19:17 [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk Konstantin Khorenko
2026-11-12 18:06 ` Konstantin Khorenko
2026-11-12 18:06 ` Konstantin Khorenko
@ 2026-11-17 10:29 ` Andrey Zhadchenko
2026-11-17 14:43 ` Konstantin Khorenko
3 siblings, 0 replies; 5+ messages in thread
From: Andrey Zhadchenko @ 2026-11-17 10:29 UTC (permalink / raw)
To: Konstantin Khorenko, Pavel Tikhomirov; +Cc: devel
Reviewed-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
On 11/5/26 20:17, Konstantin Khorenko wrote:
> notify_delta_merged() and ploop_check_delta_before_flip() walk the live
> BAT together with the BAT of a delta that ploop_read_delta_metadata()
> read into a local md tree. For each page they take the md_lock of the
> live page and then the md_lock of the local one.
>
> Every md_lock is initialized in ploop_alloc_md_page(), so both locks
> share one lockdep class. With CONFIG_PROVE_LOCKING the first walk
> reports "possible recursive locking detected", and lockdep turns itself
> off for the rest of the boot.
>
> Only the cmd that read the local tree can reach it, and it frees the
> tree after the walk, so its md_lock protects nothing. Stop taking it.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-153709
>
> Fixes: 0d4b4d0a20a9 ("dm-ploop: introduce per-md page locking")
> Feature: dm-ploop: ploop target driver
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
> This obsoletes "[PATCH vz10 10/24] dm-ploop: annotate nested md_lock in
> ploop_check_delta_before_flip()" of the VSTOR-137234 selftests series.
> Pavel pointed out that the SINGLE_DEPTH_NESTING annotation works around
> a lock that is not needed at all, and that notify_delta_merged() has
> the same problem. This patch stops taking that lock in both walks.
>
> Assisted-by: LLM
> ---
> drivers/md/dm-ploop-cmd.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
> index 2d1fa449b052d..f6135e07c2737 100644
> --- a/drivers/md/dm-ploop-cmd.c
> +++ b/drivers/md/dm-ploop-cmd.c
> @@ -812,7 +812,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
> d_bat_entries = d_md->kmpage;
>
> spin_lock_irqsave(&md->md_lock, flags); /* write */
> - spin_lock(&d_md->md_lock); /* write */
> for (; i <= end; i++) {
> clu = ploop_page_clu_idx_to_bat_clu(md->id, i);
> if (clu == nr_be - 1)
> @@ -846,7 +845,6 @@ static void notify_delta_merged(struct ploop *ploop, u8 level,
> WRITE_ONCE(md->bat_levels[i], level);
> }
>
> - spin_unlock(&d_md->md_lock);
> spin_unlock_irqrestore(&md->md_lock, flags);
>
> if (stop)
> @@ -1147,7 +1145,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
> d_bat_entries = d_md->kmpage;
>
> spin_lock_irq(&md->md_lock); /* read */
> - spin_lock(&d_md->md_lock);
> for (; i <= end; i++) {
> if (ploop_md_page_cluster_is_in_top_delta(ploop, md, i) &&
> d_bat_entries[i] != BAT_ENTRY_NONE) {
> @@ -1156,7 +1153,6 @@ static int ploop_check_delta_before_flip(struct ploop *ploop, struct file *file)
> break;
> }
> }
> - spin_unlock(&d_md->md_lock);
> spin_unlock_irq(&md->md_lock);
> if (stop)
> break;
>
> ---
> base-commit: f0cff9cebdb0d481d05b02bdb7bdafe864adca1c
> change-id: 20261105-b4-prep-khorenko-vstor-153709-dm-ploop-drop-the-lock-of-local-md-pages-4f25ac778924
>
> Best regards,
> --
> Konstantin Khorenko,
> Virtuozzo Linux Kernel Team
>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk
2026-11-05 19:17 [Devel] [PATCH hci-8.1] dm-ploop: do not lock the md pages of a delta read for a BAT walk Konstantin Khorenko
` (2 preceding siblings ...)
2026-11-17 10:29 ` Andrey Zhadchenko
@ 2026-11-17 14:43 ` Konstantin Khorenko
3 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 14:43 UTC (permalink / raw)
To: Pavel Tikhomirov, Andrey Zhadchenko, Konstantin Khorenko; +Cc: devel
On Thu, 05 Nov 2026 20:17:17 +0100, Konstantin Khorenko wrote:
> dm-ploop: do not lock the md pages of a delta read for a BAT walk
Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.24.3.vz10, thanks!
[1/1] dm-ploop: do not lock the md pages of a delta read for a BAT walk
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/0950007e48c4
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 5+ messages in thread