Re: [RFC-v2 2/2] mmc: sdhci-msm: Add support for bus bandwidth voting

From: Doug Anderson
Date: Fri Apr 03 2020 - 13:10:10 EST


Hi,

On Fri, Nov 8, 2019 at 5:45 AM Pradeep P V K <ppvk@xxxxxxxxxxxxxx> wrote:
>
> + if (msm_host->bus_vote_data->curr_vote != VOTE_ZERO)
> + queue_delayed_work(system_wq,
> + &msm_host->bus_vote_work,
> + msecs_to_jiffies(MSM_MMC_BUS_VOTING_DELAY));
> +}

Drive-by feedback here without any full review of your patch...
Someone had your patch applied and sent me a stack trace with a
warning on it. That warning showed:

workqueue: WQ_MEM_RECLAIM kblockd:blk_mq_run_work_fn is flushing
!WQ_MEM_RECLAIM events:sdhci_msm_bus_work

The trace shown was:

check_flush_dependency+0x108/0x110
__flush_work+0xa8/0x1e8
__cancel_work_timer+0x130/0x1c4
cancel_delayed_work_sync+0x20/0x30
sdhci_msm_bus_cancel_work_and_set_vote+0x3c/0x8c
sdhci_msm_bus_voting+0x40/0x7c
sdhci_msm_runtime_resume+0xdc/0xf4
pm_generic_runtime_resume+0x34/0x48
__rpm_callback+0x70/0xfc
rpm_callback+0x5c/0x8c
rpm_resume+0x3fc/0x534
__pm_runtime_resume+0x7c/0xa0
__mmc_claim_host+0x1f4/0x230
mmc_get_card+0x34/0x40
mmc_mq_queue_rq+0x18c/0x244
blk_mq_dispatch_rq_list+0x27c/0x560
blk_mq_do_dispatch_sched+0xe0/0x140
blk_mq_sched_dispatch_requests+0x138/0x1b8
__blk_mq_run_hw_queue+0xc0/0x118
blk_mq_run_work_fn+0x24/0x30

I believe the way to interpret this is that you need to be running
your work on a workqueue marked for memory reclaim. That means you
can't use the system_wq to queue your work. Without being an expert,
a quick guess would be that you should be queueing your work on the
"kblockd_workqueue" using one of the functions for this.

-Doug