Hi,
please add the commit
18dfa7117a3f379862dcd3f67cadd678013bb9dd
Btrfs: fix unwritten extent buffers and hangs on future writeback attempts
to the 5.2.x tree. It fixes a regression introduced in 5.2 with a big
user impact.
Thanks.
On Fri, Sep 13, 2019 at 12:09 AM Thomas Hellström (VMware)
<thomas_os(a)shipmail.org> wrote:
>
> From: Thomas Hellstrom <thellstrom(a)vmware.com>
>
> Commit 4daa4fba3a38 ("gpu: drm: ttm: Adding new return type vm_fault_t")
> broke TTM prefaulting. Since vmf_insert_mixed() typically always returns
> VM_FAULT_NOPAGE, prefaulting stops after the second PTE.
>
> Restore (almost) the original behaviour. Unfortunately we can no longer
> with the new vm_fault_t return type determine whether a prefaulting
> PTE insertion hit an already populated PTE, and terminate the insertion
> loop. Instead we continue with the pre-determined number of prefaults.
>
> Fixes: 4daa4fba3a38 ("gpu: drm: ttm: Adding new return type vm_fault_t")
> Cc: Souptick Joarder <jrdr.linux(a)gmail.com>
> Cc: Christian König <christian.koenig(a)amd.com>
> Signed-off-by: Thomas Hellstrom <thellstrom(a)vmware.com>
This commit merged into 4.19. Need to Cc stable.
Cc: stable(a)vger.kernel.org # v4.19+
> ---
> drivers/gpu/drm/ttm/ttm_bo_vm.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> index 5a580adeb9d1..aa18e8a53727 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> @@ -290,15 +290,13 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
> else
> ret = vmf_insert_pfn(&cvma, address, pfn);
>
> - /*
> - * Somebody beat us to this PTE or prefaulting to
> - * an already populated PTE, or prefaulting error.
> - */
> -
> - if (unlikely((ret == VM_FAULT_NOPAGE && i > 0)))
> - break;
> - else if (unlikely(ret & VM_FAULT_ERROR))
> - goto out_io_unlock;
> + /* Never error on prefaulted PTEs */
> + if (unlikely((ret & VM_FAULT_ERROR))) {
> + if (i == 0)
> + goto out_io_unlock;
> + else
> + break;
> + }
>
> address += PAGE_SIZE;
> if (unlikely(++page_offset >= page_last))
> --
> 2.20.1
>
The tmio_mmc_host_probe() calls pm_runtime_set_active() to update the
runtime PM status of the device, as to make it reflect the current status
of the HW. This works fine for most cases, but unfortunate not for all.
Especially, there is a generic problem when the device has a genpd attached
and that genpd have the ->start|stop() callbacks assigned.
More precisely, if the driver calls pm_runtime_set_active() during
->probe(), genpd does not get to invoke the ->start() callback for it,
which means the HW isn't really fully powered on. Furthermore, in the next
phase, when the device becomes runtime suspended, genpd will invoke the
->stop() callback for it, potentially leading to usage count imbalance
problems, depending on what's implemented behind the callbacks of course.
To fix this problem, convert to call pm_runtime_get_sync() from
tmio_mmc_host_probe() rather than pm_runtime_set_active(). Additionally, to
avoid bumping usage counters and unnecessary re-initializing the HW the
first time the tmio driver's ->runtime_resume() callback is called,
introduce a state flag to keeping track of this.
Cc: stable(a)vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson(a)linaro.org>
---
drivers/mmc/host/tmio_mmc.h | 1 +
drivers/mmc/host/tmio_mmc_core.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index c5ba13fae399..2f0b092d6dcc 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -163,6 +163,7 @@ struct tmio_mmc_host {
unsigned long last_req_ts;
struct mutex ios_lock; /* protect set_ios() context */
bool native_hotplug;
+ bool runtime_synced;
bool sdio_irq_enabled;
/* Mandatory callback */
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 8b299c1f0069..32f9679ec42e 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1248,20 +1248,22 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
/* See if we also get DMA */
tmio_mmc_request_dma(_host, pdata);
- pm_runtime_set_active(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_enable(&pdev->dev);
+ pm_runtime_get_sync(&pdev->dev);
ret = mmc_add_host(mmc);
if (ret)
goto remove_host;
dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
+ pm_runtime_put(&pdev->dev);
return 0;
remove_host:
+ pm_runtime_put_noidle(&pdev->dev);
tmio_mmc_host_remove(_host);
return ret;
}
@@ -1330,6 +1332,11 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
{
struct tmio_mmc_host *host = dev_get_drvdata(dev);
+ if (!host->runtime_synced) {
+ host->runtime_synced = true;
+ return 0;
+ }
+
tmio_mmc_clk_enable(host);
tmio_mmc_hw_reset(host->mmc);
--
2.17.1