We observed "BUG: scheduling while atomic: lvm/1380/0x00000003"
for the rt kernel under the upgrade and rollback test in 6.6,
6.12 and mainline.
The issue is related with dm_exception_table_lock(&lock), in
which function preempt_disable() is called twice. The code block
is between dm_exception_table_lock(&lock) and
dm_exception_table_unlock(&lock), if the code involves rt_spin_lock
that will trigger such as "BUG: scheduling while atomic:
kworker/u72:11/349/0x00000003" because the preempt number is 3
in this time.
There are several places that involve the same issue in dm-snap.c,
such as dm_add_exception(), pending_complete() and snapshot_map().
Fix this by converting a hlist_bl spinlock into a regular spinlock.
Cherry pick the upstream commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8581b19eb2c5
("dm-snapshot: fix 'scheduling while atomic' on real-time kernels")
Here we removed the patch
0015-sched-fair-Block-delayed-tasks-on-throttled-hierarch.patch,
it was not required after the kernel upgrade to 6.12.57.
Verification:
- Build iso success for rt and std.
- Run the tests upgrade and rollback for more than one day.
Closes-Bug: 2136084
Change-Id: I7a7d094c60f8f8fd9f4da3c441fcda89f6048241
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>