Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 18cf2a36 authored by Ram Prakash Gupta's avatar Ram Prakash Gupta
Browse files

mmc: core: use blk_cleanup_queue() during shutdown/reboot



It is preferred to use blk_cleanup_queue() instead of
blk_stop_queue() during reboot/shutdown due to these reasons -

1. blk_cleanup_queue() marks the queue as dying/dead which prevents
the new requests from getting inserted into the queue after MMC
driver shutdown.

If we just use blk_stop_queue(), the requests are still allowed into
the request_queue but are not dispatched to the low level MMC driver
as the queue is marked as stopped. This may result into deadlock/hang
issue during shutdown, if FS (as part of emergency remount) is waiting
for the queued request to be completed without relinquishing the CPU.
If some CPU bound workqueues related to shutdown are pending on that
CPU, then shutdown may hang.

2. blk_cleanup_queue() also drains the queue completely by processing
all the pending requests from the elevator queue even though those are
not yet dispatched to request_queue and also waits for the completion
of all those requests.

Also, do not override the queue_lock in request_queue structure with
md->lock as this will cause below problem when using
blk_cleanup_queue() in shutdown. This happens because
blk_cleanup_queue() changes queue_lock from driver md->lock to it's
original request_queue lock.

Callstack:
<6> BUG: spinlock already unlocked on CPU#6, iozone/4391
<6> lock: 0xffffffc06ab8be80, .magic: dead4ead,
.owner: <none>/-1, .owner_cpu: -1
[ffffffc0420e3b28] __delay at ffffffc00031a328
[ffffffc0420e3b38] __const_udelay at ffffffc00031a304
[ffffffc0420e3b58] msm_trigger_wdog_bite at ffffffc0004476cc
[ffffffc0420e3b68] spin_bug at ffffffc0000e4554
[ffffffc0420e3b98] do_raw_spin_unlock at ffffffc0000e47a0
[ffffffc0420e3bc8] _raw_spin_unlock_irq at ffffffc000db3ee0
[ffffffc0420e3be8] blk_queue_bio at ffffffc0002ff1e4
[ffffffc0420e3bf8] generic_make_request at ffffffc0002fd210
[ffffffc0420e3c58] submit_bio at ffffffc0002fd328
[ffffffc0420e3ca8] submit_bio_wait at ffffffc0002f5768
[ffffffc0420e3d00] compat_sys_call_table at ffffffc00008e000
[ffffffc0420e3d18] submit_bio_wait at ffffffc0002f574c
[ffffffc0420e3d38] __blkdev_issue_flush at ffffffc00030043c
[ffffffc0420e3da8] blkdev_issue_flush at ffffffc000300494
[ffffffc0420e3dd8] ext4_sync_fs at ffffffc0002597a4

Reference:
2cfffa3 mmc: queue: fix for system suspend flow for eMMC command queue
(cmdq).

Change-Id: Id6caa8a54888db0fc1dddb2a2a2e61c94809ce93
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
Signed-off-by: default avatarRam Prakash Gupta <rampraka@codeaurora.org>
parent 6b1c4897
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment