Skip to content

blk-iocost: use irq-safe locking in cgroup handlers#913

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1103769=>linus-master
Open

blk-iocost: use irq-safe locking in cgroup handlers#913
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1103769=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 1, 2026

Copy link
Copy Markdown

Pull request for series with
subject: blk-iocost: use irq-safe locking in cgroup handlers
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1103769

@blktests-ci

blktests-ci Bot commented Jun 1, 2026

Copy link
Copy Markdown
Author

Upstream branch: 8fde5d1
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci

blktests-ci Bot commented Jun 1, 2026

Copy link
Copy Markdown
Author

Upstream branch: e43ffb6
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 6c0c7d1 to 44fd214 Compare June 1, 2026 09:09
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c6dc343 to fc36596 Compare June 3, 2026 13:56
@blktests-ci

blktests-ci Bot commented Jun 3, 2026

Copy link
Copy Markdown
Author

Upstream branch: ba3e43a
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 44fd214 to 93bc5e8 Compare June 3, 2026 14:05
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from fc36596 to 7bed9c3 Compare June 5, 2026 09:48
@blktests-ci

blktests-ci Bot commented Jun 5, 2026

Copy link
Copy Markdown
Author

Upstream branch: ddd664b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 93bc5e8 to 34737a5 Compare June 5, 2026 09:54
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 7bed9c3 to a7bb5c5 Compare June 7, 2026 14:54
@blktests-ci

blktests-ci Bot commented Jun 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: 979c294
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 34737a5 to 38f0e00 Compare June 7, 2026 15:00
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from a7bb5c5 to 5e41a3b Compare June 10, 2026 13:31
@blktests-ci

blktests-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: acb7500
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 38f0e00 to 26761c2 Compare June 10, 2026 14:03
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5e41a3b to c3a084b Compare June 10, 2026 20:26
@blktests-ci

blktests-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: 9716c08
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 26761c2 to 5baea94 Compare June 11, 2026 09:36
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c3a084b to 5f78e5d Compare June 12, 2026 22:27
@blktests-ci

blktests-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 2a2974b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 5baea94 to 1ea88e0 Compare June 12, 2026 23:01
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5f78e5d to e48f9db Compare June 13, 2026 01:19
@blktests-ci

blktests-ci Bot commented Jun 13, 2026

Copy link
Copy Markdown
Author

Upstream branch: 062871f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 1ea88e0 to 83e7558 Compare June 13, 2026 01:58
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from 199644a to e6d9eb8 Compare June 17, 2026 12:02
@blktests-ci

blktests-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from 83e7558 to ec1ea0b Compare June 17, 2026 13:56
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e6d9eb8 to 7d8604f Compare June 24, 2026 01:11
ioc_timer_fn() acquires ioc->lock from timer softirq context. The
io.weight, io.cost.qos and io.cost.model cgroup handlers can take the
same lock from process context, and the direct handler paths must not do
so with interrupts enabled.

A blkcg policy configuration reproducer with lockdep reproduced the
following report:

  WARNING: inconsistent lock state
  7.1.0-rc2-g1e14adca0199 #1 Not tainted
  --------------------------------
  inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
  swapper/2/0 [HC0[0]:SC1[1]:HE0:SE0] takes:
  ffff88810f95d0f8 (&ioc->lock){+.?.}-{3:3}, at: ioc_timer_fn+0x3ff/0x3af0
  {SOFTIRQ-ON-W} state was registered at:
    lock_acquire+0xd4/0x290
    _raw_spin_lock+0x3a/0x70
    ioc_weight_write+0x35a/0x420
    cgroup_file_write+0x1c5/0x4b0
    kernfs_fop_write_iter+0x1d7/0x280
    vfs_write+0x580/0x630
    ksys_write+0xec/0x190
    do_syscall_64+0x156/0x490
    entry_SYSCALL_64_after_hwframe+0x77/0x7f

  Possible unsafe locking scenario:

        CPU0
        ----
    lock(&ioc->lock);
    <Interrupt>
      lock(&ioc->lock);

     *** DEADLOCK ***

  1 lock held by swapper/2/0:
   #0: ffffc90000230d20 ((&ioc->timer)){+.-.}-{0:0}, at:
       call_timer_fn+0xba/0x3a0
  stack backtrace:
  CPU: 2 UID: 0 PID: 0 Comm: swapper/2 Not tainted 7.1.0-rc2-g1e14adca0199 #1 PREEMPT  ea13f83d4b74a12510d20db4a7d9a0fe8275f05c
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-5.fc42 04/01/2014
  Call Trace:
   <IRQ>
   dump_stack_lvl+0x54/0x70
   print_usage_bug+0x26d/0x280
   mark_lock_irq+0x3ef/0x400
   mark_lock+0x117/0x190
   __lock_acquire+0x592/0x2850
   lock_acquire+0xd4/0x290
   _raw_spin_lock_irq+0x49/0x80
   ioc_timer_fn+0x3ff/0x3af0
   call_timer_fn+0x120/0x3a0
   __run_timer_base+0x3ad/0x490
   run_timer_softirq+0x31/0x60
   handle_softirqs+0x1a0/0x550
   __irq_exit_rcu+0x8c/0x150
   irq_exit_rcu+0xe/0x20
   sysvec_apic_timer_interrupt+0x6e/0x80
   </IRQ>

Use spin_lock_irq() in the affected process-context handlers. The default
io.weight update already holds blkcg->lock with spin_lock_irq(), so the
nested ioc->lock acquisition there is already IRQ-safe and is left as a
plain spin_lock().

Fixes: 7caa471 ("blkcg: implement blk-iocost")
Signed-off-by: Yu Kuai <yukuai@fygo.io>
@blktests-ci

blktests-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: bade58e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1103769
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1103769=>linus-master branch from ec1ea0b to edbd2d3 Compare June 24, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants