4.20.11-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 4.20.11-stable review
This is the start of the stable review cycle for the 4.20.11 release. There are 92 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 Wed Feb 20 13:34:25 UTC 2019. 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.20.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.20.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.20.11-rc1
Joonas Lahtinen <[email protected]>
drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
Lyude Paul <[email protected]>
drm/i915: Block fbdev HPD processing during suspend
Eric Anholt <[email protected]>
drm/sched: Always trace the dependencies we wait on, to fix a race.
Rodrigo Siqueira <[email protected]>
drm/vkms: Fix license inconsistent
Matthew Wilcox <[email protected]>
drm: Use array_size() when creating lease
Nikos Tsironis <[email protected]>
dm thin: fix bug where bio that overwrites thin block ignores FUA
Mikulas Patocka <[email protected]>
dm crypt: don't overallocate the integrity tag space
Scott Mayhew <[email protected]>
sunrpc: fix 4 more call sites that were using stack memory with a scatterlist
Borislav Petkov <[email protected]>
x86/a.out: Clear the dump structure initially
Nate Dailey <[email protected]>
md/raid1: don't clear bitmap bits on interrupted recovery.
Gilad Ben-Yossef <[email protected]>
crypto: ccree - fix resume race condition on init
Eric W. Biederman <[email protected]>
signal: Restore the stop PTRACE_EVENT_EXIT
James Bottomley <[email protected]>
scsi: sd: fix entropy gathering for most rotational disks
Michael Ellerman <[email protected]>
powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present()
Hedi Berriche <[email protected]>
x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls
Andreas Ziegler <[email protected]>
tracing: probeevent: Correctly update remaining space in dynamic area
Harald Freudenberger <[email protected]>
s390/zcrypt: fix specification exception on z196 during ap probe
Martin Schwidefsky <[email protected]>
s390/suspend: fix stack setup in swsusp_arch_suspend
Meelis Roos <[email protected]>
alpha: Fix Eiger NR_IRQS to 128
Sergei Trofimovich <[email protected]>
alpha: fix page fault handling for r16-r18 targets
Sandeep Patil <[email protected]>
mm: proc: smaps_rollup: fix pss_locked calculation
Dave Chinner <[email protected]>
Revert "mm: slowly shrink slabs with a relatively small number of objects"
Dave Chinner <[email protected]>
Revert "mm: don't reclaim inodes with many attached pages"
J. Bruce Fields <[email protected]>
Revert "nfsd4: return default lease period"
Matti Kurkela <[email protected]>
Input: elantech - enable 3rd button support on Fujitsu CELSIUS H780
Jonathan Bakker <[email protected]>
Input: bma150 - register input device after setting private data
Zachary Hays <[email protected]>
mmc: block: handle complete_work on separate workqueue
Chen-Yu Tsai <[email protected]>
mmc: sunxi: Filter out unsupported modes declared in the device tree
Chen-Yu Tsai <[email protected]>
mmc: sunxi: Disable HS-DDR mode for H5 eMMC controller by default
Xiaoyao Li <[email protected]>
kvm: vmx: Fix entry number check for add_atomic_switch_msr()
Vitaly Kuznetsov <[email protected]>
x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available
Stefan O'Rear <[email protected]>
riscv: Add pte bit to distinguish swap from invalid
Bob Tracy <[email protected]>
tools uapi: fix Alpha support
Russell King <[email protected]>
ASoC: hdmi-codec: fix oops on re-probe
Takashi Iwai <[email protected]>
ALSA: pcm: Revert capture stream behavior change in blocking mode
Manuel Reinhardt <[email protected]>
ALSA: usb-audio: Fix implicit fb endpoint setup by quirk
Jurica Vukadin <[email protected]>
ALSA: hda - Add quirk for HP EliteBook 840 G5
Jiri Olsa <[email protected]>
perf/x86: Add check_period PMU callback
Ingo Molnar <[email protected]>
perf/core: Fix impossible ring-buffer sizes warning
Tony Lindgren <[email protected]>
ARM: OMAP5+: Fix inverted nirq pin interrupts with irq_set_type
Dmitry Voytik <[email protected]>
arm64: dts: rockchip: enable usb-host regulators at boot on rk3328-rock64
Mauro Ciancio <[email protected]>
Input: elan_i2c - add ACPI ID for touchpad in Lenovo V330-15ISK
Dmitry Torokhov <[email protected]>
Revert "Input: elan_i2c - add ACPI ID for touchpad in ASUS Aspire F5-573G"
Anson Huang <[email protected]>
gpio: mxc: move gpio noirq suspend/resume to syscore phase
Pavel Shilovsky <[email protected]>
CIFS: Fix mounts if the client is low on credits
Pavel Shilovsky <[email protected]>
CIFS: Do not assume one credit for async responses
Pavel Shilovsky <[email protected]>
CIFS: Fix credit calculations in compound mid callback
David Rientjes <[email protected]>
kvm: sev: Fail KVM_SEV_INIT if already initialized
Pavel Shilovsky <[email protected]>
CIFS: Fix error paths in writeback code
Pavel Shilovsky <[email protected]>
CIFS: Move credit processing to mid callbacks for SMB3
Pavel Shilovsky <[email protected]>
CIFS: Fix credits calculation for cancelled requests
Ross Lagerwall <[email protected]>
cifs: Limit memory used by lock request calls to a page
Ilia Mirkin <[email protected]>
drm/nouveau/falcon: avoid touching registers if engine is off
Takashi Iwai <[email protected]>
drm/nouveau: Don't disable polling in fallback mode
Nicholas Mc Guire <[email protected]>
gpio: pl061: handle failed allocations
Guo Ren <[email protected]>
csky: fixup compile error with CPU 810.
Linus Walleij <[email protected]>
ARM: dts: kirkwood: Fix polarity of GPIO fan lines
Peter Ujfalusi <[email protected]>
ARM: dts: da850-lcdk: Correct the sound card name
Peter Ujfalusi <[email protected]>
ARM: dts: da850-lcdk: Correct the audio codec regulators
Peter Ujfalusi <[email protected]>
ARM: dts: da850-evm: Correct the sound card name
Peter Ujfalusi <[email protected]>
ARM: dts: da850-evm: Correct the audio codec regulators
Christian König <[email protected]>
drm/amdgpu: disable system memory page tables for now
Jim Qu <[email protected]>
drm/amdgpu: set WRITE_BURST_LENGTH to 64B to workaround SDMA1 hang
Tao Zhou <[email protected]>
drm/amdgpu: fix CPDMA hang in PRT mode for VEGA20
James Dingwall <[email protected]>
nvme: introduce NVME_QUIRK_IGNORE_DEV_SUBNQN
Keith Busch <[email protected]>
nvme: pad fake subsys NQN vid and ssvid with zeros
Hannes Reinecke <[email protected]>
nvme-multipath: zero out ANA log buffer
Hongbo Yao <[email protected]>
nvme-pci: fix out of bounds access in nvme_cqe_pending
Liviu Dudau <[email protected]>
nvme-pci: use the same attributes when freeing host_mem_desc_bufs.
Tomi Valkeinen <[email protected]>
drm/bridge: tc358767: fix output H/V syncs
Tomi Valkeinen <[email protected]>
drm/bridge: tc358767: reject modes which require too much BW
Tomi Valkeinen <[email protected]>
drm/bridge: tc358767: fix initial DP0/1_SRCCTRL value
Tomi Valkeinen <[email protected]>
drm/bridge: tc358767: fix single lane configuration
Tomi Valkeinen <[email protected]>
drm/bridge: tc358767: add defines for DP1_SRCCTRL & PHY_2LANE
Tomi Valkeinen <[email protected]>
drm/bridge: tc358767: add bus flags
Evan Quan <[email protected]>
drm/amd/powerplay: avoid possible buffer overflow
Guo Ren <[email protected]>
irqchip/csky: fixup handle_irq_perbit break irq
Guo Ren <[email protected]>
csky: fixup compile error with pte_alloc
Guo Ren <[email protected]>
csky: fixup CACHEV1 store instruction fast retire
Guo Ren <[email protected]>
csky: fixup relocation error with 807 & 860
Sudeep Holla <[email protected]>
cpufreq: check if policy is inactive early in __cpufreq_get()
David Abdurachmanov <[email protected]>
riscv: fix trace_sys_exit hook
Aurelien Jarno <[email protected]>
tools uapi: fix RISC-V 64-bit support
Biju Das <[email protected]>
soc: renesas: r8a774c0-sysc: Fix initialization order of 3DG-{A,B}Arnaldo Carvalho de Melo <[email protected]>
perf test shell: Use a fallback to get the pathname in vfs_getname
Jin Yao <[email protected]>
perf report: Fix wrong iteration count in --branch-history
Jin Yao <[email protected]>
perf stat: Fix endless wait for child process
Chao Fan <[email protected]>
ACPI: NUMA: Use correct type for printing addresses on i386-PAE
Emily Deng <[email protected]>
drm/amdgpu/sriov:Correct pfvf exchange logic
Jianchao Wang <[email protected]>
blk-mq: fix a hung issue when fsync
Adrian Bunk <[email protected]>
eeprom: at24: add support for 24c2048
Adrian Bunk <[email protected]>
dt-bindings: eeprom: at24: add "atmel,24c2048" compatible string
-------------
Diffstat:
Documentation/devicetree/bindings/eeprom/at24.txt | 1 + Makefile | 4 +- arch/alpha/include/asm/irq.h | 6 +- arch/alpha/mm/fault.c | 2 +- arch/arm/boot/dts/da850-evm.dts | 31 +++++++-- arch/arm/boot/dts/da850-lcdk.dts | 38 ++++++++++- arch/arm/boot/dts/kirkwood-dnskw.dtsi | 4 +- arch/arm/boot/dts/omap5-board-common.dtsi | 9 ++- arch/arm/boot/dts/omap5-cm-t54.dts | 12 +++- arch/arm/mach-integrator/impd1.c | 6 +- arch/arm/mach-omap2/omap-wakeupgen.c | 36 +++++++++- arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 + arch/csky/include/asm/io.h | 25 +++++++ arch/csky/include/asm/pgalloc.h | 43 +++++------- arch/csky/kernel/module.c | 38 ++++++----- arch/powerpc/include/asm/book3s/64/pgtable.h | 4 +- arch/riscv/include/asm/pgtable-bits.h | 6 ++ arch/riscv/include/asm/pgtable.h | 8 +-- arch/riscv/kernel/ptrace.c | 2 +- arch/s390/kernel/swsusp.S | 4 +- arch/x86/events/core.c | 14 ++++ arch/x86/events/intel/core.c | 9 +++ arch/x86/events/perf_event.h | 16 ++++- arch/x86/ia32/ia32_aout.c | 6 +- arch/x86/include/asm/uv/bios.h | 8 ++- arch/x86/kvm/svm.c | 3 + arch/x86/kvm/vmx.c | 11 ++-- arch/x86/platform/uv/bios_uv.c | 23 ++++++- block/blk-flush.c | 2 +- drivers/acpi/numa.c | 6 +- drivers/cpufreq/cpufreq.c | 12 ++-- drivers/crypto/ccree/cc_driver.c | 7 +- drivers/crypto/ccree/cc_pm.c | 13 ++-- drivers/crypto/ccree/cc_pm.h | 3 + drivers/firmware/efi/runtime-wrappers.c | 7 ++ drivers/gpio/gpio-mxc.c | 41 +++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 - drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 10 +-- drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14 ++++ drivers/gpu/drm/bridge/tc358767.c | 45 ++++++++++--- drivers/gpu/drm/drm_lease.c | 3 +- drivers/gpu/drm/i915/i915_gem.c | 12 +++- drivers/gpu/drm/i915/intel_drv.h | 10 +++ drivers/gpu/drm/i915/intel_fbdev.c | 33 +++++++++- drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | 7 +- drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | 7 +- drivers/gpu/drm/scheduler/sched_entity.c | 7 +- drivers/gpu/drm/vkms/vkms_crc.c | 3 +- drivers/gpu/drm/vkms/vkms_crtc.c | 8 +-- drivers/gpu/drm/vkms/vkms_drv.c | 7 +- drivers/gpu/drm/vkms/vkms_drv.h | 2 + drivers/gpu/drm/vkms/vkms_gem.c | 8 +-- drivers/gpu/drm/vkms/vkms_output.c | 8 +-- drivers/gpu/drm/vkms/vkms_plane.c | 8 +-- drivers/input/misc/bma150.c | 9 +-- drivers/input/mouse/elan_i2c_core.c | 2 +- drivers/input/mouse/elantech.c | 9 +++ drivers/irqchip/irq-csky-apb-intc.c | 77 ++++++++++++---------- drivers/md/dm-crypt.c | 2 +- drivers/md/dm-thin.c | 55 ++++++++++++++-- drivers/md/raid1.c | 28 +++++--- drivers/misc/eeprom/Kconfig | 2 +- drivers/misc/eeprom/at24.c | 3 + drivers/mmc/core/block.c | 10 ++- drivers/mmc/host/sunxi-mmc.c | 26 +++++++- drivers/nvme/host/core.c | 18 ++--- drivers/nvme/host/multipath.c | 2 + drivers/nvme/host/nvme.h | 5 ++ drivers/nvme/host/pci.c | 16 +++-- drivers/s390/crypto/ap_bus.c | 3 +- drivers/scsi/sd.c | 12 +++- drivers/soc/renesas/r8a774c0-sysc.c | 23 ++----- fs/cifs/cifsglob.h | 20 ++++++ fs/cifs/cifssmb.c | 7 +- fs/cifs/file.c | 37 +++++++++-- fs/cifs/inode.c | 10 +++ fs/cifs/smb2file.c | 4 ++ fs/cifs/smb2inode.c | 17 +++++ fs/cifs/smb2ops.c | 6 +- fs/cifs/smb2pdu.c | 15 +++-- fs/cifs/transport.c | 58 ++++++++++++---- fs/inode.c | 7 +- fs/nfsd/nfsctl.c | 4 +- fs/proc/task_mmu.c | 22 ++++--- include/linux/mmc/card.h | 1 + include/linux/perf_event.h | 5 ++ kernel/events/core.c | 16 +++++ kernel/events/ring_buffer.c | 2 +- kernel/signal.c | 7 +- kernel/trace/trace_probe_tmpl.h | 6 +- mm/vmscan.c | 10 --- net/sunrpc/auth_gss/gss_krb5_seqnum.c | 49 ++++++++++---- sound/core/pcm_lib.c | 20 ++---- sound/pci/hda/patch_conexant.c | 1 + sound/soc/codecs/hdmi-codec.c | 4 +- sound/usb/pcm.c | 9 ++- tools/arch/riscv/include/uapi/asm/bitsperlong.h | 25 +++++++ tools/include/uapi/asm/bitsperlong.h | 4 ++ tools/perf/builtin-stat.c | 3 +- tools/perf/tests/shell/lib/probe_vfs_getname.sh | 3 +- tools/perf/util/callchain.c | 32 +++++---- tools/perf/util/callchain.h | 1 + tools/perf/util/machine.c | 2 +- 106 files changed, 991 insertions(+), 388 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/92 dt-bindings: eeprom: at24: add "atmel,24c2048" compatible string
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6c0c5dc33ff42af49243e94842d0ebdb153189ea ]
Add new compatible to the device tree bindings.
--- Documentation/devicetree/bindings/eeprom/at24.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/eeprom/at24.txt +1 -0
@@ -27,6 +27,7 @@ Required properties: "atmel,24c256", "atmel,24c512", "atmel,24c1024", + "atmel,24c2048", If <manufacturer> is not "atmel", then a fallback must be used with the same <model> and "atmel" as manufacturer.
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 2/92 eeprom: at24: add support for 24c2048
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 37cf28d3b5bca1b532a0b6aac722e7f2788a9294 ]
Works with ST M24M02.
--- drivers/misc/eeprom/Kconfig | 2 +- drivers/misc/eeprom/at24.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/misc/eeprom/Kconfig +1 -1
@@ -13,7 +13,7 @@ config EEPROM_AT24 ones like at24c64, 24lc02 or fm24c04: 24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08, - 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024 + 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024, 24c2048 Unless you like data loss puzzles, always be sure that any chip you configure as a 24c32 (32 kbit) or larger is NOT really a
drivers/misc/eeprom/at24.c +3 -0
@@ -156,6 +156,7 @@ AT24_CHIP_DATA(at24_data_24c128, 131072 / 8, AT24_FLAG_ADDR16);AT24_CHIP_DATA (at24_data_24c256,262144 /8 ,AT24_FLAG_ADDR16 );AT24_CHIP_DATA (at24_data_24c512,524288 /8 ,AT24_FLAG_ADDR16 );AT24_CHIP_DATA (at24_data_24c1024,1048576 /8 ,AT24_FLAG_ADDR16 ); +AT24_CHIP_DATA (at24_data_24c2048,2097152 /8 ,AT24_FLAG_ADDR16 );/* identical to 24c08 ? */ AT24_CHIP_DATA (at24_data_INT3499,8192 /8 ,0 );
@@ -182,6 +183,7 @@ static const struct i2c_device_id at24_ids[] = { { "24c256", (kernel_ulong_t)&at24_data_24c256 }, { "24c512", (kernel_ulong_t)&at24_data_24c512 }, { "24c1024", (kernel_ulong_t)&at24_data_24c1024 }, + { "24c2048", (kernel_ulong_t)&at24_data_24c2048 }, { "at24", 0 }, { /* END OF LIST */ } };
@@ -210,6 +212,7 @@ static const struct of_device_id at24_of_match[] = { { .compatible = "atmel,24c256", .data = &at24_data_24c256 }, { .compatible = "atmel,24c512", .data = &at24_data_24c512 }, { .compatible = "atmel,24c1024", .data = &at24_data_24c1024 }, + { .compatible = "atmel,24c2048", .data = &at24_data_24c2048 }, { /* END OF LIST */ }, };MODULE_DEVICE_TABLE (of, at24_of_match);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 3/92 blk-mq: fix a hung issue when fsync
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 85bd6e61f34dffa8ec2dc75ff3c02ee7b2f1cbce ]
Florian reported a io hung issue when fsync(). It should be triggered by following race condition.
data + post flush a flush
blk_flush_complete_seq
case REQ_FSEQ_DATA
blk_flush_queue_rq
issued to driver blk_mq_dispatch_rq_list
try to issue a flush req failed due to NON-NCQ command .queue_rq return BLK_STS_DEV_RESOURCE
request completion
req->end_io // doesn't check RESTART mq_flush_data_end_io
case REQ_FSEQ_POSTFLUSH
blk_kick_flush
do nothing because previous flush
has not been completed
blk_mq_run_hw_queue
insert rq to hctx->dispatch due to RESTART is still set, do nothing
To fix this, replace the blk_mq_run_hw_queue in mq_flush_data_end_io with blk_mq_sched_restart to check and clear the RESTART flag.
--- block/blk-flush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-flush.c +1 -1
@@ -424,7 +424,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error)blk_flush_complete_seq (rq, fq,REQ_FSEQ_DATA , error);spin_unlock_irqrestore (&fq->mq_flush_lock, flags); -blk_mq_run_hw_queue (hctx, true); +blk_mq_sched_restart (hctx); }/**
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 4/92 drm/amdgpu/sriov:Correct pfvf exchange logic
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b8cf66182eddb22e9c7539821ed6eecdb4f86d1a ]
The pfvf exchange need be in exclusive mode. And add pfvf exchange in gpu reset.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -4
@@ -1684,8 +1684,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)amdgpu_xgmi_add_device (adev);amdgpu_amdkfd_device_init (adev); -if (amdgpu_sriov_vf (adev)) +if (amdgpu_sriov_vf (adev)) { +amdgpu_virt_init_data_exchange (adev);amdgpu_virt_release_full_gpu (adev, true); + }return 0 ; }
@@ -2597,9 +2599,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, goto failed; } -if (amdgpu_sriov_vf (adev)) -amdgpu_virt_init_data_exchange (adev); -amdgpu_fbdev_init (adev); r =amdgpu_pm_sysfs_init (adev);
@@ -3271,6 +3270,7 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, r =amdgpu_ib_ring_tests (adev); error: +amdgpu_virt_init_data_exchange (adev);amdgpu_virt_release_full_gpu (adev, true);if (!r && adev->virt.gim_feature &AMDGIM_FEATURE_GIM_FLR_VRAMLOST ) {atomic_inc (&adev->vram_lost_counter);
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -1
@@ -174,7 +174,7 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev,return r; }/* Retrieve checksum from mailbox2 */ -if (req ==IDH_REQ_GPU_INIT_ACCESS ) { +if (req ==IDH_REQ_GPU_INIT_ACCESS || req ==IDH_REQ_GPU_RESET_ACCESS ) { adev->virt.fw_reserve.checksum_key =RREG32_NO_KIQ (SOC15_REG_OFFSET (NBIO ,0 , mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW2));
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 5/92 ACPI: NUMA: Use correct type for printing addresses on i386-PAE
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b9ced18acf68dffebe6888c7ec765a2b1db7a039 ]
The addresses of NUMA nodes are not printed correctly on i386-PAE which is misleading.
Here is a debian9-32bit with PAE in a QEMU guest having more than 4G of memory:
qemu-system-i386 \
-hda /var/lib/libvirt/images/debian32.qcow2 \
-m 5G \
-enable-kvm \
-smp 10 \
-numa node,mem=512M,nodeid=0,cpus=0 \
-numa node,mem=512M,nodeid=1,cpus=1 \
-numa node,mem=512M,nodeid=2,cpus=2 \
-numa node,mem=512M,nodeid=3,cpus=3 \
-numa node,mem=512M,nodeid=4,cpus=4 \
-numa node,mem=512M,nodeid=5,cpus=5 \
-numa node,mem=512M,nodeid=6,cpus=6 \
-numa node,mem=512M,nodeid=7,cpus=7 \
-numa node,mem=512M,nodeid=8,cpus=8 \
-numa node,mem=512M,nodeid=9,cpus=9 \
-serial stdio
Because of the wrong value type, it prints as below:
[ 0.021049] ACPI: SRAT Memory (0x0 length 0xa0000) in proximity domain 0 enabled [ 0.021740] ACPI: SRAT Memory (0x100000 length 0x1ff00000) in proximity domain 0 enabled [ 0.022425] ACPI: SRAT Memory (0x20000000 length 0x20000000) in proximity domain 1 enabled [ 0.023092] ACPI: SRAT Memory (0x40000000 length 0x20000000) in proximity domain 2 enabled [ 0.023764] ACPI: SRAT Memory (0x60000000 length 0x20000000) in proximity domain 3 enabled [ 0.024431] ACPI: SRAT Memory (0x80000000 length 0x20000000) in proximity domain 4 enabled [ 0.025104] ACPI: SRAT Memory (0xa0000000 length 0x20000000) in proximity domain 5 enabled [ 0.025791] ACPI: SRAT Memory (0x0 length 0x20000000) in proximity domain 6 enabled [ 0.026412] ACPI: SRAT Memory (0x20000000 length 0x20000000) in proximity domain 7 enabled [ 0.027118] ACPI: SRAT Memory (0x40000000 length 0x20000000) in proximity domain 8 enabled [ 0.027802] ACPI: SRAT Memory (0x60000000 length 0x20000000) in proximity domain 9 enabled
The upper half of the start address of the NUMA domains between 6 and 9 inclusive was cut, so the printed values are incorrect.
Fix the value type, to get the correct values in the log as follows:
[ 0.023698] ACPI: SRAT Memory (0x0 length 0xa0000) in proximity domain 0 enabled [ 0.024325] ACPI: SRAT Memory (0x100000 length 0x1ff00000) in proximity domain 0 enabled [ 0.024981] ACPI: SRAT Memory (0x20000000 length 0x20000000) in proximity domain 1 enabled [ 0.025659] ACPI: SRAT Memory (0x40000000 length 0x20000000) in proximity domain 2 enabled [ 0.026317] ACPI: SRAT Memory (0x60000000 length 0x20000000) in proximity domain 3 enabled [ 0.026980] ACPI: SRAT Memory (0x80000000 length 0x20000000) in proximity domain 4 enabled [ 0.027635] ACPI: SRAT Memory (0xa0000000 length 0x20000000) in proximity domain 5 enabled [ 0.028311] ACPI: SRAT Memory (0x100000000 length 0x20000000) in proximity domain 6 enabled [ 0.028985] ACPI: SRAT Memory (0x120000000 length 0x20000000) in proximity domain 7 enabled [ 0.029667] ACPI: SRAT Memory (0x140000000 length 0x20000000) in proximity domain 8 enabled [ 0.030334] ACPI: SRAT Memory (0x160000000 length 0x20000000) in proximity domain 9 enabled
--- drivers/acpi/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/numa.c +3 -3
@@ -146,9 +146,9 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) {struct acpi_srat_mem_affinity *p = (struct acpi_srat_mem_affinity *)header; - pr_debug("SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n", - (unsigned long)p->base_address, - (unsigned long)p->length, + pr_debug("SRAT Memory (0x%llx length 0x%llx) in proximity domain %d %s%s%s\n", + (unsigned long long)p->base_address, + (unsigned long long)p->length, p->proximity_domain, (p->flags & ACPI_SRAT_MEM_ENABLED) ? "enabled" : "disabled",
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 6/92 perf stat: Fix endless wait for child process
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8a99255a50c0b4c2a449b96fd8d45fcc8d72c701 ]
We hit a 'perf stat' issue by using following script:
#!/bin/bash
sleep 1000 &
exec perf stat -a -e cycles -I1000 -- sleep 5
Since "perf stat" is launched by exec, the "sleep 1000" would be the child process of "perf stat". The wait4() call will not return because it's waiting for the child process "sleep 1000" to end. So 'perf stat' doesn't return even after 5s passes.
This patch lets 'perf stat' return when the specified child process ends (in this case, the specified child process is "sleep 5").
Committer testing:
# cat test.sh #!/bin/bash
sleep 10 &
exec perf stat -a -e cycles -I1000 -- sleep 5
#
Before:
# time ./test.sh
# time counts unit events
1.001113090 108,453,351 cycles
2.002062196 142,075,435 cycles
3.002896194 164,801,068 cycles
4.003731666 107,062,140 cycles
5.002068867 112,241,832 cycles real 0m10.066s
user 0m0.016s
sys 0m0.101s
#
After:
# time ./test.sh
# time counts unit events
1.001016096 91,412,027 cycles
2.002014963 124,063,708 cycles
3.002883964 125,993,929 cycles
4.003706470 120,465,734 cycles
5.002006778 163,560,355 cycles real 0m5.123s
user 0m0.014s
sys 0m0.105s
#
--- tools/perf/builtin-stat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/builtin-stat.c +2 -1
@@ -561,7 +561,8 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)break ; } } -wait4 (child_pid, &status,0 , &stat_config.ru_data); +if (child_pid !=-1 ) +wait4 (child_pid, &status,0 , &stat_config.ru_data);if (workload_exec_errno) {const char *emsg =str_error_r (workload_exec_errno, msg,sizeof (msg));
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 7/92 perf report: Fix wrong iteration count in --branch-history
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a3366db06bb656cef2e03f30f780d93059bcc594 ]
By calculating the removed loops, we can get the iteration count.
But the iteration count could be reported incorrectly, reporting impossibly high counts.
That's because previous code uses the number of removed LBR entries for the iteration count. That's not good. Fix this by increasing the iteration count when a loop is detected.
When matching the chain, the iteration count would be added up, finally we need to compute the average value when printing out.
For example,
$ perf report --branch-history --stdio --no-children
Before:
---f2 +0
|
|--33.62%--f1 +9 (cycles:1)
| f1 +0
| main +22 (cycles:1)
| main +17
| main +38 (cycles:1)
| main +27
| f1 +26 (cycles:1)
| f1 +24
| f2 +27 (cycles:7)
| f2 +0
| f1 +19 (cycles:1)
| f1 +14
| f2 +27 (cycles:11)
| f2 +0
| f1 +9 (cycles:1 iter:2968 avg_cycles:3)
| f1 +0
| main +22 (cycles:1 iter:2968 avg_cycles:3)
| main +17
| main +38 (cycles:1 iter:2968 avg_cycles:3)2968 is an impossible high iteration count and avg_cycles is too small.
After:
---f2 +0
|
|--33.62%--f1 +9 (cycles:1)
| f1 +0
| main +22 (cycles:1)
| main +17
| main +38 (cycles:1)
| main +27
| f1 +26 (cycles:1)
| f1 +24
| f2 +27 (cycles:7)
| f2 +0
| f1 +19 (cycles:1)
| f1 +14
| f2 +27 (cycles:11)
| f2 +0
| f1 +9 (cycles:1 iter:1 avg_cycles:23)
| f1 +0
| main +22 (cycles:1 iter:1 avg_cycles:23)
| main +17
| main +38 (cycles:1 iter:1 avg_cycles:23)avg_cycles:23 is the average cycles of this iteration.
--- tools/perf/util/callchain.c | 32 ++++++++++++++++++++------------ tools/perf/util/callchain.h | 1 + tools/perf/util/machine.c | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-)
tools/perf/util/callchain.c +20 -12
@@ -766,6 +766,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node, cnode->cycles_count += node->branch_flags.cycles; cnode->iter_count += node->nr_loop_iter; cnode->iter_cycles += node->iter_cycles; + cnode->from_count++; } }
@@ -1345,10 +1346,10 @@ static int branch_to_str(char *bf, int bfsize,static int branch_from_str (char *bf,int bfsize,u64 branch_count,u64 cycles_count,u64 iter_count, -u64 iter_cycles) +u64 iter_cycles,u64 from_count) {int printed =0 , i =0 ; -u64 cycles; +u64 cycles, v =0 ; cycles = cycles_count / branch_count;if (cycles) {
@@ -1357,14 +1358,16 @@ static int branch_from_str(char *bf, int bfsize, bf + printed, bfsize - printed); } -if (iter_count) { - printed +=count_pri64_printf (i++,"iter" , - iter_count, - bf + printed, bfsize - printed); +if (iter_count && from_count) { + v = iter_count / from_count; +if (v) { + printed +=count_pri64_printf (i++,"iter" , + v, bf + printed, bfsize - printed); - printed +=count_pri64_printf (i++,"avg_cycles" , - iter_cycles / iter_count, - bf + printed, bfsize - printed); + printed +=count_pri64_printf (i++,"avg_cycles" , + iter_cycles / iter_count, + bf + printed, bfsize - printed); + } }if (i)
@@ -1377,6 +1380,7 @@ static int counts_str_build(char *bf, int bfsize, u64 branch_count, u64 predicted_count, u64 abort_count, u64 cycles_count, u64 iter_count, u64 iter_cycles, + u64 from_count, struct branch_type_stat *brtype_stat) { int printed;
@@ -1389,7 +1393,8 @@ static int counts_str_build(char *bf, int bfsize, predicted_count, abort_count, brtype_stat); }else { printed =branch_from_str (bf, bfsize, branch_count, - cycles_count, iter_count, iter_cycles); + cycles_count, iter_count, iter_cycles, + from_count); }if (!printed)
@@ -1402,13 +1407,14 @@ static int callchain_counts_printf(FILE *fp, char *bf, int bfsize, u64 branch_count, u64 predicted_count, u64 abort_count, u64 cycles_count, u64 iter_count, u64 iter_cycles, + u64 from_count, struct branch_type_stat *brtype_stat) { char str[256];counts_str_build (str,sizeof (str), branch_count, predicted_count, abort_count, cycles_count, - iter_count, iter_cycles, brtype_stat); + iter_count, iter_cycles, from_count, brtype_stat);if (fp)return fprintf (fp,"%s" , str);
@@ -1422,6 +1428,7 @@ int callchain_list_counts__printf_value(struct callchain_list *clist,u64 branch_count, predicted_count;u64 abort_count, cycles_count;u64 iter_count, iter_cycles; +u64 from_count; branch_count = clist->branch_count; predicted_count = clist->predicted_count;
@@ -1429,11 +1436,12 @@ int callchain_list_counts__printf_value(struct callchain_list *clist, cycles_count = clist->cycles_count; iter_count = clist->iter_count; iter_cycles = clist->iter_cycles; + from_count = clist->from_count;return callchain_counts_printf (fp, bf, bfsize, branch_count, predicted_count, abort_count, cycles_count, iter_count, iter_cycles, - &clist->brtype_stat); + from_count, &clist->brtype_stat); }static void free_callchain_node (struct callchain_node *node)
tools/perf/util/callchain.h +1 -0
@@ -118,6 +118,7 @@ struct callchain_list {bool has_children; };u64 branch_count; +u64 from_count;u64 predicted_count;u64 abort_count;u64 cycles_count;
tools/perf/util/machine.c +1 -1
@@ -2005,7 +2005,7 @@ static void save_iterations(struct iterations *iter, {int i; - iter->nr_loop_iter = nr; + iter->nr_loop_iter++; iter->cycles =0 ;for (i =0 ; i < nr; i++)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 8/92 perf test shell: Use a fallback to get the pathname in vfs_getname
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 03fa483821c0b4db7c2b1453d3332f397d82313f ]
Some kernels, like 4.19.13-300.fc29.x86_64 in fedora 29, fail with the existing probe definition asking for the contents of result->name, working when we ask for the 'filename' variable instead, so add a fallback to that.
Now those tests are back working on fedora 29 systems with that kernel:
# perf test vfs_getname 65: Use vfs_getname probe to get syscall args filenames : Ok 66: Add vfs_getname probe to get syscall args filenames : Ok 67: Check open filename arg using perf trace + vfs_getname: Ok #
--- tools/perf/tests/shell/lib/probe_vfs_getname.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/tests/shell/lib/probe_vfs_getname.sh +2 -1
@@ -13,7 +13,8 @@ add_probe_vfs_getname() { local verbose=$1 if [ $had_vfs_getname -eq 1 ] ; then line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/') - perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string" + perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \ + perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string" fi }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 9/92 soc: renesas: r8a774c0-sysc: Fix initialization order of 3DG-{A,B}
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a64597227d0de5610407fcc95dc835745a53f5d0 ]
The workaround for the wrong hierarchy of the 3DG-{A,B} power domains on RZ/G2E ES1.0 corrected the parent domains. However, the 3DG-{A,B} power domains were still initialized and powered in the wrong order, causing 3DG operation to fail.
Fix this by changing the order in the table at runtime, when running on an affected SoC.
This work is based on the work done by Geert for R-Car E3.
--- drivers/soc/renesas/r8a774c0-sysc.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-)
drivers/soc/renesas/r8a774c0-sysc.c +4 -19
@@ -28,19 +28,6 @@ static struct rcar_sysc_area r8a774c0_areas[] __initdata = { { "3dg-b", 0x100, 1, R8A774C0_PD_3DG_B, R8A774C0_PD_3DG_A }, }; -static void __init rcar_sysc_fix_parent (struct rcar_sysc_area *areas, -unsigned int num_areas,u8 id, -int new_parent) -{ -unsigned int i; - -for (i =0 ; i < num_areas; i++) -if (areas[i].isr_bit == id) { - areas[i].parent = new_parent; -return ; - } -} -/* Fixups for RZ/G2E ES1.0 revision */ static const struct soc_device_attribute r8a774c0[]__initconst = { { .soc_id = "r8a774c0", .revision = "ES1.0" },
@@ -50,12 +37,10 @@ static const struct soc_device_attribute r8a774c0[] __initconst = {static int __init r8a774c0_sysc_init (void ) {if (soc_device_match (r8a774c0)) { -rcar_sysc_fix_parent (r8a774c0_areas, -ARRAY_SIZE (r8a774c0_areas), -R8A774C0_PD_3DG_A ,R8A774C0_PD_3DG_B ); -rcar_sysc_fix_parent (r8a774c0_areas, -ARRAY_SIZE (r8a774c0_areas), -R8A774C0_PD_3DG_B ,R8A774C0_PD_ALWAYS_ON ); +/* Fix incorrect 3DG hierarchy */ +swap (r8a774c0_areas[6 ], r8a774c0_areas[7 ]); + r8a774c0_areas[6 ].parent =R8A774C0_PD_ALWAYS_ON ; + r8a774c0_areas[7 ].parent =R8A774C0_PD_3DG_B ; }return 0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 10/92 tools uapi: fix RISC-V 64-bit support
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d0df00e30e4bf9bc27ddbd092ad683ff6121b360 ]
The BPF library is not built on 64-bit RISC-V, as the BPF feature is not detected. Looking more in details, feature/test-bpf.c fails to build with the following error:
| In file included from /tmp/linux-4.19.12/tools/include/uapi/asm/bitsperlong.h:17, | from /tmp/linux-4.19.12/tools/include/uapi/asm-generic/unistd.h:2, | from /usr/include/riscv64-linux-gnu/asm/unistd.h:1, | from test-bpf.c:2: | /tmp/linux-4.19.12/tools/include/asm-generic/bitsperlong.h:14:2: error: #error Inconsistent word size. Check asm/bitsperlong.h | #error Inconsistent word size. Check asm/bitsperlong.h | ^~~~~
The UAPI from the tools directory is missing RISC-V support, therefore bitsperlong.h from asm-generic is used, defaulting to 32 bits.
Fix that by adding tools/arch/riscv/include/uapi/asm/bitsperlong.h as a copy of arch/riscv/include/uapi/asm/bitsperlong.h and by updating tools/include/uapi/asm/bitsperlong.h.
--- .../arch/riscv/include/uapi/asm/bitsperlong.h | 25 +++++++++++++++++++ tools/include/uapi/asm/bitsperlong.h | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h
tools/arch/riscv/include/uapi/asm/bitsperlong.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2012 ARM Ltd. +* Copyright (C) 2015 Regents of the University of California +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H +#define _UAPI_ASM_RISCV_BITSPERLONG_H + +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8) + +#include <asm-generic/bitsperlong.h> + +#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
tools/include/uapi/asm/bitsperlong.h +2 -0
@@ -13,6 +13,8 @@#include "../../arch/mips/include/uapi/asm/bitsperlong.h" #elif defined(__ia64__)#include "../../arch/ia64/include/uapi/asm/bitsperlong.h" +#elif defined(__riscv) +#include "../../arch/riscv/include/uapi/asm/bitsperlong.h" #else #include <asm-generic/bitsperlong.h> #endif
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 11/92 riscv: fix trace_sys_exit hook
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 775800b0f1d7303d4fd8ce0e0d9eca4ff2f338f2 ]
Fix compilation error.
--- arch/riscv/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/ptrace.c +1 -1
@@ -172,6 +172,6 @@ void do_syscall_trace_exit(struct pt_regs *regs)#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS if (test_thread_flag (TIF_SYSCALL_TRACEPOINT )) -trace_sys_exit (regs, regs->regs[0 ]); +trace_sys_exit (regs,regs_return_value (regs));#endif }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 12/92 cpufreq: check if policy is inactive early in __cpufreq_get()
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2f66196208c98b3d1b4294edffb2c5a8197be899 ]
cpuinfo_cur_freq gets current CPU frequency as detected by hardware while scaling_cur_freq last known CPU frequency. Some platforms may not allow checking the CPU frequency of an offline CPU or the associated resources may have been released via cpufreq_exit when the CPU gets offlined, in which case the policy would have been invalidated already. If we attempt to get current frequency from the hardware, it may result in hang or crash.
For example on Juno, I see:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000188 [0000000000000188] pgd=0000000000000000 Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: CPU: 5 PID: 4202 Comm: cat Not tainted 4.20.0-08251-ga0f2c0318a15-dirty #87 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform pstate: 40000005 (nZcv daif -PAN -UAO) pc : scmi_cpufreq_get_rate+0x34/0xb0 lr : scmi_cpufreq_get_rate+0x34/0xb0 Call trace: scmi_cpufreq_get_rate+0x34/0xb0 __cpufreq_get+0x34/0xc0 show_cpuinfo_cur_freq+0x24/0x78 show+0x40/0x60 sysfs_kf_seq_show+0xc0/0x148 kernfs_seq_show+0x44/0x50 seq_read+0xd4/0x480 kernfs_fop_read+0x15c/0x208 __vfs_read+0x60/0x188 vfs_read+0x94/0x150 ksys_read+0x6c/0xd8 __arm64_sys_read+0x24/0x30 el0_svc_common+0x78/0x100 el0_svc_handler+0x38/0x78 el0_svc+0x8/0xc ---[ end trace 3d1024e58f77f6b2 ]---
So fix the issue by checking if the policy is invalid early in __cpufreq_get before attempting to get the current frequency.
--- drivers/cpufreq/cpufreq.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/cpufreq/cpufreq.c +4 -8
@@ -1530,17 +1530,16 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy) {unsigned int ret_freq =0 ; -if (!cpufreq_driver->get) +if (unlikely (policy_is_inactive (policy)) || !cpufreq_driver->get)return ret_freq; ret_freq = cpufreq_driver->get (policy->cpu);/* -* Updating inactive policies is invalid, so avoid doing that. Also -* if fast frequency switching is used with the given policy, the check +* If fast frequency switching is used with the given policy, the check * against policy->cur is pointless, so skip it in that case too. */ -if (unlikely (policy_is_inactive (policy)) || policy->fast_switch_enabled) +if (policy->fast_switch_enabled)return ret_freq; if (ret_freq && policy->cur &&
@@ -1569,10 +1568,7 @@ unsigned int cpufreq_get(unsigned int cpu)if (policy) {down_read (&policy->rwsem); - -if (!policy_is_inactive (policy)) - ret_freq =__cpufreq_get (policy); - + ret_freq =__cpufreq_get (policy);up_read (&policy->rwsem);cpufreq_cpu_put (policy);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 13/92 csky: fixup relocation error with 807 & 860
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f553aa1c13cbc29aaf420349a28fc33ca98440e5 ]
810 doesn't support jsri instruction and csky-as will leave jsri + nop for relocation. Module-probe need replace them with lrw + jsr.
--- arch/csky/kernel/module.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-)
arch/csky/kernel/module.c +22 -16
@@ -12,7 +12,7 @@#include <linux/spinlock.h> #include <asm/pgtable.h> -#if defined(__CSKYABIV2__) +#ifdef CONFIG_CPU_CK810 #define IS_BSR32 (hi16, lo16) (((hi16) & 0xFC00) == 0xE000)#define IS_JSRI32 (hi16, lo16) ((hi16) == 0xEAE0)
@@ -25,6 +25,26 @@ *(uint16_t *)(addr) =0xE8Fa ; \ *((uint16_t *)(addr) +1 ) =0x0000 ; \ } while (0) + +static void jsri_2_lrw_jsr(uint32_t *location) +{ +uint16_t location_tmp = (uint16_t *)location; + +if (IS_BSR32 (*location_tmp, *(location_tmp +1 ))) +return ; + +if (IS_JSRI32 (*location_tmp, *(location_tmp +1 ))) { +/* jsri 0x... --> lrw r26, 0x... */ +CHANGE_JSRI_TO_LRW (location); +/* lsli r0, r0 --> jsr r26 */ +SET_JSR32_R26 (location +1 ); + } +} +#else +static void inline jsri_2_lrw_jsr (uint32_t *location) +{ +return ; +}#endif int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
@@ -35,9 +55,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,Elf32_Sym *sym;uint32_t *location;short *temp; -#if defined(__CSKYABIV2__) -uint16_t *location_tmp; -#endif for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
@@ -59,18 +76,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,case R_CSKY_PCRELJSR_IMM11BY2 :break ;case R_CSKY_PCRELJSR_IMM26BY2 : -#if defined(__CSKYABIV2__) - location_tmp = (uint16_t *)location; -if (IS_BSR32 (*location_tmp, *(location_tmp +1 ))) -break ; - -if (IS_JSRI32 (*location_tmp, *(location_tmp +1 ))) { -/* jsri 0x... --> lrw r26, 0x... */ -CHANGE_JSRI_TO_LRW (location); -/* lsli r0, r0 --> jsr r26 */ -SET_JSR32_R26 (location +1 ); - } -#endif +jsri_2_lrw_jsr (location);break ;case R_CSKY_ADDR_HI16 : temp = ((short *)location) +1 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 14/92 csky: fixup CACHEV1 store instruction fast retire
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 96354ad79e2e59f9d620669c8e1ac2452440c260 ]
For I/O access, 810/807 store instruction fast retire will cause wrong primitive. For example:
stw (clear interrupt source)
stw (unmask interrupt controller)
enable interrupt
stw is fast retire instruction. When PC is run at enable interrupt stage, the clear interrupt source hasn't finished. It will cause another wrong irq-enter.
So use mb() to prevent above.
--- arch/csky/include/asm/io.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/csky/include/asm/io.h +25 -0
@@ -15,6 +15,31 @@ extern void iounmap(void *addr);extern int remap_area_pages (unsigned long address,phys_addr_t phys_addr,size_t size,unsigned long flags); +/* +* I/O memory access primitives. Reads are ordered relative to any +* following Normal memory access. Writes are ordered relative to any prior +* Normal memory access. +* +* For CACHEV1 (807, 810), store instruction could fast retire, so we need +* another mb() to prevent st fast retire. +* +* For CACHEV2 (860), store instruction with PAGE_ATTR_NO_BUFFERABLE won't +* fast retire. +*/ +#define readb (c) ({ u8 __v = readb_relaxed(c); rmb(); __v; }) +#define readw (c) ({ u16 __v = readw_relaxed(c); rmb(); __v; }) +#define readl (c) ({ u32 __v = readl_relaxed(c); rmb(); __v; }) + +#ifdef CONFIG_CPU_HAS_CACHEV2 +#define writeb (v,c) ({ wmb(); writeb_relaxed((v),(c)); }) +#define writew (v,c) ({ wmb(); writew_relaxed((v),(c)); }) +#define writel (v,c) ({ wmb(); writel_relaxed((v),(c)); }) +#else +#define writeb (v,c) ({ wmb(); writeb_relaxed((v),(c)); mb(); }) +#define writew (v,c) ({ wmb(); writew_relaxed((v),(c)); mb(); }) +#define writel (v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); }) +#endif +#define ioremap_nocache (phy, sz) ioremap(phy, sz)#define ioremap_wc ioremap_nocache#define ioremap_wt ioremap_nocache
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 15/92 csky: fixup compile error with pte_alloc
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2a60aa14a9a0333b3eef58150bc1ef654f7321ef ]
Commit: 4cf58924951e remove the address argument of pte_alloc without modify csky related code. linux-5.0-rc1 compile failed with csky.
Remove the unnecessary address testing in pte_alloc().
--- arch/csky/include/asm/pgalloc.h | 43 ++++++++++++++------------------- 1 file changed, 18 insertions(+), 25 deletions(-)
arch/csky/include/asm/pgalloc.h +18 -25
@@ -24,41 +24,34 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,extern void pgd_init (unsigned long *p); -static inline pte_t *pte_alloc_one_kernel (struct mm_struct *mm, -unsigned long address) +static inline pte_t *pte_alloc_one_kernel (struct mm_struct *mm) {pte_t *pte; -unsigned long *kaddr, i; +unsigned long i; - pte = (pte_t *)__get_free_pages (GFP_KERNEL | __GFP_RETRY_MAYFAIL, -PTE_ORDER ); - kaddr = (unsigned long *)pte; -if (address &0x80000000 ) -for (i =0 ; i < (PAGE_SIZE /4 ); i++) - *(kaddr + i) =0x1 ; -else -clear_page (kaddr); + pte = (pte_t *)__get_free_page (GFP_KERNEL ); +if (!pte) +return NULL ; + +for (i =0 ; i <PAGE_SIZE /sizeof (pte_t); i++) + (pte + i)->pte_low = _PAGE_GLOBAL;return pte; } -static inline struct page *pte_alloc_one (struct mm_struct *mm, -unsigned long address) +static inline struct page *pte_alloc_one (struct mm_struct *mm) {struct page *pte; -unsigned long *kaddr, i; - - pte =alloc_pages (GFP_KERNEL | __GFP_RETRY_MAYFAIL,PTE_ORDER ); -if (pte) { - kaddr =kmap_atomic (pte); -if (address &0x80000000 ) { -for (i =0 ; i < (PAGE_SIZE /4 ); i++) - *(kaddr + i) =0x1 ; - }else -clear_page (kaddr); -kunmap_atomic (kaddr); -pgtable_page_ctor (pte); + + pte =alloc_pages (GFP_KERNEL | __GFP_ZERO,0 ); +if (!pte) +return NULL ; + +if (!pgtable_page_ctor (pte)) { +__free_page (pte); +return NULL ; } +return pte; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 16/92 irqchip/csky: fixup handle_irq_perbit break irq
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 56752b21755aef598709d143684cb363db98a7d2 ]
The handle_irq_perbit function loop every bit in hwirq local variable.
handle_irq_perbit(hwirq) {
for_everyt_bit_in(hwirq) {
handle_domain_irq()
->irq_exit()
->invoke_softirq()
->__do_softirq()
->local_irq_enable() // Here will cause new interrupt. }
}
When new interrupt coming at local_irq_enable, it will finish another interrupt handler and pull down the interrupt source. But hwirq is the local variable for handle_irq_perbit(), it can't get new interrupt controller pending reg status. So we need update hwirq with pending reg in every loop.
Also change write_relax to writel could prevent stw from fast retire. When local_irq is enabled, intc regs is really set-in.
--- drivers/irqchip/irq-csky-apb-intc.c | 77 ++++++++++++++++------------- 1 file changed, 42 insertions(+), 35 deletions(-)
drivers/irqchip/irq-csky-apb-intc.c +42 -35
@@ -95,7 +95,7 @@ static inline void setup_irq_channel(u32 magic, void __iomem *reg_addr)/* Setup 64 channel slots */ for (i =0 ; i <INTC_IRQS ; i +=4 ) -writel_relaxed (build_channel_val (i, magic), reg_addr + i); +writel (build_channel_val (i, magic), reg_addr + i); } static int __init
@@ -135,16 +135,10 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent)static inline bool handle_irq_perbit (struct pt_regs *regs,u32 hwirq,u32 irq_base) { -u32 irq; -if (hwirq ==0 )return 0 ; -while (hwirq) { - irq =__ffs (hwirq); - hwirq &= ~BIT (irq); -handle_domain_irq (root_domain, irq_base + irq, regs); - } +handle_domain_irq (root_domain, irq_base +__fls (hwirq), regs);return 1 ; }
@@ -154,12 +148,16 @@ static void gx_irq_handler(struct pt_regs *regs) {bool ret; -do { - ret =handle_irq_perbit (regs, -readl_relaxed (reg_base +GX_INTC_PEN31_00 ),0 ); - ret |=handle_irq_perbit (regs, -readl_relaxed (reg_base +GX_INTC_PEN63_32 ),32 ); - }while (ret); +retry: + ret =handle_irq_perbit (regs, +readl (reg_base +GX_INTC_PEN63_32 ),32 ); +if (ret) + goto retry; + + ret =handle_irq_perbit (regs, +readl (reg_base +GX_INTC_PEN31_00 ),0 ); +if (ret) + goto retry; } static int __init
@@ -174,14 +172,14 @@ gx_intc_init(struct device_node *node, struct device_node *parent)/* * Initial enable reg to disable all interrupts */ -writel_relaxed (0x0 , reg_base +GX_INTC_NEN31_00 ); -writel_relaxed (0x0 , reg_base +GX_INTC_NEN63_32 ); +writel (0x0 , reg_base +GX_INTC_NEN31_00 ); +writel (0x0 , reg_base +GX_INTC_NEN63_32 );/* * Initial mask reg with all unmasked, because we only use enalbe reg */ -writel_relaxed (0x0 , reg_base +GX_INTC_NMASK31_00 ); -writel_relaxed (0x0 , reg_base +GX_INTC_NMASK63_32 ); +writel (0x0 , reg_base +GX_INTC_NMASK31_00 ); +writel (0x0 , reg_base +GX_INTC_NMASK63_32 );setup_irq_channel (0x03020100 , reg_base +GX_INTC_SOURCE );
@@ -204,20 +202,29 @@ static void ck_irq_handler(struct pt_regs *regs)void __iomem *reg_pen_lo = reg_base +CK_INTC_PEN31_00 ;void __iomem *reg_pen_hi = reg_base +CK_INTC_PEN63_32 ; -do { -/* handle 0 - 31 irqs */ - ret =handle_irq_perbit (regs,readl_relaxed (reg_pen_lo),0 ); - ret |=handle_irq_perbit (regs,readl_relaxed (reg_pen_hi),32 ); +retry: +/* handle 0 - 63 irqs */ + ret =handle_irq_perbit (regs,readl (reg_pen_hi),32 ); +if (ret) + goto retry; -if (nr_irq ==INTC_IRQS ) -continue ; + ret =handle_irq_perbit (regs,readl (reg_pen_lo),0 ); +if (ret) + goto retry; + +if (nr_irq ==INTC_IRQS ) +return ; -/* handle 64 - 127 irqs */ - ret |=handle_irq_perbit (regs, -readl_relaxed (reg_pen_lo +CK_INTC_DUAL_BASE ),64 ); - ret |=handle_irq_perbit (regs, -readl_relaxed (reg_pen_hi +CK_INTC_DUAL_BASE ),96 ); - }while (ret); +/* handle 64 - 127 irqs */ + ret =handle_irq_perbit (regs, +readl (reg_pen_hi +CK_INTC_DUAL_BASE ),96 ); +if (ret) + goto retry; + + ret =handle_irq_perbit (regs, +readl (reg_pen_lo +CK_INTC_DUAL_BASE ),64 ); +if (ret) + goto retry; } static int __init
@@ -230,11 +237,11 @@ ck_intc_init(struct device_node *node, struct device_node *parent)return ret;/* Initial enable reg to disable all interrupts */ -writel_relaxed (0 , reg_base +CK_INTC_NEN31_00 ); -writel_relaxed (0 , reg_base +CK_INTC_NEN63_32 ); +writel (0 , reg_base +CK_INTC_NEN31_00 ); +writel (0 , reg_base +CK_INTC_NEN63_32 );/* Enable irq intc */ -writel_relaxed (BIT (31 ), reg_base +CK_INTC_ICR ); +writel (BIT (31 ), reg_base +CK_INTC_ICR );ck_set_gc (node, reg_base,CK_INTC_NEN31_00 ,0 );ck_set_gc (node, reg_base,CK_INTC_NEN63_32 ,32 );
@@ -260,8 +267,8 @@ ck_dual_intc_init(struct device_node *node, struct device_node *parent)return ret;/* Initial enable reg to disable all interrupts */ -writel_relaxed (0 , reg_base +CK_INTC_NEN31_00 +CK_INTC_DUAL_BASE ); -writel_relaxed (0 , reg_base +CK_INTC_NEN63_32 +CK_INTC_DUAL_BASE ); +writel (0 , reg_base +CK_INTC_NEN31_00 +CK_INTC_DUAL_BASE ); +writel (0 , reg_base +CK_INTC_NEN63_32 +CK_INTC_DUAL_BASE );ck_set_gc (node, reg_base +CK_INTC_DUAL_BASE ,CK_INTC_NEN31_00 ,64 );ck_set_gc (node, reg_base +CK_INTC_DUAL_BASE ,CK_INTC_NEN63_32 ,96 );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 17/92 drm/amd/powerplay: avoid possible buffer overflow
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit fff0d3f7686942bd544b53a48d1b76bd62c46946 ]
Make sure the clock level enforced is within the allowed ranges.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +14 -0
@@ -2244,6 +2244,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, soft_min_level = mask ? (ffs (mask) -1 ) :0 ; soft_max_level = mask ? (fls (mask) -1 ) :0 ; +if (soft_max_level >= data->dpm_table.gfx_table.count) { +pr_err ("Clock level specified %d is over max allowed %d\n" , + soft_max_level, + data->dpm_table.gfx_table.count -1 ); +return -EINVAL ; + } + data->dpm_table.gfx_table.dpm_state.soft_min_level = data->dpm_table.gfx_table.dpm_levels[soft_min_level].value; data->dpm_table.gfx_table.dpm_state.soft_max_level =
@@ -2264,6 +2271,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, soft_min_level = mask ? (ffs (mask) -1 ) :0 ; soft_max_level = mask ? (fls (mask) -1 ) :0 ; +if (soft_max_level >= data->dpm_table.mem_table.count) { +pr_err ("Clock level specified %d is over max allowed %d\n" , + soft_max_level, + data->dpm_table.mem_table.count -1 ); +return -EINVAL ; + } + data->dpm_table.mem_table.dpm_state.soft_min_level = data->dpm_table.mem_table.dpm_levels[soft_min_level].value; data->dpm_table.mem_table.dpm_state.soft_max_level =
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 18/92 drm/bridge: tc358767: add bus flags
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4842379cbe6e851de914a7132f76f4e200b9a98b ]
tc358767 driver does not set DRM bus_flags, even if it does configures the polarity settings into its registers. This means that the DPI source can't configure the polarities correctly.
Add sync flags accordingly.
--- drivers/gpu/drm/bridge/tc358767.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/bridge/tc358767.c +4 -0
@@ -1195,6 +1195,10 @@ static int tc_bridge_attach(struct drm_bridge *bridge)drm_display_info_set_bus_formats (&tc->connector.display_info, &bus_format,1 ); + tc->connector.display_info.bus_flags = +DRM_BUS_FLAG_DE_HIGH | +DRM_BUS_FLAG_PIXDATA_NEGEDGE | +DRM_BUS_FLAG_SYNC_NEGEDGE ;drm_connector_attach_encoder (&tc->connector, tc->bridge.encoder);return 0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 19/92 drm/bridge: tc358767: add defines for DP1_SRCCTRL & PHY_2LANE
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit adf4109896bbee27fd2ac3b48d22d6a0062fe517 ]
DP1_SRCCTRL register and PHY_2LANE field did not have matching defines. Add these.
--- drivers/gpu/drm/bridge/tc358767.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/tc358767.c +7 -3
@@ -142,6 +142,8 @@#define DP0_LTLOOPCTRL 0x06d8#define DP0_SNKLTCTRL 0x06e4 +#define DP1_SRCCTRL 0x07a0 +/* PHY */ #define DP_PHY_CTRL 0x0800#define DP_PHY_RST BIT(28)/* DP PHY Global Soft Reset */
@@ -150,6 +152,7 @@#define PHY_M1_RST BIT(12)/* Reset PHY1 Main Channel */ #define PHY_RDY BIT(16)/* PHY Main Channels Ready */ #define PHY_M0_RST BIT(8)/* Reset PHY0 Main Channel */ +#define PHY_2LANE BIT(2)/* PHY Enable 2 lanes */ #define PHY_A0_EN BIT(1)/* PHY Aux Channel0 Enable */ #define PHY_M0_EN BIT(0)/* PHY Main Channel0 Enable */
@@ -564,7 +567,7 @@ static int tc_aux_link_setup(struct tc_data *tc) value |=SYSCLK_SEL_LSCLK |LSCLK_DIV_2 ;tc_write (SYS_PLLPARAM , value); -tc_write (DP_PHY_CTRL ,BGREN |PWR_SW_EN |BIT (2 ) |PHY_A0_EN ); +tc_write (DP_PHY_CTRL ,BGREN |PWR_SW_EN |PHY_2LANE |PHY_A0_EN );/* * Initially PLLs are in bypass. Force PLL parameter update,
@@ -834,7 +837,7 @@ static int tc_main_link_setup(struct tc_data *tc)DP0_SRCCTRL_LANESKEW |DP0_SRCCTRL_LANES_2 | DP0_SRCCTRL_BW27 | DP0_SRCCTRL_AUTOCORRECT);/* from excel file - DP1_SrcCtrl */ -tc_write (0x07a0 ,0x00003083 ); +tc_write (DP1_SRCCTRL ,0x00003083 ); rate =clk_get_rate (tc->refclk);switch (rate) {
@@ -855,8 +858,9 @@ static int tc_main_link_setup(struct tc_data *tc) } value |=SYSCLK_SEL_LSCLK |LSCLK_DIV_2 ;tc_write (SYS_PLLPARAM , value); +/* Setup Main Link */ - dp_phy_ctrl =BGREN |PWR_SW_EN |BIT (2 ) |PHY_A0_EN |PHY_M0_EN ; + dp_phy_ctrl =BGREN |PWR_SW_EN |PHY_2LANE |PHY_A0_EN |PHY_M0_EN ;tc_write (DP_PHY_CTRL , dp_phy_ctrl);msleep (100 );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 20/92 drm/bridge: tc358767: fix single lane configuration
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4d9d54a730434cc068dd3515ba6116697196f77b ]
PHY_2LANE bit is always set in DP_PHY_CTRL, breaking 1 lane use.
Set PHY_2LANE only when 2 lanes are used.
--- drivers/gpu/drm/bridge/tc358767.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/tc358767.c +8 -2
@@ -543,6 +543,7 @@ static int tc_aux_link_setup(struct tc_data *tc)unsigned long rate;u32 value;int ret; +u32 dp_phy_ctrl; rate =clk_get_rate (tc->refclk);switch (rate) {
@@ -567,7 +568,10 @@ static int tc_aux_link_setup(struct tc_data *tc) value |=SYSCLK_SEL_LSCLK |LSCLK_DIV_2 ;tc_write (SYS_PLLPARAM , value); -tc_write (DP_PHY_CTRL ,BGREN |PWR_SW_EN |PHY_2LANE |PHY_A0_EN ); + dp_phy_ctrl =BGREN |PWR_SW_EN |PHY_A0_EN ; +if (tc->link.base.num_lanes ==2 ) + dp_phy_ctrl |=PHY_2LANE ; +tc_write (DP_PHY_CTRL , dp_phy_ctrl);/* * Initially PLLs are in bypass. Force PLL parameter update,
@@ -860,7 +864,9 @@ static int tc_main_link_setup(struct tc_data *tc)tc_write (SYS_PLLPARAM , value);/* Setup Main Link */ - dp_phy_ctrl =BGREN |PWR_SW_EN |PHY_2LANE |PHY_A0_EN |PHY_M0_EN ; + dp_phy_ctrl =BGREN |PWR_SW_EN |PHY_A0_EN |PHY_M0_EN ; +if (tc->link.base.num_lanes ==2 ) + dp_phy_ctrl |=PHY_2LANE ;tc_write (DP_PHY_CTRL , dp_phy_ctrl);msleep (100 );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 21/92 drm/bridge: tc358767: fix initial DP0/1_SRCCTRL value
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9a63bd6fe1b5590ffa42ae2ed22ee21363293e31 ]
Initially DP0_SRCCTRL is set to a static value which includes DP0_SRCCTRL_LANES_2 and DP0_SRCCTRL_BW27, even when only 1 lane of 1.62Gbps speed is used. DP1_SRCCTRL is configured to a magic number.
This patch changes the configuration as follows:
Configure DP0_SRCCTRL by using tc_srcctrl() which provides the correct value.
DP1_SRCCTRL needs two bits to be set to the same value as DP0_SRCCTRL:
SSCG and BW27. All other bits can be zero.
--- drivers/gpu/drm/bridge/tc358767.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/tc358767.c +5 -6
@@ -836,12 +836,11 @@ static int tc_main_link_setup(struct tc_data *tc)if (!tc->mode)return -EINVAL ; -/* from excel file - DP0_SrcCtrl */ -tc_write (DP0_SRCCTRL ,DP0_SRCCTRL_SCRMBLDIS |DP0_SRCCTRL_EN810B | -DP0_SRCCTRL_LANESKEW |DP0_SRCCTRL_LANES_2 | -DP0_SRCCTRL_BW27 |DP0_SRCCTRL_AUTOCORRECT ); -/* from excel file - DP1_SrcCtrl */ -tc_write (DP1_SRCCTRL ,0x00003083 ); +tc_write (DP0_SRCCTRL ,tc_srcctrl (tc)); +/* SSCG and BW27 on DP1 must be set to the same as on DP0 */ +tc_write (DP1_SRCCTRL , + (tc->link.spread ?DP0_SRCCTRL_SSCG :0 ) | + ((tc->link.base.rate !=162000 ) ?DP0_SRCCTRL_BW27 :0 )); rate =clk_get_rate (tc->refclk);switch (rate) {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 22/92 drm/bridge: tc358767: reject modes which require too much BW
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 51b9e62eb6950c762162ab7eb8390990179be067 ]
The current driver accepts any videomode with pclk < 154MHz. This is not correct, as with 1 lane and/or 1.62Mbps speed not all videomodes can be supported.
Add code to reject modes that require more bandwidth that is available.
--- drivers/gpu/drm/bridge/tc358767.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/bridge/tc358767.c +10 -0
@@ -1114,10 +1114,20 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge,static enum drm_mode_status tc_connector_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) { +struct tc_data *tc =connector_to_tc (connector); +u32 req, avail; +u32 bits_per_pixel =24 ; +/* DPI interface clock limitation: upto 154 MHz */ if (mode->clock >154000 )return MODE_CLOCK_HIGH ; + req = mode->clock * bits_per_pixel /8 ; + avail = tc->link.base.num_lanes * tc->link.base.rate; + +if (req > avail) +return MODE_BAD ; +return MODE_OK ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 23/92 drm/bridge: tc358767: fix output H/V syncs
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 7923e09c7a766e2d58de7fc395bb84c18e5bc625 ]
The H and V syncs of the DP output are always set to active high. This patch fixes the syncs by configuring them according to the videomode.
--- drivers/gpu/drm/bridge/tc358767.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358767.c +5 -1
@@ -98,6 +98,8 @@#define DP0_STARTVAL 0x064c#define DP0_ACTIVEVAL 0x0650#define DP0_SYNCVAL 0x0654 +#define SYNCVAL_HS_POL_ACTIVE_LOW (1 << 15) +#define SYNCVAL_VS_POL_ACTIVE_LOW (1 << 31)#define DP0_MISC 0x0658#define TU_SIZE_RECOMMENDED (63)/* LSCLK cycles per TU */ #define BPC_6 (0 << 5)
@@ -726,7 +728,9 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)tc_write (DP0_ACTIVEVAL , (mode->vdisplay <<16 ) | (mode->hdisplay)); -tc_write (DP0_SYNCVAL , (vsync_len <<16 ) | (hsync_len <<0 )); +tc_write (DP0_SYNCVAL , (vsync_len <<16 ) | (hsync_len <<0 ) | + ((mode->flags &DRM_MODE_FLAG_NHSYNC ) ?SYNCVAL_HS_POL_ACTIVE_LOW :0 ) | + ((mode->flags &DRM_MODE_FLAG_NVSYNC ) ?SYNCVAL_VS_POL_ACTIVE_LOW :0 ));tc_write (DPIPXLFMT ,VS_POL_ACTIVE_LOW |HS_POL_ACTIVE_LOW |DE_POL_ACTIVE_HIGH |SUB_CFG_TYPE_CONFIG1 |DPI_BPP_RGB888 );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 24/92 nvme-pci: use the same attributes when freeing host_mem_desc_bufs.
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit cc667f6d5de023ee131e96bb88e5cddca23272bd ]
When using HMB the PCIe host driver allocates host_mem_desc_bufs using dma_alloc_attrs() but frees them using dma_free_coherent(). Use the correct dma_free_attrs() function to free the buffers.
--- drivers/nvme/host/pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/nvme/host/pci.c +6 -4
@@ -1748,8 +1748,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev)struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i];size_t size =le32_to_cpu (desc->size) * dev->ctrl.page_size; -dma_free_coherent (dev->dev, size, dev->host_mem_desc_bufs[i], -le64_to_cpu (desc->addr)); +dma_free_attrs (dev->dev, size, dev->host_mem_desc_bufs[i], +le64_to_cpu (desc->addr), +DMA_ATTR_NO_KERNEL_MAPPING |DMA_ATTR_NO_WARN ); }kfree (dev->host_mem_desc_bufs);
@@ -1815,8 +1816,9 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,while (--i >=0 ) {size_t size =le32_to_cpu (descs[i].size) * dev->ctrl.page_size; -dma_free_coherent (dev->dev, size, bufs[i], -le64_to_cpu (descs[i].addr)); +dma_free_attrs (dev->dev, size, bufs[i], +le64_to_cpu (descs[i].addr), +DMA_ATTR_NO_KERNEL_MAPPING |DMA_ATTR_NO_WARN ); }kfree (bufs);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 25/92 nvme-pci: fix out of bounds access in nvme_cqe_pending
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit dcca1662727220d18fa351097ddff33f95f516c5 ]
There is an out of bounds array access in nvme_cqe_peding().
When enable irq_thread for nvme interrupt, there is racing between the nvmeq->cq_head updating and reading.
nvmeq->cq_head is updated in nvme_update_cq_head(), if nvmeq->cq_head equals nvmeq->q_depth and before its value set to zero, nvme_cqe_pending() uses its value as an array index, the index will be out of bounds.
--- drivers/nvme/host/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +3 -1
@@ -913,9 +913,11 @@ static void nvme_complete_cqes(struct nvme_queue *nvmeq, u16 start, u16 end)static inline void nvme_update_cq_head (struct nvme_queue *nvmeq) { -if (++nvmeq->cq_head == nvmeq->q_depth) { +if (nvmeq->cq_head == nvmeq->q_depth -1 ) { nvmeq->cq_head =0 ; nvmeq->cq_phase = !nvmeq->cq_phase; + }else { + nvmeq->cq_head++; } }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 26/92 nvme-multipath: zero out ANA log buffer
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c7055fd15ff46d92eb0dd1c16a4fe010d58224c8 ]
When nvme_init_identify() fails the ANA log buffer is deallocated but _not_ set to NULL. This can cause double free oops when this controller is deleted without ever being reconnected.
--- drivers/nvme/host/multipath.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/multipath.c +2 -0
@@ -586,6 +586,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)return 0 ; out_free_ana_log_buf:kfree (ctrl->ana_log_buf); + ctrl->ana_log_buf =NULL ; out:return error; }
@@ -593,5 +594,6 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)void nvme_mpath_uninit (struct nvme_ctrl *ctrl) {kfree (ctrl->ana_log_buf); + ctrl->ana_log_buf =NULL ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 27/92 nvme: pad fake subsys NQN vid and ssvid with zeros
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3da584f57133e51aeb84aaefae5e3d69531a1e4f ]
We need to preserve the leading zeros in the vid and ssvid when generating a unique NQN. Truncating these may lead to naming collisions.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -2095,7 +2095,7 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct/* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */ off =snprintf (subsys->subnqn,NVMF_NQN_SIZE , -"nqn.2014.08.org.nvmexpress:%4x%4x" , +"nqn.2014.08.org.nvmexpress:%04x%04x" ,le16_to_cpu (id->vid),le16_to_cpu (id->ssvid));memcpy (subsys->subnqn + off, id->sn,sizeof (id->sn)); off +=sizeof (id->sn);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 28/92 nvme: introduce NVME_QUIRK_IGNORE_DEV_SUBNQN
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6299358d198a0635da2dd3c4b3ec37789e811e44 ]
If a device provides an NQN it is expected to be globally unique. Unfortunately some firmware revisions for Intel 760p/Pro 7600p devices did not satisfy this requirement. In these circumstances if a system has >1 affected device then only one device is enabled. If this quirk is enabled then the device supplied subnqn is ignored and we fallback to generating one as if the field was empty. In this case we also suppress the version check so we don't print a warning when the quirk is enabled.
--- drivers/nvme/host/core.c | 16 +++++++++------- drivers/nvme/host/nvme.h | 5 +++++ drivers/nvme/host/pci.c | 2 ++ 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/nvme/host/core.c +9 -7
@@ -2084,14 +2084,16 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ctsize_t nqnlen;int off; - nqnlen =strnlen (id->subnqn,NVMF_NQN_SIZE ); -if (nqnlen >0 && nqnlen <NVMF_NQN_SIZE ) { -strlcpy (subsys->subnqn, id->subnqn,NVMF_NQN_SIZE ); -return ; - } +if (!(ctrl->quirks &NVME_QUIRK_IGNORE_DEV_SUBNQN )) { + nqnlen =strnlen (id->subnqn,NVMF_NQN_SIZE ); +if (nqnlen >0 && nqnlen <NVMF_NQN_SIZE ) { +strlcpy (subsys->subnqn, id->subnqn,NVMF_NQN_SIZE ); +return ; + } -if (ctrl->vs >=NVME_VS (1 ,2 ,1 )) -dev_warn (ctrl->device,"missing or invalid SUBNQN field.\n" ); +if (ctrl->vs >=NVME_VS (1 ,2 ,1 )) +dev_warn (ctrl->device,"missing or invalid SUBNQN field.\n" ); + }/* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */ off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
drivers/nvme/host/nvme.h +5 -0
@@ -90,6 +90,11 @@ enum nvme_quirks {* Set MEDIUM priority on SQ creation */ NVME_QUIRK_MEDIUM_PRIO_SQ = (1 <<7 ), + +/* +* Ignore device provided subnqn. +*/ + NVME_QUIRK_IGNORE_DEV_SUBNQN = (1 << 8), };/*
drivers/nvme/host/pci.c +2 -0
@@ -2700,6 +2700,8 @@ static const struct pci_device_id nvme_id_table[] = { { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ .driver_data =NVME_QUIRK_NO_DEEPEST_PS | NVME_QUIRK_MEDIUM_PRIO_SQ }, + { PCI_VDEVICE(INTEL, 0xf1a6), /* Intel 760p/Pro 7600p */ + .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 29/92 drm/amdgpu: fix CPDMA hang in PRT mode for VEGA20
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3e958fe67720b37d04ab8ef81b9d507a56a09bbc ]
Fix CPDMA hang in PRT mode for both VEGA10 and VEGA20
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -5
@@ -112,7 +112,10 @@ static const struct soc15_reg_golden golden_settings_gc_9_0[] =SOC15_REG_GOLDEN_VALUE (GC ,0 , mmTCP_CHAN_STEER_HI,0xffffffff ,0x4a2c0e68 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmTCP_CHAN_STEER_LO,0xffffffff ,0xb5d3f197 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmVGT_CACHE_INVALIDATION,0x3fff3af3 ,0x19200000 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , mmVGT_GS_MAX_WAVE_ID,0x00000fff ,0x000003ff ) +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmVGT_GS_MAX_WAVE_ID,0x00000fff ,0x000003ff ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCP_MEC1_F32_INT_DIS,0x00000000 ,0x00000800 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCP_MEC2_F32_INT_DIS,0x00000000 ,0x00000800 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCP_DEBUG,0x00000000 ,0x00008000 ) }; static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] =
@@ -134,10 +137,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] =SOC15_REG_GOLDEN_VALUE (GC ,0 , mmRMI_UTCL1_CNTL2,0x00030000 ,0x00020000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmSPI_CONFIG_CNTL_1,0x0000000f ,0x01000107 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmTD_CNTL,0x00001800 ,0x00000800 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , mmWD_UTCL1_CNTL,0x08000000 ,0x08000080 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCP_MEC1_F32_INT_DIS,0x00000000 ,0x00000800 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCP_MEC2_F32_INT_DIS,0x00000000 ,0x00000800 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , mmCP_DEBUG,0x00000000 ,0x00008000 ) +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmWD_UTCL1_CNTL,0x08000000 ,0x08000080 ) }; static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] =
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 30/92 drm/amdgpu: set WRITE_BURST_LENGTH to 64B to workaround SDMA1 hang
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 0c6c8125582714e1fd3544983eba3d750db0f5b8 ]
effect asics: VEGA10 and VEGA12
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -1
@@ -73,7 +73,6 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = {SOC15_REG_GOLDEN_VALUE (SDMA0 ,0 , mmSDMA0_RLC1_RB_WPTR_POLL_CNTL,0x0000fff0 ,0x00403000 ),SOC15_REG_GOLDEN_VALUE (SDMA0 ,0 , mmSDMA0_UTCL1_PAGE,0x000003ff ,0x000003c0 ),SOC15_REG_GOLDEN_VALUE (SDMA0 ,0 , mmSDMA0_UTCL1_WATERMK,0xfc000000 ,0x00000000 ), -SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_CHICKEN_BITS,0xfe931f07 ,0x02831f07 ),SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_CLK_CTRL,0xffffffff ,0x3f000100 ),SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_GFX_IB_CNTL,0x800f0100 ,0x00000100 ), SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000),
@@ -91,6 +90,7 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = {static const struct soc15_reg_golden golden_settings_sdma_vg10[] = {SOC15_REG_GOLDEN_VALUE (SDMA0 ,0 , mmSDMA0_GB_ADDR_CONFIG,0x0018773f ,0x00104002 ),SOC15_REG_GOLDEN_VALUE (SDMA0 ,0 , mmSDMA0_GB_ADDR_CONFIG_READ,0x0018773f ,0x00104002 ), +SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_CHICKEN_BITS,0xfe931f07 ,0x02831d07 ),SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_GB_ADDR_CONFIG,0x0018773f ,0x00104002 ),SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_GB_ADDR_CONFIG_READ,0x0018773f ,0x00104002 ) };
@@ -98,6 +98,7 @@ static const struct soc15_reg_golden golden_settings_sdma_vg10[] = {static const struct soc15_reg_golden golden_settings_sdma_vg12[] = {SOC15_REG_GOLDEN_VALUE (SDMA0 ,0 , mmSDMA0_GB_ADDR_CONFIG,0x0018773f ,0x00104001 ),SOC15_REG_GOLDEN_VALUE (SDMA0 ,0 , mmSDMA0_GB_ADDR_CONFIG_READ,0x0018773f ,0x00104001 ), +SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_CHICKEN_BITS,0xfe931f07 ,0x02831d07 ),SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_GB_ADDR_CONFIG,0x0018773f ,0x00104001 ),SOC15_REG_GOLDEN_VALUE (SDMA1 ,0 , mmSDMA1_GB_ADDR_CONFIG_READ,0x0018773f ,0x00104001 ) };
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 31/92 drm/amdgpu: disable system memory page tables for now
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1c1eba86339c8517814863bc7dd21e2661a84e77 ]
We hit a problem with IOMMU with that. Disable until we have time to debug further.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -3
@@ -850,9 +850,6 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm, bp->size =amdgpu_vm_bo_size (adev, level); bp->byte_align =AMDGPU_GPU_PAGE_SIZE ; bp->domain =AMDGPU_GEM_DOMAIN_VRAM ; -if (bp->size <=PAGE_SIZE && adev->asic_type >=CHIP_VEGA10 && - adev->flags &AMD_IS_APU ) - bp->domain |=AMDGPU_GEM_DOMAIN_GTT ; bp->domain =amdgpu_bo_get_preferred_pin_domain (adev, bp->domain); bp->flags =AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |AMDGPU_GEM_CREATE_CPU_GTT_USWC ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 32/92 ARM: dts: da850-evm: Correct the audio codec regulators
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 706edaa88835e3d8de8920584ad5da76dd3d6666 ]
Add the board level fixed regulators for 3.3V and 1.8V which is used to power - among other things - the tlv320aic3106 codec.
Apart from removing the following warning during boot:
tlv320aic3x-codec 0-0018: Too high supply voltage(s) AVDD: 5000000, DVDD: 5000000
With the correct voltages the driver can select correct OCMV value to reduce pop noise.
--- arch/arm/boot/dts/da850-evm.dts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
arch/arm/boot/dts/da850-evm.dts +25 -4
@@ -94,6 +94,28 @@ regulator-boot-on; }; + baseboard_3v3: fixedregulator-3v3 { + /* TPS73701DCQ */ + compatible = "regulator-fixed"; + regulator-name = "baseboard_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vbat>; + regulator-always-on; + regulator-boot-on; + }; + + baseboard_1v8: fixedregulator-1v8 { + /* TPS73701DCQ */ + compatible = "regulator-fixed"; + regulator-name = "baseboard_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vbat>; + regulator-always-on; + regulator-boot-on; + }; + backlight_lcd: backlight-regulator { compatible = "regulator-fixed"; regulator-name = "lcd_backlight_pwr";
@@ -210,10 +232,9 @@ /* Regulators */ IOVDD-supply = <&vdcdc2_reg>; - /* Derived from VBAT: Baseboard 3.3V / 1.8V */ - AVDD-supply = <&vbat>; - DRVDD-supply = <&vbat>; - DVDD-supply = <&vbat>; + AVDD-supply = <&baseboard_3v3>; + DRVDD-supply = <&baseboard_3v3>; + DVDD-supply = <&baseboard_1v8>; }; tca6416: gpio@20 { compatible = "ti,tca6416";
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 33/92 ARM: dts: da850-evm: Correct the sound card name
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 7fca69d4e43fa1ae9cb4f652772c132dc5a659c6 ]
To avoid the following error:
asoc-simple-card sound: ASoC: Failed to create card debugfs directory
Which is because the card name contains '/' character, which can not be used in file or directory names.
--- arch/arm/boot/dts/da850-evm.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/da850-evm.dts +1 -1
@@ -127,7 +127,7 @@ sound { compatible = "simple-audio-card"; - simple-audio-card,name = "DA850/OMAP-L138 EVM"; + simple-audio-card,name = "DA850-OMAPL138 EVM"; simple-audio-card,widgets = "Line", "Line In", "Line", "Line Out";
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 34/92 ARM: dts: da850-lcdk: Correct the audio codec regulators
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit bd540ebe68c3017194a1caa38e075bbbc0832749 ]
Add the board level fixed regulators for 3.3V and 1.8V which is used to power - among other things - the tlv320aic3106 codec.
Apart from removing the following warning during boot:
tlv320aic3x-codec 0-0018: Invalid supply voltage(s) AVDD: -22, DVDD: -22
With the correct voltages the driver can select correct OCMV value to reduce pop noise.
--- arch/arm/boot/dts/da850-lcdk.dts | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
arch/arm/boot/dts/da850-lcdk.dts +36 -0
@@ -39,6 +39,36 @@ }; }; + vcc_5vd: fixedregulator-vcc_5vd { + compatible = "regulator-fixed"; + regulator-name = "vcc_5vd"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + }; + + vcc_3v3d: fixedregulator-vcc_3v3d { + /* TPS650250 - VDCDC1 */ + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3d"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_5vd>; + regulator-always-on; + regulator-boot-on; + }; + + vcc_1v8d: fixedregulator-vcc_1v8d { + /* TPS650250 - VDCDC2 */ + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8d"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_5vd>; + regulator-always-on; + regulator-boot-on; + }; + sound { compatible = "simple-audio-card"; simple-audio-card,name = "DA850/OMAP-L138 LCDK";
@@ -221,6 +251,12 @@ compatible = "ti,tlv320aic3106"; reg = <0x18>; status = "okay"; + + /* Regulators */ + IOVDD-supply = <&vcc_3v3d>; + AVDD-supply = <&vcc_3v3d>; + DRVDD-supply = <&vcc_3v3d>; + DVDD-supply = <&vcc_1v8d>; }; };
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 35/92 ARM: dts: da850-lcdk: Correct the sound card name
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c25748acc5c20786ecb7518bfeae8fcef93472d6 ]
To avoid the following error:
asoc-simple-card sound: ASoC: Failed to create card debugfs directory
Which is because the card name contains '/' character, which can not be used in file or directory names.
--- arch/arm/boot/dts/da850-lcdk.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/da850-lcdk.dts +1 -1
@@ -71,7 +71,7 @@ sound { compatible = "simple-audio-card"; - simple-audio-card,name = "DA850/OMAP-L138 LCDK"; + simple-audio-card,name = "DA850-OMAPL138 LCDK"; simple-audio-card,widgets = "Line", "Line In", "Line", "Line Out";
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 36/92 ARM: dts: kirkwood: Fix polarity of GPIO fan lines
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b5f034845e70916fd33e172fad5ad530a29c10ab ]
These two lines are active high, not active low. The bug was found when we changed the kernel to respect the polarity defined in the device tree.
--- arch/arm/boot/dts/kirkwood-dnskw.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/kirkwood-dnskw.dtsi +2 -2
@@ -36,8 +36,8 @@ compatible = "gpio-fan"; pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>; pinctrl-names = "default"; - gpios = <&gpio1 14 GPIO_ACTIVE_LOW - &gpio1 13 GPIO_ACTIVE_LOW>; + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH + &gpio1 13 GPIO_ACTIVE_HIGH>; gpio-fan,speed-map = <0 0 3000 1 6000 2>;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 37/92 csky: fixup compile error with CPU 810.
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 70c25259537c073584eb906865307687275b527f ]
This bug is from commit f553aa1c13cb ("csky: fixup relocation error with 807 & 860").
I forgot to compile with 810 for that patch.
--- arch/csky/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/csky/kernel/module.c +1 -1
@@ -28,7 +28,7 @@static void jsri_2_lrw_jsr (uint32_t *location) { -uint16_t location_tmp = (uint16_t *)location; +uint16_t *location_tmp = (uint16_t *)location;if (IS_BSR32 (*location_tmp, *(location_tmp +1 )))return ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 38/92 gpio: pl061: handle failed allocations
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit df209c43a0e8258e096fb722dfbdae4f0dd13fde ]
devm_kzalloc(), devm_kstrdup() and devm_kasprintf() all can fail internal allocation and return NULL. Using any of the assigned objects without checking is not safe. As this is early in the boot phase and these allocations really should not fail, any failure here is probably an indication of a more serious issue so it makes little sense to try and rollback the previous allocated resources or try to continue; but rather the probe function is simply exited with -ENOMEM.
--- arch/arm/mach-integrator/impd1.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-integrator/impd1.c +5 -1
@@ -393,7 +393,11 @@ static int __ref impd1_probe(struct lm_device *dev)sizeof (*lookup) +3 *sizeof (struct gpiod_lookup ), GFP_KERNEL); chipname =devm_kstrdup (&dev->dev, devname,GFP_KERNEL ); - mmciname =kasprintf (GFP_KERNEL ,"lm%x:00700" , dev->id); + mmciname =devm_kasprintf (&dev->dev,GFP_KERNEL , +"lm%x:00700" , dev->id); +if (!lookup || !chipname || !mmciname) +return -ENOMEM ; + lookup->dev_id = mmciname;/* * Offsets on GPIO block 1:
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 39/92 drm/nouveau: Dont disable polling in fallback mode
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 118780066e30c34de3d9349710b51780bfa0ba83 ]
When a fan is controlled via linear fallback without cstate, we shouldn't stop polling. Otherwise it won't be adjusted again and keeps running at an initial crazy pace.
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1103356
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107447
--- drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +4 -3
@@ -132,11 +132,12 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode) duty =nvkm_therm_update_linear (therm);break ;case NVBIOS_THERM_FAN_OTHER : -if (therm->cstate) +if (therm->cstate) { duty = therm->cstate; -else + poll = false; + }else { duty =nvkm_therm_update_linear_fallback (therm); - poll = false; + }break ; } immd = false;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 40/92 drm/nouveau/falcon: avoid touching registers if engine is off
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a5176a4cb85bb6213daadf691097cf411da35df2 ]
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108980
--- drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/falcon.c +5 -2
@@ -22,6 +22,7 @@#include <engine/falcon.h> #include <core/gpuobj.h> +#include <subdev/mc.h> #include <subdev/timer.h> #include <engine/fifo.h>
@@ -107,8 +108,10 @@ nvkm_falcon_fini(struct nvkm_engine *engine, bool suspend) } } -nvkm_mask (device, base +0x048 ,0x00000003 ,0x00000000 ); -nvkm_wr32 (device, base +0x014 ,0xffffffff ); +if (nvkm_mc_enabled (device, engine->subdev.index)) { +nvkm_mask (device, base +0x048 ,0x00000003 ,0x00000000 ); +nvkm_wr32 (device, base +0x014 ,0xffffffff ); + }return 0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 41/92 cifs: Limit memory used by lock request calls to a page
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 92a8109e4d3a34fb6b115c9098b51767dc933444 ]
The code tries to allocate a contiguous buffer with a size supplied by the server (maxBuf). This could fail if memory is fragmented since it results in high order allocations for commonly used server implementations. It is also wasteful since there are probably few locks in the usual case. Limit the buffer to be no larger than a page to avoid memory allocation failures due to fragmentation.
--- fs/cifs/file.c | 8 ++++++++ fs/cifs/smb2file.c | 4 ++++ 2 files changed, 12 insertions(+)
fs/cifs/file.c +8 -0
@@ -1139,6 +1139,10 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)return -EINVAL ; } +BUILD_BUG_ON (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE ) > +PAGE_SIZE ); + max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr), +PAGE_SIZE ); max_num = (max_buf -sizeof (struct smb_hdr )) /sizeof (LOCKING_ANDX_RANGE ); buf =kcalloc (max_num,sizeof (LOCKING_ANDX_RANGE ),GFP_KERNEL );
@@ -1477,6 +1481,10 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,if (max_buf < (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE )))return -EINVAL ; +BUILD_BUG_ON (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE ) > +PAGE_SIZE ); + max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr), +PAGE_SIZE ); max_num = (max_buf -sizeof (struct smb_hdr )) /sizeof (LOCKING_ANDX_RANGE ); buf =kcalloc (max_num,sizeof (LOCKING_ANDX_RANGE ),GFP_KERNEL );
fs/cifs/smb2file.c +4 -0
@@ -128,6 +128,8 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,if (max_buf <sizeof (struct smb2_lock_element ))return -EINVAL ; +BUILD_BUG_ON (sizeof (struct smb2_lock_element ) >PAGE_SIZE ); + max_buf = min_t(unsigned int, max_buf, PAGE_SIZE); max_num = max_buf /sizeof (struct smb2_lock_element ); buf =kcalloc (max_num,sizeof (struct smb2_lock_element ),GFP_KERNEL );if (!buf)
@@ -264,6 +266,8 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)return -EINVAL ; } +BUILD_BUG_ON (sizeof (struct smb2_lock_element ) >PAGE_SIZE ); + max_buf = min_t(unsigned int, max_buf, PAGE_SIZE); max_num = max_buf /sizeof (struct smb2_lock_element ); buf =kcalloc (max_num,sizeof (struct smb2_lock_element ),GFP_KERNEL );if (!buf) {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 42/92 CIFS: Fix credits calculation for cancelled requests
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8a26f0f781f56d3016b34a2217e346973d067e7b ]
If a request is cancelled, we can't assume that the server returns 1 credit back. Instead we need to wait for a response and process the number of credits granted by the server.
Create a separate mid callback for cancelled request, parse the number of credits in a response buffer and add them to the client's credits. If the didn't get a response (no response buffer available) assume 0 credits granted. The latter most probably happens together with session reconnect, so the client's credits are adjusted anyway.
--- fs/cifs/cifsglob.h | 1 + fs/cifs/transport.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-)
fs/cifs/cifsglob.h +1 -0
@@ -1426,6 +1426,7 @@ struct mid_q_entry {int mid_state;/* wish this were enum but can not pass to wait_event */ unsigned int mid_flags;__le16 command;/* smb command code */ +unsigned int optype;/* operation type */ bool large_buf:1; /* if valid response, is pointer to large buf */ bool multiRsp:1; /* multiple trans2 responses for one request */ bool multiEnd:1; /* both received */
fs/cifs/transport.c +26 -2
@@ -785,6 +785,24 @@ cifs_noop_callback(struct mid_q_entry *mid) { } +static void +cifs_cancelled_callback (struct mid_q_entry *mid) +{ +struct TCP_Server_Info *server = mid->server; +unsigned int optype = mid->optype; +unsigned int credits_received =0 ; + +if (mid->mid_state ==MID_RESPONSE_RECEIVED ) { +if (mid->resp_buf) + credits_received = server->ops->get_credits (mid); +else +cifs_dbg (FYI ,"Bad state for cancelled MID\n" ); + } + +DeleteMidQEntry (mid); +add_credits (server, credits_received, optype); +} + int compound_send_recv(const unsigned int xid, struct cifs_ses *ses, const int flags, const int num_rqst, struct smb_rqst *rqst,
@@ -860,6 +878,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, } midQ[i]->mid_state =MID_REQUEST_SUBMITTED ; + midQ[i]->optype = optype;/* * We don't invoke the callback compounds unless it is the last * request.
@@ -894,15 +913,20 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,for (i =0 ; i < num_rqst; i++) { rc =wait_for_response (ses->server, midQ[i]); -if (rc !=0 ) { +if (rc !=0 ) +break ; + } +if (rc !=0 ) { +for (; i < num_rqst; i++) {cifs_dbg (VFS ,"Cancelling wait for mid %llu cmd: %d\n" , midQ[i]->mid,le16_to_cpu (midQ[i]->command));send_cancel (ses->server, &rqst[i], midQ[i]);spin_lock (&GlobalMid_Lock);if (midQ[i]->mid_state ==MID_REQUEST_SUBMITTED ) { midQ[i]->mid_flags |=MID_WAIT_CANCELLED ; - midQ[i]->callback = DeleteMidQEntry; + midQ[i]->callback = cifs_cancelled_callback; cancelled_mid[i] = true; + credits[i] =0 ; }spin_unlock (&GlobalMid_Lock); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 43/92 CIFS: Move credit processing to mid callbacks for SMB3
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ee258d79159afed52ca9372aeb9c1a51e89b32ee ]
Currently we account for credits in the thread initiating a request and waiting for a response. The demultiplex thread receives the response, wakes up the thread and the latter collects credits from the response buffer and add them to the server structure on the client. This approach is not accurate, because it may race with reconnect events in the demultiplex thread which resets the number of credits.
Fix this by moving credit processing to new mid callbacks that collect credits granted by the server from the response in the demultiplex thread.
--- fs/cifs/transport.c | 51 ++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 17 deletions(-)
fs/cifs/transport.c +34 -17
@@ -781,12 +781,7 @@ cifs_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst) }static void -cifs_noop_callback (struct mid_q_entry *mid) -{ -} - -static void -cifs_cancelled_callback (struct mid_q_entry *mid) +cifs_compound_callback (struct mid_q_entry *mid) {struct TCP_Server_Info *server = mid->server;unsigned int optype = mid->optype;
@@ -799,10 +794,23 @@ cifs_cancelled_callback(struct mid_q_entry *mid)cifs_dbg (FYI ,"Bad state for cancelled MID\n" ); } -DeleteMidQEntry (mid);add_credits (server, credits_received, optype); } +static void +cifs_compound_last_callback (struct mid_q_entry *mid) +{ +cifs_compound_callback (mid); +cifs_wake_up_task (mid); +} + +static void +cifs_cancelled_callback (struct mid_q_entry *mid) +{ +cifs_compound_callback (mid); +DeleteMidQEntry (mid); +} + int compound_send_recv(const unsigned int xid, struct cifs_ses *ses, const int flags, const int num_rqst, struct smb_rqst *rqst,
@@ -880,11 +888,14 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, midQ[i]->mid_state =MID_REQUEST_SUBMITTED ; midQ[i]->optype = optype;/* -* We don't invoke the callback compounds unless it is the last -* request. +* Invoke callback for every part of the compound chain +* to calculate credits properly. Wake up this thread only when +* the last element is received. */ if (i < num_rqst -1 ) - midQ[i]->callback = cifs_noop_callback; + midQ[i]->callback = cifs_compound_callback; +else + midQ[i]->callback = cifs_compound_last_callback; }cifs_in_send_inc (ses->server); rc =smb_send_rqst (ses->server, num_rqst, rqst, flags);
@@ -898,8 +909,20 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,mutex_unlock (&ses->server->srv_mutex); -if (rc <0 ) +if (rc <0 ) { +/* Sending failed for some reason - return credits back */ +for (i =0 ; i < num_rqst; i++) +add_credits (ses->server, credits[i], optype); goto out; + } + +/* +* At this point the request is passed to the network stack - we assume +* that any credits taken from the server structure on the client have +* been spent and we can't return them back. Once we receive responses +* we will collect credits granted by the server in the mid callbacks +* and add those credits to the server structure. +*/ /* * Compounding is never used during session establish.
@@ -932,11 +955,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, } } -for (i =0 ; i < num_rqst; i++) -if (!cancelled_mid[i] && midQ[i]->resp_buf - && (midQ[i]->mid_state ==MID_RESPONSE_RECEIVED )) - credits[i] = ses->server->ops->get_credits (midQ[i]); -for (i =0 ; i < num_rqst; i++) {if (rc <0 ) goto out;
@@ -995,7 +1013,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,for (i =0 ; i < num_rqst; i++) {if (!cancelled_mid[i])cifs_delete_mid (midQ[i]); -add_credits (ses->server, credits[i], optype); }return rc;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 44/92 CIFS: Fix error paths in writeback code
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9a66396f1857cc1de06f4f4771797315e1a4ea56 ]
This patch aims to address writeback code problems related to error paths. In particular it respects EINTR and related error codes and stores and returns the first error occurred during writeback.
--- fs/cifs/cifsglob.h | 19 +++++++++++++++++++ fs/cifs/cifssmb.c | 7 ++++--- fs/cifs/file.c | 29 +++++++++++++++++++++++------ fs/cifs/inode.c | 10 ++++++++++ 4 files changed, 56 insertions(+), 9 deletions(-)
fs/cifs/cifsglob.h +19 -0
@@ -1563,6 +1563,25 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,kfree (param); } +static inline bool is_interrupt_error (int error) +{ +switch (error) { +case -EINTR : +case -ERESTARTSYS : +case -ERESTARTNOHAND : +case -ERESTARTNOINTR : +return true; + } +return false; +} + +static inline bool is_retryable_error (int error) +{ +if (is_interrupt_error (error) || error == -EAGAIN ) +return true; +return false; +} +#define MID_FREE 0#define MID_REQUEST_ALLOCATED 1#define MID_REQUEST_SUBMITTED 2
fs/cifs/cifssmb.c +4 -3
@@ -2043,7 +2043,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)for (j =0 ; j < nr_pages; j++) {unlock_page (wdata2->pages[j]); -if (rc !=0 && rc != -EAGAIN ) { +if (rc !=0 && !is_retryable_error (rc)) {SetPageError (wdata2->pages[j]);end_page_writeback (wdata2->pages[j]);put_page (wdata2->pages[j]);
@@ -2052,7 +2052,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)if (rc) {kref_put (&wdata2->refcount, cifs_writedata_release); -if (rc == -EAGAIN ) +if (is_retryable_error (rc))continue ;break ; }
@@ -2061,7 +2061,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata) i += nr_pages; }while (i < wdata->nr_pages); -mapping_set_error (inode->i_mapping, rc); +if (rc !=0 && !is_retryable_error (rc)) +mapping_set_error (inode->i_mapping, rc);kref_put (&wdata->refcount, cifs_writedata_release); }
fs/cifs/file.c +23 -6
@@ -732,7 +732,8 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)if (can_flush) { rc =filemap_write_and_wait (inode->i_mapping); -mapping_set_error (inode->i_mapping, rc); +if (!is_interrupt_error (rc)) +mapping_set_error (inode->i_mapping, rc);if (tcon->unix_ext) rc = cifs_get_inode_info_unix(&inode, full_path,
@@ -2117,6 +2118,7 @@ static int cifs_writepages(struct address_space *mapping,pgoff_t end, index;struct cifs_writedata *wdata;int rc =0 ; +int saved_rc =0 ;unsigned int xid;/*
@@ -2145,8 +2147,10 @@ static int cifs_writepages(struct address_space *mapping, rc = server->ops->wait_mtu_credits (server, cifs_sb->wsize, &wsize, &credits); -if (rc) +if (rc !=0 ) { + done = true;break ; + } tofind =min ((wsize /PAGE_SIZE ) -1 , end - index) +1 ;
@@ -2154,6 +2158,7 @@ static int cifs_writepages(struct address_space *mapping, &found_pages);if (!wdata) { rc = -ENOMEM ; + done = true;add_credits_and_wake_if (server, credits,0 );break ; }
@@ -2182,7 +2187,7 @@ static int cifs_writepages(struct address_space *mapping,if (rc !=0 ) {add_credits_and_wake_if (server, wdata->credits,0 );for (i =0 ; i < nr_pages; ++i) { -if (rc == -EAGAIN ) +if (is_retryable_error (rc))redirty_page_for_writepage (wbc, wdata->pages[i]);else
@@ -2190,7 +2195,7 @@ static int cifs_writepages(struct address_space *mapping,end_page_writeback (wdata->pages[i]);put_page (wdata->pages[i]); } -if (rc != -EAGAIN ) +if (!is_retryable_error (rc))mapping_set_error (mapping, rc); }kref_put (&wdata->refcount, cifs_writedata_release);
@@ -2200,6 +2205,15 @@ static int cifs_writepages(struct address_space *mapping,continue ; } +/* Return immediately if we received a signal during writing */ +if (is_interrupt_error (rc)) { + done = true; +break ; + } + +if (rc !=0 && saved_rc ==0 ) + saved_rc = rc; + wbc->nr_to_write -= nr_pages;if (wbc->nr_to_write <=0 ) done = true;
@@ -2217,6 +2231,9 @@ static int cifs_writepages(struct address_space *mapping, goto retry; } +if (saved_rc !=0 ) + rc = saved_rc; +if (wbc->range_cyclic || (range_whole && wbc->nr_to_write >0 )) mapping->writeback_index = index;
@@ -2249,8 +2266,8 @@ cifs_writepage_locked(struct page *page, struct writeback_control *wbc)set_page_writeback (page); retry_write: rc =cifs_partialpagewrite (page,0 ,PAGE_SIZE ); -if (rc == -EAGAIN ) { -if (wbc->sync_mode ==WB_SYNC_ALL ) +if (is_retryable_error (rc)) { +if (wbc->sync_mode ==WB_SYNC_ALL && rc == -EAGAIN ) goto retry_write;redirty_page_for_writepage (wbc, page); }else if (rc !=0 ) {
fs/cifs/inode.c +10 -0
@@ -2261,6 +2261,11 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)* the flush returns error? */ rc =filemap_write_and_wait (inode->i_mapping); +if (is_interrupt_error (rc)) { + rc = -ERESTARTSYS ; + goto out; + } +mapping_set_error (inode->i_mapping, rc); rc =0 ;
@@ -2404,6 +2409,11 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)* the flush returns error? */ rc =filemap_write_and_wait (inode->i_mapping); +if (is_interrupt_error (rc)) { + rc = -ERESTARTSYS ; + goto cifs_setattr_exit; + } +mapping_set_error (inode->i_mapping, rc); rc =0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 45/92 kvm: sev: Fail KVM_SEV_INIT if already initialized
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3f14a89d1132dcae3c8ce6721c6ef51f6e6d9b5f ]
By code inspection, it was found that multiple calls to KVM_SEV_INIT could deplete asid bits and overwrite kvm_sev_info's regions_list.
Multiple calls to KVM_SVM_INIT is not likely to occur with QEMU, but this should likely be fixed anyway.
This code is serialized by kvm->lock.
--- arch/x86/kvm/svm.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/svm.c +3 -0
@@ -6255,6 +6255,9 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)int asid, ret; ret = -EBUSY ; +if (unlikely (sev->active)) +return ret; + asid =sev_asid_new ();if (asid <0 )return ret;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 46/92 CIFS: Fix credit calculations in compound mid callback
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3d3003fce8e837acc4e3960fe3cbabebc356dcb5 ]
The current code doesn't do proper accounting for credits in SMB1 case: it adds one credit per response only if we get a complete response while it needs to return it unconditionally. Fix this and also include malformed responses for SMB2+ into accounting for credits because such responses have Credit Granted field, thus nothing prevents to get a proper credit value from them.
--- fs/cifs/smb2ops.c | 6 +++++- fs/cifs/transport.c | 11 +---------- 2 files changed, 6 insertions(+), 11 deletions(-)
fs/cifs/smb2ops.c +5 -1
@@ -154,7 +154,11 @@ smb2_get_credits(struct mid_q_entry *mid) {struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)mid->resp_buf; -return le16_to_cpu (shdr->CreditRequest); +if (mid->mid_state ==MID_RESPONSE_RECEIVED + || mid->mid_state ==MID_RESPONSE_MALFORMED ) +return le16_to_cpu (shdr->CreditRequest); + +return 0 ; } static int
fs/cifs/transport.c +1 -10
@@ -784,17 +784,8 @@ static void cifs_compound_callback(struct mid_q_entry *mid) {struct TCP_Server_Info *server = mid->server; -unsigned int optype = mid->optype; -unsigned int credits_received =0 ; -if (mid->mid_state ==MID_RESPONSE_RECEIVED ) { -if (mid->resp_buf) - credits_received = server->ops->get_credits (mid); -else -cifs_dbg (FYI ,"Bad state for cancelled MID\n" ); - } - -add_credits (server, credits_received, optype); +add_credits (server, server->ops->get_credits (mid), mid->optype); } static void
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 47/92 CIFS: Do not assume one credit for async responses
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 0fd1d37b0501efc6e295f56ab55cdaff784aa50c ]
If we don't receive a response we can't assume that the server granted one credit. Assume zero credits in such cases.
--- fs/cifs/smb2pdu.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
fs/cifs/smb2pdu.c +11 -4
@@ -2826,9 +2826,10 @@ smb2_echo_callback(struct mid_q_entry *mid) {struct TCP_Server_Info *server = mid->callback_data;struct smb2_echo_rsp *rsp = (struct smb2_echo_rsp *)mid->resp_buf; -unsigned int credits_received =1 ; +unsigned int credits_received =0 ; -if (mid->mid_state ==MID_RESPONSE_RECEIVED ) +if (mid->mid_state ==MID_RESPONSE_RECEIVED + || mid->mid_state ==MID_RESPONSE_MALFORMED ) credits_received =le16_to_cpu (rsp->sync_hdr.CreditRequest);DeleteMidQEntry (mid);
@@ -3085,7 +3086,7 @@ smb2_readv_callback(struct mid_q_entry *mid)struct TCP_Server_Info *server = tcon->ses->server;struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)rdata->iov[0 ].iov_base; -unsigned int credits_received =1 ; +unsigned int credits_received =0 ;struct smb_rqst rqst = { .rq_iov = rdata->iov, .rq_nvec =2 , .rq_pages = rdata->pages,
@@ -3124,6 +3125,9 @@ smb2_readv_callback(struct mid_q_entry *mid)task_io_account_read (rdata->got_bytes);cifs_stats_bytes_read (tcon, rdata->got_bytes);break ; +case MID_RESPONSE_MALFORMED : + credits_received =le16_to_cpu (shdr->CreditRequest); +/* fall through */ default :if (rdata->result != -ENODATA ) rdata->result = -EIO ;
@@ -3317,7 +3321,7 @@ smb2_writev_callback(struct mid_q_entry *mid)struct cifs_tcon *tcon =tlink_tcon (wdata->cfile->tlink);unsigned int written;struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; -unsigned int credits_received =1 ; +unsigned int credits_received =0 ;switch (mid->mid_state) {case MID_RESPONSE_RECEIVED :
@@ -3345,6 +3349,9 @@ smb2_writev_callback(struct mid_q_entry *mid)case MID_RETRY_NEEDED : wdata->result = -EAGAIN ;break ; +case MID_RESPONSE_MALFORMED : + credits_received =le16_to_cpu (rsp->sync_hdr.CreditRequest); +/* fall through */ default : wdata->result = -EIO ;break ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 48/92 CIFS: Fix mounts if the client is low on credits
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6a9cbdd1ceca1dc2359ddf082efe61b97c3e752b ]
If the server doesn't grant us at least 3 credits during the mount we won't be able to complete it because query path info operation requires 3 credits. Use the cached file handle if possible to allow the mount to succeed.
--- fs/cifs/smb2inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/cifs/smb2inode.c +17 -0
@@ -294,6 +294,8 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,int rc;struct smb2_file_all_info *smb2_data;__u32 create_options =0 ; +struct cifs_fid fid; +bool no_cached_open = tcon->nohandlecache; *adjust_tz = false; *symlink = false;
@@ -302,6 +304,21 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, GFP_KERNEL);if (smb2_data ==NULL )return -ENOMEM ; + +/* If it is a root and its handle is cached then use it */ +if (!strlen (full_path) && !no_cached_open) { + rc =open_shroot (xid, tcon, &fid); +if (rc) + goto out; + rc =SMB2_query_info (xid, tcon, fid.persistent_fid, + fid.volatile_fid, smb2_data); +close_shroot (&tcon->crfid); +if (rc) + goto out; +move_smb2_info_to_cifs (data, smb2_data); + goto out; + } +if (backup_cred (cifs_sb)) create_options |=CREATE_OPEN_BACKUP_INTENT ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 49/92 gpio: mxc: move gpio noirq suspend/resume to syscore phase
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
commit 1a5287a3dbc34cd0c02c8f64c9131bd23cdfe2bb upstream.
During noirq suspend/resume phase, GPIO irq could arrive and its registers like IMR will be changed by irq handle process, to make the GPIO registers exactly when it is powered ON after resume, move the GPIO noirq suspend/resume callback to syscore suspend/resume phase, local irq is disabled at this phase so GPIO registers are atomic.
--- drivers/gpio/gpio-mxc.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-)
drivers/gpio/gpio-mxc.c +24 -17
@@ -17,6 +17,7 @@#include <linux/irqchip/chained_irq.h> #include <linux/platform_device.h> #include <linux/slab.h> +#include <linux/syscore_ops.h> #include <linux/gpio/driver.h> #include <linux/of.h> #include <linux/of_device.h>
@@ -550,33 +551,38 @@ static void mxc_gpio_restore_regs(struct mxc_gpio_port *port)writel (port->gpio_saved_reg.dr, port->base +GPIO_DR ); } -static int __maybe_unused mxc_gpio_noirq_suspend (struct device *dev) +static int mxc_gpio_syscore_suspend (void ) { -struct platform_device *pdev =to_platform_device (dev); -struct mxc_gpio_port *port =platform_get_drvdata (pdev); +struct mxc_gpio_port *port; -mxc_gpio_save_regs (port); -clk_disable_unprepare (port->clk); +/* walk through all ports */ +list_for_each_entry (port, &mxc_gpio_ports, node) { +mxc_gpio_save_regs (port); +clk_disable_unprepare (port->clk); + }return 0 ; } -static int __maybe_unused mxc_gpio_noirq_resume (struct device *dev) +static void mxc_gpio_syscore_resume (void ) { -struct platform_device *pdev =to_platform_device (dev); -struct mxc_gpio_port *port =platform_get_drvdata (pdev); +struct mxc_gpio_port *port;int ret; - ret =clk_prepare_enable (port->clk); -if (ret) -return ret; -mxc_gpio_restore_regs (port); - -return 0 ; +/* walk through all ports */ +list_for_each_entry (port, &mxc_gpio_ports, node) { + ret =clk_prepare_enable (port->clk); +if (ret) { +pr_err ("mxc: failed to enable gpio clock %d\n" , ret); +return ; + } +mxc_gpio_restore_regs (port); + } } -static const struct dev_pm_ops mxc_gpio_dev_pm_ops = { -SET_NOIRQ_SYSTEM_SLEEP_PM_OPS (mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume) +static struct syscore_ops mxc_gpio_syscore_ops = { + .suspend = mxc_gpio_syscore_suspend, + .resume = mxc_gpio_syscore_resume, };static struct platform_driver mxc_gpio_driver = {
@@ -584,7 +590,6 @@ static struct platform_driver mxc_gpio_driver = { .name = "gpio-mxc", .of_match_table = mxc_gpio_dt_ids, .suppress_bind_attrs = true, - .pm = &mxc_gpio_dev_pm_ops, }, .probe = mxc_gpio_probe, .id_table = mxc_gpio_devtype,
@@ -592,6 +597,8 @@ static struct platform_driver mxc_gpio_driver = {static int __init gpio_mxc_init (void ) { +register_syscore_ops (&mxc_gpio_syscore_ops); +return platform_driver_register (&mxc_gpio_driver); }subsys_initcall (gpio_mxc_init);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 50/92 Revert "Input: elan_i2c - add ACPI ID for touchpad in ASUS Aspire F5-573G"
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit f420c54e4b12c1361c6ed313002ee7bd7ac58362 upstream.
This reverts commit 7db54c89f0b30a101584e09d3729144e6170059d as it breaks Acer Aspire V-371 and other devices. According to Elan:
"Acer Aspire F5-573G is MS Precision touchpad which should use hid
multitouch driver. ELAN0501 should not be added in elan_i2c."
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202503
--- drivers/input/mouse/elan_i2c_core.c | 1 - 1 file changed, 1 deletion(-)
drivers/input/mouse/elan_i2c_core.c +0 -1
@@ -1336,7 +1336,6 @@ MODULE_DEVICE_TABLE(i2c, elan_id);static const struct acpi_device_id elan_acpi_id[] = { {"ELAN0000" ,0 }, {"ELAN0100" ,0 }, - {"ELAN0501" ,0 }, {"ELAN0600" ,0 }, {"ELAN0602" ,0 }, {"ELAN0605" ,0 },
Greg Kroah-Hartman
maintainerPATCH 51/92 Input: elan_i2c - add ACPI ID for touchpad in Lenovo V330-15ISK
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Ciancio <[email protected]>
commit 7ad222b3aed350adfc27ee7eec4587ffe55dfdce upstream.
This adds ELAN0617 to the ACPI table to support Elan touchpad found in Lenovo V330-15ISK.
--- drivers/input/mouse/elan_i2c_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/mouse/elan_i2c_core.c +1 -0
@@ -1345,6 +1345,7 @@ static const struct acpi_device_id elan_ { "ELAN060C", 0 }, { "ELAN0611", 0 }, { "ELAN0612", 0 }, + { "ELAN0617", 0 }, { "ELAN0618", 0 }, { "ELAN061C", 0 }, { "ELAN061D", 0 },
Greg Kroah-Hartman
maintainerPATCH 52/92 arm64: dts: rockchip: enable usb-host regulators at boot on rk3328-rock64
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Voytik <[email protected]>
commit 26e2d7b03ea7ff254bf78305aa44dda62e70b78e upstream.
After commit ef05bcb60c1a, boot from USB drives is broken. Fix this problem by enabling usb-host regulators during boot time.
--- arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +2 -0
@@ -40,6 +40,7 @@ pinctrl-0 = <&usb30_host_drv>; regulator-name = "vcc_host_5v"; regulator-always-on; + regulator-boot-on; vin-supply = <&vcc_sys>; };
@@ -51,6 +52,7 @@ pinctrl-0 = <&usb20_host_drv>; regulator-name = "vcc_host1_5v"; regulator-always-on; + regulator-boot-on; vin-supply = <&vcc_sys>; };
Greg Kroah-Hartman
maintainerPATCH 53/92 ARM: OMAP5+: Fix inverted nirq pin interrupts with irq_set_type
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
commit d0243693fbf6fbd48b4efb2ba7210765983b03e3 upstream.
Commit 83a86fbb5b56 ("irqchip/gic: Loudly complain about the use of IRQ_TYPE_NONE") started warning about incorrect dts usage for irqs. ARM GIC only supports active-high interrupts for SPI (Shared Peripheral Interrupts), and the Palmas PMIC by default is active-low.
Palmas PMIC allows changing the interrupt polarity using register PALMAS_POLARITY_CTRL_INT_POLARITY, but configuring sys_nirq1 with a pull-down and setting PALMAS_POLARITY_CTRL_INT_POLARITY made the Palmas RTC interrupts stop working. This can be easily tested with kernel tools rtctest.c.
Turns out the SoC inverts the sys_nirq pins for GIC as they do not go through a peripheral device but go directly to the MPUSS wakeupgen. I've verified this by muxing the interrupt line temporarily to gpio_wk16 instead of sys_nirq1. with a gpio, the interrupt works fine both active-low and active-high with the SoC internal pull configured and palmas polarity configured. But as sys_nirq1, the interrupt only works when configured ACTIVE_LOW for palmas, and ACTIVE_HIGH for GIC.
Note that there was a similar issue earlier with tegra114 and palmas interrupt polarity that got fixed by commit df545d1cd01a ("mfd: palmas:
Provide irq flags through DT/platform data"). However, the difference between omap5 and tegra114 is that tegra inverts the palmas interrupt twice, once when entering tegra PMC, and again when exiting tegra PMC to GIC.
Let's fix the issue by adding a custom wakeupgen_irq_set_type() for wakeupgen and invert any interrupts with wrong polarity. Let's also warn about any non-sysnirq pins using wrong polarity. Note that we also need to update the dts for the level as IRQ_TYPE_NONE never has irq_set_type() called, and let's add some comments and use proper pin nameing to avoid more confusion later on.
--- arch/arm/boot/dts/omap5-board-common.dtsi | 9 +++++-- arch/arm/boot/dts/omap5-cm-t54.dts | 12 +++++++++- arch/arm/mach-omap2/omap-wakeupgen.c | 36 +++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 5 deletions(-)
arch/arm/boot/dts/omap5-board-common.dtsi +6 -3
@@ -317,7 +317,8 @@ palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins { pinctrl-single,pins = < - OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1 */ + /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */ + OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) >; };
@@ -385,7 +386,8 @@ palmas: palmas@48 { compatible = "ti,palmas"; - interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */ + /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>; reg = <0x48>; interrupt-controller; #interrupt-cells = <2>;
@@ -651,7 +653,8 @@ pinctrl-names = "default"; pinctrl-0 = <&twl6040_pins>; - interrupts = <GIC_SPI 119 IRQ_TYPE_NONE>; /* IRQ_SYS_2N cascaded to gic */ + /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ + interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_LOW>; /* audpwron gpio defined in the board specific dts */
arch/arm/boot/dts/omap5-cm-t54.dts +11 -1
@@ -181,6 +181,13 @@ OMAP5_IOPAD(0x0042, PIN_INPUT_PULLDOWN | MUX_MODE6) /* llib_wakereqin.gpio1_wk15 */ >; }; + + palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins { + pinctrl-single,pins = < + /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */ + OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) + >; + }; }; &omap5_pmx_core {
@@ -414,8 +421,11 @@ palmas: palmas@48 { compatible = "ti,palmas"; - interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */ reg = <0x48>; + pinctrl-0 = <&palmas_sys_nirq_pins>; + pinctrl-names = "default"; + /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>; interrupt-controller; #interrupt-cells = <2>; ti,system-power-controller;
arch/arm/mach-omap2/omap-wakeupgen.c +35 -1
@@ -50,6 +50,9 @@#define OMAP4_NR_BANKS 4#define OMAP4_NR_IRQS 128 +#define SYS_NIRQ1_EXT_SYS_IRQ_1 7 +#define SYS_NIRQ2_EXT_SYS_IRQ_2 119 +static void __iomem *wakeupgen_base;static void __iomem *sar_base;static DEFINE_RAW_SPINLOCK (wakeupgen_lock);
@@ -153,6 +156,37 @@ static void wakeupgen_unmask(struct irq_irq_chip_unmask_parent (d); } +/* +* The sys_nirq pins bypass peripheral modules and are wired directly +* to MPUSS wakeupgen. They get automatically inverted for GIC. +*/ +static int wakeupgen_irq_set_type (struct irq_data *d,unsigned int type) +{ +bool inverted = false; + +switch (type) { +case IRQ_TYPE_LEVEL_LOW : + type &= ~IRQ_TYPE_LEVEL_MASK ; + type |=IRQ_TYPE_LEVEL_HIGH ; + inverted = true; +break ; +case IRQ_TYPE_EDGE_FALLING : + type &= ~IRQ_TYPE_EDGE_BOTH ; + type |=IRQ_TYPE_EDGE_RISING ; + inverted = true; +break ; +default : +break ; + } + +if (inverted && d->hwirq !=SYS_NIRQ1_EXT_SYS_IRQ_1 && + d->hwirq !=SYS_NIRQ2_EXT_SYS_IRQ_2 ) +pr_warn ("wakeupgen: irq%li polarity inverted in dts\n" , + d->hwirq); + +return irq_chip_set_type_parent (d, type); +} +#ifdef CONFIG_HOTPLUG_CPU static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks);
@@ -446,7 +480,7 @@ static struct irq_chip wakeupgen_chip = .irq_mask = wakeupgen_mask, .irq_unmask = wakeupgen_unmask, .irq_retrigger = irq_chip_retrigger_hierarchy, - .irq_set_type = irq_chip_set_type_parent, + .irq_set_type = wakeupgen_irq_set_type, .flags =IRQCHIP_SKIP_SET_WAKE |IRQCHIP_MASK_ON_SUSPEND , #ifdef CONFIG_SMP .irq_set_affinity = irq_chip_set_affinity_parent,
Greg Kroah-Hartman
maintainerPATCH 54/92 perf/core: Fix impossible ring-buffer sizes warning
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit 528871b456026e6127d95b1b2bd8e3a003dc1614 upstream.
The following commit:
9dff0aa95a32 ("perf/core: Don't WARN() for impossible ring-buffer sizes")
results in perf recording failures with larger mmap areas:
root@skl:/tmp# perf record -g -a failed to mmap with 12 (Cannot allocate memory)
The root cause is that the following condition is buggy:
if (order_base_2(size) >= MAX_ORDER) goto fail;
The problem is that @size is in bytes and MAX_ORDER is in pages, so the right test is:
if (order_base_2(size) >= PAGE_SHIFT+MAX_ORDER) goto fail;
Fix it.
--- kernel/events/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/ring_buffer.c +1 -1
@@ -734,7 +734,7 @@ struct ring_buffer *rb_alloc(int nr_page size =sizeof (struct ring_buffer ); size += nr_pages *sizeof (void *); -if (order_base_2 (size) >=MAX_ORDER ) +if (order_base_2 (size) >=PAGE_SHIFT +MAX_ORDER ) goto fail; rb =kzalloc (size,GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 55/92 perf/x86: Add check_period PMU callback
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 81ec3f3c4c4d78f2d3b6689c9816bfbdf7417dbb upstream.
Vince (and later on Ravi) reported crashes in the BTS code during fuzzing with the following backtrace:
general protection fault: 0000 [#1] SMP PTI ... RIP: 0010:perf_prepare_sample+0x8f/0x510 ... Call Trace: <IRQ> ? intel_pmu_drain_bts_buffer+0x194/0x230 intel_pmu_drain_bts_buffer+0x160/0x230 ? tick_nohz_irq_exit+0x31/0x40 ? smp_call_function_single_interrupt+0x48/0xe0 ? call_function_single_interrupt+0xf/0x20 ? call_function_single_interrupt+0xa/0x20 ? x86_schedule_events+0x1a0/0x2f0 ? x86_pmu_commit_txn+0xb4/0x100 ? find_busiest_group+0x47/0x5d0 ? perf_event_set_state.part.42+0x12/0x50 ? perf_mux_hrtimer_restart+0x40/0xb0 intel_pmu_disable_event+0xae/0x100 ? intel_pmu_disable_event+0xae/0x100 x86_pmu_stop+0x7a/0xb0 x86_pmu_del+0x57/0x120 event_sched_out.isra.101+0x83/0x180 group_sched_out.part.103+0x57/0xe0 ctx_sched_out+0x188/0x240 ctx_resched+0xa8/0xd0 __perf_event_enable+0x193/0x1e0 event_function+0x8e/0xc0 remote_function+0x41/0x50 flush_smp_call_function_queue+0x68/0x100 generic_smp_call_function_single_interrupt+0x13/0x30 smp_call_function_single_interrupt+0x3e/0xe0 call_function_single_interrupt+0xf/0x20 </IRQ>
The reason is that while event init code does several checks for BTS events and prevents several unwanted config bits for BTS event (like precise_ip), the PERF_EVENT_IOC_PERIOD allows to create BTS event without those checks being done.
Following sequence will cause the crash:
If we create an 'almost' BTS event with precise_ip and callchains, and it into a BTS event it will crash the perf_prepare_sample() function because precise_ip events are expected to come in with callchain data initialized, but that's not the case for intel_pmu_drain_bts_buffer() caller.
Adding a check_period callback to be called before the period is changed via PERF_EVENT_IOC_PERIOD. It will deny the change if the event would become BTS. Plus adding also the limit_period check as well.
--- arch/x86/events/core.c | 14 ++++++++++++++ arch/x86/events/intel/core.c | 9 +++++++++ arch/x86/events/perf_event.h | 16 ++++++++++++++-- include/linux/perf_event.h | 5 +++++ kernel/events/core.c | 16 ++++++++++++++++ 5 files changed, 58 insertions(+), 2 deletions(-)
arch/x86/events/core.c +14 -0
@@ -2278,6 +2278,19 @@ void perf_check_microcode(void) x86_pmu.check_microcode (); } +static int x86_pmu_check_period (struct perf_event *event,u64 value) +{ +if (x86_pmu.check_period && x86_pmu.check_period (event, value)) +return -EINVAL ; + +if (value && x86_pmu.limit_period) { +if (x86_pmu.limit_period (event, value) > value) +return -EINVAL ; + } + +return 0 ; +} +static struct pmu pmu = { .pmu_enable = x86_pmu_enable, .pmu_disable = x86_pmu_disable,
@@ -2302,6 +2315,7 @@ static struct pmu pmu = { .event_idx = x86_pmu_event_idx, .sched_task = x86_pmu_sched_task, .task_ctx_size = sizeof(struct x86_perf_task_context), + .check_period = x86_pmu_check_period, }; void arch_perf_update_userpage(struct perf_event *event,
arch/x86/events/intel/core.c +9 -0
@@ -3587,6 +3587,11 @@ static void intel_pmu_sched_task(structintel_pmu_lbr_sched_task (ctx, sched_in); } +static int intel_pmu_check_period (struct perf_event *event,u64 value) +{ +return intel_pmu_has_bts_period (event, value) ? -EINVAL :0 ; +} +PMU_FORMAT_ATTR (offcore_rsp,"config1:0-63" );PMU_FORMAT_ATTR (ldlat,"config1:0-15" );
@@ -3667,6 +3672,8 @@ static __initconst const struct x86_pmu .cpu_starting = intel_pmu_cpu_starting, .cpu_dying = intel_pmu_cpu_dying, .cpu_dead = intel_pmu_cpu_dead, + + .check_period = intel_pmu_check_period, };static struct attribute *intel_pmu_attrs[];
@@ -3711,6 +3718,8 @@ static __initconst const struct x86_pmu .guest_get_msrs = intel_guest_get_msrs, .sched_task = intel_pmu_sched_task, + + .check_period = intel_pmu_check_period, };static __init void intel_clovertown_quirk (void )
arch/x86/events/perf_event.h +14 -2
@@ -646,6 +646,11 @@ struct x86_pmu {* Intel host/guest support (KVM) */ struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr); + +/* +* Check period value for PERF_EVENT_IOC_PERIOD ioctl. +*/ +int (*check_period) (struct perf_event *event,u64 period); };struct x86_perf_task_context {
@@ -857,7 +862,7 @@ static inline int amd_pmu_init(void)#ifdef CONFIG_CPU_SUP_INTEL -static inline bool intel_pmu_has_bts (struct perf_event *event) +static inline bool intel_pmu_has_bts_period (struct perf_event *event,u64 period) {struct hw_perf_event *hwc = &event->hw;unsigned int hw_event, bts_event;
@@ -868,7 +873,14 @@ static inline bool intel_pmu_has_bts(str hw_event = hwc->config &INTEL_ARCH_EVENT_MASK ; bts_event = x86_pmu.event_map (PERF_COUNT_HW_BRANCH_INSTRUCTIONS ); -return hw_event == bts_event && hwc->sample_period ==1 ; +return hw_event == bts_event && period ==1 ; +} + +static inline bool intel_pmu_has_bts (struct perf_event *event) +{ +struct hw_perf_event *hwc = &event->hw; + +return intel_pmu_has_bts_period (event, hwc->sample_period); }int intel_pmu_save_and_restart (struct perf_event *event);
include/linux/perf_event.h +5 -0
@@ -447,6 +447,11 @@ struct pmu {* Filter events for PMU-specific reasons. */ int (*filter_match) (struct perf_event *event);/* optional */ + +/* +* Check period value for PERF_EVENT_IOC_PERIOD ioctl. +*/ +int (*check_period) (struct perf_event *event,u64 value);/* optional */ };enum perf_addr_filter_action_t {
kernel/events/core.c +16 -0
@@ -4963,6 +4963,11 @@ static void __perf_event_period(struct p } } +static int perf_event_check_period (struct perf_event *event,u64 value) +{ +return event->pmu->check_period (event, value); +} +static int perf_event_period (struct perf_event *event,u64 __user *arg) {u64 value;
@@ -4979,6 +4984,9 @@ static int perf_event_period(struct perfif (event->attr.freq && value > sysctl_perf_event_sample_rate)return -EINVAL ; +if (perf_event_check_period (event, value)) +return -EINVAL ; +event_function_call (event, __perf_event_period, &value);return 0 ;
@@ -9391,6 +9399,11 @@ static int perf_pmu_nop_int(struct pmu *return 0 ; } +static int perf_event_nop_int (struct perf_event *event,u64 value) +{ +return 0 ; +} + static DEFINE_PER_CPU(unsigned int, nop_txn_flags);static void perf_pmu_start_txn (struct pmu *pmu,unsigned int flags)
@@ -9691,6 +9704,9 @@ got_cpu_context: pmu->pmu_disable = perf_pmu_nop_void; } +if (!pmu->check_period) + pmu->check_period = perf_event_nop_int; +if (!pmu->event_idx) pmu->event_idx = perf_event_idx_default;
Greg Kroah-Hartman
maintainerPATCH 56/92 ALSA: hda - Add quirk for HP EliteBook 840 G5
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jurica Vukadin <[email protected]>
commit 4cd3016ce996494f78fdfd87ea35c8ca5d0b413e upstream.
This enables mute LED support and fixes switching jacks when the laptop is docked.
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -924,6 +924,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x103c ,0x807C ,"HP EliteBook 820 G3" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x80FD ,"HP ProBook 640 G2" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x828c ,"HP EliteBook 840 G4" ,CXT_FIXUP_HP_DOCK ), +SND_PCI_QUIRK (0x103c ,0x83b2 ,"HP EliteBook 840 G5" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x83b3 ,"HP EliteBook 830 G5" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x83d3 ,"HP ProBook 640 G4" ,CXT_FIXUP_HP_DOCK ), SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
Greg Kroah-Hartman
maintainerPATCH 57/92 ALSA: usb-audio: Fix implicit fb endpoint setup by quirk
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Reinhardt <[email protected]>
commit 2bc16b9f3223d049b57202ee702fcb5b9b507019 upstream.
The commit a60945fd08e4 ("ALSA: usb-audio: move implicit fb quirks to separate function") introduced an error in the handling of quirks for implicit feedback endpoints. This commit fixes this.
If a quirk successfully sets up an implicit feedback endpoint, usb-audio no longer tries to find the implicit fb endpoint itself.
--- sound/usb/pcm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/usb/pcm.c +8 -1
@@ -314,6 +314,9 @@ static int search_roland_implicit_fb(strreturn 0 ; } +/* Setup an implicit feedback endpoint from a quirk. Returns 0 if no quirk +* applies. Returns 1 if a quirk was found. +*/ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, struct usb_device *dev, struct usb_interface_descriptor *altsd,
@@ -384,7 +387,7 @@ add_sync_ep: subs->data_endpoint->sync_master = subs->sync_endpoint; -return 0 ; +return 1 ; } static int set_sync_endpoint(struct snd_usb_substream *subs,
@@ -423,6 +426,10 @@ static int set_sync_endpoint(struct snd_if (err <0 )return err; +/* endpoint set by quirk */ +if (err >0 ) +return 0 ; +if (altsd->bNumEndpoints <2 )return 0 ;
Greg Kroah-Hartman
maintainerPATCH 58/92 ALSA: pcm: Revert capture stream behavior change in blocking mode
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 00a399cad1a063e7665f06b6497a807db20441fd upstream.
In the commit 62ba568f7aef ("ALSA: pcm: Return 0 when size < start_threshold in capture"), we changed the behavior of __snd_pcm_lib_xfer() to return immediately with 0 when a capture stream has a high start_threshold. This was intended to be a correction of the behavior consistency and looked harmless, but this was the culprit of the recent breakage reported by syzkaller, which was fixed by the commit e190161f96b8 ("ALSA: pcm: Fix tight loop of OSS capture stream").
At the time for the OSS fix, I didn't touch the behavior for ALSA native API, as assuming that this behavior actually is good. But this turned out to be also broken actually for a similar deployment, e.g. one thread goes to a write loop in blocking mode while another thread controls the start/stop of the stream manually.
Overall, the original commit is harmful, and it brings less merit to keep that behavior. Let's revert it.
--- sound/core/pcm_lib.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
sound/core/pcm_lib.c +4 -16
@@ -2112,13 +2112,6 @@ int pcm_lib_apply_appl_ptr(struct snd_pcreturn 0 ; } -/* allow waiting for a capture stream that hasn't been started */ -#if IS_ENABLED (CONFIG_SND_PCM_OSS ) -#define wait_capture_start (substream) ((substream)->oss.oss) -#else -#define wait_capture_start (substream) false -#endif -/* the common loop for read/write data */ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, void *data, bool interleaved,
@@ -2184,16 +2177,11 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(strsnd_pcm_update_hw_ptr (substream);if (!is_playback && - runtime->status->state ==SNDRV_PCM_STATE_PREPARED ) { -if (size >= runtime->start_threshold) { - err =snd_pcm_start (substream); -if (err <0 ) - goto _end_unlock; - }else if (!wait_capture_start (substream)) { -/* nothing to do */ - err =0 ; + runtime->status->state ==SNDRV_PCM_STATE_PREPARED && + size >= runtime->start_threshold) { + err =snd_pcm_start (substream); +if (err <0 ) goto _end_unlock; - } } avail =snd_pcm_avail (substream);
Greg Kroah-Hartman
maintainerPATCH 59/92 ASoC: hdmi-codec: fix oops on re-probe
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 0ce23d6d42147a692768e6baaaa3db75c44f4235 upstream.
hdmi-codec oopses the kernel when it is unbound from a successfully bound audio subsystem, and is then rebound:
Unable to handle kernel NULL pointer dereference at virtual address 0000001c pgd = ee3f0000 [0000001c] *pgd=3cc59831 Internal error: Oops: 817 [#1] PREEMPT ARM Modules linked in: ext2 snd_soc_spdif_tx vmeta dove_thermal snd_soc_kirkwood ofpart marvell_cesa m25p80 orion_wdt mtd spi_nor des_generic gpio_ir_recv snd_soc_kirkwood_spdif bmm_dmabuf auth_rpcgss nfsd autofs4 etnaviv thermal_sys hwmon gpu_sched tda9950 CPU: 0 PID: 1005 Comm: bash Not tainted 4.20.0+ #1762 Hardware name: Marvell Dove (Cubox) PC is at hdmi_dai_probe+0x68/0x80 LR is at find_held_lock+0x20/0x94 pc : [<c04c7de0>] lr : [<c0063bf4>] psr: 600f0013
sp : ee15bd28 ip : eebd8b1c fp : c093b488
r10: ee048000 r9 : eebdab18 r8 : ee048600
r7 : 00000001 r6 : 00000000 r5 : 00000000 r4 : ee82c100
r3 : 00000006 r2 : 00000001 r1 : c067e38c r0 : ee82c100
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none[ 297.318599] Control: 10c5387d Table: 2e3f0019 DAC: 00000051 Process bash (pid: 1005, stack limit = 0xee15a248)
...
[<c04c7de0>] (hdmi_dai_probe) from [<c04b7060>] (soc_probe_dai.part.9+0x34/0x70)
[<c04b7060>] (soc_probe_dai.part.9) from [<c04b81a8>] (snd_soc_instantiate_card+0x734/0xc9c)
[<c04b81a8>] (snd_soc_instantiate_card) from [<c04b8b6c>] (snd_soc_add_component+0x29c/0x378)
[<c04b8b6c>] (snd_soc_add_component) from [<c04b8c8c>] (snd_soc_register_component+0x44/0x54)
[<c04b8c8c>] (snd_soc_register_component) from [<c04c64b4>] (devm_snd_soc_register_component+0x48/0x84) [<c04c64b4>] (devm_snd_soc_register_component) from [<c04c7be8>] (hdmi_codec_probe+0x150/0x260)
[<c04c7be8>] (hdmi_codec_probe) from [<c0373124>] (platform_drv_probe+0x48/0x98)
This happens because hdmi_dai_probe() attempts to access the HDMI codec private data, but this has not been assigned by hdmi_dai_probe() before it calls devm_snd_soc_register_component(). Move the call to dev_set_drvdata() before devm_snd_soc_register_component() to avoid this oops.
--- sound/soc/codecs/hdmi-codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/hdmi-codec.c +2 -2
@@ -795,6 +795,8 @@ static int hdmi_codec_probe(struct platfif (hcd->spdif) hcp->daidrv[i] = hdmi_spdif_dai; +dev_set_drvdata (dev, hcp); + ret =devm_snd_soc_register_component (dev, &hdmi_driver, hcp->daidrv, dai_count);if (ret) {
@@ -802,8 +804,6 @@ static int hdmi_codec_probe(struct platf __func__, ret);return ret; } - -dev_set_drvdata (dev, hcp);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 60/92 tools uapi: fix Alpha support
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Tracy <[email protected]>
commit 842fc0f5dc5c9f9bd91f891554996d903c40cf35 upstream.
--- tools/include/uapi/asm/bitsperlong.h | 2 ++ 1 file changed, 2 insertions(+)
tools/include/uapi/asm/bitsperlong.h +2 -0
@@ -15,6 +15,8 @@#include "../../arch/ia64/include/uapi/asm/bitsperlong.h" #elif defined(__riscv)#include "../../arch/riscv/include/uapi/asm/bitsperlong.h" +#elif defined(__alpha__) +#include "../../arch/alpha/include/uapi/asm/bitsperlong.h" #else #include <asm-generic/bitsperlong.h> #endif
Greg Kroah-Hartman
maintainerPATCH 61/92 riscv: Add pte bit to distinguish swap from invalid
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan O'Rear <[email protected]>
commit e3613bb8afc2a9474c9214d65c8326c5ac02135e upstream.
Previously, invalid PTEs and swap PTEs had the same binary representation, causing errors when attempting to unmap PROT_NONE mappings, including implicit unmap on exit.
Typical error:
swap_info_get: Bad swap file entry 40000000007a9879
BUG: Bad page map in process a.out pte:3d4c3cc0 pmd:3e521401
--- arch/riscv/include/asm/pgtable-bits.h | 6 ++++++ arch/riscv/include/asm/pgtable.h | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
arch/riscv/include/asm/pgtable-bits.h +6 -0
@@ -35,6 +35,12 @@#define _PAGE_SPECIAL _PAGE_SOFT#define _PAGE_TABLE _PAGE_PRESENT +/* +* _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to +* distinguish them from swapped out pages +*/ +#define _PAGE_PROT_NONE _PAGE_READ +#define _PAGE_PFN_SHIFT 10/* Set of bits to preserve across pte_modify() */
arch/riscv/include/asm/pgtable.h +4 -4
@@ -44,7 +44,7 @@/* Page protection bits */ #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) -#define PAGE_NONE __pgprot(0) +#define PAGE_NONE __pgprot(_PAGE_PROT_NONE)#define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ)#define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE)#define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC)
@@ -98,7 +98,7 @@ extern unsigned long empty_zero_page[PAGstatic inline int pmd_present (pmd_t pmd) { -return (pmd_val (pmd) & _PAGE_PRESENT); +return (pmd_val (pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); }static inline int pmd_none (pmd_t pmd)
@@ -178,7 +178,7 @@ static inline pte_t *pte_offset_kernel(pstatic inline int pte_present (pte_t pte) { -return (pte_val (pte) & _PAGE_PRESENT); +return (pte_val (pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); }static inline int pte_none (pte_t pte)
@@ -380,7 +380,7 @@ static inline int ptep_clear_flush_young* * Format of swap PTE: * bit 0: _PAGE_PRESENT (zero) -* bit 1: reserved for future use (zero) +* bit 1: _PAGE_PROT_NONE (zero) * bits 2 to 6: swap type * bits 7 to XLEN-1: swap offset */
Greg Kroah-Hartman
maintainerPATCH 62/92 x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Kuznetsov <[email protected]>
commit 6b1971c694975e49af302229202c0043568b1791 upstream.
SDM says MSR_IA32_VMX_PROCBASED_CTLS2 is only available "If (CPUID.01H:ECX.[5] && IA32_VMX_PROCBASED_CTLS[63])". It was found that some old cpus (namely "Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz (family: 0x6,
model: 0xf, stepping: 0x6") don't have it. Add the missing check.
--- arch/x86/kvm/vmx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/x86/kvm/vmx.c +5 -3
@@ -3620,9 +3620,11 @@ static void nested_vmx_setup_ctls_msrs(s* secondary cpu-based controls. Do not include those that * depend on CPUID bits, they are added later by vmx_cpuid_update. */ -rdmsr (MSR_IA32_VMX_PROCBASED_CTLS2 , - msrs->secondary_ctls_low, - msrs->secondary_ctls_high); +if (msrs->procbased_ctls_high &CPU_BASED_ACTIVATE_SECONDARY_CONTROLS ) +rdmsr (MSR_IA32_VMX_PROCBASED_CTLS2 , + msrs->secondary_ctls_low, + msrs->secondary_ctls_high); + msrs->secondary_ctls_low =0 ; msrs->secondary_ctls_high &= SECONDARY_EXEC_DESC |
Greg Kroah-Hartman
maintainerPATCH 63/92 kvm: vmx: Fix entry number check for add_atomic_switch_msr()
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaoyao Li <[email protected]>
commit 98ae70cc476e833332a2c6bb72f941a25f0de226 upstream.
Commit ca83b4a7f2d068da79a0 ("x86/KVM/VMX: Add find_msr() helper function") introduces the helper function find_msr(), which returns -ENOENT when not find the msr in vmx->msr_autoload.guest/host. Correct checking contion of no more available entry in vmx->msr_autoload.
--- arch/x86/kvm/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/vmx.c +2 -1
@@ -2779,7 +2779,8 @@ static void add_atomic_switch_msr(structif (!entry_only) j =find_msr (&m->host, msr); -if (i ==NR_AUTOLOAD_MSRS || j ==NR_AUTOLOAD_MSRS ) { +if ((i <0 && m->guest.nr ==NR_AUTOLOAD_MSRS ) || + (j <0 && m->host.nr ==NR_AUTOLOAD_MSRS )) {printk_once (KERN_WARNING "Not enough msr switch entries. " "Can't add msr %x\n" , msr);return ;
Greg Kroah-Hartman
maintainerPATCH 64/92 mmc: sunxi: Disable HS-DDR mode for H5 eMMC controller by default
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit d49d92ace4974510dd5845ff91860823cf30dc08 upstream.
Some H5 boards seem to not have proper trace lengths for eMMC to be able to use the default setting for the delay chains under HS-DDR mode. These include the Bananapi M2+ H5 and NanoPi NEO Core2. However the Libre Computer ALL-H3-CC-H5 works just fine.
For the H5 (at least for now), default to not enabling HS-DDR modes in the driver, and expect the device tree to signal HS-DDR capability on boards that work.
--- drivers/mmc/host/sunxi-mmc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/mmc/host/sunxi-mmc.c +10 -1
@@ -1399,7 +1399,16 @@ static int sunxi_mmc_probe(struct platfo mmc->caps |=MMC_CAP_MMC_HIGHSPEED |MMC_CAP_SD_HIGHSPEED |MMC_CAP_ERASE |MMC_CAP_SDIO_IRQ ; -if (host->cfg->clk_delays || host->use_new_timings) +/* +* Some H5 devices do not have signal traces precise enough to +* use HS DDR mode for their eMMC chips. +* +* We still enable HS DDR modes for all the other controller +* variants that support them. +*/ +if ((host->cfg->clk_delays || host->use_new_timings) && + !of_device_is_compatible (pdev->dev.of_node, +"allwinner,sun50i-h5-emmc" )) mmc->caps |=MMC_CAP_1_8V_DDR |MMC_CAP_3_3V_DDR ; ret =mmc_of_parse (mmc);
Greg Kroah-Hartman
maintainerPATCH 65/92 mmc: sunxi: Filter out unsupported modes declared in the device tree
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit d6f11e7d91f2ac85f66194fe3ef8789b49901d64 upstream.
The MMC device tree bindings include properties used to signal various signalling speed modes. Until now the sunxi driver was accepting them without any further filtering, while the sunxi device trees were not actually using them.
Since some of the H5 boards can not run at higher speed modes stably, we are resorting to declaring the higher speed modes per-board.
Regardless, having boards declare modes and blindly following them, even without proper support in the driver, is generally a bad thing.
Filter out all unsupported modes from the capabilities mask after the device tree properties have been parsed.
--- drivers/mmc/host/sunxi-mmc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/mmc/host/sunxi-mmc.c +15 -0
@@ -1415,6 +1415,21 @@ static int sunxi_mmc_probe(struct platfoif (ret) goto error_free_dma; +/* +* If we don't support delay chains in the SoC, we can't use any +* of the higher speed modes. Mask them out in case the device +* tree specifies the properties for them, which gets added to +* the caps by mmc_of_parse() above. +*/ +if (!(host->cfg->clk_delays || host->use_new_timings)) { + mmc->caps &= ~(MMC_CAP_3_3V_DDR |MMC_CAP_1_8V_DDR | +MMC_CAP_1_2V_DDR |MMC_CAP_UHS ); + mmc->caps2 &= ~MMC_CAP2_HS200 ; + } + +/* TODO: This driver doesn't support HS400 mode yet */ + mmc->caps2 &= ~MMC_CAP2_HS400 ; + ret =sunxi_mmc_init_host (host);if (ret) goto error_free_dma;
Greg Kroah-Hartman
maintainerPATCH 66/92 mmc: block: handle complete_work on separate workqueue
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zachary Hays <[email protected]>
commit dcf6e2e38a1c7ccbc535de5e1d9b14998847499d upstream.
The kblockd workqueue is created with the WQ_MEM_RECLAIM flag set. This generates a rescuer thread for that queue that will trigger when the CPU is under heavy load and collect the uncompleted work.
In the case of mmc, this creates the possibility of a deadlock when there are multiple partitions on the device as other blk-mq work is also run on the same queue. For example:
- worker 0 claims the mmc host to work on partition 1
- worker 1 attempts to claim the host for partition 2 but has to wait for worker 0 to finish
- worker 0 schedules complete_work to release the host
- rescuer thread is triggered after time-out and collects the dangling work
- rescuer thread attempts to complete the work in order starting with claim host
- the task to release host is now blocked by a task to claim it and will never be called
The above results in multiple hung tasks that lead to failures to mount partitions.
Handling complete_work on a separate workqueue avoids this by keeping the work completion tasks separate from the other blk-mq work. This allows the host to be released without getting blocked by other tasks attempting to claim the host.
--- drivers/mmc/core/block.c | 10 +++++++++- include/linux/mmc/card.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +9 -1
@@ -2114,7 +2114,7 @@ static void mmc_blk_mq_req_done(struct mif (waiting)wake_up (&mq->wait);else -kblockd_schedule_work (&mq->complete_work); +queue_work (mq->card->complete_wq, &mq->complete_work);return ; }
@@ -2928,6 +2928,13 @@ static int mmc_blk_probe(struct mmc_cardmmc_fixup_device (card, mmc_blk_fixups); + card->complete_wq =alloc_workqueue ("mmc_complete" , +WQ_MEM_RECLAIM |WQ_HIGHPRI ,0 ); +if (unlikely (!card->complete_wq)) { +pr_err ("Failed to create mmc completion workqueue" ); +return -ENOMEM ; + } + md =mmc_blk_alloc (card);if (IS_ERR (md))return PTR_ERR (md);
@@ -2991,6 +2998,7 @@ static void mmc_blk_remove(struct mmc_capm_runtime_put_noidle (&card->dev);mmc_blk_remove_req (md);dev_set_drvdata (&card->dev,NULL ); +destroy_workqueue (card->complete_wq); }static int _mmc_blk_suspend (struct mmc_card *card)
include/linux/mmc/card.h +1 -0
@@ -308,6 +308,7 @@ struct mmc_card {unsigned int nr_parts;unsigned int bouncesz;/* Bounce buffer size */ +struct workqueue_struct *complete_wq;/* Private workqueue */ };static inline bool mmc_large_sector (struct mmc_card *card)
Greg Kroah-Hartman
maintainerPATCH 67/92 Input: bma150 - register input device after setting private data
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Bakker <[email protected]>
commit 90cc55f067f6ca0e64e5e52883ece47d8af7b67b upstream.
Otherwise we introduce a race condition where userspace can request input before we're ready leading to null pointer dereference such as
input: bma150 as /devices/platform/i2c-gpio-2/i2c-5/5-0038/input/input3
Unable to handle kernel NULL pointer dereference at virtual address 00000018 pgd = (ptrval) [00000018] *pgd=55dac831, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] PREEMPT ARM Modules linked in: bma150 input_polldev [last unloaded: bma150] CPU: 0 PID: 2870 Comm: accelerometer Not tainted 5.0.0-rc3-dirty #46 Hardware name: Samsung S5PC110/S5PV210-based board PC is at input_event+0x8/0x60 LR is at bma150_report_xyz+0x9c/0xe0 [bma150] pc : [<80450f70>] lr : [<7f0a614c>] psr: 800d0013
sp : a4c1fd78 ip : 00000081 fp : 00020000
r10: 00000000 r9 : a5e2944c r8 : a7455000
r7 : 00000016 r6 : 00000101 r5 : a7617940 r4 : 80909048
r3 : fffffff2 r2 : 00000000 r1 : 00000003 r0 : 00000000
Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 10c5387d Table: 54e34019 DAC: 00000051
Process accelerometer (pid: 2870, stack limit = 0x(ptrval))
Stackck: (0xa4c1fd78 to 0xa4c20000)
fd60: fffffff3 fc813f6c
fd80: 40410581 d7530ce3 a5e2817c a7617f00 a5e29404 a5e2817c 00000000 7f008324
fda0: a5e28000 8044f59c a5fdd9d0 a5e2945c a46a4a00 a5e29668 a7455000 80454f10
fdc0: 80909048 a5e29668 a5fdd9d0 a46a4a00 806316d0 00000000 a46a4a00 801df5f0
fde0: 00000000 d7530ce3 a4c1fec0 a46a4a00 00000000 a5fdd9d0 a46a4a08 801df53c
fe00: 00000000 801d74bc a4c1fec0 00000000 a4c1ff70 00000000 a7038da8 00000000
fe20: a46a4a00 801e91fc a411bbe0 801f2e88 00000004 00000000 80909048 00000041
fe40: 00000000 00020000 00000000 dead4ead a6a88da0 00000000 ffffe000 806fcae8
fe60: a4c1fec8 00000000 80909048 00000002 a5fdd9d0 a7660110 a411bab0 00000001
fe80: dead4ead ffffffff ffffffff a4c1fe8c a4c1fe8c d7530ce3 20000013 80909048
fea0: 80909048 a4c1ff70 00000001 fffff000 a4c1e000 00000005 00026038 801eabd8
fec0: a7660110 a411bab0 b9394901 00000006 a696201b 76fb3000 00000000 a7039720
fee0: a5fdd9d0 00000101 00000002 00000096 00000000 00000000 00000000 a4c1ff00
ff00: a6b310f4 805cb174 a6b310f4 00000010 00000fe0 00000010 a4c1e000 d7530ce3
ff20: 00000003 a5f41400 a5f41424 00000000 a6962000 00000000 00000003 00000002
ff40: ffffff9c 000a0000 80909048 d7530ce3 a6962000 00000003 80909048 ffffff9c
ff60: a6962000 801d890c 00000000 00000000 00020000 a7590000 00000004 00000100
ff80: 00000001 d7530ce3 000288b8 00026320 000288b8 00000005 80101204 a4c1e000
ffa0: 00000005 80101000 000288b8 00026320 000288b8 000a0000 00000000 00000000
ffc0: 000288b8 00026320 000288b8 00000005 7eef3bac 000264e8 00028ad8 00026038
ffe0: 00000005 7eef3300 76f76e91 76f78546 800d0030 000288b8 00000000 00000000 [<80450f70>] (input_event) from [<a5e2817c>] (0xa5e2817c)
Code: e1a08148 eaffffa8 e351001f 812fff1e (e590c018) ---[ end trace 1c691ee85f2ff243 ]---
--- drivers/input/misc/bma150.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/input/misc/bma150.c +5 -4
@@ -481,13 +481,14 @@ static int bma150_register_input_device( idev->close = bma150_irq_close;input_set_drvdata (idev, bma150); + bma150->input = idev; + error =input_register_device (idev);if (error) {input_free_device (idev);return error; } - bma150->input = idev;return 0 ; }
@@ -510,15 +511,15 @@ static int bma150_register_polled_devicebma150_init_input_device (bma150, ipoll_dev->input); + bma150->input_polled = ipoll_dev; + bma150->input = ipoll_dev->input; + error =input_register_polled_device (ipoll_dev);if (error) {input_free_polled_device (ipoll_dev);return error; } - bma150->input_polled = ipoll_dev; - bma150->input = ipoll_dev->input; -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 68/92 Input: elantech - enable 3rd button support on Fujitsu CELSIUS H780
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matti Kurkela <[email protected]>
commit e8b22d0a329f0fb5c7ef95406872d268f01ee3b1 upstream.
Like Fujitsu CELSIUS H760, the H780 also has a three-button Elantech touchpad, but the driver needs to be told so to enable the middle touchpad button.
The elantech_dmi_force_crc_enabled quirk was not necessary with the H780.
Also document the fw_version and caps values detected for both H760 and H780 models.
--- drivers/input/mouse/elantech.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/input/mouse/elantech.c +9 -0
@@ -1119,6 +1119,8 @@ static int elantech_get_resolution_v4(st* Asus UX31 0x361f00 20, 15, 0e clickpad * Asus UX32VD 0x361f02 00, 15, 0e clickpad * Avatar AVIU-145A2 0x361f00 ? clickpad +* Fujitsu CELSIUS H760 0x570f02 40, 14, 0c 3 hw buttons (**) +* Fujitsu CELSIUS H780 0x5d0f02 41, 16, 0d 3 hw buttons (**) * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons * Fujitsu LIFEBOOK E546 0x470f00 50, 12, 09 2 hw buttons * Fujitsu LIFEBOOK E547 0x470f00 50, 12, 09 2 hw buttons
@@ -1171,6 +1173,13 @@ static const struct dmi_system_id elante DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"), }, }, + { +/* Fujitsu H780 also has a middle button */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H780"), + }, + }, #endif { } };
Greg Kroah-Hartman
maintainerPATCH 69/92 Revert "nfsd4: return default lease period"
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: J. Bruce Fields <[email protected]>
commit 3bf6b57ec2ec945e5a6edf5c202a754f1e852ecd upstream.
This reverts commit d6ebf5088f09472c1136cd506bdc27034a6763f8.
I forgot that the kernel's default lease period should never be decreased!
After a kernel upgrade, the kernel has no way of knowing on its own what the previous lease time was. Unless userspace tells it otherwise, it will assume the previous lease period was the same.
So if we decrease this value in a kernel upgrade, we end up enforcing a grace period that's too short, and clients will fail to reclaim state in time. Symptoms may include EIO and log messages like "NFS:nfs4_reclaim_open_state: Lock reclaim failed!"
There was no real justification for the lease period decrease anyway.
--- fs/nfsd/nfsctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfsctl.c +2 -2
@@ -1239,8 +1239,8 @@ static __net_init int nfsd_init_net(stru retval =nfsd_idmap_init (net);if (retval) goto out_idmap_error; - nn->nfsd4_lease =45 ;/* default lease time */ - nn->nfsd4_grace =45 ; + nn->nfsd4_lease =90 ;/* default lease time */ + nn->nfsd4_grace =90 ; nn->somebody_reclaimed = false; nn->clverifier_counter =prandom_u32 (); nn->clientid_counter =prandom_u32 ();
Greg Kroah-Hartman
maintainerPATCH 70/92 Revert "mm: dont reclaim inodes with many attached pages"
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit 69056ee6a8a3d576ed31e38b3b14c70d6c74edcc upstream.
This reverts commit a76cf1a474d7d ("mm: don't reclaim inodes with many attached pages").
This change causes serious changes to page cache and inode cache behaviour and balance, resulting in major performance regressions when combining worklaods such as large file copies and kernel compiles.
https://bugzilla.kernel.org/show_bug.cgi?id=202441
This change is a hack to work around the problems introduced by changing how agressive shrinkers are on small caches in commit 172b06c32b94 ("mm:
slowly shrink slabs with a relatively small number of objects"). It creates more problems than it solves, wasn't adequately reviewed or tested, so it needs to be reverted.
--- fs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/inode.c +2 -5
@@ -730,11 +730,8 @@ static enum lru_status inode_lru_isolatereturn LRU_REMOVED ; } -/* -* Recently referenced inodes and inodes with many attached pages -* get one more pass. -*/ -if (inode->i_state &I_REFERENCED || inode->i_data.nrpages >1 ) { +/* recently referenced inodes get one more pass */ +if (inode->i_state &I_REFERENCED ) { inode->i_state &= ~I_REFERENCED ;spin_unlock (&inode->i_lock);return LRU_ROTATE ;
Greg Kroah-Hartman
maintainerPATCH 71/92 Revert "mm: slowly shrink slabs with a relatively small number of objects"
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96 upstream.
This reverts commit 172b06c32b9497 ("mm: slowly shrink slabs with a relatively small number of objects").
This change changes the agressiveness of shrinker reclaim, causing small cache and low priority reclaim to greatly increase scanning pressure on small caches. As a result, light memory pressure has a disproportionate affect on small caches, and causes large caches to be reclaimed much faster than previously.
As a result, it greatly perturbs the delicate balance of the VFS caches (dentry/inode vs file page cache) such that the inode/dentry caches are reclaimed much, much faster than the page cache and this drives us into several other caching imbalance related problems.
As such, this is a bad change and needs to be reverted.
[ Needs some massaging to retain the later seekless shrinker
modifications.]
--- mm/vmscan.c | 10 ---------- 1 file changed, 10 deletions(-)
mm/vmscan.c +0 -10
@@ -487,16 +487,6 @@ static unsigned long do_shrink_slab(stru delta = freeable /2 ; } -/* -* Make sure we apply some minimal pressure on default priority -* even on small cgroups. Stale objects are not only consuming memory -* by themselves, but can also hold a reference to a dying cgroup, -* preventing it from being reclaimed. A dying cgroup with all -* corresponding structures like per-cpu stats and kmem caches -* can be really big, so it may lead to a significant waste of memory. -*/ - delta = max_t(unsigned long long, delta, min(freeable, batch_size)); - total_scan += delta;if (total_scan <0 ) { pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n",
Re: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
Quoted 11 lines · Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").
This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
But hey, that's your tradeoff to make.
Signature · 1 line
All Rights Reversed.
Greg Kroah-Hartman
maintainerRe: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
Quoted 13 lines · Rik van Riel
Quoted 11 lines · Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").
Quoted 6 lines
This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
But hey, that's your tradeoff to make.
That's what is in Linus's tree. Should we somehow diverge from that?
thanks,
greg k-h
Re: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
Quoted 14 lines · Greg KH
Quoted 13 lines · Rik van Riel
Quoted 11 lines · Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").
Quoted 8 lines
Quoted 6 lines
This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
But hey, that's your tradeoff to make.
That's what is in Linus's tree. Should we somehow diverge from that?
I believe we should start working on a memcg specific solution to minimize regressions for others and start a more complex solution from there.
Can we special case dead memcgs in the slab reclaim and reclaim more aggressively?
Signature · 2 lines
Michal Hocko SUSE Labs
Re: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
Quoted 22 lines · Michal Hocko
Quoted 21 lines · Greg KH
Quoted 19 lines · Rik van Riel
Quoted 11 lines · Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
But hey, that's your tradeoff to make.
Quoted 8 lines
Quoted 1 line
That's what is in Linus's tree. Should we somehow diverge from that?
I believe we should start working on a memcg specific solution to minimize regressions for others and start a more complex solution from there.
Can we special case dead memcgs in the slab reclaim and reclaim more aggressively?
It's probably better to start a new thread to discuss this issue (btw, doesn't LSF/MM looks like the best place to do it? I can send a proposal).
But I don't think dead cgroups are any special here. At the moment when a cgroup is deleted, associated slab objects can be perfectly used by processes in other cgroups, so we can't reclaim them. Slab objects (vfs objects first of all) are quite often shared between cgroups, we can't just ignore it.
So in order to avoid leaks we'll need to apply some artificial pressure constantly, and then it's not clear why we need to do it separately for dead and living cgroups.
So I still believe that Rik's/mine approach is the right thing to do, we just need to apply the pressure gently, including all corner cases (e.g. concurrency issues spotted by Dave).
Generally speaking, the problem occurs because the lifecycle of a slab object can be much longer than the lifecycle of the corresponding memory cgroup. And because we pin the memcg by the object, we're wasting lot of memory. Right now we allow certain amount of vfs objects to reside in the memory pretty much forever unless we have a really strong memory pressure. It's arguable fine because inodes and dentries are relatively small, but if each of them holds a 200kb+ dead memcg, it becomes very noticeable.
So we either have to apply the memory pressure more evenly (what Rik and I are proposing), or completely reparent slab objects on cgroup removal.
Thanks!
Re: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
Quoted 25 lines · Roman Gushchin
Quoted 24 lines · Michal Hocko
Quoted 22 lines · Greg KH
Quoted 13 lines · Rik van Riel
Quoted 11 lines · Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").Quoted 6 lines
This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
But hey, that's your tradeoff to make.
That's what is in Linus's tree. Should we somehow diverge from that?
Quoted 8 lines
Quoted 6 lines
I believe we should start working on a memcg specific solution to minimize regressions for others and start a more complex solution from there.
Can we special case dead memcgs in the slab reclaim and reclaim more aggressively?
It's probably better to start a new thread to discuss this issue
agreed
Quoted 1 line
(btw, doesn't LSF/MM looks like the best place to do it? I can send a proposal).
I was about to do that if nobody else did.
dropped the rest of the email because this really deserves a new discussion.
Signature · 2 lines
Michal Hocko SUSE Labs
Re: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
Ok, I’ll send the proposal later today.
Thanks!
Sent from my iPhone
Quoted 48 lines · Michal Hocko
Quoted 27 lines · Roman Gushchin
Quoted 25 lines · Michal Hocko
Quoted 23 lines · Greg KH
Quoted 14 lines · Rik van Riel
Quoted 12 lines · Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").Quoted 6 lines
This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
But hey, that's your tradeoff to make.
That's what is in Linus's tree. Should we somehow diverge from that?
Quoted 8 lines
Quoted 6 lines
I believe we should start working on a memcg specific solution to minimize regressions for others and start a more complex solution from there.
Can we special case dead memcgs in the slab reclaim and reclaim more aggressively?
It's probably better to start a new thread to discuss this issue
agreed
Quoted 1 line
(btw, doesn't LSF/MM looks like the best place to do it? I can send a proposal).
I was about to do that if nobody else did.
dropped the rest of the email because this really deserves a new discussion.
Signature · 2 lines
Michal Hocko SUSE Labs
Sasha Levin
maintainerRe: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
In reply to Rik van RielQuoted 10 lines · Rik van Riel
Quoted 9 lines · Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.
Quoted 7 lines
Quoted 2 lines
This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
What's the "right" choice though? we get either leaky cgroups or hanging xfs.
Quoted 1 line
But hey, that's your tradeoff to make.
I don't think that any decision was made here, the stable tree simply follows upstream with regards to fixes and bugs such as these: we remain "bug compatible" with upstream in these scenarios, there was no decision made to prefer either bug.
--
Thanks,
Sasha
Re: [PATCH 4.20 71/92] Revert "mm: slowly shrink slabs with a relatively small number of objects"
Am Montag, 18. Februar 2019, 14:34:52 schrieb Sasha Levin:
Quoted 14 lines · Rik van Riel
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
a9a238e83fbb0df31c3b9b67003f8f9d1d1b6c96upstream.This reverts commit
172b06c32b9497("mm: slowly shrink slabs with a relatively small number of objects").
Quoted 7 lines
Quoted 4 lines
This revert will result in the slab caches of dead cgroups with a small number of remaining objects never getting reclaimed, which can be a memory leak in some configurations.
What's the "right" choice though? we get either leaky cgroups or hanging xfs.
This not only made xfs hang. (Since 4.19.3) on two of our servers ext4 got so sluggish that login with ssh needed a minute and more. bash tab completion was unusable. Sometimes systemd-journald was restarted with "Watchdog timeout (limit 3min)!", (journal also was on ext4).
Quoted 11 lines
Quoted 2 lines
But hey, that's your tradeoff to make.
I don't think that any decision was made here, the stable tree simply follows upstream with regards to fixes and bugs such as these: we remain "bug compatible" with upstream in these scenarios, there was no decision made to prefer either bug.
--
Thanks,
Sasha
Regards
Signature · 3 lines
Wolfgang Walter Studentenwerk München Anstalt des öffentlichen Rechts
Greg Kroah-Hartman
maintainerPATCH 72/92 mm: proc: smaps_rollup: fix pss_locked calculation
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandeep Patil <[email protected]>
commit 27dd768ed8db48beefc4d9e006c58e7a00342bde upstream.
The 'pss_locked' field of smaps_rollup was being calculated incorrectly. It accumulated the current pss everytime a locked VMA was found. Fix that by adding to 'pss_locked' the same time as that of 'pss' if the vma being walked is locked.
--- fs/proc/task_mmu.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
fs/proc/task_mmu.c +14 -8
@@ -423,7 +423,7 @@ struct mem_size_stats { };static void smaps_account (struct mem_size_stats *mss,struct page *page, -bool compound,bool young,bool dirty) +bool compound,bool young,bool dirty,bool locked) {int i, nr = compound ?1 <<compound_order (page) :1 ;unsigned long size = nr *PAGE_SIZE ;
@@ -450,24 +450,31 @@ static void smaps_account(struct mem_sizelse mss->private_clean += size; mss->pss += (u64 )size <<PSS_SHIFT ; +if (locked) + mss->pss_locked += (u64 )size <<PSS_SHIFT ;return ; }for (i =0 ; i < nr; i++, page++) {int mapcount =page_mapcount (page); +unsigned long pss = (PAGE_SIZE <<PSS_SHIFT );if (mapcount >=2 ) {if (dirty ||PageDirty (page)) mss->shared_dirty +=PAGE_SIZE ;else mss->shared_clean +=PAGE_SIZE ; - mss->pss += (PAGE_SIZE <<PSS_SHIFT ) / mapcount; + mss->pss += pss / mapcount; +if (locked) + mss->pss_locked += pss / mapcount; }else {if (dirty ||PageDirty (page)) mss->private_dirty +=PAGE_SIZE ;else mss->private_clean +=PAGE_SIZE ; - mss->pss +=PAGE_SIZE <<PSS_SHIFT ; + mss->pss += pss; +if (locked) + mss->pss_locked += pss; } } }
@@ -490,6 +497,7 @@ static void smaps_pte_entry(pte_t *pte, {struct mem_size_stats *mss = walk->private;struct vm_area_struct *vma = walk->vma; +bool locked = !!(vma->vm_flags &VM_LOCKED );struct page *page =NULL ;if (pte_present (*pte)) {
@@ -532,7 +540,7 @@ static void smaps_pte_entry(pte_t *pte,if (!page)return ; -smaps_account (mss, page, false,pte_young (*pte),pte_dirty (*pte)); +smaps_account (mss, page, false,pte_young (*pte),pte_dirty (*pte), locked); }#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -541,6 +549,7 @@ static void smaps_pmd_entry(pmd_t *pmd, {struct mem_size_stats *mss = walk->private;struct vm_area_struct *vma = walk->vma; +bool locked = !!(vma->vm_flags &VM_LOCKED );struct page *page;/* FOLL_DUMP will return -EFAULT on huge zero page */
@@ -555,7 +564,7 @@ static void smaps_pmd_entry(pmd_t *pmd,/* pass */ ; else VM_BUG_ON_PAGE(1, page); -smaps_account (mss, page, true,pmd_young (*pmd),pmd_dirty (*pmd)); +smaps_account (mss, page, true,pmd_young (*pmd),pmd_dirty (*pmd), locked); }#else static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
@@ -737,11 +746,8 @@ static void smap_gather_stats(struct vm_ } }#endif -/* mmap_sem is held in m_start */ walk_page_vma (vma, &smaps_walk); -if (vma->vm_flags &VM_LOCKED ) - mss->pss_locked += mss->pss; }#define SEQ_PUT_DEC (str, val) \
Greg Kroah-Hartman
maintainerPATCH 73/92 alpha: fix page fault handling for r16-r18 targets
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Trofimovich <[email protected]>
commit 491af60ffb848b59e82f7c9145833222e0bf27a5 upstream.
Fix page fault handling code to fixup r16-r18 registers. Before the patch code had off-by-two registers bug. This bug caused overwriting of ps,pc,gp registers instead of fixing intended r16,r17,r18 (see struct pt_regs).
More details:
Initially Dmitry noticed a kernel bug as a failure on strace test suite. Test passes unmapped userspace pointer to io_submit:
```c
#include <err.h>
#include <unistd.h>
#include <sys/mman.h>
#include <asm/unistd.h>
int main(void)
{
unsigned long ctx = 0;
if (syscall(__NR_io_setup, 1, &ctx))
err(1, "io_setup");
const size_t page_size = sysconf(_SC_PAGESIZE);
const size_t size = page_size * 2;
void *ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (MAP_FAILED == ptr)
err(1, "mmap(%zu)", size);
if (munmap(ptr, size))
err(1, "munmap");
syscall(__NR_io_submit, ctx, 1, ptr + page_size);
syscall(__NR_io_destroy, ctx);
return 0;
}
```Running this test causes kernel to crash when handling page fault:
```
Unable to handle kernel paging request at virtual address ffffffffffff9468
CPU 3
aio(26027): Oops 0
pc = [<fffffc00004eddf8>] ra = [<fffffc00004edd5c>] ps = 0000 Not tainted
pc is at sys_io_submit+0x108/0x200
ra is at sys_io_submit+0x6c/0x200
v0 = fffffc00c58e6300 t0 = fffffffffffffff2 t1 = 000002000025e000
t2 = fffffc01f159fef8 t3 = fffffc0001009640 t4 = fffffc0000e0f6e0
t5 = 0000020001002e9e t6 = 4c41564e49452031 t7 = fffffc01f159c000
s0 = 0000000000000002 s1 = 000002000025e000 s2 = 0000000000000000
s3 = 0000000000000000 s4 = 0000000000000000 s5 = fffffffffffffff2
s6 = fffffc00c58e6300
a0 = fffffc00c58e6300 a1 = 0000000000000000 a2 = 000002000025e000
a3 = 00000200001ac260 a4 = 00000200001ac1e8 a5 = 0000000000000001
t8 = 0000000000000008 t9 = 000000011f8bce30 t10= 00000200001ac440
t11= 0000000000000000 pv = fffffc00006fd320 at = 0000000000000000
gp = 0000000000000000 sp = 00000000265fd174
Disabling lock debugging due to kernel taint
Trace:
[<fffffc0000311404>] entSys+0xa4/0xc0
```Here gp has invalid value. gp is s overwritten by a fixup for the following page fault handler in io_submit` syscall handler:
```
__se_sys_io_submit
...
ldq a1,0(t1)
bne t0,4280 <__se_sys_io_submit+0x180>
```After a page fault t0 should contain -EFALUT and a1 is 0. Instead gp was overwritten in place of a1.
This happens due to a off-by-two bug in dpf_reg() for r16-r18 (aka a0-a2).
I think the bug went unnoticed for a long time as gp is one of scratch registers. Any kernel function call would re-calculate gp.
Dmitry tracked down the bug origin back to 2.1.32 kernel version where trap_a{0,1,2} fields were inserted into struct pt_regs. And even before that dpf_reg() contained off-by-one error.
--- arch/alpha/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/mm/fault.c +1 -1
@@ -78,7 +78,7 @@ __load_new_mm_context(struct mm_struct */* Macro for exception fixup code to access integer registers. */ #define dpf_reg (r) \ (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ - (r) <= 18 ? (r)+8 : (r)-10]) + (r) <= 18 ? (r)+10 : (r)-10]) asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr,
Greg Kroah-Hartman
maintainerPATCH 74/92 alpha: Fix Eiger NR_IRQS to 128
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meelis Roos <[email protected]>
commit bfc913682464f45bc4d6044084e370f9048de9d5 upstream.
Eiger machine vector definition has nr_irqs 128, and working 2.6.26 boot shows SCSI getting IRQ-s 64 and 65. Current kernel boot fails because Symbios SCSI fails to request IRQ-s and does not find the disks. It has been broken at least since 3.18 - the earliest I could test with my gcc-5.
The headers have moved around and possibly another order of defines has worked in the past - but since 128 seems to be correct and used, fix arch/alpha/include/asm/irq.h to have NR_IRQS=128 for Eiger.
This fixes 4.19-rc7 boot on my Force Flexor A264 (Eiger subarch).
--- arch/alpha/include/asm/irq.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/alpha/include/asm/irq.h +3 -3
@@ -56,15 +56,15 @@#elif defined(CONFIG_ALPHA_DP264 ) || \ defined(CONFIG_ALPHA_LYNX ) || \ - defined(CONFIG_ALPHA_SHARK ) || \ - defined(CONFIG_ALPHA_EIGER ) + defined(CONFIG_ALPHA_SHARK )# define NR_IRQS 64#elif defined(CONFIG_ALPHA_TITAN )#define NR_IRQS 80#elif defined(CONFIG_ALPHA_RAWHIDE ) || \ - defined(CONFIG_ALPHA_TAKARA ) + defined(CONFIG_ALPHA_TAKARA ) || \ + defined(CONFIG_ALPHA_EIGER )# define NR_IRQS 128#elif defined(CONFIG_ALPHA_WILDFIRE )
Greg Kroah-Hartman
maintainerPATCH 75/92 s390/suspend: fix stack setup in swsusp_arch_suspend
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 634692ab7007e8e3fec758ab0b26e65abf7c79e0 upstream.
The patch that added support for the virtually mapped kernel stacks changed swsusp_arch_suspend to switch to the nodat-stack as the vmap stack is not available while going in and out of suspend.
Unfortunately the switch to the nodat-stack is incorrect which breaks suspend to disk.
--- arch/s390/kernel/swsusp.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/swsusp.S +2 -2
@@ -30,10 +30,10 @@ .section .text ENTRY(swsusp_arch_suspend) lg %r1,__LC_NODAT_STACK - aghi %r1,-STACK_FRAME_OVERHEAD stmg %r6,%r15,__SF_GPRS(%r1) + aghi %r1,-STACK_FRAME_OVERHEAD stg %r15,__SF_BACKCHAIN(%r1) - lgr %r1,%r15 + lgr %r15,%r1 /* Store FPU registers */ brasl %r14,save_fpu_regs
Greg Kroah-Hartman
maintainerPATCH 76/92 s390/zcrypt: fix specification exception on z196 during ap probe
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <[email protected]>
commit 8f9aca0c45322a807a343fc32f95f2500f83b9ae upstream.
The older machines don't have the QCI instruction available. With support for up to 256 crypto cards the probing of each card has been extended to check card ids from 0 up to 255. For machines with QCI support there is a filter limiting the range of probed cards. The older machines (z196 and older) don't have this filter and so since support for 256 cards is in the driver all cards are probed. However, these machines also require to have the card id fit into 6 bits. Exceeding this limit results in a specification exception which happens on every kernel startup even when there is no crypto configured and used at all.
This fix limits the range of probed crypto cards to 64 if there is no QCI instruction available to obey to the older ap architecture and so fixes the specification exceptions on z196 machines.
--- drivers/s390/crypto/ap_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/s390/crypto/ap_bus.c +2 -1
@@ -248,7 +248,8 @@ static inline int ap_test_config(unsignestatic inline int ap_test_config_card_id (unsigned int id) {if (!ap_configuration)/* QCI not supported */ -return 1 ; +/* only ids 0...3F may be probed */ +return id <0x40 ?1 :0 ;return ap_test_config (ap_configuration->apm, id); }
Greg Kroah-Hartman
maintainerPATCH 77/92 tracing: probeevent: Correctly update remaining space in dynamic area
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Ziegler <[email protected]>
commit f6675872db57305fa957021efc788f9983ed3b67 upstream.
Commit 9178412ddf5a ("tracing: probeevent: Return consumed bytes of dynamic area") improved the string fetching mechanism by returning the number of required bytes after copying the argument to the dynamic area. However, this return value is now only used to increment the pointer inside the dynamic area but misses updating the 'maxlen' variable which indicates the remaining space in the dynamic area.
This means that fetch_store_string() always reads the *total* size of the dynamic area from the data_loc pointer instead of the *remaining* size (and passes it along to strncpy_from_{user,unsafe}) even if we're already about to copy data into the middle of the dynamic area.
--- kernel/trace/trace_probe_tmpl.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace_probe_tmpl.h +4 -2
@@ -180,10 +180,12 @@ store_trace_args(void *data, struct tracif (unlikely (arg->dynamic)) *dl =make_data_loc (maxlen, dyndata - base); ret =process_fetch_insn (arg->code, regs, dl, base); -if (unlikely (ret <0 && arg->dynamic)) +if (unlikely (ret <0 && arg->dynamic)) { *dl =make_data_loc (0 , dyndata - base); -else + }else { dyndata += ret; + maxlen -= ret; + } } }
Greg Kroah-Hartman
maintainerPATCH 78/92 x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hedi Berriche <[email protected]>
commit f331e766c4be33f4338574f3c9f7f77e98ab4571 upstream.
Calls into UV firmware must be protected against concurrency, expose the efi_runtime_lock to the UV platform, and use it to serialise UV BIOS calls.
--- arch/x86/include/asm/uv/bios.h | 8 +++++++- arch/x86/platform/uv/bios_uv.c | 23 +++++++++++++++++++++-- drivers/firmware/efi/runtime-wrappers.c | 7 +++++++ 3 files changed, 35 insertions(+), 3 deletions(-)
arch/x86/include/asm/uv/bios.h +7 -1
@@ -48,7 +48,8 @@ enum {BIOS_STATUS_SUCCESS =0 ,BIOS_STATUS_UNIMPLEMENTED = -ENOSYS ,BIOS_STATUS_EINVAL = -EINVAL , - BIOS_STATUS_UNAVAIL = -EBUSY +BIOS_STATUS_UNAVAIL = -EBUSY , + BIOS_STATUS_ABORT = -EINTR, };/* Address map parameters */
@@ -167,4 +168,9 @@ extern long system_serial_number;extern struct kobject *sgi_uv_kobj;/* /sys/firmware/sgi_uv */ +/* +* EFI runtime lock; cf. firmware/efi/runtime-wrappers.c for details +*/ +extern struct semaphore __efi_uv_runtime_lock; +#endif /* _ASM_X86_UV_BIOS_H */
arch/x86/platform/uv/bios_uv.c +21 -2
@@ -29,7 +29,8 @@struct uv_systab *uv_systab; -s64 uv_bios_call (enum uv_bios_cmd which,u64 a1,u64 a2,u64 a3,u64 a4,u64 a5) +static s64 __uv_bios_call (enum uv_bios_cmd which,u64 a1,u64 a2,u64 a3, +u64 a4,u64 a5) {struct uv_systab *tab = uv_systab;s64 ret;
@@ -51,6 +52,19 @@ s64 uv_bios_call(enum uv_bios_cmd which,return ret; } + +s64 uv_bios_call (enum uv_bios_cmd which,u64 a1,u64 a2,u64 a3,u64 a4,u64 a5) +{ +s64 ret; + +if (down_interruptible (&__efi_uv_runtime_lock)) +return BIOS_STATUS_ABORT ; + + ret =__uv_bios_call (which, a1, a2, a3, a4, a5); +up (&__efi_uv_runtime_lock); + +return ret; +}EXPORT_SYMBOL_GPL (uv_bios_call); s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
@@ -59,10 +73,15 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmunsigned long bios_flags;s64 ret; +if (down_interruptible (&__efi_uv_runtime_lock)) +return BIOS_STATUS_ABORT ; +local_irq_save (bios_flags); - ret =uv_bios_call (which, a1, a2, a3, a4, a5); + ret =__uv_bios_call (which, a1, a2, a3, a4, a5);local_irq_restore (bios_flags); +up (&__efi_uv_runtime_lock); +return ret; }
drivers/firmware/efi/runtime-wrappers.c +7 -0
@@ -147,6 +147,13 @@ void efi_call_virt_check_flags(unsignedstatic DEFINE_SEMAPHORE (efi_runtime_lock);/* +* Expose the EFI runtime lock to the UV platform +*/ +#ifdef CONFIG_X86_UV +extern struct semaphore __efi_uv_runtime_lock __alias(efi_runtime_lock); +#endif + +/* * Calls the appropriate efi_runtime_service() with the appropriate * arguments. *
Greg Kroah-Hartman
maintainerPATCH 79/92 powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present()
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit a58007621be33e9f7c7bed5d5ff8ecb914e1044a upstream.
In v4.20 we changed our pgd/pud_present() to check for _PAGE_PRESENT rather than just checking that the value is non-zero, e.g.:
static inline int pgd_present(pgd_t pgd)
{
- return !pgd_none(pgd);
+ return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT));
}
Unfortunately this is broken on big endian, as the result of the bitwise & is truncated to int, which is always zero because _PAGE_PRESENT is 0x8000000000000000ul. This means pgd_present() and pud_present() are always false at compile time, and the compiler elides the subsequent code.
Remarkably with that bug present we are still able to boot and run with few noticeable effects. However under some work loads we are able to trigger a warning in the ext4 code:
WARNING: CPU: 11 PID: 29593 at fs/ext4/inode.c:3927 .ext4_set_page_dirty+0x70/0xb0 CPU: 11 PID: 29593 Comm: debugedit Not tainted 4.20.0-rc1 #1 ... NIP .ext4_set_page_dirty+0x70/0xb0 LR .set_page_dirty+0xa0/0x150 Call Trace: .set_page_dirty+0xa0/0x150 .unmap_page_range+0xbf0/0xe10 .unmap_vmas+0x84/0x130 .unmap_region+0xe8/0x190 .__do_munmap+0x2f0/0x510 .__vm_munmap+0x80/0x110 .__se_sys_munmap+0x14/0x30 system_call+0x5c/0x70
The fix is simple, we need to convert the result of the bitwise & to an int before returning it.
Thanks to Erhard, Jan Kara and Aneesh for help with debugging.
--- arch/powerpc/include/asm/book3s/64/pgtable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/book3s/64/pgtable.h +2 -2
@@ -904,7 +904,7 @@ static inline int pud_none(pud_t pud)static inline int pud_present (pud_t pud) { -return (pud_raw (pud) &cpu_to_be64 (_PAGE_PRESENT)); +return !!(pud_raw (pud) &cpu_to_be64 (_PAGE_PRESENT)); }extern struct page *pud_page (pud_t pud);
@@ -951,7 +951,7 @@ static inline int pgd_none(pgd_t pgd)static inline int pgd_present (pgd_t pgd) { -return (pgd_raw (pgd) &cpu_to_be64 (_PAGE_PRESENT)); +return !!(pgd_raw (pgd) &cpu_to_be64 (_PAGE_PRESENT)); }static inline pte_t pgd_pte (pgd_t pgd)
Greg Kroah-Hartman
maintainerPATCH 80/92 scsi: sd: fix entropy gathering for most rotational disks
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Bottomley <[email protected]>
commit e4a056987c86f402f1286e050b1dee3f4ce7c7eb upstream.
The problem is that the default for MQ is not to gather entropy, whereas the default for the legacy queue was always to gather it. The original attempt to fix entropy gathering for rotational disks under MQ added an else branch in sd_read_block_characteristics(). Unfortunately, the entire check isn't reached if the device has no characteristics VPD page. Since this page was only introduced in SBC-3 and its optional anyway, most less expensive rotational disks don't have one, meaning they all stopped gathering entropy when we made MQ the default. In a wholly unrelated change, openssl and openssh won't function until the random number generator is initialised, meaning lots of people have been seeing large delays before they could log into systems with default MQ kernels due to this lack of entropy, because it now can take tens of minutes to initialise the kernel random number generator.
The fix is to set the non-rotational and add-randomness flags unconditionally early on in the disk initialization path, so they can be reset only if the device actually reports being non-rotational via the VPD page.
--- drivers/scsi/sd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/scsi/sd.c +9 -3
@@ -2960,9 +2960,6 @@ static void sd_read_block_characteristicif (rot ==1 ) {blk_queue_flag_set (QUEUE_FLAG_NONROT , q);blk_queue_flag_clear (QUEUE_FLAG_ADD_RANDOM , q); - }else { -blk_queue_flag_clear (QUEUE_FLAG_NONROT , q); -blk_queue_flag_set (QUEUE_FLAG_ADD_RANDOM , q); }if (sdkp->device->type ==TYPE_ZBC ) {
@@ -3099,6 +3096,15 @@ static int sd_revalidate_disk(struct genif (sdkp->media_present) {sd_read_capacity (sdkp, buffer); +/* +* set the default to rotational. All non-rotational devices +* support the block characteristics VPD page, which will +* cause this to be updated correctly and any device which +* doesn't support it should be treated as rotational. +*/ +blk_queue_flag_clear (QUEUE_FLAG_NONROT , q); +blk_queue_flag_set (QUEUE_FLAG_ADD_RANDOM , q); +if (scsi_device_supports_vpd (sdp)) {sd_read_block_provisioning (sdkp);sd_read_block_limits (sdkp);
Greg Kroah-Hartman
maintainerPATCH 81/92 signal: Restore the stop PTRACE_EVENT_EXIT
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric W. Biederman <[email protected]>
commit cf43a757fd49442bc38f76088b70c2299eed2c2f upstream.
In the middle of do_exit() there is there is a call "ptrace_event(PTRACE_EVENT_EXIT, code);" That call places the process in TACKED_TRACED aka "(TASK_WAKEKILL | __TASK_TRACED)" and waits for for the debugger to release the task or SIGKILL to be delivered.
Skipping past dequeue_signal when we know a fatal signal has already been delivered resulted in SIGKILL remaining pending and TIF_SIGPENDING remaining set. This in turn caused the scheduler to not sleep in PTACE_EVENT_EXIT as it figured a fatal signal was pending. This also caused ptrace_freeze_traced in ptrace_check_attach to fail because it left a per thread SIGKILL pending which is what fatal_signal_pending tests for.
This difference in signal state caused strace to report
strace: Exit of unknown pid NNNNN ignored
Therefore update the signal handling state like dequeue_signal would when removing a per thread SIGKILL, by removing SIGKILL from the per thread signal mask and clearing TIF_SIGPENDING.
--- kernel/signal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/signal.c +5 -2
@@ -2436,9 +2436,12 @@ relock: }/* Has this task already been marked for death? */ - ksig->info.si_signo = signr =SIGKILL ; -if (signal_group_exit (signal)) +if (signal_group_exit (signal)) { + ksig->info.si_signo = signr =SIGKILL ; +sigdelset (¤t->pending.signal,SIGKILL ); +recalc_sigpending (); goto fatal; + }for (;;) {struct k_sigaction *ka;
Greg Kroah-Hartman
maintainerPATCH 82/92 crypto: ccree - fix resume race condition on init
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gilad Ben-Yossef <[email protected]>
commit 1358c13a48c43f5e4de0c1835291837a27b9720c upstream.
We were enabling autosuspend, which is using data set by the hash module, prior to the hash module being inited, casuing a crash on resume as part of the startup sequence if the race was lost.
This was never a real problem because the PM infra was using low res timers so we were always winning the race, until commit 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers") changed that :-)
Fix this by seperating the PM setup and enablement and doing the latter only at the end of the init sequence.
--- drivers/crypto/ccree/cc_driver.c | 7 ++++--- drivers/crypto/ccree/cc_pm.c | 13 ++++++------- drivers/crypto/ccree/cc_pm.h | 3 +++ 3 files changed, 13 insertions(+), 10 deletions(-)
drivers/crypto/ccree/cc_driver.c +4 -3
@@ -364,7 +364,7 @@ static int init_cc_resources(struct plat rc =cc_ivgen_init (new_drvdata);if (rc) {dev_err (dev,"cc_ivgen_init failed\n" ); - goto post_power_mgr_err; + goto post_buf_mgr_err; }/* Allocate crypto algs */
@@ -387,6 +387,9 @@ static int init_cc_resources(struct plat goto post_hash_err; } +/* All set, we can allow autosuspend */ +cc_pm_go (new_drvdata); +/* If we got here and FIPS mode is enabled * it means all FIPS test passed, so let TEE * know we're good.
@@ -401,8 +404,6 @@ post_cipher_err:cc_cipher_free (new_drvdata); post_ivgen_err:cc_ivgen_fini (new_drvdata); -post_power_mgr_err: -cc_pm_fini (new_drvdata); post_buf_mgr_err:cc_buffer_mgr_fini (new_drvdata); post_req_mgr_err:
drivers/crypto/ccree/cc_pm.c +6 -7
@@ -100,20 +100,19 @@ int cc_pm_put_suspend(struct device *devint cc_pm_init (struct cc_drvdata *drvdata) { -int rc =0 ;struct device *dev =drvdata_to_dev (drvdata);/* must be before the enabling to avoid resdundent suspending */ pm_runtime_set_autosuspend_delay (dev,CC_SUSPEND_TIMEOUT );pm_runtime_use_autosuspend (dev);/* activate the PM module */ - rc =pm_runtime_set_active (dev); -if (rc) -return rc; -/* enable the PM module*/ -pm_runtime_enable (dev); +return pm_runtime_set_active (dev); +} -return rc; +/* enable the PM module*/ +void cc_pm_go (struct cc_drvdata *drvdata) +{ +pm_runtime_enable (drvdata_to_dev (drvdata)); }void cc_pm_fini (struct cc_drvdata *drvdata)
drivers/crypto/ccree/cc_pm.h +3 -0
@@ -16,6 +16,7 @@extern const struct dev_pm_ops ccree_pm;int cc_pm_init (struct cc_drvdata *drvdata); +void cc_pm_go (struct cc_drvdata *drvdata);void cc_pm_fini (struct cc_drvdata *drvdata);int cc_pm_suspend (struct device *dev);int cc_pm_resume (struct device *dev);
@@ -29,6 +30,8 @@ static inline int cc_pm_init(struct cc_dreturn 0 ; } +static void cc_pm_go (struct cc_drvdata *drvdata) {} +static inline void cc_pm_fini (struct cc_drvdata *drvdata) {}static inline int cc_pm_suspend (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 83/92 md/raid1: dont clear bitmap bits on interrupted recovery.
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nate Dailey <[email protected]>
commit dfcc34c99f3ebc16b787b118763bf9cb6b1efc7a upstream.
sync_request_write no longer submits writes to a Faulty device. This has the unfortunate side effect that bitmap bits can be incorrectly cleared if a recovery is interrupted (previously, end_sync_write would have prevented this). This means the next recovery may not copy everything it should, potentially corrupting data.
Add a function for doing the proper md_bitmap_end_sync, called from end_sync_write and the Faulty case in sync_request_write.
backport note to 4.14: s/md_bitmap_end_sync/bitmap_end_sync
--- drivers/md/raid1.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/md/raid1.c +18 -10
@@ -1863,6 +1863,20 @@ static void end_sync_read(struct bio *bireschedule_retry (r1_bio); } +static void abort_sync_write (struct mddev *mddev,struct r1bio *r1_bio) +{ +sector_t sync_blocks =0 ; +sector_t s = r1_bio->sector; +long sectors_to_go = r1_bio->sectors; + +/* make sure these bits don't get cleared. */ +do { +md_bitmap_end_sync (mddev->bitmap, s, &sync_blocks,1 ); + s += sync_blocks; + sectors_to_go -= sync_blocks; + }while (sectors_to_go >0 ); +} +static void end_sync_write (struct bio *bio) {int uptodate = !bio->bi_status;
@@ -1874,15 +1888,7 @@ static void end_sync_write(struct bio *bstruct md_rdev *rdev = conf->mirrors[find_bio_disk (r1_bio, bio)].rdev;if (!uptodate) { -sector_t sync_blocks =0 ; -sector_t s = r1_bio->sector; -long sectors_to_go = r1_bio->sectors; -/* make sure these bits doesn't get cleared. */ -do { -md_bitmap_end_sync (mddev->bitmap, s, &sync_blocks,1 ); - s += sync_blocks; - sectors_to_go -= sync_blocks; - }while (sectors_to_go >0 ); +abort_sync_write (mddev, r1_bio);set_bit (WriteErrorSeen, &rdev->flags);if (!test_and_set_bit (WantReplacement, &rdev->flags)) set_bit(MD_RECOVERY_NEEDED, &
@@ -2172,8 +2178,10 @@ static void sync_request_write(struct md (i == r1_bio->read_disk || !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)))) continue; -if (test_bit (Faulty, &conf->mirrors[i].rdev->flags)) +if (test_bit (Faulty, &conf->mirrors[i].rdev->flags)) { +abort_sync_write (mddev, r1_bio);continue ; + }bio_set_op_attrs (wbio,REQ_OP_WRITE ,0 );if (test_bit (FailFast, &conf->mirrors[i].rdev->flags))
Greg Kroah-Hartman
maintainerPATCH 84/92 x86/a.out: Clear the dump structure initially
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit 10970e1b4be9c74fce8ab6e3c34a7d718f063f2c upstream.
dump_thread32() in aout_core_dump() does not clear the user32 structure allocated on the stack as the first thing on function entry.
As a result, the dump.u_comm, dump.u_ar0 and dump.signal which get assigned before the clearing, get overwritten.
Rename that function to fill_dump() to make it clear what it does and call it first thing.
This was caught while staring at a patch by Derek Robson <[email protected]>.
--- arch/x86/ia32/ia32_aout.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/ia32/ia32_aout.c +4 -2
@@ -51,7 +51,7 @@ static unsigned long get_dr(int n)/* * fill in the user structure for a core dump.. */ -static void dump_thread32 (struct pt_regs *regs,struct user32 *dump) +static void fill_dump (struct pt_regs *regs,struct user32 *dump) {u32 fs, gs;memset (dump,0 ,sizeof (*dump));
@@ -157,10 +157,12 @@ static int aout_core_dump(struct coredum fs =get_fs ();set_fs (KERNEL_DS ); has_dumped =1 ; + +fill_dump (cprm->regs, &dump); +strncpy (dump.u_comm, current->comm,sizeof (current->comm)); dump.u_ar0 = offsetof(struct user32 , regs); dump.signal = cprm->siginfo->si_signo; -dump_thread32 (cprm->regs, &dump);/* * If the size of the dump file exceeds the rlimit, then see
Greg Kroah-Hartman
maintainerPATCH 85/92 sunrpc: fix 4 more call sites that were using stack memory with a scatterlist
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
commit e7afe6c1d486b516ed586dcc10b3e7e3e85a9c2b upstream.
While trying to reproduce a reported kernel panic on arm64, I discovered that AUTH_GSS basically doesn't work at all with older enctypes on arm64 systems with CONFIG_VMAP_STACK enabled. It turns out there still a few places using stack memory with scatterlists, causing krb5_encrypt() and krb5_decrypt() to produce incorrect results (or a BUG if CONFIG_DEBUG_SG is enabled).
Tested with cthon on v4.0/v4.1/v4.2 with krb5/krb5i/krb5p using des3-cbc-sha1 and arcfour-hmac-md5.
--- net/sunrpc/auth_gss/gss_krb5_seqnum.c | 49 ++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 11 deletions(-)
net/sunrpc/auth_gss/gss_krb5_seqnum.c +38 -11
@@ -44,7 +44,7 @@ krb5_make_rc4_seq_num(struct krb5_ctx *k unsigned char *cksum, unsigned char *buf) { struct crypto_sync_skcipher *cipher; -unsigned char plain[8 ]; +unsigned char *plain;s32 code;dprintk ("RPC: %s:\n" , __func__);
@@ -52,6 +52,10 @@ krb5_make_rc4_seq_num(struct krb5_ctx *kif (IS_ERR (cipher))return PTR_ERR (cipher); + plain =kmalloc (8 ,GFP_NOFS ); +if (!plain) +return -ENOMEM ; + plain[0 ] = (unsigned char ) ((seqnum >>24 ) &0xff ); plain[1 ] = (unsigned char ) ((seqnum >>16 ) &0xff ); plain[2 ] = (unsigned char ) ((seqnum >>8 ) &0xff );
@@ -67,6 +71,7 @@ krb5_make_rc4_seq_num(struct krb5_ctx *k code =krb5_encrypt (cipher, cksum, plain, buf,8 ); out: +kfree (plain);crypto_free_sync_skcipher (cipher);return code; }
@@ -77,12 +82,17 @@ krb5_make_seq_num(struct krb5_ctx *kctx,u32 seqnum, unsigned char *cksum, unsigned char *buf) { - unsigned char plain[8]; + unsigned char *plain; +s32 code;if (kctx->enctype ==ENCTYPE_ARCFOUR_HMAC )return krb5_make_rc4_seq_num (kctx, direction, seqnum, cksum, buf); + plain =kmalloc (8 ,GFP_NOFS ); +if (!plain) +return -ENOMEM ; + plain[0 ] = (unsigned char ) (seqnum &0xff ); plain[1 ] = (unsigned char ) ((seqnum >>8 ) &0xff ); plain[2 ] = (unsigned char ) ((seqnum >>16 ) &0xff );
@@ -93,7 +103,9 @@ krb5_make_seq_num(struct krb5_ctx *kctx, plain[6 ] = direction; plain[7 ] = direction; -return krb5_encrypt (key, cksum, plain, buf,8 ); + code =krb5_encrypt (key, cksum, plain, buf,8 ); +kfree (plain); +return code; } static s32
@@ -101,7 +113,7 @@ krb5_get_rc4_seq_num(struct krb5_ctx *kc unsigned char *buf, int *direction, s32 *seqnum) { struct crypto_sync_skcipher *cipher; -unsigned char plain[8 ]; +unsigned char *plain;s32 code;dprintk ("RPC: %s:\n" , __func__);
@@ -113,20 +125,28 @@ krb5_get_rc4_seq_num(struct krb5_ctx *kcif (code) goto out; + plain =kmalloc (8 ,GFP_NOFS ); +if (!plain) { + code = -ENOMEM ; + goto out; + } + code =krb5_decrypt (cipher, cksum, buf, plain,8 );if (code) - goto out; + goto out_plain;if ((plain[4 ] != plain[5 ]) || (plain[4 ] != plain[6 ]) || (plain[4 ] != plain[7 ])) { code = (s32 )KG_BAD_SEQ ; - goto out; + goto out_plain; } *direction = plain[4 ]; *seqnum = ((plain[0 ] <<24 ) | (plain[1 ] <<16 ) | (plain[2 ] <<8 ) | (plain[3 ])); +out_plain: +kfree (plain); out:crypto_free_sync_skcipher (cipher);return code;
@@ -139,7 +159,7 @@ krb5_get_seq_num(struct krb5_ctx *kctx, int *direction, u32 *seqnum) { s32 code; -unsigned char plain[8 ]; +unsigned char *plain;struct crypto_sync_skcipher *key = kctx->seq;dprintk ("RPC: krb5_get_seq_num:\n" );
@@ -147,18 +167,25 @@ krb5_get_seq_num(struct krb5_ctx *kctx,if (kctx->enctype ==ENCTYPE_ARCFOUR_HMAC )return krb5_get_rc4_seq_num (kctx, cksum, buf, direction, seqnum); + plain =kmalloc (8 ,GFP_NOFS ); +if (!plain) +return -ENOMEM ;if ((code =krb5_decrypt (key, cksum, buf, plain,8 ))) -return code; + goto out;if ((plain[4 ] != plain[5 ]) || (plain[4 ] != plain[6 ]) || - (plain[4 ] != plain[7 ])) -return (s32 )KG_BAD_SEQ ; + (plain[4 ] != plain[7 ])) { + code = (s32 )KG_BAD_SEQ ; + goto out; + } *direction = plain[4 ]; *seqnum = ((plain[0 ]) | (plain[1 ] <<8 ) | (plain[2 ] <<16 ) | (plain[3 ] <<24 )); -return 0 ; +out: +kfree (plain); +return code; }
Greg Kroah-Hartman
maintainerPATCH 86/92 dm crypt: dont overallocate the integrity tag space
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit ff0c129d3b5ecb3df7c8f5e2236582bf745b6c5f upstream.
bio_sectors() returns the value in the units of 512-byte sectors (no matter what the real sector size of the device). dm-crypt multiplies bio_sectors() by on_disk_tag_size to calculate the space allocated for integrity tags. If dm-crypt is running with sector size larger than 512b, it allocates more data than is needed.
Device Mapper trims the extra space when passing the bio to dm-integrity, so this bug didn't result in any visible misbehavior. But it must be fixed to avoid wasteful memory allocation for the block integrity payload.
--- drivers/md/dm-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
@@ -932,7 +932,7 @@ static int dm_crypt_integrity_io_alloc(sif (IS_ERR (bip))return PTR_ERR (bip); - tag_len = io->cc->on_disk_tag_size *bio_sectors (bio); + tag_len = io->cc->on_disk_tag_size * (bio_sectors (bio) >> io->cc->sector_shift); bip->bip_iter.bi_size = tag_len; bip->bip_iter.bi_sector = io->cc->start + io->sector;
Greg Kroah-Hartman
maintainerPATCH 87/92 dm thin: fix bug where bio that overwrites thin block ignores FUA
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikos Tsironis <[email protected]>
commit 4ae280b4ee3463fa57bbe6eede26b97daff8a0f1 upstream.
When provisioning a new data block for a virtual block, either because the block was previously unallocated or because we are breaking sharing, if the whole block of data is being overwritten the bio that triggered the provisioning is issued immediately, skipping copying or zeroing of the data block.
When this bio completes the new mapping is inserted in to the pool's metadata by process_prepared_mapping(), where the bio completion is signaled to the upper layers.
This completion is signaled without first committing the metadata. If the bio in question has the REQ_FUA flag set and the system crashes right after its completion and before the next metadata commit, then the write is lost despite the REQ_FUA flag requiring that I/O completion for this request must only be signaled after the data has been committed to non-volatile storage.
Fix this by deferring the completion of overwrite bios, with the REQ_FUA flag set, until after the metadata has been committed.
--- drivers/md/dm-thin.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-)
drivers/md/dm-thin.c +50 -5
@@ -257,6 +257,7 @@ struct pool {spinlock_t lock;struct bio_list deferred_flush_bios; +struct bio_list deferred_flush_completions;struct list_head prepared_mappings;struct list_head prepared_discards;struct list_head prepared_discards_pt2;
@@ -956,6 +957,39 @@ static void process_prepared_mapping_faimempool_free (m, &m->tc->pool->mapping_pool); } +static void complete_overwrite_bio (struct thin_c *tc,struct bio *bio) +{ +struct pool *pool = tc->pool; +unsigned long flags; + +/* +* If the bio has the REQ_FUA flag set we must commit the metadata +* before signaling its completion. +*/ +if (!bio_triggers_commit (tc, bio)) { +bio_endio (bio); +return ; + } + +/* +* Complete bio with an error if earlier I/O caused changes to the +* metadata that can't be committed, e.g, due to I/O errors on the +* metadata device. +*/ +if (dm_thin_aborted_changes (tc->td)) { +bio_io_error (bio); +return ; + } + +/* +* Batch together any bios that trigger commits and then issue a +* single commit for them in process_deferred_bios(). +*/ +spin_lock_irqsave (&pool->lock, flags); +bio_list_add (&pool->deferred_flush_completions, bio); +spin_unlock_irqrestore (&pool->lock, flags); +} +static void process_prepared_mapping (struct dm_thin_new_mapping *m) {struct thin_c *tc = m->tc;
@@ -988,7 +1022,7 @@ static void process_prepared_mapping(str*/ if (bio) {inc_remap_and_issue_cell (tc, m->cell, m->data_block); -bio_endio (bio); +complete_overwrite_bio (tc, bio); }else {inc_all_io_entry (tc->pool, m->cell->holder);remap_and_issue (tc, m->cell->holder, m->data_block);
@@ -2317,7 +2351,7 @@ static void process_deferred_bios(struct {unsigned long flags;struct bio *bio; -struct bio_list bios; +struct bio_list bios, bio_completions;struct thin_c *tc; tc =get_first_thin (pool);
@@ -2328,26 +2362,36 @@ static void process_deferred_bios(struct }/* -* If there are any deferred flush bios, we must commit -* the metadata before issuing them. +* If there are any deferred flush bios, we must commit the metadata +* before issuing them or signaling their completion. */ bio_list_init (&bios); +bio_list_init (&bio_completions); +spin_lock_irqsave (&pool->lock, flags);bio_list_merge (&bios, &pool->deferred_flush_bios);bio_list_init (&pool->deferred_flush_bios); + +bio_list_merge (&bio_completions, &pool->deferred_flush_completions); +bio_list_init (&pool->deferred_flush_completions);spin_unlock_irqrestore (&pool->lock, flags); -if (bio_list_empty (&bios) && +if (bio_list_empty (&bios) &&bio_list_empty (&bio_completions) && !(dm_pool_changed_this_transaction (pool->pmd) &&need_commit_due_to_time (pool)))return ;if (commit (pool)) { +bio_list_merge (&bios, &bio_completions); +while ((bio =bio_list_pop (&bios)))bio_io_error (bio);return ; } pool->last_commit_jiffies = jiffies; +while ((bio =bio_list_pop (&bio_completions))) +bio_endio (bio); +while ((bio =bio_list_pop (&bios)))generic_make_request (bio); }
@@ -2954,6 +2998,7 @@ static struct pool *pool_create(struct mINIT_DELAYED_WORK (&pool->no_space_timeout, do_no_space_timeout);spin_lock_init (&pool->lock);bio_list_init (&pool->deferred_flush_bios); +bio_list_init (&pool->deferred_flush_completions);INIT_LIST_HEAD (&pool->prepared_mappings);INIT_LIST_HEAD (&pool->prepared_discards);INIT_LIST_HEAD (&pool->prepared_discards_pt2);
Greg Kroah-Hartman
maintainerPATCH 88/92 drm: Use array_size() when creating lease
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox <[email protected]>
commit 69ef943dbc14b21987c79f8399ffea08f9a1b446 upstream.
Passing an object_count of sufficient size will make object_count * 4 wrap around to be very small, then a later function will happily iterate off the end of the object_ids array. Using array_size() will saturate at SIZE_MAX, the kmalloc() will fail and we'll return an -ENOMEM to the norty userspace.
--- drivers/gpu/drm/drm_lease.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_lease.c +2 -1
@@ -521,7 +521,8 @@ int drm_mode_create_lease_ioctl(struct d object_count = cl->object_count; - object_ids =memdup_user (u64_to_user_ptr (cl->object_ids), object_count *sizeof (__u32)); + object_ids =memdup_user (u64_to_user_ptr (cl->object_ids), +array_size (object_count,sizeof (__u32)));if (IS_ERR (object_ids))return PTR_ERR (object_ids);
Greg Kroah-Hartman
maintainerPATCH 89/92 drm/vkms: Fix license inconsistent
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Siqueira <[email protected]>
commit 7fd56e0260a22c0cfaf9adb94a2427b76e239dd0 upstream.
Fixes license inconsistent related to the VKMS driver and remove the redundant boilerplate comment.
--- drivers/gpu/drm/vkms/vkms_crc.c | 3 ++- drivers/gpu/drm/vkms/vkms_crtc.c | 8 +------- drivers/gpu/drm/vkms/vkms_drv.c | 7 +------ drivers/gpu/drm/vkms/vkms_drv.h | 2 ++ drivers/gpu/drm/vkms/vkms_gem.c | 8 +------- drivers/gpu/drm/vkms/vkms_output.c | 8 +------- drivers/gpu/drm/vkms/vkms_plane.c | 8 +------- 7 files changed, 9 insertions(+), 35 deletions(-)
drivers/gpu/drm/vkms/vkms_crc.c +2 -1
@@ -1,4 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0+ +#include "vkms_drv.h" #include <linux/crc32.h> #include <drm/drm_atomic.h>
drivers/gpu/drm/vkms/vkms_crtc.c +1 -7
@@ -1,10 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -*/ +// SPDX-License-Identifier: GPL-2.0+ #include "vkms_drv.h" #include <drm/drm_atomic_helper.h>
drivers/gpu/drm/vkms/vkms_drv.c +1 -6
@@ -1,9 +1,4 @@ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -*/ +// SPDX-License-Identifier: GPL-2.0+ /** * DOC: vkms (Virtual Kernel Modesetting)
drivers/gpu/drm/vkms/vkms_drv.h +2 -0
@@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef _VKMS_DRV_H_#define _VKMS_DRV_H_
drivers/gpu/drm/vkms/vkms_gem.c +1 -7
@@ -1,10 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -*/ +// SPDX-License-Identifier: GPL-2.0+ #include <linux/shmem_fs.h>
drivers/gpu/drm/vkms/vkms_output.c +1 -7
@@ -1,10 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -*/ +// SPDX-License-Identifier: GPL-2.0+ #include "vkms_drv.h" #include <drm/drm_crtc_helper.h>
drivers/gpu/drm/vkms/vkms_plane.c +1 -7
@@ -1,10 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -*/ +// SPDX-License-Identifier: GPL-2.0+ #include "vkms_drv.h" #include <drm/drm_plane_helper.h>
Greg Kroah-Hartman
maintainerPATCH 90/92 drm/sched: Always trace the dependencies we wait on, to fix a race.
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Anholt <[email protected]>
commit 82abf33766712d8446ea137a3400165e31bd12c7 upstream.
The entity->dependency can go away completely once we've called drm_sched_entity_add_dependency_cb() (if the cb is called before we get around to tracing). The tracepoint is more useful if we trace every dependency instead of just ones that get callbacks installed, anyway, so just do that.
Fixes any easy-to-produce OOPS when tracing the scheduler on V3D with "perf record -a -e gpu_scheduler:.\* glxgears" and DEBUG_SLAB enabled.
--- drivers/gpu/drm/scheduler/sched_entity.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/scheduler/sched_entity.c +2 -5
@@ -434,13 +434,10 @@ struct drm_sched_job *drm_sched_entity_pwhile ((entity->dependency = sched->ops->dependency (sched_job, entity))) { +trace_drm_sched_job_wait_dep (sched_job, entity->dependency); -if (drm_sched_entity_add_dependency_cb (entity)) { - -trace_drm_sched_job_wait_dep (sched_job, - entity->dependency); +if (drm_sched_entity_add_dependency_cb (entity))return NULL ; - } }/* skip jobs from entity that marked guilty */
Greg Kroah-Hartman
maintainerPATCH 91/92 drm/i915: Block fbdev HPD processing during suspend
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lyude Paul <[email protected]>
commit e8a8fedd57fdcebf0e4f24ef0fc7e29323df8e66 upstream.
When resuming, we check whether or not any previously connected MST topologies are still present and if so, attempt to resume them. If this fails, we disable said MST topologies and fire off a hotplug event so that userspace knows to reprobe.
However, sending a hotplug event involves calling drm_fb_helper_hotplug_event(), which in turn results in fbcon doing a connector reprobe in the caller's thread - something we can't do at the point in which i915 calls drm_dp_mst_topology_mgr_resume() since hotplugging hasn't been fully initialized yet.
This currently causes some rather subtle but fatal issues. For example, on my T480s the laptop dock connected to it usually disappears during a suspend cycle, and comes back up a short while after the system has been resumed. This guarantees pretty much every suspend and resume cycle, drm_dp_mst_topology_mgr_set_mst(mgr, false); will be caused and in turn, a connector hotplug will occur. Now it's Rute Goldberg time: when the connector hotplug occurs, i915 reprobes /all/ of the connectors, including eDP. However, eDP probing requires that we power on the panel VDD which in turn, grabs a wakeref to the appropriate power domain on the GPU (on my T480s, this is the PORT_DDI_A_IO domain). This is where things start breaking, since this all happens before intel_power_domains_enable() is called we end up leaking the wakeref that was acquired and never releasing it later. Come next suspend/resume cycle, this causes us to fail to shut down the GPU properly, which causes it not to resume properly and die a horrible complicated death.
(as a note: this only happens when there's both an eDP panel and MST topology connected which is removed mid-suspend. One or the other seems to always be OK).
We could try to fix the VDD wakeref leak, but this doesn't seem like it's worth it at all since we aren't able to handle hotplug detection while resuming anyway. So, let's go with a more robust solution inspired by nouveau: block fbdev from handling hotplug events until we resume fbdev. This allows us to still send sysfs hotplug events to be handled later by user space while we're resuming, while also preventing us from actually processing any hotplug events we receive until it's safe.
This fixes the wakeref leak observed on the T480s and as such, also fixes suspend/resume with MST topologies connected on this machine.
Changes since v2:
* Don't call drm_fb_helper_hotplug_event() under lock, do it after lock (Chris Wilson)
* Don't call drm_fb_helper_hotplug_event() in intel_fbdev_output_poll_changed() under lock (Chris Wilson)
* Always set ifbdev->hpd_waiting (Chris Wilson)
--- drivers/gpu/drm/i915/intel_drv.h | 10 ++++++++++ drivers/gpu/drm/i915/intel_fbdev.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_drv.h +10 -0
@@ -209,6 +209,16 @@ struct intel_fbdev {unsigned long vma_flags;async_cookie_t cookie;int preferred_bpp; + +/* Whether or not fbdev hpd processing is temporarily suspended */ + bool hpd_suspended : 1; +/* Set when a hotplug was received while HPD processing was +* suspended +*/ + bool hpd_waiting : 1; + +/* Protects hpd_suspended */ +struct mutex hpd_lock; };struct intel_encoder {
drivers/gpu/drm/i915/intel_fbdev.c +32 -1
@@ -679,6 +679,7 @@ int intel_fbdev_init(struct drm_device *if (ifbdev ==NULL )return -ENOMEM ; +mutex_init (&ifbdev->hpd_lock);drm_fb_helper_prepare (dev, &ifbdev->helper, &intel_fb_helper_funcs);if (!intel_fbdev_init_bios (dev, ifbdev))
@@ -752,6 +753,26 @@ void intel_fbdev_fini(struct drm_i915_printel_fbdev_destroy (ifbdev); } +/* Suspends/resumes fbdev processing of incoming HPD events. When resuming HPD +* processing, fbdev will perform a full connector reprobe if a hotplug event +* was received while HPD was suspended. +*/ +static void intel_fbdev_hpd_set_suspend (struct intel_fbdev *ifbdev,int state) +{ +bool send_hpd = false; + +mutex_lock (&ifbdev->hpd_lock); + ifbdev->hpd_suspended = state ==FBINFO_STATE_SUSPENDED ; + send_hpd = !ifbdev->hpd_suspended && ifbdev->hpd_waiting; + ifbdev->hpd_waiting = false; +mutex_unlock (&ifbdev->hpd_lock); + +if (send_hpd) { +DRM_DEBUG_KMS ("Handling delayed fbcon HPD event\n" ); +drm_fb_helper_hotplug_event (&ifbdev->helper); + } +} +void intel_fbdev_set_suspend (struct drm_device *dev,int state,bool synchronous) {struct drm_i915_private *dev_priv =to_i915 (dev);
@@ -773,6 +794,7 @@ void intel_fbdev_set_suspend(struct drm_*/ if (state !=FBINFO_STATE_RUNNING )flush_work (&dev_priv->fbdev_suspend_work); +console_lock (); }else {/*
@@ -800,17 +822,26 @@ void intel_fbdev_set_suspend(struct drm_drm_fb_helper_set_suspend (&ifbdev->helper, state);console_unlock (); + +intel_fbdev_hpd_set_suspend (ifbdev, state); }void intel_fbdev_output_poll_changed (struct drm_device *dev) {struct intel_fbdev *ifbdev =to_i915 (dev)->fbdev; +bool send_hpd;if (!ifbdev)return ;intel_fbdev_sync (ifbdev); -if (ifbdev->vma || ifbdev->helper.deferred_setup) + +mutex_lock (&ifbdev->hpd_lock); + send_hpd = !ifbdev->hpd_suspended; + ifbdev->hpd_waiting = true; +mutex_unlock (&ifbdev->hpd_lock); + +if (send_hpd && (ifbdev->vma || ifbdev->helper.deferred_setup))drm_fb_helper_hotplug_event (&ifbdev->helper); }
Greg Kroah-Hartman
maintainerPATCH 92/92 drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set
In reply to Greg Kroah-Hartman4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joonas Lahtinen <[email protected]>
commit 2e7bd10e05afb866b5fb13eda25095c35d7a27cc upstream.
Make sure the underlying VMA in the process address space is the same as it was during vm_mmap to avoid applying WC to wrong VMA.
A more long-term solution would be to have vm_mmap_locked variant in linux/mmap.h for when caller wants to hold mmap_sem for an extended duration.
v2:
- Refactor the compare function
--- drivers/gpu/drm/i915/i915_gem.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +11 -1
@@ -1826,6 +1826,16 @@ i915_gem_sw_finish_ioctl(struct drm_devireturn 0 ; } +static inline bool +__vma_matches (struct vm_area_struct *vma,struct file *filp, +unsigned long addr,unsigned long size) +{ +if (vma->vm_file != filp) +return false; + +return vma->vm_start == addr && (vma->vm_end - vma->vm_start) == size; +} +/** * i915_gem_mmap_ioctl - Maps the contents of an object, returning the address * it is mapped to.
@@ -1884,7 +1894,7 @@ i915_gem_mmap_ioctl(struct drm_device *dreturn -EINTR ; } vma =find_vma (mm, addr); -if (vma) +if (vma &&__vma_matches (vma, obj->base.filp, addr, args->size)) vma->vm_page_prot =pgprot_writecombine (vm_get_page_prot (vma->vm_flags));else
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.20.11 release. There are 92 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 Wed Feb 20 13:34:25 UTC 2019. 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.20.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.20.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.20.11-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.20.y
git commit: d1ed2615d6401be6432cd67f6bd81d7d94af6af4
git describe: v4.20.10-93-gd1ed2615d640
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.20-oe/build/v4.20.10-93-gd1ed2615d640
No regressions (compared to build v4.20.10)
No fixes (compared to build v4.20.10)
Ran 21417 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_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* spectre-meltdown-checker-test
* ltp-fs-tests
* 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 17 lines · Naresh Kamboju
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.20.11 release. There are 92 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 Wed Feb 20 13:34:25 UTC 2019. 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.20.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.20.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Thanks for testing 5 of these 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.20.11 release. There are 92 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 Wed Feb 20 13:34:25 UTC 2019. Anything received after that time might be too late.
Build results:
total: 159 pass: 156 fail: 3
Failed builds:
csky:defconfig
csky:allnoconfig
csky:tinyconfig
Qemu test results:
total: 343 pass: 343 fail: 0
Building csky:defconfig ... failed
--------------
Error log:mm/memory.c: In function ‘__pte_alloc’:mm/memory.c:406:18: error: too many arguments to function ‘pte_alloc_one’
Commit d6caf1d0d553 ("csky: fixup compile error with pte_alloc") (upstream patch 2a60aa14a9a) needs to be removed; the offending patch is not in v4.20.y.
The automatic scripts seem to be a bit too aggressive.
Guenter
Greg Kroah-Hartman
maintainerQuoted 26 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.20.11 release. There are 92 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 Wed Feb 20 13:34:25 UTC 2019. Anything received after that time might be too late.
Build results:
total: 159 pass: 156 fail: 3Failed builds:
csky:defconfig
csky:allnoconfig
csky:tinyconfig
Qemu test results:total: 343 pass: 343 fail: 0Building csky:defconfig ... failed
--------------
Error log:mm/memory.c: In function ‘__pte_alloc’:mm/memory.c:406:18: error: too many arguments to function ‘pte_alloc_one’
Quoted 5 lines
Commit
d6caf1d0d553("csky: fixup compile error withpte_alloc") (upstream patch2a60aa14a9a) needs to be removed; the offending patch is not in v4.20.y.The automatic scripts seem to be a bit too aggressive.
Thanks for finding this. I'll drop it before I do the release. And thanks for testing all of these and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.20.11 release. There are 92 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 Wed Feb 20 13:34:25 UTC 2019. 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.20.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.20.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah