4.19.11-stable review
Greg Kroah-Hartman
maintainercover 4.19.11-stable review
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.11-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.11-rc1
Masahiro Yamada <[email protected]>
x86/build: Fix compiler support check for CONFIG_RETPOLINE
Damien Le Moal <[email protected]>
dm zoned: Fix target BIO completion handling
Junwei Zhang <[email protected]>
drm/amdgpu: update SMC firmware image for polaris10 variants
Alex Deucher <[email protected]>
drm/amdgpu: update smu firmware images for VI variants (v2)
Alex Deucher <[email protected]>
drm/amdgpu: add some additional vega10 pci ids
Alex Deucher <[email protected]>
drm/amdkfd: add new vega10 pci ids
Kenneth Feng <[email protected]>
drm/amdgpu/powerplay: Apply avfs cks-off voltages on VI
Chris Wilson <[email protected]>
drm/i915/execlists: Apply a full mb before execution for Braswell
Tina Zhang <[email protected]>
drm/i915/gvt: Fix tiled memory decoding bug on BDW
Brian Norris <[email protected]>
Revert "drm/rockchip: Allow driver to be shutdown on reboot/kexec"
Ben Skeggs <[email protected]>
drm/nouveau/kms/nv50-: also flush fb writes when rewinding push buffer
Lyude Paul <[email protected]>
drm/nouveau/kms: Fix memory leak in nv50_mstm_del()
Benjamin Herrenschmidt <[email protected]>
powerpc: Look for "stdout-path" when setting up legacy consoles
Radu Rendec <[email protected]>
powerpc/msi: Fix NULL pointer access in teardown code
Hans Verkuil <[email protected]>
media: vb2: don't call __vb2_queue_cancel if vb2_start_streaming failed
Steven Rostedt (VMware) <[email protected]>
tracing: Fix memory leak of instance function hash filters
Steven Rostedt (VMware) <[email protected]>
tracing: Fix memory leak in set_trigger_filter()
Steven Rostedt (VMware) <[email protected]>
tracing: Fix memory leak in create_filter()
Mike Snitzer <[email protected]>
dm: call blk_queue_split() to impose device limits on bios
Mike Snitzer <[email protected]>
dm cache metadata: verify cache has blocks in blocks_are_clean_separate_dirty()
Mike Snitzer <[email protected]>
dm thin: send event about thin-pool state change _after_ making it
Stefan Wahren <[email protected]>
ARM: dts: bcm2837: Fix polarity of wifi reset GPIOs
Lubomir Rintel <[email protected]>
ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt
Chad Austin <[email protected]>
fuse: continue to send FUSE_RELEASEDIR when FUSE_OPEN returns ENOSYS
Alek Du <[email protected]>
mmc: sdhci: fix the timeout check window for clock and reset
Faiz Abbas <[email protected]>
mmc: sdhci-omap: Fix DCRC error handling during tuning
Wolfram Sang <[email protected]>
mmc: core: use mrq->sbc when sending CMD23 for RPMB
Aaro Koskinen <[email protected]>
MMC: OMAP: fix broken MMC on OMAP15XX/OMAP5910/OMAP310
Amir Goldstein <[email protected]>
ovl: fix missing override creds in link of a metacopy upper
Amir Goldstein <[email protected]>
ovl: fix decode of dir file handle with multi lower layers
Keith Busch <[email protected]>
block/bio: Do not zero user pages
Robin Murphy <[email protected]>
arm64: dma-mapping: Fix FORCE_CONTIGUOUS buffer clearing
Andrea Arcangeli <[email protected]>
userfaultfd: check VM_MAYWRITE was set after verifying the uffd is registered
Piotr Jaroszynski <[email protected]>
fs/iomap.c: get/put the page in iomap_page_create/release()
Thierry Reding <[email protected]>
scripts/spdxcheck.py: always open files in binary mode
Jeff Moyer <[email protected]>
aio: fix spectre gadget in lookup_ioctx
Chen-Yu Tsai <[email protected]>
pinctrl: sunxi: a83t: Fix IRQ offset typo for PH11
Arnd Bergmann <[email protected]>
drm/msm: fix address space warning
Arnd Bergmann <[email protected]>
ARM: dts: qcom-apq8064-arrow-sd-600eval fix graph_endpoint warning
Arnd Bergmann <[email protected]>
i2c: aspeed: fix build warning
Arnd Bergmann <[email protected]>
slimbus: ngd: mark PM functions as __maybe_unused
Lubomir Rintel <[email protected]>
staging: olpc_dcon: add a missing dependency
Arnd Bergmann <[email protected]>
scsi: raid_attrs: fix unused variable warning
Vincent Guittot <[email protected]>
sched/pelt: Fix warning and clean up IRQ PELT config
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 2 +- arch/arm/boot/dts/bcm2837-rpi-3-b.dts | 2 +- .../arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts | 5 + arch/arm/mach-mmp/cputype.h | 6 +- arch/arm64/mm/dma-mapping.c | 2 +- arch/powerpc/kernel/legacy_serial.c | 6 +- arch/powerpc/kernel/msi.c | 7 +- arch/x86/Makefile | 10 +- block/bio.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 36 +++++- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 6 + drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h | 2 + .../drm/amd/powerplay/smumgr/polaris10_smumgr.c | 6 + drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c | 3 + drivers/gpu/drm/i915/gvt/fb_decoder.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 7 +- drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 8 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 30 +++-- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 6 - drivers/i2c/busses/i2c-aspeed.c | 4 +- drivers/md/dm-cache-metadata.c | 4 + drivers/md/dm-thin.c | 68 ++++++------ drivers/md/dm-zoned-target.c | 122 +++++++-------------- drivers/md/dm.c | 2 + drivers/media/common/videobuf2/videobuf2-core.c | 4 +- drivers/mmc/core/block.c | 15 ++- drivers/mmc/host/omap.c | 11 +- drivers/mmc/host/sdhci-omap.c | 12 +- drivers/mmc/host/sdhci.c | 18 ++- drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c | 2 +- drivers/scsi/raid_class.c | 4 +- drivers/slimbus/qcom-ngd-ctrl.c | 6 +- drivers/staging/olpc_dcon/Kconfig | 1 + fs/aio.c | 2 + fs/fuse/dir.c | 2 +- fs/fuse/file.c | 21 ++-- fs/fuse/fuse_i.h | 2 +- fs/iomap.c | 7 ++ fs/overlayfs/dir.c | 14 ++- fs/overlayfs/export.c | 6 +- fs/userfaultfd.c | 3 +- init/Kconfig | 5 + kernel/sched/core.c | 7 +- kernel/sched/fair.c | 2 +- kernel/sched/pelt.c | 2 +- kernel/sched/pelt.h | 2 +- kernel/sched/sched.h | 5 +- kernel/trace/ftrace.c | 1 + kernel/trace/trace_events_filter.c | 5 +- kernel/trace/trace_events_trigger.c | 6 +- scripts/spdxcheck.py | 6 +- 53 files changed, 311 insertions(+), 219 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/44 sched/pelt: Fix warning and clean up IRQ PELT config
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
Commit 11d4afd4ff667f9b6178ee8c142c36cb78bd84db upstream.
Create a config for enabling irq load tracking in the scheduler. irq load tracking is useful only when irq or paravirtual time is accounted but it's only possible with SMP for now.
Also use __maybe_unused to remove the compilation warning in update_rq_clock_task() that has been introduced by:
2e62c4743adc ("sched/fair: Remove #ifdefs from scale_rt_capacity()")
--- init/Kconfig | 5 +++++ kernel/sched/core.c | 7 +++---- kernel/sched/fair.c | 2 +- kernel/sched/pelt.c | 2 +- kernel/sched/pelt.h | 2 +- kernel/sched/sched.h | 5 ++--- 6 files changed, 13 insertions(+), 10 deletions(-)
init/Kconfig +5 -0
@@ -415,6 +415,11 @@ config IRQ_TIME_ACCOUNTING If in doubt, say N here. +config HAVE_SCHED_AVG_IRQ + def_bool y + depends on IRQ_TIME_ACCOUNTING || PARAVIRT_TIME_ACCOUNTING + depends on SMP + config BSD_PROCESS_ACCT bool "BSD Process Accounting" depends on MULTIUSER
kernel/sched/core.c +3 -4
@@ -135,9 +135,8 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)* In theory, the compile should just see 0 here, and optimize out the call * to sched_rt_avg_update. But I don't trust it... */ -#if defined(CONFIG_IRQ_TIME_ACCOUNTING ) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING ) -s64 steal =0 , irq_delta =0 ; -#endif +s64 __maybe_unused steal =0 , irq_delta =0 ; +#ifdef CONFIG_IRQ_TIME_ACCOUNTING irq_delta =irq_time_read (cpu_of (rq)) - rq->prev_irq_time;
@@ -177,7 +176,7 @@ static void update_rq_clock_task(struct rq *rq, s64 delta) rq->clock_task += delta; -#ifdef HAVE_SCHED_AVG_IRQ +#ifdef CONFIG_HAVE_SCHED_AVG_IRQ if ((irq_delta + steal) &&sched_feat (NONTASK_CAPACITY ))update_irq_load_avg (rq, irq_delta + steal);#endif
kernel/sched/fair.c +1 -1
@@ -7361,7 +7361,7 @@ static inline bool others_have_blocked(struct rq *rq)if (READ_ONCE (rq->avg_dl.util_avg))return true; -#if defined(CONFIG_IRQ_TIME_ACCOUNTING ) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING ) +#ifdef CONFIG_HAVE_SCHED_AVG_IRQ if (READ_ONCE (rq->avg_irq.util_avg))return true;#endif
kernel/sched/pelt.c +1 -1
@@ -358,7 +358,7 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running)return 0 ; } -#if defined(CONFIG_IRQ_TIME_ACCOUNTING ) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING ) +#ifdef CONFIG_HAVE_SCHED_AVG_IRQ /* * irq: *
kernel/sched/pelt.h +1 -1
@@ -6,7 +6,7 @@ int __update_load_avg_cfs_rq(u64 now, int cpu, struct cfs_rq *cfs_rq);int update_rt_rq_load_avg (u64 now,struct rq *rq,int running);int update_dl_rq_load_avg (u64 now,struct rq *rq,int running); -#if defined(CONFIG_IRQ_TIME_ACCOUNTING ) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING ) +#ifdef CONFIG_HAVE_SCHED_AVG_IRQ int update_irq_load_avg (struct rq *rq,u64 running);#else static inline int
kernel/sched/sched.h +2 -3
@@ -859,8 +859,7 @@ struct rq {struct sched_avg avg_rt;struct sched_avg avg_dl; -#if defined(CONFIG_IRQ_TIME_ACCOUNTING ) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING ) -#define HAVE_SCHED_AVG_IRQ +#ifdef CONFIG_HAVE_SCHED_AVG_IRQ struct sched_avg avg_irq;#endif u64 idle_stamp;
@@ -2215,7 +2214,7 @@ static inline unsigned long cpu_util_rt(struct rq *rq) }#endif -#ifdef HAVE_SCHED_AVG_IRQ +#ifdef CONFIG_HAVE_SCHED_AVG_IRQ static inline unsigned long cpu_util_irq (struct rq *rq) {return rq->avg_irq.util_avg;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 2/44 scsi: raid_attrs: fix unused variable warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
Commit 0eeec01488da9b1403c8c29e73eacac8af9e4bf2 upstream.
I ran into a new warning on randconfig kernels:
drivers/scsi/raid_class.c: In function 'raid_match':drivers/scsi/raid_class.c:64:24: error: unused variable 'i' [-Werror=unused-variable]
This looks like a very old problem that for some reason was very hard to run into, but it is very easy to fix, by replacing the incorrect #ifdef with a simpler IS_ENABLED() check.
--- drivers/scsi/raid_class.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/raid_class.c +1 -3
@@ -63,8 +63,7 @@ static int raid_match(struct attribute_container *cont, struct device *dev)* emulated RAID devices, so start with SCSI */ struct raid_internal *i =ac_to_raid_internal (cont); -#if defined(CONFIG_SCSI ) || defined(CONFIG_SCSI_MODULE ) -if (scsi_is_sdev_device (dev)) { +if (IS_ENABLED (CONFIG_SCSI ) &&scsi_is_sdev_device (dev)) {struct scsi_device *sdev =to_scsi_device (dev);if (i->f->cookie != sdev->host->hostt)
@@ -72,7 +71,6 @@ static int raid_match(struct attribute_container *cont, struct device *dev)return i->f->is_raid (dev); } -#endif /* FIXME: look at other subsystems too */ return 0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 3/44 staging: olpc_dcon: add a missing dependency
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
Commit 33f49571d75024b1044cd02689ad2bdb4924cc80 upstream.
WARNING: unmet direct dependencies detected for BACKLIGHT_CLASS_DEVICE
Depends on [n]: HAS_IOMEM [=y] && BACKLIGHT_LCD_SUPPORT [=n] Selected by [y]:
- FB_OLPC_DCON [=y] && STAGING [=y] && X86 [=y] && OLPC [=y] && FB [=y] && I2C [=y] && (GPIO_CS5535 [=n] || GPIO_CS5535 [=n]=n)
--- drivers/staging/olpc_dcon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/olpc_dcon/Kconfig +1 -0
@@ -2,6 +2,7 @@ config FB_OLPC_DCON tristate "One Laptop Per Child Display CONtroller support" depends on OLPC && FB depends on I2C + depends on BACKLIGHT_LCD_SUPPORT depends on (GPIO_CS5535 || GPIO_CS5535=n) select BACKLIGHT_CLASS_DEVICE help
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 4/44 slimbus: ngd: mark PM functions as __maybe_unused
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
Commit 2e6ae11dd0d1c37f44cec51a58fb2092e55ed0f5 upstream.
qcom_slim_ngd_runtime_suspend is protected by an #ifdef, qcom_slim_ngd_runtime_idle is now, which causes a build time warning:
drivers/slimbus/qcom-ngd-ctrl.c:1470:12: error: 'qcom_slim_ngd_runtime_idle' defined but not used [-Werror=unused-function]
Marking both as __maybe_unused lets us get rid of the warning as well as the #ifdef.
--- drivers/slimbus/qcom-ngd-ctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/slimbus/qcom-ngd-ctrl.c +2 -4
@@ -1467,7 +1467,7 @@ static int qcom_slim_ngd_remove(struct platform_device *pdev)return 0 ; } -static int qcom_slim_ngd_runtime_idle (struct device *dev) +static int __maybe_unused qcom_slim_ngd_runtime_idle (struct device *dev) {struct qcom_slim_ngd_ctrl *ctrl =dev_get_drvdata (dev);
@@ -1477,8 +1477,7 @@ static int qcom_slim_ngd_runtime_idle(struct device *dev)return -EAGAIN ; } -#ifdef CONFIG_PM -static int qcom_slim_ngd_runtime_suspend (struct device *dev) +static int __maybe_unused qcom_slim_ngd_runtime_suspend (struct device *dev) {struct qcom_slim_ngd_ctrl *ctrl =dev_get_drvdata (dev);int ret =0 ;
@@ -1491,7 +1490,6 @@ static int qcom_slim_ngd_runtime_suspend(struct device *dev)return ret; } -#endif static const struct dev_pm_ops qcom_slim_ngd_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 5/44 i2c: aspeed: fix build warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
Upstream commit 3e9efc3299dd ("i2c: aspeed: Handle master/slave combined irq events properly") reworked the interrupt handling and fixed a warning in the process:
drivers/i2c/busses/i2c-aspeed.c: In function 'aspeed_i2c_bus_irq':drivers/i2c/busses/i2c-aspeed.c:567:1: error: label 'out' defined but not used [-Werror=unused-label]
The warning is still present in v4.19.8 and can be fixed either by applying that original patch, or by adding a simple #ifdef.
Here, I choose the second simpler option as the original patch seems too invasive for a stable backport.
--- drivers/i2c/busses/i2c-aspeed.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-aspeed.c +3 -1
@@ -555,7 +555,7 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)spin_lock (&bus->lock);#if IS_ENABLED (CONFIG_I2C_SLAVE ) -if (aspeed_i2c_slave_irq (bus)) { +if (IS_ENABLED (CONFIG_I2C_SLAVE ) &&aspeed_i2c_slave_irq (bus)) {dev_dbg (bus->dev,"irq handled by slave.\n" ); ret = true; goto out;
@@ -564,7 +564,9 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) ret =aspeed_i2c_master_irq (bus); +#if IS_ENABLED (CONFIG_I2C_SLAVE ) out: +#endif spin_unlock (&bus->lock);return ret ?IRQ_HANDLED :IRQ_NONE ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 6/44 ARM: dts: qcom-apq8064-arrow-sd-600eval fix graph_endpoint warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
Upstream commit 972910948fb6 ("ARM: dts: qcom: Remove Arrow SD600 eval board") removed this file because there are no known users, but in linux-4.19.y, we still get a compile-time warnign for it:
arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dtb: Warning (graph_endpoint): /soc/mdp@5100000/ports/port@3/endpoint: graph connection to node '/soc/hdmi-tx@4a00000/ports/port@0/endpoint' is not bidirectional
Address the warning by adding the remote endpoint that makes the link bidirectional. This is the same property that other boards use.
--- arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts +5 -0
@@ -387,6 +387,11 @@ hpd-gpio = <&tlmm_pinmux 72 GPIO_ACTIVE_HIGH>; ports { + port@0 { + endpoint { + remote-endpoint = <&mdp_dtv_out>; + }; + }; port@1 { endpoint { remote-endpoint = <&hdmi_con>;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 7/44 drm/msm: fix address space warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
In the linux-4.19 stable kernel, we get a warning about a type mismatch between phys_addr_t and dma_addr_t:
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c: In function '_dpu_dbg_dump_dpu_dbg_bus':drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:2003:16: error: passing argument 3 of 'dma_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]
list_size, &phys, GFP_KERNEL);
^~~~~
In file included from include/linux/dma-buf.h:31,
from drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:20:include/linux/dma-mapping.h:561:15: note: expected 'dma_addr_t *' {aka 'long long unsigned int *'} but argument is of type 'phys_addr_t *' {aka 'unsigned int *'}
dma_addr_t *dma_handle, gfp_t flag)
~~~~~~~~~~~~^~~~~~~~~~drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c: In function '_dpu_dbg_dump_vbif_dbg_bus':drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:2154:16: error: passing argument 3 of 'dma_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]
list_size, &phys, GFP_KERNEL);
^~~~~
In file included from include/linux/dma-buf.h:31,
from drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:20:include/linux/dma-mapping.h:561:15: note: expected 'dma_addr_t *' {aka 'long long unsigned int *'} but argument is of type 'phys_addr_t *' {aka 'unsigned int *'}
This code was removed in linux-4.20 with upstream commit effec874792f ("drm/msm/dpu: Remove dpu_dbg"). Rather than backporting the large patch, this just fixes the warning by using the correct type.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c +4 -4
@@ -1962,7 +1962,7 @@ static void _dpu_dbg_dump_dpu_dbg_bus(struct dpu_dbg_dpu_debug_bus *bus)u32 *dump_addr =NULL ;u32 status =0 ;struct dpu_debug_bus_entry *head; -phys_addr_t phys =0 ; +dma_addr_t dma =0 ;int list_size;int i;u32 offset;
@@ -2000,7 +2000,7 @@ static void _dpu_dbg_dump_dpu_dbg_bus(struct dpu_dbg_dpu_debug_bus *bus)if (in_mem) {if (!(*dump_mem)) *dump_mem =dma_alloc_coherent (dpu_dbg_base.dev, - list_size, &phys,GFP_KERNEL ); + list_size, &dma,GFP_KERNEL );if (*dump_mem) { dump_addr = *dump_mem;
@@ -2101,7 +2101,7 @@ static void _dpu_dbg_dump_vbif_dbg_bus(struct dpu_dbg_vbif_debug_bus *bus)u32 value, d0, d1;unsigned long reg, reg1, reg2;struct vbif_debug_bus_entry *head; -phys_addr_t phys =0 ; +dma_addr_t dma =0 ;int i, list_size =0 ;void __iomem *mem_base =NULL ;struct vbif_debug_bus_entry *dbg_bus;
@@ -2151,7 +2151,7 @@ static void _dpu_dbg_dump_vbif_dbg_bus(struct dpu_dbg_vbif_debug_bus *bus)if (in_mem) {if (!(*dump_mem)) *dump_mem =dma_alloc_coherent (dpu_dbg_base.dev, - list_size, &phys,GFP_KERNEL ); + list_size, &dma,GFP_KERNEL );if (*dump_mem) { dump_addr = *dump_mem;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 8/44 pinctrl: sunxi: a83t: Fix IRQ offset typo for PH11
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 478b6767ad26ab86d9ecc341027dd09a87b1f997 upstream.
Pin PH11 is used on various A83T board to detect a change in the OTG port's ID pin, as in when an OTG host cable is plugged in.
The incorrect offset meant the gpiochip/irqchip was activating the wrong pin for interrupts.
--- drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c +1 -1
@@ -568,7 +568,7 @@ static const struct sunxi_desc_pin sun8iSUNXI_PIN (SUNXI_PINCTRL_PIN (H ,11 ),SUNXI_FUNCTION (0x0 ,"gpio_in" ),SUNXI_FUNCTION (0x1 ,"gpio_out" ), - SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 1)), /* PH_EINT11 */ + SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 11)), /* PH_EINT11 */ };static const struct sunxi_pinctrl_desc sun8i_a83t_pinctrl_data = {
Greg Kroah-Hartman
maintainerPATCH 9/44 aio: fix spectre gadget in lookup_ioctx
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Moyer <[email protected]>
commit a538e3ff9dabcdf6c3f477a373c629213d1c3066 upstream.
Matthew pointed out that the ioctx_table is susceptible to spectre v1, because the index can be controlled by an attacker. The below patch should mitigate the attack for all of the aio system calls.
--- fs/aio.c | 2 ++ 1 file changed, 2 insertions(+)
fs/aio.c +2 -0
@@ -45,6 +45,7 @@#include <asm/kmap_types.h> #include <linux/uaccess.h> +#include <linux/nospec.h> #include "internal.h"
@@ -1038,6 +1039,7 @@ static struct kioctx *lookup_ioctx(unsigif (!table || id >= table->nr) goto out; + id =array_index_nospec (id, table->nr); ctx =rcu_dereference (table->table[id]);if (ctx && ctx->user_id == ctx_id) {if (percpu_ref_tryget_live (&ctx->users))
Greg Kroah-Hartman
maintainerPATCH 10/44 scripts/spdxcheck.py: always open files in binary mode
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thierry Reding <[email protected]>
commit 3a6ab5c7dc114057fd67750e308e1745dafc0e6a upstream.
The spdxcheck script currently falls over when confronted with a binary file (such as Documentation/logo.gif). To avoid that, always open files in binary mode and decode line-by-line, ignoring encoding errors.
One tricky case is when piping data into the script and reading it from standard input. By default, standard input will be opened in text mode, so we need to reopen it in binary mode.
The breakage only happens with python3 and results in a UnicodeDecodeError (according to Uwe).
--- scripts/spdxcheck.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/spdxcheck.py +4 -2
@@ -168,6 +168,7 @@ class id_parser(object): self.curline = 0 try: for line in fd: + line = line.decode(locale.getpreferredencoding(False), errors='ignore') self.curline += 1 if self.curline > maxlines: break
@@ -249,12 +250,13 @@ if __name__ == '__main__': try: if len(args.path) and args.path[0] == '-': - parser.parse_lines(sys.stdin, args.maxlines, '-') + stdin = os.fdopen(sys.stdin.fileno(), 'rb') + parser.parse_lines(stdin, args.maxlines, '-') else: if args.path: for p in args.path: if os.path.isfile(p): - parser.parse_lines(open(p), args.maxlines, p) + parser.parse_lines(open(p, 'rb'), args.maxlines, p) elif os.path.isdir(p): scan_git_subtree(repo.head.reference.commit.tree, p) else:
Greg Kroah-Hartman
maintainerPATCH 11/44 fs/iomap.c: get/put the page in iomap_page_create/release()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Piotr Jaroszynski <[email protected]>
commit 61c6de667263184125d5ca75e894fcad632b0dd3 upstream.
migrate_page_move_mapping() expects pages with private data set to have a page_count elevated by 1. This is what used to happen for xfs through the buffer_heads code before the switch to iomap in commit 82cb14175e7d ("xfs: add support for sub-pagesize writeback without buffer_heads"). Not having the count elevated causes move_pages() to fail on memory mapped files coming from xfs.
Make iomap compatible with the migrate_page_move_mapping() assumption by elevating the page count as part of iomap_page_create() and lowering it in iomap_page_release().
It causes the move_pages() syscall to misbehave on memory mapped files from xfs. It does not not move any pages, which I suppose is "just" a perf issue, but it also ends up returning a positive number which is out of spec for the syscall. Talking to Michal Hocko, it sounds like returning positive numbers might be a necessary update to move_pages() anyway though
(https://lkml.kernel.org/r/[email protected]).
I only hit this in tests that verify that move_pages() actually moved the pages. The test also got confused by the positive return from move_pages() (it got treated as a success as positive numbers were not expected and not handled) making it a bit harder to track down what's going on.
--- fs/iomap.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/iomap.c +7 -0
@@ -117,6 +117,12 @@ iomap_page_create(struct inode *inode, satomic_set (&iop->read_count,0 );atomic_set (&iop->write_count,0 );bitmap_zero (iop->uptodate,PAGE_SIZE /SECTOR_SIZE ); + +/* +* migrate_page_move_mapping() assumes that pages with private data have +* their count elevated by 1. +*/ +get_page (page);set_page_private (page, (unsigned long )iop);SetPagePrivate (page);return iop;
@@ -133,6 +139,7 @@ iomap_page_release(struct page *page)WARN_ON_ONCE (atomic_read (&iop->write_count));ClearPagePrivate (page);set_page_private (page,0 ); +put_page (page);kfree (iop); }
Greg Kroah-Hartman
maintainerPATCH 12/44 userfaultfd: check VM_MAYWRITE was set after verifying the uffd is registered
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 01e881f5a1fca4677e82733061868c6d6ea05ca7 upstream.
Calling UFFDIO_UNREGISTER on virtual ranges not yet registered in uffd could trigger an harmless false positive WARN_ON. Check the vma is already registered before checking VM_MAYWRITE to shut off the false positive warning.
--- fs/userfaultfd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/userfaultfd.c +2 -1
@@ -1566,7 +1566,6 @@ static int userfaultfd_unregister(structcond_resched ();BUG_ON (!vma_can_userfault (vma)); -WARN_ON (!(vma->vm_flags &VM_MAYWRITE ));/* * Nothing to do: this vma is already registered into this
@@ -1575,6 +1574,8 @@ static int userfaultfd_unregister(structif (!vma->vm_userfaultfd_ctx.ctx) goto skip; +WARN_ON (!(vma->vm_flags &VM_MAYWRITE )); +if (vma->vm_start > start) start = vma->vm_start; vma_end =min (end, vma->vm_end);
Greg Kroah-Hartman
maintainerPATCH 13/44 arm64: dma-mapping: Fix FORCE_CONTIGUOUS buffer clearing
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
commit 3238c359acee4ab57f15abb5a82b8ab38a661ee7 upstream.
We need to invalidate the caches *before* clearing the buffer via the non-cacheable alias, else in the worst case __dma_flush_area() may write back dirty lines over the top of our nice new zeros.
--- arch/arm64/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/dma-mapping.c +1 -1
@@ -587,9 +587,9 @@ static void *__iommu_alloc_attrs(struct prot, __builtin_return_address(0));if (addr) { -memset (addr,0 , size);if (!coherent)__dma_flush_area (page_to_virt (page), iosize); +memset (addr,0 , size); }else {iommu_dma_unmap_page (dev, *handle, iosize,0 , attrs); dma_release_from_contiguous(dev, page,
Greg Kroah-Hartman
maintainerPATCH 14/44 block/bio: Do not zero user pages
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
commit f55adad601c6a97c8c9628195453e0fb23b4a0ae upstream.
We don't need to zero fill the bio if not using kernel allocated pages.
--- block/bio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/bio.c +2 -1
@@ -1262,7 +1262,8 @@ struct bio *bio_copy_user_iov(struct reqif (ret) goto cleanup; }else { -zero_fill_bio (bio); +if (bmd->is_our_pages) +zero_fill_bio (bio);iov_iter_advance (iter, bio->bi_iter.bi_size); }
Greg Kroah-Hartman
maintainerPATCH 15/44 ovl: fix decode of dir file handle with multi lower layers
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit 155b8a0492a90a4c6e22f046a3568b92a6bc48da upstream.
When decoding a lower file handle, we first call ovl_check_origin_fh() with connected=false to get any real lower dentry for overlay inode cache lookup.
If the real dentry is a disconnected dir dentry, ovl_check_origin_fh() is called again with connected=true to get a connected real dentry and find the lower layer the real dentry belongs to.
If the first call returned a connected real dentry, we use it to lookup an overlay connected dentry, but the first ovl_check_origin_fh() call with connected=false did not check that the found dentry is under the root of the layer (see ovl_acceptable()), it only checked that the found dentry super block matches the uuid of the lower file handle.
In case there are multiple lower layers on the same fs and the found dentry is not from the top most lower layer, using the layer index returned from the first ovl_check_origin_fh() is wrong and we end up failing to decode the file handle.
Fix this by always calling ovl_check_origin_fh() with connected=true if we got a directory dentry in the first call.
--- fs/overlayfs/export.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/overlayfs/export.c +3 -3
@@ -754,9 +754,8 @@ static struct dentry *ovl_lower_fh_to_d( goto out; } -/* Otherwise, get a connected non-upper dir or disconnected non-dir */ -if (d_is_dir (origin.dentry) && - (origin.dentry->d_flags &DCACHE_DISCONNECTED )) { +/* Find origin.dentry again with ovl_acceptable() layer check */ +if (d_is_dir (origin.dentry)) {dput (origin.dentry); origin.dentry =NULL ; err =ovl_check_origin_fh (ofs, fh, true,NULL , &stack);
@@ -769,6 +768,7 @@ static struct dentry *ovl_lower_fh_to_d( goto out_err; } +/* Get a connected non-upper dir or disconnected non-dir */ dentry =ovl_get_dentry (sb,NULL , &origin, index); out:
Greg Kroah-Hartman
maintainerPATCH 16/44 ovl: fix missing override creds in link of a metacopy upper
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit 91ff20f34e94424e586f57f4f593beae16504f86 upstream.
Theodore Ts'o reported a v4.19 regression with docker-dropbox:
https://marc.info/?l=linux-fsdevel&m=154070089431116&w=2
"I was rebuilding my dropbox Docker container, and it failed in 4.19
with the following error:
...
dpkg: error: error creating new backup file \
'/var/lib/dpkg/status-old': Invalid cross-device link"
The problem did not reproduce with metacopy feature disabled. The error was caused by insufficient credentials to set "trusted.overlay.redirect" xattr on link of a metacopy file.
Reproducer:
echo Y > /sys/module/overlay/parameters/redirect_dir echo Y > /sys/module/overlay/parameters/metacopy cd /tmp
mkdir l u w m
chmod 777 l u
touch l/foo
ln l/foo l/link
chmod 666 l/foo
mount -t overlay none -olowerdir=l,upperdir=u,workdir=w m su fsgqa
ln m/foo m/bar
[ 21.455823] overlayfs: failed to set redirect (-1)
ln: failed to create hard link 'm/bar' => 'm/foo':\
Invalid cross-device link--- fs/overlayfs/dir.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
fs/overlayfs/dir.c +13 -1
@@ -652,6 +652,18 @@ static int ovl_symlink(struct inode *dirreturn ovl_create_object (dentry,S_IFLNK ,0 , link); } +static int ovl_set_link_redirect (struct dentry *dentry) +{ +const struct cred *old_cred; +int err; + + old_cred =ovl_override_creds (dentry->d_sb); + err =ovl_set_redirect (dentry, false); +revert_creds (old_cred); + +return err; +} +static int ovl_link (struct dentry *old,struct inode *newdir,struct dentry *new) {
@@ -672,7 +684,7 @@ static int ovl_link(struct dentry *old, goto out_drop_write;if (ovl_is_metacopy_dentry (old)) { - err =ovl_set_redirect (old, false); + err =ovl_set_link_redirect (old);if (err) goto out_drop_write; }
Greg Kroah-Hartman
maintainerPATCH 17/44 MMC: OMAP: fix broken MMC on OMAP15XX/OMAP5910/OMAP310
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
commit e8cde625bfe8a714a856e1366bcbb259d7346095 upstream.
Since v2.6.22 or so there has been reports [1] about OMAP MMC being broken on OMAP15XX based hardware (OMAP5910 and OMAP310). The breakage seems to have been caused by commit 46a6730e3ff9 ("mmc-omap: Fix omap to use MMC_POWER_ON") that changed clock enabling to be done on MMC_POWER_ON. This can happen multiple times in a row, and on 15XX the hardware doesn't seem to like it and the MMC just stops responding. Fix by memorizing the power mode and do the init only when necessary.
Before the patch (on Palm TE):
mmc0: new SD card at address b368
mmcblk0: mmc0:b368 SDC 977 MiB
mmci-omap mmci-omap.0: command timeout (CMD18) mmci-omap mmci-omap.0: command timeout (CMD13) mmci-omap mmci-omap.0: command timeout (CMD13) mmci-omap mmci-omap.0: command timeout (CMD12) [x 6] mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
mmcblk0: error -110 requesting status
mmci-omap mmci-omap.0: command timeout (CMD8) mmci-omap mmci-omap.0: command timeout (CMD18) mmci-omap mmci-omap.0: command timeout (CMD13) mmci-omap mmci-omap.0: command timeout (CMD13) mmci-omap mmci-omap.0: command timeout (CMD12) [x 6] mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
mmcblk0: error -110 requesting status
mmcblk0: recovery failed!
print_req_error: I/O error, dev mmcblk0, sector 0 Buffer I/O error on dev mmcblk0, logical block 0, async page read
mmcblk0: unable to read partition table
After the patch:
mmc0: new SD card at address b368 mmcblk0: mmc0:b368 SDC 977 MiB mmcblk0: p1
The patch is based on a fix and analysis done by Ladislav Michl.
Tested on OMAP15XX/OMAP310 (Palm TE), OMAP1710 (Nokia 770) and OMAP2420 (Nokia N810).
[1] https://marc.info/?t=123175197000003&r=1&w=2
--- drivers/mmc/host/omap.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/mmc/host/omap.c +9 -2
@@ -104,6 +104,7 @@ struct mmc_omap_slot {unsigned int vdd;u16 saved_con;u16 bus_mode; +u16 power_mode;unsigned int fclk_freq;struct tasklet_struct cover_tasklet;
@@ -1157,7 +1158,7 @@ static void mmc_omap_set_ios(struct mmc_struct mmc_omap_slot *slot =mmc_priv (mmc);struct mmc_omap_host *host = slot->host;int i, dsor; -int clk_enabled; +int clk_enabled, init_stream;mmc_omap_select_slot (slot,0 );
@@ -1167,6 +1168,7 @@ static void mmc_omap_set_ios(struct mmc_ slot->vdd = ios->vdd; clk_enabled =0 ; + init_stream =0 ;switch (ios->power_mode) {case MMC_POWER_OFF :mmc_omap_set_power (slot,0 , ios->vdd);
@@ -1174,13 +1176,17 @@ static void mmc_omap_set_ios(struct mmc_case MMC_POWER_UP :/* Cannot touch dsor yet, just power up MMC */ mmc_omap_set_power (slot,1 , ios->vdd); + slot->power_mode = ios->power_mode; goto exit;case MMC_POWER_ON :mmc_omap_fclk_enable (host,1 ); clk_enabled =1 ; dsor |=1 <<11 ; +if (slot->power_mode !=MMC_POWER_ON ) + init_stream =1 ;break ; } + slot->power_mode = ios->power_mode;if (slot->bus_mode != ios->bus_mode) {if (slot->pdata->set_bus_mode !=NULL )
@@ -1196,7 +1202,7 @@ static void mmc_omap_set_ios(struct mmc_for (i =0 ; i <2 ; i++)OMAP_MMC_WRITE (host,CON , dsor); slot->saved_con = dsor; -if (ios->power_mode ==MMC_POWER_ON ) { +if (init_stream) {/* worst case at 400kHz, 80 cycles makes 200 microsecs */ int usecs =250 ;
@@ -1234,6 +1240,7 @@ static int mmc_omap_new_slot(struct mmc_ slot->host = host; slot->mmc = mmc; slot->id = id; + slot->power_mode =MMC_POWER_UNDEFINED ; slot->pdata = &host->pdata->slots[id]; host->slots[id] = slot;
Greg Kroah-Hartman
maintainerPATCH 18/44 mmc: core: use mrq->sbc when sending CMD23 for RPMB
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit a44f7cb937321d4961bfc8f28912126b06e701c5 upstream.
When sending out CMD23 in the blk preparation, the comment there rightfully says:
* However, it is not sufficient to just send CMD23,
* and avoid the final CMD12, as on an error condition
* CMD12 (stop) needs to be sent anyway. This, coupled
* with Auto-CMD23 enhancements provided by some
* hosts, means that the complexity of dealing
* with this is best left to the host. If CMD23 is
* supported by card and host, we'll fill sbc in and let
* the host deal with handling it correctly.
Let's do this behaviour for RPMB as well, and not send CMD23 independently. Otherwise IP cores (like Renesas SDHI) may timeout because of automatic CMD23/CMD12 handling.
--- drivers/mmc/core/block.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/mmc/core/block.c +10 -5
@@ -472,7 +472,7 @@ out:static int __mmc_blk_ioctl_cmd (struct mmc_card *card,struct mmc_blk_data *md,struct mmc_blk_ioc_data *idata) { -struct mmc_command cmd = {}; +struct mmc_command cmd = {}, sbc = {};struct mmc_data data = {};struct mmc_request mrq = {};struct scatterlist sg;
@@ -550,10 +550,15 @@ static int __mmc_blk_ioctl_cmd(struct mm }if (idata->rpmb) { - err =mmc_set_blockcount (card, data.blocks, - idata->ic.write_flag & (1 <<31 )); -if (err) -return err; + sbc.opcode =MMC_SET_BLOCK_COUNT ; +/* +* We don't do any blockcount validation because the max size +* may be increased by a future standard. We just copy the +* 'Reliable Write' bit here. +*/ + sbc.arg = data.blocks | (idata->ic.write_flag &BIT (31 )); + sbc.flags =MMC_RSP_R1 |MMC_CMD_AC ; + mrq.sbc = &sbc; } if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) &&
Greg Kroah-Hartman
maintainerPATCH 19/44 mmc: sdhci-omap: Fix DCRC error handling during tuning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Faiz Abbas <[email protected]>
commit db2039fcfd5754d15986340152e4503737f68f8d upstream.
Commit 7d33c3581536 ("mmc: sdhci-omap: Workaround for Errata i802") disabled DCRC interrupts during tuning. This write to the interrupt enable register gets overwritten in sdhci_prepare_data() and the interrupt is not in fact disabled. Fix this by disabling the interrupt in the host->ier variable.
--- drivers/mmc/host/sdhci-omap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci-omap.c +8 -4
@@ -288,9 +288,9 @@ static int sdhci_omap_execute_tuning(strstruct device *dev = omap_host->dev;struct mmc_ios *ios = &mmc->ios;u32 start_window =0 , max_window =0 ; +bool dcrc_was_enabled = false;u8 cur_match, prev_match =0 ;u32 length =0 , max_len =0 ; -u32 ier = host->ier;u32 phase_delay =0 ;int ret =0 ;u32 reg;
@@ -317,9 +317,10 @@ static int sdhci_omap_execute_tuning(str* during the tuning procedure. So disable it during the * tuning procedure. */ - ier &= ~SDHCI_INT_DATA_CRC ; -sdhci_writel (host, ier,SDHCI_INT_ENABLE ); -sdhci_writel (host, ier,SDHCI_SIGNAL_ENABLE ); +if (host->ier &SDHCI_INT_DATA_CRC ) { + host->ier &= ~SDHCI_INT_DATA_CRC ; + dcrc_was_enabled = true; + }while (phase_delay <=MAX_PHASE_DELAY ) {sdhci_omap_set_dll (omap_host, phase_delay);
@@ -366,6 +367,9 @@ tuning_error: ret:sdhci_reset (host,SDHCI_RESET_CMD |SDHCI_RESET_DATA ); +/* Reenable forbidden interrupt */ +if (dcrc_was_enabled) + host->ier |=SDHCI_INT_DATA_CRC ;sdhci_writel (host, host->ier,SDHCI_INT_ENABLE );sdhci_writel (host, host->ier,SDHCI_SIGNAL_ENABLE );return ret;
Greg Kroah-Hartman
maintainerPATCH 20/44 mmc: sdhci: fix the timeout check window for clock and reset
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alek Du <[email protected]>
commit b704441e38f645dcfba1348ca3cc1ba43d1a9f31 upstream.
We observed some premature timeouts on a virtualization platform, the log is like this:
case 1:
[159525.255629] mmc1: Internal clock never stabilised. [159525.255818] mmc1: sdhci: ============ SDHCI REGISTER DUMP =========== [159525.256049] mmc1: sdhci: Sys addr: 0x00000000 | Version: 0x00001002 ... [159525.257205] mmc1: sdhci: Wake-up: 0x00000000 | Clock: 0x0000fa03
Quoted 1 line
Quoted 1 line
From the clock control register dump, we are pretty sure the clock was
stablized.
case 2:
[ 914.550127] mmc1: Reset 0x2 never completed. [ 914.550321] mmc1: sdhci: ============ SDHCI REGISTER DUMP =========== [ 914.550608] mmc1: sdhci: Sys addr: 0x00000010 | Version: 0x00001002
After checking the sdhci code, we found the timeout check actually has a little window that the CPU can be scheduled out and when it comes back, the original time set or check is not valid.
--- drivers/mmc/host/sdhci.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci.c +13 -5
@@ -193,8 +193,12 @@ void sdhci_reset(struct sdhci_host *host timeout =ktime_add_ms (ktime_get (),100 );/* hw clears the bit when it's done */ -while (sdhci_readb (host,SDHCI_SOFTWARE_RESET ) & mask) { -if (ktime_after (ktime_get (), timeout)) { +while (1 ) { +bool timedout =ktime_after (ktime_get (), timeout); + +if (!(sdhci_readb (host,SDHCI_SOFTWARE_RESET ) & mask)) +break ; +if (timedout) {pr_err ("%s: Reset 0x%x never completed.\n" ,mmc_hostname (host->mmc), (int )mask);sdhci_dumpregs (host);
@@ -1495,9 +1499,13 @@ void sdhci_enable_clk(struct sdhci_host/* Wait max 20 ms */ timeout =ktime_add_ms (ktime_get (),20 ); -while (!((clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL )) - &SDHCI_CLOCK_INT_STABLE )) { -if (ktime_after (ktime_get (), timeout)) { +while (1 ) { +bool timedout =ktime_after (ktime_get (), timeout); + + clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); +if (clk &SDHCI_CLOCK_INT_STABLE ) +break ; +if (timedout) {pr_err ("%s: Internal clock never stabilised.\n" ,mmc_hostname (host->mmc));sdhci_dumpregs (host);
Greg Kroah-Hartman
maintainerPATCH 21/44 fuse: continue to send FUSE_RELEASEDIR when FUSE_OPEN returns ENOSYS
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chad Austin <[email protected]>
commit 2e64ff154ce6ce9a8dc0f9556463916efa6ff460 upstream.
When FUSE_OPEN returns ENOSYS, the no_open bit is set on the connection.
Because the FUSE_RELEASE and FUSE_RELEASEDIR paths share code, this incorrectly caused the FUSE_RELEASEDIR request to be dropped and never sent to userspace.
Pass an isdir bool to distinguish between FUSE_RELEASE and FUSE_RELEASEDIR inside of fuse_file_put.
--- fs/fuse/dir.c | 2 +- fs/fuse/file.c | 21 +++++++++++---------- fs/fuse/fuse_i.h | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-)
fs/fuse/dir.c +1 -1
@@ -1439,7 +1439,7 @@ static int fuse_dir_open(struct inode *istatic int fuse_dir_release (struct inode *inode,struct file *file) { -fuse_release_common (file,FUSE_RELEASEDIR ); +fuse_release_common (file, true);return 0 ; }
fs/fuse/file.c +11 -10
@@ -87,12 +87,12 @@ static void fuse_release_end(struct fuseiput (req->misc.release.inode); } -static void fuse_file_put (struct fuse_file *ff,bool sync) +static void fuse_file_put (struct fuse_file *ff,bool sync,bool isdir) {if (refcount_dec_and_test (&ff->count)) {struct fuse_req *req = ff->reserved_req; -if (ff->fc->no_open) { +if (ff->fc->no_open && !isdir) {/* * Drop the release request when client does not * implement 'open'
@@ -245,10 +245,11 @@ static void fuse_prepare_release(struct req->in.args[0 ].value = inarg; } -void fuse_release_common (struct file *file,int opcode) +void fuse_release_common (struct file *file,bool isdir) {struct fuse_file *ff = file->private_data;struct fuse_req *req = ff->reserved_req; +int opcode = isdir ?FUSE_RELEASEDIR :FUSE_RELEASE ;fuse_prepare_release (ff, file->f_flags, opcode);
@@ -270,7 +271,7 @@ void fuse_release_common(struct file *fi* synchronous RELEASE is allowed (and desirable) in this case * because the server can be trusted not to screw up. */ -fuse_file_put (ff, ff->fc->destroy_req !=NULL ); +fuse_file_put (ff, ff->fc->destroy_req !=NULL , isdir); }static int fuse_open (struct inode *inode,struct file *file)
@@ -286,7 +287,7 @@ static int fuse_release(struct inode *inif (fc->writeback_cache)write_inode_now (inode,1 ); -fuse_release_common (file,FUSE_RELEASE ); +fuse_release_common (file, false);/* return value is ignored by VFS */ return 0 ;
@@ -300,7 +301,7 @@ void fuse_sync_release(struct fuse_file* iput(NULL) is a no-op and since the refcount is 1 and everything's * synchronous, we are fine with not doing igrab() here" */ -fuse_file_put (ff, true); +fuse_file_put (ff, true, false); }EXPORT_SYMBOL_GPL (fuse_sync_release);
@@ -805,7 +806,7 @@ static void fuse_readpages_end(struct fuput_page (page); }if (req->ff) -fuse_file_put (req->ff, false); +fuse_file_put (req->ff, false, false); }static void fuse_send_readpages (struct fuse_req *req,struct file *file)
@@ -1459,7 +1460,7 @@ static void fuse_writepage_free(struct f__free_page (req->pages[i]);if (req->ff) -fuse_file_put (req->ff, false); +fuse_file_put (req->ff, false, false); }static void fuse_writepage_finish (struct fuse_conn *fc,struct fuse_req *req)
@@ -1616,7 +1617,7 @@ int fuse_write_inode(struct inode *inode ff =__fuse_write_file_get (fc, fi); err =fuse_flush_times (inode, ff);if (ff) -fuse_file_put (ff,0 ); +fuse_file_put (ff, false, false);return err; }
@@ -1930,7 +1931,7 @@ static int fuse_writepages(struct addres err =0 ; }if (data.ff) -fuse_file_put (data.ff, false); +fuse_file_put (data.ff, false, false);kfree (data.orig_pages); out:
fs/fuse/fuse_i.h +1 -1
@@ -749,7 +749,7 @@ void fuse_sync_release(struct fuse_file/** * Send RELEASE or RELEASEDIR request */ -void fuse_release_common (struct file *file,int opcode); +void fuse_release_common (struct file *file,bool isdir);/** * Send FSYNC or FSYNCDIR request
Greg Kroah-Hartman
maintainerPATCH 22/44 ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lubomir Rintel <[email protected]>
commit 76f4e2c3b6a560cdd7a75b87df543e04d05a9e5f upstream.
cpu_is_mmp2() was equivalent to cpu_is_pj4(), wouldn't be correct for multiplatform kernels. Fix it by also considering mmp_chip_id, as is done for cpu_is_pxa168() and cpu_is_pxa910() above.
Moreover, it is only available with CONFIG_CPU_MMP2 and thus doesn't work on DT-based MMP2 machines. Enable it on CONFIG_MACH_MMP2_DT too.
Note: CONFIG_CPU_MMP2 is only used for machines that use board files instead of DT. It should perhaps be renamed. I'm not doing it now, because I don't have a better idea.
--- arch/arm/mach-mmp/cputype.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-mmp/cputype.h +4 -2
@@ -44,10 +44,12 @@ static inline int cpu_is_pxa910(void)#define cpu_is_pxa910 () (0)#endif -#ifdef CONFIG_CPU_MMP2 +#if defined(CONFIG_CPU_MMP2 ) || defined(CONFIG_MACH_MMP2_DT )static inline int cpu_is_mmp2 (void ) { -return (((read_cpuid_id () >>8 ) &0xff ) ==0x58 ); +return (((read_cpuid_id () >>8 ) &0xff ) ==0x58 ) && + (((mmp_chip_id &0xfff ) ==0x410 ) || + ((mmp_chip_id &0xfff ) ==0x610 )); }#else #define cpu_is_mmp2 () (0)
Greg Kroah-Hartman
maintainerPATCH 23/44 ARM: dts: bcm2837: Fix polarity of wifi reset GPIOs
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
commit e25b6783c7b1bb79103d4617336879423f86b05e upstream.
The commit b1b8f45b3130 ("ARM: dts: bcm2837: Add missing GPIOs of Expander") introduced a wifi power sequence. Unfortunately the polarity of the reset GPIOs were wrong and broke the wifi support on Raspberry Pi 3 B and later in 3 B+. This wasn't discovered before since the power sequence takes only effect in case the relevant MMC driver is compiled as a module.
--- arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 2 +- arch/arm/boot/dts/bcm2837-rpi-3-b.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts +1 -1
@@ -31,7 +31,7 @@ wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; - reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>; + reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>; }; };
arch/arm/boot/dts/bcm2837-rpi-3-b.dts +1 -1
@@ -26,7 +26,7 @@ wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; - reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>; + reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>; }; };
Greg Kroah-Hartman
maintainerPATCH 24/44 dm thin: send event about thin-pool state change _after_ making it
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit f6c367585d0d851349d3a9e607c43e5bea993fa1 upstream.
Sending a DM event before a thin-pool state change is about to happen is a bug. It wasn't realized until it became clear that userspace response to the event raced with the actual state change that the event was meant to notify about.
Fix this by first updating internal thin-pool state to reflect what the DM event is being issued about. This fixes a long-standing racey/buggy userspace device-mapper-test-suite 'resize_io' test that would get an event but not find the state it was looking for -- so it would just go on to hang because no other events caused the test to reevaluate the thin-pool's state.
--- drivers/md/dm-thin.c | 68 ++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 33 deletions(-)
drivers/md/dm-thin.c +35 -33
@@ -195,7 +195,7 @@ static void throttle_unlock(struct throtstruct dm_thin_new_mapping ;/* -* The pool runs in 4 modes. Ordered in degraded order for comparisons. +* The pool runs in various modes. Ordered in degraded order for comparisons. */ enum pool_mode {PM_WRITE ,/* metadata may be changed */
@@ -282,9 +282,38 @@ struct pool {mempool_t mapping_pool; }; -static enum pool_mode get_pool_mode (struct pool *pool);static void metadata_operation_failed (struct pool *pool,const char *op,int r); +static enum pool_mode get_pool_mode (struct pool *pool) +{ +return pool->pf.mode; +} + +static void notify_of_pool_mode_change (struct pool *pool) +{ +const char *descs[] = { +"write" , +"out-of-data-space" , +"read-only" , +"read-only" , +"fail" + }; +const char *extra_desc =NULL ; +enum pool_mode mode =get_pool_mode (pool); + +if (mode ==PM_OUT_OF_DATA_SPACE ) { +if (!pool->pf.error_if_no_space) + extra_desc =" (queue IO)" ; +else + extra_desc =" (error IO)" ; + } + +dm_table_event (pool->ti->table); +DMINFO ("%s: switching pool to %s%s mode" , +dm_device_name (pool->pool_md), + descs[(int )mode], extra_desc ? :"" ); +} +/* * Target context for a pool. */
@@ -2351,8 +2380,6 @@ static void do_waker(struct work_structqueue_delayed_work (pool->wq, &pool->waker,COMMIT_PERIOD ); } -static void notify_of_pool_mode_change_to_oods (struct pool *pool); -/* * We're holding onto IO to allow userland time to react. After the * timeout either the pool will have been resized (and thus back in
@@ -2365,7 +2392,7 @@ static void do_no_space_timeout(struct wif (get_pool_mode (pool) ==PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) { pool->pf.error_if_no_space = true; -notify_of_pool_mode_change_to_oods (pool); +notify_of_pool_mode_change (pool);error_retry_list_with_code (pool,BLK_STS_NOSPC ); } }
@@ -2433,26 +2460,6 @@ static void noflush_work(struct thin_c */*----------------------------------------------------------------*/ -static enum pool_mode get_pool_mode (struct pool *pool) -{ -return pool->pf.mode; -} - -static void notify_of_pool_mode_change (struct pool *pool,const char *new_mode) -{ -dm_table_event (pool->ti->table); -DMINFO ("%s: switching pool to %s mode" , -dm_device_name (pool->pool_md), new_mode); -} - -static void notify_of_pool_mode_change_to_oods (struct pool *pool) -{ -if (!pool->pf.error_if_no_space) -notify_of_pool_mode_change (pool,"out-of-data-space (queue IO)" ); -else -notify_of_pool_mode_change (pool,"out-of-data-space (error IO)" ); -} -static bool passdown_enabled (struct pool_c *pt) {return pt->adjusted_pf.discard_passdown;
@@ -2501,8 +2508,6 @@ static void set_pool_mode(struct pool *pswitch (new_mode) {case PM_FAIL : -if (old_mode != new_mode) -notify_of_pool_mode_change (pool,"failure" );dm_pool_metadata_read_only (pool->pmd); pool->process_bio = process_bio_fail; pool->process_discard = process_bio_fail;
@@ -2516,8 +2521,6 @@ static void set_pool_mode(struct pool *pcase PM_OUT_OF_METADATA_SPACE :case PM_READ_ONLY : -if (!is_read_only_pool_mode (old_mode)) -notify_of_pool_mode_change (pool,"read-only" );dm_pool_metadata_read_only (pool->pmd); pool->process_bio = process_bio_read_only; pool->process_discard = process_bio_success;
@@ -2538,8 +2541,6 @@ static void set_pool_mode(struct pool *p* alarming rate. Adjust your low water mark if you're * frequently seeing this mode. */ -if (old_mode != new_mode) -notify_of_pool_mode_change_to_oods (pool); pool->out_of_data_space = true; pool->process_bio = process_bio_read_only; pool->process_discard = process_discard_bio;
@@ -2552,8 +2553,6 @@ static void set_pool_mode(struct pool *pbreak ;case PM_WRITE : -if (old_mode != new_mode) -notify_of_pool_mode_change (pool,"write" );if (old_mode ==PM_OUT_OF_DATA_SPACE )cancel_delayed_work_sync (&pool->no_space_timeout); pool->out_of_data_space = false;
@@ -2573,6 +2572,9 @@ static void set_pool_mode(struct pool *p* doesn't cause an unexpected mode transition on resume. */ pt->adjusted_pf.mode = new_mode; + +if (old_mode != new_mode) +notify_of_pool_mode_change (pool); }static void abort_transaction (struct pool *pool)
Greg Kroah-Hartman
maintainerPATCH 25/44 dm cache metadata: verify cache has blocks in blocks_are_clean_separate_dirty()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 687cf4412a343a63928a5c9d91bdc0f522939d43 upstream.
Otherwise dm_bitset_cursor_begin() return -ENODATA. Other calls to dm_bitset_cursor_begin() have similar negative checks.
Fixes inability to create a cache in passthrough mode (even though doing so makes no sense).
--- drivers/md/dm-cache-metadata.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/dm-cache-metadata.c +4 -0
@@ -930,6 +930,10 @@ static int blocks_are_clean_separate_dirbool dirty_flag; *result = true; +if (from_cblock (cmd->cache_blocks) ==0 ) +/* Nothing to do */ +return 0 ; + r =dm_bitset_cursor_begin (&cmd->dirty_info, cmd->dirty_root,from_cblock (cmd->cache_blocks), &cmd->dirty_cursor);if (r) {
Greg Kroah-Hartman
maintainerPATCH 26/44 dm: call blk_queue_split() to impose device limits on bios
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 89f5fa47476eda56402e29fff3c5097f5c2a1e19 upstream.
Otherwise the incoming bios, of various types, won't be shaped based on the DM device's advertised limits.
Depends-on: af67c31fba ("blk: remove bio_set arg from blk_queue_split()")
--- drivers/md/dm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/dm.c +2 -0
@@ -1592,6 +1592,8 @@ static blk_qc_t __split_and_process_bio(return ret; } +blk_queue_split (md->queue, &bio); +init_clone_info (&ci, md, map, bio);if (bio->bi_opf &REQ_PREFLUSH ) {
Greg Kroah-Hartman
maintainerPATCH 27/44 tracing: Fix memory leak in create_filter()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (VMware) <[email protected]>
commit b61c19209c2c35ea2a2fe502d484703686eba98c upstream.
The create_filter() calls create_filter_start() which allocates a "parse_error" descriptor, but fails to call create_filter_finish() that frees it.
The op_stack and inverts in predicate_parse() were also not freed.
Found by kmemleak detector.
--- kernel/trace/trace_events_filter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/trace/trace_events_filter.c +4 -1
@@ -570,11 +570,13 @@ predicate_parse(const char *str, int nr_ } } +kfree (op_stack); +kfree (inverts);return prog; out_free:kfree (op_stack); -kfree (prog_stack);kfree (inverts); +kfree (prog_stack);return ERR_PTR (ret); }
@@ -1718,6 +1720,7 @@ static int create_filter(struct trace_ev err =process_preds (call, filter_string, *filterp, pe);if (err && set_str)append_filter_err (pe, *filterp); +create_filter_finish (pe);return err; }
Greg Kroah-Hartman
maintainerPATCH 28/44 tracing: Fix memory leak in set_trigger_filter()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (VMware) <[email protected]>
commit 3cec638b3d793b7cacdec5b8072364b41caeb0e1 upstream.
When create_event_filter() fails in set_trigger_filter(), the filter may still be allocated and needs to be freed. The caller expects the data->filter to be updated with the new filter, even if the new filter failed (we could add an error message by setting set_str parameter of create_event_filter(), but that's another update).
But because the error would just exit, filter was left hanging and nothing could free it.
Found by kmemleak detector.
--- kernel/trace/trace_events_trigger.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace_events_trigger.c +4 -2
@@ -732,8 +732,10 @@ int set_trigger_filter(char *filter_str,/* The filter is for the 'trigger' event, not the triggered event */ ret =create_event_filter (file->event_call, filter_str, false, &filter); -if (ret) - goto out; +/* +* If create_event_filter() fails, filter still needs to be freed. +* Which the calling code will do with data->filter. +*/ assign: tmp =rcu_access_pointer (data->filter);
Greg Kroah-Hartman
maintainerPATCH 29/44 tracing: Fix memory leak of instance function hash filters
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (VMware) <[email protected]>
commit 2840f84f74035e5a535959d5f17269c69fa6edc5 upstream.
The following commands will cause a memory leak:
# cd /sys/kernel/tracing # mkdir instances/foo # echo schedule > instance/foo/set_ftrace_filter # rmdir instances/foo
The reason is that the hashes that hold the filters to set_ftrace_filter and set_ftrace_notrace are not freed if they contain any data on the instance and the instance is removed.
Found by kmemleak detector.
--- kernel/trace/ftrace.c | 1 + 1 file changed, 1 insertion(+)
kernel/trace/ftrace.c +1 -0
@@ -5460,6 +5460,7 @@ void ftrace_destroy_filter_files(structif (ops->flags &FTRACE_OPS_FL_ENABLED )ftrace_shutdown (ops,0 ); ops->flags |=FTRACE_OPS_FL_DELETED ; +ftrace_free_filter (ops);mutex_unlock (&ftrace_lock); }
Greg Kroah-Hartman
maintainerPATCH 30/44 media: vb2: dont call __vb2_queue_cancel if vb2_start_streaming failed
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 04990215dec43c424daff00d1f622167b8aafd1f upstream.
vb2_start_streaming() already rolls back the buffers, so there is no need to call __vb2_queue_cancel(). Especially since __vb2_queue_cancel() does too much, such as zeroing the q->queued_count value, causing vb2 to think that no buffers have been queued.
It appears that this call to __vb2_queue_cancel() is a left-over from before commit b3379c6201bb3.
--- drivers/media/common/videobuf2/videobuf2-core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/common/videobuf2/videobuf2-core.c +1 -3
@@ -1755,10 +1755,8 @@ int vb2_core_streamon(struct vb2_queue *if (ret)return ret; ret =vb2_start_streaming (q); -if (ret) { -__vb2_queue_cancel (q); +if (ret)return ret; - } } q->streaming =1 ;
Greg Kroah-Hartman
maintainerPATCH 31/44 powerpc/msi: Fix NULL pointer access in teardown code
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Rendec <[email protected]>
commit 78e7b15e17ac175e7eed9e21c6f92d03d3b0a6fa upstream.
The arch_teardown_msi_irqs() function assumes that controller ops pointers were already checked in arch_setup_msi_irqs(), but this assumption is wrong: arch_teardown_msi_irqs() can be called even when arch_setup_msi_irqs() returns an error (-ENOSYS).
This can happen in the following scenario:
- msi_capability_init() calls pci_msi_setup_msi_irqs()
- pci_msi_setup_msi_irqs() returns -ENOSYS
- msi_capability_init() notices the error and calls free_msi_irqs()
- free_msi_irqs() calls pci_msi_teardown_msi_irqs()
This is easier to see when CONFIG_PCI_MSI_IRQ_DOMAIN is not set and pci_msi_setup_msi_irqs() and pci_msi_teardown_msi_irqs() are just aliases to arch_setup_msi_irqs() and arch_teardown_msi_irqs().
The call to free_msi_irqs() upon pci_msi_setup_msi_irqs() failure seems legit, as it does additional cleanup; e.g. list_del(&entry->list) and kfree(entry) inside free_msi_irqs() do happen (MSI descriptors are allocated before pci_msi_setup_msi_irqs() is called and need to be cleaned up if that fails).
--- arch/powerpc/kernel/msi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/kernel/msi.c +6 -1
@@ -34,5 +34,10 @@ void arch_teardown_msi_irqs(struct pci_d {struct pci_controller *phb =pci_bus_to_host (dev->bus); - phb->controller_ops.teardown_msi_irqs (dev); +/* +* We can be called even when arch_setup_msi_irqs() returns -ENOSYS, +* so check the pointer again. +*/ +if (phb->controller_ops.teardown_msi_irqs) + phb->controller_ops.teardown_msi_irqs (dev); }
Greg Kroah-Hartman
maintainerPATCH 32/44 powerpc: Look for "stdout-path" when setting up legacy consoles
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit bf3d6afbb234156749b640b6c50f714967a85964 upstream.
Commit 78e5dfea84dc ("powerpc: dts: replace 'linux,stdout-path' with 'stdout-path'") broke the default console on a number of embedded PowerPC systems, because it failed to also update the code in arch/powerpc/kernel/legacy_serial.c to look for that property in addition to the old one.
This fixes it.
--- arch/powerpc/kernel/legacy_serial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/kernel/legacy_serial.c +5 -1
@@ -372,6 +372,8 @@ void __init find_legacy_serial_ports(voi/* Now find out if one of these is out firmware console */ path =of_get_property (of_chosen,"linux,stdout-path" ,NULL ); +if (path ==NULL ) + path =of_get_property (of_chosen,"stdout-path" ,NULL );if (path !=NULL ) { stdout =of_find_node_by_path (path);if (stdout)
@@ -595,8 +597,10 @@ static int __init check_legacy_serial_co/* We are getting a weird phandle from OF ... */ /* ... So use the full path instead */ name =of_get_property (of_chosen,"linux,stdout-path" ,NULL ); +if (name ==NULL ) + name =of_get_property (of_chosen,"stdout-path" ,NULL );if (name ==NULL ) { -DBG (" no linux,stdout-path !\n" ); +DBG (" no stdout-path !\n" );return -ENODEV ; } prom_stdout =of_find_node_by_path (name);
Greg Kroah-Hartman
maintainerPATCH 33/44 drm/nouveau/kms: Fix memory leak in nv50_mstm_del()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lyude Paul <[email protected]>
commit 24199c5436f267399afed0c4f1f57663c0408f57 upstream.
Noticed this while working on redoing the reference counting scheme in the DP MST helpers. Nouveau doesn't attempt to call drm_dp_mst_topology_mgr_destroy() at all, which leaves it leaking all of the resources for drm_dp_mst_topology_mgr and it's children mstbs+ports.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/dispnv50/disp.c +1 -0
@@ -1226,6 +1226,7 @@ nv50_mstm_del(struct nv50_mstm **pmstm) {struct nv50_mstm *mstm = *pmstm;if (mstm) { +drm_dp_mst_topology_mgr_destroy (&mstm->mgr);kfree (*pmstm); *pmstm =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 34/44 drm/nouveau/kms/nv50-: also flush fb writes when rewinding push buffer
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Skeggs <[email protected]>
commit 970a5ee41c72df46e3b0f307528c7d8ef7734a2e upstream.
Should hopefully fix a regression some people have been seeing since EVO push buffers were moved to VRAM by default on Pascal GPUs.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +18 -11
@@ -197,6 +197,22 @@ nv50_dmac_create(struct nvif_device *dev/****************************************************************************** * EVO channel helpers *****************************************************************************/ +static void +evo_flush (struct nv50_dmac *dmac) +{ +/* Push buffer fetches are not coherent with BAR1, we need to ensure +* writes have been flushed right through to VRAM before writing PUT. +*/ +if (dmac->push.type &NVIF_MEM_VRAM ) { +struct nvif_device *device = dmac->base.device; +nvif_wr32 (&device->object,0x070000 ,0x00000001 ); +nvif_msec (device,2000 , + if (!(nvif_rd32(&device->object, 0x070000) & 0x00000002)) + break; + ); + } +} +u32 *evo_wait (struct nv50_dmac *evoc,int nr) {
@@ -207,6 +223,7 @@ evo_wait(struct nv50_dmac *evoc, int nr)mutex_lock (&dmac->lock);if (put + nr >= (PAGE_SIZE /4 ) -8 ) { dmac->ptr[put] =0x20000000 ; +evo_flush (dmac);nvif_wr32 (&dmac->base.user,0x0000 ,0x00000000 ); if (nvif_msec(device, 2000,
@@ -229,17 +246,7 @@ evo_kick(u32 *push, struct nv50_dmac *ev {struct nv50_dmac *dmac = evoc; -/* Push buffer fetches are not coherent with BAR1, we need to ensure -* writes have been flushed right through to VRAM before writing PUT. -*/ -if (dmac->push.type &NVIF_MEM_VRAM ) { -struct nvif_device *device = dmac->base.device; -nvif_wr32 (&device->object,0x070000 ,0x00000001 ); -nvif_msec (device,2000 , - if (!(nvif_rd32(&device->object, 0x070000) & 0x00000002)) - break; - ); - } +evo_flush (dmac);nvif_wr32 (&dmac->base.user,0x0000 , (push - dmac->ptr) <<2 );mutex_unlock (&dmac->lock);
Greg Kroah-Hartman
maintainerPATCH 35/44 Revert "drm/rockchip: Allow driver to be shutdown on reboot/kexec"
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit 63238173b2faf3d6b85a416f1c69af6c7be2413f upstream.
This reverts commit 7f3ef5dedb146e3d5063b6845781ad1bb59b92b5.
It causes new warnings [1] on shutdown when running the Google Kevin or Scarlet (RK3399) boards under Chrome OS. Presumably our usage of DRM is different than what Marc and Heiko test.
We're looking at a different approach (e.g., [2]) to replace this, but IMO the revert should be taken first, as it already propagated to -stable.
[1] Report here:
http://lkml.kernel.org/lkml/[email protected]
WARNING: CPU: 4 PID: 2035 at drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x1c4/0x294 ... Call trace: drm_mode_config_cleanup+0x1c4/0x294 rockchip_drm_unbind+0x4c/0x8c component_master_del+0x88/0xb8 rockchip_drm_platform_remove+0x2c/0x44 rockchip_drm_platform_shutdown+0x20/0x2c platform_drv_shutdown+0x2c/0x38 device_shutdown+0x164/0x1b8 kernel_restart_prepare+0x40/0x48 kernel_restart+0x20/0x68 ... Memory manager not clean during takedown. WARNING: CPU: 4 PID: 2035 at drivers/gpu/drm/drm_mm.c:950 drm_mm_takedown+0x34/0x44 ... drm_mm_takedown+0x34/0x44 rockchip_drm_unbind+0x64/0x8c component_master_del+0x88/0xb8 rockchip_drm_platform_remove+0x2c/0x44 rockchip_drm_platform_shutdown+0x20/0x2c platform_drv_shutdown+0x2c/0x38 device_shutdown+0x164/0x1b8 kernel_restart_prepare+0x40/0x48 kernel_restart+0x20/0x68
...
[2] https://patchwork.kernel.org/patch/10556151/
https://www.spinics.net/lists/linux-rockchip/msg21342.html
[PATCH] drm/rockchip: shutdown drm subsystem on shutdown
--- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -6
@@ -442,11 +442,6 @@ static int rockchip_drm_platform_remove(return 0 ; } -static void rockchip_drm_platform_shutdown (struct platform_device *pdev) -{ -rockchip_drm_platform_remove (pdev); -} -static const struct of_device_id rockchip_drm_dt_ids[] = { { .compatible ="rockchip,display-subsystem" , }, {/* sentinel */ },
@@ -456,7 +451,6 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_static struct platform_driver rockchip_drm_platform_driver = { .probe = rockchip_drm_platform_probe, .remove = rockchip_drm_platform_remove, - .shutdown = rockchip_drm_platform_shutdown, .driver = { .name ="rockchip-drm" , .of_match_table = rockchip_drm_dt_ids,
Greg Kroah-Hartman
maintainerPATCH 36/44 drm/i915/gvt: Fix tiled memory decoding bug on BDW
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tina Zhang <[email protected]>
commit a40fa231bb64b33e2cd54cf8ef44a9f89875fa11 upstream.
Commit b244ffa15c8b ("drm/i915/gvt: Fix drm_format_mod value for vGPU plane") introduced a regression issue to the tiled memory decoding on BDW.
This patch can fix this issue.
Here is the issue detail: https://github.com/intel/gvt-linux/issues/61
v1->v2:
- Refine the commit message. (Zhenyu)
--- drivers/gpu/drm/i915/gvt/fb_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/fb_decoder.c +1 -1
@@ -235,7 +235,7 @@ int intel_vgpu_decode_primary_plane(stru plane->bpp = skl_pixel_formats[fmt].bpp; plane->drm_format = skl_pixel_formats[fmt].drm_format; }else { - plane->tiled = !!(val &DISPPLANE_TILED ); + plane->tiled = val &DISPPLANE_TILED ; fmt =bdw_format_to_drm (val &DISPPLANE_PIXFORMAT_MASK ); plane->bpp = bdw_pixel_formats[fmt].bpp; plane->drm_format = bdw_pixel_formats[fmt].drm_format;
Greg Kroah-Hartman
maintainerPATCH 37/44 drm/i915/execlists: Apply a full mb before execution for Braswell
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit cf66b8a0ba142fbd1bf10ac8f3ae92d1b0cb7b8f upstream.
Braswell is really picky about having our writes posted to memory before we execute or else the GPU may see stale values. A wmb() is insufficient as it only ensures the writes are visible to other cores, we need a full mb() to ensure the writes are in memory and visible to the GPU.
The most frequent failure in flushing before execution is that we see stale PTE values and execute the wrong pages.
References: 987abd5c62f9 ("drm/i915/execlists: Force write serialisation into context image vs execution")
--- drivers/gpu/drm/i915/intel_lrc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +6 -1
@@ -442,8 +442,13 @@ static u64 execlists_update_context(stru* may not be visible to the HW prior to the completion of the UC * register write and that we may begin execution from the context * before its image is complete leading to invalid PD chasing. +* +* Furthermore, Braswell, at least, wants a full mb to be sure that +* the writes are coherent in memory (visible to the GPU) prior to +* execution, and not just visible to other CPUs (as is the result of +* wmb). */ -wmb (); +mb ();return ce->lrc_desc; }
Greg Kroah-Hartman
maintainerPATCH 38/44 drm/amdgpu/powerplay: Apply avfs cks-off voltages on VI
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kenneth Feng <[email protected]>
commit cf4197ed5796234a53beb71228198c7d1e678947 upstream.
Instead of EVV cks-off voltages, avfs cks-off voltages can avoid the overshoot voltages when switching sclk.
--- drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h | 2 ++ drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 6 ++++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h +2 -0
@@ -386,6 +386,8 @@ typedef uint16_t PPSMC_Result;#define PPSMC_MSG_AgmResetPsm ((uint16_t) 0x403)#define PPSMC_MSG_ReadVftCell ((uint16_t) 0x404) +#define PPSMC_MSG_ApplyAvfsCksOffVoltage ((uint16_t) 0x415) +#define PPSMC_MSG_GFX_CU_PG_ENABLE ((uint16_t) 0x280)#define PPSMC_MSG_GFX_CU_PG_DISABLE ((uint16_t) 0x281)#define PPSMC_MSG_GetCurrPkgPwr ((uint16_t) 0x282)
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +6 -0
@@ -1984,6 +1984,12 @@ int polaris10_thermal_avfs_enable(structsmum_send_msg_to_smc (hwmgr, PPSMC_MSG_EnableAvfs); +/* Apply avfs cks-off voltages to avoid the overshoot +* when switching to the highest sclk frequency +*/ +if (data->apply_avfs_cks_off_voltage) +smum_send_msg_to_smc (hwmgr, PPSMC_MSG_ApplyAvfsCksOffVoltage); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 39/44 drm/amdkfd: add new vega10 pci ids
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 756e16bf79f2815e7c83a04881b5545b55a99fd3 upstream.
New vega10 ids.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +6 -0
@@ -326,7 +326,13 @@ static const struct kfd_deviceid support { 0x6864, &vega10_device_info }, /* Vega10 */ { 0x6867, &vega10_device_info }, /* Vega10 */ { 0x6868, &vega10_device_info }, /* Vega10 */ + { 0x6869, &vega10_device_info }, /* Vega10 */ + { 0x686A, &vega10_device_info }, /* Vega10 */ + { 0x686B, &vega10_device_info }, /* Vega10 */ { 0x686C, &vega10_vf_device_info }, /* Vega10 vf*/ + { 0x686D, &vega10_device_info }, /* Vega10 */ + { 0x686E, &vega10_device_info }, /* Vega10 */ + { 0x686F, &vega10_device_info }, /* Vega10 */ { 0x687F, &vega10_device_info }, /* Vega10 */ };
Greg Kroah-Hartman
maintainerPATCH 40/44 drm/amdgpu: add some additional vega10 pci ids
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 2244b5887c6865b9e9cf14ee12a312b776aeeb58 upstream.
New vega ids.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -0
@@ -761,7 +761,13 @@ static const struct pci_device_id pciidl {0x1002, 0x6864, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, {0x1002, 0x6867, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, {0x1002, 0x6868, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x6869, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x686a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x686b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, {0x1002, 0x686c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x686d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x686e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x686f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, {0x1002, 0x687f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},/* Vega 12 */ {0x1002, 0x69A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12},
Greg Kroah-Hartman
maintainerPATCH 41/44 drm/amdgpu: update smu firmware images for VI variants (v2)
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 153573d8870e1c173721bdc1ced72b3ad0d85de4 upstream.
Some new variants require updated firmware.
V2: add MODULE_FIRMWARE for new firmwares
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 33 ++++++++++++++++++++++---- drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c | 3 ++ 2 files changed, 31 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +28 -5
@@ -330,7 +330,9 @@ static int amdgpu_cgs_get_firmware_info(case CHIP_TOPAZ :if (((adev->pdev->device ==0x6900 ) && (adev->pdev->revision ==0x81 )) || ((adev->pdev->device ==0x6900 ) && (adev->pdev->revision ==0x83 )) || - ((adev->pdev->device ==0x6907 ) && (adev->pdev->revision ==0x87 ))) { + ((adev->pdev->device ==0x6907 ) && (adev->pdev->revision ==0x87 )) || + ((adev->pdev->device ==0x6900 ) && (adev->pdev->revision ==0xD1 )) || + ((adev->pdev->device ==0x6900 ) && (adev->pdev->revision ==0xD3 ))) { info->is_kicker = true;strcpy (fw_name,"amdgpu/topaz_k_smc.bin" ); }else
@@ -351,7 +353,6 @@ static int amdgpu_cgs_get_firmware_info(if (type ==CGS_UCODE_ID_SMU ) { if (((adev->pdev->device == 0x67ef) && ((adev->pdev->revision == 0xe0) || - (adev->pdev->revision == 0xe2) || (adev->pdev->revision == 0xe5))) || ((adev->pdev->device == 0x67ff) && ((adev->pdev->revision == 0xcf) ||
@@ -359,8 +360,13 @@ static int amdgpu_cgs_get_firmware_info( (adev->pdev->revision == 0xff)))) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris11_k_smc.bin" ); - } else + } else if ((adev->pdev->device == 0x67ef) && + (adev->pdev->revision == 0xe2)) { + info->is_kicker = true; +strcpy (fw_name,"amdgpu/polaris11_k2_smc.bin" ); + } else {strcpy (fw_name,"amdgpu/polaris11_smc.bin" ); + } }else if (type ==CGS_UCODE_ID_SMU_SK ) {strcpy (fw_name,"amdgpu/polaris11_smc_sk.bin" ); }
@@ -378,14 +384,31 @@ static int amdgpu_cgs_get_firmware_info( (adev->pdev->revision == 0xef))) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris10_k_smc.bin" ); - } else + } else if ((adev->pdev->device == 0x67df) && + ((adev->pdev->revision == 0xe1) || + (adev->pdev->revision == 0xf7))) { + info->is_kicker = true; +strcpy (fw_name,"amdgpu/polaris10_k2_smc.bin" ); + } else {strcpy (fw_name,"amdgpu/polaris10_smc.bin" ); + } }else if (type ==CGS_UCODE_ID_SMU_SK ) {strcpy (fw_name,"amdgpu/polaris10_smc_sk.bin" ); }break ;case CHIP_POLARIS12 : -strcpy (fw_name,"amdgpu/polaris12_smc.bin" ); +if (((adev->pdev->device ==0x6987 ) && + ((adev->pdev->revision ==0xc0 ) || + (adev->pdev->revision ==0xc3 ))) || + ((adev->pdev->device ==0x6981 ) && + ((adev->pdev->revision ==0x00 ) || + (adev->pdev->revision ==0x01 ) || + (adev->pdev->revision ==0x10 )))) { + info->is_kicker = true; +strcpy (fw_name,"amdgpu/polaris12_k_smc.bin" ); + }else { +strcpy (fw_name,"amdgpu/polaris12_smc.bin" ); + }break ;case CHIP_VEGAM :strcpy (fw_name,"amdgpu/vegam_smc.bin" );
drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +3 -0
@@ -37,10 +37,13 @@ MODULE_FIRMWARE("amdgpu/fiji_smc.bin");MODULE_FIRMWARE ("amdgpu/polaris10_smc.bin" );MODULE_FIRMWARE ("amdgpu/polaris10_smc_sk.bin" );MODULE_FIRMWARE ("amdgpu/polaris10_k_smc.bin" ); +MODULE_FIRMWARE ("amdgpu/polaris10_k2_smc.bin" );MODULE_FIRMWARE ("amdgpu/polaris11_smc.bin" );MODULE_FIRMWARE ("amdgpu/polaris11_smc_sk.bin" );MODULE_FIRMWARE ("amdgpu/polaris11_k_smc.bin" ); +MODULE_FIRMWARE ("amdgpu/polaris11_k2_smc.bin" );MODULE_FIRMWARE ("amdgpu/polaris12_smc.bin" ); +MODULE_FIRMWARE ("amdgpu/polaris12_k_smc.bin" );MODULE_FIRMWARE ("amdgpu/vegam_smc.bin" );MODULE_FIRMWARE ("amdgpu/vega10_smc.bin" );MODULE_FIRMWARE ("amdgpu/vega10_acg_smc.bin" );
Greg Kroah-Hartman
maintainerPATCH 42/44 drm/amdgpu: update SMC firmware image for polaris10 variants
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junwei Zhang <[email protected]>
commit d55d8be0747c96db28a1d08fc24d22ccd9b448ac upstream.
Some new variants require different firmwares.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +2 -1
@@ -381,7 +381,8 @@ static int amdgpu_cgs_get_firmware_info( (adev->pdev->revision ==0xe7 ) || (adev->pdev->revision == 0xef))) || ((adev->pdev->device ==0x6fdf ) && - (adev->pdev->revision == 0xef))) { + ((adev->pdev->revision ==0xef ) || + (adev->pdev->revision == 0xff)))) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris10_k_smc.bin" ); } else if ((adev->pdev->device == 0x67df) &&
Greg Kroah-Hartman
maintainerPATCH 43/44 dm zoned: Fix target BIO completion handling
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit d57f9da890696af1484f4a47f7f123560197865a upstream.
struct bioctx includes the ref refcount_t to track the number of I/O fragments used to process a target BIO as well as ensure that the zone of the BIO is kept in the active state throughout the lifetime of the BIO. However, since decrementing of this reference count is done in the target .end_io method, the function bio_endio() must be called multiple times for read and write target BIOs, which causes problems with the value of the __bi_remaining struct bio field for chained BIOs (e.g. the clone BIO passed by dm core is large and splits into fragments by the block layer), resulting in incorrect values and inconsistencies with the BIO_CHAIN flag setting. This is turn triggers the BUG_ON() call:
BUG_ON(atomic_read(&bio->__bi_remaining) <= 0);
in bio_remaining_done() called from bio_endio().
Fix this ensuring that bio_endio() is called only once for any target BIO by always using internal clone BIOs for processing any read or write target BIO. This allows reference counting using the target BIO context counter to trigger the target BIO completion bio_endio() call once all data, metadata and other zone work triggered by the BIO complete.
Overall, this simplifies the code too as the target .end_io becomes unnecessary and differences between read and write BIO issuing and completion processing disappear.
--- drivers/md/dm-zoned-target.c | 122 +++++++++++++------------------------------ 1 file changed, 38 insertions(+), 84 deletions(-)
drivers/md/dm-zoned-target.c +38 -84
@@ -20,7 +20,6 @@ struct dmz_bioctx {struct dm_zone *zone;struct bio *bio;atomic_t ref; -blk_status_t status; };/*
@@ -78,65 +77,66 @@ static inline void dmz_bio_endio(struct {struct dmz_bioctx *bioctx =dm_per_bio_data (bio,sizeof (struct dmz_bioctx )); -if (bioctx->status ==BLK_STS_OK && status !=BLK_STS_OK ) - bioctx->status = status; -bio_endio (bio); +if (status !=BLK_STS_OK && bio->bi_status ==BLK_STS_OK ) + bio->bi_status = status; + +if (atomic_dec_and_test (&bioctx->ref)) { +struct dm_zone *zone = bioctx->zone; + +if (zone) { +if (bio->bi_status !=BLK_STS_OK && +bio_op (bio) ==REQ_OP_WRITE && +dmz_is_seq (zone)) +set_bit (DMZ_SEQ_WRITE_ERR , &zone->flags); +dmz_deactivate_zone (zone); + } +bio_endio (bio); + } }/* -* Partial clone read BIO completion callback. This terminates the +* Completion callback for an internally cloned target BIO. This terminates the * target BIO when there are no more references to its context. */ -static void dmz_read_bio_end_io (struct bio *bio) +static void dmz_clone_endio (struct bio *clone) { -struct dmz_bioctx *bioctx = bio->bi_private; -blk_status_t status = bio->bi_status; +struct dmz_bioctx *bioctx = clone->bi_private; +blk_status_t status = clone->bi_status; -bio_put (bio); +bio_put (clone);dmz_bio_endio (bioctx->bio, status); }/* -* Issue a BIO to a zone. The BIO may only partially process the +* Issue a clone of a target BIO. The clone may only partially process the * original target BIO. */ -static int dmz_submit_read_bio (struct dmz_target *dmz,struct dm_zone *zone, -struct bio *bio,sector_t chunk_block, -unsigned int nr_blocks) +static int dmz_submit_bio (struct dmz_target *dmz,struct dm_zone *zone, +struct bio *bio,sector_t chunk_block, +unsigned int nr_blocks) {struct dmz_bioctx *bioctx =dm_per_bio_data (bio,sizeof (struct dmz_bioctx )); -sector_t sector;struct bio *clone; -/* BIO remap sector */ - sector =dmz_start_sect (dmz->metadata, zone) +dmz_blk2sect (chunk_block); - -/* If the read is not partial, there is no need to clone the BIO */ -if (nr_blocks ==dmz_bio_blocks (bio)) { -/* Setup and submit the BIO */ - bio->bi_iter.bi_sector = sector; -atomic_inc (&bioctx->ref); -generic_make_request (bio); -return 0 ; - } - -/* Partial BIO: we need to clone the BIO */ clone =bio_clone_fast (bio,GFP_NOIO , &dmz->bio_set);if (!clone)return -ENOMEM ; -/* Setup the clone */ - clone->bi_iter.bi_sector = sector; +bio_set_dev (clone, dmz->dev->bdev); + clone->bi_iter.bi_sector = +dmz_start_sect (dmz->metadata, zone) +dmz_blk2sect (chunk_block); clone->bi_iter.bi_size =dmz_blk2sect (nr_blocks) <<SECTOR_SHIFT ; - clone->bi_end_io = dmz_read_bio_end_io; + clone->bi_end_io = dmz_clone_endio; clone->bi_private = bioctx;bio_advance (bio, clone->bi_iter.bi_size); -/* Submit the clone */ atomic_inc (&bioctx->ref);generic_make_request (clone); +if (bio_op (bio) ==REQ_OP_WRITE &&dmz_is_seq (zone)) + zone->wp_block += nr_blocks; +return 0 ; }
@@ -214,7 +214,7 @@ static int dmz_handle_read(struct dmz_taif (nr_blocks) {/* Valid blocks found: read them */ nr_blocks = min_t(unsigned int, nr_blocks, end_block - chunk_block); - ret =dmz_submit_read_bio (dmz, rzone, bio, chunk_block, nr_blocks); + ret =dmz_submit_bio (dmz, rzone, bio, chunk_block, nr_blocks);if (ret)return ret; chunk_block += nr_blocks;
@@ -229,25 +229,6 @@ static int dmz_handle_read(struct dmz_ta }/* -* Issue a write BIO to a zone. -*/ -static void dmz_submit_write_bio (struct dmz_target *dmz,struct dm_zone *zone, -struct bio *bio,sector_t chunk_block, -unsigned int nr_blocks) -{ -struct dmz_bioctx *bioctx =dm_per_bio_data (bio,sizeof (struct dmz_bioctx )); - -/* Setup and submit the BIO */ -bio_set_dev (bio, dmz->dev->bdev); - bio->bi_iter.bi_sector =dmz_start_sect (dmz->metadata, zone) +dmz_blk2sect (chunk_block); -atomic_inc (&bioctx->ref); -generic_make_request (bio); - -if (dmz_is_seq (zone)) - zone->wp_block += nr_blocks; -} - -/* * Write blocks directly in a data zone, at the write pointer. * If a buffer zone is assigned, invalidate the blocks written * in place.
@@ -265,7 +246,9 @@ static int dmz_handle_direct_write(strucreturn -EROFS ;/* Submit write */ -dmz_submit_write_bio (dmz, zone, bio, chunk_block, nr_blocks); + ret =dmz_submit_bio (dmz, zone, bio, chunk_block, nr_blocks); +if (ret) +return ret;/* * Validate the blocks in the data zone and invalidate
@@ -301,7 +284,9 @@ static int dmz_handle_buffered_write(strreturn -EROFS ;/* Submit write */ -dmz_submit_write_bio (dmz, bzone, bio, chunk_block, nr_blocks); + ret =dmz_submit_bio (dmz, bzone, bio, chunk_block, nr_blocks); +if (ret) +return ret;/* * Validate the blocks in the buffer zone
@@ -600,7 +585,6 @@ static int dmz_map(struct dm_target *ti, bioctx->zone =NULL ; bioctx->bio = bio;atomic_set (&bioctx->ref,1 ); - bioctx->status =BLK_STS_OK ;/* Set the BIO pending in the flush list */ if (!nr_sectors &&bio_op (bio) ==REQ_OP_WRITE ) {
@@ -624,35 +608,6 @@ static int dmz_map(struct dm_target *ti, }/* -* Completed target BIO processing. -*/ -static int dmz_end_io (struct dm_target *ti,struct bio *bio,blk_status_t *error) -{ -struct dmz_bioctx *bioctx =dm_per_bio_data (bio,sizeof (struct dmz_bioctx )); - -if (bioctx->status ==BLK_STS_OK && *error) - bioctx->status = *error; - -if (!atomic_dec_and_test (&bioctx->ref)) -return DM_ENDIO_INCOMPLETE ; - -/* Done */ - bio->bi_status = bioctx->status; - -if (bioctx->zone) { -struct dm_zone *zone = bioctx->zone; - -if (*error &&bio_op (bio) ==REQ_OP_WRITE ) { -if (dmz_is_seq (zone)) -set_bit (DMZ_SEQ_WRITE_ERR , &zone->flags); - } -dmz_deactivate_zone (zone); - } - -return DM_ENDIO_DONE ; -} - -/* * Get zoned device information. */ static int dmz_get_zoned_device (struct dm_target *ti,char *path)
@@ -947,7 +902,6 @@ static struct target_type dmz_type = { .ctr = dmz_ctr, .dtr = dmz_dtr, .map = dmz_map, - .end_io = dmz_end_io, .io_hints = dmz_io_hints, .prepare_ioctl = dmz_prepare_ioctl, .postsuspend = dmz_suspend,
Greg Kroah-Hartman
maintainerPATCH 44/44 x86/build: Fix compiler support check for CONFIG_RETPOLINE
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
commit 25896d073d8a0403b07e6dec56f58e6c33678207 upstream.
It is troublesome to add a diagnostic like this to the Makefile parse stage because the top-level Makefile could be parsed with a stale include/config/auto.conf.
Once you are hit by the error about non-retpoline compiler, the compilation still breaks even after disabling CONFIG_RETPOLINE.
The easiest fix is to move this check to the "archprepare" like this commit did:
829fe4aa9ac1 ("x86: Allow generating user-space headers without a compiler")
--- arch/x86/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/Makefile +7 -3
@@ -223,9 +223,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwin # Avoid indirect branches in kernel to deal with Spectre ifdef CONFIG_RETPOLINE -ifeq ($(RETPOLINE_CFLAGS),) - $(error You are building kernel with non-retpoline compiler, please update your compiler.) -endif KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) endif
@@ -303,6 +300,13 @@ ifndef CC_HAVE_ASM_GOTO @echo Compiler lacks asm-goto support. @exit 1 endif +ifdef CONFIG_RETPOLINE +ifeq ($(RETPOLINE_CFLAGS),) + @echo "You are building kernel with non-retpoline compiler." >&2 + @echo "Please update your compiler." >&2 + @false +endif +endif archclean: $(Q)rm -rf $(objtree)/arch/i386
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.11-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 15 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.11-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing and letting me know.
greg k-h
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.19.11-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.19.y
git commit: 75803dcafdb3171314d8767b002143fc031611e9
git describe: v4.19.10-45-g75803dcafdb3
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.19-oe/build/v4.19.10-45-g75803dcafdb3
No regressions (compared to build v4.19.10)
No fixes (compared to build v4.19.10)
Ran 20521 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* boot
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* spectre-meltdown-checker-test
* ltp-open-posix-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 11 lines · Dan Rue
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Great, thanks for testing and letting me know.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.11-rc1.gz
Quoted 8 lines
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
linux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted on the Lenovo IdeaPad 330-15ARR, no dmesg regressions.
Signature · 2 lines
Harsh Shandilya PRJKT Development LLC
Greg Kroah-Hartman
maintainerQuoted 16 lines · Harsh Shandilya
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.11-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
linux-4.19.y
and the diffstat can be found below.
Quoted 4 lines
Quoted 3 lines
thanks,
greg k-h
Built and booted on the Lenovo IdeaPad 330-15ARR, no dmesg regressions.
Great, thanks for testing and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 338 pass: 338 fail: 0
Details are available at https://kerneltests.org/builders/.
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.11 release. There are 44 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Dec 20 16:39:02 UTC 2018. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 338 pass: 338 fail: 0Details are available at https://kerneltests.org/builders/.
Wonderful, thanks for testing and letting me know.
greg k-h