5.2.7-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 5.2.7-stable review
This is the start of the stable review cycle for the 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. 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/v5.x/stable-review/patch-5.2.7-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-5.2.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.2.7-rc1
Xiaolin Zhang <[email protected]>
drm/i915/gvt: fix incorrect cache entry for guest page mapping
Lionel Landwerlin <[email protected]>
drm/i915/perf: fix ICL perf register offsets
Kaike Wan <[email protected]>
IB/hfi1: Field not zero-ed when allocating TID flow memory
Kaike Wan <[email protected]>
IB/hfi1: Drop all TID RDMA READ RESP packets after r_next_psn
John Fleck <[email protected]>
IB/hfi1: Check for error on call to alloc_rsm_map_table
Yishai Hadas <[email protected]>
IB/mlx5: Fix RSS Toeplitz setup to be aligned with the HW specification
Yishai Hadas <[email protected]>
IB/mlx5: Fix clean_mr() to work in the expected order
Yishai Hadas <[email protected]>
IB/mlx5: Move MRs to a kernel PD when freeing them to the MR cache
Yishai Hadas <[email protected]>
IB/mlx5: Use direct mkey destroy command upon UMR unreg failure
Yishai Hadas <[email protected]>
IB/mlx5: Fix unreg_umr to ignore the mkey state
Jason Gunthorpe <[email protected]>
RDMA/devices: Do not deadlock during client removal
Selvin Xavier <[email protected]>
RDMA/bnxt_re: Honor vlan_id in GID entry comparison
Souptick Joarder <[email protected]>
xen/gntdev.c: Replace vm_map_pages() with vm_map_pages_zero()
Juergen Gross <[email protected]>
xen/swiotlb: fix condition for calling xen_destroy_contiguous_region()
Munehisa Kamata <[email protected]>
nbd: replace kill_bdev() with __invalidate_device() again
Suganath Prabu <[email protected]>
scsi: mpt3sas: Use 63-bit DMA addressing on SAS35 HBA
Weiyi Lu <[email protected]>
clk: mediatek: mt8183: Register 13MHz clock earlier for clocksource
Jackie Liu <[email protected]>
io_uring: fix KASAN use after free in io_sq_wq_submit_work
Will Deacon <[email protected]>
arm64: cpufeature: Fix feature comparison for CTR_EL0.{CWG,ERG}Will Deacon <[email protected]>
arm64: compat: Allow single-byte watchpoints on all addresses
Will Deacon <[email protected]>
drivers/perf: arm_pmu: Fix failure path in PM notifier
Helge Deller <[email protected]>
parisc: Fix build of compressed kernel even with debug enabled
Helge Deller <[email protected]>
parisc: Strip debug info from kernel before creating compressed vmlinuz
James Bottomley <[email protected]>
parisc: Add archclean Makefile target
Chris Down <[email protected]>
cgroup: kselftest: relax fs_spec checks
Stefan Haberland <[email protected]>
s390/dasd: fix endless loop after read unit address configuration
Jan Kara <[email protected]>
loop: Fix mount(2) failure due to race with LOOP_SET_FD
Ralph Campbell <[email protected]>
mm/migrate.c: initialize pud_entry in migrate_vma()
Arnd Bergmann <[email protected]>
ubsan: build ubsan.c more conservatively
Mel Gorman <[email protected]>
mm: compaction: avoid 100% CPU usage during compaction when a task is killed
Jan Kara <[email protected]>
mm: migrate: fix reference check race between __find_get_block() and migration
Yang Shi <[email protected]>
mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker
Samuel Thibault <[email protected]>
ALSA: hda: Fix 1-minute detection delay when i915 module is not available
Ondrej Mosnacek <[email protected]>
selinux: fix memory leak in policydb_init()
Christophe Leroy <[email protected]>
powerpc/kasan: fix early boot failure on PPC32
Michał Mirosław <[email protected]>
i2c: at91: fix clk_offset for sama5d2
Michał Mirosław <[email protected]>
i2c: at91: disable TXRDY interrupt after sending data
Rayagonda Kokatanur <[email protected]>
i2c: iproc: Fix i2c master read more than 63 bytes
Jean Delvare <[email protected]>
eeprom: at24: make spd world-readable again
Marco Felsch <[email protected]>
mtd: rawnand: micron: handle on-die "ECC-off" devices correctly
Lyude Paul <[email protected]>
drm/nouveau: Only release VCPI slots on mode changes
Gustavo A. R. Silva <[email protected]>
IB/hfi1: Fix Spectre v1 vulnerability
Michael Wu <[email protected]>
gpiolib: fix incorrect IRQ requesting of an active-low lineevent
Bartosz Golaszewski <[email protected]>
gpio: don't WARN() on NULL descs if gpiolib is disabled
Chris Packham <[email protected]>
gpiolib: Preserve desc->flags when setting state
Andreas Koop <[email protected]>
mmc: mmc_spi: Enable stable writes
Baolin Wang <[email protected]>
mmc: host: sdhci-sprd: Fix the missing pm_runtime_put_noidle()
Joe Perches <[email protected]>
mmc: meson-mx-sdio: Fix misuse of GENMASK macro
Douglas Anderson <[email protected]>
mmc: dw_mmc: Fix occasional hang after tuning on eMMC
Changbin Du <[email protected]>
fgraph: Remove redundant ftrace_graph_notrace_addr() test
Jan Kara <[email protected]>
dax: Fix missed wakeup in put_unlocked_entry()
Filipe Manana <[email protected]>
Btrfs: fix race leading to fs corruption after transaction abort
Filipe Manana <[email protected]>
Btrfs: fix incremental send failure after deduplication
Milan Broz <[email protected]>
tpm: Fix null pointer dereference on chip register error path
Masahiro Yamada <[email protected]>
kbuild: modpost: include .*.cmd files only when targets exist
Masahiro Yamada <[email protected]>
kbuild: initialize CLANG_FLAGS correctly in the top Makefile
M. Vefa Bicakci <[email protected]>
kconfig: Clear "written" flag to avoid data loss
Ralph Campbell <[email protected]>
drm/nouveau/dmem: missing mutex_lock in error path
Fugang Duan <[email protected]>
dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device
Yongxin Liu <[email protected]>
drm/nouveau: fix memory leak in nouveau_conn_reset()
Josh Poimboeuf <[email protected]>
bpf: Disable GCC -fgcse optimization for ___bpf_prog_run()
Zhenzhong Duan <[email protected]>
x86, boot: Remove multiple copy of static function sanitize_boot_params()
Josh Poimboeuf <[email protected]>
x86/paravirt: Fix callee-saved function ELF sizes
Josh Poimboeuf <[email protected]>
x86/kvm: Don't call kvm_spurious_fault() from .fixup
Zhenzhong Duan <[email protected]>
xen/pv: Fix a boot up hang revealed by int3 self test
David Rientjes <[email protected]>
crypto: ccp - Fix SEV_VERSION_GREATER_OR_EQUAL
Peter Zijlstra <[email protected]>
stacktrace: Force USER_DS for stack_trace_save_user()
Pavel Tatashin <[email protected]>
mm/hotplug: make remove_memory() interface usable
Pavel Tatashin <[email protected]>
device-dax: fix memory and resource leak if hotplug fails
Dmitry V. Levin <[email protected]>
nds32: fix asm/syscall.h
Kees Cook <[email protected]>
ipc/mqueue.c: only perform resource calculation if user valid
Dan Carpenter <[email protected]>
drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings
Mikko Rapeli <[email protected]>
uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers
Sam Protsenko <[email protected]>
coda: fix build using bare-metal toolchain
Zhouyang Jia <[email protected]>
coda: add error handling for fget
Anshuman Khandual <[email protected]>
mm/ioremap: check virtual address alignment while creating huge mappings
Peter Rosin <[email protected]>
lib/test_string.c: avoid masking memset16/32/64 failures
Kees Cook <[email protected]>
lib/test_overflow.c: avoid tainting the kernel and fix wrap size
Doug Berger <[email protected]>
mm/cma.c: fail if fixed declaration can't be honored
Arnd Bergmann <[email protected]>
x86: math-emu: Hide clang warnings for 16-bit overflow
Qian Cai <[email protected]>
x86/apic: Silence -Wtype-limits compiler warnings
Henry Burns <[email protected]>
mm/z3fold.c: reinitialize zhdr structs after migration
Yafang Shao <[email protected]>
mm/memcontrol.c: keep local VM counters in sync with the hierarchical ones
Arnd Bergmann <[email protected]>
mm/slab_common.c: work around clang bug #42570
Vitaly Wool <[email protected]>
mm/z3fold: don't try to use buddy slots after free
Benjamin Poirier <[email protected]>
be2net: Signal that the device cannot transmit during reconfiguration
Andrii Nakryiko <[email protected]>
bpf: fix BTF verifier size resolution logic
Liran Alon <[email protected]>
KVM: nVMX: Ignore segment base for VMX memory operand when segment not FS or GS
Arnd Bergmann <[email protected]>
ACPI: fix false-positive -Wuninitialized warning
Arnd Bergmann <[email protected]>
x86: kvm: avoid constant-conversion warning
Ravi Bangoria <[email protected]>
perf version: Fix segfault due to missing OPT_END()
Ronnie Sahlberg <[email protected]>
cifs: fix crash in cifs_dfs_do_automount
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Expose audio inst from DC to DM
Ilya Leoshkevich <[email protected]>
selftests/bpf: do not ignore clang failures
Benjamin Block <[email protected]>
scsi: zfcp: fix GCC compiler warning emitted with -Wmaybe-uninitialized
Arnd Bergmann <[email protected]>
ACPI: blacklist: fix clang warning for unused DMI table
Ihor Matushchak <[email protected]>
virtio-mmio: add error check for platform_get_irq
Jeff Layton <[email protected]>
ceph: return -ERANGE if virtual xattr value didn't fit in buffer
Yan, Zheng <[email protected]>
ceph: fix dir_lease_is_valid()
Andrea Parri <[email protected]>
ceph: fix improper use of smp_mb__before_atomic()
Ronnie Sahlberg <[email protected]>
cifs: Fix a race condition with cifs_echo_request
Qu Wenruo <[email protected]>
btrfs: qgroup: Don't hold qgroup_ioctl_lock in btrfs_qgroup_inherit()
Clement Leger <[email protected]>
remoteproc: copy parent dma_pfn_offset for vdev
Qu Wenruo <[email protected]>
btrfs: Flush before reflinking any extent to prevent NOCOW write falling back to COW without data reservation
David Sterba <[email protected]>
btrfs: fix minimum number of chunk errors for DUP
Qu Wenruo <[email protected]>
btrfs: tree-checker: Check if the file extent end overflows
Vicente Bergas <[email protected]>
arm64: dts: rockchip: Fix USB3 Type-C on rk3399-sapphire
Chunyan Zhang <[email protected]>
clk: sprd: Add check for return value of sprd_clk_regmap_init()
Russell King <[email protected]>
fs/adfs: super: fix use-after-free bug
JC Kuo <[email protected]>
clk: tegra210: fix PLLU and PLLU_OUT1
Arnd Bergmann <[email protected]>
ARM: exynos: Only build MCPM support if used
Geert Uytterhoeven <[email protected]>
dmaengine: rcar-dmac: Reject zero-length slave DMA requests
Petr Cvek <[email protected]>
MIPS: lantiq: Fix bitfield masking
Arnd Bergmann <[email protected]>
swiotlb: fix phys_addr_t overflow warning
Andy Gross <[email protected]>
arm64: qcom: qcs404: Add reset-cells to GCC node
Anson Huang <[email protected]>
soc: imx8: Fix potential kernel dump in error path
Jean-Philippe Brucker <[email protected]>
firmware/psci: psci_checker: Park kthreads before stopping them
Jean-Philippe Brucker <[email protected]>
PCI: OF: Initialize dev->fwnode appropriately
Prarit Bhargava <[email protected]>
kernel/module.c: Only return -EEXIST for modules that have finished loading
Helen Koike <[email protected]>
arm64: dts: rockchip: fix isp iommu clocks and power domain
Dmitry Osipenko <[email protected]>
dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset
Anson Huang <[email protected]>
soc: imx: soc-imx8: Correct return value of error handle
Heinrich Schuchardt <[email protected]>
arm64: dts: marvell: mcbin: enlarge PCI memory window
Sibi Sankar <[email protected]>
soc: qcom: rpmpd: fixup rpmpd set performance state
Niklas Cassel <[email protected]>
arm64: dts: qcom: qcs404-evb: fix l3 min voltage
Cheng Jian <[email protected]>
ftrace: Enable trampoline when rec count returns back to one
Douglas Anderson <[email protected]>
ARM: dts: rockchip: Mark that the rk3288 timer might stop in suspend
Jerome Brunet <[email protected]>
clk: meson: mpll: properly handle spread spectrum
Douglas Anderson <[email protected]>
ARM: dts: rockchip: Make rk3288-veyron-mickey's emmc work again
Douglas Anderson <[email protected]>
ARM: dts: rockchip: Make rk3288-veyron-minnie run at hs200
Russell King <[email protected]>
ARM: riscpc: fix DMA
-------------
Diffstat:
Makefile | 7 +- arch/arm/boot/dts/rk3288-veyron-mickey.dts | 4 -- arch/arm/boot/dts/rk3288-veyron-minnie.dts | 4 -- arch/arm/boot/dts/rk3288.dtsi | 1 + arch/arm/mach-exynos/Kconfig | 6 +- arch/arm/mach-exynos/Makefile | 2 +- arch/arm/mach-exynos/suspend.c | 6 +- arch/arm/mach-rpc/dma.c | 5 +- arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi | 2 + arch/arm64/boot/dts/qcom/qcs404-evb.dtsi | 2 +- arch/arm64/boot/dts/qcom/qcs404.dtsi | 1 + arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi | 5 +- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 8 +-- arch/arm64/include/asm/cpufeature.h | 7 +- arch/arm64/kernel/cpufeature.c | 8 ++- arch/arm64/kernel/hw_breakpoint.c | 7 +- arch/mips/lantiq/irq.c | 5 +- arch/nds32/include/asm/syscall.h | 27 ++++--- arch/parisc/Makefile | 3 + arch/parisc/boot/compressed/Makefile | 4 +- arch/parisc/boot/compressed/vmlinux.lds.S | 4 +- arch/powerpc/mm/kasan/kasan_init_32.c | 7 +- arch/x86/boot/compressed/misc.c | 1 + arch/x86/boot/compressed/misc.h | 1 - arch/x86/entry/entry_64.S | 1 - arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/kvm_host.h | 34 +++++---- arch/x86/include/asm/paravirt.h | 1 + arch/x86/include/asm/traps.h | 2 +- arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/kvm.c | 1 + arch/x86/kvm/mmu.c | 6 +- arch/x86/kvm/vmx/nested.c | 5 +- arch/x86/math-emu/fpu_emu.h | 2 +- arch/x86/math-emu/reg_constant.c | 2 +- arch/x86/xen/enlighten_pv.c | 2 +- arch/x86/xen/xen-asm_64.S | 1 - drivers/acpi/blacklist.c | 4 ++ drivers/block/loop.c | 16 +++-- drivers/block/nbd.c | 2 +- drivers/char/tpm/tpm-chip.c | 23 ++++-- drivers/clk/mediatek/clk-mt8183.c | 46 ++++++++---- drivers/clk/meson/clk-mpll.c | 9 ++- drivers/clk/meson/clk-mpll.h | 1 + drivers/clk/sprd/sc9860-clk.c | 5 +- drivers/clk/tegra/clk-tegra210.c | 8 +-- drivers/crypto/ccp/psp-dev.c | 19 +++-- drivers/dax/kmem.c | 5 +- drivers/dma/sh/rcar-dmac.c | 2 +- drivers/dma/tegra20-apb-dma.c | 12 +++- drivers/firmware/psci/psci_checker.c | 10 +-- drivers/gpio/gpiolib.c | 23 +++--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 + drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 + drivers/gpu/drm/i915/gvt/kvmgt.c | 12 ++++ drivers/gpu/drm/i915/i915_perf.c | 10 ++- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 3 +- drivers/i2c/busses/i2c-at91-core.c | 2 +- drivers/i2c/busses/i2c-at91-master.c | 9 +-- drivers/i2c/busses/i2c-bcm-iproc.c | 10 +-- drivers/infiniband/core/device.c | 54 ++++++++++---- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7 +- drivers/infiniband/hw/bnxt_re/qplib_res.c | 13 ++-- drivers/infiniband/hw/bnxt_re/qplib_res.h | 2 +- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 14 ++-- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 7 +- drivers/infiniband/hw/hfi1/chip.c | 11 ++- drivers/infiniband/hw/hfi1/tid_rdma.c | 43 +---------- drivers/infiniband/hw/hfi1/verbs.c | 2 + drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 + drivers/infiniband/hw/mlx5/mr.c | 23 +++--- drivers/infiniband/hw/mlx5/qp.c | 13 ++-- drivers/misc/eeprom/at24.c | 2 +- drivers/mmc/core/queue.c | 5 ++ drivers/mmc/host/dw_mmc.c | 3 +- drivers/mmc/host/meson-mx-sdio.c | 2 +- drivers/mmc/host/sdhci-sprd.c | 1 + drivers/mtd/nand/raw/nand_micron.c | 14 +++- drivers/net/ethernet/emulex/benet/be_main.c | 6 +- drivers/pci/of.c | 8 +++ drivers/perf/arm_pmu.c | 2 +- drivers/rapidio/devices/rio_mport_cdev.c | 2 + drivers/remoteproc/remoteproc_core.c | 1 + drivers/s390/block/dasd_alias.c | 22 ++++-- drivers/s390/scsi/zfcp_erp.c | 7 ++ drivers/scsi/mpt3sas/mpt3sas_base.c | 12 ++-- drivers/soc/imx/soc-imx8.c | 19 +++-- drivers/soc/qcom/rpmpd.c | 2 +- drivers/virtio/virtio_mmio.c | 7 +- drivers/xen/gntdev.c | 2 +- drivers/xen/swiotlb-xen.c | 6 +- fs/adfs/super.c | 5 +- fs/block_dev.c | 83 +++++++++++++++------- fs/btrfs/ioctl.c | 21 ++++++ fs/btrfs/qgroup.c | 24 ++++++- fs/btrfs/send.c | 77 ++++---------------- fs/btrfs/transaction.c | 10 +++ fs/btrfs/tree-checker.c | 11 +++ fs/btrfs/volumes.c | 3 +- fs/ceph/dir.c | 26 ++++--- fs/ceph/super.h | 7 +- fs/ceph/xattr.c | 14 ++-- fs/cifs/connect.c | 24 ++++--- fs/coda/psdev.c | 5 +- fs/dax.c | 2 +- fs/io_uring.c | 3 +- include/linux/acpi.h | 5 +- include/linux/coda.h | 3 +- include/linux/coda_psdev.h | 11 +++ include/linux/compiler-gcc.h | 2 + include/linux/compiler_types.h | 4 ++ include/linux/fs.h | 6 ++ include/linux/gpio/consumer.h | 64 ++++++++--------- include/linux/memory_hotplug.h | 8 ++- include/rdma/ib_verbs.h | 3 + include/uapi/linux/coda_psdev.h | 13 ---- ipc/mqueue.c | 19 ++--- kernel/bpf/btf.c | 19 +++-- kernel/bpf/core.c | 2 +- kernel/dma/direct.c | 18 +++-- kernel/dma/swiotlb.c | 4 +- kernel/module.c | 6 +- kernel/stacktrace.c | 5 ++ kernel/trace/ftrace.c | 28 ++++---- kernel/trace/trace_functions_graph.c | 17 ++--- lib/Makefile | 3 +- lib/ioremap.c | 9 +++ lib/test_overflow.c | 11 +-- lib/test_string.c | 6 +- mm/cma.c | 13 ++++ mm/compaction.c | 11 +-- mm/memcontrol.c | 22 ++++-- mm/memory_hotplug.c | 64 +++++++++++------ mm/migrate.c | 21 +++--- mm/slab_common.c | 3 +- mm/vmscan.c | 9 ++- mm/z3fold.c | 15 +++- scripts/Makefile.modpost | 6 +- scripts/kconfig/confdata.c | 4 ++ security/selinux/ss/policydb.c | 6 +- sound/hda/hdac_i915.c | 10 +-- tools/perf/builtin-version.c | 1 + tools/testing/selftests/bpf/Makefile | 13 ++-- tools/testing/selftests/cgroup/cgroup_util.c | 3 +- 146 files changed, 961 insertions(+), 561 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/131 ARM: riscpc: fix DMA
[ Upstream commit ffd9a1ba9fdb7f2bd1d1ad9b9243d34e96756ba2 ]
DMA got broken a while back in two different ways:
1) a change in the behaviour of disable_irq() to wait for the interrupt to finish executing causes us to deadlock at the end of DMA.
2) a change to avoid modifying the scatterlist left the first transfer uninitialised.
DMA is only used with expansion cards, so has gone unnoticed.
--- arch/arm/mach-rpc/dma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-rpc/dma.c +4 -1
@@ -128,7 +128,7 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id) }while (1 ); idma->state = ~DMA_ST_AB ; -disable_irq (irq); +disable_irq_nosync (irq);return IRQ_HANDLED ; }
@@ -177,6 +177,9 @@ static void iomd_enable_dma(unsigned int chan, dma_t *dma) DMA_FROM_DEVICE : DMA_TO_DEVICE); } + idma->dma_addr = idma->dma.sg->dma_address; + idma->dma_len = idma->dma.sg->length; +iomd_writeb (DMA_CR_C , dma_base +CR ); idma->state =DMA_ST_AB ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 2/131 ARM: dts: rockchip: Make rk3288-veyron-minnie run at hs200
In reply to Greg Kroah-Hartman[ Upstream commit 1c0479023412ab7834f2e98b796eb0d8c627cd62 ]
As some point hs200 was failing on rk3288-veyron-minnie. See commit 984926781122 ("ARM: dts: rockchip: temporarily remove emmc hs200 speed from rk3288 minnie"). Although I didn't track down exactly when it started working, it seems to work OK now, so let's turn it back on.
To test this, I booted from SD card and then used this script to stress the enumeration process after fixing a memory leak [1]:
cd /sys/bus/platform/drivers/dwmmc_rockchip
for i in $(seq 1 3000); do
echo "========================" $i
echo ff0f0000.dwmmc > unbind
sleep .5
echo ff0f0000.dwmmc > bind
while true; do
if [ -e /dev/mmcblk2 ]; then
break;
fi
sleep .1
done
done
It worked fine.
[1] https://lkml.kernel.org/r/[email protected]
--- arch/arm/boot/dts/rk3288-veyron-minnie.dts | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/boot/dts/rk3288-veyron-minnie.dts +0 -4
@@ -90,10 +90,6 @@ pwm-off-delay-ms = <200>; }; -&emmc { - /delete-property/mmc-hs200-1_8v; -}; - &gpio_keys { pinctrl-0 = <&pwr_key_l &ap_lid_int_l &volum_down_l &volum_up_l>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 3/131 ARM: dts: rockchip: Make rk3288-veyron-mickeys emmc work again
In reply to Greg Kroah-Hartman[ Upstream commit 99fa066710f75f18f4d9a5bc5f6a711968a581d5 ]
When I try to boot rk3288-veyron-mickey I totally fail to make the eMMC work. Specifically my logs (on Chrome OS 4.19):
mmc_host mmc1: card is non-removable.
mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0) mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, actual 50000000HZ div = 0)
mmc1: switch to bus width 8 failed
mmc1: switch to bus width 4 failed
mmc1: new high speed MMC card at address 0001
mmcblk1: mmc1:0001 HAG2e 14.7 GiB
mmcblk1boot0: mmc1:0001 HAG2e partition 1 4.00 MiB
mmcblk1boot1: mmc1:0001 HAG2e partition 2 4.00 MiB
mmcblk1rpmb: mmc1:0001 HAG2e partition 3 4.00 MiB, chardev (243:0)
mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0) mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, actual 50000000HZ div = 0)
mmc1: switch to bus width 8 failed
mmc1: switch to bus width 4 failed
mmc1: tried to HW reset card, got error -110
mmcblk1: error -110 requesting status
mmcblk1: recovery failed!
print_req_error: I/O error, dev mmcblk1, sector 0
...
When I remove the '/delete-property/mmc-hs200-1_8v' then everything is hunky dory.
That line comes from the original submission of the mickey dts upstream, so presumably at the time the HS200 was failing and just enumerating things as a high speed device was fine. ...or maybe it's just that some mickey devices work when enumerating at "high speed", just not mine?
In any case, hs200 seems good now. Let's turn it on.
--- arch/arm/boot/dts/rk3288-veyron-mickey.dts | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/boot/dts/rk3288-veyron-mickey.dts +0 -4
@@ -128,10 +128,6 @@ }; }; -&emmc { - /delete-property/mmc-hs200-1_8v; -}; - &i2c2 { status = "disabled"; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 4/131 clk: meson: mpll: properly handle spread spectrum
In reply to Greg Kroah-Hartman[ Upstream commit f9b3eeebef6aabaa37a351715374de53b6da860c ]
The bit 'SSEN' available on some MPLL DSS outputs is not related to the fractional part of the divider but to the function called 'Spread Spectrum'.
This function might be used to solve EM issues by adding a jitter on clock signal. This widens the signal spectrum and weakens the peaks in it.
While spread spectrum might be useful for some application, it is problematic for others, such as audio.
This patch introduce a new flag to the MPLL driver to enable (or not) the spread spectrum function.
--- drivers/clk/meson/clk-mpll.c | 9 ++++++--- drivers/clk/meson/clk-mpll.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/clk/meson/clk-mpll.c +6 -3
@@ -119,9 +119,12 @@ static int mpll_set_rate(struct clk_hw *hw,meson_parm_write (clk->map, &mpll->sdm, sdm);meson_parm_write (clk->map, &mpll->sdm_en,1 ); -/* Set additional fractional part enable if required */ -if (MESON_PARM_APPLICABLE (&mpll->ssen)) -meson_parm_write (clk->map, &mpll->ssen,1 ); +/* Set spread spectrum if possible */ +if (MESON_PARM_APPLICABLE (&mpll->ssen)) { +unsigned int ss = + mpll->flags &CLK_MESON_MPLL_SPREAD_SPECTRUM ?1 :0 ; +meson_parm_write (clk->map, &mpll->ssen, ss); + }/* Set the integer divider part */ meson_parm_write (clk->map, &mpll->n2, n2);
drivers/clk/meson/clk-mpll.h +1 -0
@@ -23,6 +23,7 @@ struct meson_clk_mpll_data { };#define CLK_MESON_MPLL_ROUND_CLOSEST BIT(0) +#define CLK_MESON_MPLL_SPREAD_SPECTRUM BIT(1)extern const struct clk_ops meson_clk_mpll_ro_ops;extern const struct clk_ops meson_clk_mpll_ops;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 5/131 ARM: dts: rockchip: Mark that the rk3288 timer might stop in suspend
In reply to Greg Kroah-Hartman[ Upstream commit 8ef1ba39a9fa53d2205e633bc9b21840a275908e ]
This is similar to commit e6186820a745 ("arm64: dts: rockchip: Arch counter doesn't tick in system suspend"). Specifically on the rk3288 it can be seen that the timer stops ticking in suspend if we end up running through the "osc_disable" path in rk3288_slp_mode_set(). In that path the 24 MHz clock will turn off and the timer stops.
To test this, I ran this on a Chrome OS filesystem:
before=$(date); \
suspend_stress_test -c1 --suspend_min=30 --suspend_max=31; \
echo ${before}; date
...and I found that unless I plug in a device that requests USB wakeup to be active that the two calls to "date" would show that fewer than 30 seconds passed.
NOTE: deep suspend (where the 24 MHz clock gets disabled) isn't supported yet on upstream Linux so this was tested on a downstream kernel.
--- arch/arm/boot/dts/rk3288.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/rk3288.dtsi +1 -0
@@ -231,6 +231,7 @@ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; clock-frequency = <24000000>; + arm,no-tick-in-suspend; }; timer: timer@ff810000 {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 6/131 ftrace: Enable trampoline when rec count returns back to one
In reply to Greg Kroah-Hartman[ Upstream commit a124692b698b00026a58d89831ceda2331b2e1d0 ]
Custom trampolines can only be enabled if there is only a single ops attached to it. If there's only a single callback registered to a function, and the ops has a trampoline registered for it, then we can call the trampoline directly. This is very useful for improving the performance of ftrace and livepatch.
If more than one callback is registered to a function, the general trampoline is used, and the custom trampoline is not restored back to the direct call even if all the other callbacks were unregistered and we are back to one callback for the function.
To fix this, set FTRACE_FL_TRAMP flag if rec count is decremented to one, and the ops that left has a trampoline.
Testing After this patch :
insmod livepatch_unshare_files.ko
cat /sys/kernel/debug/tracing/enabled_functions
unshare_files (1) R I tramp: 0xffffffffc0000000(klp_ftrace_handler+0x0/0xa0) ->ftrace_ops_assist_func+0x0/0xf0
echo unshare_files > /sys/kernel/debug/tracing/set_ftrace_filter echo function > /sys/kernel/debug/tracing/current_tracer cat /sys/kernel/debug/tracing/enabled_functions
unshare_files (2) R I ->ftrace_ops_list_func+0x0/0x150
echo nop > /sys/kernel/debug/tracing/current_tracer cat /sys/kernel/debug/tracing/enabled_functions
unshare_files (1) R I tramp: 0xffffffffc0000000(klp_ftrace_handler+0x0/0xa0) ->ftrace_ops_assist_func+0x0/0xf0
--- kernel/trace/ftrace.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
kernel/trace/ftrace.c +15 -13
@@ -1622,6 +1622,11 @@ static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec)return keep_regs; } +static struct ftrace_ops * +ftrace_find_tramp_ops_any (struct dyn_ftrace *rec); +static struct ftrace_ops * +ftrace_find_tramp_ops_next (struct dyn_ftrace *rec,struct ftrace_ops *ops); +static bool __ftrace_hash_rec_update (struct ftrace_ops *ops,int filter_hash,bool inc)
@@ -1750,15 +1755,17 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, }/* -* If the rec had TRAMP enabled, then it needs to -* be cleared. As TRAMP can only be enabled iff -* there is only a single ops attached to it. -* In otherwords, always disable it on decrementing. -* In the future, we may set it if rec count is -* decremented to one, and the ops that is left -* has a trampoline. +* The TRAMP needs to be set only if rec count +* is decremented to one, and the ops that is +* left has a trampoline. As TRAMP can only be +* enabled if there is only a single ops attached +* to it. */ - rec->flags &= ~FTRACE_FL_TRAMP ; +if (ftrace_rec_count (rec) ==1 && +ftrace_find_tramp_ops_any (rec)) + rec->flags |=FTRACE_FL_TRAMP ; +else + rec->flags &= ~FTRACE_FL_TRAMP ;/* * flags will be cleared in ftrace_check_record()
@@ -1951,11 +1958,6 @@ static void print_ip_ins(const char *fmt, const unsigned char *p)printk (KERN_CONT "%s%02x" , i ?":" :"" , p[i]); } -static struct ftrace_ops * -ftrace_find_tramp_ops_any (struct dyn_ftrace *rec); -static struct ftrace_ops * -ftrace_find_tramp_ops_next (struct dyn_ftrace *rec,struct ftrace_ops *ops); -enum ftrace_bug_type ftrace_bug_type;const void *ftrace_expected;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 7/131 arm64: dts: qcom: qcs404-evb: fix l3 min voltage
In reply to Greg Kroah-Hartman[ Upstream commit 887b528c958f40b064d53edd0bfa9fea3a69eccd ]
The current l3 min voltage level is not supported by
the regulator (the voltage is not a multiple of the regulator step size), so a driver requesting this exact voltage would fail, see discussion in:
https://patchwork.kernel.org/comment/22461199/
It was agreed upon to set a min voltage level that is a multiple of the regulator step size.
There was actually a patch sent that did this:
https://patchwork.kernel.org/patch/10819313/
However, the commit 331ab98f8c4a ("arm64: dts: qcom: qcs404:
Fix voltages l3") that was applied is not identical to that patch.
--- arch/arm64/boot/dts/qcom/qcs404-evb.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/qcs404-evb.dtsi +1 -1
@@ -118,7 +118,7 @@ }; vreg_l3_1p05: l3 { - regulator-min-microvolt = <1050000>; + regulator-min-microvolt = <1048000>; regulator-max-microvolt = <1160000>; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/131 soc: qcom: rpmpd: fixup rpmpd set performance state
In reply to Greg Kroah-Hartman[ Upstream commit 8b3344422f097debe52296b87a39707d56ca3abe ]
Remoteproc q6v5-mss calls set_performance_state with INT_MAX on rpmpd. This is currently ignored since it is greater than the max supported state. Fixup rpmpd state to max if the required state is greater than all the supported states.
--- drivers/soc/qcom/rpmpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/rpmpd.c +1 -1
@@ -226,7 +226,7 @@ static int rpmpd_set_performance(struct generic_pm_domain *domain,struct rpmpd *pd =domain_to_rpmpd (domain);if (state >MAX_RPMPD_STATE ) - goto out; + state =MAX_RPMPD_STATE ;mutex_lock (&rpmpd_lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 9/131 arm64: dts: marvell: mcbin: enlarge PCI memory window
In reply to Greg Kroah-Hartman[ Upstream commit d3446b266a8c72a7bbc94b65f5fc6d206be77d24 ]
Running a graphics adapter on the MACCHIATObin fails due to an insufficiently sized memory window.
Enlarge the memory window for the PCIe slot to 512 MiB.
With the patch I am able to use a GT710 graphics adapter with 1 GB onboard memory.
These are the mapped memory areas that the graphics adapter is actually using:
Region 0: Memory at cc000000 (32-bit, non-prefetchable) [size=16M] Region 1: Memory at c0000000 (64-bit, prefetchable) [size=128M] Region 3: Memory at c8000000 (64-bit, prefetchable) [size=32M] Region 5: I/O ports at 1000 [size=128]
Expansion ROM at ca000000 [disabled] [size=512K]
--- arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi +2 -0
@@ -184,6 +184,8 @@ num-lanes = <4>; num-viewport = <8>; reset-gpios = <&cp0_gpio2 20 GPIO_ACTIVE_LOW>; + ranges = <0x81000000 0x0 0xf9010000 0x0 0xf9010000 0x0 0x10000 + 0x82000000 0x0 0xc0000000 0x0 0xc0000000 0x0 0x20000000>; status = "okay"; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 10/131 soc: imx: soc-imx8: Correct return value of error handle
In reply to Greg Kroah-Hartman[ Upstream commit 4c396a604a57da8f883a8b3368d83181680d6907 ]
Current implementation of i.MX8 SoC driver returns -ENODEV for all cases of error during initialization, this is incorrect. This patch fixes them using correct return value according to different errors.
--- drivers/soc/imx/soc-imx8.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/soc/imx/soc-imx8.c +11 -5
@@ -73,7 +73,7 @@ static int __init imx8_soc_init(void) soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL );if (!soc_dev_attr) -return -ENODEV ; +return -ENOMEM ; soc_dev_attr->family ="Freescale i.MX" ;
@@ -83,8 +83,10 @@ static int __init imx8_soc_init(void) goto free_soc; id =of_match_node (imx8_soc_match, root); -if (!id) +if (!id) { + ret = -ENODEV ; goto free_soc; + }of_node_put (root);
@@ -96,12 +98,16 @@ static int __init imx8_soc_init(void) } soc_dev_attr->revision =imx8_revision (soc_rev); -if (!soc_dev_attr->revision) +if (!soc_dev_attr->revision) { + ret = -ENOMEM ; goto free_soc; + } soc_dev =soc_device_register (soc_dev_attr); -if (IS_ERR (soc_dev)) +if (IS_ERR (soc_dev)) { + ret =PTR_ERR (soc_dev); goto free_rev; + }return 0 ;
@@ -110,6 +116,6 @@ free_rev: free_soc:kfree (soc_dev_attr);of_node_put (root); -return -ENODEV ; +return ret; }device_initcall (imx8_soc_init);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 11/131 dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset
In reply to Greg Kroah-Hartman[ Upstream commit dc161064beb83c668e0f85766b92b1e7ed186e58 ]
Apparently driver was never tested with DMA_PREP_INTERRUPT flag being unset since it completely disables interrupt handling instead of skipping the callbacks invocations, hence putting channel into unusable state.
The flag is always set by all of kernel drivers that use APB DMA, so let's error out in otherwise case for consistency. It won't be difficult to support that case properly if ever will be needed.
--- drivers/dma/tegra20-apb-dma.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/dma/tegra20-apb-dma.c +10 -2
@@ -977,8 +977,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; } -if (flags &DMA_PREP_INTERRUPT ) +if (flags &DMA_PREP_INTERRUPT ) { csr |=TEGRA_APBDMA_CSR_IE_EOC ; + }else { +WARN_ON_ONCE (1 ); +return NULL ; + } apb_seq |=TEGRA_APBDMA_APBSEQ_WRAP_WORD_1 ;
@@ -1120,8 +1124,12 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; } -if (flags &DMA_PREP_INTERRUPT ) +if (flags &DMA_PREP_INTERRUPT ) { csr |=TEGRA_APBDMA_CSR_IE_EOC ; + }else { +WARN_ON_ONCE (1 ); +return NULL ; + } apb_seq |=TEGRA_APBDMA_APBSEQ_WRAP_WORD_1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 12/131 arm64: dts: rockchip: fix isp iommu clocks and power domain
In reply to Greg Kroah-Hartman[ Upstream commit c432a29d3fc9ee928caeca2f5cf68b3aebfa6817 ]
isp iommu requires wrapper variants of the clocks.
noc variants are always on and using the wrapper variants will activate {A,H}CLK_ISP{0,1} due to the hierarchy.
Tested using the pending isp patch set (which is not upstream yet). Without this patch, streaming from the isp stalls.
Also add the respective power domain and remove the "disabled" status.
Refer:
RK3399 TRM v1.4 Fig. 2-4 RK3399 Clock Architecture Diagram RK3399 TRM v1.4 Fig. 8-1 RK3399 Power Domain Partition
--- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +4 -4
@@ -1706,11 +1706,11 @@ reg = <0x0 0xff914000 0x0 0x100>, <0x0 0xff915000 0x0 0x100>; interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>; interrupt-names = "isp0_mmu"; - clocks = <&cru ACLK_ISP0_NOC>, <&cru HCLK_ISP0_NOC>; + clocks = <&cru ACLK_ISP0_WRAPPER>, <&cru HCLK_ISP0_WRAPPER>; clock-names = "aclk", "iface"; #iommu-cells = <0>; + power-domains = <&power RK3399_PD_ISP0>; rockchip,disable-mmu-reset; - status = "disabled"; }; isp1_mmu: iommu@ff924000 {
@@ -1718,11 +1718,11 @@ reg = <0x0 0xff924000 0x0 0x100>, <0x0 0xff925000 0x0 0x100>; interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH 0>; interrupt-names = "isp1_mmu"; - clocks = <&cru ACLK_ISP1_NOC>, <&cru HCLK_ISP1_NOC>; + clocks = <&cru ACLK_ISP1_WRAPPER>, <&cru HCLK_ISP1_WRAPPER>; clock-names = "aclk", "iface"; #iommu-cells = <0>; + power-domains = <&power RK3399_PD_ISP1>; rockchip,disable-mmu-reset; - status = "disabled"; }; hdmi_sound: hdmi-sound {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 13/131 kernel/module.c: Only return -EEXIST for modules that have finished loading
In reply to Greg Kroah-Hartman[ Upstream commit 6e6de3dee51a439f76eb73c22ae2ffd2c9384712 ]
Microsoft HyperV disables the X86_FEATURE_SMCA bit on AMD systems, and linux guests boot with repeated errors:
amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
The warnings occur because the module code erroneously returns -EEXIST for modules that have failed to load and are in the process of being removed from the module list.
module amd64_edac_mod has a dependency on module edac_mce_amd. Using modules.dep, systemd will load edac_mce_amd for every request of amd64_edac_mod. When the edac_mce_amd module loads, the module has state MODULE_STATE_UNFORMED and once the module load fails and the state becomes MODULE_STATE_GOING. Another request for edac_mce_amd module executes and add_unformed_module() will erroneously return -EEXIST even though the previous instance of edac_mce_amd has MODULE_STATE_GOING. Upon receiving -EEXIST, systemd attempts to load amd64_edac_mod, which fails because of unknown symbols from edac_mce_amd.
add_unformed_module() must wait to return for any case other than MODULE_STATE_LIVE to prevent a race between multiple loads of dependent modules.
--- kernel/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/module.c +2 -4
@@ -3385,8 +3385,7 @@ static bool finished_loading(const char *name)sched_annotate_sleep ();mutex_lock (&module_mutex); mod =find_module_all (name,strlen (name), true); - ret = !mod || mod->state ==MODULE_STATE_LIVE - || mod->state ==MODULE_STATE_GOING ; + ret = !mod || mod->state ==MODULE_STATE_LIVE ;mutex_unlock (&module_mutex);return ret;
@@ -3576,8 +3575,7 @@ again:mutex_lock (&module_mutex); old =find_module_all (mod->name,strlen (mod->name), true);if (old !=NULL ) { -if (old->state ==MODULE_STATE_COMING - || old->state ==MODULE_STATE_UNFORMED ) { +if (old->state !=MODULE_STATE_LIVE ) {/* Wait in case it fails to load. */ mutex_unlock (&module_mutex); err = wait_event_interruptible(module_wq,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 14/131 PCI: OF: Initialize dev->fwnode appropriately
In reply to Greg Kroah-Hartman[ Upstream commit 59b099a6c75e4ddceeaf9676422d8d91d0049755 ]
For PCI devices that have an OF node, set the fwnode as well. This way drivers that rely on fwnode don't need the special case described by commit f94277af03ea ("of/platform: Initialise dev->fwnode appropriately").
--- drivers/pci/of.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pci/of.c +8 -0
@@ -22,12 +22,15 @@ void pci_set_of_node(struct pci_dev *dev)return ; dev->dev.of_node =of_pci_find_child_device (dev->bus->dev.of_node, dev->devfn); +if (dev->dev.of_node) + dev->dev.fwnode = &dev->dev.of_node->fwnode; }void pci_release_of_node (struct pci_dev *dev) {of_node_put (dev->dev.of_node); dev->dev.of_node =NULL ; + dev->dev.fwnode =NULL ; }void pci_set_bus_of_node (struct pci_bus *bus)
@@ -41,13 +44,18 @@ void pci_set_bus_of_node(struct pci_bus *bus)if (node &&of_property_read_bool (node,"external-facing" )) bus->self->untrusted = true; } + bus->dev.of_node = node; + +if (bus->dev.of_node) + bus->dev.fwnode = &bus->dev.of_node->fwnode; }void pci_release_bus_of_node (struct pci_bus *bus) {of_node_put (bus->dev.of_node); bus->dev.of_node =NULL ; + bus->dev.fwnode =NULL ; }struct device_node *__weak pcibios_get_phb_of_node (struct pci_bus *bus)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 15/131 firmware/psci: psci_checker: Park kthreads before stopping them
In reply to Greg Kroah-Hartman[ Upstream commit 92e074acf6f7694e96204265eb18ac113f546e80 ]
Since commit 85f1abe0019f ("kthread, sched/wait: Fix kthread_parkme() completion issue"), kthreads that are bound to a CPU must be parked before being stopped. At the moment the PSCI checker calls kthread_stop() directly on the suspend kthread, which triggers the following warning:
[ 6.068288] WARNING: CPU: 1 PID: 1 at kernel/kthread.c:398 __kthread_bind_mask+0x20/0x78
...
[ 6.190151] Call trace:
[ 6.192566] __kthread_bind_mask+0x20/0x78
[ 6.196615] kthread_unpark+0x74/0x80
[ 6.200235] kthread_stop+0x44/0x1d8
[ 6.203769] psci_checker+0x3bc/0x484
[ 6.207389] do_one_initcall+0x48/0x260
[ 6.211180] kernel_init_freeable+0x2c8/0x368
[ 6.215488] kernel_init+0x10/0x100
[ 6.218935] ret_from_fork+0x10/0x1c
[ 6.222467] ---[ end trace e05e22863d043cd3 ]---kthread_unpark() tries to bind the thread to its CPU and aborts with a WARN() if the thread wasn't in TASK_PARKED state. Park the kthreads before stopping them.
--- drivers/firmware/psci/psci_checker.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/firmware/psci/psci_checker.c +6 -4
@@ -359,16 +359,16 @@ static int suspend_test_thread(void *arg)for (;;) {/* Needs to be set first to avoid missing a wakeup. */ set_current_state (TASK_INTERRUPTIBLE ); -if (kthread_should_stop ()) { -__set_current_state (TASK_RUNNING ); +if (kthread_should_park ())break ; - }schedule (); }pr_info ("CPU %d suspend test results: success %d, shallow states %d, errors %d\n" , cpu, nb_suspend, nb_shallow_sleep, nb_err); +kthread_parkme (); +return nb_err; }
@@ -433,8 +433,10 @@ static int suspend_tests(void)/* Stop and destroy all threads, get return status. */ -for (i =0 ; i < nb_threads; ++i) +for (i =0 ; i < nb_threads; ++i) { + err +=kthread_park (threads[i]); err +=kthread_stop (threads[i]); + } out:cpuidle_resume_and_unlock ();kfree (threads);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 16/131 soc: imx8: Fix potential kernel dump in error path
In reply to Greg Kroah-Hartman[ Upstream commit 1bcbe7300815e91fef18ee905b04f65490ad38c9 ]
When SoC's revision value is 0, SoC driver will print out "unknown" in sysfs's revision node, this "unknown" is a static string which can NOT be freed, this will caused below kernel dump in later error path which calls kfree:
kernel BUG at mm/slub.c:3942!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in: CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.2.0-rc4-next-20190611-00023-g705146c-dirty #2197 Hardware name: NXP i.MX8MQ EVK (DT) pstate: 60000005 (nZCv daif -PAN -UAO) pc : kfree+0x170/0x1b0 lr : imx8_soc_init+0xc0/0xe4
sp : ffff00001003bd10
x29: ffff00001003bd10 x28: ffff00001121e0a0
x27: ffff000011482000 x26: ffff00001117068c
x25: ffff00001121e100 x24: ffff000011482000
x23: ffff000010fe2b58 x22: ffff0000111b9ab0
x21: ffff8000bd9dfba0 x20: ffff0000111b9b70
x19: ffff7e000043f880 x18: 0000000000001000
x17: ffff000010d05fa0 x16: ffff0000122e0000
x15: 0140000000000000 x14: 0000000030360000
x13: ffff8000b94b5bb0 x12: 0000000000000038
x11: ffffffffffffffff x10: ffffffffffffffff
x9 : 0000000000000003 x8 : ffff8000b9488147
x7 : ffff00001003bc00 x6 : 0000000000000000
x5 : 0000000000000003 x4 : 0000000000000003
x3 : 0000000000000003 x2 : b8793acd604edf00
x1 : ffff7e000043f880 x0 : ffff7e000043f888
Call trace: kfree+0x170/0x1b0 imx8_soc_init+0xc0/0xe4 do_one_initcall+0x58/0x1b8 kernel_init_freeable+0x1cc/0x288 kernel_init+0x10/0x100 ret_from_fork+0x10/0x18
This patch fixes this potential kernel dump when a chip's revision is "unknown", it is done by checking whether the revision space can be freed.
--- drivers/soc/imx/soc-imx8.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/imx/soc-imx8.c +2 -1
@@ -112,7 +112,8 @@ static int __init imx8_soc_init(void)return 0 ; free_rev: -kfree (soc_dev_attr->revision); +if (strcmp (soc_dev_attr->revision,"unknown" )) +kfree (soc_dev_attr->revision); free_soc:kfree (soc_dev_attr);of_node_put (root);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 17/131 arm64: qcom: qcs404: Add reset-cells to GCC node
In reply to Greg Kroah-Hartman[ Upstream commit 0763d0c2273a3c72247d325c48fbac3d918d6b87 ]
This patch adds a reset-cells property to the gcc controller on the QCS404. Without this in place, we get warnings like the following if nodes reference a gcc reset:
arch/arm64/boot/dts/qcom/qcs404.dtsi:261.38-310.5: Warning (resets_property):
/soc@0/remoteproc@b00000: Missing property '#reset-cells' in node /soc@0/clock-controller@1800000 or bad phandle (referred from resets[0])
also defined at arch/arm64/boot/dts/qcom/qcs404-evb.dtsi:82.18-84.3
DTC arch/arm64/boot/dts/qcom/qcs404-evb-4000.dtb
arch/arm64/boot/dts/qcom/qcs404.dtsi:261.38-310.5: Warning (resets_property):
/soc@0/remoteproc@b00000: Missing property '#reset-cells' in node /soc@0/clock-controller@1800000 or bad phandle (referred from resets[0])
also defined at arch/arm64/boot/dts/qcom/qcs404-evb.dtsi:82.18-84.3
--- arch/arm64/boot/dts/qcom/qcs404.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/qcs404.dtsi +1 -0
@@ -383,6 +383,7 @@ compatible = "qcom,gcc-qcs404"; reg = <0x01800000 0x80000>; #clock-cells = <1>; + #reset-cells = <1>; assigned-clocks = <&gcc GCC_APSS_AHB_CLK_SRC>; assigned-clock-rates = <19200000>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/131 swiotlb: fix phys_addr_t overflow warning
In reply to Greg Kroah-Hartman[ Upstream commit 9c106119f6538f65bdddb7948a157d90625effa7 ]
On architectures that have a larger dma_addr_t than phys_addr_t, the swiotlb_tbl_map_single() function truncates its return code in the failure path, making it impossible to identify the error later, as we compare to the original value:
kernel/dma/swiotlb.c:551:9: error: implicit conversion from 'dma_addr_t' (aka 'unsigned long long') to 'phys_addr_t' (aka 'unsigned int') changes value from 18446744073709551615 to 4294967295 [-Werror,-Wconstant-conversion]
return DMA_MAPPING_ERROR;
Use an explicit typecast here to convert it to the narrower type, and use the same expression in the error handling later.
--- drivers/xen/swiotlb-xen.c | 2 +- kernel/dma/swiotlb.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/xen/swiotlb-xen.c +1 -1
@@ -402,7 +402,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, map =swiotlb_tbl_map_single (dev, start_dma_addr, phys, size, dir, attrs); -if (map ==DMA_MAPPING_ERROR ) +if (map == (phys_addr_t )DMA_MAPPING_ERROR )return DMA_MAPPING_ERROR ; dev_addr =xen_phys_to_bus (map);
kernel/dma/swiotlb.c +2 -2
@@ -546,7 +546,7 @@ not_found:if (!(attrs &DMA_ATTR_NO_WARN ) &&printk_ratelimit ())dev_warn (hwdev,"swiotlb buffer is full (sz: %zd bytes), total %lu (slots), used %lu (slots)\n" , size, io_tlb_nslabs, tmp_io_tlb_used); -return DMA_MAPPING_ERROR ; +return (phys_addr_t )DMA_MAPPING_ERROR ; found: io_tlb_used += nslots;spin_unlock_irqrestore (&io_tlb_lock, flags);
@@ -664,7 +664,7 @@ bool swiotlb_map(struct device *dev, phys_addr_t *phys, dma_addr_t *dma_addr,/* Oh well, have to allocate and map a bounce buffer. */ *phys =swiotlb_tbl_map_single (dev,__phys_to_dma (dev, io_tlb_start), *phys, size, dir, attrs); -if (*phys ==DMA_MAPPING_ERROR ) +if (*phys == (phys_addr_t )DMA_MAPPING_ERROR )return false;/* Ensure that the address returned is DMA'ble */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 19/131 MIPS: lantiq: Fix bitfield masking
In reply to Greg Kroah-Hartman[ Upstream commit ba1bc0fcdeaf3bf583c1517bd2e3e29cf223c969 ]
The modification of EXIN register doesn't clean the bitfield before the writing of a new value. After a few modifications the bitfield would accumulate only '1's.
--- arch/mips/lantiq/irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/lantiq/irq.c +3 -2
@@ -154,8 +154,9 @@ static int ltq_eiu_settype(struct irq_data *d, unsigned int type)if (edge)irq_set_handler (d->hwirq, handle_edge_irq); -ltq_eiu_w32 (ltq_eiu_r32 (LTQ_EIU_EXIN_C ) | - (val << (i *4 )),LTQ_EIU_EXIN_C ); +ltq_eiu_w32 ((ltq_eiu_r32 (LTQ_EIU_EXIN_C ) & + (~(7 << (i *4 )))) | (val << (i *4 )), +LTQ_EIU_EXIN_C ); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 20/131 dmaengine: rcar-dmac: Reject zero-length slave DMA requests
In reply to Greg Kroah-Hartman[ Upstream commit 78efb76ab4dfb8f74f290ae743f34162cd627f19 ]
While the .device_prep_slave_sg() callback rejects empty scatterlists, it still accepts single-entry scatterlists with a zero-length segment. These may happen if a driver calls dmaengine_prep_slave_single() with a zero len parameter. The corresponding DMA request will never complete, leading to messages like:
rcar-dmac e7300000.dma-controller: Channel Address Error happen
and DMA timeouts.
Although requesting a zero-length DMA request is a driver bug, rejecting it early eases debugging. Note that the .device_prep_dma_memcpy() callback already rejects requests to copy zero bytes.
--- drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +1 -1
@@ -1165,7 +1165,7 @@ rcar_dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,struct rcar_dmac_chan *rchan =to_rcar_dmac_chan (chan);/* Someone calling slave DMA on a generic channel? */ -if (rchan->mid_rid <0 || !sg_len) { +if (rchan->mid_rid <0 || !sg_len || !sg_dma_len (sgl)) {dev_warn (chan->device->dev,"%s: bad parameter: len=%d, id=%d\n" , __func__, sg_len, rchan->mid_rid);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/131 ARM: exynos: Only build MCPM support if used
In reply to Greg Kroah-Hartman[ Upstream commit 24d2c73ff28bcda48607eacc4bc804002dbf78d9 ]
We get a link error for configurations that enable an Exynos SoC that does not require MCPM, but then manually enable MCPM anyway without also turning on the arm-cci:
arch/arm/mach-exynos/mcpm-exynos.o: In function `exynos_pm_power_up_setup':
mcpm-exynos.c:(.text+0x8): undefined reference to `cci_enable_port_for_self'
Change it back to only build the code we actually need, by introducing a CONFIG_EXYNOS_MCPM that serves the same purpose as the older CONFIG_EXYNOS5420_MCPM.
--- arch/arm/mach-exynos/Kconfig | 6 +++++- arch/arm/mach-exynos/Makefile | 2 +- arch/arm/mach-exynos/suspend.c | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-)
arch/arm/mach-exynos/Kconfig +5 -1
@@ -106,7 +106,7 @@ config SOC_EXYNOS5420 bool "SAMSUNG EXYNOS5420" default y depends on ARCH_EXYNOS5 - select MCPM if SMP + select EXYNOS_MCPM if SMP select ARM_CCI400_PORT_CTRL select ARM_CPU_SUSPEND
@@ -115,6 +115,10 @@ config SOC_EXYNOS5800 default y depends on SOC_EXYNOS5420 +config EXYNOS_MCPM + bool + select MCPM + config EXYNOS_CPU_SUSPEND bool select ARM_CPU_SUSPEND
arch/arm/mach-exynos/Makefile +1 -1
@@ -18,5 +18,5 @@ plus_sec := $(call as-instr,.arch_extension sec,+sec) AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec) AFLAGS_sleep.o :=-Wa,-march=armv7-a$(plus_sec) -obj-$(CONFIG_MCPM) += mcpm-exynos.o +obj-$(CONFIG_EXYNOS_MCPM) += mcpm-exynos.o CFLAGS_mcpm-exynos.o += -march=armv7-a
arch/arm/mach-exynos/suspend.c +3 -3
@@ -268,7 +268,7 @@ static int exynos5420_cpu_suspend(unsigned long arg)unsigned int cluster =MPIDR_AFFINITY_LEVEL (mpidr,1 );unsigned int cpu =MPIDR_AFFINITY_LEVEL (mpidr,0 ); -if (IS_ENABLED (CONFIG_MCPM )) { +if (IS_ENABLED (CONFIG_EXYNOS_MCPM )) {mcpm_set_entry_vector (cpu, cluster, exynos_cpu_resume);mcpm_cpu_suspend (); }
@@ -351,7 +351,7 @@ static void exynos5420_pm_prepare(void)exynos_pm_enter_sleep_mode ();/* ensure at least INFORM0 has the resume address */ -if (IS_ENABLED (CONFIG_MCPM )) +if (IS_ENABLED (CONFIG_EXYNOS_MCPM ))pmu_raw_writel (__pa_symbol (mcpm_entry_point),S5P_INFORM0 ); tmp =pmu_raw_readl (EXYNOS_L2_OPTION (0 ));
@@ -455,7 +455,7 @@ static void exynos5420_prepare_pm_resume(void) mpidr =read_cpuid_mpidr (); cluster =MPIDR_AFFINITY_LEVEL (mpidr,1 ); -if (IS_ENABLED (CONFIG_MCPM )) +if (IS_ENABLED (CONFIG_EXYNOS_MCPM ))WARN_ON (mcpm_cpu_powered_up ());if (IS_ENABLED (CONFIG_HW_PERF_EVENTS ) && cluster !=0 ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 22/131 clk: tegra210: fix PLLU and PLLU_OUT1
In reply to Greg Kroah-Hartman[ Upstream commit 0d34dfbf3023cf119b83f6470692c0b10c832495 ]
Full-speed and low-speed USB devices do not work with Tegra210 platforms because of incorrect PLLU/PLLU_OUT1 clock settings.
When full-speed device is connected:
[ 14.059886] usb 1-3: new full-speed USB device number 2 using tegra-xusb [ 14.196295] usb 1-3: device descriptor read/64, error -71 [ 14.436311] usb 1-3: device descriptor read/64, error -71 [ 14.675749] usb 1-3: new full-speed USB device number 3 using tegra-xusb [ 14.812335] usb 1-3: device descriptor read/64, error -71 [ 15.052316] usb 1-3: device descriptor read/64, error -71 [ 15.164799] usb usb1-port3: attempt power cycle
When low-speed device is connected:
[ 37.610949] usb usb1-port3: Cannot enable. Maybe the USB cable is bad? [ 38.557376] usb usb1-port3: Cannot enable. Maybe the USB cable is bad? [ 38.564977] usb usb1-port3: attempt power cycle
This commit fixes the issue by:
1. initializing PLLU_OUT1 before initializing XUSB_FS_SRC clock because PLLU_OUT1 is parent of XUSB_FS_SRC.
2. changing PLLU post-divider to /2 (DIVP=1) according to Technical Reference Manual.
--- drivers/clk/tegra/clk-tegra210.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/tegra/clk-tegra210.c +4 -4
@@ -2204,9 +2204,9 @@ static struct div_nmp pllu_nmp = { };static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { - {12000000 ,480000000 ,40 ,1 ,0 ,0 }, - {13000000 ,480000000 ,36 ,1 ,0 ,0 },/* actual: 468.0 MHz */ - {38400000 ,480000000 ,25 ,2 ,0 ,0 }, + {12000000 ,480000000 ,40 ,1 ,1 ,0 }, + {13000000 ,480000000 ,36 ,1 ,1 ,0 },/* actual: 468.0 MHz */ + {38400000 ,480000000 ,25 ,2 ,1 ,0 }, {0 ,0 ,0 ,0 ,0 ,0 }, };
@@ -3333,6 +3333,7 @@ static struct tegra_clk_init_table init_table[] __initdata = { { TEGRA210_CLK_DFLL_REF, TEGRA210_CLK_PLL_P, 51000000, 1 }, { TEGRA210_CLK_SBC4, TEGRA210_CLK_PLL_P, 12000000, 1 }, { TEGRA210_CLK_PLL_RE_VCO, TEGRA210_CLK_CLK_MAX, 672000000, 1 }, + { TEGRA210_CLK_PLL_U_OUT1, TEGRA210_CLK_CLK_MAX, 48000000, 1 }, { TEGRA210_CLK_XUSB_GATE, TEGRA210_CLK_CLK_MAX, 0, 1 }, { TEGRA210_CLK_XUSB_SS_SRC, TEGRA210_CLK_PLL_U_480M, 120000000, 0 }, { TEGRA210_CLK_XUSB_FS_SRC, TEGRA210_CLK_PLL_U_48M, 48000000, 0 },
@@ -3357,7 +3358,6 @@ static struct tegra_clk_init_table init_table[] __initdata = { { TEGRA210_CLK_PLL_DP, TEGRA210_CLK_CLK_MAX, 270000000, 0 }, { TEGRA210_CLK_SOC_THERM, TEGRA210_CLK_PLL_P, 51000000, 0 }, { TEGRA210_CLK_CCLK_G, TEGRA210_CLK_CLK_MAX, 0, 1 }, - { TEGRA210_CLK_PLL_U_OUT1, TEGRA210_CLK_CLK_MAX, 48000000, 1 }, { TEGRA210_CLK_PLL_U_OUT2, TEGRA210_CLK_CLK_MAX, 60000000, 1 }, { TEGRA210_CLK_SPDIF_IN_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, { TEGRA210_CLK_I2S0_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 23/131 fs/adfs: super: fix use-after-free bug
In reply to Greg Kroah-Hartman[ Upstream commit 5808b14a1f52554de612fee85ef517199855e310 ]
Fix a use-after-free bug during filesystem initialisation, where we access the disc record (which is stored in a buffer) after we have released the buffer.
--- fs/adfs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/adfs/super.c +4 -1
@@ -360,6 +360,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)struct buffer_head *bh;struct object_info root_obj;unsigned char *b_data; +unsigned int blocksize;struct adfs_sb_info *asb;struct inode *root;int ret = -EINVAL ;
@@ -411,8 +412,10 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) goto error_free_bh; } + blocksize =1 << dr->log2secsize;brelse (bh); -if (sb_set_blocksize (sb,1 << dr->log2secsize)) { + +if (sb_set_blocksize (sb, blocksize)) { bh =sb_bread (sb,ADFS_DISCRECORD / sb->s_blocksize);if (!bh) { adfs_error(sb, "couldn't read superblock on "
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/131 clk: sprd: Add check for return value of sprd_clk_regmap_init()
In reply to Greg Kroah-Hartman[ Upstream commit c974c48deeb969c5e4250e4f06af91edd84b1f10 ]
sprd_clk_regmap_init() doesn't always return success, adding check for its return value should make the code more strong.
--- drivers/clk/sprd/sc9860-clk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/sprd/sc9860-clk.c +4 -1
@@ -2023,6 +2023,7 @@ static int sc9860_clk_probe(struct platform_device *pdev) {const struct of_device_id *match;const struct sprd_clk_desc *desc; +int ret; match =of_match_node (sprd_sc9860_clk_ids, pdev->dev.of_node);if (!match) {
@@ -2031,7 +2032,9 @@ static int sc9860_clk_probe(struct platform_device *pdev) } desc = match->data; -sprd_clk_regmap_init (pdev, desc); + ret =sprd_clk_regmap_init (pdev, desc); +if (ret) +return ret;return sprd_clk_probe (&pdev->dev, desc->hw_clks); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 25/131 arm64: dts: rockchip: Fix USB3 Type-C on rk3399-sapphire
In reply to Greg Kroah-Hartman[ Upstream commit e1d9149e8389f1690cdd4e4056766dd26488a0fe ]
Before this patch, the Type-C port on the Sapphire board is dead. If setting the 'regulator-always-on' property to 'vcc5v0_typec0' then the port works for about 4 seconds at start-up. This is a sample trace with a memory stick plugged in:
1.- The memory stick LED lights on and kernel reports:
[ 4.782999] scsi 0:0:0:0: Direct-Access USB DISK PMAP PQ: 0 ANSI: 4 [ 5.904580] sd 0:0:0:0: [sdb] 3913344 512-byte logical blocks: (2.00 GB/1.87 GiB) [ 5.906860] sd 0:0:0:0: [sdb] Write Protect is off [ 5.908973] sd 0:0:0:0: [sdb] Mode Sense: 23 00 00 00 [ 5.909122] sd 0:0:0:0: [sdb] No Caching mode page found [ 5.911214] sd 0:0:0:0: [sdb] Assuming drive cache: write through [ 5.951585] sdb: sdb1 [ 5.954816] sd 0:0:0:0: [sdb] Attached SCSI removable disk 2.- 4 seconds later the memory stick LED lights off and kernel reports: [ 9.082822] phy phy-ff770000.syscon:[email protected]: charger = USB_DCP_CHARGER 3.- After a minute the kernel reports: [ 71.666761] usb 5-1: USB disconnect, device number 2
It has been checked that, although the LED is off, VBUS is present.
If, instead, the dr_mode is changed to host and the phy-supply changed accordingly, then it works. It has only been tested in host mode.
--- arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +2 -3
@@ -565,12 +565,11 @@ status = "okay"; u2phy0_otg: otg-port { - phy-supply = <&vcc5v0_typec0>; status = "okay"; }; u2phy0_host: host-port { - phy-supply = <&vcc5v0_host>; + phy-supply = <&vcc5v0_typec0>; status = "okay"; }; };
@@ -620,7 +619,7 @@ &usbdrd_dwc3_0 { status = "okay"; - dr_mode = "otg"; + dr_mode = "host"; }; &usbdrd3_1 {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/131 btrfs: tree-checker: Check if the file extent end overflows
In reply to Greg Kroah-Hartman[ Upstream commit 4c094c33c9ed4b8d0d814bd1d7ff78e123d15d00 ]
Under certain conditions, we could have strange file extent item in log tree like:
item 18 key (69599 108 397312) itemoff 15208 itemsize 53
extent data disk bytenr 0 nr 0 extent data offset 0 nr 18446744073709547520 ram 18446744073709547520
The num_bytes + ram_bytes overflow 64 bit type.
For num_bytes part, we can detect such overflow along with file offset (key->offset), as file_offset + num_bytes should never go beyond u64.
For ram_bytes part, it's about the decompressed size of the extent, not directly related to the size.
In theory it is OK to have a large value, and put extra limitation on RAM bytes may cause unexpected false alerts.
So in tree-checker, we only check if the file offset and num bytes overflow.
--- fs/btrfs/tree-checker.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/btrfs/tree-checker.c +11 -0
@@ -132,6 +132,7 @@ static int check_extent_data_item(struct extent_buffer *leaf,struct btrfs_file_extent_item *fi;u32 sectorsize = fs_info->sectorsize;u32 item_size =btrfs_item_size_nr (leaf, slot); +u64 extent_end;if (!IS_ALIGNED (key->offset, sectorsize)) { file_extent_err(leaf, slot,
@@ -207,6 +208,16 @@ static int check_extent_data_item(struct extent_buffer *leaf, CHECK_FE_ALIGNED(leaf, slot, fi, num_bytes, sectorsize))return -EUCLEAN ; +/* Catch extent end overflow */ +if (check_add_overflow (btrfs_file_extent_num_bytes (leaf, fi), + key->offset, &extent_end)) { +file_extent_err (leaf, slot, +"extent end overflow, have file offset %llu extent num bytes %llu" , + key->offset, +btrfs_file_extent_num_bytes (leaf, fi)); +return -EUCLEAN ; + } +/* * Check that no two consecutive file extent items, in the same leaf, * present ranges that overlap each other.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 27/131 btrfs: fix minimum number of chunk errors for DUP
In reply to Greg Kroah-Hartman[ Upstream commit 0ee5f8ae082e1f675a2fb6db601c31ac9958a134 ]
The list of profiles in btrfs_chunk_max_errors lists DUP as a profile DUP able to tolerate 1 device missing. Though this profile is special with 2 copies, it still needs the device, unlike the others.
Looking at the history of changes, thre's no clear reason why DUP is there, functions were refactored and blocks of code merged to one helper.
d20983b40e828 Btrfs: fix writing data into the seed filesystem
- factor code to a helper
de11cc12df173 Btrfs: don't pre-allocate btrfs bio
- unrelated change, DUP still in the list with max errors 1
a236aed14ccb0 Btrfs: Deal with failed writes in mirrored configurations
- introduced the max errors, leaves DUP and RAID1 in the same group
--- fs/btrfs/volumes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/volumes.c +1 -2
@@ -5328,8 +5328,7 @@ static inline int btrfs_chunk_max_errors(struct map_lookup *map)if (map->type & (BTRFS_BLOCK_GROUP_RAID1 |BTRFS_BLOCK_GROUP_RAID10 | -BTRFS_BLOCK_GROUP_RAID5 | -BTRFS_BLOCK_GROUP_DUP )) { +BTRFS_BLOCK_GROUP_RAID5 )) { max_errors =1 ; }else if (map->type &BTRFS_BLOCK_GROUP_RAID6 ) { max_errors =2 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/131 btrfs: Flush before reflinking any extent to prevent NOCOW write falling back to COW without data reservation
In reply to Greg Kroah-Hartman[ Upstream commit a94d1d0cb3bf1983fcdf05b59d914dbff4f1f52c ]
[BUG]
The following script can cause unexpected fsync failure:
#!/bin/bash
dev=/dev/test/test
mnt=/mnt/btrfs
mkfs.btrfs -f $dev -b 512M > /dev/null
mount $dev $mnt -o nospace_cache
# Prealloc one extent
xfs_io -f -c "falloc 8k 64m" $mnt/file1
# Fill the remaining data space
xfs_io -f -c "pwrite 0 -b 4k 512M" $mnt/padding
sync
# Write into the prealloc extent
xfs_io -c "pwrite 1m 16m" $mnt/file1
# Reflink then fsync, fsync would fail due to ENOSPC xfs_io -c "reflink $mnt/file1 8k 0 4k" -c "fsync" $mnt/file1 umount $dev
The fsync fails with ENOSPC, and the last page of the buffered write is lost.
[CAUSE]
This is caused by:
- Btrfs' back reference only has extent level granularity
So write into shared extent must be COWed even only part of the extent is shared.
So for above script we have:
- fallocate
Create a preallocated extent where we can do NOCOW write.
- fill all the remaining data and unallocated space
- buffered write into preallocated space
As we have not enough space available for data and the extent is not shared (yet) we fall into NOCOW mode.
- reflink
Now part of the large preallocated extent is shared, later write into that extent must be COWed.
- fsync triggers writeback
But now the extent is shared and therefore we must fallback into COW mode, which fails with ENOSPC since there's not enough space to allocate data extents.
[WORKAROUND]
The workaround is to ensure any buffered write in the related extents (not just the reflink source range) get flushed before reflink/dedupe, so that NOCOW writes succeed that happened before reflinking succeed.
The workaround is expensive, we could do it better by only flushing NOCOW range, but that needs extra accounting for NOCOW range. For now, fix the possible data loss first.
--- fs/btrfs/ioctl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
fs/btrfs/ioctl.c +21 -0
@@ -3999,6 +3999,27 @@ static int btrfs_remap_file_range_prep(struct file *file_in, loff_t pos_in,if (!same_inode)inode_dio_wait (inode_out); +/* +* Workaround to make sure NOCOW buffered write reach disk as NOCOW. +* +* Btrfs' back references do not have a block level granularity, they +* work at the whole extent level. +* NOCOW buffered write without data space reserved may not be able +* to fall back to CoW due to lack of data space, thus could cause +* data loss. +* +* Here we take a shortcut by flushing the whole inode, so that all +* nocow write should reach disk as nocow before we increase the +* reference of the extent. We could do better by only flushing NOCOW +* data, but that needs extra accounting. +* +* Also we don't need to check ASYNC_EXTENT, as async extent will be +* CoWed anyway, not affecting nocow part. +*/ + ret =filemap_flush (inode_in->i_mapping); +if (ret <0 ) +return ret; + ret =btrfs_wait_ordered_range (inode_in,ALIGN_DOWN (pos_in, bs), wb_len);if (ret <0 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/131 remoteproc: copy parent dma_pfn_offset for vdev
In reply to Greg Kroah-Hartman[ Upstream commit 72f64cabc4bd6985c7355f5547bd3637c82762ac ]
When preparing the subdevice for the vdev, also copy dma_pfn_offset since this is used for sub device dma allocations. Without that, there is incoherency between the parent dma settings and the childs one, potentially leading to dma_alloc_coherent failure (due to phys_to_dma using dma_pfn_offset for translation).
--- drivers/remoteproc/remoteproc_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/remoteproc/remoteproc_core.c +1 -0
@@ -512,6 +512,7 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,/* Initialise vdev subdevice */ snprintf (name,sizeof (name),"vdev%dbuffer" , rvdev->index); rvdev->dev.parent = rproc->dev.parent; + rvdev->dev.dma_pfn_offset = rproc->dev.parent->dma_pfn_offset; rvdev->dev.release = rproc_rvdev_release;dev_set_name (&rvdev->dev,"%s#%s" ,dev_name (rvdev->dev.parent), name);dev_set_drvdata (&rvdev->dev, rvdev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/131 btrfs: qgroup: Dont hold qgroup_ioctl_lock in btrfs_qgroup_inherit()
In reply to Greg Kroah-Hartman[ Upstream commit e88439debd0a7f969b3ddba6f147152cd0732676 ]
[BUG]
Lockdep will report the following circular locking dependency:
WARNING: possible circular locking dependency detected
5.2.0-rc2-custom #24 Tainted: G O
------------------------------------------------------
btrfs/8631 is trying to acquire lock:
000000002536438c (&fs_info->qgroup_ioctl_lock#2){+.+.}, at: btrfs_qgroup_inherit+0x40/0x620 [btrfs]
but task is already holding lock:
000000003d52cc23 (&fs_info->tree_log_mutex){+.+.}, at: create_pending_snapshot+0x8b6/0xe60 [btrfs]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&fs_info->tree_log_mutex){+.+.}:
__mutex_lock+0x76/0x940
mutex_lock_nested+0x1b/0x20
btrfs_commit_transaction+0x475/0xa00 [btrfs]
btrfs_commit_super+0x71/0x80 [btrfs]
close_ctree+0x2bd/0x320 [btrfs]
btrfs_put_super+0x15/0x20 [btrfs]
generic_shutdown_super+0x72/0x110
kill_anon_super+0x18/0x30
btrfs_kill_super+0x16/0xa0 [btrfs]
deactivate_locked_super+0x3a/0x80
deactivate_super+0x51/0x60
cleanup_mnt+0x3f/0x80
__cleanup_mnt+0x12/0x20
task_work_run+0x94/0xb0
exit_to_usermode_loop+0xd8/0xe0
do_syscall_64+0x210/0x240
entry_SYSCALL_64_after_hwframe+0x49/0xbe-> #1 (&fs_info->reloc_mutex){+.+.}:
__mutex_lock+0x76/0x940
mutex_lock_nested+0x1b/0x20
btrfs_commit_transaction+0x40d/0xa00 [btrfs]
btrfs_quota_enable+0x2da/0x730 [btrfs]
btrfs_ioctl+0x2691/0x2b40 [btrfs]
do_vfs_ioctl+0xa9/0x6d0
ksys_ioctl+0x67/0x90
__x64_sys_ioctl+0x1a/0x20
do_syscall_64+0x65/0x240
entry_SYSCALL_64_after_hwframe+0x49/0xbe-> #0 (&fs_info->qgroup_ioctl_lock#2){+.+.}:
lock_acquire+0xa7/0x190
__mutex_lock+0x76/0x940
mutex_lock_nested+0x1b/0x20
btrfs_qgroup_inherit+0x40/0x620 [btrfs]
create_pending_snapshot+0x9d7/0xe60 [btrfs]
create_pending_snapshots+0x94/0xb0 [btrfs]
btrfs_commit_transaction+0x415/0xa00 [btrfs]
btrfs_mksubvol+0x496/0x4e0 [btrfs]
btrfs_ioctl_snap_create_transid+0x174/0x180 [btrfs]
btrfs_ioctl_snap_create_v2+0x11c/0x180 [btrfs]
btrfs_ioctl+0xa90/0x2b40 [btrfs]
do_vfs_ioctl+0xa9/0x6d0
ksys_ioctl+0x67/0x90
__x64_sys_ioctl+0x1a/0x20
do_syscall_64+0x65/0x240
entry_SYSCALL_64_after_hwframe+0x49/0xbeother info that might help us debug this:
Chain exists of:
&fs_info->qgroup_ioctl_lock#2 --> &fs_info->reloc_mutex --> &fs_info->tree_log_mutex
Possible unsafe locking scenario: CPU0 CPU1
---- ----
lock(&fs_info->tree_log_mutex);
lock(&fs_info->reloc_mutex);
lock(&fs_info->tree_log_mutex);
lock(&fs_info->qgroup_ioctl_lock#2);*** DEADLOCK ***
6 locks held by btrfs/8631:
#0: 00000000ed8f23f6 (sb_writers#12){.+.+}, at: mnt_want_write_file+0x28/0x60
#1: 000000009fb1597a (&type->i_mutex_dir_key#10/1){+.+.}, at: btrfs_mksubvol+0x70/0x4e0 [btrfs] #2: 0000000088c5ad88 (&fs_info->subvol_sem){++++}, at: btrfs_mksubvol+0x128/0x4e0 [btrfs] #3: 000000009606fc3e (sb_internal#2){.+.+}, at: start_transaction+0x37a/0x520 [btrfs] #4: 00000000f82bbdf5 (&fs_info->reloc_mutex){+.+.}, at: btrfs_commit_transaction+0x40d/0xa00 [btrfs] #5: 000000003d52cc23 (&fs_info->tree_log_mutex){+.+.}, at: create_pending_snapshot+0x8b6/0xe60 [btrfs]
[CAUSE]
Due to the delayed subvolume creation, we need to call btrfs_qgroup_inherit() inside commit transaction code, with a lot of other mutex hold.
This hell of lock chain can lead to above problem.
[FIX]
On the other hand, we don't really need to hold qgroup_ioctl_lock if we're in the context of create_pending_snapshot().
As in that context, we're the only one being able to modify qgroup.
All other qgroup functions which needs qgroup_ioctl_lock are either holding a transaction handle, or will start a new transaction:
Functions will start a new transaction():
* btrfs_quota_enable()
* btrfs_quota_disable()
Functions hold a transaction handler:
* btrfs_add_qgroup_relation()
* btrfs_del_qgroup_relation()
* btrfs_create_qgroup()
* btrfs_remove_qgroup()
* btrfs_limit_qgroup()
* btrfs_qgroup_inherit() call inside create_subvol()
So we have a higher level protection provided by transaction, thus we don't need to always hold qgroup_ioctl_lock in btrfs_qgroup_inherit().
Only the btrfs_qgroup_inherit() call in create_subvol() needs to hold qgroup_ioctl_lock, while the btrfs_qgroup_inherit() call in create_pending_snapshot() is already protected by transaction.
So the fix is to detect the context by checking trans->transaction->state.
If we're at TRANS_STATE_COMMIT_DOING, then we're in commit transaction context and no need to get the mutex.
--- fs/btrfs/qgroup.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
fs/btrfs/qgroup.c +22 -2
@@ -2614,6 +2614,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,int ret =0 ;int i;u64 *i_qgroups; +bool committing = false;struct btrfs_fs_info *fs_info = trans->fs_info;struct btrfs_root *quota_root;struct btrfs_qgroup *srcgroup;
@@ -2621,7 +2622,25 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,u32 level_size =0 ;u64 nums; -mutex_lock (&fs_info->qgroup_ioctl_lock); +/* +* There are only two callers of this function. +* +* One in create_subvol() in the ioctl context, which needs to hold +* the qgroup_ioctl_lock. +* +* The other one in create_pending_snapshot() where no other qgroup +* code can modify the fs as they all need to either start a new trans +* or hold a trans handler, thus we don't need to hold +* qgroup_ioctl_lock. +* This would avoid long and complex lock chain and make lockdep happy. +*/ +spin_lock (&fs_info->trans_lock); +if (trans->transaction->state ==TRANS_STATE_COMMIT_DOING ) + committing = true; +spin_unlock (&fs_info->trans_lock); + +if (!committing) +mutex_lock (&fs_info->qgroup_ioctl_lock);if (!test_bit (BTRFS_FS_QUOTA_ENABLED , &fs_info->flags)) goto out;
@@ -2785,7 +2804,8 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, unlock:spin_unlock (&fs_info->qgroup_lock); out: -mutex_unlock (&fs_info->qgroup_ioctl_lock); +if (!committing) +mutex_unlock (&fs_info->qgroup_ioctl_lock);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 31/131 cifs: Fix a race condition with cifs_echo_request
In reply to Greg Kroah-Hartman[ Upstream commit f2caf901c1b7ce65f9e6aef4217e3241039db768 ]
There is a race condition with how we send (or supress and don't send) smb echos that will cause the client to incorrectly think the server is unresponsive and thus needs to be reconnected.
Summary of the race condition:
1) Daisy chaining scheduling creates a gap.
2) If traffic comes unfortunate shortly after the last echo, the planned echo is suppressed.
3) Due to the gap, the next echo transmission is delayed until after the timeout, which is set hard to twice the echo interval.
This is fixed by changing the timeouts from 2 to three times the echo interval.
Detailed description of the bug: https://lutz.donnerhacke.de/eng/Blog/Groundhog-Day-with-SMB-remount
--- fs/cifs/connect.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/cifs/connect.c +4 -4
@@ -706,10 +706,10 @@ static bool server_unresponsive(struct TCP_Server_Info *server) {/* -* We need to wait 2 echo intervals to make sure we handle such +* We need to wait 3 echo intervals to make sure we handle such * situations right: * 1s client sends a normal SMB request -* 2s client gets a response +* 3s client gets a response * 30s echo workqueue job pops, and decides we got a response recently * and don't need to send another * ...
@@ -718,9 +718,9 @@ server_unresponsive(struct TCP_Server_Info *server)*/ if ((server->tcpStatus == CifsGood || server->tcpStatus == CifsNeedNegotiate) && -time_after (jiffies, server->lstrp +2 * server->echo_interval)) { +time_after (jiffies, server->lstrp +3 * server->echo_interval)) {cifs_dbg (VFS ,"Server %s has not responded in %lu seconds. Reconnecting...\n" , - server->hostname, (2 * server->echo_interval) /HZ ); + server->hostname, (3 * server->echo_interval) /HZ );cifs_reconnect (server);wake_up (&server->response_q);return true;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/131 ceph: fix improper use of smp_mb__before_atomic()
In reply to Greg Kroah-Hartman[ Upstream commit 749607731e26dfb2558118038c40e9c0c80d23b5 ]
This barrier only applies to the read-modify-write operations; in particular, it does not apply to the atomic64_set() primitive.
Replace the barrier with an smp_mb().
--- fs/ceph/super.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ceph/super.h +6 -1
@@ -544,7 +544,12 @@ static inline void __ceph_dir_set_complete(struct ceph_inode_info *ci,long long release_count, long long ordered_count) { -smp_mb__before_atomic (); +/* +* Makes sure operations that setup readdir cache (update page +* cache and i_size) are strongly ordered w.r.t. the following +* atomic64_set() operations. +*/ +smp_mb ();atomic64_set (&ci->i_complete_seq[0 ], release_count);atomic64_set (&ci->i_complete_seq[1 ], ordered_count); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/131 ceph: fix dir_lease_is_valid()
In reply to Greg Kroah-Hartman[ Upstream commit feab6ac25dbfe3ab96299cb741925dc8d2da0caf ]
It should call __ceph_dentry_dir_lease_touch() under dentry->d_lock. Besides, ceph_dentry(dentry) can be NULL when called by LOOKUP_RCU d_revalidate()
--- fs/ceph/dir.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
fs/ceph/dir.c +17 -9
@@ -1512,18 +1512,26 @@ static int __dir_lease_try_check(const struct dentry *dentry)static int dir_lease_is_valid (struct inode *dir,struct dentry *dentry) {struct ceph_inode_info *ci =ceph_inode (dir); -struct ceph_dentry_info *di =ceph_dentry (dentry); -int valid =0 ; +int valid; +int shared_gen;spin_lock (&ci->i_ceph_lock); -if (atomic_read (&ci->i_shared_gen) == di->lease_shared_gen) - valid =__ceph_caps_issued_mask (ci,CEPH_CAP_FILE_SHARED ,1 ); + valid =__ceph_caps_issued_mask (ci,CEPH_CAP_FILE_SHARED ,1 ); + shared_gen =atomic_read (&ci->i_shared_gen);spin_unlock (&ci->i_ceph_lock); -if (valid) -__ceph_dentry_dir_lease_touch (di); -dout ("dir_lease_is_valid dir %p v%u dentry %p v%u = %d\n" , - dir, (unsigned )atomic_read (&ci->i_shared_gen), - dentry, (unsigned )di->lease_shared_gen, valid); +if (valid) { +struct ceph_dentry_info *di; +spin_lock (&dentry->d_lock); + di =ceph_dentry (dentry); +if (dir ==d_inode (dentry->d_parent) && + di && di->lease_shared_gen == shared_gen) +__ceph_dentry_dir_lease_touch (di); +else + valid =0 ; +spin_unlock (&dentry->d_lock); + } +dout ("dir_lease_is_valid dir %p v%u dentry %p = %d\n" , + dir, (unsigned )atomic_read (&ci->i_shared_gen), dentry, valid);return valid; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 34/131 ceph: return -ERANGE if virtual xattr value didnt fit in buffer
In reply to Greg Kroah-Hartman[ Upstream commit 3b421018f48c482bdc9650f894aa1747cf90e51d ]
The getxattr manpage states that we should return ERANGE if the destination buffer size is too small to hold the value. ceph_vxattrcb_layout does this internally, but we should be doing this for all vxattrs.
Fix the only caller of getxattr_cb to check the returned size against the buffer length and return -ERANGE if it doesn't fit. Drop the same check in ceph_vxattrcb_layout and just rely on the caller to handle it.
--- fs/ceph/xattr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/ceph/xattr.c +7 -7
@@ -79,7 +79,7 @@ static size_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,const char *ns_field =" pool_namespace=" ;char buf[128 ];size_t len, total_len =0 ; -int ret; +ssize_t ret; pool_ns =ceph_try_get_string (ci->i_layout.pool_ns);
@@ -103,11 +103,8 @@ static size_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,if (pool_ns) total_len +=strlen (ns_field) + pool_ns->len; -if (!size) { - ret = total_len; - }else if (total_len > size) { - ret = -ERANGE ; - }else { + ret = total_len; +if (size >= total_len) {memcpy (val, buf, len); ret = len;if (pool_name) {
@@ -835,8 +832,11 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value,if (err)return err; err = -ENODATA ; -if (!(vxattr->exists_cb && !vxattr->exists_cb (ci))) +if (!(vxattr->exists_cb && !vxattr->exists_cb (ci))) { err = vxattr->getxattr_cb (ci, value, size); +if (size && size < err) + err = -ERANGE ; + }return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/131 virtio-mmio: add error check for platform_get_irq
In reply to Greg Kroah-Hartman[ Upstream commit 5e663f0410fa2f355042209154029842ba1abd43 ]
in vm_find_vqs() irq has a wrong type
so, in case of no IRQ resource defined,
wrong parameter will be passed to request_irq()
--- drivers/virtio/virtio_mmio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/virtio/virtio_mmio.c +6 -1
@@ -463,9 +463,14 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, struct irq_affinity *desc) {struct virtio_mmio_device *vm_dev =to_virtio_mmio_device (vdev); -unsigned int irq =platform_get_irq (vm_dev->pdev,0 ); +int irq =platform_get_irq (vm_dev->pdev,0 );int i, err, queue_idx =0 ; +if (irq <0 ) { +dev_err (&vdev->dev,"Cannot get IRQ resource\n" ); +return irq; + } + err =request_irq (irq, vm_interrupt,IRQF_SHARED ,dev_name (&vdev->dev), vm_dev);if (err)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/131 ACPI: blacklist: fix clang warning for unused DMI table
In reply to Greg Kroah-Hartman[ Upstream commit b80d6a42bdc97bdb6139107d6034222e9843c6e2 ]
When CONFIG_DMI is disabled, we only have a tentative declaration, which causes a warning from clang:
drivers/acpi/blacklist.c:20:35: error: tentative array definition assumed to have one element [-Werror] static const struct dmi_system_id acpi_rev_dmi_table[] __initconst;
As the variable is not actually used here, hide it entirely in an #ifdef to shut up the warning.
--- drivers/acpi/blacklist.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/blacklist.c +4 -0
@@ -17,7 +17,9 @@#include "internal.h" +#ifdef CONFIG_DMI static const struct dmi_system_id acpi_rev_dmi_table[]__initconst ; +#endif /* * POLICY: If *anything* doesn't work, put it on the blacklist.
@@ -61,7 +63,9 @@ int __init acpi_blacklisted(void) } (void )early_acpi_osi_init (); +#ifdef CONFIG_DMI dmi_check_system (acpi_rev_dmi_table); +#endif return blacklisted; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/131 scsi: zfcp: fix GCC compiler warning emitted with -Wmaybe-uninitialized
In reply to Greg Kroah-Hartman[ Upstream commit 484647088826f2f651acbda6bcf9536b8a466703 ]
GCC v9 emits this warning:
CC drivers/s390/scsi/zfcp_erp.o
drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_action_enqueue':
drivers/s390/scsi/zfcp_erp.c:217:26: warning: 'erp_action' may be used uninitialized in this function [-Wmaybe-uninitialized]
217 | struct zfcp_erp_action *erp_action;
| ^~~~~~~~~~
This is a possible false positive case, as also documented in the GCC documentations:
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmaybe-uninitialized
The actual code-sequence is like this:
Various callers can invoke the function below with the argument "want"
being one of:
ZFCP_ERP_ACTION_REOPEN_ADAPTER,
ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
ZFCP_ERP_ACTION_REOPEN_PORT, or
ZFCP_ERP_ACTION_REOPEN_LUN.
zfcp_erp_action_enqueue(want, ...)
...
need = zfcp_erp_required_act(want, ...)
need = want
...
maybe: need = ZFCP_ERP_ACTION_REOPEN_PORT
maybe: need = ZFCP_ERP_ACTION_REOPEN_ADAPTER
...
return need
...
zfcp_erp_setup_act(need, ...)
struct zfcp_erp_action *erp_action; // <== line 217
...
switch(need) {
case ZFCP_ERP_ACTION_REOPEN_LUN:
...
erp_action = &zfcp_sdev->erp_action;
WARN_ON_ONCE(erp_action->port != port); // <== access
...
break;
case ZFCP_ERP_ACTION_REOPEN_PORT:
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
...
erp_action = &port->erp_action;
WARN_ON_ONCE(erp_action->port != port); // <== access
...
break;
case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
...
erp_action = &adapter->erp_action;
WARN_ON_ONCE(erp_action->port != NULL); // <== access
...
break;
}
...
WARN_ON_ONCE(erp_action->adapter != adapter); // <== accessWhen zfcp_erp_setup_act() is called, 'need' will never be anything else than one of the 4 possible enumeration-names that are used in the switch-case, and 'erp_action' is initialized for every one of them, before it is used. Thus the warning is a false positive, as documented.
We introduce the extra if{} in the beginning to create an extra code-flow, so the compiler can be convinced that the switch-case will never see any other value.
BUG_ON()/BUG() is intentionally not used to not crash anything, should this ever happen anyway - right now it's impossible, as argued above; and it doesn't introduce a 'default:' switch-case to retain warnings should 'enum zfcp_erp_act_type' ever be extended and no explicit case be introduced. See also v5.0 commit 399b6c8bc9f7 ("scsi: zfcp: drop old default switch case which might paper over missing case").
--- drivers/s390/scsi/zfcp_erp.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/s390/scsi/zfcp_erp.c +7 -0
@@ -11,6 +11,7 @@#define pr_fmt (fmt) KMSG_COMPONENT ": " fmt#include <linux/kthread.h> +#include <linux/bug.h> #include "zfcp_ext.h" #include "zfcp_reqlist.h"
@@ -217,6 +218,12 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(enum zfcp_erp_act_type need,struct zfcp_erp_action *erp_action;struct zfcp_scsi_dev *zfcp_sdev; +if (WARN_ON_ONCE (need !=ZFCP_ERP_ACTION_REOPEN_LUN && + need !=ZFCP_ERP_ACTION_REOPEN_PORT && + need !=ZFCP_ERP_ACTION_REOPEN_PORT_FORCED && + need !=ZFCP_ERP_ACTION_REOPEN_ADAPTER )) +return NULL ; +switch (need) {case ZFCP_ERP_ACTION_REOPEN_LUN : zfcp_sdev =sdev_to_zfcp (sdev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/131 selftests/bpf: do not ignore clang failures
In reply to Greg Kroah-Hartman[ Upstream commit 9cae4ace80ef39005da106fbb89c952b27d7b89e ]
When compiling an eBPF prog fails, make still returns 0, because failing clang command's output is piped to llc and therefore its exit status is ignored.
When clang fails, pipe the string "clang failed" to llc. This will make llc fail with an informative error message. This solution was chosen over using pipefail, having separate targets or getting rid of llc invocation due to its simplicity.
In addition, pull Kbuild.include in order to get .DELETE_ON_ERROR target, which would cause partial .o files to be removed.
--- tools/testing/selftests/bpf/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tools/testing/selftests/bpf/Makefile +7 -6
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 +include ../../../../scripts/Kbuild.include LIBDIR := ../../../lib BPFDIR := $(LIBDIR)/bpf
@@ -185,8 +186,8 @@ $(ALU32_BUILD_DIR)/test_progs_32: prog_tests/*.c $(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \ $(ALU32_BUILD_DIR)/test_progs_32 - $(CLANG) $(CLANG_FLAGS) \ - -O2 -target bpf -emit-llvm -c $< -o - | \ + ($(CLANG) $(CLANG_FLAGS) -O2 -target bpf -emit-llvm -c $< -o - || \ + echo "clang failed") | \ $(LLC) -march=bpf -mattr=+alu32 -mcpu=$(CPU) $(LLC_FLAGS) \ -filetype=obj -o $@ ifeq ($(DWARF2BTF),y)
@@ -197,16 +198,16 @@ endif # Have one program compiled without "-target bpf" to test whether libbpf loads # it successfully $(OUTPUT)/test_xdp.o: progs/test_xdp.c - $(CLANG) $(CLANG_FLAGS) \ - -O2 -emit-llvm -c $< -o - | \ + ($(CLANG) $(CLANG_FLAGS) -O2 -emit-llvm -c $< -o - || \ + echo "clang failed") | \ $(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@ ifeq ($(DWARF2BTF),y) $(BTF_PAHOLE) -J $@ endif $(OUTPUT)/%.o: progs/%.c - $(CLANG) $(CLANG_FLAGS) \ - -O2 -target bpf -emit-llvm -c $< -o - | \ + ($(CLANG) $(CLANG_FLAGS) -O2 -target bpf -emit-llvm -c $< -o - || \ + echo "clang failed") | \ $(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@ ifeq ($(DWARF2BTF),y) $(BTF_PAHOLE) -J $@
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 39/131 drm/amd/display: Expose audio inst from DC to DM
In reply to Greg Kroah-Hartman[ Upstream commit 5fdb7c4c7f2691efd760b0b0dc00da4a3699f1a6 ]
[Why]
In order to give pin notifications to the sound driver from DM we need to know whether audio is enabled on a stream and what pin it's using from DC.
[How]
Expose the instance via stream status if it's a mapped resource for the stream. It will be -1 if there's no audio mapped.
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 +++ drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 + 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -0
@@ -2034,6 +2034,9 @@ enum dc_status resource_map_pool_resources(if (context->streams[i] == stream) { context->stream_status[i].primary_otg_inst = pipe_ctx->stream_res.tg->inst; context->stream_status[i].stream_enc_inst = pipe_ctx->stream_res.stream_enc->id; + context->stream_status[i].audio_inst = + pipe_ctx->stream_res.audio ? pipe_ctx->stream_res.audio->inst :-1 ; +return DC_OK ; }
drivers/gpu/drm/amd/display/dc/dc_stream.h +1 -0
@@ -42,6 +42,7 @@ struct dc_stream_status {int primary_otg_inst;int stream_enc_inst;int plane_count; +int audio_inst;struct timing_sync_info timing_sync_info;struct dc_plane_state *plane_states[MAX_SURFACE_NUM ]; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/131 cifs: fix crash in cifs_dfs_do_automount
In reply to Greg Kroah-Hartman[ Upstream commit ce465bf94b70f03136171a62b607864f00093b19 ]
RHBZ: 1649907
Fix a crash that happens while attempting to mount a DFS referral from the same server on the root of a filesystem.
--- fs/cifs/connect.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
fs/cifs/connect.c +12 -4
@@ -4463,11 +4463,13 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server,unsigned int xid, struct cifs_tcon *tcon, struct cifs_sb_info *cifs_sb, - char *full_path) + char *full_path, + int added_treename) { int rc;char *s;char sep, tmp; +int skip = added_treename ?1 :0 ; sep =CIFS_DIR_SEP (cifs_sb); s = full_path;
@@ -4482,7 +4484,14 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server,/* next separator */ while (*s && *s != sep) s++; - +/* +* if the treename is added, we then have to skip the first +* part within the separators +*/ +if (skip) { + skip =0 ; +continue ; + }/* * temporarily null-terminate the path at the end of * the current component
@@ -4530,8 +4539,7 @@ static int is_path_remote(struct cifs_sb_info *cifs_sb, struct smb_vol *vol,if (rc != -EREMOTE ) { rc =cifs_are_all_path_components_accessible (server, xid, tcon, - cifs_sb, - full_path); + cifs_sb, full_path, tcon->Flags &SMB_SHARE_IS_IN_DFS );if (rc !=0 ) {cifs_dbg (VFS ,"cannot query dirs between root and final path, " "enabling CIFS_MOUNT_USE_PREFIX_PATH\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 41/131 perf version: Fix segfault due to missing OPT_END()
In reply to Greg Kroah-Hartman[ Upstream commit 916c31fff946fae0e05862f9b2435fdb29fd5090 ]
'perf version' on powerpc segfaults when used with non-supported option:
# perf version -a Segmentation fault (core dumped)
Fix this.
--- tools/perf/builtin-version.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-version.c +1 -0
@@ -19,6 +19,7 @@ static struct version version;static struct option version_options[] = {OPT_BOOLEAN (0 ,"build-options" , &version.build_options,"display the build options" ), +OPT_END (), };static const char *const version_usage[] = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/131 x86: kvm: avoid constant-conversion warning
In reply to Greg Kroah-Hartman[ Upstream commit a6a6d3b1f867d34ba5bd61aa7bb056b48ca67cff ]
clang finds a contruct suspicious that converts an unsigned character to a signed integer and back, causing an overflow:
arch/x86/kvm/mmu.c:4605:39: error: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from -205 to 51 [-Werror,-Wconstant-conversion]
u8 wf = (pfec & PFERR_WRITE_MASK) ? ~w : 0;
~~ ^~
arch/x86/kvm/mmu.c:4607:38: error: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from -241 to 15 [-Werror,-Wconstant-conversion]
u8 uf = (pfec & PFERR_USER_MASK) ? ~u : 0;
~~ ^~
arch/x86/kvm/mmu.c:4609:39: error: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from -171 to 85 [-Werror,-Wconstant-conversion]
u8 ff = (pfec & PFERR_FETCH_MASK) ? ~x : 0;
~~ ^~Add an explicit cast to tell clang that everything works as intended here.
--- arch/x86/kvm/mmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kvm/mmu.c +3 -3
@@ -4593,11 +4593,11 @@ static void update_permission_bitmask(struct kvm_vcpu *vcpu,*/ /* Faults from writes to non-writable pages */ -u8 wf = (pfec &PFERR_WRITE_MASK ) ? ~w :0 ; +u8 wf = (pfec &PFERR_WRITE_MASK ) ? (u8 )~w :0 ;/* Faults from user mode accesses to supervisor pages */ -u8 uf = (pfec &PFERR_USER_MASK ) ? ~u :0 ; +u8 uf = (pfec &PFERR_USER_MASK ) ? (u8 )~u :0 ;/* Faults from fetches of non-executable pages*/ -u8 ff = (pfec &PFERR_FETCH_MASK ) ? ~x :0 ; +u8 ff = (pfec &PFERR_FETCH_MASK ) ? (u8 )~x :0 ;/* Faults from kernel mode fetches of user pages */ u8 smepf =0 ;/* Faults from kernel mode accesses of user pages */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 43/131 ACPI: fix false-positive -Wuninitialized warning
In reply to Greg Kroah-Hartman[ Upstream commit dfd6f9ad36368b8dbd5f5a2b2f0a4705ae69a323 ]
clang gets confused by an uninitialized variable in what looks to it like a never executed code path:
arch/x86/kernel/acpi/boot.c:618:13: error: variable 'polarity' is uninitialized when used here [-Werror,-Wuninitialized]
polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
^~~~~~~~
arch/x86/kernel/acpi/boot.c:606:32: note: initialize the variable 'polarity' to silence this warning
int rc, irq, trigger, polarity;
^
= 0
arch/x86/kernel/acpi/boot.c:617:12: error: variable 'trigger' is uninitialized when used here [-Werror,-Wuninitialized]
trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
^~~~~~~
arch/x86/kernel/acpi/boot.c:606:22: note: initialize the variable 'trigger' to silence this warning
int rc, irq, trigger, polarity;
^
= 0This is unfortunately a design decision in clang and won't be fixed.
Changing the acpi_get_override_irq() macro to an inline function reliably avoids the issue.
--- include/linux/acpi.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/acpi.h +4 -1
@@ -317,7 +317,10 @@ void acpi_set_irq_model(enum acpi_irq_model_id model,#ifdef CONFIG_X86_IO_APIC extern int acpi_get_override_irq (u32 gsi,int *trigger,int *polarity);#else -#define acpi_get_override_irq (gsi, trigger, polarity) (-1) +static inline int acpi_get_override_irq (u32 gsi,int *trigger,int *polarity) +{ +return -1 ; +}#endif /* * This function undoes the effect of one call to acpi_register_gsi().
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/131 KVM: nVMX: Ignore segment base for VMX memory operand when segment not FS or GS
In reply to Greg Kroah-Hartman[ Upstream commit 6694e48012826351036fd10fc506ca880023e25f ]
As reported by Maxime at
https://bugzilla.kernel.org/show_bug.cgi?id=204175:
In vmx/nested.c::get_vmx_mem_address(), when the guest runs in long mode, the base address of the memory operand is computed with a simple:
*ret = s.base + off;
This is incorrect, the base applies only to FS and GS, not to the others. Because of that, if the guest uses a VMX instruction based on DS and has a DS.base that is non-zero, KVM wrongfully adds the base to the resulting address.
--- arch/x86/kvm/vmx/nested.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kvm/vmx/nested.c +4 -1
@@ -4087,7 +4087,10 @@ int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification,* mode, e.g. a 32-bit address size can yield a 64-bit virtual * address when using FS/GS with a non-zero base. */ - *ret = s.base + off; +if (seg_reg ==VCPU_SREG_FS || seg_reg ==VCPU_SREG_GS ) + *ret = s.base + off; +else + *ret = off;/* Long mode: #GP(0)/#SS(0) if the memory address is in a * non-canonical form. This is the only check on the memory
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/131 bpf: fix BTF verifier size resolution logic
In reply to Greg Kroah-Hartman[ Upstream commit 1acc5d5c5832da9a98b22374a8fae08ffe31b3f8 ]
BTF verifier has a size resolution bug which in some circumstances leads to invalid size resolution for, e.g., TYPEDEF modifier. This happens if we have
[1] PTR -> [2] TYPEDEF -> [3] ARRAY, in which case due to being in pointer context ARRAY size won't be resolved (because for pointer it doesn't matter, so it's a sink in pointer context), but it will be permanently remembered as zero for TYPEDEF and TYPEDEF will be marked as RESOLVED. Eventually ARRAY size will be resolved correctly, but TYPEDEF resolved_size won't be updated anymore. This, subsequently, will lead to erroneous map creation failure, if that TYPEDEF is specified as either key or value, as key_size/value_size won't correspond to resolved size of TYPEDEF (kernel will believe it's zero).
Note, that if BTF was ordered as [1] ARRAY <- [2] TYPEDEF <- [3] PTR, this won't be a problem, as by the time we get to TYPEDEF, ARRAY's size is already calculated and stored.
This bug manifests itself in rejecting BTF-defined maps that use array typedef as a value type:
typedef int array_t[16];
struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__type(value, array_t); /* i.e., array_t *value; */
} test_map SEC(".maps");The fix consists on not relying on modifier's resolved_size and instead using modifier's resolved_id (type ID for "concrete" type to which modifier eventually resolves) and doing size determination for that resolved type. This allow to preserve existing "early DFS termination" logic for PTR or STRUCT_OR_ARRAY contexts, but still do correct size determination for modifier types.
--- kernel/bpf/btf.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
kernel/bpf/btf.c +12 -7
@@ -1073,11 +1073,18 @@ const struct btf_type *btf_type_id_size(const struct btf *btf, !btf_type_is_var(size_type)))return NULL ; - size = btf->resolved_sizes[size_type_id]; size_type_id = btf->resolved_ids[size_type_id]; size_type =btf_type_by_id (btf, size_type_id);if (btf_type_nosize_or_null (size_type))return NULL ; +else if (btf_type_has_size (size_type)) + size = size_type->size; +else if (btf_type_is_array (size_type)) + size = btf->resolved_sizes[size_type_id]; +else if (btf_type_is_ptr (size_type)) + size =sizeof (void *); +else +return NULL ; } *type_id = size_type_id;
@@ -1602,7 +1609,6 @@ static int btf_modifier_resolve(struct btf_verifier_env *env,const struct btf_type *next_type;u32 next_type_id = t->type;struct btf *btf = env->btf; -u32 next_type_size =0 ; next_type =btf_type_by_id (btf, next_type_id);if (!next_type ||btf_type_is_resolve_source_only (next_type)) {
@@ -1620,7 +1626,7 @@ static int btf_modifier_resolve(struct btf_verifier_env *env,* save us a few type-following when we use it later (e.g. in * pretty print). */ -if (!btf_type_id_size (btf, &next_type_id, &next_type_size)) { +if (!btf_type_id_size (btf, &next_type_id,NULL )) {if (env_type_is_resolved (env, next_type_id)) next_type =btf_type_id_resolve (btf, &next_type_id);
@@ -1633,7 +1639,7 @@ static int btf_modifier_resolve(struct btf_verifier_env *env, } } -env_stack_pop_resolved (env, next_type_id, next_type_size); +env_stack_pop_resolved (env, next_type_id,0 );return 0 ; }
@@ -1645,7 +1651,6 @@ static int btf_var_resolve(struct btf_verifier_env *env,const struct btf_type *t = v->t;u32 next_type_id = t->type;struct btf *btf = env->btf; -u32 next_type_size; next_type =btf_type_by_id (btf, next_type_id);if (!next_type ||btf_type_is_resolve_source_only (next_type)) {
@@ -1675,12 +1680,12 @@ static int btf_var_resolve(struct btf_verifier_env *env,* forward types or similar that would resolve to size of * zero is allowed. */ -if (!btf_type_id_size (btf, &next_type_id, &next_type_size)) { +if (!btf_type_id_size (btf, &next_type_id,NULL )) {btf_verifier_log_type (env, v->t,"Invalid type_id" );return -EINVAL ; } -env_stack_pop_resolved (env, next_type_id, next_type_size); +env_stack_pop_resolved (env, next_type_id,0 );return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 46/131 be2net: Signal that the device cannot transmit during reconfiguration
In reply to Greg Kroah-Hartman[ Upstream commit 7429c6c0d9cb086d8e79f0d2a48ae14851d2115e ]
While changing the number of interrupt channels, be2net stops adapter operation (including netif_tx_disable()) but it doesn't signal that it cannot transmit. This may lead dev_watchdog() to falsely trigger during that time.
Add the missing call to netif_carrier_off(), following the pattern used in many other drivers. netif_carrier_on() is already taken care of in be_open().
--- drivers/net/ethernet/emulex/benet/be_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_main.c +5 -1
@@ -4697,8 +4697,12 @@ int be_update_queues(struct be_adapter *adapter)struct net_device *netdev = adapter->netdev;int status; -if (netif_running (netdev)) +if (netif_running (netdev)) { +/* device cannot transmit now, avoid dev_watchdog timeouts */ +netif_carrier_off (netdev); +be_close (netdev); + }be_cancel_worker (adapter);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 47/131 mm/z3fold: dont try to use buddy slots after free
In reply to Greg Kroah-Hartman[ Upstream commit bb9a374dfa3a2f46581455ab66cd1d24c5e3d183 ]
As reported by Henry Burns:
Running z3fold stress testing with address sanitization showed zhdr->slots was being used after it was freed.
z3fold_free(z3fold_pool, handle)
free_handle(handle)
kmem_cache_free(pool->c_handle, zhdr->slots)
release_z3fold_page_locked_list(kref)
__release_z3fold_page(zhdr, true)
zhdr_to_pool(zhdr)
slots_to_pool(zhdr->slots) *BOOM*To fix this, add pointer to the pool back to z3fold_header and modify zhdr_to_pool to return zhdr->pool.
--- mm/z3fold.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/z3fold.c +4 -1
@@ -101,6 +101,7 @@ struct z3fold_buddy_slots {* @refcount: reference count for the z3fold page * @work: work_struct for page layout optimization * @slots: pointer to the structure holding buddy slots +* @pool: pointer to the containing pool * @cpu: CPU which this page "belongs" to * @first_chunks: the size of the first buddy in chunks, 0 if free * @middle_chunks: the size of the middle buddy in chunks, 0 if free
@@ -114,6 +115,7 @@ struct z3fold_header {struct kref refcount;struct work_struct work;struct z3fold_buddy_slots *slots; +struct z3fold_pool *pool;short cpu;unsigned short first_chunks;unsigned short middle_chunks;
@@ -320,6 +322,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, zhdr->start_middle =0 ; zhdr->cpu =-1 ; zhdr->slots = slots; + zhdr->pool = pool;INIT_LIST_HEAD (&zhdr->buddy);INIT_WORK (&zhdr->work, compact_page_work);return zhdr;
@@ -426,7 +429,7 @@ static enum buddy handle_to_buddy(unsigned long handle)static inline struct z3fold_pool *zhdr_to_pool (struct z3fold_header *zhdr) { -return slots_to_pool (zhdr->slots); +return zhdr->pool; }static void __release_z3fold_page (struct z3fold_header *zhdr,bool locked)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 48/131 mm/slab_common.c: work around clang bug #42570
In reply to Greg Kroah-Hartman[ Upstream commit a07057dce2823e10d64a2b73cefbf09d8645efe9 ]
Clang gets rather confused about two variables in the same special section when one of them is not initialized, leading to an assembler warning later:
/tmp/slab_common-18f869.s: Assembler messages:
/tmp/slab_common-18f869.s:7526: Warning: ignoring changed section attributes for .data..ro_after_init
Adding an initialization to kmalloc_caches is rather silly here but does avoid the issue.
--- mm/slab_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/slab_common.c +2 -1
@@ -1003,7 +1003,8 @@ struct kmem_cache *__init create_kmalloc_cache(const char *name, }struct kmem_cache * -kmalloc_caches[NR_KMALLOC_TYPES ][KMALLOC_SHIFT_HIGH +1 ]__ro_after_init ; +kmalloc_caches[NR_KMALLOC_TYPES ][KMALLOC_SHIFT_HIGH +1 ]__ro_after_init = +{/* initialization for https://bugs.llvm.org/show_bug.cgi?id=42570 */ };EXPORT_SYMBOL (kmalloc_caches);/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/131 mm/memcontrol.c: keep local VM counters in sync with the hierarchical ones
In reply to Greg Kroah-Hartman[ Upstream commit 766a4c19d880887c457811b86f1f68525e416965 ]
After commit 815744d75152 ("mm: memcontrol: don't batch updates of local VM stats and events"), the local VM counter are not in sync with the hierarchical ones.
Below is one example in a leaf memcg on my server (with 8 CPUs):
inactive_file 3567570944 total_inactive_file 3568029696
We find that the deviation is very great because the 'val' in __mod_memcg_state() is in pages while the effective value in memcg_stat_show() is in bytes.
So the maximum of this deviation between local VM stats and total VM stats can be (32 * number_of_cpu * PAGE_SIZE), that may be an unacceptably great value.
We should keep the local VM stats in sync with the total stats. In order to keep this behavior the same across counters, this patch updates __mod_lruvec_state() and __count_memcg_events() as well.
--- mm/memcontrol.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
mm/memcontrol.c +15 -7
@@ -691,12 +691,15 @@ void __mod_memcg_state(struct mem_cgroup *memcg, int idx, int val)if (mem_cgroup_disabled ())return ; -__this_cpu_add (memcg->vmstats_local->stat[idx], val); - x = val +__this_cpu_read (memcg->vmstats_percpu->stat[idx]);if (unlikely (abs (x) >MEMCG_CHARGE_BATCH )) {struct mem_cgroup *mi; +/* +* Batch local counters to keep them in sync with +* the hierarchical ones. +*/ +__this_cpu_add (memcg->vmstats_local->stat[idx], x);for (mi = memcg; mi; mi =parent_mem_cgroup (mi))atomic_long_add (x, &mi->vmstats[idx]); x =0 ;
@@ -745,13 +748,15 @@ void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,/* Update memcg */ __mod_memcg_state (memcg, idx, val); -/* Update lruvec */ -__this_cpu_add (pn->lruvec_stat_local->count[idx], val); - x = val +__this_cpu_read (pn->lruvec_stat_cpu->count[idx]);if (unlikely (abs (x) >MEMCG_CHARGE_BATCH )) {struct mem_cgroup_per_node *pi; +/* +* Batch local counters to keep them in sync with +* the hierarchical ones. +*/ +__this_cpu_add (pn->lruvec_stat_local->count[idx], x);for (pi = pn; pi; pi =parent_nodeinfo (pi, pgdat->node_id))atomic_long_add (x, &pi->lruvec_stat[idx]); x =0 ;
@@ -773,12 +778,15 @@ void __count_memcg_events(struct mem_cgroup *memcg, enum vm_event_item idx,if (mem_cgroup_disabled ())return ; -__this_cpu_add (memcg->vmstats_local->events[idx], count); - x = count +__this_cpu_read (memcg->vmstats_percpu->events[idx]);if (unlikely (x >MEMCG_CHARGE_BATCH )) {struct mem_cgroup *mi; +/* +* Batch local counters to keep them in sync with +* the hierarchical ones. +*/ +__this_cpu_add (memcg->vmstats_local->events[idx], x);for (mi = memcg; mi; mi =parent_mem_cgroup (mi))atomic_long_add (x, &mi->vmevents[idx]); x =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 50/131 mm/z3fold.c: reinitialize zhdr structs after migration
In reply to Greg Kroah-Hartman[ Upstream commit c92d2f38563db20c20c8db2f98fa1349290477d5 ]
z3fold_page_migration() calls memcpy(new_zhdr, zhdr, PAGE_SIZE). However, zhdr contains fields that can't be directly coppied over (ex:list_head, a circular linked list). We only need to initialize the linked lists in new_zhdr, as z3fold_isolate_page() already ensures that these lists are empty
Additionally it is possible that zhdr->work has been placed in a workqueue. In this case we shouldn't migrate the page, as zhdr->work references zhdr as opposed to new_zhdr.
--- mm/z3fold.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
mm/z3fold.c +10 -0
@@ -1360,12 +1360,22 @@ static int z3fold_page_migrate(struct address_space *mapping, struct page *newpaunlock_page (page);return -EBUSY ; } +if (work_pending (&zhdr->work)) { +z3fold_page_unlock (zhdr); +return -EAGAIN ; + } new_zhdr =page_address (newpage);memcpy (new_zhdr, zhdr,PAGE_SIZE ); newpage->private = page->private; page->private =0 ;z3fold_page_unlock (zhdr);spin_lock_init (&new_zhdr->page_lock); +INIT_WORK (&new_zhdr->work, compact_page_work); +/* +* z3fold_page_isolate() ensures that new_zhdr->buddy is empty, +* so we only have to reinitialize it. +*/ +INIT_LIST_HEAD (&new_zhdr->buddy); new_mapping =page_mapping (page);__ClearPageMovable (page);ClearPagePrivate (page);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/131 x86/apic: Silence -Wtype-limits compiler warnings
In reply to Greg Kroah-Hartman[ Upstream commit ec6335586953b0df32f83ef696002063090c7aef ]
There are many compiler warnings like this,
In file included from ./arch/x86/include/asm/smp.h:13,
from ./arch/x86/include/asm/mmzone_64.h:11,
from ./arch/x86/include/asm/mmzone.h:5,
from ./include/linux/mmzone.h:969,
from ./include/linux/gfp.h:6,
from ./include/linux/mm.h:10,
from arch/x86/kernel/apic/io_apic.c:34:
arch/x86/kernel/apic/io_apic.c: In function 'check_timer':
./arch/x86/include/asm/apic.h:37:11: warning: comparison of unsigned
expression >= 0 is always true [-Wtype-limits]
if ((v) <= apic_verbosity) \
^~arch/x86/kernel/apic/io_apic.c:2160:2: note: in expansion of macro 'apic_printk'
apic_printk(APIC_QUIET, KERN_INFO "..TIMER: vector=0x%02X " ^~~~~~~~~~~./arch/x86/include/asm/apic.h:37:11: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
if ((v) <= apic_verbosity) \
^~arch/x86/kernel/apic/io_apic.c:2207:4: note: in expansion of macro 'apic_printk'
apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: " ^~~~~~~~~~~
APIC_QUIET is 0, so silence them by making apic_verbosity type int.
--- arch/x86/include/asm/apic.h | 2 +- arch/x86/kernel/apic/apic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/apic.h +1 -1
@@ -49,7 +49,7 @@ static inline void generic_apic_probe(void)#ifdef CONFIG_X86_LOCAL_APIC -extern unsigned int apic_verbosity; +extern int apic_verbosity;extern int local_apic_timer_c2_ok;extern int disable_apic;
arch/x86/kernel/apic/apic.c +1 -1
@@ -183,7 +183,7 @@ EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);/* * Debug level, exported for io_apic.c */ -unsigned int apic_verbosity; +int apic_verbosity;int pic_mode;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 52/131 x86: math-emu: Hide clang warnings for 16-bit overflow
In reply to Greg Kroah-Hartman[ Upstream commit 29e7e9664aec17b94a9c8c5a75f8d216a206aa3a ]
clang warns about a few parts of the math-emu implementation where a 16-bit integer becomes negative during assignment:
arch/x86/math-emu/poly_tan.c:88:35: error: implicit conversion from 'int' to 'short' changes value from 49216 to -16320 [-Werror,-Wconstant-conversion]
(0x41 + EXTENDED_Ebias) | SIGN_Negative);
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
arch/x86/math-emu/fpu_emu.h:180:58: note: expanded from macro 'setexponent16'
#define setexponent16(x,y) { (*(short *)&((x)->exp)) = (y); }
~ ^
arch/x86/math-emu/reg_constant.c:37:32: error: implicit conversion from 'int' to 'short' changes value from 49085 to -16451 [-Werror,-Wconstant-conversion]
FPU_REG const CONST_PI2extra = MAKE_REG(NEG, -66,
^~~~~~~~~~~~~~~~~~
arch/x86/math-emu/reg_constant.c:21:25: note: expanded from macro 'MAKE_REG'
((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) }
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/math-emu/reg_constant.c:48:28: error: implicit conversion from 'int' to 'short' changes value from 65535 to -1 [-Werror,-Wconstant-conversion]
FPU_REG const CONST_QNaN = MAKE_REG(NEG, EXP_OVER, 0x00000000, 0xC0000000);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/math-emu/reg_constant.c:21:25: note: expanded from macro 'MAKE_REG'
((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) }
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~The code is correct as is, so add a typecast to shut up the warnings.
--- arch/x86/math-emu/fpu_emu.h | 2 +- arch/x86/math-emu/reg_constant.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/math-emu/fpu_emu.h +1 -1
@@ -177,7 +177,7 @@ static inline void reg_copy(FPU_REG const *x, FPU_REG *y)#define setexponentpos (x,y) { (*(short *)&((x)->exp)) = \ ((y) + EXTENDED_Ebias) & 0x7fff; }#define exponent16 (x) (*(short *)&((x)->exp)) -#define setexponent16 (x,y) { (*(short *)&((x)->exp)) = (y); } +#define setexponent16 (x,y) { (*(short *)&((x)->exp)) = (u16)(y); }#define addexponent (x,y) { (*(short *)&((x)->exp)) += (y); }#define stdexp (x) { (*(short *)&((x)->exp)) += EXTENDED_Ebias; }
arch/x86/math-emu/reg_constant.c +1 -1
@@ -18,7 +18,7 @@#include "control_w.h" #define MAKE_REG (s, e, l, h) { l, h, \ - ((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) } + (u16)((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) }FPU_REG const CONST_1 =MAKE_REG (POS ,0 ,0x00000000 ,0x80000000 );#if 0
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 53/131 mm/cma.c: fail if fixed declaration cant be honored
In reply to Greg Kroah-Hartman[ Upstream commit c633324e311243586675e732249339685e5d6faa ]
The description of cma_declare_contiguous() indicates that if the 'fixed' argument is true the reserved contiguous area must be exactly at the address of the 'base' argument.
However, the function currently allows the 'base', 'size', and 'limit' arguments to be silently adjusted to meet alignment constraints. This commit enforces the documented behavior through explicit checks that return an error if the region does not fit within a specified region.
--- mm/cma.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
mm/cma.c +13 -0
@@ -278,6 +278,12 @@ int __init cma_declare_contiguous(phys_addr_t base,*/ alignment =max (alignment, (phys_addr_t )PAGE_SIZE << max_t(unsigned long, MAX_ORDER - 1, pageblock_order)); +if (fixed && base & (alignment -1 )) { + ret = -EINVAL ; +pr_err ("Region at %pa must be aligned to %pa bytes\n" , + &base, &alignment); + goto err; + } base =ALIGN (base, alignment); size =ALIGN (size, alignment); limit &= ~(alignment -1 );
@@ -308,6 +314,13 @@ int __init cma_declare_contiguous(phys_addr_t base,if (limit ==0 || limit > memblock_end) limit = memblock_end; +if (base + size > limit) { + ret = -EINVAL ; +pr_err ("Size (%pa) of region at %pa exceeds limit (%pa)\n" , + &size, &base, &limit); + goto err; + } +/* Reserve memory */ if (fixed) { if (memblock_is_region_reserved(base, size) ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 54/131 lib/test_overflow.c: avoid tainting the kernel and fix wrap size
In reply to Greg Kroah-Hartman[ Upstream commit 8e060c21ae2c265a2b596e9e7f9f97ec274151a4 ]
This adds __GFP_NOWARN to the kmalloc()-portions of the overflow test to avoid tainting the kernel. Additionally fixes up the math on wrap size to be architecture and page size agnostic.
--- lib/test_overflow.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
lib/test_overflow.c +6 -5
@@ -486,16 +486,17 @@ static int __init test_overflow_shift(void)* Deal with the various forms of allocator arguments. See comments above * the DEFINE_TEST_ALLOC() instances for mapping of the "bits". */ -#define alloc010 (alloc, arg, sz) alloc(sz, GFP_KERNEL) -#define alloc011 (alloc, arg, sz) alloc(sz, GFP_KERNEL, NUMA_NO_NODE) +#define alloc_GFP (GFP_KERNEL | __GFP_NOWARN) +#define alloc010 (alloc, arg, sz) alloc(sz, alloc_GFP) +#define alloc011 (alloc, arg, sz) alloc(sz, alloc_GFP, NUMA_NO_NODE)#define alloc000 (alloc, arg, sz) alloc(sz)#define alloc001 (alloc, arg, sz) alloc(sz, NUMA_NO_NODE) -#define alloc110 (alloc, arg, sz) alloc(arg, sz, GFP_KERNEL) +#define alloc110 (alloc, arg, sz) alloc(arg, sz, alloc_GFP)#define free0 (free, arg, ptr) free(ptr)#define free1 (free, arg, ptr) free(arg, ptr) -/* Wrap around to 8K */ -#define TEST_SIZE (9 << PAGE_SHIFT) +/* Wrap around to 16K */ +#define TEST_SIZE (5 * 4096)#define DEFINE_TEST_ALLOC (func, free_func, want_arg, want_gfp, want_node)\ static int __init test_ ## func (void *arg) \
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 55/131 lib/test_string.c: avoid masking memset16/32/64 failures
In reply to Greg Kroah-Hartman[ Upstream commit 33d6e0ff68af74be0c846c8e042e84a9a1a0561e ]
If a memsetXX implementation is completely broken and fails in the first iteration, when i, j, and k are all zero, the failure is masked as zero is returned. Failing in the first iteration is perhaps the most likely failure, so this makes the tests pretty much useless. Avoid the situation by always setting a random unused bit in the result on failure.
--- lib/test_string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/test_string.c +3 -3
@@ -36,7 +36,7 @@ static __init int memset16_selftest(void) fail:kfree (p);if (i <256 ) -return (i <<24 ) | (j <<16 ) | k; +return (i <<24 ) | (j <<16 ) | k |0x8000 ;return 0 ; }
@@ -72,7 +72,7 @@ static __init int memset32_selftest(void) fail:kfree (p);if (i <256 ) -return (i <<24 ) | (j <<16 ) | k; +return (i <<24 ) | (j <<16 ) | k |0x8000 ;return 0 ; }
@@ -108,7 +108,7 @@ static __init int memset64_selftest(void) fail:kfree (p);if (i <256 ) -return (i <<24 ) | (j <<16 ) | k; +return (i <<24 ) | (j <<16 ) | k |0x8000 ;return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/131 mm/ioremap: check virtual address alignment while creating huge mappings
In reply to Greg Kroah-Hartman[ Upstream commit 6b95ab4218bfa59bc315105127ffe03aef3b5742 ]
Virtual address alignment is essential in ensuring correct clearing for all intermediate level pgtable entries and freeing associated pgtable pages. An unaligned address can end up randomly freeing pgtable page that potentially still contains valid mappings. Hence also check it's alignment along with existing phys_addr check.
--- lib/ioremap.c | 9 +++++++++ 1 file changed, 9 insertions(+)
lib/ioremap.c +9 -0
@@ -86,6 +86,9 @@ static int ioremap_try_huge_pmd(pmd_t *pmd, unsigned long addr,if ((end - addr) !=PMD_SIZE )return 0 ; +if (!IS_ALIGNED (addr,PMD_SIZE )) +return 0 ; +if (!IS_ALIGNED (phys_addr,PMD_SIZE ))return 0 ;
@@ -126,6 +129,9 @@ static int ioremap_try_huge_pud(pud_t *pud, unsigned long addr,if ((end - addr) !=PUD_SIZE )return 0 ; +if (!IS_ALIGNED (addr,PUD_SIZE )) +return 0 ; +if (!IS_ALIGNED (phys_addr,PUD_SIZE ))return 0 ;
@@ -166,6 +172,9 @@ static int ioremap_try_huge_p4d(p4d_t *p4d, unsigned long addr,if ((end - addr) !=P4D_SIZE )return 0 ; +if (!IS_ALIGNED (addr,P4D_SIZE )) +return 0 ; +if (!IS_ALIGNED (phys_addr,P4D_SIZE ))return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 57/131 coda: add error handling for fget
In reply to Greg Kroah-Hartman[ Upstream commit 02551c23bcd85f0c68a8259c7b953d49d44f86af ]
When fget fails, the lack of error-handling code may cause unexpected results.
This patch adds error-handling code after calling fget.
--- fs/coda/psdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/coda/psdev.c +4 -1
@@ -182,8 +182,11 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf,if (req->uc_opcode ==CODA_OPEN_BY_FD ) {struct coda_open_by_fd_out *outp = (struct coda_open_by_fd_out *)req->uc_data; -if (!outp->oh.result) +if (!outp->oh.result) { outp->fh =fget (outp->fd); +if (!outp->fh) +return -EBADF ; + } }wake_up (&req->uc_sleep);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/131 coda: fix build using bare-metal toolchain
In reply to Greg Kroah-Hartman[ Upstream commit b2a57e334086602be56b74958d9f29b955cd157f ]
The kernel is self-contained project and can be built with bare-metal toolchain. But bare-metal toolchain doesn't define __linux__. Because of this u_quad_t type is not defined when using bare-metal toolchain and codafs build fails. This patch fixes it by defining u_quad_t type unconditionally.
--- include/linux/coda.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/coda.h +1 -2
@@ -58,8 +58,7 @@ Mellon the rights to redistribute these changes without encumbrance.#ifndef _CODA_HEADER_#define _CODA_HEADER_ -#if defined(__linux__)typedef unsigned long long u_quad_t ; -#endif +#include <uapi/linux/coda.h> #endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/131 uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers
In reply to Greg Kroah-Hartman[ Upstream commit f90fb3c7e2c13ae829db2274b88b845a75038b8a ]
Only users of upc_req in kernel side fs/coda/psdev.c and fs/coda/upcall.c already include linux/coda_psdev.h.
Suggested by Jan Harkes <[email protected]> in
https://lore.kernel.org/lkml/[email protected]/
Fixes these include/uapi/linux/coda_psdev.h compilation errors in userspace:
linux/coda_psdev.h:12:19: error: field `uc_chain' has incomplete type
struct list_head uc_chain;
^ linux/coda_psdev.h:13:2: error: unknown type name `caddr_t'
caddr_t uc_data;
^
linux/coda_psdev.h:14:2: error: unknown type name `u_short'
u_short uc_flags;
^
linux/coda_psdev.h:15:2: error: unknown type name `u_short'
u_short uc_inSize; /* Size is at most 5000 bytes */
^
linux/coda_psdev.h:16:2: error: unknown type name `u_short'
u_short uc_outSize;
^
linux/coda_psdev.h:17:2: error: unknown type name `u_short'
u_short uc_opcode; /* copied from data to save lookup */
^
linux/coda_psdev.h:19:2: error: unknown type name `wait_queue_head_t'
wait_queue_head_t uc_sleep; /* process' wait queue */
^
--- include/linux/coda_psdev.h | 11 +++++++++++ include/uapi/linux/coda_psdev.h | 13 ------------- 2 files changed, 11 insertions(+), 13 deletions(-)
include/linux/coda_psdev.h +11 -0
@@ -19,6 +19,17 @@ struct venus_comm {struct mutex vc_mutex; }; +/* messages between coda filesystem in kernel and Venus */ +struct upc_req { +struct list_head uc_chain; +caddr_t uc_data; +u_short uc_flags; +u_short uc_inSize;/* Size is at most 5000 bytes */ +u_short uc_outSize; +u_short uc_opcode;/* copied from data to save lookup */ +int uc_unique; +wait_queue_head_t uc_sleep;/* process' wait queue */ +};static inline struct venus_comm *coda_vcp (struct super_block *sb) {
include/uapi/linux/coda_psdev.h +0 -13
@@ -7,19 +7,6 @@#define CODA_PSDEV_MAJOR 67#define MAX_CODADEVS 5/* how many do we allow */ - -/* messages between coda filesystem in kernel and Venus */ -struct upc_req { -struct list_head uc_chain; -caddr_t uc_data; -u_short uc_flags; -u_short uc_inSize;/* Size is at most 5000 bytes */ -u_short uc_outSize; -u_short uc_opcode;/* copied from data to save lookup */ -int uc_unique; -wait_queue_head_t uc_sleep;/* process' wait queue */ -}; -#define CODA_REQ_ASYNC 0x1#define CODA_REQ_READ 0x2#define CODA_REQ_WRITE 0x4
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 60/131 drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings
In reply to Greg Kroah-Hartman[ Upstream commit 156e0b1a8112b76e351684ac948c59757037ac36 ]
The dev_info.name[] array has space for RIO_MAX_DEVNAME_SZ + 1 characters. But the problem here is that we don't ensure that the user put a NUL terminator on the end of the string. It could lead to an out of bounds read.
--- drivers/rapidio/devices/rio_mport_cdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/rapidio/devices/rio_mport_cdev.c +2 -0
@@ -1686,6 +1686,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,if (copy_from_user (&dev_info, arg,sizeof (dev_info)))return -EFAULT ; + dev_info.name[sizeof (dev_info.name) -1 ] ='\0' ;rmcd_debug (RDEV ,"name:%s ct:0x%x did:0x%x hc:0x%x" , dev_info.name, dev_info.comptag, dev_info.destid, dev_info.hopcount);
@@ -1817,6 +1818,7 @@ static int rio_mport_del_riodev(struct mport_cdev_priv *priv, void __user *arg)if (copy_from_user (&dev_info, arg,sizeof (dev_info)))return -EFAULT ; + dev_info.name[sizeof (dev_info.name) -1 ] ='\0' ; mport = priv->md->mport;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/131 ipc/mqueue.c: only perform resource calculation if user valid
In reply to Greg Kroah-Hartman[ Upstream commit a318f12ed8843cfac53198390c74a565c632f417 ]
Andreas Christoforou reported:
UBSAN: Undefined behaviour in ipc/mqueue.c:414:49 signed integer overflow:
9 * 2305843009213693951 cannot be represented in type 'long int'
...
Call Trace:
mqueue_evict_inode+0x8e7/0xa10 ipc/mqueue.c:414
evict+0x472/0x8c0 fs/inode.c:558
iput_final fs/inode.c:1547 [inline]
iput+0x51d/0x8c0 fs/inode.c:1573
mqueue_get_inode+0x8eb/0x1070 ipc/mqueue.c:320
mqueue_create_attr+0x198/0x440 ipc/mqueue.c:459
vfs_mkobj+0x39e/0x580 fs/namei.c:2892
prepare_open ipc/mqueue.c:731 [inline]
do_mq_open+0x6da/0x8e0 ipc/mqueue.c:771Which could be triggered by:
struct mq_attr attr = {
.mq_flags = 0,
.mq_maxmsg = 9,
.mq_msgsize = 0x1fffffffffffffff,
.mq_curmsgs = 0,
};
if (mq_open("/testing", 0x40, 3, &attr) == (mqd_t) -1)
perror("mq_open");mqueue_get_inode() was correctly rejecting the giant mq_msgsize, and preparing to return -EINVAL. During the cleanup, it calls mqueue_evict_inode() which performed resource usage tracking math for updating "user", before checking if there was a valid "user" at all (which would indicate that the calculations would be sane). Instead, delay this check to after seeing a valid "user".
The overflow was real, but the results went unused, so while the flaw is harmless, it's noisy for kernel fuzzers, so just fix it by moving the calculation under the non-NULL "user" where it actually gets used.
--- ipc/mqueue.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
ipc/mqueue.c +10 -9
@@ -438,7 +438,6 @@ static void mqueue_evict_inode(struct inode *inode) {struct mqueue_inode_info *info;struct user_struct *user; -unsigned long mq_bytes, mq_treesize;struct ipc_namespace *ipc_ns;struct msg_msg *msg, *nmsg;LIST_HEAD (tmp_msg);
@@ -461,16 +460,18 @@ static void mqueue_evict_inode(struct inode *inode)free_msg (msg); } -/* Total amount of bytes accounted for the mqueue */ - mq_treesize = info->attr.mq_maxmsg *sizeof (struct msg_msg ) + - min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * -sizeof (struct posix_msg_tree_node ); - - mq_bytes = mq_treesize + (info->attr.mq_maxmsg * - info->attr.mq_msgsize); - user = info->user;if (user) { +unsigned long mq_bytes, mq_treesize; + +/* Total amount of bytes accounted for the mqueue */ + mq_treesize = info->attr.mq_maxmsg *sizeof (struct msg_msg ) + + min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * +sizeof (struct posix_msg_tree_node ); + + mq_bytes = mq_treesize + (info->attr.mq_maxmsg * + info->attr.mq_msgsize); +spin_lock (&mq_lock); user->mq_bytes -= mq_bytes;/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/131 nds32: fix asm/syscall.h
In reply to Greg Kroah-Hartman[ Upstream commit 33644b95eb342201511fc951d8fcd10362bd435b ]
PTRACE_GET_SYSCALL_INFO is a generic ptrace API that lets ptracer obtain details of the syscall the tracee is blocked in.
There are two reasons for a special syscall-related ptrace request.
Firstly, with the current ptrace API there are cases when ptracer cannot retrieve necessary information about syscalls. Some examples include:
* The notorious int-0x80-from-64-bit-task issue. See [1] for details. In short, if a 64-bit task performs a syscall through int 0x80, its tracer has no reliable means to find out that the syscall was, in fact, a compat syscall, and misidentifies it.
* Syscall-enter-stop and syscall-exit-stop look the same for the tracer. Common practice is to keep track of the sequence of ptrace-stops in order not to mix the two syscall-stops up. But it is not as simple as it looks; for example, strace had a (just recently fixed) long-standing bug where attaching strace to a tracee that is performing the execve system call led to the tracer identifying the following syscall-exit-stop as syscall-enter-stop, which messed up all the state tracking.
* Since the introduction of commit 84d77d3f06e7 ("ptrace: Don't allow accessing an undumpable mm"), both PTRACE_PEEKDATA and process_vm_readv become unavailable when the process dumpable flag is cleared. On such architectures as ia64 this results in all syscall arguments being unavailable for the tracer.
Secondly, ptracers also have to support a lot of arch-specific code for obtaining information about the tracee. For some architectures, this requires a ptrace(PTRACE_PEEKUSER, ...) invocation for every syscall argument and return value.
PTRACE_GET_SYSCALL_INFO returns the following structure:
struct ptrace_syscall_info {
__u8 op; /* PTRACE_SYSCALL_INFO_* */
__u32 arch __attribute__((__aligned__(sizeof(__u32))));
__u64 instruction_pointer;
__u64 stack_pointer;
union {
struct {
__u64 nr;
__u64 args[6];
} entry;
struct {
__s64 rval;
__u8 is_error;
} exit;
struct {
__u64 nr;
__u64 args[6];
__u32 ret_data;
} seccomp;
};
};The structure was chosen according to [2], except for the following changes:
* seccomp substructure was added as a superset of entry substructure
* the type of nr field was changed from int to __u64 because syscall numbers are, as a practical matter, 64 bits
* stack_pointer field was added along with instruction_pointer field since it is readily available and can save the tracer from extra PTRACE_GETREGS/PTRACE_GETREGSET calls
* arch is always initialized to aid with tracing system calls such as execve()
* instruction_pointer and stack_pointer are always initialized so they could be easily obtained for non-syscall stops
* a boolean is_error field was added along with rval field, this way the tracer can more reliably distinguish a return value from an error value
strace has been ported to PTRACE_GET_SYSCALL_INFO. Starting with release 4.26, strace uses PTRACE_GET_SYSCALL_INFO API as the preferred mechanism of obtaining syscall information.
[1] https://lore.kernel.org/lkml/CA+55aFzcSVmdDj9Lh_gdbz1OzHyEm6ZrGPBDAJnywm2LF_eVyg@mail.gmail.com/
[2] https://lore.kernel.org/lkml/CAObL_7GM0n80N7J_DFw_eQyfLyzq+sf4y2AvsCCV88Tb3AwEHA@mail.gmail.com/
This patch (of 7):
All syscall_get_*() and syscall_set_*() functions must be defined as static inline as on all other architectures, otherwise asm/syscall.h cannot be included in more than one compilation unit.
This bug has to be fixed in order to extend the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.
--- arch/nds32/include/asm/syscall.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
arch/nds32/include/asm/syscall.h +17 -10
@@ -26,7 +26,8 @@ struct pt_regs;* * It's only valid to call this when @task is known to be blocked. */ -int syscall_get_nr (struct task_struct *task,struct pt_regs *regs) +static inline int +syscall_get_nr (struct task_struct *task,struct pt_regs *regs) {return regs->syscallno; }
@@ -47,7 +48,8 @@ int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)* system call instruction. This may not be the same as what the * register state looked like at system call entry tracing. */ -void syscall_rollback (struct task_struct *task,struct pt_regs *regs) +static inline void +syscall_rollback (struct task_struct *task,struct pt_regs *regs) { regs->uregs[0 ] = regs->orig_r0; }
@@ -62,7 +64,8 @@ void syscall_rollback(struct task_struct *task, struct pt_regs *regs)* It's only valid to call this when @task is stopped for tracing on exit * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. */ -long syscall_get_error (struct task_struct *task,struct pt_regs *regs) +static inline long +syscall_get_error (struct task_struct *task,struct pt_regs *regs) {unsigned long error = regs->uregs[0 ];return IS_ERR_VALUE (error) ? error :0 ;
@@ -79,7 +82,8 @@ long syscall_get_error(struct task_struct *task, struct pt_regs *regs)* It's only valid to call this when @task is stopped for tracing on exit * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. */ -long syscall_get_return_value (struct task_struct *task,struct pt_regs *regs) +static inline long +syscall_get_return_value (struct task_struct *task,struct pt_regs *regs) {return regs->uregs[0 ]; }
@@ -99,8 +103,9 @@ long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)* It's only valid to call this when @task is stopped for tracing on exit * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. */ -void syscall_set_return_value (struct task_struct *task,struct pt_regs *regs, -int error,long val) +static inline void +syscall_set_return_value (struct task_struct *task,struct pt_regs *regs, +int error,long val) { regs->uregs[0 ] = (long )error ? error : val; }
@@ -118,8 +123,9 @@ void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,* entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. */ #define SYSCALL_MAX_ARGS 6 -void syscall_get_arguments (struct task_struct *task,struct pt_regs *regs, -unsigned long *args) +static inline void +syscall_get_arguments (struct task_struct *task,struct pt_regs *regs, +unsigned long *args) { args[0 ] = regs->orig_r0; args++;
@@ -138,8 +144,9 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,* It's only valid to call this when @task is stopped for tracing on * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. */ -void syscall_set_arguments (struct task_struct *task,struct pt_regs *regs, -const unsigned long *args) +static inline void +syscall_set_arguments (struct task_struct *task,struct pt_regs *regs, +const unsigned long *args) { regs->orig_r0 = args[0 ]; args++;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/131 device-dax: fix memory and resource leak if hotplug fails
In reply to Greg Kroah-Hartman[ Upstream commit 31e4ca92a7dd4cdebd7fe1456b3b0b6ace9a816f ]
Patch series ""Hotremove" persistent memory", v6.
Recently, adding a persistent memory to be used like a regular RAM was added to Linux. This work extends this functionality to also allow hot removing persistent memory.
We (Microsoft) have an important use case for this functionality.
The requirement is for physical machines with small amount of RAM (~8G) to be able to reboot in a very short period of time (<1s). Yet, there is a userland state that is expensive to recreate (~2G).
The solution is to boot machines with 2G preserved for persistent memory.
Copy the state, and hotadd the persistent memory so machine still has all 8G available for runtime. Before reboot, offline and hotremove device-dax 2G, copy the memory that is needed to be preserved to pmem0 device, and reboot.
The series of operations look like this:
1. After boot restore /dev/pmem0 to ramdisk to be consumed by apps. and free ramdisk.
2. Convert raw pmem0 to devdax
ndctl create-namespace --mode devdax --map mem -e namespace0.0 -f
3. Hotadd to System RAM
echo dax0.0 > /sys/bus/dax/drivers/device_dax/unbind echo dax0.0 > /sys/bus/dax/drivers/kmem/new_id
echo online_movable > /sys/devices/system/memoryXXX/state
4. Before reboot hotremove device-dax memory from System RAM echo offline > /sys/devices/system/memoryXXX/state echo dax0.0 > /sys/bus/dax/drivers/kmem/unbind
5. Create raw pmem0 device
ndctl create-namespace --mode raw -e namespace0.0 -f
6. Copy the state that was stored by apps to ramdisk to pmem device
7. Do kexec reboot or reboot through firmware if firmware does not zero memory in pmem0 region (These machines have only regular volatile memory). So to have pmem0 device either memmap kernel parameter is used, or devices nodes in dtb are specified.
This patch (of 3):
When add_memory() fails, the resource and the memory should be freed.
--- drivers/dax/kmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dax/kmem.c +4 -1
@@ -66,8 +66,11 @@ int dev_dax_kmem_probe(struct device *dev) new_res->name =dev_name (dev); rc =add_memory (numa_node, new_res->start,resource_size (new_res)); -if (rc) +if (rc) { +release_resource (new_res); +kfree (new_res);return rc; + }return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/131 mm/hotplug: make remove_memory() interface usable
In reply to Greg Kroah-Hartman[ Upstream commit eca499ab3749a4537dee77ffead47a1a2c0dee19 ]
Presently the remove_memory() interface is inherently broken. It tries to remove memory but panics if some memory is not offline. The problem is that it is impossible to ensure that all memory blocks are offline as this function also takes lock_device_hotplug that is required to change memory state via sysfs.
So, between calling this function and offlining all memory blocks there is always a window when lock_device_hotplug is released, and therefore, there is always a chance for a panic during this window.
Make this interface to return an error if memory removal fails. This way it is safe to call this function without panicking machine, and also makes it symmetric to add_memory() which already returns an error.
--- include/linux/memory_hotplug.h | 8 +++-- mm/memory_hotplug.c | 64 +++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 23 deletions(-)
include/linux/memory_hotplug.h +6 -2
@@ -324,7 +324,7 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {}extern bool is_mem_section_removable (unsigned long pfn,unsigned long nr_pages);extern void try_offline_node (int nid);extern int offline_pages (unsigned long start_pfn,unsigned long nr_pages); -extern void remove_memory (int nid,u64 start,u64 size); +extern int remove_memory (int nid,u64 start,u64 size);extern void __remove_memory (int nid,u64 start,u64 size);#else
@@ -341,7 +341,11 @@ static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages) return -EINVAL; } -static inline void remove_memory (int nid,u64 start,u64 size) {} +static inline int remove_memory (int nid,u64 start,u64 size) +{ +return -EBUSY ; +} +static inline void __remove_memory (int nid,u64 start,u64 size) {}#endif /* CONFIG_MEMORY_HOTREMOVE */
mm/memory_hotplug.c +43 -21
98 lines not on this page · raw message
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 65/131 stacktrace: Force USER_DS for stack_trace_save_user()
In reply to Greg Kroah-Hartman[ Upstream commit cac9b9a4b08304f11daace03b8b48659355e44c1 ]
When walking userspace stacks, USER_DS needs to be set, otherwise access_ok() will not function as expected.
--- kernel/stacktrace.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/stacktrace.c +5 -0
@@ -226,12 +226,17 @@ unsigned int stack_trace_save_user(unsigned long *store, unsigned int size) .store = store, .size = size, }; +mm_segment_t fs;/* Trace user stack if not a kernel thread */ if (!current->mm)return 0 ; + fs =get_fs (); +set_fs (USER_DS );arch_stack_walk_user (consume_entry, &c,task_pt_regs (current)); +set_fs (fs); +return c.len; }#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 66/131 crypto: ccp - Fix SEV_VERSION_GREATER_OR_EQUAL
In reply to Greg Kroah-Hartman[ Upstream commit 83bf42510d7f7e1daa692c096e8e9919334d7b57 ]
SEV_VERSION_GREATER_OR_EQUAL() will fail if upgrading from 2.2 to 3.1, for example, because the minor version is not equal to or greater than the major.
Fix this and move to a static inline function for appropriate type checking.
--- drivers/crypto/ccp/psp-dev.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/crypto/ccp/psp-dev.c +12 -7
@@ -24,10 +24,6 @@#include "sp-dev.h" #include "psp-dev.h" -#define SEV_VERSION_GREATER_OR_EQUAL (_maj, _min) \ - ((psp_master->api_major) >= _maj && \ - (psp_master->api_minor) >= _min) -#define DEVICE_NAME "sev"#define SEV_FW_FILE "amd/sev.fw"#define SEV_FW_NAME_SIZE 64
@@ -47,6 +43,15 @@ MODULE_PARM_DESC(psp_probe_timeout, " default timeout value, in seconds, duringstatic bool psp_dead;static int psp_timeout; +static inline bool sev_version_greater_or_equal (u8 maj,u8 min) +{ +if (psp_master->api_major > maj) +return true; +if (psp_master->api_major == maj && psp_master->api_minor >= min) +return true; +return false; +} +static struct psp_device *psp_alloc_struct (struct sp_device *sp) {struct device *dev = sp->dev;
@@ -588,7 +593,7 @@ static int sev_ioctl_do_get_id2(struct sev_issue_cmd *argp)int ret;/* SEV GET_ID is available from SEV API v0.16 and up */ -if (!SEV_VERSION_GREATER_OR_EQUAL (0 ,16 )) +if (!sev_version_greater_or_equal (0 ,16 ))return -ENOTSUPP ;if (copy_from_user (&input, (void __user *)argp->data,sizeof (input)))
@@ -651,7 +656,7 @@ static int sev_ioctl_do_get_id(struct sev_issue_cmd *argp)int ret;/* SEV GET_ID available from SEV API v0.16 and up */ -if (!SEV_VERSION_GREATER_OR_EQUAL (0 ,16 )) +if (!sev_version_greater_or_equal (0 ,16 ))return -ENOTSUPP ;/* SEV FW expects the buffer it fills with the ID to be
@@ -1053,7 +1058,7 @@ void psp_pci_init(void) psp_master->sev_state =SEV_STATE_UNINIT ; } -if (SEV_VERSION_GREATER_OR_EQUAL (0 ,15 ) && +if (sev_version_greater_or_equal (0 ,15 ) &&sev_update_firmware (psp_master->dev) ==0 )sev_get_api_version ();
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 67/131 xen/pv: Fix a boot up hang revealed by int3 self test
In reply to Greg Kroah-Hartman[ Upstream commit b23e5844dfe78a80ba672793187d3f52e4b528d7 ]
Commit 7457c0da024b ("x86/alternatives: Add int3_emulate_call() selftest") is used to ensure there is a gap setup in int3 exception stack which could be used for inserting call return address.
This gap is missed in XEN PV int3 exception entry path, then below panic triggered:
[ 0.772876] general protection fault: 0000 [#1] SMP NOPTI [ 0.772886] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0+ #11 [ 0.772893] RIP: e030:int3_magic+0x0/0x7 [ 0.772905] RSP: 3507:ffffffff82203e98 EFLAGS: 00000246 [ 0.773334] Call Trace: [ 0.773334] alternative_instructions+0x3d/0x12e [ 0.773334] check_bugs+0x7c9/0x887 [ 0.773334] ? __get_locked_pte+0x178/0x1f0 [ 0.773334] start_kernel+0x4ff/0x535 [ 0.773334] ? set_init_arg+0x55/0x55 [ 0.773334] xen_start_kernel+0x571/0x57a
For 64bit PV guests, Xen's ABI enters the kernel with using SYSRET, with %rcx/%r11 on the stack. To convert back to "normal" looking exceptions, the xen thunks do 'xen_*: pop %rcx; pop %r11; jmp *'.
E.g. Extracting 'xen_pv_trap xenint3' we have:xen_xenint3:
pop %rcx;
pop %r11;
jmp xenint3
As xenint3 and int3 entry code are same except xenint3 doesn't generate a gap, we can fix it by using int3 and drop useless xenint3.
--- arch/x86/entry/entry_64.S | 1 - arch/x86/include/asm/traps.h | 2 +- arch/x86/xen/enlighten_pv.c | 2 +- arch/x86/xen/xen-asm_64.S | 1 - 4 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/entry/entry_64.S +0 -1
@@ -1171,7 +1171,6 @@ idtentry stack_segment do_stack_segment has_error_code=1 #ifdef CONFIG_XEN_PV idtentry xennmi do_nmi has_error_code=0 idtentry xendebug do_debug has_error_code=0 -idtentry xenint3 do_int3 has_error_code=0 #endif idtentry general_protection do_general_protection has_error_code=1
arch/x86/include/asm/traps.h +1 -1
@@ -40,7 +40,7 @@ asmlinkage void simd_coprocessor_error(void); asmlinkage void xen_divide_error(void); asmlinkage void xen_xennmi(void); asmlinkage void xen_xendebug(void); -asmlinkage void xen_xenint3(void); +asmlinkage void xen_int3(void); asmlinkage void xen_overflow(void); asmlinkage void xen_bounds(void); asmlinkage void xen_invalid_op(void);
arch/x86/xen/enlighten_pv.c +1 -1
@@ -596,12 +596,12 @@ struct trap_array_entry {static struct trap_array_entry trap_array[] = { { debug, xen_xendebug, true }, - { int3, xen_xenint3, true }, { double_fault, xen_double_fault, true }, #ifdef CONFIG_X86_MCE { machine_check, xen_machine_check, true }, #endif { nmi, xen_xennmi, true }, + { int3, xen_int3, false }, { overflow, xen_overflow, false }, #ifdef CONFIG_IA32_EMULATION { entry_INT80_compat, xen_entry_INT80_compat, false },
arch/x86/xen/xen-asm_64.S +0 -1
@@ -32,7 +32,6 @@ xen_pv_trap divide_error xen_pv_trap debug xen_pv_trap xendebug xen_pv_trap int3 -xen_pv_trap xenint3 xen_pv_trap xennmi xen_pv_trap overflow xen_pv_trap bounds
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 68/131 x86/kvm: Dont call kvm_spurious_fault() from .fixup
In reply to Greg Kroah-Hartman[ Upstream commit 3901336ed9887b075531bffaeef7742ba614058b ]
After making a change to improve objtool's sibling call detection, it started showing the following warning:
arch/x86/kvm/vmx/nested.o: warning: objtool: .fixup+0x15: sibling call from callable instruction with modified stack frame
The problem is the ____kvm_handle_fault_on_reboot() macro. It does a fake call by pushing a fake RIP and doing a jump. That tricks the unwinder into printing the function which triggered the exception, rather than the .fixup code.
Instead of the hack to make it look like the original function made the call, just change the macro so that the original function actually does make the call. This allows removal of the hack, and also makes objtool happy.
I triggered a vmx instruction exception and verified that the stack trace is still sane:
kernel BUG at arch/x86/kvm/x86.c:358!
invalid opcode: 0000 [#1] SMP PTI
CPU: 28 PID: 4096 Comm: qemu-kvm Not tainted 5.2.0+ #16 Hardware name: Lenovo THINKSYSTEM SD530 -[7X2106Z000]-/-[7X2106Z000]-, BIOS -[TEE113Z-1.00]- 07/17/2017 RIP: 0010:kvm_spurious_fault+0x5/0x10 Code: 00 00 00 00 00 8b 44 24 10 89 d2 45 89 c9 48 89 44 24 10 8b 44 24 08 48 89 44 24 08 e9 d4 40 22 00 0f 1f 40 00 0f 1f 44 00 00 <0f> 0b 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 55 49 89 fd 41 RSP: 0018:ffffbf91c683bd00 EFLAGS: 00010246 RAX: 000061f040000000 RBX: ffff9e159c77bba0 RCX: ffff9e15a5c87000 RDX: 0000000665c87000 RSI: ffff9e15a5c87000 RDI: ffff9e159c77bba0 RBP: 0000000000000000 R08: 0000000000000000 R09: ffff9e15a5c87000 R10: 0000000000000000 R11: fffff8f2d99721c0 R12: ffff9e159c77bba0 R13: ffffbf91c671d960 R14: ffff9e159c778000 R15: 0000000000000000 FS: 00007fa341cbe700(0000) GS:ffff9e15b7400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fdd38356804 CR3: 00000006759de003 CR4: 00000000007606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: loaded_vmcs_init+0x4f/0xe0 alloc_loaded_vmcs+0x38/0xd0 vmx_create_vcpu+0xf7/0x600 kvm_vm_ioctl+0x5e9/0x980 ? __switch_to_asm+0x40/0x70 ? __switch_to_asm+0x34/0x70 ? __switch_to_asm+0x40/0x70 ? __switch_to_asm+0x34/0x70 ? free_one_page+0x13f/0x4e0 do_vfs_ioctl+0xa4/0x630 ksys_ioctl+0x60/0x90 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x55/0x1c0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fa349b1ee5b
--- arch/x86/include/asm/kvm_host.h | 34 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
arch/x86/include/asm/kvm_host.h +19 -15
@@ -1491,25 +1491,29 @@ enum {#define kvm_arch_vcpu_memslots_id (vcpu) ((vcpu)->arch.hflags & HF_SMM_MASK ? 1 : 0)#define kvm_memslots_for_spte_role (kvm, role) __kvm_memslots(kvm, (role).smm) +asmlinkage void __noreturn kvm_spurious_fault(void); +/* * Hardware virtualization extension instructions may fault if a * reboot turns off virtualization while processes are running. -* Trap the fault and ignore the instruction if that happens. +* Usually after catching the fault we just panic; during reboot +* instead the instruction is ignored. */ -asmlinkage void kvm_spurious_fault(void); - -#define ____kvm_handle_fault_on_reboot (insn, cleanup_insn) \ - "666: " insn "\n\t" \ - "668: \n\t" \ - ".pushsection .fixup, \"ax\" \n" \ - "667: \n\t" \ - cleanup_insn "\n\t" \ - "cmpb $0, kvm_rebooting \n\t" \ - "jne 668b \n\t" \ - __ASM_SIZE(push) " $666b \n\t" \ - "jmp kvm_spurious_fault \n\t" \ - ".popsection \n\t" \ - _ASM_EXTABLE(666b, 667b) +#define ____kvm_handle_fault_on_reboot (insn, cleanup_insn) \ + "666: \n\t" \ + insn "\n\t" \ + "jmp 668f \n\t" \ + "667: \n\t" \ + "call kvm_spurious_fault \n\t" \ + "668: \n\t" \ + ".pushsection .fixup, \"ax\" \n\t" \ + "700: \n\t" \ + cleanup_insn "\n\t" \ + "cmpb $0, kvm_rebooting\n\t" \ + "je 667b \n\t" \ + "jmp 668b \n\t" \ + ".popsection \n\t" \ + _ASM_EXTABLE(666b, 700b)#define __kvm_handle_fault_on_reboot (insn) \ ____kvm_handle_fault_on_reboot(insn, "")
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 69/131 x86/paravirt: Fix callee-saved function ELF sizes
In reply to Greg Kroah-Hartman[ Upstream commit 083db6764821996526970e42d09c1ab2f4155dd4 ]
The __raw_callee_save_*() functions have an ELF symbol size of zero, which confuses objtool and other tools.
Fixes a bunch of warnings like the following:
arch/x86/xen/mmu_pv.o: warning: objtool: __raw_callee_save_xen_pte_val() is missing an ELF size annotation arch/x86/xen/mmu_pv.o: warning: objtool: __raw_callee_save_xen_pgd_val() is missing an ELF size annotation arch/x86/xen/mmu_pv.o: warning: objtool: __raw_callee_save_xen_make_pte() is missing an ELF size annotation arch/x86/xen/mmu_pv.o: warning: objtool: __raw_callee_save_xen_make_pgd() is missing an ELF size annotation
--- arch/x86/include/asm/paravirt.h | 1 + arch/x86/kernel/kvm.c | 1 + 2 files changed, 2 insertions(+)
arch/x86/include/asm/paravirt.h +1 -0
@@ -746,6 +746,7 @@ bool __raw_callee_save___native_vcpu_is_preempted(long cpu);PV_RESTORE_ALL_CALLER_REGS \ FRAME_END \"ret;" \ + ".size " PV_THUNK_NAME(func) ", .-" PV_THUNK_NAME(func) ";" \ ".popsection")/* Get a reference to a callee-save function */
arch/x86/kernel/kvm.c +1 -0
@@ -817,6 +817,7 @@ asm( "cmpb $0, " __stringify(KVM_STEAL_TIME_preempted) "+steal_time(%rax);""setne %al;" "ret;" +".size __raw_callee_save___kvm_vcpu_is_preempted, .-__raw_callee_save___kvm_vcpu_is_preempted;" ".popsection");#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 70/131 x86, boot: Remove multiple copy of static function sanitize_boot_params()
In reply to Greg Kroah-Hartman[ Upstream commit 8c5477e8046ca139bac250386c08453da37ec1ae ]
Kernel build warns:
'sanitize_boot_params' defined but not used [-Wunused-function]
at below files:
arch/x86/boot/compressed/cmdline.c
arch/x86/boot/compressed/error.c
arch/x86/boot/compressed/early_serial_console.c
arch/x86/boot/compressed/acpi.c
That's becausethey each include misc.h which includes a definition of sanitize_boot_params() via bootparam_utils.h.
Remove the inclusion from misc.h and have the c file including bootparam_utils.h directly.
--- arch/x86/boot/compressed/misc.c | 1 + arch/x86/boot/compressed/misc.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/compressed/misc.c +1 -0
@@ -17,6 +17,7 @@#include "pgtable.h" #include "../string.h" #include "../voffset.h" +#include <asm/bootparam_utils.h> /* * WARNING!!
arch/x86/boot/compressed/misc.h +0 -1
@@ -23,7 +23,6 @@#include <asm/page.h> #include <asm/boot.h> #include <asm/bootparam.h> -#include <asm/bootparam_utils.h> #define BOOT_CTYPE_H #include <linux/acpi.h>
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 71/131 bpf: Disable GCC -fgcse optimization for ___bpf_prog_run()
In reply to Greg Kroah-Hartman[ Upstream commit 3193c0836f203a91bef96d88c64cccf0be090d9c ]
On x86-64, with CONFIG_RETPOLINE=n, GCC's "global common subexpression elimination" optimization results in ___bpf_prog_run()'s jumptable code changing from this:
select_insn: jmp *jumptable(, %rax, 8) ... ALU64_ADD_X: ... jmp *jumptable(, %rax, 8) ALU_ADD_X: ... jmp *jumptable(, %rax, 8)
to this:
select_insn: mov jumptable, %r12 jmp *(%r12, %rax, 8) ... ALU64_ADD_X: ... jmp *(%r12, %rax, 8) ALU_ADD_X: ... jmp *(%r12, %rax, 8)
The jumptable address is placed in a register once, at the beginning of the function. The function execution can then go through multiple indirect jumps which rely on that same register value. This has a few issues:
1) Objtool isn't smart enough to be able to track such a register value across multiple recursive indirect jumps through the jump table.
2) With CONFIG_RETPOLINE enabled, this optimization actually results in a small slowdown. I measured a ~4.7% slowdown in the test_bpf "tcpdump port 22" selftest.
This slowdown is actually predicted by the GCC manual:
Note: When compiling a program using computed gotos, a GCC extension, you may get better run-time performance if you disable the global common subexpression elimination pass by adding -fno-gcse to the command line.
So just disable the optimization for this function.
--- include/linux/compiler-gcc.h | 2 ++ include/linux/compiler_types.h | 4 ++++ kernel/bpf/core.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-)
include/linux/compiler-gcc.h +2 -0
@@ -170,3 +170,5 @@#else #define __diag_GCC_8 (s)#endif + +#define __no_fgcse __attribute__((optimize("-fno-gcse")))
include/linux/compiler_types.h +4 -0
@@ -187,6 +187,10 @@ struct ftrace_likely_data { #define asm_volatile_goto(x...) asm goto(x)#endif +#ifndef __no_fgcse +# define __no_fgcse +#endif +/* Are two types/vars the same type (ignoring qualifiers)? */ #define __same_type (a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
kernel/bpf/core.c +1 -1
@@ -1295,7 +1295,7 @@ bool bpf_opcode_in_insntable(u8 code)* * Decode and execute eBPF instructions. */ -static u64 ___bpf_prog_run (u64 *regs,const struct bpf_insn *insn,u64 *stack) +static u64 __no_fgcse ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) {#define BPF_INSN_2_LBL (x, y) [BPF_##x | BPF_##y] = &&x##_##y#define BPF_INSN_3_LBL (x, y, z) [BPF_##x | BPF_##y | BPF_##z] = &&x##_##y##_##z
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 72/131 drm/nouveau: fix memory leak in nouveau_conn_reset()
In reply to Greg Kroah-Hartman[ Upstream commit 09b90e2fe35faeace2488234e2a7728f2ea8ba26 ]
In nouveau_conn_reset(), if connector->state is true, __drm_atomic_helper_connector_destroy_state() will be called, but the memory pointed by asyc isn't freed. Memory leak happens in the following function __drm_atomic_helper_connector_reset(), where newly allocated asyc->state will be assigned to connector->state.
So using nouveau_conn_atomic_destroy_state() instead of __drm_atomic_helper_connector_destroy_state to free the "old" asyc.
Here the is the log showing memory leak.
unreferenced object 0xffff8c5480483c80 (size 192):
comm "kworker/0:2", pid 188, jiffies 4294695279 (age 53.179s) hex dump (first 32 bytes):
00 f0 ba 7b 54 8c ff ff 00 00 00 00 00 00 00 00 ...{T...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000005005c0d0>] kmem_cache_alloc_trace+0x195/0x2c0
[<00000000a122baed>] nouveau_conn_reset+0x25/0xc0 [nouveau]
[<000000004fd189a2>] nouveau_connector_create+0x3a7/0x610 [nouveau]
[<00000000c73343a8>] nv50_display_create+0x343/0x980 [nouveau]
[<000000002e2b03c3>] nouveau_display_create+0x51f/0x660 [nouveau]
[<00000000c924699b>] nouveau_drm_device_init+0x182/0x7f0 [nouveau]
[<00000000cc029436>] nouveau_drm_probe+0x20c/0x2c0 [nouveau]
[<000000007e961c3e>] local_pci_probe+0x47/0xa0
[<00000000da14d569>] work_for_cpu_fn+0x1a/0x30
[<0000000028da4805>] process_one_work+0x27c/0x660
[<000000001d415b04>] worker_thread+0x22b/0x3f0
[<0000000003b69f1f>] kthread+0x12f/0x150
[<00000000c94c29b7>] ret_from_fork+0x3a/0x50--- drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -1
@@ -252,7 +252,7 @@ nouveau_conn_reset(struct drm_connector *connector)return ;if (connector->state) -__drm_atomic_helper_connector_destroy_state (connector->state); +nouveau_conn_atomic_destroy_state (connector, connector->state);__drm_atomic_helper_connector_reset (connector, &asyc->state); asyc->dither.mode =DITHERING_MODE_AUTO ; asyc->dither.depth =DITHERING_DEPTH_AUTO ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 73/131 dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device
In reply to Greg Kroah-Hartman[ Upstream commit 449fa54d6815be8c2c1f68fa9dbbae9384a7c03e ]
dma_map_sg() may use swiotlb buffer when the kernel command line includes "swiotlb=force" or the dma_addr is out of dev->dma_mask range. After DMA complete the memory moving from device to memory, then user call dma_sync_sg_for_cpu() to sync with DMA buffer, and copy the original virtual buffer to other space.
So dma_direct_sync_sg_for_cpu() should use swiotlb physical addr, not the original physical addr from sg_phys(sg).
dma_direct_sync_sg_for_device() also has the same issue, correct it as well.
--- kernel/dma/direct.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
kernel/dma/direct.c +11 -7
@@ -231,12 +231,14 @@ void dma_direct_sync_sg_for_device(struct device *dev,int i;for_each_sg (sgl, sg, nents, i) { -if (unlikely (is_swiotlb_buffer (sg_phys (sg)))) -swiotlb_tbl_sync_single (dev,sg_phys (sg), sg->length, +phys_addr_t paddr =dma_to_phys (dev,sg_dma_address (sg)); + +if (unlikely (is_swiotlb_buffer (paddr))) +swiotlb_tbl_sync_single (dev, paddr, sg->length, dir,SYNC_FOR_DEVICE );if (!dev_is_dma_coherent (dev)) -arch_sync_dma_for_device (dev,sg_phys (sg), sg->length, +arch_sync_dma_for_device (dev, paddr, sg->length, dir); } }
@@ -268,11 +270,13 @@ void dma_direct_sync_sg_for_cpu(struct device *dev,int i;for_each_sg (sgl, sg, nents, i) { +phys_addr_t paddr =dma_to_phys (dev,sg_dma_address (sg)); +if (!dev_is_dma_coherent (dev)) -arch_sync_dma_for_cpu (dev,sg_phys (sg), sg->length, dir); - -if (unlikely (is_swiotlb_buffer (sg_phys (sg)))) -swiotlb_tbl_sync_single (dev,sg_phys (sg), sg->length, dir, +arch_sync_dma_for_cpu (dev, paddr, sg->length, dir); + +if (unlikely (is_swiotlb_buffer (paddr))) +swiotlb_tbl_sync_single (dev, paddr, sg->length, dir,SYNC_FOR_CPU ); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerRe: [PATCH 5.2 073/131] dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device
Quoted 11 lines · Greg Kroah-Hartman
[ Upstream commit
449fa54d6815be8c2c1f68fa9dbbae9384a7c03e]
dma_map_sg()may use swiotlb buffer when the kernel command line includes "swiotlb=force" or thedma_addris out ofdev->dma_maskrange. After DMA complete the memory moving from device to memory, then user calldma_sync_sg_for_cpu()to sync with DMA buffer, and copy the original virtual buffer to other space.So
dma_direct_sync_sg_for_cpu()should use swiotlb physical addr, not the original physical addr fromsg_phys(sg).
Quoted 8 lines
dma_direct_sync_sg_for_device()also has the same issue, correct it as well.Fixes 55897af63091("dma-direct: merge swiotlb_dma_ops into the dma_direct code")Signed-off-by Fugang Duan <[email protected]>Reviewed-by Robin Murphy <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Sasha Levin <[email protected]>
I'm going to drop this one. There's a fix to it upstream, but the fix also seems to want 0036bc73ccbe ("drm/msm: stop abusing dma_map/unmap for cache") which we're not taking, so I'm just going to drop this one as well.
If someone wants it in the stable trees, please send a tested backport.
--
Thanks,
Sasha
Re: [PATCH 5.2 073/131] dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device
Quoted 21 lines · Sasha Levin
Quoted 11 lines · Greg Kroah-Hartman
[ Upstream commit
449fa54d6815be8c2c1f68fa9dbbae9384a7c03e]
dma_map_sg()may use swiotlb buffer when the kernel command line includes "swiotlb=force" or thedma_addris out ofdev->dma_maskrange. After DMA complete the memory moving from device to memory, then user calldma_sync_sg_for_cpu()to sync with DMA buffer, and copy the original virtual buffer to other space.So
dma_direct_sync_sg_for_cpu()should use swiotlb physical addr, not the original physical addr fromsg_phys(sg).Quoted 8 lines
dma_direct_sync_sg_for_device()also has the same issue, correct it as well.Fixes 55897af63091("dma-direct: merge swiotlb_dma_ops into the dma_direct code")Signed-off-by Fugang Duan <[email protected]>Reviewed-by Robin Murphy <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 4 lines
I'm going to drop this one. There's a fix to it upstream, but the fix also seems to want
0036bc73ccbe("drm/msm: stop abusing dma_map/unmap for cache") which we're not taking, so I'm just going to drop this one as well.
Given that the two commits touch entirely separate files I'm not sure what the imagined dependency could be :/
0036bc73ccbe is indeed not a fix (frankly I'm not convinced it's even a valid change at all) but even conceptually it bears no relation whatsoever to the genuine bug fixed by 449fa54d6815.
Robin.
Quoted 6 lines
If someone wants it in the stable trees, please send a tested backport.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerRe: [PATCH 5.2 073/131] dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device
Quoted 22 lines · Robin Murphy
Quoted 21 lines · Sasha Levin
Quoted 19 lines · Greg Kroah-Hartman
[ Upstream commit
449fa54d6815be8c2c1f68fa9dbbae9384a7c03e]
dma_map_sg()may use swiotlb buffer when the kernel command line includes "swiotlb=force" or thedma_addris out ofdev->dma_maskrange. After DMA complete the memory moving from device to memory, then user calldma_sync_sg_for_cpu()to sync with DMA buffer, and copy the original virtual buffer to other space.So
dma_direct_sync_sg_for_cpu()should use swiotlb physical addr, not the original physical addr fromsg_phys(sg).
dma_direct_sync_sg_for_device()also has the same issue, correct it as well.Fixes 55897af63091("dma-direct: merge swiotlb_dma_ops into the dma_direct code")Signed-off-by Fugang Duan <[email protected]>Reviewed-by Robin Murphy <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 6 lines
Quoted 4 lines
I'm going to drop this one. There's a fix to it upstream, but the fix also seems to want
0036bc73ccbe("drm/msm: stop abusing dma_map/unmap for cache") which we're not taking, so I'm just going to drop this one as well.Given that the two commits touch entirely separate files I'm not sure what the imagined dependency could be :/
From the commit message of 3de433c5b38a ("drm/msm: Use the correct dma_sync calls in msm_gem"):
Fixes the combination of two patches:
Quoted 1 line
0036bc73ccbeis indeed not a fix (frankly I'm not convinced it's even a valid change at all) but even conceptually it bears no relation whatsoever to the genuine bug fixed by449fa54d6815.
Given that Rob Clark asked me to drop 0036bc73ccbe not because it's irrelevant but because it's potentially dangerous, I did not feel confident enough ignoring the statement in the commit message and dropped this patch instead.
If I'm wrong here, I'd be happy to take these two patches if someone acks it.
--
Thanks,
Sasha
Re: [PATCH 5.2 073/131] dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device
Quoted 12 lines · Sasha Levin
Quoted 4 lines · Robin Murphy
Given that the two commits touch entirely separate files I'm not sure what the imagined dependency could be :/
From the commit message of
3de433c5b38a("drm/msm: Use the correct
dma_synccalls inmsm_gem"):Fixes the combination of two patches:
Fixes 0036bc73ccbe (drm/msm: stop abusing dma_map/unmap for cache)Fixes 449fa54d6815 (dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device)
Quoted 8 lines
Quoted 3 lines
0036bc73ccbeis indeed not a fix (frankly I'm not convinced it's even a valid change at all) but even conceptually it bears no relation whatsoever to the genuine bug fixed by449fa54d6815.Given that Rob Clark asked me to drop
0036bc73ccbenot because it's irrelevant but because it's potentially dangerous, I did not feel confident enough ignoring the statement in the commit message and dropped this patch instead.
449fa54d6815 fixes swiotlb misbehaving vs the API spec for the call, something that real users on x86 cought. Robs fix works around the fact that msm is badly abusing dma API. So even if both are genuine bugs it is pretty clear we need to decide the match for the proper users of the API and not the single abuser.
Greg Kroah-Hartman
maintainerPATCH 74/131 drm/nouveau/dmem: missing mutex_lock in error path
In reply to Greg Kroah-Hartman[ Upstream commit d304654bd79332ace9ac46b9a3d8de60acb15da3 ]
In nouveau_dmem_pages_alloc(), the drm->dmem->mutex is unlocked before calling nouveau_dmem_chunk_alloc() as shown when CONFIG_PROVE_LOCKING is enabled:
[ 1294.871933] =====================================
[ 1294.876656] WARNING: bad unlock balance detected!
[ 1294.881375] 5.2.0-rc3+ #5 Not tainted
[ 1294.885048] -------------------------------------
[ 1294.889773] test-malloc-vra/6299 is trying to release lock (&drm->dmem->mutex) at:
[ 1294.897482] [<ffffffffa01a220f>] nouveau_dmem_migrate_alloc_and_copy+0x79f/0xbf0 [nouveau]
[ 1294.905782] but there are no more locks to release!
[ 1294.910690]
[ 1294.910690] other info that might help us debug this:
[ 1294.917249] 1 lock held by test-malloc-vra/6299:
[ 1294.921881] #0: 0000000016e10454 (&mm->mmap_sem#2){++++}, at: nouveau_svmm_bind+0x142/0x210 [nouveau]
[ 1294.931313]
[ 1294.931313] stack backtrace:
[ 1294.935702] CPU: 4 PID: 6299 Comm: test-malloc-vra Not tainted 5.2.0-rc3+ #5
[ 1294.942786] Hardware name: ASUS X299-A/PRIME X299-A, BIOS 1401 05/21/2018
[ 1294.949590] Call Trace:
[ 1294.952059] dump_stack+0x7c/0xc0
[ 1294.955469] ? nouveau_dmem_migrate_alloc_and_copy+0x79f/0xbf0 [nouveau]
[ 1294.962213] print_unlock_imbalance_bug.cold.52+0xca/0xcf
[ 1294.967641] lock_release+0x306/0x380
[ 1294.971383] ? nouveau_dmem_migrate_alloc_and_copy+0x79f/0xbf0 [nouveau]
[ 1294.978089] ? lock_downgrade+0x2d0/0x2d0
[ 1294.982121] ? find_held_lock+0xac/0xd0
[ 1294.985979] __mutex_unlock_slowpath+0x8f/0x3f0
[ 1294.990540] ? wait_for_completion+0x230/0x230
[ 1294.995002] ? rwlock_bug.part.2+0x60/0x60
[ 1294.999197] nouveau_dmem_migrate_alloc_and_copy+0x79f/0xbf0 [nouveau]
[ 1295.005751] ? page_mapping+0x98/0x110
[ 1295.009511] migrate_vma+0xa74/0x1090
[ 1295.013186] ? move_to_new_page+0x480/0x480
[ 1295.017400] ? __kmalloc+0x153/0x300
[ 1295.021052] ? nouveau_dmem_migrate_vma+0xd8/0x1e0 [nouveau]
[ 1295.026796] nouveau_dmem_migrate_vma+0x157/0x1e0 [nouveau]
[ 1295.032466] ? nouveau_dmem_init+0x490/0x490 [nouveau]
[ 1295.037612] ? vmacache_find+0xc2/0x110
[ 1295.041537] nouveau_svmm_bind+0x1b4/0x210 [nouveau]
[ 1295.046583] ? nouveau_svm_fault+0x13e0/0x13e0 [nouveau]
[ 1295.051912] drm_ioctl_kernel+0x14d/0x1a0
[ 1295.055930] ? drm_setversion+0x330/0x330
[ 1295.059971] drm_ioctl+0x308/0x530
[ 1295.063384] ? drm_version+0x150/0x150
[ 1295.067153] ? find_held_lock+0xac/0xd0
[ 1295.070996] ? __pm_runtime_resume+0x3f/0xa0
[ 1295.075285] ? mark_held_locks+0x29/0xa0
[ 1295.079230] ? _raw_spin_unlock_irqrestore+0x3c/0x50
[ 1295.084232] ? lockdep_hardirqs_on+0x17d/0x250
[ 1295.088768] nouveau_drm_ioctl+0x9a/0x100 [nouveau]
[ 1295.093661] do_vfs_ioctl+0x137/0x9a0
[ 1295.097341] ? ioctl_preallocate+0x140/0x140
[ 1295.101623] ? match_held_lock+0x1b/0x230
[ 1295.105646] ? match_held_lock+0x1b/0x230
[ 1295.109660] ? find_held_lock+0xac/0xd0
[ 1295.113512] ? __do_page_fault+0x324/0x630
[ 1295.117617] ? lock_downgrade+0x2d0/0x2d0
[ 1295.121648] ? mark_held_locks+0x79/0xa0
[ 1295.125583] ? handle_mm_fault+0x352/0x430
[ 1295.129687] ksys_ioctl+0x60/0x90
[ 1295.133020] ? mark_held_locks+0x29/0xa0
[ 1295.136964] __x64_sys_ioctl+0x3d/0x50
[ 1295.140726] do_syscall_64+0x68/0x250
[ 1295.144400] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1295.149465] RIP: 0033:0x7f1a3495809b
[ 1295.153053] Code: 0f 1e fa 48 8b 05 ed bd 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d bd bd 0c 00 f7 d8 64 89 01 48
[ 1295.171850] RSP: 002b:00007ffef7ed1358 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 1295.179451] RAX: ffffffffffffffda RBX: 00007ffef7ed1628 RCX: 00007f1a3495809b
[ 1295.186601] RDX: 00007ffef7ed13b0 RSI: 0000000040406449 RDI: 0000000000000004
[ 1295.193759] RBP: 00007ffef7ed13b0 R08: 0000000000000000 R09: 000000000157e770
[ 1295.200917] R10: 000000000151c010 R11: 0000000000000246 R12: 0000000040406449
[ 1295.208083] R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000Reacquire the lock before continuing to the next page.
--- drivers/gpu/drm/nouveau/nouveau_dmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_dmem.c +2 -1
@@ -385,9 +385,10 @@ nouveau_dmem_pages_alloc(struct nouveau_drm *drm, ret =nouveau_dmem_chunk_alloc (drm);if (ret) {if (c) -break ; +return 0 ;return ret; } +mutex_lock (&drm->dmem->mutex);continue ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 75/131 kconfig: Clear "written" flag to avoid data loss
In reply to Greg Kroah-HartmanFrom: M. Vefa Bicakci <[email protected]>
commit 0c5b6c28ed68becb692b43eae5e44d5aa7e160ce upstream.
Prior to this commit, starting nconfig, xconfig or gconfig, and saving the .config file more than once caused data loss, where a .config file that contained only comments would be written to disk starting from the second save operation.
This bug manifests itself because the SYMBOL_WRITTEN flag is never cleared after the first call to conf_write, and subsequent calls to conf_write then skip all of the configuration symbols due to the SYMBOL_WRITTEN flag being set.
This commit resolves this issue by clearing the SYMBOL_WRITTEN flag from all symbols before conf_write returns.
--- scripts/kconfig/confdata.c | 4 ++++ 1 file changed, 4 insertions(+)
scripts/kconfig/confdata.c +4 -0
@@ -867,6 +867,7 @@ int conf_write(const char *name)const char *str;char tmpname[PATH_MAX +1 ], oldname[PATH_MAX +1 ];char *env; +int i;bool need_newline = false;if (!name)
@@ -949,6 +950,9 @@ next: }fclose (out); +for_all_symbols (i, sym) + sym->flags &= ~SYMBOL_WRITTEN; +if (*tmpname) {if (is_same (name, tmpname)) {conf_message ("No change to %s" , name);
Greg Kroah-Hartman
maintainerPATCH 76/131 kbuild: initialize CLANG_FLAGS correctly in the top Makefile
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 5241ab4cf42d3a93b933b55d3d53f43049081fa1 upstream.
CLANG_FLAGS is initialized by the following line:
CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
..., which is run only when CROSS_COMPILE is set.
Some build targets (bindeb-pkg etc.) recurse to the top Makefile.
When you build the kernel with Clang but without CROSS_COMPILE, the same compiler flags such as -no-integrated-as are accumulated into CLANG_FLAGS.
If you run 'make CC=clang' and then 'make CC=clang bindeb-pkg', Kbuild will recompile everything needlessly due to the build command change.
Fix this by correctly initializing CLANG_FLAGS.
--- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
@@ -467,6 +467,7 @@ KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds KBUILD_LDFLAGS := GCC_PLUGINS_CFLAGS := +CLANG_FLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP PAHOLE KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
@@ -519,7 +520,7 @@ endif ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) ifneq ($(CROSS_COMPILE),) -CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) +CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
Greg Kroah-Hartman
maintainerPATCH 77/131 kbuild: modpost: include .*.cmd files only when targets exist
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 944cfe9be1fbbec73bab2f7e77fe2e8f9c72970f upstream.
If a build rule fails, the .DELETE_ON_ERROR special target removes the target, but does nothing for the .*.cmd file, which might be corrupted. So, .*.cmd files should be included only when the corresponding targets exist.
Commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files") missed to fix up this file.
--- scripts/Makefile.modpost | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/Makefile.modpost +2 -4
@@ -142,10 +142,8 @@ FORCE: # optimization, we don't need to read them if the target does not # exist, we will rebuild anyway in that case. -cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) +existing-targets := $(wildcard $(sort $(targets))) -ifneq ($(cmd_files),) - include $(cmd_files) -endif +-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) .PHONY: $(PHONY)
Greg Kroah-Hartman
maintainerPATCH 78/131 tpm: Fix null pointer dereference on chip register error path
In reply to Greg Kroah-HartmanFrom: Milan Broz <[email protected]>
commit 1e5ac6300a07ceecfc70a893ebef3352be21e6f8 upstream.
If clk_enable is not defined and chip initialization is canceled code hits null dereference.
Easily reproducible with vTPM init fail:
swtpm chardev --tpmstate dir=nonexistent_dir --tpm2 --vtpm-proxy
BUG: kernel NULL pointer dereference, address: 00000000 ... Call Trace: tpm_chip_start+0x9d/0xa0 [tpm] tpm_chip_register+0x10/0x1a0 [tpm] vtpm_proxy_work+0x11/0x30 [tpm_vtpm_proxy] process_one_work+0x214/0x5a0 worker_thread+0x134/0x3e0 ? process_one_work+0x5a0/0x5a0 kthread+0xd4/0x100 ? process_one_work+0x5a0/0x5a0 ? kthread_park+0x90/0x90 ret_from_fork+0x19/0x24
--- drivers/char/tpm/tpm-chip.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/char/tpm/tpm-chip.c +16 -7
@@ -77,6 +77,18 @@ static int tpm_go_idle(struct tpm_chip *return chip->ops->go_idle (chip); } +static void tpm_clk_enable (struct tpm_chip *chip) +{ +if (chip->ops->clk_enable) + chip->ops->clk_enable (chip, true); +} + +static void tpm_clk_disable (struct tpm_chip *chip) +{ +if (chip->ops->clk_enable) + chip->ops->clk_enable (chip, false); +} +/** * tpm_chip_start() - power on the TPM * @chip: a TPM chip to use
@@ -89,13 +101,12 @@ int tpm_chip_start(struct tpm_chip *chip {int ret; -if (chip->ops->clk_enable) - chip->ops->clk_enable (chip, true); +tpm_clk_enable (chip);if (chip->locality ==-1 ) { ret =tpm_request_locality (chip);if (ret) { - chip->ops->clk_enable (chip, false); +tpm_clk_disable (chip);return ret; } }
@@ -103,8 +114,7 @@ int tpm_chip_start(struct tpm_chip *chip ret =tpm_cmd_ready (chip);if (ret) {tpm_relinquish_locality (chip); -if (chip->ops->clk_enable) - chip->ops->clk_enable (chip, false); +tpm_clk_disable (chip);return ret; }
@@ -124,8 +134,7 @@ void tpm_chip_stop(struct tpm_chip *chip {tpm_go_idle (chip);tpm_relinquish_locality (chip); -if (chip->ops->clk_enable) - chip->ops->clk_enable (chip, false); +tpm_clk_disable (chip); }EXPORT_SYMBOL_GPL (tpm_chip_stop);
Greg Kroah-Hartman
maintainerPATCH 79/131 Btrfs: fix incremental send failure after deduplication
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit b4f9a1a87a48c255bb90d8a6c3d555a1abb88130 upstream.
When doing an incremental send operation we can fail if we previously did deduplication operations against a file that exists in both snapshots. In that case we will fail the send operation with -EIO and print a message to dmesg/syslog like the following:
BTRFS error (device sdc): Send: inconsistent snapshot, found updated \ extent for inode 257 without updated inode item, send root is 258, \ parent root is 257
This requires that we deduplicate to the same file in both snapshots for the same amount of times on each snapshot. The issue happens because a deduplication only updates the iversion of an inode and does not update any other field of the inode, therefore if we deduplicate the file on each snapshot for the same amount of time, the inode will have the same iversion value (stored as the "sequence" field on the inode item) on both snapshots, therefore it will be seen as unchanged between in the send snapshot while there are new/updated/deleted extent items when comparing to the parent snapshot. This makes the send operation return -EIO and print an error message.
Example reproducer:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt
# Create our first file. The first half of the file has several 64Kb
# extents while the second half as a single 512Kb extent. $ xfs_io -f -s -c "pwrite -S 0xb8 -b 64K 0 512K" /mnt/foo $ xfs_io -c "pwrite -S 0xb8 512K 512K" /mnt/foo
# Create the base snapshot and the parent send stream from it.
$ btrfs subvolume snapshot -r /mnt /mnt/mysnap1 $ btrfs send -f /tmp/1.snap /mnt/mysnap1
# Create our second file, that has exactly the same data as the first
# file. $ xfs_io -f -c "pwrite -S 0xb8 0 1M" /mnt/bar
# Create the second snapshot, used for the incremental send, before
# doing the file deduplication. $ btrfs subvolume snapshot -r /mnt /mnt/mysnap2
# Now before creating the incremental send stream:
#
# 1) Deduplicate into a subrange of file foo in snapshot mysnap1. This
# will drop several extent items and add a new one, also updating # the inode's iversion (sequence field in inode item) by 1, but not # any other field of the inode; # # 2) Deduplicate into a different subrange of file foo in snapshot # mysnap2. This will replace an extent item with a new one, also # updating the inode's iversion by 1 but not any other field of the # inode. # # After these two deduplication operations, the inode items, for file # foo, are identical in both snapshots, but we have different extent # items for this inode in both snapshots. We want to check this doesn't # cause send to fail with an error or produce an incorrect stream.
$ xfs_io -r -c "dedupe /mnt/bar 0 0 512K" /mnt/mysnap1/foo $ xfs_io -r -c "dedupe /mnt/bar 512K 512K 512K" /mnt/mysnap2/foo
# Create the incremental send stream.
$ btrfs send -p /mnt/mysnap1 -f /tmp/2.snap /mnt/mysnap2 ERROR: send ioctl failed with -5: Input/output error
This issue started happening back in 2015 when deduplication was updated to not update the inode's ctime and mtime and update only the iversion. Back then we would hit a BUG_ON() in send, but later in 2016 send was updated to return -EIO and print the error message instead of doing the BUG_ON().
A test case for fstests follows soon.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203933
--- fs/btrfs/send.c | 77 ++++++++++---------------------------------------------- 1 file changed, 15 insertions(+), 62 deletions(-)
fs/btrfs/send.c +15 -62
@@ -6322,68 +6322,21 @@ static int changed_extent(struct send_ct {int ret =0 ; -if (sctx->cur_ino != sctx->cmp_key->objectid) { - -if (result ==BTRFS_COMPARE_TREE_CHANGED ) { -struct extent_buffer *leaf_l; -struct extent_buffer *leaf_r; -struct btrfs_file_extent_item *ei_l; -struct btrfs_file_extent_item *ei_r; - - leaf_l = sctx->left_path->nodes[0 ]; - leaf_r = sctx->right_path->nodes[0 ]; - ei_l =btrfs_item_ptr (leaf_l, - sctx->left_path->slots[0 ], - struct btrfs_file_extent_item); - ei_r =btrfs_item_ptr (leaf_r, - sctx->right_path->slots[0 ], - struct btrfs_file_extent_item); - -/* -* We may have found an extent item that has changed -* only its disk_bytenr field and the corresponding -* inode item was not updated. This case happens due to -* very specific timings during relocation when a leaf -* that contains file extent items is COWed while -* relocation is ongoing and its in the stage where it -* updates data pointers. So when this happens we can -* safely ignore it since we know it's the same extent, -* but just at different logical and physical locations -* (when an extent is fully replaced with a new one, we -* know the generation number must have changed too, -* since snapshot creation implies committing the current -* transaction, and the inode item must have been updated -* as well). -* This replacement of the disk_bytenr happens at -* relocation.c:replace_file_extents() through -* relocation.c:btrfs_reloc_cow_block(). -*/ -if (btrfs_file_extent_generation (leaf_l, ei_l) == -btrfs_file_extent_generation (leaf_r, ei_r) && -btrfs_file_extent_ram_bytes (leaf_l, ei_l) == -btrfs_file_extent_ram_bytes (leaf_r, ei_r) && -btrfs_file_extent_compression (leaf_l, ei_l) == -btrfs_file_extent_compression (leaf_r, ei_r) && -btrfs_file_extent_encryption (leaf_l, ei_l) == -btrfs_file_extent_encryption (leaf_r, ei_r) && -btrfs_file_extent_other_encoding (leaf_l, ei_l) == -btrfs_file_extent_other_encoding (leaf_r, ei_r) && -btrfs_file_extent_type (leaf_l, ei_l) == -btrfs_file_extent_type (leaf_r, ei_r) && -btrfs_file_extent_disk_bytenr (leaf_l, ei_l) != -btrfs_file_extent_disk_bytenr (leaf_r, ei_r) && -btrfs_file_extent_disk_num_bytes (leaf_l, ei_l) == -btrfs_file_extent_disk_num_bytes (leaf_r, ei_r) && -btrfs_file_extent_offset (leaf_l, ei_l) == -btrfs_file_extent_offset (leaf_r, ei_r) && -btrfs_file_extent_num_bytes (leaf_l, ei_l) == -btrfs_file_extent_num_bytes (leaf_r, ei_r)) -return 0 ; - } - -inconsistent_snapshot_error (sctx, result,"extent" ); -return -EIO ; - } +/* +* We have found an extent item that changed without the inode item +* having changed. This can happen either after relocation (where the +* disk_bytenr of an extent item is replaced at +* relocation.c:replace_file_extents()) or after deduplication into a +* file in both the parent and send snapshots (where an extent item can +* get modified or replaced with a new one). Note that deduplication +* updates the inode item, but it only changes the iversion (sequence +* field in the inode item) of the inode, so if a file is deduplicated +* the same amount of times in both the parent and send snapshots, its +* iversion becames the same in both snapshots, whence the inode item is +* the same on both snapshots. +*/ +if (sctx->cur_ino != sctx->cmp_key->objectid) +return 0 ;if (!sctx->cur_inode_new_gen && !sctx->cur_inode_deleted) {if (result !=BTRFS_COMPARE_TREE_DELETED )
Greg Kroah-Hartman
maintainerPATCH 80/131 Btrfs: fix race leading to fs corruption after transaction abort
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit cb2d3daddbfb6318d170e79aac1f7d5e4d49f0d7 upstream.
When one transaction is finishing its commit, it is possible for another transaction to start and enter its initial commit phase as well. If the first ends up getting aborted, we have a small time window where the second transaction commit does not notice that the previous transaction aborted and ends up committing, writing a superblock that points to btrees that reference extent buffers (nodes and leafs) that were not persisted to disk. The consequence is that after mounting the filesystem again, we will be unable to load some btree nodes/leafs, either because the content on disk is either garbage (or just zeroes) or corresponds to the old content of a previouly COWed or deleted node/leaf, resulting in the well known error messages "parent transid verify failed on ...".
The following sequence diagram illustrates how this can happen.
CPU 1 CPU 2
<at transaction N>
btrfs_commit_transaction()
(...)
--> sets transaction state to
TRANS_STATE_UNBLOCKED
--> sets fs_info->running_transaction
to NULL
(...)
btrfs_start_transaction()
start_transaction()
wait_current_trans()
--> returns immediately
because
fs_info->running_transaction
is NULL
join_transaction()
--> creates transaction N + 1
--> sets
fs_info->running_transaction
to transaction N + 1
--> adds transaction N + 1 to
the fs_info->trans_list list
--> returns transaction handle
pointing to the new
transaction N + 1
(...)
btrfs_sync_file()
btrfs_start_transaction()
--> returns handle to
transaction N + 1
(...) btrfs_write_and_wait_transaction()
--> writeback of some extent
buffer fails, returns an
error
btrfs_handle_fs_error()
--> sets BTRFS_FS_STATE_ERROR in
fs_info->fs_state
--> jumps to label "scrub_continue"
cleanup_transaction()
btrfs_abort_transaction(N)
--> sets BTRFS_FS_STATE_TRANS_ABORTED
flag in fs_info->fs_state
--> sets aborted field in the
transaction and transaction
handle structures, for
transaction N only
--> removes transaction from the
list fs_info->trans_list
btrfs_commit_transaction(N + 1)
--> transaction N + 1 was not
aborted, so it proceeds
(...)
--> sets the transaction's state
to TRANS_STATE_COMMIT_START
--> does not find the previous
transaction (N) in the
fs_info->trans_list, so it
doesn't know that transaction
was aborted, and the commit
of transaction N + 1 proceeds
(...)
--> sets transaction N + 1 state
to TRANS_STATE_UNBLOCKED
btrfs_write_and_wait_transaction()
--> succeeds writing all extent
buffers created in the
transaction N + 1
write_all_supers()
--> succeeds
--> we now have a superblock on
disk that points to trees
that refer to at least one
extent buffer that was
never persistedSo fix this by updating the transaction commit path to check if the flag BTRFS_FS_STATE_TRANS_ABORTED is set on fs_info->fs_state if after setting the transaction to the TRANS_STATE_COMMIT_START we do not find any previous transaction in the fs_info->trans_list. If the flag is set, just fail the transaction commit with -EROFS, as we do in other places. The exact error code for the previous transaction abort was already logged and reported.
--- fs/btrfs/transaction.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/btrfs/transaction.c +10 -0
@@ -2019,6 +2019,16 @@ int btrfs_commit_transaction(struct btrf } }else {spin_unlock (&fs_info->trans_lock); +/* +* The previous transaction was aborted and was already removed +* from the list of transactions at fs_info->trans_list. So we +* abort to prevent writing a new superblock that reflects a +* corrupt state (pointing to trees with unwritten nodes/leafs). +*/ +if (test_bit (BTRFS_FS_STATE_TRANS_ABORTED , &fs_info->fs_state)) { + ret = -EROFS ; + goto cleanup_transaction; + } }extwriter_counter_dec (cur_trans, trans->type);
Greg Kroah-Hartman
maintainerPATCH 81/131 dax: Fix missed wakeup in put_unlocked_entry()
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 61c30c98ef17e5a330d7bb8494b78b3d6dffe9b8 upstream.
The condition checking whether put_unlocked_entry() needs to wake up following waiter got broken by commit 23c84eb78375 ("dax: Fix missed wakeup with PMD faults"). We need to wake the waiter whenever the passed entry is valid (i.e., non-NULL and not special conflict entry). This could lead to processes never being woken up when waiting for entry lock. Fix the condition.
--- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dax.c +1 -1
@@ -267,7 +267,7 @@ static void wait_entry_unlocked(struct xstatic void put_unlocked_entry (struct xa_state *xas,void *entry) {/* If we were the only waiter woken, wake the next one */ -if (entry &&dax_is_conflict (entry)) +if (entry && !dax_is_conflict (entry))dax_wake_entry (xas, entry, false); }
Greg Kroah-Hartman
maintainerPATCH 82/131 fgraph: Remove redundant ftrace_graph_notrace_addr() test
In reply to Greg Kroah-HartmanFrom: Changbin Du <[email protected]>
commit 6c77221df96177da0520847ce91e33f539fb8b2d upstream.
We already have tested it before. The second one should be removed. With this change, the performance should have little improvement.
--- kernel/trace/trace_functions_graph.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
kernel/trace/trace_functions_graph.c +7 -10
@@ -137,6 +137,13 @@ int trace_graph_entry(struct ftrace_grapif (trace_recursion_test (TRACE_GRAPH_NOTRACE_BIT ))return 0 ; +/* +* Do not trace a function if it's filtered by set_graph_notrace. +* Make the index of ret stack negative to indicate that it should +* ignore further functions. But it needs its own ret stack entry +* to recover the original index in order to continue tracing after +* returning from the function. +*/ if (ftrace_graph_notrace_addr (trace->func)) {trace_recursion_set (TRACE_GRAPH_NOTRACE_BIT );/*
@@ -156,16 +163,6 @@ int trace_graph_entry(struct ftrace_grapreturn 0 ;/* -* Do not trace a function if it's filtered by set_graph_notrace. -* Make the index of ret stack negative to indicate that it should -* ignore further functions. But it needs its own ret stack entry -* to recover the original index in order to continue tracing after -* returning from the function. -*/ -if (ftrace_graph_notrace_addr (trace->func)) -return 1 ; - -/* * Stop here if tracing_threshold is set. We only write function return * events to the ring buffer. */
Greg Kroah-Hartman
maintainerPATCH 83/131 mmc: dw_mmc: Fix occasional hang after tuning on eMMC
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
commit ba2d139b02ba684c6c101de42fed782d6cd2b997 upstream.
In commit 46d179525a1f ("mmc: dw_mmc: Wait for data transfer after response errors.") we fixed a tuning-induced hang that I saw when stress testing tuning on certain SD cards. I won't re-hash that whole commit, but the summary is that as a normal part of tuning you need to deal with transfer errors and there were cases where these transfer errors was putting my system into a bad state causing all future transfers to fail. That commit fixed handling of the transfer errors for me.
In downstream Chrome OS my fix landed and had the same behavior for all SD/MMC commands. However, it looks like when the commit landed upstream we limited it to only SD tuning commands. Presumably this was to try to get around problems that Alim Akhtar reported on exynos [1].
Unfortunately while stress testing reboots (and suspend/resume) on some rk3288-based Chromebooks I found the same problem on the eMMC on some of my Chromebooks (the ones with Hynix eMMC). Since the eMMC tuning command is different (MMC_SEND_TUNING_BLOCK_HS200 vs. MMC_SEND_TUNING_BLOCK) we were basically getting back into the same situation.
I'm hoping that whatever problems exynos was having in the past are somehow magically fixed now and we can make the behavior the same for all commands.
[1] https://lkml.kernel.org/r/CAGOxZ53WfNbaMe0_AM0qBqU47kAfgmPBVZC8K8Y-_J3mDMqW4A@mail.gmail.com
--- drivers/mmc/host/dw_mmc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/dw_mmc.c +1 -2
@@ -2034,8 +2034,7 @@ static void dw_mci_tasklet_func(unsigned* delayed. Allowing the transfer to take place * avoids races and keeps things simple. */ -if ((err != -ETIMEDOUT ) && - (cmd->opcode ==MMC_SEND_TUNING_BLOCK )) { +if (err != -ETIMEDOUT ) { state =STATE_SENDING_DATA ;continue ; }
Greg Kroah-Hartman
maintainerPATCH 84/131 mmc: meson-mx-sdio: Fix misuse of GENMASK macro
In reply to Greg Kroah-HartmanFrom: Joe Perches <[email protected]>
commit 665e985c2f41bebc3e6cee7e04c36a44afbc58f7 upstream.
Arguments are supposed to be ordered high then low.
Meson8 and Meson8b SoCs")
--- drivers/mmc/host/meson-mx-sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/meson-mx-sdio.c +1 -1
@@ -73,7 +73,7 @@#define MESON_MX_SDIO_IRQC_IF_CONFIG_MASK GENMASK(7, 6)#define MESON_MX_SDIO_IRQC_FORCE_DATA_CLK BIT(8)#define MESON_MX_SDIO_IRQC_FORCE_DATA_CMD BIT(9) -#define MESON_MX_SDIO_IRQC_FORCE_DATA_DAT_MASK GENMASK(10, 13) +#define MESON_MX_SDIO_IRQC_FORCE_DATA_DAT_MASK GENMASK(13, 10)#define MESON_MX_SDIO_IRQC_SOFT_RESET BIT(15)#define MESON_MX_SDIO_IRQC_FORCE_HALT BIT(30)#define MESON_MX_SDIO_IRQC_HALT_HOLE BIT(31)
Greg Kroah-Hartman
maintainerPATCH 85/131 mmc: host: sdhci-sprd: Fix the missing pm_runtime_put_noidle()
In reply to Greg Kroah-HartmanFrom: Baolin Wang <[email protected]>
commit fc62113b32c95906b3ea8ba42e91014c7d0c6fa6 upstream.
When the SD host controller tries to probe again due to the derferred probe mechanism, it will always keep the SD host device as runtime resume state due to missing the runtime put operation in error path last time.
Thus add the pm_runtime_put_noidle() in error path to make the PM runtime counter balance, which can make the SD host device's PM runtime work well.
--- drivers/mmc/host/sdhci-sprd.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-sprd.c +1 -0
@@ -405,6 +405,7 @@ err_cleanup_host:sdhci_cleanup_host (host); pm_runtime_disable: +pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 86/131 mmc: mmc_spi: Enable stable writes
In reply to Greg Kroah-HartmanFrom: Andreas Koop <[email protected]>
commit 3a6ffb3c8c3274a39dc8f2514526e645c5d21753 upstream.
While using the mmc_spi driver occasionally errors like this popped up:
mmcblk0: error -84 transferring data end_request: I/O error, dev mmcblk0, sector 581756
I looked on the Internet for occurrences of the same problem and came across a helpful post [1]. It includes source code to reproduce the bug. There is also an analysis about the cause. During transmission data in the supplied buffer is being modified. Thus the previously calculated checksum is not correct anymore.
After some digging I found out that device drivers are supposed to report they need stable writes. To fix this I set the appropriate flag at queue initialization if CRC checksumming is enabled for that SPI host.
[1]
https://groups.google.com/forum/#!msg/sim1/gLlzWeXGFr8/KevXinUXfc8J
--- drivers/mmc/core/queue.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/core/queue.c +5 -0
@@ -10,6 +10,7 @@#include <linux/kthread.h> #include <linux/scatterlist.h> #include <linux/dma-mapping.h> +#include <linux/backing-dev.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h>
@@ -430,6 +431,10 @@ int mmc_init_queue(struct mmc_queue *mq, goto free_tag_set; } +if (mmc_host_is_spi (host) && host->use_spi_crc) + mq->queue->backing_dev_info->capabilities |= +BDI_CAP_STABLE_WRITES ; + mq->queue->queuedata = mq;blk_queue_rq_timeout (mq->queue,60 *HZ );
Greg Kroah-Hartman
maintainerPATCH 87/131 gpiolib: Preserve desc->flags when setting state
In reply to Greg Kroah-HartmanFrom: Chris Packham <[email protected]>
commit d95da993383c78f7efd25957ba3af23af4b1c613 upstream.
desc->flags may already have values set by of_gpiochip_add() so make sure that this isn't undone when setting the initial direction.
--- drivers/gpio/gpiolib.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/gpio/gpiolib.c +11 -6
@@ -1392,12 +1392,17 @@ int gpiochip_add_data_with_key(struct gpfor (i =0 ; i < chip->ngpio; i++) {struct gpio_desc *desc = &gdev->descs[i]; -if (chip->get_direction &&gpiochip_line_is_valid (chip, i)) - desc->flags = !chip->get_direction (chip, i) ? - (1 <<FLAG_IS_OUT ) :0 ; -else - desc->flags = !chip->direction_input ? - (1 <<FLAG_IS_OUT ) :0 ; +if (chip->get_direction &&gpiochip_line_is_valid (chip, i)) { +if (!chip->get_direction (chip, i)) +set_bit (FLAG_IS_OUT , &desc->flags); +else +clear_bit (FLAG_IS_OUT , &desc->flags); + }else { +if (!chip->direction_input) +set_bit (FLAG_IS_OUT , &desc->flags); +else +clear_bit (FLAG_IS_OUT , &desc->flags); + } }acpi_gpiochip_add (chip);
Greg Kroah-Hartman
maintainerPATCH 88/131 gpio: dont WARN() on NULL descs if gpiolib is disabled
In reply to Greg Kroah-HartmanFrom: Bartosz Golaszewski <[email protected]>
commit ffe0bbabb0cffceceae07484fde1ec2a63b1537c upstream.
If gpiolib is disabled, we use the inline stubs from gpio/consumer.h instead of regular definitions of GPIO API. The stubs for 'optional' variants of gpiod_get routines return NULL in this case as if the relevant GPIO wasn't found. This is correct so far.
Calling other (non-gpio_get) stubs from this header triggers a warning because the GPIO descriptor couldn't have been requested. The warning however is unconditional (WARN_ON(1)) and is emitted even if the passed descriptor pointer is NULL.
We don't want to force the users of 'optional' gpio_get to check the returned pointer before calling e.g. gpiod_set_value() so let's only WARN on non-NULL descriptors.
--- include/linux/gpio/consumer.h | 64 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
include/linux/gpio/consumer.h +32 -32
@@ -247,7 +247,7 @@ static inline void gpiod_put(struct gpiomight_sleep ();/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc); } static inline void devm_gpiod_unhinge(struct device *dev,
@@ -256,7 +256,7 @@ static inline void devm_gpiod_unhinge(stmight_sleep ();/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc); }static inline void gpiod_put_array (struct gpio_descs *descs)
@@ -264,7 +264,7 @@ static inline void gpiod_put_array(strucmight_sleep ();/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (descs); } static inline struct gpio_desc *__must_check
@@ -317,7 +317,7 @@ static inline void devm_gpiod_put(structmight_sleep ();/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc); } static inline void devm_gpiod_put_array(struct device *dev,
@@ -326,32 +326,32 @@ static inline void devm_gpiod_put_array(might_sleep ();/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (descs); }static inline int gpiod_get_direction (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -ENOSYS ; }static inline int gpiod_direction_input (struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -ENOSYS ; }static inline int gpiod_direction_output (struct gpio_desc *desc,int value) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -ENOSYS ; }static inline int gpiod_direction_output_raw (struct gpio_desc *desc,int value) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -ENOSYS ; }
@@ -359,7 +359,7 @@ static inline int gpiod_direction_outputstatic inline int gpiod_get_value (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return 0 ; } static inline int gpiod_get_array_value(unsigned int array_size,
@@ -368,13 +368,13 @@ static inline int gpiod_get_array_value( unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline void gpiod_set_value (struct gpio_desc *desc,int value) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc); } static inline int gpiod_set_array_value(unsigned int array_size, struct gpio_desc **desc_array,
@@ -382,13 +382,13 @@ static inline int gpiod_set_array_value( unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline int gpiod_get_raw_value (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return 0 ; } static inline int gpiod_get_raw_array_value(unsigned int array_size,
@@ -397,13 +397,13 @@ static inline int gpiod_get_raw_array_va unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline void gpiod_set_raw_value (struct gpio_desc *desc,int value) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc); } static inline int gpiod_set_raw_array_value(unsigned int array_size, struct gpio_desc **desc_array,
@@ -411,14 +411,14 @@ static inline int gpiod_set_raw_array_va unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline int gpiod_get_value_cansleep (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return 0 ; } static inline int gpiod_get_array_value_cansleep(unsigned int array_size,
@@ -427,13 +427,13 @@ static inline int gpiod_get_array_value_ unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline void gpiod_set_value_cansleep (struct gpio_desc *desc,int value) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc); } static inline int gpiod_set_array_value_cansleep(unsigned int array_size, struct gpio_desc **desc_array,
@@ -441,13 +441,13 @@ static inline int gpiod_set_array_value_ unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline int gpiod_get_raw_value_cansleep (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return 0 ; } static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size,
@@ -456,14 +456,14 @@ static inline int gpiod_get_raw_array_va unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline void gpiod_set_raw_value_cansleep (struct gpio_desc *desc,int value) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc); } static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, struct gpio_desc **desc_array,
@@ -471,41 +471,41 @@ static inline int gpiod_set_raw_array_va unsigned long *value_bitmap) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc_array);return 0 ; }static inline int gpiod_set_debounce (struct gpio_desc *desc,unsigned debounce) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -ENOSYS ; }static inline int gpiod_set_transitory (struct gpio_desc *desc,bool transitory) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -ENOSYS ; }static inline int gpiod_is_active_low (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return 0 ; }static inline int gpiod_cansleep (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return 0 ; }static inline int gpiod_to_irq (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -EINVAL ; }
@@ -513,7 +513,7 @@ static inline int gpiod_set_consumer_nam const char *name) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -EINVAL ; }
@@ -525,7 +525,7 @@ static inline struct gpio_desc *gpio_to_static inline int desc_to_gpio (const struct gpio_desc *desc) {/* GPIO can never have been requested */ -WARN_ON (1 ); +WARN_ON (desc);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 89/131 gpiolib: fix incorrect IRQ requesting of an active-low lineevent
In reply to Greg Kroah-HartmanFrom: Michael Wu <[email protected]>
commit 223ecaf140b1dd1c1d2a1a1d96281efc5c906984 upstream.
When a pin is active-low, logical trigger edge should be inverted to match the same interrupt opportunity.
For example, a button pushed triggers falling edge in ACTIVE_HIGH case; in ACTIVE_LOW case, the button pushed triggers rising edge. For user space the IRQ requesting doesn't need to do any modification except to configuring GPIOHANDLE_REQUEST_ACTIVE_LOW.
For example, we want to catch the event when the button is pushed. The button on the original board drives level to be low when it is pushed, and drives level to be high when it is released.
In user space we can do:
req.handleflags = GPIOHANDLE_REQUEST_INPUT;
req.eventflags = GPIOEVENT_REQUEST_FALLING_EDGE;
while (1) {
read(fd, &dat, sizeof(dat));
if (dat.id == GPIOEVENT_EVENT_FALLING_EDGE)
printf("button pushed\n");
}Run the same logic on another board which the polarity of the button is inverted; it drives level to be high when pushed, and level to be low when released. For this inversion we add flag GPIOHANDLE_REQUEST_ACTIVE_LOW:
req.handleflags = GPIOHANDLE_REQUEST_INPUT | GPIOHANDLE_REQUEST_ACTIVE_LOW; req.eventflags = GPIOEVENT_REQUEST_FALLING_EDGE;
At the result, there are no any events caught when the button is pushed. By the way, button releasing will emit a "falling" event. The timing of "falling" catching is not expected.
--- drivers/gpio/gpiolib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib.c +4 -2
@@ -956,9 +956,11 @@ static int lineevent_create(struct gpio_ }if (eflags &GPIOEVENT_REQUEST_RISING_EDGE ) - irqflags |=IRQF_TRIGGER_RISING ; + irqflags |=test_bit (FLAG_ACTIVE_LOW , &desc->flags) ? +IRQF_TRIGGER_FALLING :IRQF_TRIGGER_RISING ;if (eflags &GPIOEVENT_REQUEST_FALLING_EDGE ) - irqflags |=IRQF_TRIGGER_FALLING ; + irqflags |=test_bit (FLAG_ACTIVE_LOW , &desc->flags) ? +IRQF_TRIGGER_RISING :IRQF_TRIGGER_FALLING ; irqflags |=IRQF_ONESHOT ;INIT_KFIFO (le->events);
Greg Kroah-Hartman
maintainerPATCH 90/131 IB/hfi1: Fix Spectre v1 vulnerability
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
commit 6497d0a9c53df6e98b25e2b79f2295d7caa47b6e upstream.
sl is controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
Fix this by sanitizing sl before using it to index ibp->sl_to_sc.
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://lore.kernel.org/lkml/[email protected]/
--- drivers/infiniband/hw/hfi1/verbs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/hfi1/verbs.c +2 -0
@@ -54,6 +54,7 @@#include <linux/mm.h> #include <linux/vmalloc.h> #include <rdma/opa_addr.h> +#include <linux/nospec.h> #include "hfi.h" #include "common.h"
@@ -1536,6 +1537,7 @@ static int hfi1_check_ah(struct ib_devic sl =rdma_ah_get_sl (ah_attr);if (sl >=ARRAY_SIZE (ibp->sl_to_sc))return -EINVAL ; + sl =array_index_nospec (sl,ARRAY_SIZE (ibp->sl_to_sc)); sc5 = ibp->sl_to_sc[sl];if (sc_to_vlt (dd, sc5) > num_vls &&sc_to_vlt (dd, sc5) !=0xf )
Greg Kroah-Hartman
maintainerPATCH 91/131 drm/nouveau: Only release VCPI slots on mode changes
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 412e85b605315fd129a849599cf4a5a7959573a8 upstream.
Looks like a regression got introduced into nv50_mstc_atomic_check() that somehow didn't get found until now. If userspace changes crtc_state->active to false but leaves the CRTC enabled, we end up calling drm_dp_atomic_find_vcpi_slots() using the PBN calculated in asyh->dp.pbn. However, if the display is inactive we end up calculating a PBN of 0, which inadvertently causes us to have an allocation of 0.
Quoted 1 line
From there, if userspace then disables the CRTC afterwards we end up
accidentally attempting to free the VCPI twice:
WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336 drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper] RIP: 0010:drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper] Call Trace: drm_atomic_helper_check_modeset+0x3f3/0xa60 [drm_kms_helper] ? drm_atomic_check_only+0x43/0x780 [drm] drm_atomic_helper_check+0x15/0x90 [drm_kms_helper] nv50_disp_atomic_check+0x83/0x1d0 [nouveau] drm_atomic_check_only+0x54d/0x780 [drm] ? drm_atomic_set_crtc_for_connector+0xec/0x100 [drm] drm_atomic_commit+0x13/0x50 [drm] drm_atomic_helper_set_config+0x81/0x90 [drm_kms_helper] drm_mode_setcrtc+0x194/0x6a0 [drm] ? vprintk_emit+0x16a/0x230 ? drm_ioctl+0x163/0x390 [drm] ? drm_mode_getcrtc+0x180/0x180 [drm] drm_ioctl_kernel+0xaa/0xf0 [drm] drm_ioctl+0x208/0x390 [drm] ? drm_mode_getcrtc+0x180/0x180 [drm] nouveau_drm_ioctl+0x63/0xb0 [nouveau] do_vfs_ioctl+0x405/0x660 ? recalc_sigpending+0x17/0x50 ? _copy_from_user+0x37/0x60 ksys_ioctl+0x5e/0x90 ? exit_to_usermode_loop+0x92/0xe0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x59/0x190 entry_SYSCALL_64_after_hwframe+0x44/0xa9 WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336 drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper] ---[ end trace 4c395c0c51b1f88d ]---
[drm:drm_dp_atomic_release_vcpi_slots [drm_kms_helper]] *ERROR* no VCPI for [MST PORT:00000000e288eb7d] found in mst state 000000008e642070
So, fix this by doing what we probably should have done from the start: only call drm_dp_atomic_find_vcpi_slots() when crtc_state->mode_changed is set, so that VCPI allocations remain for as long as the CRTC is enabled.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +1 -1
@@ -775,7 +775,7 @@ nv50_msto_atomic_check(struct drm_encodedrm_dp_calc_pbn_mode (crtc_state->adjusted_mode.clock, connector->display_info.bpc *3 ); -if (drm_atomic_crtc_needs_modeset (crtc_state)) { +if (crtc_state->mode_changed) { slots =drm_dp_atomic_find_vcpi_slots (state, &mstm->mgr, mstc->port, asyh->dp.pbn);
Greg Kroah-Hartman
maintainerPATCH 92/131 mtd: rawnand: micron: handle on-die "ECC-off" devices correctly
In reply to Greg Kroah-HartmanFrom: Marco Felsch <[email protected]>
commit 8493b2a06fc5b77ef5c579dc32b12761f7b7a84c upstream.
Some devices are not supposed to support on-die ECC but experience shows that internal ECC machinery can actually be enabled through the "SET FEATURE (EFh)" command, even if a read of the "READ ID Parameter Tables" returns that it is not.
Currently, the driver checks the "READ ID Parameter" field directly after having enabled the feature. If the check fails it returns immediately but leaves the ECC on. When using buggy chips like MT29F2G08ABAGA and MT29F2G08ABBGA, all future read/program cycles will go through the on-die ECC, confusing the host controller which is supposed to be the one handling correction.
To address this in a common way we need to turn off the on-die ECC directly after reading the "READ ID Parameter" and before checking the "ECC status".
--- drivers/mtd/nand/raw/nand_micron.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/nand_micron.c +11 -3
@@ -390,6 +390,14 @@ static int micron_supports_on_die_ecc(st (chip->id.data[4] & MICRON_ID_INTERNAL_ECC_MASK) != 0x2)return MICRON_ON_DIE_UNSUPPORTED ; +/* +* It seems that there are devices which do not support ECC officially. +* At least the MT29F2G08ABAGA / MT29F2G08ABBGA devices supports +* enabling the ECC feature but don't reflect that to the READ_ID table. +* So we have to guarantee that we disable the ECC feature directly +* after we did the READ_ID table command. Later we can evaluate the +* ECC_ENABLE support. +*/ ret =micron_nand_on_die_ecc_setup (chip, true);if (ret)return MICRON_ON_DIE_UNSUPPORTED ;
@@ -398,13 +406,13 @@ static int micron_supports_on_die_ecc(stif (ret)return MICRON_ON_DIE_UNSUPPORTED ; -if (!(id[4 ] &MICRON_ID_ECC_ENABLED )) -return MICRON_ON_DIE_UNSUPPORTED ; - ret =micron_nand_on_die_ecc_setup (chip, false);if (ret)return MICRON_ON_DIE_UNSUPPORTED ; +if (!(id[4 ] &MICRON_ID_ECC_ENABLED )) +return MICRON_ON_DIE_UNSUPPORTED ; + ret =nand_readid_op (chip,0 , id,sizeof (id));if (ret)return MICRON_ON_DIE_UNSUPPORTED ;
Greg Kroah-Hartman
maintainerPATCH 93/131 eeprom: at24: make spd world-readable again
In reply to Greg Kroah-HartmanFrom: Jean Delvare <[email protected]>
commit 25e5ef302c24a6fead369c0cfe88c073d7b97ca8 upstream.
The integration of the at24 driver into the nvmem framework broke the world-readability of spd EEPROMs. Fix it.
--- drivers/misc/eeprom/at24.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/eeprom/at24.c +1 -1
@@ -719,7 +719,7 @@ static int at24_probe(struct i2c_client nvmem_config.name =dev_name (dev); nvmem_config.dev = dev; nvmem_config.read_only = !writable; - nvmem_config.root_only = true; + nvmem_config.root_only = !(flags &AT24_FLAG_IRUGO ); nvmem_config.owner =THIS_MODULE ; nvmem_config.compat = true; nvmem_config.base_dev = dev;
Greg Kroah-Hartman
maintainerPATCH 94/131 i2c: iproc: Fix i2c master read more than 63 bytes
In reply to Greg Kroah-HartmanFrom: Rayagonda Kokatanur <[email protected]>
commit fd01eecdf9591453177d7b06faaabef8c300114a upstream.
Use SMBUS_MASTER_DATA_READ.MASTER_RD_STATUS bit to check for RX FIFO empty condition because SMBUS_MASTER_FIFO_CONTROL.MASTER_RX_PKT_COUNT is not updated for read >= 64 bytes. This fixes the issue when trying to read from the I2C slave more than 63 bytes.
--- drivers/i2c/busses/i2c-bcm-iproc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-bcm-iproc.c +6 -4
@@ -403,16 +403,18 @@ static bool bcm_iproc_i2c_slave_isr(strustatic void bcm_iproc_i2c_read_valid_bytes (struct bcm_iproc_i2c_dev *iproc_i2c) {struct i2c_msg *msg = iproc_i2c->msg; +uint32_t val;/* Read valid data from RX FIFO */ while (iproc_i2c->rx_bytes < msg->len) { -if (!((iproc_i2c_rd_reg (iproc_i2c,M_FIFO_CTRL_OFFSET ) >>M_FIFO_RX_CNT_SHIFT ) - &M_FIFO_RX_CNT_MASK )) + val =iproc_i2c_rd_reg (iproc_i2c,M_RX_OFFSET ); + +/* rx fifo empty */ +if (!((val >>M_RX_STATUS_SHIFT ) &M_RX_STATUS_MASK ))break ; msg->buf[iproc_i2c->rx_bytes] = - (iproc_i2c_rd_reg (iproc_i2c,M_RX_OFFSET ) >> -M_RX_DATA_SHIFT ) &M_RX_DATA_MASK ; + (val >>M_RX_DATA_SHIFT ) &M_RX_DATA_MASK ; iproc_i2c->rx_bytes++; } }
Greg Kroah-Hartman
maintainerPATCH 95/131 i2c: at91: disable TXRDY interrupt after sending data
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
commit d12e3aae160fb26b534c4496b211d6e60a5179ed upstream.
Driver was not disabling TXRDY interrupt after last TX byte. This caused interrupt storm until transfer timeouts for slow or broken device on the bus. The patch fixes the interrupt storm on my SAMA5D2-based board.
--- drivers/i2c/busses/i2c-at91-master.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-at91-master.c +5 -4
@@ -122,9 +122,11 @@ static void at91_twi_write_next_byte(strwriteb_relaxed (*dev->buf, dev->base +AT91_TWI_THR );/* send stop when last byte has been written */ -if (--dev->buf_len ==0 ) +if (--dev->buf_len ==0 ) {if (!dev->use_alt_cmd)at91_twi_write (dev,AT91_TWI_CR ,AT91_TWI_STOP ); +at91_twi_write (dev,AT91_TWI_IDR ,AT91_TWI_TXRDY ); + }dev_dbg (dev->dev,"wrote 0x%x, to go %zu\n" , *dev->buf, dev->buf_len);
@@ -542,9 +544,8 @@ static int at91_do_twi_transfer(struct a }else {at91_twi_write_next_byte (dev);at91_twi_write (dev,AT91_TWI_IER , -AT91_TWI_TXCOMP | -AT91_TWI_NACK | -AT91_TWI_TXRDY ); +AT91_TWI_TXCOMP |AT91_TWI_NACK | + (dev->buf_len ?AT91_TWI_TXRDY :0 )); } }
Greg Kroah-Hartman
maintainerPATCH 96/131 i2c: at91: fix clk_offset for sama5d2
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
commit b1ac6704493fa14b5dc19eb6b69a73932361a131 upstream.
In SAMA5D2 datasheet, TWIHS_CWGR register rescription mentions clock offset of 3 cycles (compared to 4 in eg. SAMA5D3).
--- drivers/i2c/busses/i2c-at91-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-at91-core.c +1 -1
@@ -142,7 +142,7 @@ static struct at91_twi_pdata sama5d4_constatic struct at91_twi_pdata sama5d2_config = { .clk_max_div =7 , - .clk_offset =4 , + .clk_offset =3 , .has_unre_flag = true, .has_alt_cmd = true, .has_hold_field = true,
Greg Kroah-Hartman
maintainerPATCH 97/131 powerpc/kasan: fix early boot failure on PPC32
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit d7e23b887f67178c4f840781be7a6aa6aeb52ab1 upstream.
Due to commit 4a6d8cf90017 ("powerpc/mm: don't use pte_alloc_kernel() until slab is available on PPC32"), pte_alloc_kernel() cannot be used during early KASAN init.
Fix it by using memblock_alloc() instead.
--- arch/powerpc/mm/kasan/kasan_init_32.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/mm/kasan/kasan_init_32.c +5 -2
@@ -21,7 +21,7 @@ static void kasan_populate_pte(pte_t *pt__set_pte_at (&init_mm, va, ptep,pfn_pte (PHYS_PFN (pa), prot),0 ); } -static int kasan_init_shadow_page_tables (unsigned long k_start,unsigned long k_end) +static int __ref kasan_init_shadow_page_tables (unsigned long k_start,unsigned long k_end) {pmd_t *pmd;unsigned long k_cur, k_next;
@@ -35,7 +35,10 @@ static int kasan_init_shadow_page_tablesif ((void *)pmd_page_vaddr (*pmd) != kasan_early_shadow_pte)continue ; - new =pte_alloc_one_kernel (&init_mm); +if (slab_is_available ()) + new =pte_alloc_one_kernel (&init_mm); +else + new =memblock_alloc (PTE_FRAG_SIZE ,PTE_FRAG_SIZE );if (!new)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 98/131 selinux: fix memory leak in policydb_init()
In reply to Greg Kroah-HartmanFrom: Ondrej Mosnacek <[email protected]>
commit 45385237f65aeee73641f1ef737d7273905a233f upstream.
Since roles_init() adds some entries to the role hash table, we need to destroy also its keys/values on error, otherwise we get a memory leak in the error path.
--- security/selinux/ss/policydb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
security/selinux/ss/policydb.c +5 -1
@@ -272,6 +272,8 @@ static int rangetr_cmp(struct hashtab *hreturn v; } +static int (*destroy_f[SYM_NUM ]) (void *key,void *datum,void *datap); +/* * Initialize a policy database structure. */
@@ -319,8 +321,10 @@ static int policydb_init(struct policydb out:hashtab_destroy (p->filename_trans);hashtab_destroy (p->range_tr); -for (i =0 ; i <SYM_NUM ; i++) +for (i =0 ; i <SYM_NUM ; i++) { +hashtab_map (p->symtab[i].table, destroy_f[i],NULL );hashtab_destroy (p->symtab[i].table); + }return rc; }
Greg Kroah-Hartman
maintainerPATCH 99/131 ALSA: hda: Fix 1-minute detection delay when i915 module is not available
In reply to Greg Kroah-HartmanFrom: Samuel Thibault <[email protected]>
commit 74bf71ed792ab0f64631cc65ccdb54c356c36d45 upstream.
Distribution installation images such as Debian include different sets of modules which can be downloaded dynamically. Such images may notably include the hda sound modules but not the i915 DRM module, even if the latter was enabled at build time, as reported on
https://bugs.debian.org/931507
In such a case hdac_i915 would be linked in and try to load the i915 module, fail since it is not there, but still wait for a whole minute before giving up binding with it.
This fixes such as case by only waiting for the binding if the module was properly loaded (or module support is disabled, in which case i915 is already compiled-in anyway).
--- sound/hda/hdac_i915.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/hda/hdac_i915.c +6 -4
@@ -136,10 +136,12 @@ int snd_hdac_i915_init(struct hdac_bus *if (!acomp)return -ENODEV ;if (!acomp->ops) { -request_module ("i915" ); -/* 60s timeout */ -wait_for_completion_timeout (&bind_complete, -msecs_to_jiffies (60 *1000 )); +if (!IS_ENABLED (CONFIG_MODULES ) || + !request_module ("i915" )) { +/* 60s timeout */ +wait_for_completion_timeout (&bind_complete, +msecs_to_jiffies (60 *1000 )); + } }if (!acomp->ops) {dev_info (bus->dev,"couldn't bind with audio component\n" );
Greg Kroah-Hartman
maintainerPATCH 100/131 mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker
In reply to Greg Kroah-HartmanFrom: Yang Shi <[email protected]>
commit fa1e512fac717f34e7c12d7a384c46e90a647392 upstream.
Shakeel Butt reported premature oom on kernel with "cgroup_disable=memory" since mem_cgroup_is_root() returns false even though memcg is actually NULL. The drop_caches is also broken.
It is because commit aeed1d325d42 ("mm/vmscan.c: generalize shrink_slab() calls in shrink_node()") removed the !memcg check before !mem_cgroup_is_root(). And, surprisingly root memcg is allocated even though memory cgroup is disabled by kernel boot parameter.
Add mem_cgroup_disabled() check to make reclaimer work as expected.
--- mm/vmscan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
mm/vmscan.c +8 -1
@@ -684,7 +684,14 @@ static unsigned long shrink_slab(gfp_t gunsigned long ret, freed =0 ;struct shrinker *shrinker; -if (!mem_cgroup_is_root (memcg)) +/* +* The root memcg might be allocated even though memcg is disabled +* via "cgroup_disable=memory" boot parameter. This could make +* mem_cgroup_is_root() return false, then just run memcg slab +* shrink, but skip global shrink. This may result in premature +* oom. +*/ +if (!mem_cgroup_disabled () && !mem_cgroup_is_root (memcg))return shrink_slab_memcg (gfp_mask, nid, memcg, priority);if (!down_read_trylock (&shrinker_rwsem))
Greg Kroah-Hartman
maintainerPATCH 101/131 mm: migrate: fix reference check race between __find_get_block() and migration
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit ebdf4de5642fb6580b0763158b6b4b791c4d6a4d upstream.
buffer_migrate_page_norefs() can race with bh users in the following way:
CPU1 CPU2buffer_migrate_page_norefs()
buffer_migrate_lock_buffers()
checks bh refs
spin_unlock(&mapping->private_lock)
__find_get_block()
spin_lock(&mapping->private_lock)
grab bh ref
spin_unlock(&mapping->private_lock)move page do bh work
This can result in various issues like lost updates to buffers (i.e. metadata corruption) or use after free issues for the old page.
This patch closes the race by holding mapping->private_lock while the mapping is being moved to a new page. Ordinarily, a reference can be taken outside of the private_lock using the per-cpu BH LRU but the references are checked and the LRU invalidated if necessary. The private_lock is held once the references are known so the buffer lookup slow path will spin on the private_lock. Between the page lock and private_lock, it should be impossible for other references to be acquired and updates to happen during the migration.
A user had reported data corruption issues on a distribution kernel with a similar page migration implementation as mainline. The data corruption could not be reproduced with this patch applied. A small number of migration-intensive tests were run and no performance problems were noted.
--- mm/migrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/migrate.c +3 -1
@@ -771,12 +771,12 @@ recheck_buffers: } bh = bh->b_this_page; }while (bh != head); -spin_unlock (&mapping->private_lock);if (busy) {if (invalidated) { rc = -EAGAIN ; goto unlock_buffers; } +spin_unlock (&mapping->private_lock);invalidate_bh_lrus (); invalidated = true; goto recheck_buffers;
@@ -809,6 +809,8 @@ recheck_buffers: rc =MIGRATEPAGE_SUCCESS ; unlock_buffers: +if (check_refs) +spin_unlock (&mapping->private_lock); bh = head; do { unlock_buffer(bh);
Greg Kroah-Hartman
maintainerPATCH 102/131 mm: compaction: avoid 100% CPU usage during compaction when a task is killed
In reply to Greg Kroah-HartmanFrom: Mel Gorman <[email protected]>
commit 670105a25608affe01cb0ccdc2a1f4bd2327172b upstream.
"howaboutsynergy" reported via kernel buzilla number 204165 that compact_zone_order was consuming 100% CPU during a stress test for prolonged periods of time. Specifically the following command, which should exit in 10 seconds, was taking an excessive time to finish while the CPU was pegged at 100%.
stress -m 220 --vm-bytes 1000000000 --timeout 10
Tracing indicated a pattern as follows
stress-3923 [007] 519.106208: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106212: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106216: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106219: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106223: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106227: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106231: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106235: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106238: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
stress-3923 [007] 519.106242: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0Note that compaction is entered in rapid succession while scanning and isolating nothing. The problem is that when a task that is compacting receives a fatal signal, it retries indefinitely instead of exiting while making no progress as a fatal signal is pending.
It's not easy to trigger this condition although enabling zswap helps on the basis that the timing is altered. A very small window has to be hit for the problem to occur (signal delivered while compacting and isolating a PFN for migration that is not aligned to SWAP_CLUSTER_MAX).
This was reproduced locally -- 16G single socket system, 8G swap, 30% zswap configured, vm-bytes 22000000000 using Colin Kings stress-ng implementation from github running in a loop until the problem hits). Tracing recorded the problem occurring almost 200K times in a short window. With this patch, the problem hit 4 times but the task existed normally instead of consuming CPU.
This problem has existed for some time but it was made worse by commit cf66f0700c8f ("mm, compaction: do not consider a need to reschedule as contention"). Before that commit, if the same condition was hit then locks would be quickly contended and compaction would exit that way.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204165
--- mm/compaction.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
mm/compaction.c +7 -4
@@ -842,13 +842,15 @@ isolate_migratepages_block(struct compac/* * Periodically drop the lock (if held) regardless of its -* contention, to give chance to IRQs. Abort async compaction -* if contended. +* contention, to give chance to IRQs. Abort completely if +* a fatal signal is pending. */ if (!(low_pfn %SWAP_CLUSTER_MAX ) &&compact_unlock_should_abort (&pgdat->lru_lock, - flags, &locked, cc)) -break ; + flags, &locked, cc)) { + low_pfn =0 ; + goto fatal_pending; + }if (!pfn_valid_within (low_pfn)) goto isolate_fail;
@@ -1060,6 +1062,7 @@ isolate_abort:trace_mm_compaction_isolate_migratepages (start_pfn, low_pfn, nr_scanned, nr_isolated); +fatal_pending: cc->total_migrate_scanned += nr_scanned;if (nr_isolated)count_compact_events (COMPACTISOLATED , nr_isolated);
Greg Kroah-Hartman
maintainerPATCH 103/131 ubsan: build ubsan.c more conservatively
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit af700eaed0564d5d3963a7a51cb0843629d7fe3d upstream.
objtool points out several conditions that it does not like, depending on the combination with other configuration options and compiler variants:
stack protector:
lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0xbf: call to __stack_chk_fail() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0xbe: call to __stack_chk_fail() with UACCESS enabled
stackleak plugin:
lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x4a: call to stackleak_track_stack() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x4a: call to stackleak_track_stack() with UACCESS enabled
kasan:
lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x25: call to memcpy() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x25: call to memcpy() with UACCESS enabled
The stackleak and kasan options just need to be disabled for this file as we do for other files already. For the stack protector, we already attempt to disable it, but this fails on clang because the check is mixed with the gcc specific -fno-conserve-stack option. According to Andrey Ryabinin, that option is not even needed, dropping it here fixes the stackprotector issue.
--- lib/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/Makefile +2 -1
@@ -278,7 +278,8 @@ obj-$(CONFIG_UCS2_STRING) += ucs2_string obj-$(CONFIG_UBSAN) += ubsan.o UBSAN_SANITIZE_ubsan.o := n -CFLAGS_ubsan.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) +KASAN_SANITIZE_ubsan.o := n +CFLAGS_ubsan.o := $(call cc-option, -fno-stack-protector) $(DISABLE_STACKLEAK_PLUGIN) obj-$(CONFIG_SBITMAP) += sbitmap.o
Greg Kroah-Hartman
maintainerPATCH 104/131 mm/migrate.c: initialize pud_entry in migrate_vma()
In reply to Greg Kroah-HartmanFrom: Ralph Campbell <[email protected]>
commit 7b358c6f12dc82364f6d317f8c8f1d794adbc3f5 upstream.
When CONFIG_MIGRATE_VMA_HELPER is enabled, migrate_vma() calls migrate_vma_collect() which initializes a struct mm_walk but didn't initialize mm_walk.pud_entry. (Found by code inspection) Use a C structure initialization to make sure it is set to NULL.
--- mm/migrate.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
mm/migrate.c +7 -10
@@ -2347,16 +2347,13 @@ next:static void migrate_vma_collect (struct migrate_vma *migrate) {struct mmu_notifier_range range; -struct mm_walk mm_walk; - - mm_walk.pmd_entry = migrate_vma_collect_pmd; - mm_walk.pte_entry =NULL ; - mm_walk.pte_hole = migrate_vma_collect_hole; - mm_walk.hugetlb_entry =NULL ; - mm_walk.test_walk =NULL ; - mm_walk.vma = migrate->vma; - mm_walk.mm = migrate->vma->vm_mm; - mm_walk.private = migrate; +struct mm_walk mm_walk = { + .pmd_entry = migrate_vma_collect_pmd, + .pte_hole = migrate_vma_collect_hole, + .vma = migrate->vma, + .mm = migrate->vma->vm_mm, + .private = migrate, + }; mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm_walk.mm, migrate->start,
Greg Kroah-Hartman
maintainerPATCH 105/131 loop: Fix mount(2) failure due to race with LOOP_SET_FD
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 89e524c04fa966330e2e80ab2bc50b9944c5847a upstream.
Commit 33ec3e53e7b1 ("loop: Don't change loop device under exclusive opener") made LOOP_SET_FD ioctl acquire exclusive block device reference while it updates loop device binding. However this can make perfectly valid mount(2) fail with EBUSY due to racing LOOP_SET_FD holding temporarily the exclusive bdev reference in cases like this:
for i in {a..z}{a..z}; do
dd if=/dev/zero of=$i.image bs=1k count=0 seek=1024
mkfs.ext2 $i.image
mkdir mnt$idone
echo "Run"
for i in {a..z}{a..z}; do
mount -o loop -t ext2 $i.image mnt$i &
done
Fix the problem by not getting full exclusive bdev reference in LOOP_SET_FD but instead just mark the bdev as being claimed while we update the binding information. This just blocks new exclusive openers instead of failing them with EBUSY thus fixing the problem.
--- drivers/block/loop.c | 16 +++++---- fs/block_dev.c | 83 +++++++++++++++++++++++++++++++++++---------------- include/linux/fs.h | 6 +++ 3 files changed, 73 insertions(+), 32 deletions(-)
drivers/block/loop.c +9 -7
@@ -932,6 +932,7 @@ static int loop_set_fd(struct loop_devicstruct file *file;struct inode *inode;struct address_space *mapping; +struct block_device *claimed_bdev =NULL ;int lo_flags =0 ;int error;loff_t size;
@@ -950,10 +951,11 @@ static int loop_set_fd(struct loop_devic* here to avoid changing device under exclusive owner. */ if (!(mode &FMODE_EXCL )) { -bdgrab (bdev); - error =blkdev_get (bdev, mode |FMODE_EXCL , loop_set_fd); -if (error) + claimed_bdev =bd_start_claiming (bdev, loop_set_fd); +if (IS_ERR (claimed_bdev)) { + error =PTR_ERR (claimed_bdev); goto out_putf; + } } error =mutex_lock_killable (&loop_ctl_mutex);
@@ -1023,15 +1025,15 @@ static int loop_set_fd(struct loop_devicmutex_unlock (&loop_ctl_mutex);if (partscan)loop_reread_partitions (lo, bdev); -if (!(mode &FMODE_EXCL )) -blkdev_put (bdev, mode |FMODE_EXCL ); +if (claimed_bdev) +bd_abort_claiming (bdev, claimed_bdev, loop_set_fd);return 0 ; out_unlock:mutex_unlock (&loop_ctl_mutex); out_bdev: -if (!(mode &FMODE_EXCL )) -blkdev_put (bdev, mode |FMODE_EXCL ); +if (claimed_bdev) +bd_abort_claiming (bdev, claimed_bdev, loop_set_fd); out_putf:fput (file); out:
fs/block_dev.c +58 -25
101 lines not on this page · raw message
include/linux/fs.h +6 -0
@@ -2615,6 +2615,12 @@ extern struct block_device *blkdev_get_b void *holder);extern struct block_device *blkdev_get_by_dev (dev_t dev,fmode_t mode,void *holder); +extern struct block_device *bd_start_claiming (struct block_device *bdev, +void *holder); +extern void bd_finish_claiming (struct block_device *bdev, +struct block_device *whole,void *holder); +extern void bd_abort_claiming (struct block_device *bdev, +struct block_device *whole,void *holder);extern void blkdev_put (struct block_device *bdev,fmode_t mode);extern int __blkdev_reread_part (struct block_device *bdev);extern int blkdev_reread_part (struct block_device *bdev);
Greg Kroah-Hartman
maintainerPATCH 106/131 s390/dasd: fix endless loop after read unit address configuration
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
commit 41995342b40c418a47603e1321256d2c4a2ed0fb upstream.
After getting a storage server event that causes the DASD device driver to update its unit address configuration during a device shutdown there is the possibility of an endless loop in the device driver.
In the system log there will be ongoing DASD error messages with RC: -19.
The reason is that the loop starting the ruac request only terminates when the retry counter is decreased to 0. But in the sleep_on function there are early exit paths that do not decrease the retry counter.
Prevent an endless loop by handling those cases separately.
Remove the unnecessary do..while loop since the sleep_on function takes care of retries by itself.
--- drivers/s390/block/dasd_alias.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/s390/block/dasd_alias.c +16 -6
@@ -383,6 +383,20 @@ suborder_not_supported(struct dasd_ccw_rchar msg_format;char msg_no; +/* +* intrc values ENODEV, ENOLINK and EPERM +* will be optained from sleep_on to indicate that no +* IO operation can be started +*/ +if (cqr->intrc == -ENODEV ) +return 1 ; + +if (cqr->intrc == -ENOLINK ) +return 1 ; + +if (cqr->intrc == -EPERM ) +return 1 ; + sense =dasd_get_sense (&cqr->irb);if (!sense)return 0 ;
@@ -447,12 +461,8 @@ static int read_unit_address_configurati lcu->flags &= ~NEED_UAC_UPDATE ;spin_unlock_irqrestore (&lcu->lock, flags); -do { - rc =dasd_sleep_on (cqr); -if (rc &&suborder_not_supported (cqr)) -return -EOPNOTSUPP ; - }while (rc && (cqr->retries >0 )); -if (rc) { + rc =dasd_sleep_on (cqr); +if (rc && !suborder_not_supported (cqr)) {spin_lock_irqsave (&lcu->lock, flags); lcu->flags |=NEED_UAC_UPDATE ;spin_unlock_irqrestore (&lcu->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 107/131 cgroup: kselftest: relax fs_spec checks
In reply to Greg Kroah-HartmanFrom: Chris Down <[email protected]>
commit b59b1baab789eacdde809135542e3d4f256f6878 upstream.
On my laptop most memcg kselftests were being skipped because it claimed cgroup v2 hierarchy wasn't mounted, but this isn't correct. Instead, it seems current systemd HEAD mounts it with the name "cgroup2" instead of "cgroup":
% grep cgroup /proc/mounts
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
I can't think of a reason to need to check fs_spec explicitly since it's arbitrary, so we can just rely on fs_vfstype.
After these changes, make TARGETS=cgroup kselftest actually runs the cgroup v2 tests in more cases.
--- tools/testing/selftests/cgroup/cgroup_util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/cgroup/cgroup_util.c +1 -2
@@ -191,8 +191,7 @@ int cg_find_unified_root(char *root, sizstrtok (NULL , delim);strtok (NULL , delim); -if (strcmp (fs,"cgroup" ) ==0 && -strcmp (type,"cgroup2" ) ==0 ) { +if (strcmp (type,"cgroup2" ) ==0 ) {strncpy (root, mount, len);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 108/131 parisc: Add archclean Makefile target
In reply to Greg Kroah-HartmanFrom: James Bottomley <[email protected]>
commit f2c5ed0dd5004c2cff5c0e3d430a107576fcc17f upstream.
Apparently we don't have an archclean target in our arch/parisc/Makefile, so files in there never get cleaned out by make mrproper. This, in turn means that the sizes.h file in arch/parisc/boot/compressed never gets removed and worse, when you transition to an O=build/parisc[64] build model it overrides the generated file. The upshot being my bzImage was building with a SZ_end that was too small.
I fixed it by making mrproper clean everything.
--- arch/parisc/Makefile | 3 +++ arch/parisc/boot/compressed/Makefile | 1 + 2 files changed, 4 insertions(+)
arch/parisc/Makefile +3 -0
@@ -164,5 +164,8 @@ define archhelp @echo ' zinstall - Install compressed vmlinuz kernel' endef +archclean: + $(Q)$(MAKE) $(clean)=$(boot) + archheaders: $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
arch/parisc/boot/compressed/Makefile +1 -0
@@ -12,6 +12,7 @@ UBSAN_SANITIZE := n targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 targets += misc.o piggy.o sizes.h head.o real2.o firmware.o +targets += real2.S firmware.c KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
Greg Kroah-Hartman
maintainerPATCH 109/131 parisc: Strip debug info from kernel before creating compressed vmlinuz
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit e50beea8e7738377b4fa664078547be338038ff9 upstream.
Same as on x86-64, strip the .comment, .note and debug sections from the Linux kernel before creating the compressed image for the boot loader.
--- arch/parisc/boot/compressed/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/boot/compressed/Makefile +2 -1
@@ -56,7 +56,8 @@ $(obj)/misc.o: $(obj)/sizes.h CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER $(obj)/vmlinux.lds: $(obj)/sizes.h -$(obj)/vmlinux.bin: vmlinux +OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S +$(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy) vmlinux.bin.all-y := $(obj)/vmlinux.bin
Greg Kroah-Hartman
maintainerPATCH 110/131 parisc: Fix build of compressed kernel even with debug enabled
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 3fe6c873af2f2247544debdbe51ec29f690a2ccf upstream.
With debug info enabled (CONFIG_DEBUG_INFO=y) the resulting vmlinux may get that huge that we need to increase the start addresss for the decompression text section otherwise one will face a linker error.
--- arch/parisc/boot/compressed/vmlinux.lds.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/boot/compressed/vmlinux.lds.S +2 -2
@@ -48,8 +48,8 @@ SECTIONS *(.rodata.compressed) } - /* bootloader code and data starts behind area of extracted kernel */ - . = (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START); + /* bootloader code and data starts at least behind area of extracted kernel */ + . = MAX(ABSOLUTE(.), (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START)); /* align on next page boundary */ . = ALIGN(4096);
Greg Kroah-Hartman
maintainerPATCH 111/131 drivers/perf: arm_pmu: Fix failure path in PM notifier
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 0d7fd70f26039bd4b33444ca47f0e69ce3ae0354 upstream.
Handling of the CPU_PM_ENTER_FAILED transition in the Arm PMU PM notifier code incorrectly skips restoration of the counters. Fix the logic so that CPU_PM_ENTER_FAILED follows the same path as CPU_PM_EXIT.
--- drivers/perf/arm_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_pmu.c +1 -1
@@ -723,8 +723,8 @@ static int cpu_pm_pmu_notify(struct noticpu_pm_pmu_setup (armpmu, cmd);break ;case CPU_PM_EXIT : -cpu_pm_pmu_setup (armpmu, cmd);case CPU_PM_ENTER_FAILED : +cpu_pm_pmu_setup (armpmu, cmd); armpmu->start (armpmu);break ;default :
Greg Kroah-Hartman
maintainerPATCH 112/131 arm64: compat: Allow single-byte watchpoints on all addresses
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 849adec41203ac5837c40c2d7e08490ffdef3c2c upstream.
Commit d968d2b801d8 ("ARM: 7497/1: hw_breakpoint: allow single-byte watchpoints on all addresses") changed the validation requirements for hardware watchpoints on arch/arm/. Update our compat layer to implement the same relaxation.
--- arch/arm64/kernel/hw_breakpoint.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm64/kernel/hw_breakpoint.c +4 -3
@@ -536,13 +536,14 @@ int hw_breakpoint_arch_parse(struct perf/* Aligned */ break ;case 1 : -/* Allow single byte watchpoint. */ -if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_1 ) -break ;case 2 :/* Allow halfword watchpoints and breakpoints. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_2 )break ; +case 3 : +/* Allow single byte watchpoint. */ +if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_1 ) +break ;default :return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 113/131 arm64: cpufeature: Fix feature comparison for CTR_EL0.{CWG,ERG}
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 147b9635e6347104b91f48ca9dca61eb0fbf2a54 upstream.
If CTR_EL0.{CWG,ERG} are 0b0000 then they must be interpreted to have their architecturally maximum values, which defeats the use of FTR_HIGHER_SAFE when sanitising CPU ID registers on heterogeneous machines.
Introduce FTR_HIGHER_OR_ZERO_SAFE so that these fields effectively saturate at zero.
--- arch/arm64/include/asm/cpufeature.h | 7 ++++--- arch/arm64/kernel/cpufeature.c | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-)
arch/arm64/include/asm/cpufeature.h +4 -3
@@ -35,9 +35,10 @@*/ enum ftr_type { -FTR_EXACT ,/* Use a predefined safe value */ -FTR_LOWER_SAFE ,/* Smaller value is safe */ -FTR_HIGHER_SAFE ,/* Bigger value is safe */ +FTR_EXACT ,/* Use a predefined safe value */ +FTR_LOWER_SAFE ,/* Smaller value is safe */ +FTR_HIGHER_SAFE ,/* Bigger value is safe */ +FTR_HIGHER_OR_ZERO_SAFE ,/* Bigger value is safe, but 0 is biggest */ };#define FTR_STRICT true/* SANITY check strict matching required */
arch/arm64/kernel/cpufeature.c +6 -2
@@ -225,8 +225,8 @@ static const struct arm64_ftr_bits ftr_cARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_EXACT ,31 ,1 ,1 ),/* RES1 */ ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,CTR_DIC_SHIFT ,1 ,1 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,CTR_IDC_SHIFT ,1 ,1 ), -ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_HIGHER_SAFE ,CTR_CWG_SHIFT ,4 ,0 ), -ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_HIGHER_SAFE ,CTR_ERG_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_HIGHER_OR_ZERO_SAFE ,CTR_CWG_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_HIGHER_OR_ZERO_SAFE ,CTR_ERG_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,CTR_DMINLINE_SHIFT ,4 ,1 ),/* * Linux can handle differing I-cache policies. Userspace JITs will
@@ -468,6 +468,10 @@ static s64 arm64_ftr_safe_value(const stcase FTR_LOWER_SAFE : ret = new < cur ? new : cur;break ; +case FTR_HIGHER_OR_ZERO_SAFE : +if (!cur || !new) +break ; +/* Fallthrough */ case FTR_HIGHER_SAFE : ret = new > cur ? new : cur;break ;
Greg Kroah-Hartman
maintainerPATCH 114/131 io_uring: fix KASAN use after free in io_sq_wq_submit_work
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
commit d0ee879187df966ef638031b5f5183078d672141 upstream.
[root@localhost ~]# ./liburing/test/link
QEMU Standard PC report that:
[ 29.379892] CPU: 0 PID: 84 Comm: kworker/u2:2 Not tainted 5.3.0-rc2-00051-g4010b622f1d2-dirty #86 [ 29.379902] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 [ 29.379913] Workqueue: io_ring-wq io_sq_wq_submit_work [ 29.379929] Call Trace: [ 29.379953] dump_stack+0xa9/0x10e [ 29.379970] ? io_sq_wq_submit_work+0xbf4/0xe90 [ 29.379986] print_address_description.cold.6+0x9/0x317 [ 29.379999] ? io_sq_wq_submit_work+0xbf4/0xe90 [ 29.380010] ? io_sq_wq_submit_work+0xbf4/0xe90 [ 29.380026] __kasan_report.cold.7+0x1a/0x34 [ 29.380044] ? io_sq_wq_submit_work+0xbf4/0xe90 [ 29.380061] kasan_report+0xe/0x12 [ 29.380076] io_sq_wq_submit_work+0xbf4/0xe90 [ 29.380104] ? io_sq_thread+0xaf0/0xaf0 [ 29.380152] process_one_work+0xb59/0x19e0 [ 29.380184] ? pwq_dec_nr_in_flight+0x2c0/0x2c0 [ 29.380221] worker_thread+0x8c/0xf40 [ 29.380248] ? __kthread_parkme+0xab/0x110 [ 29.380265] ? process_one_work+0x19e0/0x19e0 [ 29.380278] kthread+0x30b/0x3d0 [ 29.380292] ? kthread_create_on_node+0xe0/0xe0 [ 29.380311] ret_from_fork+0x3a/0x50
[ 29.380635] Allocated by task 209: [ 29.381255] save_stack+0x19/0x80 [ 29.381268] __kasan_kmalloc.constprop.6+0xc1/0xd0 [ 29.381279] kmem_cache_alloc+0xc0/0x240 [ 29.381289] io_submit_sqe+0x11bc/0x1c70 [ 29.381300] io_ring_submit+0x174/0x3c0 [ 29.381311] __x64_sys_io_uring_enter+0x601/0x780 [ 29.381322] do_syscall_64+0x9f/0x4d0 [ 29.381336] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 29.381633] Freed by task 84: [ 29.382186] save_stack+0x19/0x80 [ 29.382198] __kasan_slab_free+0x11d/0x160 [ 29.382210] kmem_cache_free+0x8c/0x2f0 [ 29.382220] io_put_req+0x22/0x30 [ 29.382230] io_sq_wq_submit_work+0x28b/0xe90 [ 29.382241] process_one_work+0xb59/0x19e0 [ 29.382251] worker_thread+0x8c/0xf40 [ 29.382262] kthread+0x30b/0x3d0 [ 29.382272] ret_from_fork+0x3a/0x50
[ 29.382569] The buggy address belongs to the object at ffff888067172140
which belongs to the cache io_kiocb of size 224
[ 29.384692] The buggy address is located 120 bytes inside of
224-byte region [ffff888067172140, ffff888067172220)
[ 29.386723] The buggy address belongs to the page:
[ 29.387575] page:ffffea00019c5c80 refcount:1 mapcount:0 mapping:ffff88806ace5180 index:0x0
[ 29.387587] flags: 0x100000000000200(slab)
[ 29.387603] raw: 0100000000000200 dead000000000100 dead000000000122 ffff88806ace5180
[ 29.387617] raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
[ 29.387624] page dumped because: kasan: bad access detected[ 29.387920] Memory state around the buggy address: [ 29.388771] ffff888067172080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc [ 29.390062] ffff888067172100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb [ 29.391325] >ffff888067172180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 29.392578] ^ [ 29.393480] ffff888067172200: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc [ 29.394744] ffff888067172280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 29.396003] ================================================================== [ 29.397260] Disabling lock debugging due to kernel taint
io_sq_wq_submit_work free and read req again.
--- fs/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/io_uring.c +2 -1
@@ -1692,6 +1692,7 @@ restart: do { struct sqe_submit *s = &req->submit; const struct io_uring_sqe *sqe = s->sqe; + unsigned int flags = req->flags; /* Ensure we clear previously set non-block flag */ req->rw.ki_flags &= ~IOCB_NOWAIT;
@@ -1737,7 +1738,7 @@ restart:kfree (sqe);/* req from defer and link list needn't decrease async cnt */ -if (req->flags & (REQ_F_IO_DRAINED |REQ_F_LINK_DONE )) +if (flags & (REQ_F_IO_DRAINED |REQ_F_LINK_DONE )) goto out;if (!async_list)
Greg Kroah-Hartman
maintainerPATCH 115/131 clk: mediatek: mt8183: Register 13MHz clock earlier for clocksource
In reply to Greg Kroah-HartmanFrom: Weiyi Lu <[email protected]>
commit c93d059a80450af99dd6c0e8c36790579343675a upstream.
The 13MHz clock should be registered before clocksource driver is initialized. Use CLK_OF_DECLARE_DRIVER() to guarantee.
--- drivers/clk/mediatek/clk-mt8183.c | 46 ++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-)
drivers/clk/mediatek/clk-mt8183.c +34 -12
@@ -25,9 +25,11 @@ static const struct mtk_fixed_clk top_fi FIXED_CLK(CLK_TOP_UNIVP_192M, "univpll_192m", "univpll", 192000000), }; +static const struct mtk_fixed_factor top_early_divs[] = { +FACTOR (CLK_TOP_CLK13M ,"clk13m" ,"clk26m" ,1 ,2 ), +}; +static const struct mtk_fixed_factor top_divs[] = { -FACTOR (CLK_TOP_CLK13M ,"clk13m" ,"clk26m" ,1 , -2 ),FACTOR (CLK_TOP_F26M_CK_D2 ,"csw_f26m_ck_d2" ,"clk26m" ,1 ,2 ), FACTOR(CLK_TOP_SYSPLL_CK, "syspll_ck", "mainpll", 1,
@@ -1167,37 +1169,57 @@ static int clk_mt8183_apmixed_probe(strureturn of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); } +static struct clk_onecell_data *top_clk_data; + +static void clk_mt8183_top_init_early (struct device_node *node) +{ +int i; + + top_clk_data =mtk_alloc_clk_data (CLK_TOP_NR_CLK ); + +for (i =0 ; i <CLK_TOP_NR_CLK ; i++) + top_clk_data->clks[i] =ERR_PTR (-EPROBE_DEFER ); + +mtk_clk_register_factors (top_early_divs,ARRAY_SIZE (top_early_divs), + top_clk_data); + +of_clk_add_provider (node, of_clk_src_onecell_get, top_clk_data); +} + +CLK_OF_DECLARE_DRIVER (mt8183_topckgen,"mediatek,mt8183-topckgen" , + clk_mt8183_top_init_early); +static int clk_mt8183_top_probe (struct platform_device *pdev) {struct resource *res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );void __iomem *base; -struct clk_onecell_data *clk_data;struct device_node *node = pdev->dev.of_node; base =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (base))return PTR_ERR (base); - clk_data =mtk_alloc_clk_data (CLK_TOP_NR_CLK ); -mtk_clk_register_fixed_clks (top_fixed_clks,ARRAY_SIZE (top_fixed_clks), - clk_data); + top_clk_data); + +mtk_clk_register_factors (top_early_divs,ARRAY_SIZE (top_early_divs), + top_clk_data); -mtk_clk_register_factors (top_divs,ARRAY_SIZE (top_divs), clk_data); +mtk_clk_register_factors (top_divs,ARRAY_SIZE (top_divs), top_clk_data);mtk_clk_register_muxes (top_muxes,ARRAY_SIZE (top_muxes), - node, &mt8183_clk_lock, clk_data); + node, &mt8183_clk_lock, top_clk_data);mtk_clk_register_composites (top_aud_muxes,ARRAY_SIZE (top_aud_muxes), - base, &mt8183_clk_lock, clk_data); + base, &mt8183_clk_lock, top_clk_data);mtk_clk_register_composites (top_aud_divs,ARRAY_SIZE (top_aud_divs), - base, &mt8183_clk_lock, clk_data); + base, &mt8183_clk_lock, top_clk_data);mtk_clk_register_gates (node, top_clks,ARRAY_SIZE (top_clks), - clk_data); + top_clk_data); -return of_clk_add_provider (node, of_clk_src_onecell_get, clk_data); +return of_clk_add_provider (node, of_clk_src_onecell_get, top_clk_data); }static int clk_mt8183_infra_probe (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 116/131 scsi: mpt3sas: Use 63-bit DMA addressing on SAS35 HBA
In reply to Greg Kroah-HartmanFrom: Suganath Prabu <[email protected]>
commit df9a606184bfdb5ae3ca9d226184e9489f5c24f7 upstream.
Although SAS3 & SAS3.5 IT HBA controllers support 64-bit DMA addressing, as per hardware design, if DMA-able range contains all 64-bits
set (0xFFFFFFFF-FFFFFFFF) then it results in a firmware fault.
E.g. SGE's start address is 0xFFFFFFFF-FFFF000 and data length is 0x1000 bytes. when HBA tries to DMA the data at 0xFFFFFFFF-FFFFFFFF location then HBA will fault the firmware.
Driver will set 63-bit DMA mask to ensure the above address will not be used.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +7 -5
@@ -2683,6 +2683,8 @@ _base_config_dma_addressing(struct MPT3S {u64 required_mask, coherent_mask;struct sysinfo s; +/* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */ +int dma_mask = (ioc->hba_mpi_version_belonged >MPI2_VERSION ) ?63 :64 ;if (ioc->is_mcpu_endpoint) goto try_32bit;
@@ -2692,17 +2694,17 @@ _base_config_dma_addressing(struct MPT3S goto try_32bit;if (ioc->dma_mask) - coherent_mask =DMA_BIT_MASK (64 ); + coherent_mask =DMA_BIT_MASK (dma_mask);else coherent_mask =DMA_BIT_MASK (32 ); -if (dma_set_mask (&pdev->dev,DMA_BIT_MASK (64 )) || +if (dma_set_mask (&pdev->dev,DMA_BIT_MASK (dma_mask)) ||dma_set_coherent_mask (&pdev->dev, coherent_mask)) goto try_32bit; ioc->base_add_sg_single = &_base_add_sg_single_64; ioc->sge_size =sizeof (Mpi2SGESimple64_t); - ioc->dma_mask =64 ; + ioc->dma_mask = dma_mask; goto out; try_32bit:
@@ -2724,7 +2726,7 @@ static int _base_change_consistent_dma_mask(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) { - if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { + if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(ioc->dma_mask))) { if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) return -ENODEV; }
@@ -4631,7 +4633,7 @@ _base_allocate_memory_pools(struct MPT3S total_sz += sz; }while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count)); -if (ioc->dma_mask ==64 ) { +if (ioc->dma_mask >32 ) {if (_base_change_consistent_dma_mask (ioc, ioc->pdev) !=0 ) {ioc_warn (ioc,"no suitable consistent DMA mask for %s\n" ,pci_name (ioc->pdev));
Greg Kroah-Hartman
maintainerPATCH 117/131 nbd: replace kill_bdev() with __invalidate_device() again
In reply to Greg Kroah-HartmanFrom: Munehisa Kamata <[email protected]>
commit 2b5c8f0063e4b263cf2de82029798183cf85c320 upstream.
Commit abbbdf12497d ("replace kill_bdev() with __invalidate_device()") once did this, but 29eaadc03649 ("nbd: stop using the bdev everywhere") resurrected kill_bdev() and it has been there since then. So buffer_head mappings still get killed on a server disconnection, and we can still hit the BUG_ON on a filesystem on the top of the nbd device.
EXT4-fs (nbd0): mounted filesystem with ordered data mode. Opts: (null)
block nbd0: Receive control failed (result -32)
block nbd0: shutting down sockets
print_req_error: I/O error, dev nbd0, sector 66264 flags 3000
EXT4-fs warning (device nbd0): htree_dirblock_to_tree:979: inode #2: lblock 0: comm ls: error -5 reading directory block
print_req_error: I/O error, dev nbd0, sector 2264 flags 3000
EXT4-fs error (device nbd0): __ext4_get_inode_loc:4690: inode #2: block 283: comm ls: unable to read itable block EXT4-fs error (device nbd0) in ext4_reserve_inode_write:5894: IO failure
------------[ cut here ]------------ kernel BUG at fs/buffer.c:3057! invalid opcode: 0000 [#1] SMP PTI CPU: 7 PID: 40045 Comm: jbd2/nbd0-8 Not tainted 5.1.0-rc3+ #4 Hardware name: Amazon EC2 m5.12xlarge/, BIOS 1.0 10/16/2017 RIP: 0010:submit_bh_wbc+0x18b/0x190 ... Call Trace: jbd2_write_superblock+0xf1/0x230 [jbd2] ? account_entity_enqueue+0xc5/0xf0 jbd2_journal_update_sb_log_tail+0x94/0xe0 [jbd2] jbd2_journal_commit_transaction+0x12f/0x1d20 [jbd2] ? __switch_to_asm+0x40/0x70 ... ? lock_timer_base+0x67/0x80 kjournald2+0x121/0x360 [jbd2] ? remove_wait_queue+0x60/0x60 kthread+0xf8/0x130 ? commit_timeout+0x10/0x10 [jbd2] ? kthread_bind+0x10/0x10 ret_from_fork+0x35/0x40
With __invalidate_device(), I no longer hit the BUG_ON with sync or unmount on the disconnected device.
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -1229,7 +1229,7 @@ static void nbd_clear_sock_ioctl(struct struct block_device *bdev) {sock_shutdown (nbd); -kill_bdev (bdev); +__invalidate_device (bdev, true);nbd_bdev_reset (bdev);if (test_and_clear_bit (NBD_HAS_CONFIG_REF , &nbd->config->runtime_flags))
Greg Kroah-Hartman
maintainerPATCH 118/131 xen/swiotlb: fix condition for calling xen_destroy_contiguous_region()
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 50f6393f9654c561df4cdcf8e6cfba7260143601 upstream.
The condition in xen_swiotlb_free_coherent() for deciding whether to call xen_destroy_contiguous_region() is wrong: in case the region to be freed is not contiguous calling xen_destroy_contiguous_region() is the wrong thing to do: it would result in inconsistent mappings of multiple PFNs to the same MFN. This will lead to various strange crashes or data corruption.
Instead of calling xen_destroy_contiguous_region() in that case a warning should be issued as that situation should never occur.
--- drivers/xen/swiotlb-xen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/swiotlb-xen.c +2 -2
@@ -361,8 +361,8 @@ xen_swiotlb_free_coherent(struct device/* Convert the size to actually allocated. */ size =1UL << (order +XEN_PAGE_SHIFT ); -if (((dev_addr + size -1 <= dma_mask)) || -range_straddles_page_boundary (phys, size)) +if (!WARN_ON ((dev_addr + size -1 > dma_mask) || +range_straddles_page_boundary (phys, size)))xen_destroy_contiguous_region (phys, order);xen_free_coherent_pages (hwdev, size, vaddr, (dma_addr_t )phys, attrs);
Greg Kroah-Hartman
maintainerPATCH 119/131 xen/gntdev.c: Replace vm_map_pages() with vm_map_pages_zero()
In reply to Greg Kroah-HartmanFrom: Souptick Joarder <[email protected]>
commit 8d1502f629c9966743de45744f4c1ba93a57d105 upstream.
'commit df9bde015a72 ("xen/gntdev.c: convert to use vm_map_pages()")' breaks gntdev driver. If vma->vm_pgoff > 0, vm_map_pages() will:
- use map->pages starting at vma->vm_pgoff instead of 0
- verify map->count against vma_pages()+vma->vm_pgoff instead of just vma_pages().
In practice, this breaks using a single gntdev FD for mapping multiple grants.
relevant strace output:
[pid 857] ioctl(7, IOCTL_GNTDEV_MAP_GRANT_REF, 0x7ffd3407b6d0) = 0
[pid 857] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 7, 0) =0x777f1211b000
[pid 857] ioctl(7, IOCTL_GNTDEV_SET_UNMAP_NOTIFY, 0x7ffd3407b710) = 0 [pid 857] ioctl(7, IOCTL_GNTDEV_MAP_GRANT_REF, 0x7ffd3407b6d0) = 0 [pid 857] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 7,
0x1000) = -1 ENXIO (No such device or address)
details here:
https://github.com/QubesOS/qubes-issues/issues/5199
The reason is -> ( copying Marek's word from discussion)
vma->vm_pgoff is used as index passed to gntdev_find_map_index. It's basically using this parameter for "which grant reference to map". map struct returned by gntdev_find_map_index() describes just the pages to be mapped. Specifically map->pages[0] should be mapped at vma->vm_start, not vma->vm_start+vma->vm_pgoff*PAGE_SIZE.
When trying to map grant with index (aka vma->vm_pgoff) > 1, __vm_map_pages() will refuse to map it because it will expect map->count to be at least vma_pages(vma)+vma->vm_pgoff, while it is exactly vma_pages(vma).
Converting vm_map_pages() to use vm_map_pages_zero() will fix the problem.
Marek has tested and confirmed the same.
--- drivers/xen/gntdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/gntdev.c +1 -1
@@ -1145,7 +1145,7 @@ static int gntdev_mmap(struct file *flip goto out_put_map;if (!use_ptemod) { - err =vm_map_pages (vma, map->pages, map->count); + err =vm_map_pages_zero (vma, map->pages, map->count);if (err) goto out_put_map; }else {
Greg Kroah-Hartman
maintainerPATCH 120/131 RDMA/bnxt_re: Honor vlan_id in GID entry comparison
In reply to Greg Kroah-HartmanFrom: Selvin Xavier <[email protected]>
commit c56b593d2af4cbd189c6af5fd6790728fade80cc upstream.
A GID entry consists of GID, vlan, netdev and smac. Extend GID duplicate check comparisons to consider vlan_id as well to support IPv6 VLAN based link local addresses. Introduce a new structure (bnxt_qplib_gid_info) to hold gid and vlan_id information.
The issue is discussed in the following thread
https://lore.kernel.org/r/AM0PR05MB4866CFEDCDF3CDA1D7D18AA5D1F20@AM0PR05MB4866.eurprd05.prod.outlook.com
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7 +++++-- drivers/infiniband/hw/bnxt_re/qplib_res.c | 13 +++++++++---- drivers/infiniband/hw/bnxt_re/qplib_res.h | 2 +- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 14 +++++++++----- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 7 ++++++- 5 files changed, 30 insertions(+), 13 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +5 -2
@@ -308,6 +308,7 @@ int bnxt_re_del_gid(const struct ib_gid_struct bnxt_re_dev *rdev =to_bnxt_re_dev (attr->device, ibdev);struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl;struct bnxt_qplib_gid *gid_to_del; +u16 vlan_id =0xFFFF ;/* Delete the entry from the hardware */ ctx = *context;
@@ -317,7 +318,8 @@ int bnxt_re_del_gid(const struct ib_gid_if (sgid_tbl && sgid_tbl->active) {if (ctx->idx >= sgid_tbl->max)return -EINVAL ; - gid_to_del = &sgid_tbl->tbl[ctx->idx]; + gid_to_del = &sgid_tbl->tbl[ctx->idx].gid; + vlan_id = sgid_tbl->tbl[ctx->idx].vlan_id;/* DEL_GID is called in WQ context(netdevice_event_work_handler) * or via the ib_unregister_device path. In the former case QP1 * may not be destroyed yet, in which case just return as FW
@@ -335,7 +337,8 @@ int bnxt_re_del_gid(const struct ib_gid_ } ctx->refcnt--;if (!ctx->refcnt) { - rc =bnxt_qplib_del_sgid (sgid_tbl, gid_to_del, true); + rc =bnxt_qplib_del_sgid (sgid_tbl, gid_to_del, + vlan_id, true);if (rc) {dev_err (rdev_to_dev (rdev),"Failed to remove GID: %#x" , rc);
drivers/infiniband/hw/bnxt_re/qplib_res.c +9 -4
@@ -488,7 +488,7 @@ static int bnxt_qplib_alloc_sgid_tbl(str struct bnxt_qplib_sgid_tbl *sgid_tbl, u16 max) { - sgid_tbl->tbl =kcalloc (max,sizeof (struct bnxt_qplib_gid ),GFP_KERNEL ); + sgid_tbl->tbl =kcalloc (max,sizeof (*sgid_tbl->tbl),GFP_KERNEL );if (!sgid_tbl->tbl)return -ENOMEM ;
@@ -526,9 +526,10 @@ static void bnxt_qplib_cleanup_sgid_tbl(for (i =0 ; i < sgid_tbl->max; i++) {if (memcmp (&sgid_tbl->tbl[i], &bnxt_qplib_gid_zero,sizeof (bnxt_qplib_gid_zero))) -bnxt_qplib_del_sgid (sgid_tbl, &sgid_tbl->tbl[i], true); +bnxt_qplib_del_sgid (sgid_tbl, &sgid_tbl->tbl[i].gid, + sgid_tbl->tbl[i].vlan_id, true); } -memset (sgid_tbl->tbl,0 ,sizeof (struct bnxt_qplib_gid ) * sgid_tbl->max); +memset (sgid_tbl->tbl,0 ,sizeof (*sgid_tbl->tbl) * sgid_tbl->max);memset (sgid_tbl->hw_id,-1 ,sizeof (u16) * sgid_tbl->max);memset (sgid_tbl->vlan,0 ,sizeof (u8) * sgid_tbl->max); sgid_tbl->active =0 ;
@@ -537,7 +538,11 @@ static void bnxt_qplib_cleanup_sgid_tbl(static void bnxt_qplib_init_sgid_tbl (struct bnxt_qplib_sgid_tbl *sgid_tbl,struct net_device *netdev) { -memset (sgid_tbl->tbl,0 ,sizeof (struct bnxt_qplib_gid ) * sgid_tbl->max); +u32 i; + +for (i =0 ; i < sgid_tbl->max; i++) + sgid_tbl->tbl[i].vlan_id =0xffff ; +memset (sgid_tbl->hw_id,-1 ,sizeof (u16) * sgid_tbl->max); }
drivers/infiniband/hw/bnxt_re/qplib_res.h +1 -1
@@ -111,7 +111,7 @@ struct bnxt_qplib_pd_tbl { };struct bnxt_qplib_sgid_tbl { -struct bnxt_qplib_gid *tbl; +struct bnxt_qplib_gid_info *tbl;u16 *hw_id;u16 max;u16 active;
drivers/infiniband/hw/bnxt_re/qplib_sp.c +9 -5
@@ -213,12 +213,12 @@ int bnxt_qplib_get_sgid(struct bnxt_qpli index, sgid_tbl->max);return -EINVAL ; } -memcpy (gid, &sgid_tbl->tbl[index],sizeof (*gid)); +memcpy (gid, &sgid_tbl->tbl[index].gid,sizeof (*gid));return 0 ; }int bnxt_qplib_del_sgid (struct bnxt_qplib_sgid_tbl *sgid_tbl, -struct bnxt_qplib_gid *gid,bool update) +struct bnxt_qplib_gid *gid,u16 vlan_id,bool update) { struct bnxt_qplib_res *res = to_bnxt_qplib(sgid_tbl, struct bnxt_qplib_res,
@@ -236,7 +236,8 @@ int bnxt_qplib_del_sgid(struct bnxt_qplireturn -ENOMEM ; }for (index =0 ; index < sgid_tbl->max; index++) { -if (!memcmp (&sgid_tbl->tbl[index], gid,sizeof (*gid))) +if (!memcmp (&sgid_tbl->tbl[index].gid, gid,sizeof (*gid)) && + vlan_id == sgid_tbl->tbl[index].vlan_id)break ; }if (index == sgid_tbl->max) {
@@ -262,8 +263,9 @@ int bnxt_qplib_del_sgid(struct bnxt_qpliif (rc)return rc; } -memcpy (&sgid_tbl->tbl[index], &bnxt_qplib_gid_zero, +memcpy (&sgid_tbl->tbl[index].gid, &bnxt_qplib_gid_zero,sizeof (bnxt_qplib_gid_zero)); + sgid_tbl->tbl[index].vlan_id =0xFFFF ; sgid_tbl->vlan[index] =0 ; sgid_tbl->active--; dev_dbg(&res->pdev->dev,
@@ -296,7 +298,8 @@ int bnxt_qplib_add_sgid(struct bnxt_qpli } free_idx = sgid_tbl->max;for (i =0 ; i < sgid_tbl->max; i++) { -if (!memcmp (&sgid_tbl->tbl[i], gid,sizeof (*gid))) { +if (!memcmp (&sgid_tbl->tbl[i], gid,sizeof (*gid)) && + sgid_tbl->tbl[i].vlan_id == vlan_id) {dev_dbg (&res->pdev->dev,"SGID entry already exist in entry %d!\n" , i); *index = i;
@@ -351,6 +354,7 @@ int bnxt_qplib_add_sgid(struct bnxt_qpli }/* Add GID to the sgid_tbl */ memcpy (&sgid_tbl->tbl[free_idx], gid,sizeof (*gid)); + sgid_tbl->tbl[free_idx].vlan_id = vlan_id; sgid_tbl->active++;if (vlan_id !=0xFFFF ) sgid_tbl->vlan[free_idx] =1 ;
drivers/infiniband/hw/bnxt_re/qplib_sp.h +6 -1
@@ -84,6 +84,11 @@ struct bnxt_qplib_gid {u8 data[16 ]; }; +struct bnxt_qplib_gid_info { +struct bnxt_qplib_gid gid; +u16 vlan_id; +}; +struct bnxt_qplib_ah {struct bnxt_qplib_gid dgid;struct bnxt_qplib_pd *pd;
@@ -221,7 +226,7 @@ int bnxt_qplib_get_sgid(struct bnxt_qpli struct bnxt_qplib_sgid_tbl *sgid_tbl, int index, struct bnxt_qplib_gid *gid);int bnxt_qplib_del_sgid (struct bnxt_qplib_sgid_tbl *sgid_tbl, -struct bnxt_qplib_gid *gid,bool update); +struct bnxt_qplib_gid *gid,u16 vlan_id,bool update);int bnxt_qplib_add_sgid (struct bnxt_qplib_sgid_tbl *sgid_tbl,struct bnxt_qplib_gid *gid,u8 *mac,u16 vlan_id,bool update,u32 *index);
Greg Kroah-Hartman
maintainerPATCH 121/131 RDMA/devices: Do not deadlock during client removal
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
commit 621e55ff5b8e0ab5d1063f0eae0ef3960bef8f6e upstream.
lockdep reports:
WARNING: possible circular locking dependency detected
modprobe/302 is trying to acquire lock:
0000000007c8919c ((wq_completion)ib_cm){+.+.}, at: flush_workqueue+0xdf/0x990
but task is already holding lock:
000000002d3d2ca9 (&device->client_data_rwsem){++++}, at: remove_client_context+0x79/0xd0 [ib_core]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&device->client_data_rwsem){++++}:
down_read+0x3f/0x160
ib_get_net_dev_by_params+0xd5/0x200 [ib_core]
cma_ib_req_handler+0x5f6/0x2090 [rdma_cm]
cm_process_work+0x29/0x110 [ib_cm]
cm_req_handler+0x10f5/0x1c00 [ib_cm]
cm_work_handler+0x54c/0x311d [ib_cm]
process_one_work+0x4aa/0xa30
worker_thread+0x62/0x5b0
kthread+0x1ca/0x1f0
ret_from_fork+0x24/0x30-> #1 ((work_completion)(&(&work->work)->work)){+.+.}:
process_one_work+0x45f/0xa30
worker_thread+0x62/0x5b0
kthread+0x1ca/0x1f0
ret_from_fork+0x24/0x30-> #0 ((wq_completion)ib_cm){+.+.}:
lock_acquire+0xc8/0x1d0
flush_workqueue+0x102/0x990
cm_remove_one+0x30e/0x3c0 [ib_cm]
remove_client_context+0x94/0xd0 [ib_core]
disable_device+0x10a/0x1f0 [ib_core]
__ib_unregister_device+0x5a/0xe0 [ib_core]
ib_unregister_device+0x21/0x30 [ib_core]
mlx5_ib_stage_ib_reg_cleanup+0x9/0x10 [mlx5_ib]
__mlx5_ib_remove+0x3d/0x70 [mlx5_ib]
mlx5_ib_remove+0x12e/0x140 [mlx5_ib]
mlx5_remove_device+0x144/0x150 [mlx5_core]
mlx5_unregister_interface+0x3f/0xf0 [mlx5_core]
mlx5_ib_cleanup+0x10/0x3a [mlx5_ib]
__x64_sys_delete_module+0x227/0x350
do_syscall_64+0xc3/0x6a4
entry_SYSCALL_64_after_hwframe+0x49/0xbeWhich is due to the read side of the client_data_rwsem being obtained recursively through a work queue flush during cm client removal.
The lock is being held across the remove in remove_client_context() so that the function is a fence, once it returns the client is removed. This is required so that the two callers do not proceed with destruction until the client completes removal.
Instead of using client_data_rwsem use the existing device unregistration refcount and add a similar client unregistration (client->uses) refcount.
This will fence the two unregistration paths without holding any locks.
--- drivers/infiniband/core/device.c | 54 +++++++++++++++++++++++++++++---------- include/rdma/ib_verbs.h | 3 ++ 2 files changed, 44 insertions(+), 13 deletions(-)
drivers/infiniband/core/device.c +41 -13
@@ -98,6 +98,12 @@ static LIST_HEAD(client_list); static DEFINE_XARRAY_FLAGS(clients, XA_FLAGS_ALLOC);static DECLARE_RWSEM (clients_rwsem); +static void ib_client_put (struct ib_client *client) +{ +if (refcount_dec_and_test (&client->uses)) +complete (&client->uses_zero); +} +/* * If client_data is registered then the corresponding client must also still * be registered.
@@ -651,6 +657,14 @@ static int add_client_context(struct ib_down_write (&device->client_data_rwsem);/* +* So long as the client is registered hold both the client and device +* unregistration locks. +*/ +if (!refcount_inc_not_zero (&client->uses)) + goto out_unlock; +refcount_inc (&device->refcount); + +/* * Another caller to add_client_context got here first and has already * completely initialized context. */
@@ -673,6 +687,9 @@ static int add_client_context(struct ib_return 0 ; out: +ib_device_put (device); +ib_client_put (client); +out_unlock:up_write (&device->client_data_rwsem);return ret; }
@@ -692,7 +709,7 @@ static void remove_client_context(struct client_data =xa_load (&device->client_data, client_id);xa_clear_mark (&device->client_data, client_id,CLIENT_DATA_REGISTERED ); client =xa_load (&clients, client_id); -downgrade_write (&device->client_data_rwsem); +up_write (&device->client_data_rwsem);/* * Notice we cannot be holding any exclusive locks when calling the
@@ -702,17 +719,13 @@ static void remove_client_context(struct* * For this reason clients and drivers should not call the * unregistration functions will holdling any locks. -* -* It tempting to drop the client_data_rwsem too, but this is required -* to ensure that unregister_client does not return until all clients -* are completely unregistered, which is required to avoid module -* unloading races. */ if (client->remove) client->remove (device, client_data);xa_erase (&device->client_data, client_id); -up_read (&device->client_data_rwsem); +ib_device_put (device); +ib_client_put (client); }static int alloc_port_data (struct ib_device *device)
@@ -1696,6 +1709,8 @@ int ib_register_client(struct ib_clientunsigned long index;int ret; +refcount_set (&client->uses,1 ); +init_completion (&client->uses_zero); ret =assign_client_id (client);if (ret)return ret;
@@ -1731,16 +1746,29 @@ void ib_unregister_client(struct ib_clieunsigned long index;down_write (&clients_rwsem); +ib_client_put (client);xa_clear_mark (&clients, client->client_id,CLIENT_REGISTERED );up_write (&clients_rwsem); + +/* We do not want to have locks while calling client->remove() */ +rcu_read_lock (); + xa_for_each (&devices, index, device) { +if (!ib_device_try_get (device)) +continue ; +rcu_read_unlock (); + +remove_client_context (device, client->client_id); + +ib_device_put (device); +rcu_read_lock (); + } +rcu_read_unlock (); +/* -* Every device still known must be serialized to make sure we are -* done with the client callbacks before we return. +* remove_client_context() is not a fence, it can return even though a +* removal is ongoing. Wait until all removals are completed. */ -down_read (&devices_rwsem); - xa_for_each (&devices, index, device) -remove_client_context (device, client->client_id); -up_read (&devices_rwsem); +wait_for_completion (&client->uses_zero);down_write (&clients_rwsem);list_del (&client->list);
include/rdma/ib_verbs.h +3 -0
@@ -2722,6 +2722,9 @@ struct ib_client {const union ib_gid *gid, const struct sockaddr *addr, void *client_data); + +refcount_t uses; +struct completion uses_zero;struct list_head list;u32 client_id;
Greg Kroah-Hartman
maintainerPATCH 122/131 IB/mlx5: Fix unreg_umr to ignore the mkey state
In reply to Greg Kroah-HartmanFrom: Yishai Hadas <[email protected]>
commit 6a053953739d23694474a5f9c81d1a30093da81a upstream.
Fix unreg_umr to ignore the mkey state and do not fail if was freed. This prevents a case that a user space application already changed the mkey state to free and then the UMR operation will fail leaving the mkey in an inappropriate state.
--- drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 + drivers/infiniband/hw/mlx5/mr.c | 4 ++-- drivers/infiniband/hw/mlx5/qp.c | 12 ++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-)
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -0
@@ -480,6 +480,7 @@ struct mlx5_umr_wr {u64 length;int access_flags;u32 mkey; + u8 ignore_free_state:1; };static inline const struct mlx5_umr_wr *umr_wr (const struct ib_send_wr *wr)
drivers/infiniband/hw/mlx5/mr.c +2 -2
@@ -1372,10 +1372,10 @@ static int unreg_umr(struct mlx5_ib_devif (mdev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR )return 0 ; - umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR | -MLX5_IB_SEND_UMR_FAIL_IF_FREE ; + umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR ; umrwr.wr.opcode =MLX5_IB_WR_UMR ; umrwr.mkey = mr->mmkey.key; + umrwr.ignore_free_state =1 ;return mlx5_ib_post_send_wait (dev, &umrwr); }
drivers/infiniband/hw/mlx5/qp.c +8 -4
@@ -4262,10 +4262,14 @@ static int set_reg_umr_segment(struct mlmemset (umr,0 ,sizeof (*umr)); -if (wr->send_flags &MLX5_IB_SEND_UMR_FAIL_IF_FREE ) - umr->flags =MLX5_UMR_CHECK_FREE ;/* fail if free */ -else - umr->flags =MLX5_UMR_CHECK_NOT_FREE ;/* fail if not free */ +if (!umrwr->ignore_free_state) { +if (wr->send_flags &MLX5_IB_SEND_UMR_FAIL_IF_FREE ) +/* fail if free */ + umr->flags =MLX5_UMR_CHECK_FREE ; +else +/* fail if not free */ + umr->flags =MLX5_UMR_CHECK_NOT_FREE ; + } umr->xlt_octowords =cpu_to_be16 (get_xlt_octo (umrwr->xlt_size));if (wr->send_flags &MLX5_IB_SEND_UMR_UPDATE_XLT ) {
Greg Kroah-Hartman
maintainerPATCH 123/131 IB/mlx5: Use direct mkey destroy command upon UMR unreg failure
In reply to Greg Kroah-HartmanFrom: Yishai Hadas <[email protected]>
commit afd1417404fba6dbfa6c0a8e5763bd348da682e4 upstream.
Use a direct firmware command to destroy the mkey in case the unreg UMR operation has failed.
This prevents a case that a mkey will leak out from the cache post a failure to be destroyed by a UMR WR.
In case the MR cache limit didn't reach a call to add another entry to the cache instead of the destroyed one is issued.
In addition, replaced a warn message to WARN_ON() as this flow is fatal and can't happen unless some bug around.
--- drivers/infiniband/hw/mlx5/mr.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx5/mr.c +8 -5
@@ -545,13 +545,16 @@ void mlx5_mr_cache_free(struct mlx5_ib_dreturn ; c =order2idx (dev, mr->order); -if (c <0 || c >=MAX_MR_CACHE_ENTRIES ) { -mlx5_ib_warn (dev,"order %d, cache index %d\n" , mr->order, c); -return ; - } +WARN_ON (c <0 || c >=MAX_MR_CACHE_ENTRIES ); -if (unreg_umr (dev, mr)) +if (unreg_umr (dev, mr)) { + mr->allocated_from_cache = false; +destroy_mkey (dev, mr); + ent = &cache->ent[c]; +if (ent->cur < ent->limit) +queue_work (cache->wq, &ent->work);return ; + } ent = &cache->ent[c];spin_lock_irq (&ent->lock);
Greg Kroah-Hartman
maintainerPATCH 124/131 IB/mlx5: Move MRs to a kernel PD when freeing them to the MR cache
In reply to Greg Kroah-HartmanFrom: Yishai Hadas <[email protected]>
commit 9ec4483a3f0f71a228a5933bc040441322bfb090 upstream.
Fix unreg_umr to move the MR to a kernel owned PD (i.e. the UMR PD) which can't be accessed by userspace.
This ensures that nothing can continue to access the MR once it has been placed in the kernels cache for reuse.
MRs in the cache continue to have their HW state, including DMA tables, present. Even though the MR has been invalidated, changing the PD provides an additional layer of protection against use of the MR.
--- drivers/infiniband/hw/mlx5/mr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mr.c +3 -1
@@ -1375,8 +1375,10 @@ static int unreg_umr(struct mlx5_ib_devif (mdev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR )return 0 ; - umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR ; + umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR | +MLX5_IB_SEND_UMR_UPDATE_PD_ACCESS ; umrwr.wr.opcode =MLX5_IB_WR_UMR ; + umrwr.pd = dev->umrc.pd; umrwr.mkey = mr->mmkey.key; umrwr.ignore_free_state =1 ;
Greg Kroah-Hartman
maintainerPATCH 125/131 IB/mlx5: Fix clean_mr() to work in the expected order
In reply to Greg Kroah-HartmanFrom: Yishai Hadas <[email protected]>
commit b9332dad987018745a0c0bb718d12dacfa760489 upstream.
Any dma map underlying the MR should only be freed once the MR is fenced at the hardware.
As of the above we first destroy the MKEY and just after that can safely call to dma_unmap_single().
--- drivers/infiniband/hw/mlx5/mr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx5/mr.c +3 -3
@@ -1583,10 +1583,10 @@ static void clean_mr(struct mlx5_ib_dev mr->sig =NULL ; } -mlx5_free_priv_descs (mr); - -if (!allocated_from_cache) +if (!allocated_from_cache) {destroy_mkey (dev, mr); +mlx5_free_priv_descs (mr); + } }static void dereg_mr (struct mlx5_ib_dev *dev,struct mlx5_ib_mr *mr)
Greg Kroah-Hartman
maintainerPATCH 126/131 IB/mlx5: Fix RSS Toeplitz setup to be aligned with the HW specification
In reply to Greg Kroah-HartmanFrom: Yishai Hadas <[email protected]>
commit b7165bd0d6cbb93732559be6ea8774653b204480 upstream.
The specification for the Toeplitz function doesn't require to set the key explicitly to be symmetric. In case a symmetric functionality is required a symmetric key can be simply used.
Wrongly forcing the algorithm to symmetric causes the wrong packet distribution and a performance degradation.
--- drivers/infiniband/hw/mlx5/qp.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +0 -1
@@ -1718,7 +1718,6 @@ static int create_rss_raw_qp_tir(struct }MLX5_SET (tirc, tirc, rx_hash_fn,MLX5_RX_HASH_FN_TOEPLITZ ); -MLX5_SET (tirc, tirc, rx_hash_symmetric,1 );memcpy (rss_key, ucmd.rx_hash_key, len);break ; }
Greg Kroah-Hartman
maintainerPATCH 127/131 IB/hfi1: Check for error on call to alloc_rsm_map_table
In reply to Greg Kroah-HartmanFrom: John Fleck <[email protected]>
commit cd48a82087231fdba0e77521102386c6ed0168d6 upstream.
The call to alloc_rsm_map_table does not check if the kmalloc fails. Check for a NULL on alloc, and bail if it fails.
--- drivers/infiniband/hw/hfi1/chip.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +9 -2
@@ -14452,7 +14452,7 @@ void hfi1_deinit_vnic_rsm(struct hfi1_declear_rcvctrl (dd,RCV_CTRL_RCV_RSM_ENABLE_SMASK ); } -static void init_rxe (struct hfi1_devdata *dd) +static int init_rxe (struct hfi1_devdata *dd) {struct rsm_map_table *rmt;u64 val;
@@ -14461,6 +14461,9 @@ static void init_rxe(struct hfi1_devdatawrite_csr (dd,RCV_ERR_MASK , ~0ull ); rmt =alloc_rsm_map_table (dd); +if (!rmt) +return -ENOMEM ; +/* set up QOS, including the QPN map table */ init_qos (dd, rmt);init_fecn_handling (dd, rmt);
@@ -14487,6 +14490,7 @@ static void init_rxe(struct hfi1_devdata val |= ((4ull &RCV_BYPASS_HDR_SIZE_MASK ) <<RCV_BYPASS_HDR_SIZE_SHIFT );write_csr (dd,RCV_BYPASS , val); +return 0 ; }static void init_other (struct hfi1_devdata *dd)
@@ -15024,7 +15028,10 @@ int hfi1_init_dd(struct hfi1_devdata *dd goto bail_cleanup;/* set initial RXE CSRs */ -init_rxe (dd); + ret =init_rxe (dd); +if (ret) + goto bail_cleanup; +/* set initial TXE CSRs */ init_txe (dd);/* set initial non-RXE, non-TXE CSRs */
Greg Kroah-Hartman
maintainerPATCH 128/131 IB/hfi1: Drop all TID RDMA READ RESP packets after r_next_psn
In reply to Greg Kroah-HartmanFrom: Kaike Wan <[email protected]>
commit f4d46119f214f9a7620b0d18b153d7e0e8c90b4f upstream.
When a TID sequence error occurs while receiving TID RDMA READ RESP packets, all packets after flow->flow_state.r_next_psn should be dropped, including those response packets for subsequent segments.
The current implementation will drop the subsequent response packets for the segment to complete next, but may accept packets for subsequent segments and therefore mistakenly advance the r_next_psn fields for the corresponding software flows. This may result in failures to complete subsequent segments after the current segment is completed.
The fix is to only use the flow pointed by req->clear_tail for checking KDETH PSN instead of finding a flow from the request's flow array.
--- drivers/infiniband/hw/hfi1/tid_rdma.c | 42 ---------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-)
drivers/infiniband/hw/hfi1/tid_rdma.c +1 -41
@@ -1673,34 +1673,6 @@ static struct tid_rdma_flow *find_flow_ireturn NULL ; } -static struct tid_rdma_flow * -__find_flow_ranged (struct tid_rdma_request *req,u16 head,u16 tail, -u32 psn,u16 *fidx) -{ -for ( ;CIRC_CNT (head, tail,MAX_FLOWS ); - tail =CIRC_NEXT (tail,MAX_FLOWS )) { -struct tid_rdma_flow *flow = &req->flows[tail]; -u32 spsn, lpsn; - - spsn =full_flow_psn (flow, flow->flow_state.spsn); - lpsn =full_flow_psn (flow, flow->flow_state.lpsn); - -if (cmp_psn (psn, spsn) >=0 &&cmp_psn (psn, lpsn) <=0 ) { -if (fidx) - *fidx = tail; -return flow; - } - } -return NULL ; -} - -static struct tid_rdma_flow *find_flow (struct tid_rdma_request *req, -u32 psn,u16 *fidx) -{ -return __find_flow_ranged (req, req->setup_head, req->clear_tail, psn, - fidx); -} -/* TID RDMA READ functions */ u32 hfi1_build_tid_rdma_read_packet(struct rvt_swqe *wqe, struct ib_other_headers *ohdr, u32 *bth1,
@@ -2790,19 +2762,7 @@ static bool handle_read_kdeth_eflags(str* to prevent continuous Flow Sequence errors for any * packets that could be still in the fabric. */ - flow =find_flow (req, psn,NULL ); -if (!flow) { -/* -* We can't find the IB PSN matching the -* received KDETH PSN. The only thing we can -* do at this point is report the error to -* the QP. -*/ -hfi1_kern_read_tid_flow_free (qp); -spin_unlock (&qp->s_lock); -rvt_rc_error (qp,IB_WC_LOC_QP_OP_ERR ); -return ret; - } + flow = &req->flows[req->clear_tail];if (priv->s_flags &HFI1_R_TID_SW_PSN ) { diff =cmp_psn (psn, flow->flow_state.r_next_psn);
Greg Kroah-Hartman
maintainerPATCH 129/131 IB/hfi1: Field not zero-ed when allocating TID flow memory
In reply to Greg Kroah-HartmanFrom: Kaike Wan <[email protected]>
commit dc25b239ebeaa3c58e5ceaa732140427d386aa16 upstream.
The field flow->resync_npkts is added for TID RDMA WRITE request and zero-ed when a TID RDMA WRITE RESP packet is received by the requester. This field is used to rewind a request during retry in the function hfi1_tid_rdma_restart_req() shared by both TID RDMA WRITE and TID RDMA READ requests. Therefore, when a TID RDMA READ request is retried, this field may not be initialized at all, which causes the retry to start at an incorrect psn, leading to the drop of the retry request by the responder.
This patch fixes the problem by zeroing out the field when the flow memory is allocated.
--- drivers/infiniband/hw/hfi1/tid_rdma.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hfi1/tid_rdma.c +1 -0
@@ -1620,6 +1620,7 @@ static int hfi1_kern_exp_rcv_alloc_flows flows[i].req = req; flows[i].npagesets =0 ; flows[i].pagesets[0 ].mapped =0 ; + flows[i].resync_npkts =0 ; } req->flows = flows;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 130/131 drm/i915/perf: fix ICL perf register offsets
In reply to Greg Kroah-HartmanFrom: Lionel Landwerlin <[email protected]>
commit 95eef14cdad150fed43147bcd4f29eea3d0a3f03 upstream.
We got the wrong offsets (could they have changed?). New values were computed off an error state by looking up the register offset in the context image as written by the HW.
--- drivers/gpu/drm/i915/i915_perf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +7 -3
@@ -3457,9 +3457,13 @@ void i915_perf_init(struct drm_i915_priv dev_priv->perf.oa.ops.enable_metric_set = gen8_enable_metric_set; dev_priv->perf.oa.ops.disable_metric_set = gen10_disable_metric_set; - dev_priv->perf.oa.ctx_oactxctrl_offset =0x128 ; - dev_priv->perf.oa.ctx_flexeu0_offset =0x3de ; - +if (IS_GEN (dev_priv,10 )) { + dev_priv->perf.oa.ctx_oactxctrl_offset =0x128 ; + dev_priv->perf.oa.ctx_flexeu0_offset =0x3de ; + }else { + dev_priv->perf.oa.ctx_oactxctrl_offset =0x124 ; + dev_priv->perf.oa.ctx_flexeu0_offset =0x78e ; + } dev_priv->perf.oa.gen8_valid_ctx_bit = (1 <<16 ); } }
Greg Kroah-Hartman
maintainerPATCH 131/131 drm/i915/gvt: fix incorrect cache entry for guest page mapping
In reply to Greg Kroah-HartmanFrom: Xiaolin Zhang <[email protected]>
commit 7366aeb77cd840f3edea02c65065d40affaa7f45 upstream.
GPU hang observed during the guest OCL conformance test which is caused by THP GTT feature used durning the test.
It was observed the same GFN with different size (4K and 2M) requested from the guest in GVT. So during the guest page dma map stage, it is required to unmap first with orginal size and then remap again with requested size.
--- drivers/gpu/drm/i915/gvt/kvmgt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/i915/gvt/kvmgt.c +12 -0
@@ -1911,6 +1911,18 @@ static int kvmgt_dma_map_guest_page(unsi ret =__gvt_cache_add (info->vgpu, gfn, *dma_addr, size);if (ret) goto err_unmap; + }else if (entry->size != size) { +/* the same gfn with different size: unmap and re-map */ +gvt_dma_unmap_page (vgpu, gfn, entry->dma_addr, entry->size); +__gvt_cache_remove_entry (vgpu, entry); + + ret =gvt_dma_map_page (vgpu, gfn, dma_addr, size); +if (ret) + goto err_unlock; + + ret =__gvt_cache_add (info->vgpu, gfn, *dma_addr, size); +if (ret) + goto err_unmap; }else {kref_get (&entry->ref); *dma_addr = entry->dma_addr;
stable-rc/linux-5.2.y boot: 134 boots: 0 failed, 93 passed with 41 offline (v5.2.6-132-ga312bfbb74da)
stable-rc/linux-5.2.y boot: 134 boots: 0 failed, 93 passed with 41 offline (v5.2.6-132-ga312bfbb74da)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-5.2.y/kernel/v5.2.6-132-ga312bfbb74da/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-5.2.y/kernel/v5.2.6-132-ga312bfbb74da/
Tree: stable-rc
Branch: linux-5.2.y
Git Describe: v5.2.6-132-ga312bfbb74da
Git Commit: a312bfbb74da87b0c6822845b2cb9932d43c9208
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 77 unique boards, 28 SoC families, 17 builds out of 209
Boot Regressions Detected:
arm:
qcom_defconfig:
gcc-8:
qcom-apq8064-cm-qs600:
lab-baylibre-seattle: failing since 1 day (last pass: v5.2.4-235-g44397d30b22d - first fail: v5.2.6)
qcom-apq8064-ifc6410:
lab-baylibre-seattle: failing since 1 day (last pass: v5.2.4-235-g44397d30b22d - first fail: v5.2.6)
sunxi_defconfig:
gcc-8:
sun4i-a10-cubieboard:
lab-baylibre-seattle: failing since 1 day (last pass: v5.2.4-235-g44397d30b22d - first fail: v5.2.6)
sun5i-r8-chip:
lab-baylibre-seattle: failing since 1 day (last pass: v5.2.4-235-g44397d30b22d - first fail: v5.2.6)
sun7i-a20-bananapi:
lab-baylibre-seattle: failing since 1 day (last pass: v5.2.4-235-g44397d30b22d - first fail: v5.2.6)Offline Platforms:
riscv:
defconfig:
gcc-8
sifive_fu540: 1 offline lab
arm64:
defconfig:
gcc-8
apq8016-sbc: 1 offline lab
meson-axg-s400: 1 offline lab
meson-g12a-u200: 1 offline lab
meson-g12a-x96-max: 1 offline lab
meson-gxbb-odroidc2: 1 offline lab
meson-gxl-s905d-p230: 1 offline lab
meson-gxl-s905x-libretech-cc: 1 offline lab
meson-gxl-s905x-nexbox-a95x: 1 offline lab
meson-gxl-s905x-p212: 1 offline lab
meson-gxm-nexbox-a1: 1 offline lab
rk3399-firefly: 1 offline lab
sun50i-a64-pine64-plus: 1 offline labmips:
pistachio_defconfig:
gcc-8
pistachio_marduk: 1 offline lab
arm:
exynos_defconfig:
gcc-8
exynos5250-arndale: 1 offline lab
exynos5800-peach-pi: 1 offline lab
multi_v7_defconfig:
gcc-8
bcm4708-smartrg-sr400ac: 1 offline lab
bcm72521-bcm97252sffe: 1 offline lab
bcm7445-bcm97445c: 1 offline lab
exynos5800-peach-pi: 1 offline lab
imx6dl-wandboard_solo: 1 offline lab
imx6q-wandboard: 1 offline lab
imx7s-warp: 1 offline lab
meson8b-odroidc1: 1 offline lab
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline lab
stih410-b2120: 1 offline lab
sun4i-a10-cubieboard: 1 offline lab
sun5i-r8-chip: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
vf610-colibri-eval-v3: 1 offline lab
qcom_defconfig:
gcc-8
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline lab
davinci_all_defconfig:
gcc-8
da850-evm: 1 offline lab
dm365evm,legacy: 1 offline lab
imx_v6_v7_defconfig:
gcc-8
imx6dl-wandboard_solo: 1 offline lab
imx7s-warp: 1 offline lab
vf610-colibri-eval-v3: 1 offline lab
sunxi_defconfig:
gcc-8
sun4i-a10-cubieboard: 1 offline lab
sun5i-r8-chip: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
---
For more info write to <[email protected]>
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. 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/v5.x/stable-review/patch-5.2.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 15 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. 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/v5.x/stable-review/patch-5.2.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing all of these and letting me know.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.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: 5.2.7-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.2.y
git commit: 22499a2919399df3cd619a46afd6a90a731892f0
git describe: v5.2.6-132-g22499a291939
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.2-oe/build/v5.2.6-132-g22499a291939
No regressions (compared to build v5.2.6)
No fixes (compared to build v5.2.6)
Ran 24113 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libgpiod
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* network-basic-tests
* ltp-open-posix-tests
* kvm-unit-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 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. 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/v5.x/stable-review/patch-5.2.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Thanks for testing all 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 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. Anything received after that time might be too late.
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 364 pass: 364 fail: 0
Guenter
Greg Kroah-Hartman
maintainerQuoted 6 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.7 release. There are 131 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.
Quoted 8 lines
Quoted 3 lines
Responses should be made by Wed 07 Aug 2019 12:47:58 PM UTC. Anything received after that time might be too late.
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 364 pass: 364 fail: 0
Wonderful, thanks for testing all of these and letting me know.
greg k-h
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.2:
12 builds: 12 pass, 0 fail
22 boots: 22 pass, 0 fail
38 tests: 38 pass, 0 failLinux version: 5.2.7-rc1-g22499a291939
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 23 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.7 release. There are 131 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 07 Aug 2019 12:47:58 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.2:
Quoted 8 lines
12 builds: 12 pass, 0 fail 22 boots: 22 pass, 0 fail 38 tests: 38 pass, 0 failLinux version: 5.2.7-rc1-g22499a291939
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,tegra194-p2972-0000, tegra20-ventana, tegra210-p2371-2180, tegra30-cardhu-a04
Thanks for testing all of these and letting me know.
greg k-h