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

From: ppvk
Date: Wed Apr 08 2020 - 08:58:40 EST


Hi Doug,

You no longer seeing this warning stack with the latest patch set.
https://lkml.org/lkml/2020/3/23/407

The latest patch set is based on OPP framework and no workqueue's used to queue the work.
Can you give a try with the latest patch and check if this helps ?

Thanks and Regards,
Pradeep

-----Original Message-----
From: Doug Anderson <dianders@xxxxxxxxxxxx>
Sent: Friday, April 3, 2020 10:34 PM
To: Pradeep P V K <ppvk@xxxxxxxxxxxxxx>
Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>; Georgi Djakov <georgi.djakov@xxxxxxxxxx>; Rob Herring <robh+dt@xxxxxxxxxx>; Ulf Hansson <ulf.hansson@xxxxxxxxxx>; Asutosh Das <asutoshd@xxxxxxxxxxxxxx>; Veerabhadrarao Badiganti <vbadigan@xxxxxxxxxxxxxx>; Sahitya Tummala <stummala@xxxxxxxxxxxxxx>; Sayali Lokhande <sayalil@xxxxxxxxxxxxxx>; Ram Prakash Gupta <rampraka@xxxxxxxxxxxxxx>; Stephen Boyd <sboyd@xxxxxxxxxx>; Linux MMC List <linux-mmc@xxxxxxxxxxxxxxx>; LKML <linux-kernel@xxxxxxxxxxxxxxx>; linux-arm-msm <linux-arm-msm@xxxxxxxxxxxxxxx>; open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS <devicetree@xxxxxxxxxxxxxxx>; Andy Gross <agross@xxxxxxxxxx>; linux-mmc-owner@xxxxxxxxxxxxxxx; Subhash Jadavani <subhashj@xxxxxxxxxxxxxx>
Subject: Re: [RFC-v2 2/2] mmc: sdhci-msm: Add support for bus bandwidth voting

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