90264576e2
* refs/heads/tmp-a483478: UPSTREAM: arm64: vdso: Build vDSO with -ffixed-x18 Revert "drm/dsi: Fix byte order of DCS set/get brightness" Reverting below patches from android-4.19-stable.125 Linux 4.19.125 rxrpc: Fix ack discard rxrpc: Trace discarded ACKs iio: adc: stm32-dfsdm: fix device used to request dma iio: adc: stm32-dfsdm: Use dma_request_chan() instead dma_request_slave_channel() iio: adc: stm32-adc: fix device used to request dma iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel() x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks rxrpc: Fix a memory leak in rxkad_verify_response() rapidio: fix an error in get_user_pages_fast() error handling ipack: tpci200: fix error return code in tpci200_register() mei: release me_cl object reference misc: rtsx: Add short delay after exit from ASPM iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()' iio: sca3000: Remove an erroneous 'get_device()' staging: greybus: Fix uninitialized scalar variable staging: iio: ad2s1210: Fix SPI reading Revert "gfs2: Don't demote a glock until its revokes are written" brcmfmac: abort and release host after error tty: serial: qcom_geni_serial: Fix wrap around of TX buffer cxgb4/cxgb4vf: Fix mac_hlist initialization and free cxgb4: free mac_hlist properly net: bcmgenet: abort suspend on error net: bcmgenet: code movement Revert "net/ibmvnic: Fix EOI when running in XIVE mode" media: fdp1: Fix R-Car M3-N naming in debug message thunderbolt: Drop duplicated get_switch_at_route() staging: most: core: replace strcpy() by strscpy() libnvdimm/btt: Fix LBA masking during 'free list' population libnvdimm/btt: Remove unnecessary code in btt_freelist_init nfit: Add Hyper-V NVDIMM DSM command set to white list powerpc/64s: Disable STRICT_KERNEL_RWX powerpc: Remove STRICT_KERNEL_RWX incompatibility with RELOCATABLE drm/i915/gvt: Init DPLL/DDI vreg for virtual display instead of inheritance. dmaengine: owl: Use correct lock in owl_dma_get_pchan() dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()' apparmor: Fix aa_label refcnt leak in policy_update apparmor: fix potential label refcnt leak in aa_change_profile apparmor: Fix use-after-free in aa_audit_rule_init drm/etnaviv: fix perfmon domain interation ALSA: hda/realtek - Add more fixup entries for Clevo machines ALSA: hda/realtek - Fix silent output on Gigabyte X570 Aorus Xtreme ALSA: pcm: fix incorrect hw_base increase ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option padata: purge get_cpu and reorder_via_wq from padata_do_serial padata: initialize pd->cpu with effective cpumask padata: Replace delayed timer with immediate workqueue in padata_reorder ARM: futex: Address build warning platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA USB: core: Fix misleading driver bug report stmmac: fix pointer check after utilization in stmmac_interrupt ceph: fix double unlock in handle_cap_export() HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K12A keyboard-dock gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp() x86/apic: Move TSC deadline timer debug printk HID: i2c-hid: reset Synaptics SYNA2393 on resume scsi: ibmvscsi: Fix WARN_ON during event pool release component: Silence bind error on -EPROBE_DEFER aquantia: Fix the media type of AQC100 ethernet controller in the driver vhost/vsock: fix packet delivery order to monitoring devices configfs: fix config_item refcnt leak in configfs_rmdir() scsi: qla2xxx: Delete all sessions before unregister local nvme port scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead HID: alps: Add AUI1657 device ID HID: multitouch: add eGalaxTouch P80H84 support gcc-common.h: Update for GCC 10 ubi: Fix seq_file usage in detailed_erase_block_info debugfs file i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()' iommu/amd: Fix over-read of ACPI UID from IVRS table ubifs: remove broken lazytime support fix multiplication overflow in copy_fdtable() mtd: spinand: Propagate ECC information to the MTD structure ima: Fix return value of ima_write_policy() evm: Check also if *tfm is an error pointer in init_desc() ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash() riscv: set max_pfn to the PFN of the last page KVM: SVM: Fix potential memory leak in svm_cpu_init() i2c: dev: Fix the race between the release of i2c_dev and cdev ubsan: build ubsan.c more conservatively x86/uaccess, ubsan: Fix UBSAN vs. SMAP ANDROID: scsi: ufs: Handle clocks when lrbp fails ANDROID: fscrypt: handle direct I/O with IV_INO_LBLK_32 BACKPORT: FROMLIST: fscrypt: add support for IV_INO_LBLK_32 policies ANDROID: Update the ABI xml and qcom whitelist ANDROID: Fix build.config.gki-debug Linux 4.19.124 Makefile: disallow data races on gcc-10 as well KVM: x86: Fix off-by-one error in kvm_vcpu_ioctl_x86_setup_mce ARM: dts: r8a7740: Add missing extal2 to CPG node arm64: dts: renesas: r8a77980: Fix IPMMU VIP[01] nodes ARM: dts: r8a73a4: Add missing CMT1 interrupts arm64: dts: rockchip: Rename dwc3 device nodes on rk3399 to make dtc happy arm64: dts: rockchip: Replace RK805 PMIC node name with "pmic" on rk3328 boards clk: Unlink clock if failed to prepare or enable Revert "ALSA: hda/realtek: Fix pop noise on ALC225" usb: gadget: legacy: fix error return code in cdc_bind() usb: gadget: legacy: fix error return code in gncm_bind() usb: gadget: audio: Fix a missing error return value in audio_bind() usb: gadget: net2272: Fix a memory leak in an error handling path in 'net2272_plat_probe()' dwc3: Remove check for HWO flag in dwc3_gadget_ep_reclaim_trb_sg() clk: rockchip: fix incorrect configuration of rk3228 aclk_gpu* clocks exec: Move would_dump into flush_old_exec x86/unwind/orc: Fix error handling in __unwind_start() x86: Fix early boot crash on gcc-10, third try cifs: fix leaked reference on requeued write ARM: dts: imx27-phytec-phycard-s-rdk: Fix the I2C1 pinctrl entries ARM: dts: dra7: Fix bus_dma_limit for PCIe usb: xhci: Fix NULL pointer dereference when enqueuing trbs from urb sg list USB: gadget: fix illegal array access in binding with UDC usb: host: xhci-plat: keep runtime active when removing host usb: core: hub: limit HUB_QUIRK_DISABLE_AUTOSUSPEND to USB5534B ALSA: usb-audio: Add control message quirk delay for Kingston HyperX headset ALSA: rawmidi: Fix racy buffer resize under concurrent accesses ALSA: hda/realtek - Limit int mic boost for Thinkpad T530 gcc-10: avoid shadowing standard library 'free()' in crypto gcc-10: disable 'restrict' warning for now gcc-10: disable 'stringop-overflow' warning for now gcc-10: disable 'array-bounds' warning for now gcc-10: disable 'zero-length-bounds' warning for now Stop the ad-hoc games with -Wno-maybe-initialized kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig gcc-10 warnings: fix low-hanging fruit pnp: Use list_for_each_entry() instead of open coding hwmon: (da9052) Synchronize access with mfd IB/mlx4: Test return value of calls to ib_get_cached_pkey netfilter: nft_set_rbtree: Introduce and use nft_rbtree_interval_start() arm64: fix the flush_icache_range arguments in machine_kexec netfilter: conntrack: avoid gcc-10 zero-length-bounds warning NFSv4: Fix fscache cookie aux_data to ensure change_attr is included nfs: fscache: use timespec64 in inode auxdata NFS: Fix fscache super_cookie index_key from changing after umount mmc: block: Fix request completion in the CQE timeout path mmc: core: Check request type before completing the request i40iw: Fix error handling in i40iw_manage_arp_cache() pinctrl: cherryview: Add missing spinlock usage in chv_gpio_irq_handler pinctrl: baytrail: Enable pin configuration setting for GPIO chip gfs2: Another gfs2_walk_metadata fix ALSA: hda/realtek - Fix S3 pop noise on Dell Wyse ipc/util.c: sysvipc_find_ipc() incorrectly updates position index drm/qxl: lost qxl_bo_kunmap_atomic_page in qxl_image_init_helper() ALSA: hda/hdmi: fix race in monitor detection during probe cpufreq: intel_pstate: Only mention the BIOS disabling turbo mode once dmaengine: mmp_tdma: Reset channel error on release dmaengine: pch_dma.c: Avoid data race between probe and irq handler riscv: fix vdso build with lld tcp: fix SO_RCVLOWAT hangs with fat skbs net: tcp: fix rx timestamp behavior for tcp_recvmsg netprio_cgroup: Fix unlimited memory leak of v2 cgroups net: ipv4: really enforce backoff for redirects net: dsa: loop: Add module soft dependency hinic: fix a bug of ndo_stop virtio_net: fix lockdep warning on 32 bit tcp: fix error recovery in tcp_zerocopy_receive() Revert "ipv6: add mtu lock check in __ip6_rt_update_pmtu" pppoe: only process PADT targeted at local interfaces net: phy: fix aneg restart in phy_ethtool_set_eee netlabel: cope with NULL catmap net: fix a potential recursive NETDEV_FEAT_CHANGE mmc: sdhci-acpi: Add SDHCI_QUIRK2_BROKEN_64_BIT_DMA for AMDI0040 scsi: sg: add sg_remove_request in sg_write virtio-blk: handle block_device_operations callbacks after hot unplug drop_monitor: work around gcc-10 stringop-overflow warning net: moxa: Fix a potential double 'free_irq()' net/sonic: Fix a resource leak in an error handling path in 'jazz_sonic_probe()' shmem: fix possible deadlocks on shmlock_user_lock net: dsa: Do not make user port errors fatal ANDROID: rtc: class: call hctosys in resource managed registration ANDROID: GKI: Update the ABI xml and whitelist ANDROID: power_supply: Add RTX power-supply property f2fs: flush dirty meta pages when flushing them f2fs: fix checkpoint=disable:%u%% f2fs: rework filename handling f2fs: split f2fs_d_compare() from f2fs_match_name() f2fs: don't leak filename in f2fs_try_convert_inline_dir() ANDROID: clang: update to 11.0.1 FROMLIST: x86_64: fix jiffies ODR violation ANDROID: arm64: vdso: Fix removing SCS flags ANDROID: GKI: Update the ABI xml and whitelist ANDROID: Incremental fs: wake up log pollers less often ANDROID: Incremental fs: Fix scheduling while atomic error ANDROID: Incremental fs: Avoid continually recalculating hashes ANDROID: export: Disable symbol trimming on modules ANDROID: GKI: Update the ABI xml and whitelist ANDROID: fscrypt: set dun_bytes more precisely ANDROID: dm-default-key: set dun_bytes more precisely ANDROID: block: backport the ability to specify max_dun_bytes ANDROID: Revert "ANDROID: GKI: gki_defconfig: CONFIG_DM_DEFAULT_KEY=m" Linux 4.19.123 ipc/mqueue.c: change __do_notify() to bypass check_kill_permission() scripts/decodecode: fix trapping instruction formatting objtool: Fix stack offset tracking for indirect CFAs netfilter: nf_osf: avoid passing pointer to local var netfilter: nat: never update the UDP checksum when it's 0 x86/unwind/orc: Fix premature unwind stoppage due to IRET frames x86/unwind/orc: Fix error path for bad ORC entry type x86/unwind/orc: Prevent unwinding before ORC initialization x86/unwind/orc: Don't skip the first frame for inactive tasks x86/entry/64: Fix unwind hints in rewind_stack_do_exit() x86/entry/64: Fix unwind hints in kernel exit path x86/entry/64: Fix unwind hints in register clearing code batman-adv: Fix refcnt leak in batadv_v_ogm_process batman-adv: Fix refcnt leak in batadv_store_throughput_override batman-adv: Fix refcnt leak in batadv_show_throughput_override batman-adv: fix batadv_nc_random_weight_tq KVM: VMX: Mark RCX, RDX and RSI as clobbered in vmx_vcpu_run()'s asm blob KVM: VMX: Explicitly reference RCX as the vmx_vcpu pointer in asm blobs coredump: fix crash when umh is disabled staging: gasket: Check the return value of gasket_get_bar_index() mm/page_alloc: fix watchdog soft lockups during set_zone_contiguous() arm64: hugetlb: avoid potential NULL dereference KVM: arm64: Fix 32bit PC wrap-around KVM: arm: vgic: Fix limit condition when writing to GICD_I[CS]ACTIVER tracing: Add a vmalloc_sync_mappings() for safe measure USB: serial: garmin_gps: add sanity checking for data length USB: uas: add quirk for LaCie 2Big Quadra HID: usbhid: Fix race between usbhid_close() and usbhid_stop() sctp: Fix bundling of SHUTDOWN with COOKIE-ACK HID: wacom: Read HID_DG_CONTACTMAX directly for non-generic devices net: stricter validation of untrusted gso packets bnxt_en: Fix VF anti-spoof filter setup. bnxt_en: Improve AER slot reset. net/mlx5: Fix command entry leak in Internal Error State net/mlx5: Fix forced completion access non initialized command entry bnxt_en: Fix VLAN acceleration handling in bnxt_fix_features(). tipc: fix partial topology connection closure sch_sfq: validate silly quantum values sch_choke: avoid potential panic in choke_reset() net: usb: qmi_wwan: add support for DW5816e net_sched: sch_skbprio: add message validation to skbprio_change() net/mlx4_core: Fix use of ENOSPC around mlx4_counter_alloc() net: macsec: preserve ingress frame ordering fq_codel: fix TCA_FQ_CODEL_DROP_BATCH_SIZE sanity checks dp83640: reverse arguments to list_add_tail vt: fix unicode console freeing with a common interface tracing/kprobes: Fix a double initialization typo USB: serial: qcserial: Add DW5816e support ANDROID: usb: gadget: Add missing inline qualifier to stub functions ANDROID: Drop ABI monitoring from KASAN build config ANDROID: Rename build.config.gki.arch_kasan ANDROID: GKI: Enable CONFIG_STATIC_USERMODEHELPER ANDROID: dm-default-key: Update key size for wrapped keys ANDROID: gki_defconfig: enable CONFIG_MMC_CRYPTO ANDROID: mmc: MMC crypto API ANDROID: GKI: Update the ABI xml and whitelist ANDROID: GKI: add missing exports for cam_smmu_api.ko Linux 4.19.122 drm/atomic: Take the atomic toys away from X cgroup, netclassid: remove double cond_resched mac80211: add ieee80211_is_any_nullfunc() platform/x86: GPD pocket fan: Fix error message when temp-limits are out of range ALSA: hda: Match both PCI ID and SSID for driver blacklist hexagon: define ioremap_uc hexagon: clean up ioremap mfd: intel-lpss: Use devm_ioremap_uc for MMIO lib: devres: add a helper function for ioremap_uc drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event sctp: Fix SHUTDOWN CTSN Ack in the peer restart case net: systemport: suppress warnings on failed Rx SKB allocations net: bcmgenet: suppress warnings on failed Rx SKB allocations lib/mpi: Fix building for powerpc with clang scripts/config: allow colons in option strings for sed s390/ftrace: fix potential crashes when switching tracers cifs: protect updating server->dstaddr with a spinlock ASoC: rsnd: Fix "status check failed" spam for multi-SSI ASoC: rsnd: Don't treat master SSI in multi SSI setup as parent net: stmmac: Fix sub-second increment net: stmmac: fix enabling socfpga's ptp_ref_clock wimax/i2400m: Fix potential urb refcnt leak drm/amdgpu: Correctly initialize thermal controller for GPUs with Powerplay table v0 (e.g Hawaii) ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode usb: dwc3: gadget: Properly set maxpacket limit ASoC: sgtl5000: Fix VAG power-on handling selftests/ipc: Fix test failure seen after initial test run ASoC: topology: Check return value of pcm_new_ver powerpc/pci/of: Parse unassigned resources vhost: vsock: kick send_pkt worker once device is started ANDROID: GKI: fix build warning on 32bits due to ASoC msm change ANDROID: GKI: fix build error on 32bits due to ASoC msm change ANDROID: GKI: update abi definition due to FAIR_GROUP_SCHED removal ANDROID: GKI: Remove FAIR_GROUP_SCHED ANDROID: GKI: BULK update ABI XML representation and qcom whitelist ANDROID: build.config.gki.aarch64: Enable WHITELIST_STRICT_MODE ANDROID: GKI: Update the ABI xml and qcom whitelist ANDROID: remove unused variable ANDROID: Drop ABI monitoring from KASAN build config Linux 4.19.121 mmc: meson-mx-sdio: remove the broken ->card_busy() op mmc: meson-mx-sdio: Set MMC_CAP_WAIT_WHILE_BUSY mmc: sdhci-msm: Enable host capabilities pertains to R1b response mmc: sdhci-pci: Fix eMMC driver strength for BYT-based controllers mmc: sdhci-xenon: fix annoying 1.8V regulator warning mmc: cqhci: Avoid false "cqhci: CQE stuck on" by not open-coding timeout loop btrfs: transaction: Avoid deadlock due to bad initialization timing of fs_info::journal_info btrfs: fix partial loss of prealloc extent past i_size after fsync selinux: properly handle multiple messages in selinux_netlink_send() dmaengine: dmatest: Fix iteration non-stop logic nfs: Fix potential posix_acl refcnt leak in nfs3_set_acl ALSA: opti9xx: shut up gcc-10 range warning iommu/amd: Fix legacy interrupt remapping for x2APIC-enabled system scsi: target/iblock: fix WRITE SAME zeroing iommu/qcom: Fix local_base status check vfio/type1: Fix VA->PA translation for PFNMAP VMAs in vaddr_get_pfn() vfio: avoid possible overflow in vfio_iommu_type1_pin_pages RDMA/core: Fix race between destroy and release FD object RDMA/core: Prevent mixed use of FDs between shared ufiles RDMA/mlx4: Initialize ib_spec on the stack RDMA/mlx5: Set GRH fields in query QP on RoCE scsi: qla2xxx: check UNLOADING before posting async work scsi: qla2xxx: set UNLOADING before waiting for session deletion dm multipath: use updated MPATHF_QUEUE_IO on mapping for bio-based mpath dm writecache: fix data corruption when reloading the target dm verity fec: fix hash block number in verity_fec_decode PM: hibernate: Freeze kernel threads in software_resume() PM: ACPI: Output correct message on target power state ALSA: pcm: oss: Place the plugin buffer overflow checks correctly ALSA: hda/hdmi: fix without unlocked before return ALSA: usb-audio: Correct a typo of NuPrime DAC-10 USB ID ALSA: hda/realtek - Two front mics on a Lenovo ThinkCenter btrfs: fix block group leak when removing fails drm/qxl: qxl_release use after free drm/qxl: qxl_release leak in qxl_hw_surface_alloc() drm/qxl: qxl_release leak in qxl_draw_dirty_fb() drm/edid: Fix off-by-one in DispID DTD pixel clock ANDROID: GKI: Bulk update ABI XML representation ANDROID: GKI: Enable net testing options ANDROID: gki_defconfig: Enable CONFIG_REMOTEPROC ANDROID: Rename build.config.gki.arch_kasan ANDROID: GKI: Update ABI for IOMMU ANDROID: Incremental fs: Fix issues with very large files ANDROID: Correct build.config branch name ANDROID: GKI: Bulk update ABI XML representation and whitelist. UPSTREAM: vdso: Fix clocksource.h macro detection ANDROID: GKI: update abi definition due to added padding ANDROID: GKI: networking: add Android ABI padding to a lot of networking structures ANDROID: GKI: dma-mapping.h: add Android ABI padding to a structure ANDROID: GKI: ioport.h: add Android ABI padding to a structure ANDROID: GKI: iomap.h: add Android ABI padding to a structure ANDROID: GKI: genhd.h: add Android ABI padding to some structures ANDROID: GKI: hrtimer.h: add Android ABI padding to a structure ANDROID: GKI: ethtool.h: add Android ABI padding to a structure ANDROID: GKI: sched: add Android ABI padding to some structures ANDROID: GKI: kernfs.h: add Android ABI padding to some structures ANDROID: GKI: kobject.h: add Android ABI padding to some structures ANDROID: GKI: mm.h: add Android ABI padding to a structure ANDROID: GKI: mmu_notifier.h: add Android ABI padding to some structures ANDROID: GKI: pci: add Android ABI padding to some structures ANDROID: GKI: irqdomain.h: add Android ABI padding to a structure ANDROID: GKI: blk_types.h: add Android ABI padding to a structure ANDROID: GKI: scsi.h: add Android ABI padding to a structure ANDROID: GKI: quota.h: add Android ABI padding to some structures ANDROID: GKI: timer.h: add Android ABI padding to a structure ANDROID: GKI: user_namespace.h: add Android ABI padding to a structure FROMGIT: f2fs: fix missing check for f2fs_unlock_op Linux 4.19.120 propagate_one(): mnt_set_mountpoint() needs mount_lock ext4: check for non-zero journal inum in ext4_calculate_overhead qed: Fix use after free in qed_chain_free bpf, x86_32: Fix clobbering of dst for BPF_JSET hwmon: (jc42) Fix name to have no illegal characters ext4: convert BUG_ON's to WARN_ON's in mballoc.c ext4: increase wait time needed before reuse of deleted inode numbers ext4: use matching invalidatepage in ext4_writepage arm64: Delete the space separator in __emit_inst ALSA: hda: call runtime_allow() for all hda controllers xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status objtool: Support Clang non-section symbols in ORC dump objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings scsi: target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN scsi: target: fix PR IN / READ FULL STATUS for FC ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported ALSA: hda: Keep the controller initialization even if no codecs found xfs: fix partially uninitialized structure in xfs_reflink_remap_extent x86: hyperv: report value of misc_features net: fec: set GPR bit on suspend by DT configuration. bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX BPF_B xfs: clear PF_MEMALLOC before exiting xfsaild thread mm: shmem: disable interrupt when acquiring info->lock in userfaultfd_copy path bpf, x86_32: Fix incorrect encoding in BPF_LDX zero-extension perf/core: fix parent pid/tid in task exit events net/mlx5: Fix failing fw tracer allocation on s390 cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled ARM: dts: bcm283x: Disable dsi0 node PCI: Move Apex Edge TPU class quirk to fix BAR assignment PCI: Avoid ASMedia XHCI USB PME# from D0 defect svcrdma: Fix leak of svc_rdma_recv_ctxt objects svcrdma: Fix trace point use-after-free race xfs: acquire superblock freeze protection on eofblocks scans net/cxgb4: Check the return from t4_query_params properly rxrpc: Fix DATA Tx to disable nofrag for UDP on AF_INET6 socket i2c: altera: use proper variable to hold errno nfsd: memory corruption in nfsd4_lock() ASoC: wm8960: Fix wrong clock after suspend & resume ASoC: tas571x: disable regulators on failed probe ASoC: q6dsp6: q6afe-dai: add missing channels to MI2S DAIs iio:ad7797: Use correct attribute_group usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete usb: dwc3: gadget: Do link recovery for SS and SSP binder: take read mode of mmap_sem in binder_alloc_free_page() include/uapi/linux/swab.h: fix userspace breakage, use __BITS_PER_LONG for swap mtd: cfi: fix deadloop in cfi_cmdset_0002.c do_write_buffer remoteproc: Fix wrong rvring index computation FROMLIST: PM / devfreq: Restart previous governor if new governor fails to start ANDROID: GKI: arm64: Enable GZIP and LZ4 kernel compression modes ANDROID: GKI: arm64: gki_defconfig: Set arm_smmu configuration ANDROID: GKI: iommu/arm-smmu: Modularize ARM SMMU driver ANDROID: GKI: iommu: Snapshot of vendor changes ANDROID: GKI: Additions to ARM SMMU register definitions ANDROID: GKI: iommu/io-pgtable-arm: LPAE related updates by vendor ANDROID: GKI: common: dma-mapping: make dma_common_contiguous_remap more robust ANDROID: GKI: dma-coherent: Expose device base address and size ANDROID: GKI: arm64: add support for NO_KERNEL_MAPPING and STRONGLY_ORDERED ANDROID: GKI: dma-mapping: Add dma_remap functions ANDROID: GKI: arm64: Support early fixup for CMA ANDROID: GKI: iommu: dma-mapping-fast: Fast ARMv7/v8 Long Descriptor Format ANDROID: GKI: arm64: dma-mapping: add support for IOMMU mapper ANDROID: GKI: add ARCH_NR_GPIO for ABI match ANDROID: GKI: kernel: Export symbol of `cpu_do_idle` ANDROID: GKI: kernel: Export symbols needed by msm_minidump.ko and minidump_log.ko (again) ANDROID: GKI: add missing exports for __flush_dcache_area ANDROID: GKI: arm64: Export caching APIs ANDROID: GKI: arm64: provide dma cache routines with same API as 32 bit ANDROID: gki_defconfig: add FORTIFY_SOURCE, remove SPMI_MSM_PMIC_ARB Revert "ANDROID: GKI: spmi: pmic-arb: don't enable SPMI_MSM_PMIC_ARB by default" ANDROID: GKI: update abi definitions after adding padding ANDROID: GKI: elevator: add Android ABI padding to some structures ANDROID: GKI: dentry: add Android ABI padding to some structures ANDROID: GKI: bio: add Android ABI padding to some structures ANDROID: GKI: scsi: add Android ABI padding to some structures ANDROID: GKI: ufs: add Android ABI padding to some structures ANDROID: GKI: workqueue.h: add Android ABI padding to some structures ANDROID: GKI: fs.h: add Android ABI padding to some structures ANDROID: GKI: USB: add Android ABI padding to some structures ANDROID: GKI: mm: add Android ABI padding to some structures ANDROID: GKI: mount.h: add Android ABI padding to some structures ANDROID: GKI: sched.h: add Android ABI padding to some structures ANDROID: GKI: sock.h: add Android ABI padding to some structures ANDROID: GKI: module.h: add Android ABI padding to some structures ANDROID: GKI: device.h: add Android ABI padding to some structures ANDROID: GKI: phy: add Android ABI padding to some structures ANDROID: GKI: add android_kabi.h ANDROID: ABI: update due to previous changes in the tree BACKPORT: sched/core: Fix reset-on-fork from RT with uclamp ANDROID: GKI: Add support for missing V4L2 symbols ANDROID: GKI: Bulk update ABI XML representation ANDROID: GKI: arm64: psci: Support for OS initiated scheme ANDROID: GKI: net: add counter for number of frames coalesced in GRO ANDROID: GKI: cfg80211: Include length of kek in rekey data BACKPORT: loop: change queue block size to match when using DIO ANDROID: Incremental fs: Add setattr call ANDROID: GKI: enable CONFIG_RTC_SYSTOHC ANDROID: GKI: ipv4: add vendor padding to __IPV4_DEVCONF_* enums Revert "ANDROID: GKI: ipv4: increase __IPV4_DEVCONF_MAX to 64" ANDROID: driver: gpu: drm: fix export symbol types ANDROID: SoC: core: fix export symbol type ANDROID: ufshcd-crypto: fix export symbol type ANDROID: GKI: drivers: mailbox: fix race resulting in multiple message submission ANDROID: GKI: arm64: gki_defconfig: Enable a few thermal configs Revert "ANDROID: GKI: add base.h include to match MODULE_VERSIONS" FROMLIST: thermal: Make cooling device trip point writable from sysfs ANDROID: GKI: drivers: thermal: cpu_cooling: Use CPU ID as cooling device ID ANDROID: GKI: PM / devfreq: Allow min freq to be 0 ANDROID: GKI: arm64: gki_defconfig: Enable REGULATOR_PROXY_CONSUMER ANDROID: GKI: Bulk Update ABI XML representation ANDROID: KASAN support for GKI remove CONFIG_CC_WERROR ANDROID: KASAN support for GKI ANDROID: virt_wifi: fix export symbol types ANDROID: vfs: fix export symbol type ANDROID: vfs: fix export symbol types ANDROID: fscrypt: fix export symbol type ANDROID: cfi: fix export symbol types ANDROID: bpf: fix export symbol type Linux 4.19.119 s390/mm: fix page table upgrade vs 2ndary address mode accesses xfs: Fix deadlock between AGI and AGF with RENAME_WHITEOUT serial: sh-sci: Make sure status register SCxSR is read in correct sequence xhci: prevent bus suspend if a roothub port detected a over-current condition usb: f_fs: Clear OS Extended descriptor counts to zero in ffs_data_reset() usb: dwc3: gadget: Fix request completion check UAS: fix deadlock in error handling and PM flushing work UAS: no use logging any details in case of ENODEV cdc-acm: introduce a cool down cdc-acm: close race betrween suspend() and acm_softint staging: vt6656: Power save stop wake_up_count wrap around. staging: vt6656: Fix pairwise key entry save. staging: vt6656: Fix drivers TBTT timing counter. staging: vt6656: Fix calling conditions of vnt_set_bss_mode staging: vt6656: Don't set RCR_MULTICAST or RCR_BROADCAST by default. vt: don't use kmalloc() for the unicode screen buffer vt: don't hardcode the mem allocation upper bound staging: comedi: Fix comedi_device refcnt leak in comedi_open staging: comedi: dt2815: fix writing hi byte of analog output powerpc/setup_64: Set cache-line-size based on cache-block-size ARM: imx: provide v7_cpu_resume() only on ARM_CPU_SUSPEND=y iwlwifi: mvm: beacon statistics shouldn't go backwards iwlwifi: pcie: actually release queue memory in TVQM ASoC: dapm: fixup dapm kcontrol widget audit: check the length of userspace generated audit records usb-storage: Add unusual_devs entry for JMicron JMS566 tty: rocket, avoid OOB access tty: hvc: fix buffer overflow during hvc_alloc(). KVM: VMX: Enable machine check support for 32bit targets KVM: Check validity of resolved slot when searching memslots KVM: s390: Return last valid slot if approx index is out-of-bounds tpm: ibmvtpm: retry on H_CLOSED in tpm_ibmvtpm_send() tpm/tpm_tis: Free IRQ if probing fails ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices ALSA: usb-audio: Fix usb audio refcnt leak when getting spdif ALSA: hda/realtek - Add new codec supported for ALC245 ALSA: hda/realtek - Fix unexpected init_amp override ALSA: usx2y: Fix potential NULL dereference tools/vm: fix cross-compile build mm/ksm: fix NULL pointer dereference when KSM zero page is enabled mm/hugetlb: fix a addressing exception caused by huge_pte_offset vmalloc: fix remap_vmalloc_range() bounds checks USB: hub: Fix handling of connect changes during sleep USB: core: Fix free-while-in-use bug in the USB S-Glibrary USB: early: Handle AMD's spec-compliant identifiers, too USB: Add USB_QUIRK_DELAY_CTRL_MSG and USB_QUIRK_DELAY_INIT for Corsair K70 RGB RAPIDFIRE USB: sisusbvga: Change port variable from signed to unsigned fs/namespace.c: fix mountpoint reference counter race iio: xilinx-xadc: Make sure not exceed maximum samplerate iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode iio: xilinx-xadc: Fix clearing interrupt when enabling trigger iio: xilinx-xadc: Fix ADC-B powerdown iio: adc: stm32-adc: fix sleep in atomic context iio: st_sensors: rely on odr mask to know if odr can be set iio: core: remove extra semi-colon from devm_iio_device_register() macro ALSA: usb-audio: Add connector notifier delegation ALSA: usb-audio: Add static mapping table for ALC1220-VB-based mobos ALSA: hda: Remove ASUS ROG Zenith from the blacklist KEYS: Avoid false positive ENOMEM error on key read mlxsw: Fix some IS_ERR() vs NULL bugs vrf: Check skb for XFRM_TRANSFORMED flag xfrm: Always set XFRM_TRANSFORMED in xfrm{4,6}_output_finish net: dsa: b53: b53_arl_rw_op() needs to select IVL or SVL net: dsa: b53: Rework ARL bin logic net: dsa: b53: Fix ARL register definitions net: dsa: b53: Lookup VID in ARL searches when VLAN is enabled vrf: Fix IPv6 with qdisc and xfrm team: fix hang in team_mode_get() tcp: cache line align MAX_TCP_HEADER sched: etf: do not assume all sockets are full blown net/x25: Fix x25_neigh refcnt leak when receiving frame net: stmmac: dwmac-meson8b: Add missing boundary to RGMII TX clock array net: netrom: Fix potential nr_neigh refcnt leak in nr_add_node net: bcmgenet: correct per TX/RX ring statistics macvlan: fix null dereference in macvlan_device_event() macsec: avoid to set wrong mtu ipv6: fix restrict IPV6_ADDRFORM operation cxgb4: fix large delays in PTP synchronization cxgb4: fix adapter crash due to wrong MC size x86/KVM: Clean up host's steal time structure x86/KVM: Make sure KVM_VCPU_FLUSH_TLB flag is not missed x86/kvm: Cache gfn to pfn translation x86/kvm: Introduce kvm_(un)map_gfn() KVM: Properly check if "page" is valid in kvm_vcpu_unmap kvm: fix compile on s390 part 2 kvm: fix compilation on s390 kvm: fix compilation on aarch64 KVM: Introduce a new guest mapping API KVM: nVMX: Always sync GUEST_BNDCFGS when it comes from vmcs01 KVM: VMX: Zero out *all* general purpose registers after VM-Exit f2fs: fix to avoid memory leakage in f2fs_listxattr blktrace: fix dereference after null check blktrace: Protect q->blk_trace with RCU net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup net: ipv6: add net argument to ip6_dst_lookup_flow PCI/ASPM: Allow re-enabling Clock PM scsi: smartpqi: fix call trace in device discovery virtio-blk: improve virtqueue error to BLK_STS tracing/selftests: Turn off timeout setting drm/amd/display: Not doing optimize bandwidth if flip pending. xhci: Ensure link state is U3 after setting USB_SS_PORT_LS_U3 ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN MPWIN895CL tablet perf/core: Disable page faults when getting phys address pwm: bcm2835: Dynamically allocate base pwm: renesas-tpu: Fix late Runtime PM enablement Revert "powerpc/64: irq_work avoid interrupt when called with hardware irqs enabled" loop: Better discard support for block devices s390/cio: avoid duplicated 'ADD' uevents kconfig: qconf: Fix a few alignment issues ipc/util.c: sysvipc_find_ipc() should increase position index selftests: kmod: fix handling test numbers above 9 kernel/gcov/fs.c: gcov_seq_next() should increase position index nvme: fix deadlock caused by ANA update wrong locking ASoC: Intel: atom: Take the drv->lock mutex before calling sst_send_slot_map() scsi: iscsi: Report unbind session event when the target has been removed pwm: rcar: Fix late Runtime PM enablement ceph: don't skip updating wanted caps when cap is stale ceph: return ceph_mdsc_do_request() errors from __get_parent() scsi: lpfc: Fix crash in target side cable pulls hitting WAIT_FOR_UNREG scsi: lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login watchdog: reset last_hw_keepalive time at start arm64: Silence clang warning on mismatched value/register sizes arm64: compat: Workaround Neoverse-N1 #1542419 for compat user-space arm64: Fake the IminLine size on systems affected by Neoverse-N1 #1542419 arm64: errata: Hide CTR_EL0.DIC on systems affected by Neoverse-N1 #1542419 arm64: Add part number for Neoverse N1 vti4: removed duplicate log message. crypto: mxs-dcp - make symbols 'sha1_null_hash' and 'sha256_null_hash' static bpftool: Fix printing incorrect pointer in btf_dump_ptr drm/msm: Use the correct dma_sync calls harder ext4: fix extent_status fragmentation for plain files ANDROID: abi_gki_aarch64_cuttlefish_whitelist: remove stale symbols ANDROID: GKI: ipv4: increase __IPV4_DEVCONF_MAX to 64 ANDROID: GKI: power: add missing export for POWER_RESET_QCOM=m BACKPORT: cfg80211: Support key configuration for Beacon protection (BIGTK) BACKPORT: cfg80211: Enhance the AKM advertizement to support per interface. UPSTREAM: sysrq: Use panic() to force a crash ANDROID: GKI: kernel: sound: update codec options with block size ANDROID: add compat cross compiler ANDROID: x86/vdso: disable LTO only for VDSO BACKPORT: arm64: vdso32: Enable Clang Compilation UPSTREAM: arm64: compat: vdso: Expose BUILD_VDSO32 BACKPORT: lib/vdso: Enable common headers BACKPORT: arm: vdso: Enable arm to use common headers BACKPORT: x86/vdso: Enable x86 to use common headers BACKPORT: mips: vdso: Enable mips to use common headers UPSTREAM: arm64: vdso32: Include common headers in the vdso library UPSTREAM: arm64: vdso: Include common headers in the vdso library UPSTREAM: arm64: Introduce asm/vdso/processor.h BACKPORT: arm64: vdso32: Code clean up UPSTREAM: linux/elfnote.h: Replace elf.h with UAPI equivalent UPSTREAM: scripts: Fix the inclusion order in modpost UPSTREAM: common: Introduce processor.h UPSTREAM: linux/ktime.h: Extract common header for vDSO UPSTREAM: linux/jiffies.h: Extract common header for vDSO UPSTREAM: linux/time64.h: Extract common header for vDSO BACKPORT: linux/time32.h: Extract common header for vDSO BACKPORT: linux/time.h: Extract common header for vDSO UPSTREAM: linux/math64.h: Extract common header for vDSO BACKPORT: linux/clocksource.h: Extract common header for vDSO BACKPORT: mips: Introduce asm/vdso/clocksource.h BACKPORT: arm64: Introduce asm/vdso/clocksource.h BACKPORT: arm: Introduce asm/vdso/clocksource.h BACKPORT: x86: Introduce asm/vdso/clocksource.h UPSTREAM: linux/limits.h: Extract common header for vDSO BACKPORT: linux/kernel.h: split *_MAX and *_MIN macros into <linux/limits.h> BACKPORT: linux/bits.h: Extract common header for vDSO UPSTREAM: linux/const.h: Extract common header for vDSO BACKPORT: arm64: vdso: fix flip/flop vdso build bug UPSTREAM: lib/vdso: Allow the high resolution parts to be compiled out UPSTREAM: lib/vdso: Only read hrtimer_res when needed in __cvdso_clock_getres() UPSTREAM: lib/vdso: Mark do_hres() and do_coarse() as __always_inline UPSTREAM: lib/vdso: Avoid duplication in __cvdso_clock_getres() UPSTREAM: lib/vdso: Let do_coarse() return 0 to simplify the callsite UPSTREAM: lib/vdso: Remove checks on return value for 32 bit vDSO UPSTREAM: lib/vdso: Build 32 bit specific functions in the right context UPSTREAM: lib/vdso: Make __cvdso_clock_getres() static UPSTREAM: lib/vdso: Make clock_getres() POSIX compliant again UPSTREAM: lib/vdso/32: Provide legacy syscall fallbacks UPSTREAM: lib/vdso: Move fallback invocation to the callers UPSTREAM: lib/vdso/32: Remove inconsistent NULL pointer checks UPSTREAM: lib/vdso: Make delta calculation work correctly UPSTREAM: arm64: compat: Fix syscall number of compat_clock_getres BACKPORT: arm64: lse: Fix LSE atomics with LLVM UPSTREAM: mips: Fix gettimeofday() in the vdso library UPSTREAM: mips: vdso: Fix __arch_get_hw_counter() BACKPORT: arm64: Kconfig: Make CONFIG_COMPAT_VDSO a proper Kconfig option UPSTREAM: arm64: vdso32: Rename COMPATCC to CC_COMPAT UPSTREAM: arm64: vdso32: Pass '--target' option to clang via VDSO_CAFLAGS UPSTREAM: arm64: vdso32: Don't use KBUILD_CPPFLAGS unconditionally UPSTREAM: arm64: vdso32: Move definition of COMPATCC into vdso32/Makefile UPSTREAM: arm64: Default to building compat vDSO with clang when CONFIG_CC_IS_CLANG UPSTREAM: lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO UPSTREAM: arm64: vdso32: Remove jump label config option in Makefile UPSTREAM: arm64: vdso32: Detect binutils support for dmb ishld BACKPORT: arm64: vdso: Remove stale files from old assembly implementation UPSTREAM: arm64: vdso32: Fix broken compat vDSO build warnings UPSTREAM: mips: compat: vdso: Use legacy syscalls as fallback BACKPORT: arm64: Relax Documentation/arm64/tagged-pointers.rst BACKPORT: arm64: Add tagged-address-abi.rst to index.rst UPSTREAM: arm64: vdso: Fix Makefile regression UPSTREAM: mips: vdso: Fix flip/flop vdso building bug UPSTREAM: mips: vdso: Fix source path UPSTREAM: mips: Add clock_gettime64 entry point UPSTREAM: mips: Add clock_getres entry point BACKPORT: mips: Add support for generic vDSO BACKPORT: arm64: vdso: Explicitly add build-id option BACKPORT: arm64: vdso: use $(LD) instead of $(CC) to link VDSO BACKPORT: arm64: vdso: Cleanup Makefiles UPSTREAM: arm64: vdso: Fix population of AT_SYSINFO_EHDR for compat vdso UPSTREAM: arm64: vdso: Fix compilation with clang older than 8 UPSTREAM: arm64: compat: Fix __arch_get_hw_counter() implementation UPSTREAM: arm64: Fix __arch_get_hw_counter() implementation UPSTREAM: x86/vdso/32: Use 32bit syscall fallback UPSTREAM: x86/vdso: Fix flip/flop vdso build bug UPSTREAM: x86/vdso: Give the [ph]vclock_page declarations real types UPSTREAM: x86/vdso: Add clock_gettime64() entry point BACKPORT: x86/vdso: Add clock_getres() entry point BACKPORT: x86/vdso: Switch to generic vDSO implementation UPSTREAM: x86/segments: Introduce the 'CPUNODE' naming to better document the segment limit CPU/node NR trick UPSTREAM: x86/vdso: Initialize the CPU/node NR segment descriptor earlier UPSTREAM: x86/vdso: Introduce helper functions for CPU and node number UPSTREAM: x86/segments/64: Rename the GDT PER_CPU entry to CPU_NUMBER BACKPORT: arm64: vdso: Enable vDSO compat support UPSTREAM: arm64: compat: Get sigreturn trampolines from vDSO UPSTREAM: arm64: elf: VDSO code page discovery UPSTREAM: arm64: compat: VDSO setup for compat layer UPSTREAM: arm64: vdso: Refactor vDSO code BACKPORT: arm64: compat: Add vDSO UPSTREAM: arm64: compat: Generate asm offsets for signals UPSTREAM: arm64: compat: Expose signal related structures UPSTREAM: arm64: compat: Add missing syscall numbers BACKPORT: arm64: vdso: Substitute gettimeofday() with C implementation UPSTREAM: timekeeping: Provide a generic update_vsyscall() implementation UPSTREAM: lib/vdso: Add compat support UPSTREAM: lib/vdso: Provide generic VDSO implementation UPSTREAM: vdso: Define standardized vdso_datapage UPSTREAM: hrtimer: Split out hrtimer defines into separate header UPSTREAM: nds32: Fix vDSO clock_getres() UPSTREAM: arm64: compat: Reduce address limit for 64K pages BACKPORT: arm64: compat: Add KUSER_HELPERS config option UPSTREAM: arm64: compat: Refactor aarch32_alloc_vdso_pages() BACKPORT: arm64: compat: Split kuser32 UPSTREAM: arm64: compat: Alloc separate pages for vectors and sigpage ANDROID: GKI: Update ABI XML representation ANDROID: GKI: Enable GENERIC_IRQ_CHIP ANDROID: GKI: power_supply: Add FG_TYPE power-supply property ANDROID: GKI: mm: export mm_trace_rss_stat for modules to report RSS changes ANDROID: GKI: gki_defconfig: Enable CONFIG_LEDS_TRIGGER_TRANSIENT ANDROID: GKI: gki_defconfig: Enable CONFIG_CPU_FREQ_STAT ANDROID: GKI: arm64: gki_defconfig: Disable HW tracing features ANDROID: GKI: gki_defconfig: Enable CONFIG_I2C_CHARDEV ANDROID: Incremental fs: Use simple compression in log buffer ANDROID: GKI: usb: core: Add support to parse config summary capability descriptors ANDROID: GKI: Update ABI XML representation ANDROID: dm-bow: Fix not to skip trim at framented range ANDROID: Remove VLA from uid_sys_stats.c f2fs: fix missing check for f2fs_unlock_op ANDROID: fix wakeup reason findings UPSTREAM: cfg80211: fix and clean up cfg80211_gen_new_bssid() UPSTREAM: cfg80211: save multi-bssid properties UPSTREAM: cfg80211: make BSSID generation function inline UPSTREAM: cfg80211: parse multi-bssid only if HW supports it UPSTREAM: cfg80211: Move Multiple BSS info to struct cfg80211_bss to be visible UPSTREAM: cfg80211: Properly track transmitting and non-transmitting BSS UPSTREAM: cfg80211: use for_each_element() for multi-bssid parsing UPSTREAM: cfg80211: Parsing of Multiple BSSID information in scanning UPSTREAM: cfg80211/nl80211: Offload OWE processing to user space in AP mode ANDROID: GKI: cfg80211: Sync nl80211 commands/feature with upstream ANDROID: GKI: gki_defconfig: Enable FW_LOADER_USER_HELPER* ANDROID: GKI: arm64: gki_defconfig: Disable CONFIG_ARM64_TAGGED_ADDR_ABI ANDROID: GKI: gki_defconfig: CONFIG_CHR_DEV_SG=y ANDROID: GKI: gki_defconfig: CONFIG_DM_DEFAULT_KEY=m ANDROID: update the ABI xml representation ANDROID: init: GKI: enable hidden configs for GPU Linux 4.19.118 bpf: fix buggy r0 retval refinement for tracing helpers KEYS: Don't write out to userspace while holding key semaphore mtd: phram: fix a double free issue in error path mtd: lpddr: Fix a double free in probe() mtd: spinand: Explicitly use MTD_OPS_RAW to write the bad block marker to OOB locktorture: Print ratio of acquisitions, not failures tty: evh_bytechan: Fix out of bounds accesses iio: si1133: read 24-bit signed integer for measurement fbdev: potential information leak in do_fb_ioctl() net: dsa: bcm_sf2: Fix overflow checks f2fs: fix to wait all node page writeback iommu/amd: Fix the configuration of GCR3 table root pointer libnvdimm: Out of bounds read in __nd_ioctl() power: supply: axp288_fuel_gauge: Broaden vendor check for Intel Compute Sticks. ext2: fix debug reference to ext2_xattr_cache ext2: fix empty body warnings when -Wextra is used iommu/vt-d: Fix mm reference leak drm/vc4: Fix HDMI mode validation f2fs: fix NULL pointer dereference in f2fs_write_begin() NFS: Fix memory leaks in nfs_pageio_stop_mirroring() drm/amdkfd: kfree the wrong pointer x86: ACPI: fix CPU hotplug deadlock KVM: s390: vsie: Fix possible race when shadowing region 3 tables compiler.h: fix error in BUILD_BUG_ON() reporting percpu_counter: fix a data race at vm_committed_as include/linux/swapops.h: correct guards for non_swap_entry() cifs: Allocate encryption header through kmalloc um: ubd: Prevent buffer overrun on command completion ext4: do not commit super on read-only bdev s390/cpum_sf: Fix wrong page count in error message powerpc/maple: Fix declaration made after definition s390/cpuinfo: fix wrong output when CPU0 is offline NFS: direct.c: Fix memory leak of dreq when nfs_get_lock_context fails NFSv4/pnfs: Return valid stateids in nfs_layout_find_inode_by_stateid() rtc: 88pm860x: fix possible race condition soc: imx: gpc: fix power up sequencing clk: tegra: Fix Tegra PMC clock out parents power: supply: bq27xxx_battery: Silence deferred-probe error clk: at91: usb: continue if clk_hw_round_rate() return zero x86/Hyper-V: Report crash data in die() when panic_on_oops is set x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set x86/Hyper-V: Trigger crash enlightenment only once during system crash. x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump x86/Hyper-V: Unload vmbus channel in hv panic callback xsk: Add missing check on user supplied headroom size rbd: call rbd_dev_unprobe() after unwatching and flushing notifies rbd: avoid a deadlock on header_rwsem when flushing notifies video: fbdev: sis: Remove unnecessary parentheses and commented code lib/raid6: use vdupq_n_u8 to avoid endianness warnings x86/Hyper-V: Report crash register data or kmsg before running crash kernel of: overlay: kmemleak in dup_and_fixup_symbol_prop() of: unittest: kmemleak in of_unittest_overlay_high_level() of: unittest: kmemleak in of_unittest_platform_populate() of: unittest: kmemleak on changeset destroy ALSA: hda: Don't release card at firmware loading error irqchip/mbigen: Free msi_desc on device teardown netfilter: nf_tables: report EOPNOTSUPP on unsupported flags/object type ARM: dts: imx6: Use gpc for FEC interrupt controller to fix wake on LAN. arm, bpf: Fix bugs with ALU64 {RSH, ARSH} BPF_K shift by 0 watchdog: sp805: fix restart handler ext4: use non-movable memory for superblock readahead scsi: sg: add sg_remove_request in sg_common_write objtool: Fix switch table detection in .text.unlikely arm, bpf: Fix offset overflow for BPF_MEM BPF_DW ANDROID: GKI: Bulk update ABI report. ANDROID: GKI: qos: Register irq notify after adding the qos request ANDROID: GKI: Add dual role mode to usb_dr_modes array UPSTREAM: virtio-gpu api: comment feature flags ANDROID: arch:arm64: Increase kernel command line size ANDROID: GKI: Add special linux_banner_ptr for modules Revert "ANDROID: GKI: Make linux_banner a C pointer" ANDROID: GKI: PM / devfreq: Add new flag to do simple clock scaling ANDROID: GKI: Resolve ABI diff for struct snd_usb_audio ANDROID: GKI: Bulk update ABI ANDROID: GKI: Update the whitelist for qcom SoCs ANDROID: GKI: arm64: gki_defconfig: Set CONFIG_SCSI_UFSHCD=m ANDROID: GKI: scsi: add option to override the command timeout ANDROID: GKI: scsi: Adjust DBD setting in mode sense for caching mode page per LLD ANDROID: add ion_stat tracepoint to common kernel UPSTREAM: gpu/trace: add a gpu total memory usage tracepoint Linux 4.19.117 mm/vmalloc.c: move 'area->pages' after if statement wil6210: remove reset file from debugfs wil6210: make sure Rx ring sizes are correlated wil6210: add general initialization/size checks wil6210: ignore HALP ICR if already handled wil6210: check rx_buff_mgmt before accessing it x86/resctrl: Fix invalid attempt at removing the default resource group x86/resctrl: Preserve CDP enable over CPU hotplug x86/microcode/AMD: Increase microcode PATCH_MAX_SIZE scsi: target: fix hang when multiple threads try to destroy the same iscsi session scsi: target: remove boilerplate code kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_SSBD ext4: do not zeroout extents beyond i_disksize drm/amd/powerplay: force the trim of the mclk dpm_levels if OD is enabled usb: dwc3: gadget: Don't clear flags before transfer ended usb: dwc3: gadget: don't enable interrupt when disabling endpoint mac80211_hwsim: Use kstrndup() in place of kasprintf() btrfs: check commit root generation in should_ignore_root tracing: Fix the race between registering 'snapshot' event trigger and triggering 'snapshot' operation keys: Fix proc_keys_next to increase position index ALSA: usb-audio: Check mapping at creating connector controls, too ALSA: usb-audio: Don't create jack controls for PCM terminals ALSA: usb-audio: Don't override ignore_ctl_error value from the map ALSA: usb-audio: Filter error from connector kctl ops, too ASoC: Intel: mrfld: return error codes when an error occurs ASoC: Intel: mrfld: fix incorrect check on p->sink ext4: fix incorrect inodes per group in error message ext4: fix incorrect group count in ext4_fill_super error message pwm: pca9685: Fix PWM/GPIO inter-operation jbd2: improve comments about freeing data buffers whose page mapping is NULL scsi: ufs: Fix ufshcd_hold() caused scheduling while atomic ovl: fix value of i_ino for lower hardlink corner case net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode net: stmmac: dwmac-sunxi: Provide TX and RX fifo sizes net: revert default NAPI poll timeout to 2 jiffies net: qrtr: send msgs from local of same id as broadcast net: ipv6: do not consider routes via gateways for anycast address check net: ipv4: devinet: Fix crash when add/del multicast IP with autojoin hsr: check protocol version in hsr_newlink() amd-xgbe: Use __napi_schedule() in BH context ANDROID: GKI: drivers: of-thermal: Relate thermal zones using same sensor ANDROID: GKI: Bulk ABI update ANDROID: GKI: dma: Add set_dma_mask hook to struct dma_map_ops ANDROID: GKI: ABI update due to recent patches FROMLIST: drm/prime: add support for virtio exported objects FROMLIST: dma-buf: add support for virtio exported objects UPSTREAM: drm/virtio: module_param_named() requires linux/moduleparam.h UPSTREAM: drm/virtio: fix resource id creation race UPSTREAM: drm/virtio: make resource id workaround runtime switchable. BACKPORT: drm/virtio: Drop deprecated load/unload initialization ANDROID: GKI: Add DRM_TTM config to GKI ANDROID: Bulk update the ABI xml representation ANDROID: GKI: spmi: pmic-arb: don't enable SPMI_MSM_PMIC_ARB by default ANDROID: GKI: attribute page lock and waitqueue functions as sched ANDROID: GKI: extcon: Fix Add usage of blocking notifier chain ANDROID: GKI: USB: pd: Extcon fix for C current ANDROID: drm/dsi: Fix byte order of DCS set/get brightness ANDROID: GKI: mm: Export symbols to modularize CONFIG_MSM_DRM ANDROID: GKI: ALSA: compress: Add support to send codec specific data ANDROID: GKI: ALSA: Compress - dont use lock for all ioctls ANDROID: GKI: ASoC: msm: qdsp6v2: add support for AMR_WB_PLUS offload ANDROID: GKI: msm: dolby: MAT and THD audiocodec name modification ANDROID: GKI: asoc: msm: Add support for compressed perf mode ANDROID: GKI: msm: audio: support for gapless_pcm ANDROID: GKI: uapi: msm: dolby: Support for TrueHD and MAT decoders ANDROID: GKI: ASoC: msm: qdsp6v2: Add TrueHD HDMI compress pass-though ANDROID: GKI: ALSA: compress: Add APTX format support in ALSA ANDROID: GKI: msm: qdsp6v2: Add timestamp support for compress capture ANDROID: GKI: SoC: msm: Add support for meta data in compressed TX ANDROID: GKI: ALSA: compress: Add DSD format support for ALSA ANDROID: GKI: ASoC: msm: qdsp6v2: add support for ALAC and APE offload ANDROID: GKI: SoC: msm: Add compressed TX and passthrough support ANDROID: GKI: ASoC: msm: qdsp6v2: Add FLAC in compress offload path ANDROID: GKI: ASoC: msm: add support for different compressed formats ANDROID: GKI: ASoC: msm: Update the encode option and sample rate ANDROID: GKI: Enable CONFIG_SND_VERBOSE_PROCFS in gki_defconfig ANDROID: GKI: Add hidden CONFIG_SND_SOC_COMPRESS to gki_defconfig ANDROID: GKI: ALSA: pcm: add locks for accessing runtime resource ANDROID: GKI: Update ABI for DRM changes ANDROID: GKI: Add drm_dp_send_dpcd_{read,write} accessor functions ANDROID: GKI: drm: Add drm_dp_mst_get_max_sdp_streams_supported accessor function ANDROID: GKI: drm: Add drm_dp_mst_has_fec accessor function ANDROID: GKI: Add 'dsc_info' to struct drm_dp_mst_port ANDROID: GKI: usb: Add support to handle USB SMMU S1 address ANDROID: GKI: usb: Add helper APIs to return xhci phys addresses ANDROID: Add C protos for dma_buf/drm_prime get_uuid ANDROID: GKI: Make linux_banner a C pointer ANDROID: GKI: Add 'refresh_rate', 'id' to struct drm_panel_notifier ANDROID: GKI: Add 'i2c_mutex' to struct drm_dp_aux ANDROID: GKI: Add 'checksum' to struct drm_connector Revert "BACKPORT: drm: Add HDR source metadata property" Revert "BACKPORT: drm: Parse HDR metadata info from EDID" ANDROID: drm: Add DP colorspace property ANDROID: GKI: drm: Initialize display->hdmi when parsing vsdb ANDROID: drivers: gpu: drm: add support to batch commands ANDROID: ABI: update the qcom whitelist ANDROID: GKI: ARM64: smp: add vendor field pending_ipi ANDROID: gki_defconfig: enable msm serial early console ANDROID: serial: msm_geni_serial_console : Add Earlycon support ANDROID: GKI: serial: core: export uart_console_device f2fs: fix quota_sync failure due to f2fs_lock_op f2fs: support read iostat f2fs: Fix the accounting of dcc->undiscard_blks f2fs: fix to handle error path of f2fs_ra_meta_pages() f2fs: report the discard cmd errors properly f2fs: fix long latency due to discard during umount f2fs: add tracepoint for f2fs iostat f2fs: introduce sysfs/data_io_flag to attach REQ_META/FUA ANDROID: GKI: update abi definition due to previous changes in the tree Linux 4.19.116 efi/x86: Fix the deletion of variables in mixed mode mfd: dln2: Fix sanity checking for endpoints etnaviv: perfmon: fix total and idle HI cyleces readout misc: echo: Remove unnecessary parentheses and simplify check for zero powerpc/fsl_booke: Avoid creating duplicate tlb1 entry ftrace/kprobe: Show the maxactive number on kprobe_events drm: Remove PageReserved manipulation from drm_pci_alloc drm/dp_mst: Fix clearing payload state on topology disable Revert "drm/dp_mst: Remove VCPI while disabling topology mgr" crypto: ccree - only try to map auth tag if needed crypto: ccree - dec auth tag size from cryptlen map crypto: ccree - don't mangle the request assoclen crypto: ccree - zero out internal struct before use crypto: ccree - improve error handling crypto: caam - update xts sector size for large input length dm zoned: remove duplicate nr_rnd_zones increase in dmz_init_zone() btrfs: use nofs allocations for running delayed items powerpc: Make setjmp/longjmp signature standard powerpc: Add attributes for setjmp/longjmp scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug powerpc/kprobes: Ignore traps that happened in real mode powerpc/xive: Use XIVE_BAD_IRQ instead of zero to catch non configured IPIs powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries powerpc/64/tm: Don't let userspace set regs->trap via sigreturn powerpc/powernv/idle: Restore AMR/UAMOR/AMOR after idle xen/blkfront: fix memory allocation flags in blkfront_setup_indirect() ipmi: fix hung processes in __get_guid() libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set hfsplus: fix crash and filesystem corruption when deleting files cpufreq: powernv: Fix use-after-free kmod: make request_module() return an error when autoloading is disabled clk: ingenic/jz4770: Exit with error if CGU init failed Input: i8042 - add Acer Aspire 5738z to nomux list s390/diag: fix display of diagnose call statistics perf tools: Support Python 3.8+ in Makefile ocfs2: no need try to truncate file beyond i_size fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() ext4: fix a data race at inode->i_blocks NFS: Fix a page leak in nfs_destroy_unlinked_subrequests() powerpc/pseries: Avoid NULL pointer dereference when drmem is unavailable drm/etnaviv: rework perfmon query infrastructure rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH selftests: vm: drop dependencies on page flags from mlock2 tests arm64: armv8_deprecated: Fix undef_hook mask for thumb setend scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point dm verity fec: fix memory leak in verity_fec_dtr dm writecache: add cond_resched to avoid CPU hangs arm64: dts: allwinner: h6: Fix PMU compatible net: qualcomm: rmnet: Allow configuration updates to existing devices mm: Use fixed constant in page_frag_alloc instead of size + 1 tools: gpio: Fix out-of-tree build regression x86/speculation: Remove redundant arch_smt_update() invocation powerpc/pseries: Drop pointless static qualifier in vpa_debugfs_init() erofs: correct the remaining shrink objects crypto: mxs-dcp - fix scatterlist linearization for hash btrfs: fix missing semaphore unlock in btrfs_sync_file btrfs: fix missing file extent item for hole after ranged fsync btrfs: drop block from cache on error in relocation btrfs: set update the uuid generation as soon as possible Btrfs: fix crash during unmount due to race with delayed inode workers mtd: spinand: Do not erase the block before writing a bad block marker mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers CIFS: Fix bug which the return value by asynchronous read is error KVM: VMX: fix crash cleanup when KVM wasn't used KVM: x86: Gracefully handle __vmalloc() failure during VM allocation KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support KVM: x86: Allocate new rmap and large page tracking when moving memslot KVM: s390: vsie: Fix delivery of addressing exceptions KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks KVM: nVMX: Properly handle userspace interrupt window request x86/entry/32: Add missing ASM_CLAC to general_protection entry signal: Extend exec_id to 64bits ath9k: Handle txpower changes even when TPC is disabled MIPS: OCTEON: irq: Fix potential NULL pointer dereference MIPS/tlbex: Fix LDDIR usage in setup_pw() for Loongson-3 pstore: pstore_ftrace_seq_next should increase position index irqchip/versatile-fpga: Apply clear-mask earlier KEYS: reaching the keys quotas correctly tpm: tpm2_bios_measurements_next should increase position index tpm: tpm1_bios_measurements_next should increase position index tpm: Don't make log failures fatal PCI: endpoint: Fix for concurrent memory allocation in OB address region PCI: Add boot interrupt quirk mechanism for Xeon chipsets PCI/ASPM: Clear the correct bits when enabling L1 substates PCI: pciehp: Fix indefinite wait on sysfs requests nvme: Treat discovery subsystems as unique subsystems nvme-fc: Revert "add module to ops template to allow module references" thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n acpi/x86: ignore unspecified bit positions in the ACPI global lock field media: ti-vpe: cal: fix disable_irqs to only the intended target ALSA: hda/realtek - Add quirk for MSI GL63 ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups ALSA: hda/realtek - Set principled PC Beep configuration for ALC256 ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256 ALSA: pcm: oss: Fix regression by buffer overflow fix ALSA: ice1724: Fix invalid access for enumerated ctl items ALSA: hda: Fix potential access overflow in beep helper ALSA: hda: Add driver blacklist ALSA: usb-audio: Add mixer workaround for TRX40 and co usb: gadget: composite: Inform controller driver of self-powered usb: gadget: f_fs: Fix use after free issue as part of queue failure ASoC: topology: use name_prefix for new kcontrol ASoC: dpcm: allow start or stop during pause for backend ASoC: dapm: connect virtual mux with default value ASoC: fix regwmask slub: improve bit diffusion for freelist ptr obfuscation uapi: rename ext2_swab() to swab() and share globally in swab.h IB/mlx5: Replace tunnel mpls capability bits for tunnel_offloads btrfs: track reloc roots based on their commit root bytenr btrfs: remove a BUG_ON() from merge_reloc_roots() btrfs: qgroup: ensure qgroup_rescan_running is only set when the worker is at least queued block, bfq: fix use-after-free in bfq_idle_slice_timer_body locking/lockdep: Avoid recursion in lockdep_count_{for,back}ward_deps() firmware: fix a double abort case with fw_load_sysfs_fallback md: check arrays is suspended in mddev_detach before call quiesce operations irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency usb: dwc3: core: add support for disabling SS instances in park mode media: i2c: ov5695: Fix power on and off sequences block: Fix use-after-free issue accessing struct io_cq genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy() efi/x86: Ignore the memory attributes table on i386 x86/boot: Use unsigned comparison for addresses gfs2: Don't demote a glock until its revokes are written pstore/platform: fix potential mem leak if pstore_init_fs failed libata: Remove extra scsi_host_put() in ata_scsi_add_hosts() media: i2c: video-i2c: fix build errors due to 'imply hwmon' PCI/switchtec: Fix init_completion race condition with poll_wait() selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault sched: Avoid scale real weight down to zero irqchip/versatile-fpga: Handle chained IRQs properly block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices x86: Don't let pgprot_modify() change the page encryption bit xhci: bail out early if driver can't accress host in resume null_blk: fix spurious IO errors after failed past-wp access null_blk: Handle null_add_dev() failures properly null_blk: Fix the null_add_dev() error path firmware: arm_sdei: fix double-lock on hibernate with shared events media: venus: hfi_parser: Ignore HEVC encoding for V1 cpufreq: imx6q: Fixes unwanted cpu overclocking on i.MX6ULL i2c: st: fix missing struct parameter description qlcnic: Fix bad kzalloc null test cxgb4/ptp: pass the sign of offset delta in FW CMD hinic: fix wrong para of wait_for_completion_timeout hinic: fix a bug of waitting for IO stopped net: vxge: fix wrong __VA_ARGS__ usage bus: sunxi-rsb: Return correct data when mixing 16-bit and 8-bit reads ARM: dts: sun8i-a83t-tbs-a711: HM5065 doesn't like such a high voltage ANDROID: build.config.allmodconfig: Re-enable XFS_FS FROMGIT: of: property: Add device link support for extcon ANDROID: GKI: arm64: gki_defconfig: enable CONFIG_MM_EVENT_STAT ANDROID: GKI: add fields from per-process mm event tracking feature ANDROID: GKI: fix ABI diffs caused by ION heap and pool vmstat additions UPSTREAM: GKI: panic/reboot: allow specifying reboot_mode for panic only ANDROID: GKI: of: property: Add device link support for phys property ANDROID: GKI: usb: phy: Fix ABI diff for usb_otg_state ANDROID: GKI: usb: phy: Fix ABI diff due to usb_phy.drive_dp_pulse ANDROID: GKI: usb: phy: Fix ABI diff for usb_phy_type and usb_phy.reset ANDROID: gki_defconfig: enable CONFIG_GPIO_SYSFS ANDROID: GKI: qcom: Fix compile issue when setting msm_lmh_dcvs as a module ANDROID: GKI: drivers: cpu_cooling: allow platform freq mitigation ANDROID: GKI: ASoC: Add locking in DAPM widget power update ANDROID: GKI: ASoC: jack: Fix buttons enum value ANDROID: GKI: ALSA: jack: Add support to report second microphone ANDROID: GKI: ALSA: jack: Update supported jack switch types ANDROID: GKI: ALSA: jack: update jack types ANDROID: GKI: Export symbols arm_cpuidle_suspend, cpuidle_dev and cpuidle_register_governor ANDROID: GKI: usb: hcd: Add USB atomic notifier callback for HC died error ANDROID: media: increase video max frame number BACKPORT: nvmem: core: add NVMEM_SYSFS Kconfig UPSTREAM: nvmem: add support for cell info UPSTREAM: nvmem: remove the global cell list UPSTREAM: nvmem: use kref UPSTREAM: nvmem: use list_for_each_entry_safe in nvmem_device_remove_all_cells() UPSTREAM: nvmem: provide nvmem_dev_name() ANDROID: GKI: Bulk ABI update ANDROID: GKI: cpuhotplug: adding hotplug enums for vendor code ANDROID: Incremental fs: Fix create_file performance ANDROID: build.config.common: Add BUILDTOOLS_PREBUILT_BIN UPSTREAM: kheaders: include only headers into kheaders_data.tar.xz UPSTREAM: kheaders: remove meaningless -R option of 'ls' ANDROID: GKI: of: platform: initialize of_reserved_mem ANDROID: driver: gpu: drm: add notifier for panel related events ANDROID: include: drm: support unicasting mipi cmds to dsi ctrls ANDROID: include: drm: increase DRM max property count to 64 BACKPORT: drm: Add HDMI colorspace property ANDROID: drm: edid: add support for additional CEA extension blocks BACKPORT: drm: Parse HDR metadata info from EDID BACKPORT: drm: Add HDR source metadata property BACKPORT: drm/dp_mst: Parse FEC capability on MST ports ANDROID: GKI: ABI update for DRM changes ANDROID: ABI: add missing elf variables to representation ANDROID: GKI: power_supply: Add PROP_MOISTURE_DETECTION_ENABLED ANDROID: include: drm: add the definitions for DP Link Compliance tests ANDROID: drivers: gpu: drm: fix bugs encountered while fuzzing FROMLIST: power_supply: Add additional health properties to the header UPSTREAM: power: supply: core: Update sysfs-class-power ABI document UPSTREAM: Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-4.19.y' into android-4.19 (v5.7-rc1) ANDROID: drivers: gpu: drm: add support for secure framebuffer ANDROID: include: uapi: drm: add additional QCOM modifiers ANDROID: drm: dsi: add two DSI mode flags for BLLP ANDROID: include: uapi: drm: add additional drm mode flags UPSTREAM: drm: plug memory leak on drm_setup() failure UPSTREAM: drm: factor out drm_close_helper() function ANDROID: GKI: Bulk ABI update BACKPORT: nl80211: Add per peer statistics to compute FCS error rate ANDROID: GKI: sound: usb: Add snd_usb_enable_audio_stream/find_snd_usb_substream ANDROID: GKI: add dma-buf includes ANDROID: GKI: sched: struct fields for Per-Sched-domain over utilization ANDROID: GKI: Add vendor fields to root_domain ANDROID: gki_defconfig: Enable CONFIG_IRQ_TIME_ACCOUNTING ANDROID: fix allmodconfig build to use the right toolchain ANDROID: fix allmodconfig build to use the right toolchain ANDROID: GKI: Update ABI Revert "UPSTREAM: mm, page_alloc: spread allocations across zones before introducing fragmentation" Revert "UPSTREAM: mm: use alloc_flags to record if kswapd can wake" Revert "BACKPORT: mm: move zone watermark accesses behind an accessor" Revert "BACKPORT: mm: reclaim small amounts of memory when an external fragmentation event occurs" Revert "BACKPORT: mm, compaction: be selective about what pageblocks to clear skip hints" ANDROID: GKI: panic: add vendor callback function in panic() UPSTREAM: GKI: thermal: make device_register's type argument const ANDROID: GKI: add base.h include to match MODULE_VERSIONS ANDROID: update the ABI based on the new whitelist ANDROID: GKI: fdt: export symbols required by modules ANDROID: GKI: drivers: of: Add APIs to find DDR device rank, HBB ANDROID: GKI: security: Add mmap export symbols for modules ANDROID: GKI: arch: add stub symbols for boot_reason and cold_boot ANDROID: GKI: USB: Fix ABI diff for struct usb_bus ANDROID: GKI: USB: Resolve ABI diff for usb_gadget and usb_gadget_ops ANDROID: GKI: add hidden V4L2_MEM2MEM_DEV ANDROID: GKI: enable VIDEO_V4L2_SUBDEV_API ANDROID: GKI: export symbols from abi_gki_aarch64_qcom_whitelist ANDROID: Update the whitelist for qcom SoCs ANDROID: Incremental fs: Fix compound page usercopy crash ANDROID: Incremental fs: Clean up incfs_test build process ANDROID: Incremental fs: make remount log buffer change atomic ANDROID: Incremental fs: Optimize get_filled_block ANDROID: Incremental fs: Fix mislabeled __user ptrs ANDROID: Incremental fs: Use 64-bit int for file_size when writing hash blocks Linux 4.19.115 drm/msm: Use the correct dma_sync calls in msm_gem drm_dp_mst_topology: fix broken drm_dp_sideband_parse_remote_dpcd_read() usb: dwc3: don't set gadget->is_otg flag rpmsg: glink: Remove chunk size word align warning arm64: Fix size of __early_cpu_boot_status drm/msm: stop abusing dma_map/unmap for cache clk: qcom: rcg: Return failure for RCG update fbcon: fix null-ptr-deref in fbcon_switch RDMA/cm: Update num_paths in cma_resolve_iboe_route error flow Bluetooth: RFCOMM: fix ODEBUG bug in rfcomm_dev_ioctl RDMA/cma: Teach lockdep about the order of rtnl and lock RDMA/ucma: Put a lock around every call to the rdma_cm layer ceph: canonicalize server path in place ceph: remove the extra slashes in the server path IB/hfi1: Fix memory leaks in sysfs registration and unregistration IB/hfi1: Call kobject_put() when kobject_init_and_add() fails ASoC: jz4740-i2s: Fix divider written at incorrect offset in register hwrng: imx-rngc - fix an error path tools/accounting/getdelays.c: fix netlink attribute length usb: dwc3: gadget: Wrap around when skip TRBs random: always use batched entropy for get_random_u{32,64} mlxsw: spectrum_flower: Do not stop at FLOW_ACTION_VLAN_MANGLE slcan: Don't transmit uninitialized stack data in padding net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting net: phy: micrel: kszphy_resume(): add delay after genphy_resume() before accessing PHY registers net: dsa: bcm_sf2: Ensure correct sub-node is parsed net: dsa: bcm_sf2: Do not register slave MDIO bus with OF ipv6: don't auto-add link-local address to lag ports mm: mempolicy: require at least one nodeid for MPOL_PREFERRED include/linux/notifier.h: SRCU: fix ctags bitops: protect variables in set_mask_bits() macro padata: always acquire cpu_hotplug_lock before pinst->lock net: Fix Tx hash bound checking rxrpc: Fix sendmsg(MSG_WAITALL) handling ALSA: hda/ca0132 - Add Recon3Di quirk to handle integrated sound on EVGA X99 Classified motherboard power: supply: axp288_charger: Add special handling for HP Pavilion x2 10 extcon: axp288: Add wakeup support mei: me: add cedar fork device ids coresight: do not use the BIT() macro in the UAPI header misc: pci_endpoint_test: Avoid using module parameter to determine irqtype misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices misc: rtsx: set correct pcr_ops for rts522A media: rc: IR signal for Panasonic air conditioner too long drm/etnaviv: replace MMU flush marker with flush sequence tools/power turbostat: Fix missing SYS_LPI counter on some Chromebooks tools/power turbostat: Fix gcc build warnings drm/amdgpu: fix typo for vcn1 idle check initramfs: restore default compression behavior drm/bochs: downgrade pci_request_region failure from error to warning drm/amd/display: Add link_rate quirk for Apple 15" MBP 2017 nvme-rdma: Avoid double freeing of async event data sctp: fix possibly using a bad saddr with a given dst sctp: fix refcount bug in sctp_wfree net, ip_tunnel: fix interface lookup with no key ipv4: fix a RCU-list lock in fib_triestat_seq_show ANDROID: GKI: export symbols required by SPECTRA_CAMERA ANDROID: GKI: ARM/ARM64: Introduce arch_read_hardware_id ANDROID: GKI: drivers: base: soc: export symbols for socinfo ANDROID: GKI: Update ABI ANDROID: GKI: ASoC: msm: fix integer overflow for long duration offload playback ANDROID: GKI: Bulk ABI update Revert "ANDROID: GKI: mm: add struct/enum fields for SPECULATIVE_PAGE_FAULTS" ANDROID: GKI: Revert "arm64: kill flush_cache_all()" ANDROID: GKI: Revert "arm64: Remove unused macros from assembler.h" ANDROID: GKI: kernel/dma, mm/cma: Export symbols needed by vendor modules ANDROID: GKI: mm: Export symbols __next_zones_zonelist and zone_watermark_ok_safe ANDROID: GKI: mm/memblock: export memblock_overlaps_memory ANDROID: GKI: net, skbuff: export symbols needed by vendor drivers ANDROID: GKI: Add stub __cpu_isolated_mask symbol ANDROID: GKI: sched: stub sched_isolate symbols ANDROID: GKI: export saved_command_line ANDROID: GKI: Update ABI ANDROID: GKI: ASoC: core: Update ALSA core to issue restart in underrun. ANDROID: GKI: SoC: pcm: Add a restart callback field to struct snd_pcm_ops ANDROID: GKI: SoC: pcm: Add fields to struct snd_pcm_ops and struct snd_soc_component_driver ANDROID: GKI: ASoC: core: Add compat_ioctl callback to struct snd_pcm_ops ANDROID: GKI: ALSA: core: modify, rename and export create_subdir API ANDROID: GKI: usb: Add helper API to issue stop endpoint command ANDROID: GKI: Thermal: thermal_zone_get_cdev_by_name added ANDROID: GKI: add missing exports for CONFIG_ARM_SMMU=m ANDROID: power: wakeup_reason: wake reason enhancements BACKPORT: FROMGIT: kbuild: mkcompile_h: Include $LD version in /proc/version ANDROID: GKI: kernel: Export symbols needed by msm_minidump.ko and minidump_log.ko ubifs: wire up FS_IOC_GET_ENCRYPTION_NONCE f2fs: wire up FS_IOC_GET_ENCRYPTION_NONCE ext4: wire up FS_IOC_GET_ENCRYPTION_NONCE fscrypt: add FS_IOC_GET_ENCRYPTION_NONCE ioctl ANDROID: Bulk update the ABI xml ANDROID: gki_defconfig: add CONFIG_IPV6_SUBTREES ANDROID: GKI: arm64: reserve space in cpu_hwcaps and cpu_hwcap_keys arrays ANDROID: GKI: of: reserved_mem: Fix kmemleak crash on no-map region ANDROID: GKI: sched: add task boost vendor fields to task_struct ANDROID: GKI: mm: add rss counter for unreclaimable pages ANDROID: GKI: irqdomain: add bus token DOMAIN_BUS_WAKEUP ANDROID: GKI: arm64: fault: do_tlb_conf_fault_cb register fault callback ANDROID: GKI: QoS: Enhance framework to support cpu/irq specific QoS requests ANDROID: GKI: Bulk ABI update ANDROID: GKI: PM/devfreq: Do not switch governors from sysfs when device is suspended ANDROID: GKI: PM / devfreq: Fix race condition between suspend/resume and governor_store ANDROID: GKI: PM / devfreq: Introduce a sysfs lock ANDROID: GKI: regmap: irq: Add support to clear ack registers ANDROID: GKI: Remove SCHED_AUTOGROUP ANDROID: ignore compiler tag __must_check for GENKSYMS ANDROID: GKI: Bulk update ABI ANDROID: GKI: Fix ABI diff for struct thermal_cooling_device_ops ANDROID: GKI: ASoC: soc-core: export function to find components ANDROID: GKI: thermal: thermal_sys: Add configurable thermal trip points. ANDROID: fscrypt: fall back to filesystem-layer crypto when needed ANDROID: block: require drivers to declare supported crypto key type(s) ANDROID: block: make blk_crypto_start_using_mode() properly check for support ANDROID: GKI: power: supply: format regression ANDROID: GKI: kobject: increase number of kobject uevent pointers to 64 ANDROID: GKI: drivers: video: backlight: Fix ABI diff for struct backlight_device ANDROID: GKI: usb: xhci: Add support for secondary interrupters ANDROID: GKI: usb: host: xhci: Add support for usb core indexing ANDROID: gki_defconfig: enable USB_XHCI_HCD ANDROID: gki_defconfig: enable CONFIG_BRIDGE ANDROID: GKI: Update ABI report ANDROID: GKI: arm64: smp: Add set_update_ipi_history_callback ANDROID: kbuild: ensure __cfi_check is correctly aligned f2fs: keep inline_data when compression conversion f2fs: fix to disable compression on directory f2fs: add missing CONFIG_F2FS_FS_COMPRESSION f2fs: switch discard_policy.timeout to bool type f2fs: fix to verify tpage before releasing in f2fs_free_dic() f2fs: show compression in statx f2fs: clean up dic->tpages assignment f2fs: compress: support zstd compress algorithm f2fs: compress: add .{init,destroy}_decompress_ctx callback f2fs: compress: fix to call missing destroy_compress_ctx() f2fs: change default compression algorithm f2fs: clean up {cic,dic}.ref handling f2fs: fix to use f2fs_readpage_limit() in f2fs_read_multi_pages() f2fs: xattr.h: Make stub helpers inline f2fs: fix to avoid double unlock f2fs: fix potential .flags overflow on 32bit architecture f2fs: fix NULL pointer dereference in f2fs_verity_work() f2fs: fix to clear PG_error if fsverity failed f2fs: don't call fscrypt_get_encryption_info() explicitly in f2fs_tmpfile() f2fs: don't trigger data flush in foreground operation f2fs: fix NULL pointer dereference in f2fs_write_begin() f2fs: clean up f2fs_may_encrypt() f2fs: fix to avoid potential deadlock f2fs: don't change inode status under page lock f2fs: fix potential deadlock on compressed quota file f2fs: delete DIO read lock f2fs: don't mark compressed inode dirty during f2fs_iget() f2fs: fix to account compressed blocks in f2fs_compressed_blocks() f2fs: xattr.h: Replace zero-length array with flexible-array member f2fs: fix to update f2fs_super_block fields under sb_lock f2fs: Add a new CP flag to help fsck fix resize SPO issues f2fs: Fix mount failure due to SPO after a successful online resize FS f2fs: use kmem_cache pool during inline xattr lookups f2fs: skip migration only when BG_GC is called f2fs: fix to show tracepoint correctly f2fs: avoid __GFP_NOFAIL in f2fs_bio_alloc f2fs: introduce F2FS_IOC_GET_COMPRESS_BLOCKS f2fs: fix to avoid triggering IO in write path f2fs: add prefix for f2fs slab cache name f2fs: introduce DEFAULT_IO_TIMEOUT f2fs: skip GC when section is full f2fs: add migration count iff migration happens f2fs: clean up bggc mount option f2fs: clean up lfs/adaptive mount option f2fs: fix to show norecovery mount option f2fs: clean up parameter of macro XATTR_SIZE() f2fs: clean up codes with {f2fs_,}data_blkaddr() f2fs: show mounted time f2fs: Use scnprintf() for avoiding potential buffer overflow f2fs: allow to clear F2FS_COMPR_FL flag f2fs: fix to check dirty pages during compressed inode conversion f2fs: fix to account compressed inode correctly f2fs: fix wrong check on F2FS_IOC_FSSETXATTR f2fs: fix to avoid use-after-free in f2fs_write_multi_pages() f2fs: fix to avoid using uninitialized variable f2fs: fix inconsistent comments f2fs: remove i_sem lock coverage in f2fs_setxattr() f2fs: cover last_disk_size update with spinlock f2fs: fix to check i_compr_blocks correctly FROMLIST: kmod: make request_module() return an error when autoloading is disabled ANDROID: GKI: Update ABI report ANDROID: GKI: ARM64: dma-mapping: export symbol arch_setup_dma_ops ANDROID: GKI: ARM: dma-mapping: export symbol arch_setup_dma_ops ANDROID: GKI: ASoC: dapm: Avoid static route b/w cpu and codec dai ANDROID: GKI: ASoC: pcm: Add support for hostless playback/capture ANDROID: GKI: ASoC: core - add hostless DAI support ANDROID: GKI: drivers: thermal: Resolve ABI diff for struct thermal_zone_device_ops ANDROID: GKI: drivers: thermal: Add support for getting trip temperature ANDROID: GKI: Add functions of_thermal_handle_trip/of_thermal_handle_trip_temp ANDROID: GKI: drivers: thermal: Add post suspend evaluate flag to thermal zone devicetree UPSTREAM: loop: Only freeze block queue when needed. UPSTREAM: loop: Only change blocksize when needed. ANDROID: Fix wq fp check for CFI builds ANDROID: GKI: update abi definition after CONFIG_DEBUG_LIST was enabled ANDROID: gki_defconfig: enable CONFIG_DEBUG_LIST ANDROID: GKI: Update ABI definition ANDROID: GKI: remove condition causing sk_buff struct ABI differences ANDROID: GKI: Export symbol arch_timer_mem_get_cval ANDROID: GKI: pwm: core: Add option to config PWM duty/period with u64 data length ANDROID: Update ABI whitelist for qcom SoCs ANDROID: Incremental fs: Fix remount ANDROID: Incremental fs: Protect get_fill_block, and add a field ANDROID: Incremental fs: Fix crash polling 0 size read_log ANDROID: Incremental fs: get_filled_blocks: better index_out ANDROID: GKI: of: property: Add device links support for "qcom,wrapper-dev" ANDROID: GKI: update abi definitions due to recent changes ANDROID: GKI: clk: Initialize in stack clk_init_data to 0 in all drivers ANDROID: GKI: drivers: clksource: Add API to return cval ANDROID: GKI: clk: Add support for voltage voting ANDROID: GKI: kernel: Export task and IRQ affinity symbols ANDROID: GKI: regulator: core: Add support for regulator providers with sync state ANDROID: GKI: regulator: Call proxy-consumer functions for each regulator registered ANDROID: GKI: regulator: Add proxy consumer driver ANDROID: GKI: regulator: core: allow long device tree supply regulator property names ANDROID: GKI: Revert "regulator: Enable supply regulator if child rail is enabled." ANDROID: GKI: regulator: Remove redundant set_mode call in drms_uA_update ANDROID: GKI: net: Add the get current NAPI context API ANDROID: GKI: remove DRM_KMS_CMA_HELPER from GKI configuration ANDROID: GKI: edac: Fix ABI diffs in edac_device_ctl_info struct ANDROID: GKI: pwm: Add different PWM output types support UPSTREAM: cfg80211: Authentication offload to user space in AP mode Linux 4.19.114 arm64: dts: ls1046ardb: set RGMII interfaces to RGMII_ID mode arm64: dts: ls1043a-rdb: correct RGMII delay mode to rgmii-id ARM: dts: N900: fix onenand timings ARM: dts: imx6: phycore-som: fix arm and soc minimum voltage ARM: bcm2835-rpi-zero-w: Add missing pinctrl name ARM: dts: oxnas: Fix clear-mask property perf map: Fix off by one in strncpy() size argument arm64: alternative: fix build with clang integrated assembler net: ks8851-ml: Fix IO operations, again gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 CHT + AXP288 model bpf: Explicitly memset some bpf info structures declared on the stack bpf: Explicitly memset the bpf_attr structure platform/x86: pmc_atom: Add Lex 2I385SW to critclk_systems DMI table vt: vt_ioctl: fix use-after-free in vt_in_use() vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console vt: vt_ioctl: remove unnecessary console allocation checks vt: switch vt_dont_switch to bool vt: ioctl, switch VT_IS_IN_USE and VT_BUSY to inlines vt: selection, introduce vc_is_sel mac80211: fix authentication with iwlwifi/mvm mac80211: Check port authorization in the ieee80211_tx_dequeue() case media: xirlink_cit: add missing descriptor sanity checks media: stv06xx: add missing descriptor sanity checks media: dib0700: fix rc endpoint lookup media: ov519: add missing endpoint sanity checks libfs: fix infoleak in simple_attr_read() ahci: Add Intel Comet Lake H RAID PCI ID staging: wlan-ng: fix use-after-free Read in hfa384x_usbin_callback staging: wlan-ng: fix ODEBUG bug in prism2sta_disconnect_usb staging: rtl8188eu: Add ASUS USB-N10 Nano B1 to device table media: usbtv: fix control-message timeouts media: flexcop-usb: fix endpoint sanity check usb: musb: fix crash with highmen PIO and usbmon USB: serial: io_edgeport: fix slab-out-of-bounds read in edge_interrupt_callback USB: cdc-acm: restore capability check order USB: serial: option: add Wistron Neweb D19Q1 USB: serial: option: add BroadMobi BM806U USB: serial: option: add support for ASKEY WWHC050 mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX mac80211: add option for setting control flags Revert "r8169: check that Realtek PHY driver module is loaded" vti6: Fix memory leak of skb if input policy check fails bpf/btf: Fix BTF verification of enum members in struct/union netfilter: nft_fwd_netdev: validate family and chain type netfilter: flowtable: reload ip{v6}h in nf_flow_tuple_ip{v6} afs: Fix some tracing details xfrm: policy: Fix doulbe free in xfrm_policy_timer xfrm: add the missing verify_sec_ctx_len check in xfrm_add_acquire xfrm: fix uctx len check in verify_sec_ctx_len RDMA/mlx5: Block delay drop to unprivileged users vti[6]: fix packet tx through bpf_redirect() in XinY cases xfrm: handle NETDEV_UNREGISTER for xfrm device genirq: Fix reference leaks on irq affinity notifiers RDMA/core: Ensure security pkey modify is not lost gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 BYT + AXP288 model gpiolib: acpi: Rework honor_wakeup option into an ignore_wake option gpiolib: acpi: Correct comment for HP x2 10 honor_wakeup quirk mac80211: mark station unauthorized before key removal nl80211: fix NL80211_ATTR_CHANNEL_WIDTH attribute type scsi: sd: Fix optimal I/O size for devices that change reported values scripts/dtc: Remove redundant YYLOC global declaration tools: Let O= makes handle a relative path with -C option perf probe: Do not depend on dwfl_module_addrsym() ARM: dts: omap5: Add bus_dma_limit for L3 bus ARM: dts: dra7: Add bus_dma_limit for L3 bus ceph: check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL Input: avoid BIT() macro usage in the serio.h UAPI header Input: synaptics - enable RMI on HP Envy 13-ad105ng Input: raydium_i2c_ts - fix error codes in raydium_i2c_boot_trigger() i2c: hix5hd2: add missed clk_disable_unprepare in remove ftrace/x86: Anotate text_mutex split between ftrace_arch_code_modify_post_process() and ftrace_arch_code_modify_prepare() sxgbe: Fix off by one in samsung driver strncpy size arg dpaa_eth: Remove unnecessary boolean expression in dpaa_get_headroom mac80211: Do not send mesh HWMP PREQ if HWMP is disabled scsi: ipr: Fix softlockup when rescanning devices in petitboot s390/qeth: handle error when backing RX buffer fsl/fman: detect FMan erratum A050385 arm64: dts: ls1043a: FMan erratum A050385 dt-bindings: net: FMan erratum A050385 cgroup1: don't call release_agent when it is "" drivers/of/of_mdio.c:fix of_mdiobus_register() cpupower: avoid multiple definition with gcc -fno-common nfs: add minor version to nfs_server_key for fscache cgroup-v1: cgroup_pidlist_next should update position index hsr: set .netnsok flag hsr: add restart routine into hsr_get_node_list() hsr: use rcu_read_lock() in hsr_get_node_{list/status}() vxlan: check return value of gro_cells_init() tcp: repair: fix TCP_QUEUE_SEQ implementation r8169: re-enable MSI on RTL8168c net: phy: mdio-mux-bcm-iproc: check clk_prepare_enable() return value net: dsa: mt7530: Change the LINK bit to reflect the link status net: ip_gre: Accept IFLA_INFO_DATA-less configuration net: ip_gre: Separate ERSPAN newlink / changelink callbacks bnxt_en: Reset rings if ring reservation fails during open() bnxt_en: fix memory leaks in bnxt_dcbnl_ieee_getets() slcan: not call free_netdev before rtnl_unlock in slcan_open NFC: fdp: Fix a signedness bug in fdp_nci_send_patch() net: stmmac: dwmac-rk: fix error path in rk_gmac_probe net_sched: keep alloc_hash updated after hash allocation net_sched: cls_route: remove the right filter from hashtable net: qmi_wwan: add support for ASKEY WWHC050 net/packet: tpacket_rcv: avoid a producer race condition net: mvneta: Fix the case where the last poll did not process all rx net: dsa: Fix duplicate frames flooded by learning net: cbs: Fix software cbs to consider packet sending time mlxsw: spectrum_mr: Fix list iteration in error path macsec: restrict to ethernet devices hsr: fix general protection fault in hsr_addr_is_self() geneve: move debug check after netdev unregister Revert "drm/dp_mst: Skip validating ports during destruction, just ref" mmc: sdhci-tegra: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY mmc: sdhci-omap: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for eMMC sleep command mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard mmc: core: Allow host controllers to require R1B for CMD6 f2fs: fix to avoid potential deadlock f2fs: add missing function name in kernel message f2fs: recycle unused compress_data.chksum feild f2fs: fix to avoid NULL pointer dereference f2fs: fix leaking uninitialized memory in compressed clusters f2fs: fix the panic in do_checkpoint() f2fs: fix to wait all node page writeback mm/swapfile.c: move inode_lock out of claim_swapfile fscrypt: don't evict dirty inodes after removing key Conflicts: Documentation/arm64/silicon-errata.txt Documentation/devicetree/bindings Documentation/devicetree/bindings/net/fsl-fman.txt arch/arm/kernel/setup.c arch/arm/kernel/smp.c arch/arm/mm/dma-mapping.c arch/arm64/Kconfig arch/arm64/Makefile arch/arm64/include/asm/cpucaps.h arch/arm64/include/asm/cputype.h arch/arm64/include/asm/proc-fns.h arch/arm64/include/asm/traps.h arch/arm64/kernel/arm64ksyms.c arch/arm64/kernel/cpu_errata.c arch/arm64/kernel/setup.c arch/arm64/kernel/smp.c arch/arm64/mm/dma-mapping.c arch/arm64/mm/fault.c arch/arm64/mm/proc.S drivers/base/power/wakeup.c drivers/clk/clk.c drivers/clk/qcom/clk-rcg2.c drivers/clocksource/arm_arch_timer.c drivers/devfreq/devfreq.c drivers/devfreq/governor_simpleondemand.c drivers/dma-buf/dma-buf.c drivers/extcon/extcon.c drivers/gpu/Makefile drivers/gpu/drm/drm_connector.c drivers/gpu/drm/drm_dp_mst_topology.c drivers/gpu/drm/drm_edid.c drivers/gpu/drm/drm_file.c drivers/gpu/drm/drm_panel.c drivers/gpu/drm/drm_property.c drivers/iommu/Kconfig drivers/iommu/Makefile drivers/iommu/arm-smmu.c drivers/iommu/dma-iommu.c drivers/iommu/dma-mapping-fast.c drivers/iommu/io-pgtable-arm.c drivers/iommu/io-pgtable-fast.c drivers/iommu/io-pgtable.c drivers/iommu/iommu.c drivers/irqchip/irq-gic-v3.c drivers/media/v4l2-core/v4l2-ioctl.c drivers/mmc/core/Kconfig drivers/mmc/core/block.c drivers/mmc/core/queue.c drivers/mmc/host/cqhci.c drivers/mmc/host/sdhci-msm.c drivers/net/wireless/ath/wil6210/interrupt.c drivers/net/wireless/ath/wil6210/main.c drivers/net/wireless/ath/wil6210/wil6210.h drivers/net/wireless/ath/wil6210/wmi.c drivers/nvmem/core.c drivers/nvmem/nvmem-sysfs.c drivers/of/fdt.c drivers/power/supply/power_supply_sysfs.c drivers/pwm/sysfs.c drivers/regulator/core.c drivers/scsi/sd.c drivers/scsi/ufs/ufshcd.c drivers/tty/serial/Kconfig drivers/tty/serial/Makefile drivers/usb/common/common.c fs/crypto/crypto.c fs/f2fs/checkpoint.c fs/f2fs/f2fs.h include/drm/drm_connector.h include/drm/drm_dp_mst_helper.h include/drm/drm_panel.h include/linux/clk-provider.h include/linux/dma-buf.h include/linux/dma-mapping-fast.h include/linux/dma-mapping.h include/linux/extcon.h include/linux/io-pgtable.h include/linux/iommu.h include/linux/kobject.h include/linux/mm.h include/linux/mm_types.h include/linux/mmc/host.h include/linux/netdevice.h include/linux/power_supply.h include/linux/pwm.h include/linux/regulator/driver.h include/linux/thermal.h include/linux/vm_event_item.h include/net/cfg80211.h include/scsi/scsi_device.h include/sound/pcm.h include/sound/soc.h include/uapi/drm/drm_mode.h include/uapi/linux/coresight-stm.h include/uapi/linux/ip.h include/uapi/linux/nl80211.h include/uapi/linux/videodev2.h include/uapi/sound/compress_offload.h kernel/dma/coherent.c kernel/dma/mapping.c kernel/panic.c kernel/power/qos.c kernel/sched/sched.h mm/Kconfig mm/filemap.c mm/swapfile.c mm/vmalloc.c mm/vmstat.c net/qrtr/qrtr.c net/wireless/nl80211.c net/wireless/scan.c sound/core/compress_offload.c sound/soc/soc-core.c sound/usb/card.c sound/usb/pcm.c sound/usb/pcm.h sound/usb/usbaudio.h Fixed build errors: drivers/base/power/main.c drivers/thermal/thermal_core.c drivers/cpuidle/lpm-levels.c include/soc/qcom/lpm_levels.h Change-Id: Idf25b239f53681bdfa2ef371a91720fadf1a3f01 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
4625 lines
112 KiB
C
4625 lines
112 KiB
C
/*
|
|
* kernel/lockdep.c
|
|
*
|
|
* Runtime locking correctness validator
|
|
*
|
|
* Started by Ingo Molnar:
|
|
*
|
|
* Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
|
|
* Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
|
|
*
|
|
* this code maps all the lock dependencies as they occur in a live kernel
|
|
* and will warn about the following classes of locking bugs:
|
|
*
|
|
* - lock inversion scenarios
|
|
* - circular lock dependencies
|
|
* - hardirq/softirq safe/unsafe locking bugs
|
|
*
|
|
* Bugs are reported even if the current locking scenario does not cause
|
|
* any deadlock at this point.
|
|
*
|
|
* I.e. if anytime in the past two locks were taken in a different order,
|
|
* even if it happened for another task, even if those were different
|
|
* locks (but of the same class as this lock), this code will detect it.
|
|
*
|
|
* Thanks to Arjan van de Ven for coming up with the initial idea of
|
|
* mapping lock dependencies runtime.
|
|
*/
|
|
#define DISABLE_BRANCH_PROFILING
|
|
#include <linux/mutex.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/sched/clock.h>
|
|
#include <linux/sched/task.h>
|
|
#include <linux/sched/mm.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/module.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/kallsyms.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/stacktrace.h>
|
|
#include <linux/debug_locks.h>
|
|
#include <linux/irqflags.h>
|
|
#include <linux/utsname.h>
|
|
#include <linux/hash.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/stringify.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/gfp.h>
|
|
#include <linux/random.h>
|
|
#include <linux/jhash.h>
|
|
#include <linux/nmi.h>
|
|
|
|
#include <asm/sections.h>
|
|
#include <asm/stacktrace.h>
|
|
|
|
#include "lockdep_internals.h"
|
|
|
|
#define CREATE_TRACE_POINTS
|
|
#include <trace/events/lock.h>
|
|
|
|
#ifdef CONFIG_PROVE_LOCKING
|
|
int prove_locking = 1;
|
|
module_param(prove_locking, int, 0644);
|
|
#else
|
|
#define prove_locking 0
|
|
#endif
|
|
|
|
#ifdef CONFIG_LOCK_STAT
|
|
int lock_stat = 1;
|
|
module_param(lock_stat, int, 0644);
|
|
#else
|
|
#define lock_stat 0
|
|
#endif
|
|
|
|
static int lockdep_log = 1;
|
|
|
|
static int lockdep_logging_off(void)
|
|
{
|
|
if (lockdep_log && xchg(&lockdep_log, 0)) {
|
|
if (!debug_locks_silent)
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
#define MAX_ITR 20
|
|
#define lockdep_warn_on(cond) \
|
|
({ \
|
|
int __ret = 0; \
|
|
\
|
|
if (!oops_in_progress && unlikely(cond)) { \
|
|
if (lockdep_logging_off() && !debug_locks_silent) \
|
|
WARN(1, "lockdep_warn_on(%s)", #cond); \
|
|
__ret = 1; \
|
|
} \
|
|
__ret; \
|
|
})
|
|
|
|
/*
|
|
* lockdep_lock: protects the lockdep graph, the hashes and the
|
|
* class/list/hash allocators.
|
|
*
|
|
* This is one of the rare exceptions where it's justified
|
|
* to use a raw spinlock - we really dont want the spinlock
|
|
* code to recurse back into the lockdep code...
|
|
*/
|
|
static arch_spinlock_t lockdep_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
|
|
|
|
static int graph_lock(void)
|
|
{
|
|
arch_spin_lock(&lockdep_lock);
|
|
/*
|
|
* Make sure that if another CPU detected a bug while
|
|
* walking the graph we dont change it (while the other
|
|
* CPU is busy printing out stuff with the graph lock
|
|
* dropped already)
|
|
*/
|
|
if (!debug_locks) {
|
|
arch_spin_unlock(&lockdep_lock);
|
|
return 0;
|
|
}
|
|
/* prevent any recursions within lockdep from causing deadlocks */
|
|
current->lockdep_recursion++;
|
|
return 1;
|
|
}
|
|
|
|
static inline int graph_unlock(void)
|
|
{
|
|
if (debug_locks && !arch_spin_is_locked(&lockdep_lock)) {
|
|
/*
|
|
* The lockdep graph lock isn't locked while we expect it to
|
|
* be, we're confused now, bye!
|
|
*/
|
|
return lockdep_warn_on(1);
|
|
}
|
|
|
|
current->lockdep_recursion--;
|
|
arch_spin_unlock(&lockdep_lock);
|
|
return 0;
|
|
}
|
|
|
|
static int lockdep_logging_off_graph_unlock(void)
|
|
{
|
|
int ret = lockdep_logging_off();
|
|
|
|
graph_unlock();
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Turn lock debugging off and return with 0 if it was off already,
|
|
* and also release the graph lock:
|
|
*/
|
|
static inline int debug_locks_off_graph_unlock(void)
|
|
{
|
|
int ret = debug_locks_off();
|
|
|
|
arch_spin_unlock(&lockdep_lock);
|
|
|
|
return ret;
|
|
}
|
|
|
|
unsigned long nr_list_entries;
|
|
static struct lock_list list_entries[MAX_LOCKDEP_ENTRIES];
|
|
|
|
/*
|
|
* All data structures here are protected by the global debug_lock.
|
|
*
|
|
* Mutex key structs only get allocated, once during bootup, and never
|
|
* get freed - this significantly simplifies the debugging code.
|
|
*/
|
|
unsigned long nr_lock_classes;
|
|
static struct lock_class lock_classes[MAX_LOCKDEP_KEYS];
|
|
|
|
static inline struct lock_class *hlock_class(struct held_lock *hlock)
|
|
{
|
|
if (!hlock->class_idx) {
|
|
/*
|
|
* Someone passed in garbage, we give up.
|
|
*/
|
|
lockdep_warn_on(1);
|
|
return NULL;
|
|
}
|
|
return lock_classes + hlock->class_idx - 1;
|
|
}
|
|
|
|
#ifdef CONFIG_LOCK_STAT
|
|
static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], cpu_lock_stats);
|
|
|
|
static inline u64 lockstat_clock(void)
|
|
{
|
|
return local_clock();
|
|
}
|
|
|
|
static int lock_point(unsigned long points[], unsigned long ip)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < LOCKSTAT_POINTS; i++) {
|
|
if (points[i] == 0) {
|
|
points[i] = ip;
|
|
break;
|
|
}
|
|
if (points[i] == ip)
|
|
break;
|
|
}
|
|
|
|
return i;
|
|
}
|
|
|
|
static void lock_time_inc(struct lock_time *lt, u64 time)
|
|
{
|
|
if (time > lt->max)
|
|
lt->max = time;
|
|
|
|
if (time < lt->min || !lt->nr)
|
|
lt->min = time;
|
|
|
|
lt->total += time;
|
|
lt->nr++;
|
|
}
|
|
|
|
static inline void lock_time_add(struct lock_time *src, struct lock_time *dst)
|
|
{
|
|
if (!src->nr)
|
|
return;
|
|
|
|
if (src->max > dst->max)
|
|
dst->max = src->max;
|
|
|
|
if (src->min < dst->min || !dst->nr)
|
|
dst->min = src->min;
|
|
|
|
dst->total += src->total;
|
|
dst->nr += src->nr;
|
|
}
|
|
|
|
struct lock_class_stats lock_stats(struct lock_class *class)
|
|
{
|
|
struct lock_class_stats stats;
|
|
int cpu, i;
|
|
|
|
memset(&stats, 0, sizeof(struct lock_class_stats));
|
|
for_each_possible_cpu(cpu) {
|
|
struct lock_class_stats *pcs =
|
|
&per_cpu(cpu_lock_stats, cpu)[class - lock_classes];
|
|
|
|
for (i = 0; i < ARRAY_SIZE(stats.contention_point); i++)
|
|
stats.contention_point[i] += pcs->contention_point[i];
|
|
|
|
for (i = 0; i < ARRAY_SIZE(stats.contending_point); i++)
|
|
stats.contending_point[i] += pcs->contending_point[i];
|
|
|
|
lock_time_add(&pcs->read_waittime, &stats.read_waittime);
|
|
lock_time_add(&pcs->write_waittime, &stats.write_waittime);
|
|
|
|
lock_time_add(&pcs->read_holdtime, &stats.read_holdtime);
|
|
lock_time_add(&pcs->write_holdtime, &stats.write_holdtime);
|
|
|
|
for (i = 0; i < ARRAY_SIZE(stats.bounces); i++)
|
|
stats.bounces[i] += pcs->bounces[i];
|
|
}
|
|
|
|
return stats;
|
|
}
|
|
|
|
void clear_lock_stats(struct lock_class *class)
|
|
{
|
|
int cpu;
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
struct lock_class_stats *cpu_stats =
|
|
&per_cpu(cpu_lock_stats, cpu)[class - lock_classes];
|
|
|
|
memset(cpu_stats, 0, sizeof(struct lock_class_stats));
|
|
}
|
|
memset(class->contention_point, 0, sizeof(class->contention_point));
|
|
memset(class->contending_point, 0, sizeof(class->contending_point));
|
|
}
|
|
|
|
static struct lock_class_stats *get_lock_stats(struct lock_class *class)
|
|
{
|
|
return &this_cpu_ptr(cpu_lock_stats)[class - lock_classes];
|
|
}
|
|
|
|
static void lock_release_holdtime(struct held_lock *hlock)
|
|
{
|
|
struct lock_class_stats *stats;
|
|
u64 holdtime;
|
|
|
|
if (!lock_stat)
|
|
return;
|
|
|
|
holdtime = lockstat_clock() - hlock->holdtime_stamp;
|
|
|
|
stats = get_lock_stats(hlock_class(hlock));
|
|
if (hlock->read)
|
|
lock_time_inc(&stats->read_holdtime, holdtime);
|
|
else
|
|
lock_time_inc(&stats->write_holdtime, holdtime);
|
|
}
|
|
#else
|
|
static inline void lock_release_holdtime(struct held_lock *hlock)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* We keep a global list of all lock classes. The list only grows,
|
|
* never shrinks. The list is only accessed with the lockdep
|
|
* spinlock lock held.
|
|
*/
|
|
LIST_HEAD(all_lock_classes);
|
|
|
|
/*
|
|
* The lockdep classes are in a hash-table as well, for fast lookup:
|
|
*/
|
|
#define CLASSHASH_BITS (MAX_LOCKDEP_KEYS_BITS - 1)
|
|
#define CLASSHASH_SIZE (1UL << CLASSHASH_BITS)
|
|
#define __classhashfn(key) hash_long((unsigned long)key, CLASSHASH_BITS)
|
|
#define classhashentry(key) (classhash_table + __classhashfn((key)))
|
|
|
|
static struct hlist_head classhash_table[CLASSHASH_SIZE];
|
|
|
|
/*
|
|
* We put the lock dependency chains into a hash-table as well, to cache
|
|
* their existence:
|
|
*/
|
|
#define CHAINHASH_BITS (MAX_LOCKDEP_CHAINS_BITS-1)
|
|
#define CHAINHASH_SIZE (1UL << CHAINHASH_BITS)
|
|
#define __chainhashfn(chain) hash_long(chain, CHAINHASH_BITS)
|
|
#define chainhashentry(chain) (chainhash_table + __chainhashfn((chain)))
|
|
|
|
static struct hlist_head chainhash_table[CHAINHASH_SIZE];
|
|
|
|
/*
|
|
* The hash key of the lock dependency chains is a hash itself too:
|
|
* it's a hash of all locks taken up to that lock, including that lock.
|
|
* It's a 64-bit hash, because it's important for the keys to be
|
|
* unique.
|
|
*/
|
|
static inline u64 iterate_chain_key(u64 key, u32 idx)
|
|
{
|
|
u32 k0 = key, k1 = key >> 32;
|
|
|
|
__jhash_mix(idx, k0, k1); /* Macro that modifies arguments! */
|
|
|
|
return k0 | (u64)k1 << 32;
|
|
}
|
|
|
|
void lockdep_off(void)
|
|
{
|
|
current->lockdep_recursion++;
|
|
}
|
|
EXPORT_SYMBOL(lockdep_off);
|
|
|
|
void lockdep_on(void)
|
|
{
|
|
current->lockdep_recursion--;
|
|
}
|
|
EXPORT_SYMBOL(lockdep_on);
|
|
|
|
/*
|
|
* Debugging switches:
|
|
*/
|
|
|
|
#define VERBOSE 0
|
|
#define VERY_VERBOSE 0
|
|
|
|
#if VERBOSE
|
|
# define HARDIRQ_VERBOSE 1
|
|
# define SOFTIRQ_VERBOSE 1
|
|
#else
|
|
# define HARDIRQ_VERBOSE 0
|
|
# define SOFTIRQ_VERBOSE 0
|
|
#endif
|
|
|
|
#if VERBOSE || HARDIRQ_VERBOSE || SOFTIRQ_VERBOSE
|
|
/*
|
|
* Quick filtering for interesting events:
|
|
*/
|
|
static int class_filter(struct lock_class *class)
|
|
{
|
|
#if 0
|
|
/* Example */
|
|
if (class->name_version == 1 &&
|
|
!strcmp(class->name, "lockname"))
|
|
return 1;
|
|
if (class->name_version == 1 &&
|
|
!strcmp(class->name, "&struct->lockfield"))
|
|
return 1;
|
|
#endif
|
|
/* Filter everything else. 1 would be to allow everything else */
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
static int verbose(struct lock_class *class)
|
|
{
|
|
#if VERBOSE
|
|
return class_filter(class);
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Stack-trace: tightly packed array of stack backtrace
|
|
* addresses. Protected by the graph_lock.
|
|
*/
|
|
unsigned long nr_stack_trace_entries;
|
|
static unsigned long stack_trace[MAX_STACK_TRACE_ENTRIES];
|
|
|
|
static void print_lockdep_off(const char *bug_msg)
|
|
{
|
|
printk(KERN_DEBUG "%s\n", bug_msg);
|
|
printk(KERN_DEBUG "turning off the locking correctness validator.\n");
|
|
#ifdef CONFIG_LOCK_STAT
|
|
printk(KERN_DEBUG "Please attach the output of /proc/lock_stat to the bug report\n");
|
|
#endif
|
|
}
|
|
|
|
static int save_trace(struct stack_trace *trace)
|
|
{
|
|
trace->nr_entries = 0;
|
|
trace->max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries;
|
|
trace->entries = stack_trace + nr_stack_trace_entries;
|
|
|
|
trace->skip = 3;
|
|
|
|
save_stack_trace(trace);
|
|
|
|
/*
|
|
* Some daft arches put -1 at the end to indicate its a full trace.
|
|
*
|
|
* <rant> this is buggy anyway, since it takes a whole extra entry so a
|
|
* complete trace that maxes out the entries provided will be reported
|
|
* as incomplete, friggin useless </rant>
|
|
*/
|
|
if (trace->nr_entries != 0 &&
|
|
trace->entries[trace->nr_entries-1] == ULONG_MAX)
|
|
trace->nr_entries--;
|
|
|
|
trace->max_entries = trace->nr_entries;
|
|
|
|
nr_stack_trace_entries += trace->nr_entries;
|
|
|
|
if (nr_stack_trace_entries >= MAX_STACK_TRACE_ENTRIES-1) {
|
|
if (!lockdep_logging_off_graph_unlock())
|
|
return 0;
|
|
|
|
print_lockdep_off("BUG: MAX_STACK_TRACE_ENTRIES too low!");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
unsigned int nr_hardirq_chains;
|
|
unsigned int nr_softirq_chains;
|
|
unsigned int nr_process_chains;
|
|
unsigned int max_lockdep_depth;
|
|
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
/*
|
|
* Various lockdep statistics:
|
|
*/
|
|
DEFINE_PER_CPU(struct lockdep_stats, lockdep_stats);
|
|
#endif
|
|
|
|
/*
|
|
* Locking printouts:
|
|
*/
|
|
|
|
#define __USAGE(__STATE) \
|
|
[LOCK_USED_IN_##__STATE] = "IN-"__stringify(__STATE)"-W", \
|
|
[LOCK_ENABLED_##__STATE] = __stringify(__STATE)"-ON-W", \
|
|
[LOCK_USED_IN_##__STATE##_READ] = "IN-"__stringify(__STATE)"-R",\
|
|
[LOCK_ENABLED_##__STATE##_READ] = __stringify(__STATE)"-ON-R",
|
|
|
|
static const char *usage_str[] =
|
|
{
|
|
#define LOCKDEP_STATE(__STATE) __USAGE(__STATE)
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
[LOCK_USED] = "INITIAL USE",
|
|
};
|
|
|
|
const char * __get_key_name(struct lockdep_subclass_key *key, char *str)
|
|
{
|
|
return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str);
|
|
}
|
|
|
|
static inline unsigned long lock_flag(enum lock_usage_bit bit)
|
|
{
|
|
return 1UL << bit;
|
|
}
|
|
|
|
static char get_usage_char(struct lock_class *class, enum lock_usage_bit bit)
|
|
{
|
|
char c = '.';
|
|
|
|
if (class->usage_mask & lock_flag(bit + 2))
|
|
c = '+';
|
|
if (class->usage_mask & lock_flag(bit)) {
|
|
c = '-';
|
|
if (class->usage_mask & lock_flag(bit + 2))
|
|
c = '?';
|
|
}
|
|
|
|
return c;
|
|
}
|
|
|
|
void get_usage_chars(struct lock_class *class, char usage[LOCK_USAGE_CHARS])
|
|
{
|
|
int i = 0;
|
|
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE); \
|
|
usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE##_READ);
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
|
|
usage[i] = '\0';
|
|
}
|
|
|
|
static void __print_lock_name(struct lock_class *class)
|
|
{
|
|
char str[KSYM_NAME_LEN];
|
|
const char *name;
|
|
|
|
name = class->name;
|
|
if (!name) {
|
|
name = __get_key_name(class->key, str);
|
|
printk(KERN_CONT "%s", name);
|
|
} else {
|
|
printk(KERN_CONT "%s", name);
|
|
if (class->name_version > 1)
|
|
printk(KERN_CONT "#%d", class->name_version);
|
|
if (class->subclass)
|
|
printk(KERN_CONT "/%d", class->subclass);
|
|
}
|
|
}
|
|
|
|
static void print_lock_name(struct lock_class *class)
|
|
{
|
|
char usage[LOCK_USAGE_CHARS];
|
|
|
|
get_usage_chars(class, usage);
|
|
|
|
printk(KERN_CONT " (");
|
|
__print_lock_name(class);
|
|
printk(KERN_CONT "){%s}", usage);
|
|
}
|
|
|
|
static void print_lockdep_cache(struct lockdep_map *lock)
|
|
{
|
|
const char *name;
|
|
char str[KSYM_NAME_LEN];
|
|
|
|
name = lock->name;
|
|
if (!name)
|
|
name = __get_key_name(lock->key->subkeys, str);
|
|
|
|
printk(KERN_CONT "%s", name);
|
|
}
|
|
|
|
static void print_lock(struct held_lock *hlock)
|
|
{
|
|
/*
|
|
* We can be called locklessly through debug_show_all_locks() so be
|
|
* extra careful, the hlock might have been released and cleared.
|
|
*/
|
|
unsigned int class_idx = hlock->class_idx;
|
|
|
|
/* Don't re-read hlock->class_idx, can't use READ_ONCE() on bitfields: */
|
|
barrier();
|
|
|
|
if (!class_idx || (class_idx - 1) >= MAX_LOCKDEP_KEYS) {
|
|
printk(KERN_CONT "<RELEASED>\n");
|
|
return;
|
|
}
|
|
|
|
printk(KERN_CONT "%p", hlock->instance);
|
|
print_lock_name(lock_classes + class_idx - 1);
|
|
printk(KERN_CONT ", at: %pS\n", (void *)hlock->acquire_ip);
|
|
}
|
|
|
|
static void lockdep_print_held_locks(struct task_struct *p)
|
|
{
|
|
int i, depth = READ_ONCE(p->lockdep_depth);
|
|
|
|
if (!depth)
|
|
printk("no locks held by %s/%d.\n", p->comm, task_pid_nr(p));
|
|
else
|
|
printk("%d lock%s held by %s/%d:\n", depth,
|
|
depth > 1 ? "s" : "", p->comm, task_pid_nr(p));
|
|
/*
|
|
* It's not reliable to print a task's held locks if it's not sleeping
|
|
* and it's not the current task.
|
|
*/
|
|
if (p->state == TASK_RUNNING && p != current)
|
|
return;
|
|
for (i = 0; i < depth; i++) {
|
|
printk(" #%d: ", i);
|
|
print_lock(p->held_locks + i);
|
|
}
|
|
}
|
|
|
|
static void print_kernel_ident(void)
|
|
{
|
|
printk("%s %.*s %s\n", init_utsname()->release,
|
|
(int)strcspn(init_utsname()->version, " "),
|
|
init_utsname()->version,
|
|
print_tainted());
|
|
}
|
|
|
|
static int very_verbose(struct lock_class *class)
|
|
{
|
|
#if VERY_VERBOSE
|
|
return class_filter(class);
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Is this the address of a static object:
|
|
*/
|
|
#ifdef __KERNEL__
|
|
static int static_obj(void *obj)
|
|
{
|
|
unsigned long start = (unsigned long) &_stext,
|
|
end = (unsigned long) &_end,
|
|
addr = (unsigned long) obj;
|
|
|
|
/*
|
|
* static variable?
|
|
*/
|
|
if ((addr >= start) && (addr < end))
|
|
return 1;
|
|
|
|
if (arch_is_kernel_data(addr))
|
|
return 1;
|
|
|
|
/*
|
|
* in-kernel percpu var?
|
|
*/
|
|
if (is_kernel_percpu_address(addr))
|
|
return 1;
|
|
|
|
/*
|
|
* module static or percpu var?
|
|
*/
|
|
return is_module_address(addr) || is_module_percpu_address(addr);
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* To make lock name printouts unique, we calculate a unique
|
|
* class->name_version generation counter:
|
|
*/
|
|
static int count_matching_names(struct lock_class *new_class)
|
|
{
|
|
struct lock_class *class;
|
|
int count = 0;
|
|
|
|
if (!new_class->name)
|
|
return 0;
|
|
|
|
list_for_each_entry_rcu(class, &all_lock_classes, lock_entry) {
|
|
if (new_class->key - new_class->subclass == class->key)
|
|
return class->name_version;
|
|
if (class->name && !strcmp(class->name, new_class->name))
|
|
count = max(count, class->name_version);
|
|
}
|
|
|
|
return count + 1;
|
|
}
|
|
|
|
static inline struct lock_class *
|
|
look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)
|
|
{
|
|
struct lockdep_subclass_key *key;
|
|
struct hlist_head *hash_head;
|
|
struct lock_class *class;
|
|
|
|
if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) {
|
|
debug_locks_off();
|
|
printk(KERN_ERR
|
|
"BUG: looking up invalid subclass: %u\n", subclass);
|
|
printk(KERN_ERR
|
|
"turning off the locking correctness validator.\n");
|
|
dump_stack();
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
* If it is not initialised then it has never been locked,
|
|
* so it won't be present in the hash table.
|
|
*/
|
|
if (unlikely(!lock->key))
|
|
return NULL;
|
|
|
|
/*
|
|
* NOTE: the class-key must be unique. For dynamic locks, a static
|
|
* lock_class_key variable is passed in through the mutex_init()
|
|
* (or spin_lock_init()) call - which acts as the key. For static
|
|
* locks we use the lock object itself as the key.
|
|
*/
|
|
BUILD_BUG_ON(sizeof(struct lock_class_key) >
|
|
sizeof(struct lockdep_map));
|
|
|
|
key = lock->key->subkeys + subclass;
|
|
|
|
hash_head = classhashentry(key);
|
|
|
|
/*
|
|
* We do an RCU walk of the hash, see lockdep_free_key_range().
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return NULL;
|
|
|
|
hlist_for_each_entry_rcu(class, hash_head, hash_entry) {
|
|
if (class->key == key) {
|
|
/*
|
|
* Huh! same key, different name? Did someone trample
|
|
* on some memory? We're most confused.
|
|
*/
|
|
WARN_ON_ONCE(class->name != lock->name);
|
|
return class;
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
* Static locks do not have their class-keys yet - for them the key is
|
|
* the lock object itself. If the lock is in the per cpu area, the
|
|
* canonical address of the lock (per cpu offset removed) is used.
|
|
*/
|
|
static bool assign_lock_key(struct lockdep_map *lock)
|
|
{
|
|
unsigned long can_addr, addr = (unsigned long)lock;
|
|
|
|
if (__is_kernel_percpu_address(addr, &can_addr))
|
|
lock->key = (void *)can_addr;
|
|
else if (__is_module_percpu_address(addr, &can_addr))
|
|
lock->key = (void *)can_addr;
|
|
else if (static_obj(lock))
|
|
lock->key = (void *)lock;
|
|
else {
|
|
/* Debug-check: all keys must be persistent! */
|
|
pr_err("INFO: trying to register non-static key.\n");
|
|
pr_err("the code is fine but needs lockdep annotation.\n");
|
|
dump_stack();
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
* Register a lock's class in the hash-table, if the class is not present
|
|
* yet. Otherwise we look it up. We cache the result in the lock object
|
|
* itself, so actual lookup of the hash should be once per lock object.
|
|
*/
|
|
static struct lock_class *
|
|
register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
|
|
{
|
|
struct lockdep_subclass_key *key;
|
|
struct hlist_head *hash_head;
|
|
struct lock_class *class;
|
|
|
|
DEBUG_LOCKS_WARN_ON(!irqs_disabled());
|
|
|
|
class = look_up_lock_class(lock, subclass);
|
|
if (likely(class))
|
|
goto out_set_class_cache;
|
|
|
|
if (!lock->key) {
|
|
if (!assign_lock_key(lock))
|
|
return NULL;
|
|
} else if (!static_obj(lock->key)) {
|
|
return NULL;
|
|
}
|
|
|
|
key = lock->key->subkeys + subclass;
|
|
hash_head = classhashentry(key);
|
|
|
|
if (!graph_lock()) {
|
|
return NULL;
|
|
}
|
|
/*
|
|
* We have to do the hash-walk again, to avoid races
|
|
* with another CPU:
|
|
*/
|
|
hlist_for_each_entry_rcu(class, hash_head, hash_entry) {
|
|
if (class->key == key)
|
|
goto out_unlock_set;
|
|
}
|
|
|
|
/*
|
|
* Allocate a new key from the static array, and add it to
|
|
* the hash:
|
|
*/
|
|
if (nr_lock_classes >= MAX_LOCKDEP_KEYS) {
|
|
if (!debug_locks_off_graph_unlock()) {
|
|
return NULL;
|
|
}
|
|
|
|
print_lockdep_off("BUG: MAX_LOCKDEP_KEYS too low!");
|
|
dump_stack();
|
|
return NULL;
|
|
}
|
|
class = lock_classes + nr_lock_classes++;
|
|
debug_atomic_inc(nr_unused_locks);
|
|
class->key = key;
|
|
class->name = lock->name;
|
|
class->subclass = subclass;
|
|
INIT_LIST_HEAD(&class->lock_entry);
|
|
INIT_LIST_HEAD(&class->locks_before);
|
|
INIT_LIST_HEAD(&class->locks_after);
|
|
class->name_version = count_matching_names(class);
|
|
/*
|
|
* We use RCU's safe list-add method to make
|
|
* parallel walking of the hash-list safe:
|
|
*/
|
|
hlist_add_head_rcu(&class->hash_entry, hash_head);
|
|
/*
|
|
* Add it to the global list of classes:
|
|
*/
|
|
list_add_tail_rcu(&class->lock_entry, &all_lock_classes);
|
|
|
|
if (verbose(class)) {
|
|
graph_unlock();
|
|
|
|
printk("\nnew class %px: %s", class->key, class->name);
|
|
if (class->name_version > 1)
|
|
printk(KERN_CONT "#%d", class->name_version);
|
|
printk(KERN_CONT "\n");
|
|
dump_stack();
|
|
|
|
if (!graph_lock()) {
|
|
return NULL;
|
|
}
|
|
}
|
|
out_unlock_set:
|
|
graph_unlock();
|
|
|
|
out_set_class_cache:
|
|
if (!subclass || force)
|
|
lock->class_cache[0] = class;
|
|
else if (subclass < NR_LOCKDEP_CACHING_CLASSES)
|
|
lock->class_cache[subclass] = class;
|
|
|
|
/*
|
|
* Hash collision, did we smoke some? We found a class with a matching
|
|
* hash but the subclass -- which is hashed in -- didn't match.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(class->subclass != subclass))
|
|
return NULL;
|
|
|
|
return class;
|
|
}
|
|
|
|
#ifdef CONFIG_PROVE_LOCKING
|
|
/*
|
|
* Allocate a lockdep entry. (assumes the graph_lock held, returns
|
|
* with NULL on failure)
|
|
*/
|
|
static struct lock_list *alloc_list_entry(void)
|
|
{
|
|
if (nr_list_entries >= MAX_LOCKDEP_ENTRIES) {
|
|
if (!debug_locks_off_graph_unlock())
|
|
return NULL;
|
|
|
|
print_lockdep_off("BUG: MAX_LOCKDEP_ENTRIES too low!");
|
|
dump_stack();
|
|
return NULL;
|
|
}
|
|
return list_entries + nr_list_entries++;
|
|
}
|
|
|
|
/*
|
|
* Add a new dependency to the head of the list:
|
|
*/
|
|
static int add_lock_to_list(struct lock_class *this, struct list_head *head,
|
|
unsigned long ip, int distance,
|
|
struct stack_trace *trace)
|
|
{
|
|
struct lock_list *entry;
|
|
/*
|
|
* Lock not present yet - get a new dependency struct and
|
|
* add it to the list:
|
|
*/
|
|
entry = alloc_list_entry();
|
|
if (!entry)
|
|
return 0;
|
|
|
|
entry->class = this;
|
|
entry->distance = distance;
|
|
entry->trace = *trace;
|
|
/*
|
|
* Both allocation and removal are done under the graph lock; but
|
|
* iteration is under RCU-sched; see look_up_lock_class() and
|
|
* lockdep_free_key_range().
|
|
*/
|
|
list_add_tail_rcu(&entry->entry, head);
|
|
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* For good efficiency of modular, we use power of 2
|
|
*/
|
|
#define MAX_CIRCULAR_QUEUE_SIZE 4096UL
|
|
#define CQ_MASK (MAX_CIRCULAR_QUEUE_SIZE-1)
|
|
|
|
/*
|
|
* The circular_queue and helpers is used to implement the
|
|
* breadth-first search(BFS)algorithem, by which we can build
|
|
* the shortest path from the next lock to be acquired to the
|
|
* previous held lock if there is a circular between them.
|
|
*/
|
|
struct circular_queue {
|
|
unsigned long element[MAX_CIRCULAR_QUEUE_SIZE];
|
|
unsigned int front, rear;
|
|
};
|
|
|
|
static struct circular_queue lock_cq;
|
|
|
|
unsigned int max_bfs_queue_depth;
|
|
|
|
static unsigned int lockdep_dependency_gen_id;
|
|
|
|
static inline void __cq_init(struct circular_queue *cq)
|
|
{
|
|
cq->front = cq->rear = 0;
|
|
lockdep_dependency_gen_id++;
|
|
}
|
|
|
|
static inline int __cq_empty(struct circular_queue *cq)
|
|
{
|
|
return (cq->front == cq->rear);
|
|
}
|
|
|
|
static inline int __cq_full(struct circular_queue *cq)
|
|
{
|
|
return ((cq->rear + 1) & CQ_MASK) == cq->front;
|
|
}
|
|
|
|
static inline int __cq_enqueue(struct circular_queue *cq, unsigned long elem)
|
|
{
|
|
if (__cq_full(cq))
|
|
return -1;
|
|
|
|
cq->element[cq->rear] = elem;
|
|
cq->rear = (cq->rear + 1) & CQ_MASK;
|
|
return 0;
|
|
}
|
|
|
|
static inline int __cq_dequeue(struct circular_queue *cq, unsigned long *elem)
|
|
{
|
|
if (__cq_empty(cq))
|
|
return -1;
|
|
|
|
*elem = cq->element[cq->front];
|
|
cq->front = (cq->front + 1) & CQ_MASK;
|
|
return 0;
|
|
}
|
|
|
|
static inline unsigned int __cq_get_elem_count(struct circular_queue *cq)
|
|
{
|
|
return (cq->rear - cq->front) & CQ_MASK;
|
|
}
|
|
|
|
static inline void mark_lock_accessed(struct lock_list *lock,
|
|
struct lock_list *parent)
|
|
{
|
|
unsigned long nr;
|
|
|
|
nr = lock - list_entries;
|
|
WARN_ON(nr >= nr_list_entries); /* Out-of-bounds, input fail */
|
|
lock->parent = parent;
|
|
lock->class->dep_gen_id = lockdep_dependency_gen_id;
|
|
}
|
|
|
|
static inline unsigned long lock_accessed(struct lock_list *lock)
|
|
{
|
|
unsigned long nr;
|
|
|
|
nr = lock - list_entries;
|
|
WARN_ON(nr >= nr_list_entries); /* Out-of-bounds, input fail */
|
|
return lock->class->dep_gen_id == lockdep_dependency_gen_id;
|
|
}
|
|
|
|
static inline struct lock_list *get_lock_parent(struct lock_list *child)
|
|
{
|
|
return child->parent;
|
|
}
|
|
|
|
static inline int get_lock_depth(struct lock_list *child)
|
|
{
|
|
int depth = 0;
|
|
struct lock_list *parent;
|
|
|
|
while ((parent = get_lock_parent(child))) {
|
|
child = parent;
|
|
depth++;
|
|
}
|
|
return depth;
|
|
}
|
|
|
|
static int __bfs(struct lock_list *source_entry,
|
|
void *data,
|
|
int (*match)(struct lock_list *entry, void *data),
|
|
struct lock_list **target_entry,
|
|
int forward)
|
|
{
|
|
struct lock_list *entry;
|
|
struct list_head *head;
|
|
struct circular_queue *cq = &lock_cq;
|
|
int ret = 1;
|
|
|
|
if (match(source_entry, data)) {
|
|
*target_entry = source_entry;
|
|
ret = 0;
|
|
goto exit;
|
|
}
|
|
|
|
if (forward)
|
|
head = &source_entry->class->locks_after;
|
|
else
|
|
head = &source_entry->class->locks_before;
|
|
|
|
if (list_empty(head))
|
|
goto exit;
|
|
|
|
__cq_init(cq);
|
|
__cq_enqueue(cq, (unsigned long)source_entry);
|
|
|
|
while (!__cq_empty(cq)) {
|
|
struct lock_list *lock;
|
|
|
|
__cq_dequeue(cq, (unsigned long *)&lock);
|
|
|
|
if (!lock->class) {
|
|
ret = -2;
|
|
goto exit;
|
|
}
|
|
|
|
if (forward)
|
|
head = &lock->class->locks_after;
|
|
else
|
|
head = &lock->class->locks_before;
|
|
|
|
DEBUG_LOCKS_WARN_ON(!irqs_disabled());
|
|
|
|
list_for_each_entry_rcu(entry, head, entry) {
|
|
if (!lock_accessed(entry)) {
|
|
unsigned int cq_depth;
|
|
mark_lock_accessed(entry, lock);
|
|
if (match(entry, data)) {
|
|
*target_entry = entry;
|
|
ret = 0;
|
|
goto exit;
|
|
}
|
|
|
|
if (__cq_enqueue(cq, (unsigned long)entry)) {
|
|
ret = -1;
|
|
goto exit;
|
|
}
|
|
cq_depth = __cq_get_elem_count(cq);
|
|
if (max_bfs_queue_depth < cq_depth)
|
|
max_bfs_queue_depth = cq_depth;
|
|
}
|
|
}
|
|
}
|
|
exit:
|
|
return ret;
|
|
}
|
|
|
|
static inline int __bfs_forwards(struct lock_list *src_entry,
|
|
void *data,
|
|
int (*match)(struct lock_list *entry, void *data),
|
|
struct lock_list **target_entry)
|
|
{
|
|
return __bfs(src_entry, data, match, target_entry, 1);
|
|
|
|
}
|
|
|
|
static inline int __bfs_backwards(struct lock_list *src_entry,
|
|
void *data,
|
|
int (*match)(struct lock_list *entry, void *data),
|
|
struct lock_list **target_entry)
|
|
{
|
|
return __bfs(src_entry, data, match, target_entry, 0);
|
|
|
|
}
|
|
|
|
/*
|
|
* Recursive, forwards-direction lock-dependency checking, used for
|
|
* both noncyclic checking and for hardirq-unsafe/softirq-unsafe
|
|
* checking.
|
|
*/
|
|
|
|
/*
|
|
* Print a dependency chain entry (this is only done when a deadlock
|
|
* has been detected):
|
|
*/
|
|
static noinline int
|
|
print_circular_bug_entry(struct lock_list *target, int depth)
|
|
{
|
|
if (debug_locks_silent)
|
|
return 0;
|
|
printk("\n-> #%u", depth);
|
|
print_lock_name(target->class);
|
|
printk(KERN_CONT ":\n");
|
|
print_stack_trace(&target->trace, 6);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void
|
|
print_circular_lock_scenario(struct held_lock *src,
|
|
struct held_lock *tgt,
|
|
struct lock_list *prt)
|
|
{
|
|
struct lock_class *source = hlock_class(src);
|
|
struct lock_class *target = hlock_class(tgt);
|
|
struct lock_class *parent = prt->class;
|
|
|
|
/*
|
|
* A direct locking problem where unsafe_class lock is taken
|
|
* directly by safe_class lock, then all we need to show
|
|
* is the deadlock scenario, as it is obvious that the
|
|
* unsafe lock is taken under the safe lock.
|
|
*
|
|
* But if there is a chain instead, where the safe lock takes
|
|
* an intermediate lock (middle_class) where this lock is
|
|
* not the same as the safe lock, then the lock chain is
|
|
* used to describe the problem. Otherwise we would need
|
|
* to show a different CPU case for each link in the chain
|
|
* from the safe_class lock to the unsafe_class lock.
|
|
*/
|
|
if (parent != source) {
|
|
printk("Chain exists of:\n ");
|
|
__print_lock_name(source);
|
|
printk(KERN_CONT " --> ");
|
|
__print_lock_name(parent);
|
|
printk(KERN_CONT " --> ");
|
|
__print_lock_name(target);
|
|
printk(KERN_CONT "\n\n");
|
|
}
|
|
|
|
printk(" Possible unsafe locking scenario:\n\n");
|
|
printk(" CPU0 CPU1\n");
|
|
printk(" ---- ----\n");
|
|
printk(" lock(");
|
|
__print_lock_name(target);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" lock(");
|
|
__print_lock_name(parent);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" lock(");
|
|
__print_lock_name(target);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" lock(");
|
|
__print_lock_name(source);
|
|
printk(KERN_CONT ");\n");
|
|
printk("\n *** DEADLOCK ***\n\n");
|
|
}
|
|
|
|
/*
|
|
* When a circular dependency is detected, print the
|
|
* header first:
|
|
*/
|
|
static noinline int
|
|
print_circular_bug_header(struct lock_list *entry, unsigned int depth,
|
|
struct held_lock *check_src,
|
|
struct held_lock *check_tgt)
|
|
{
|
|
struct task_struct *curr = current;
|
|
|
|
if (debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("======================================================\n");
|
|
pr_warn("WARNING: possible circular locking dependency detected\n");
|
|
print_kernel_ident();
|
|
pr_warn("------------------------------------------------------\n");
|
|
pr_warn("%s/%d is trying to acquire lock:\n",
|
|
curr->comm, task_pid_nr(curr));
|
|
print_lock(check_src);
|
|
|
|
pr_warn("\nbut task is already holding lock:\n");
|
|
|
|
print_lock(check_tgt);
|
|
pr_warn("\nwhich lock already depends on the new lock.\n\n");
|
|
pr_warn("\nthe existing dependency chain (in reverse order) is:\n");
|
|
|
|
print_circular_bug_entry(entry, depth);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline int class_equal(struct lock_list *entry, void *data)
|
|
{
|
|
return entry->class == data;
|
|
}
|
|
|
|
static noinline int print_circular_bug(struct lock_list *this,
|
|
struct lock_list *target,
|
|
struct held_lock *check_src,
|
|
struct held_lock *check_tgt,
|
|
struct stack_trace *trace)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct lock_list *parent;
|
|
struct lock_list *first_parent;
|
|
int depth;
|
|
|
|
if (!lockdep_logging_off_graph_unlock() || debug_locks_silent)
|
|
return 0;
|
|
|
|
if (!save_trace(&this->trace))
|
|
return 0;
|
|
|
|
depth = get_lock_depth(target);
|
|
|
|
print_circular_bug_header(target, depth, check_src, check_tgt);
|
|
|
|
parent = get_lock_parent(target);
|
|
first_parent = parent;
|
|
|
|
while (parent) {
|
|
print_circular_bug_entry(parent, --depth);
|
|
parent = get_lock_parent(parent);
|
|
}
|
|
|
|
printk("\nother info that might help us debug this:\n\n");
|
|
print_circular_lock_scenario(check_src, check_tgt,
|
|
first_parent);
|
|
|
|
lockdep_print_held_locks(curr);
|
|
|
|
printk("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
static noinline int print_bfs_bug(int ret)
|
|
{
|
|
if (!debug_locks_off_graph_unlock())
|
|
return 0;
|
|
|
|
/*
|
|
* Breadth-first-search failed, graph got corrupted?
|
|
*/
|
|
WARN(1, "lockdep bfs error:%d\n", ret);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int noop_count(struct lock_list *entry, void *data)
|
|
{
|
|
(*(unsigned long *)data)++;
|
|
return 0;
|
|
}
|
|
|
|
static unsigned long __lockdep_count_forward_deps(struct lock_list *this)
|
|
{
|
|
unsigned long count = 0;
|
|
struct lock_list *uninitialized_var(target_entry);
|
|
|
|
__bfs_forwards(this, (void *)&count, noop_count, &target_entry);
|
|
|
|
return count;
|
|
}
|
|
unsigned long lockdep_count_forward_deps(struct lock_class *class)
|
|
{
|
|
unsigned long ret, flags;
|
|
struct lock_list this;
|
|
|
|
this.parent = NULL;
|
|
this.class = class;
|
|
|
|
raw_local_irq_save(flags);
|
|
current->lockdep_recursion = 1;
|
|
arch_spin_lock(&lockdep_lock);
|
|
ret = __lockdep_count_forward_deps(&this);
|
|
arch_spin_unlock(&lockdep_lock);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static unsigned long __lockdep_count_backward_deps(struct lock_list *this)
|
|
{
|
|
unsigned long count = 0;
|
|
struct lock_list *uninitialized_var(target_entry);
|
|
|
|
__bfs_backwards(this, (void *)&count, noop_count, &target_entry);
|
|
|
|
return count;
|
|
}
|
|
|
|
unsigned long lockdep_count_backward_deps(struct lock_class *class)
|
|
{
|
|
unsigned long ret, flags;
|
|
struct lock_list this;
|
|
|
|
this.parent = NULL;
|
|
this.class = class;
|
|
|
|
raw_local_irq_save(flags);
|
|
current->lockdep_recursion = 1;
|
|
arch_spin_lock(&lockdep_lock);
|
|
ret = __lockdep_count_backward_deps(&this);
|
|
arch_spin_unlock(&lockdep_lock);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Prove that the dependency graph starting at <entry> can not
|
|
* lead to <target>. Print an error and return 0 if it does.
|
|
*/
|
|
static noinline int
|
|
check_noncircular(struct lock_list *root, struct lock_class *target,
|
|
struct lock_list **target_entry)
|
|
{
|
|
int result;
|
|
|
|
debug_atomic_inc(nr_cyclic_checks);
|
|
|
|
result = __bfs_forwards(root, target, class_equal, target_entry);
|
|
|
|
return result;
|
|
}
|
|
|
|
static noinline int
|
|
check_redundant(struct lock_list *root, struct lock_class *target,
|
|
struct lock_list **target_entry)
|
|
{
|
|
int result;
|
|
|
|
debug_atomic_inc(nr_redundant_checks);
|
|
|
|
result = __bfs_forwards(root, target, class_equal, target_entry);
|
|
|
|
return result;
|
|
}
|
|
|
|
#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
|
|
/*
|
|
* Forwards and backwards subgraph searching, for the purposes of
|
|
* proving that two subgraphs can be connected by a new dependency
|
|
* without creating any illegal irq-safe -> irq-unsafe lock dependency.
|
|
*/
|
|
|
|
static inline int usage_match(struct lock_list *entry, void *bit)
|
|
{
|
|
return entry->class->usage_mask & (1 << (enum lock_usage_bit)bit);
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
* Find a node in the forwards-direction dependency sub-graph starting
|
|
* at @root->class that matches @bit.
|
|
*
|
|
* Return 0 if such a node exists in the subgraph, and put that node
|
|
* into *@target_entry.
|
|
*
|
|
* Return 1 otherwise and keep *@target_entry unchanged.
|
|
* Return <0 on error.
|
|
*/
|
|
static int
|
|
find_usage_forwards(struct lock_list *root, enum lock_usage_bit bit,
|
|
struct lock_list **target_entry)
|
|
{
|
|
int result;
|
|
|
|
debug_atomic_inc(nr_find_usage_forwards_checks);
|
|
|
|
result = __bfs_forwards(root, (void *)bit, usage_match, target_entry);
|
|
|
|
return result;
|
|
}
|
|
|
|
/*
|
|
* Find a node in the backwards-direction dependency sub-graph starting
|
|
* at @root->class that matches @bit.
|
|
*
|
|
* Return 0 if such a node exists in the subgraph, and put that node
|
|
* into *@target_entry.
|
|
*
|
|
* Return 1 otherwise and keep *@target_entry unchanged.
|
|
* Return <0 on error.
|
|
*/
|
|
static int
|
|
find_usage_backwards(struct lock_list *root, enum lock_usage_bit bit,
|
|
struct lock_list **target_entry)
|
|
{
|
|
int result;
|
|
|
|
debug_atomic_inc(nr_find_usage_backwards_checks);
|
|
|
|
result = __bfs_backwards(root, (void *)bit, usage_match, target_entry);
|
|
|
|
return result;
|
|
}
|
|
|
|
static void print_lock_class_header(struct lock_class *class, int depth)
|
|
{
|
|
int bit;
|
|
|
|
printk("%*s->", depth, "");
|
|
print_lock_name(class);
|
|
printk(KERN_CONT " ops: %lu", class->ops);
|
|
printk(KERN_CONT " {\n");
|
|
|
|
for (bit = 0; bit < LOCK_USAGE_STATES; bit++) {
|
|
if (class->usage_mask & (1 << bit)) {
|
|
int len = depth;
|
|
|
|
len += printk("%*s %s", depth, "", usage_str[bit]);
|
|
len += printk(KERN_CONT " at:\n");
|
|
print_stack_trace(class->usage_traces + bit, len);
|
|
}
|
|
}
|
|
printk("%*s }\n", depth, "");
|
|
|
|
printk("%*s ... key at: [<%px>] %pS\n",
|
|
depth, "", class->key, class->key);
|
|
}
|
|
|
|
/*
|
|
* printk the shortest lock dependencies from @start to @end in reverse order:
|
|
*/
|
|
static void __used
|
|
print_shortest_lock_dependencies(struct lock_list *leaf,
|
|
struct lock_list *root)
|
|
{
|
|
struct lock_list *entry = leaf;
|
|
int depth;
|
|
|
|
/*compute depth from generated tree by BFS*/
|
|
depth = get_lock_depth(leaf);
|
|
|
|
do {
|
|
print_lock_class_header(entry->class, depth);
|
|
printk("%*s ... acquired at:\n", depth, "");
|
|
print_stack_trace(&entry->trace, 2);
|
|
printk("\n");
|
|
|
|
if (depth == 0 && (entry != root)) {
|
|
printk("lockdep:%s bad path found in chain graph\n", __func__);
|
|
break;
|
|
}
|
|
|
|
entry = get_lock_parent(entry);
|
|
depth--;
|
|
} while (entry && (depth >= 0));
|
|
|
|
return;
|
|
}
|
|
|
|
static void
|
|
print_irq_lock_scenario(struct lock_list *safe_entry,
|
|
struct lock_list *unsafe_entry,
|
|
struct lock_class *prev_class,
|
|
struct lock_class *next_class)
|
|
{
|
|
struct lock_class *safe_class = safe_entry->class;
|
|
struct lock_class *unsafe_class = unsafe_entry->class;
|
|
struct lock_class *middle_class = prev_class;
|
|
|
|
if (middle_class == safe_class)
|
|
middle_class = next_class;
|
|
|
|
/*
|
|
* A direct locking problem where unsafe_class lock is taken
|
|
* directly by safe_class lock, then all we need to show
|
|
* is the deadlock scenario, as it is obvious that the
|
|
* unsafe lock is taken under the safe lock.
|
|
*
|
|
* But if there is a chain instead, where the safe lock takes
|
|
* an intermediate lock (middle_class) where this lock is
|
|
* not the same as the safe lock, then the lock chain is
|
|
* used to describe the problem. Otherwise we would need
|
|
* to show a different CPU case for each link in the chain
|
|
* from the safe_class lock to the unsafe_class lock.
|
|
*/
|
|
if (middle_class != unsafe_class) {
|
|
printk("Chain exists of:\n ");
|
|
__print_lock_name(safe_class);
|
|
printk(KERN_CONT " --> ");
|
|
__print_lock_name(middle_class);
|
|
printk(KERN_CONT " --> ");
|
|
__print_lock_name(unsafe_class);
|
|
printk(KERN_CONT "\n\n");
|
|
}
|
|
|
|
printk(" Possible interrupt unsafe locking scenario:\n\n");
|
|
printk(" CPU0 CPU1\n");
|
|
printk(" ---- ----\n");
|
|
printk(" lock(");
|
|
__print_lock_name(unsafe_class);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" local_irq_disable();\n");
|
|
printk(" lock(");
|
|
__print_lock_name(safe_class);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" lock(");
|
|
__print_lock_name(middle_class);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" <Interrupt>\n");
|
|
printk(" lock(");
|
|
__print_lock_name(safe_class);
|
|
printk(KERN_CONT ");\n");
|
|
printk("\n *** DEADLOCK ***\n\n");
|
|
}
|
|
|
|
static int
|
|
print_bad_irq_dependency(struct task_struct *curr,
|
|
struct lock_list *prev_root,
|
|
struct lock_list *next_root,
|
|
struct lock_list *backwards_entry,
|
|
struct lock_list *forwards_entry,
|
|
struct held_lock *prev,
|
|
struct held_lock *next,
|
|
enum lock_usage_bit bit1,
|
|
enum lock_usage_bit bit2,
|
|
const char *irqclass)
|
|
{
|
|
if (!lockdep_logging_off_graph_unlock() || debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("=====================================================\n");
|
|
pr_warn("WARNING: %s-safe -> %s-unsafe lock order detected\n",
|
|
irqclass, irqclass);
|
|
print_kernel_ident();
|
|
pr_warn("-----------------------------------------------------\n");
|
|
pr_warn("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n",
|
|
curr->comm, task_pid_nr(curr),
|
|
curr->hardirq_context, hardirq_count() >> HARDIRQ_SHIFT,
|
|
curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT,
|
|
curr->hardirqs_enabled,
|
|
curr->softirqs_enabled);
|
|
print_lock(next);
|
|
|
|
pr_warn("\nand this task is already holding:\n");
|
|
print_lock(prev);
|
|
pr_warn("which would create a new lock dependency:\n");
|
|
print_lock_name(hlock_class(prev));
|
|
pr_cont(" ->");
|
|
print_lock_name(hlock_class(next));
|
|
pr_cont("\n");
|
|
|
|
pr_warn("\nbut this new dependency connects a %s-irq-safe lock:\n",
|
|
irqclass);
|
|
print_lock_name(backwards_entry->class);
|
|
pr_warn("\n... which became %s-irq-safe at:\n", irqclass);
|
|
|
|
print_stack_trace(backwards_entry->class->usage_traces + bit1, 1);
|
|
|
|
pr_warn("\nto a %s-irq-unsafe lock:\n", irqclass);
|
|
print_lock_name(forwards_entry->class);
|
|
pr_warn("\n... which became %s-irq-unsafe at:\n", irqclass);
|
|
pr_warn("...");
|
|
|
|
print_stack_trace(forwards_entry->class->usage_traces + bit2, 1);
|
|
|
|
pr_warn("\nother info that might help us debug this:\n\n");
|
|
print_irq_lock_scenario(backwards_entry, forwards_entry,
|
|
hlock_class(prev), hlock_class(next));
|
|
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nthe dependencies between %s-irq-safe lock and the holding lock:\n", irqclass);
|
|
if (!save_trace(&prev_root->trace))
|
|
return 0;
|
|
print_shortest_lock_dependencies(backwards_entry, prev_root);
|
|
|
|
pr_warn("\nthe dependencies between the lock to be acquired");
|
|
pr_warn(" and %s-irq-unsafe lock:\n", irqclass);
|
|
if (!save_trace(&next_root->trace))
|
|
return 0;
|
|
print_shortest_lock_dependencies(forwards_entry, next_root);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int
|
|
check_usage(struct task_struct *curr, struct held_lock *prev,
|
|
struct held_lock *next, enum lock_usage_bit bit_backwards,
|
|
enum lock_usage_bit bit_forwards, const char *irqclass)
|
|
{
|
|
int ret;
|
|
struct lock_list this, that;
|
|
struct lock_list *uninitialized_var(target_entry);
|
|
struct lock_list *uninitialized_var(target_entry1);
|
|
|
|
this.parent = NULL;
|
|
|
|
this.class = hlock_class(prev);
|
|
ret = find_usage_backwards(&this, bit_backwards, &target_entry);
|
|
if (ret < 0)
|
|
return print_bfs_bug(ret);
|
|
if (ret == 1)
|
|
return ret;
|
|
|
|
that.parent = NULL;
|
|
that.class = hlock_class(next);
|
|
ret = find_usage_forwards(&that, bit_forwards, &target_entry1);
|
|
if (ret < 0)
|
|
return print_bfs_bug(ret);
|
|
if (ret == 1)
|
|
return ret;
|
|
|
|
return print_bad_irq_dependency(curr, &this, &that,
|
|
target_entry, target_entry1,
|
|
prev, next,
|
|
bit_backwards, bit_forwards, irqclass);
|
|
}
|
|
|
|
static const char *state_names[] = {
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
__stringify(__STATE),
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
};
|
|
|
|
static const char *state_rnames[] = {
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
__stringify(__STATE)"-READ",
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
};
|
|
|
|
static inline const char *state_name(enum lock_usage_bit bit)
|
|
{
|
|
return (bit & 1) ? state_rnames[bit >> 2] : state_names[bit >> 2];
|
|
}
|
|
|
|
static int exclusive_bit(int new_bit)
|
|
{
|
|
/*
|
|
* USED_IN
|
|
* USED_IN_READ
|
|
* ENABLED
|
|
* ENABLED_READ
|
|
*
|
|
* bit 0 - write/read
|
|
* bit 1 - used_in/enabled
|
|
* bit 2+ state
|
|
*/
|
|
|
|
int state = new_bit & ~3;
|
|
int dir = new_bit & 2;
|
|
|
|
/*
|
|
* keep state, bit flip the direction and strip read.
|
|
*/
|
|
return state | (dir ^ 2);
|
|
}
|
|
|
|
static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
|
|
struct held_lock *next, enum lock_usage_bit bit)
|
|
{
|
|
/*
|
|
* Prove that the new dependency does not connect a hardirq-safe
|
|
* lock with a hardirq-unsafe lock - to achieve this we search
|
|
* the backwards-subgraph starting at <prev>, and the
|
|
* forwards-subgraph starting at <next>:
|
|
*/
|
|
if (!check_usage(curr, prev, next, bit,
|
|
exclusive_bit(bit), state_name(bit)))
|
|
return 0;
|
|
|
|
bit++; /* _READ */
|
|
|
|
/*
|
|
* Prove that the new dependency does not connect a hardirq-safe-read
|
|
* lock with a hardirq-unsafe lock - to achieve this we search
|
|
* the backwards-subgraph starting at <prev>, and the
|
|
* forwards-subgraph starting at <next>:
|
|
*/
|
|
if (!check_usage(curr, prev, next, bit,
|
|
exclusive_bit(bit), state_name(bit)))
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
static int
|
|
check_prev_add_irq(struct task_struct *curr, struct held_lock *prev,
|
|
struct held_lock *next)
|
|
{
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
if (!check_irq_usage(curr, prev, next, LOCK_USED_IN_##__STATE)) \
|
|
return 0;
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
|
|
return 1;
|
|
}
|
|
|
|
static void inc_chains(void)
|
|
{
|
|
if (current->hardirq_context)
|
|
nr_hardirq_chains++;
|
|
else {
|
|
if (current->softirq_context)
|
|
nr_softirq_chains++;
|
|
else
|
|
nr_process_chains++;
|
|
}
|
|
}
|
|
|
|
#else
|
|
|
|
static inline int
|
|
check_prev_add_irq(struct task_struct *curr, struct held_lock *prev,
|
|
struct held_lock *next)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
static inline void inc_chains(void)
|
|
{
|
|
nr_process_chains++;
|
|
}
|
|
|
|
#endif
|
|
|
|
static void
|
|
print_deadlock_scenario(struct held_lock *nxt,
|
|
struct held_lock *prv)
|
|
{
|
|
struct lock_class *next = hlock_class(nxt);
|
|
struct lock_class *prev = hlock_class(prv);
|
|
|
|
printk(" Possible unsafe locking scenario:\n\n");
|
|
printk(" CPU0\n");
|
|
printk(" ----\n");
|
|
printk(" lock(");
|
|
__print_lock_name(prev);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" lock(");
|
|
__print_lock_name(next);
|
|
printk(KERN_CONT ");\n");
|
|
printk("\n *** DEADLOCK ***\n\n");
|
|
printk(" May be due to missing lock nesting notation\n\n");
|
|
}
|
|
|
|
static int
|
|
print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
|
|
struct held_lock *next)
|
|
{
|
|
if (!lockdep_logging_off_graph_unlock() || debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("============================================\n");
|
|
pr_warn("WARNING: possible recursive locking detected\n");
|
|
print_kernel_ident();
|
|
pr_warn("--------------------------------------------\n");
|
|
pr_warn("%s/%d is trying to acquire lock:\n",
|
|
curr->comm, task_pid_nr(curr));
|
|
print_lock(next);
|
|
pr_warn("\nbut task is already holding lock:\n");
|
|
print_lock(prev);
|
|
|
|
pr_warn("\nother info that might help us debug this:\n");
|
|
print_deadlock_scenario(next, prev);
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Check whether we are holding such a class already.
|
|
*
|
|
* (Note that this has to be done separately, because the graph cannot
|
|
* detect such classes of deadlocks.)
|
|
*
|
|
* Returns: 0 on deadlock detected, 1 on OK, 2 on recursive read
|
|
*/
|
|
static int
|
|
check_deadlock(struct task_struct *curr, struct held_lock *next,
|
|
struct lockdep_map *next_instance, int read)
|
|
{
|
|
struct held_lock *prev;
|
|
struct held_lock *nest = NULL;
|
|
int i;
|
|
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
prev = curr->held_locks + i;
|
|
|
|
if (prev->instance == next->nest_lock)
|
|
nest = prev;
|
|
|
|
if (hlock_class(prev) != hlock_class(next))
|
|
continue;
|
|
|
|
/*
|
|
* Allow read-after-read recursion of the same
|
|
* lock class (i.e. read_lock(lock)+read_lock(lock)):
|
|
*/
|
|
if ((read == 2) && prev->read)
|
|
return 2;
|
|
|
|
/*
|
|
* We're holding the nest_lock, which serializes this lock's
|
|
* nesting behaviour.
|
|
*/
|
|
if (nest)
|
|
return 2;
|
|
|
|
return print_deadlock_bug(curr, prev, next);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* There was a chain-cache miss, and we are about to add a new dependency
|
|
* to a previous lock. We recursively validate the following rules:
|
|
*
|
|
* - would the adding of the <prev> -> <next> dependency create a
|
|
* circular dependency in the graph? [== circular deadlock]
|
|
*
|
|
* - does the new prev->next dependency connect any hardirq-safe lock
|
|
* (in the full backwards-subgraph starting at <prev>) with any
|
|
* hardirq-unsafe lock (in the full forwards-subgraph starting at
|
|
* <next>)? [== illegal lock inversion with hardirq contexts]
|
|
*
|
|
* - does the new prev->next dependency connect any softirq-safe lock
|
|
* (in the full backwards-subgraph starting at <prev>) with any
|
|
* softirq-unsafe lock (in the full forwards-subgraph starting at
|
|
* <next>)? [== illegal lock inversion with softirq contexts]
|
|
*
|
|
* any of these scenarios could lead to a deadlock.
|
|
*
|
|
* Then if all the validations pass, we add the forwards and backwards
|
|
* dependency.
|
|
*/
|
|
static int
|
|
check_prev_add(struct task_struct *curr, struct held_lock *prev,
|
|
struct held_lock *next, int distance, struct stack_trace *trace,
|
|
int (*save)(struct stack_trace *trace))
|
|
{
|
|
struct lock_list *uninitialized_var(target_entry);
|
|
struct lock_list *entry;
|
|
struct lock_list this;
|
|
int ret;
|
|
|
|
/*
|
|
* Prove that the new <prev> -> <next> dependency would not
|
|
* create a circular dependency in the graph. (We do this by
|
|
* forward-recursing into the graph starting at <next>, and
|
|
* checking whether we can reach <prev>.)
|
|
*
|
|
* We are using global variables to control the recursion, to
|
|
* keep the stackframe size of the recursive functions low:
|
|
*/
|
|
this.class = hlock_class(next);
|
|
this.parent = NULL;
|
|
ret = check_noncircular(&this, hlock_class(prev), &target_entry);
|
|
if (unlikely(!ret)) {
|
|
if (!trace->entries) {
|
|
/*
|
|
* If @save fails here, the printing might trigger
|
|
* a WARN but because of the !nr_entries it should
|
|
* not do bad things.
|
|
*/
|
|
save(trace);
|
|
}
|
|
return print_circular_bug(&this, target_entry, next, prev, trace);
|
|
}
|
|
else if (unlikely(ret < 0))
|
|
return print_bfs_bug(ret);
|
|
|
|
if (!check_prev_add_irq(curr, prev, next))
|
|
return 0;
|
|
|
|
/*
|
|
* For recursive read-locks we do all the dependency checks,
|
|
* but we dont store read-triggered dependencies (only
|
|
* write-triggered dependencies). This ensures that only the
|
|
* write-side dependencies matter, and that if for example a
|
|
* write-lock never takes any other locks, then the reads are
|
|
* equivalent to a NOP.
|
|
*/
|
|
if (next->read == 2 || prev->read == 2)
|
|
return 1;
|
|
/*
|
|
* Is the <prev> -> <next> dependency already present?
|
|
*
|
|
* (this may occur even though this is a new chain: consider
|
|
* e.g. the L1 -> L2 -> L3 -> L4 and the L5 -> L1 -> L2 -> L3
|
|
* chains - the second one will be new, but L1 already has
|
|
* L2 added to its dependency list, due to the first chain.)
|
|
*/
|
|
list_for_each_entry(entry, &hlock_class(prev)->locks_after, entry) {
|
|
if (entry->class == hlock_class(next)) {
|
|
if (distance == 1)
|
|
entry->distance = 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Is the <prev> -> <next> link redundant?
|
|
*/
|
|
this.class = hlock_class(prev);
|
|
this.parent = NULL;
|
|
ret = check_redundant(&this, hlock_class(next), &target_entry);
|
|
if (!ret) {
|
|
debug_atomic_inc(nr_redundant);
|
|
return 2;
|
|
}
|
|
if (ret < 0)
|
|
return print_bfs_bug(ret);
|
|
|
|
|
|
if (!trace->entries && !save(trace))
|
|
return 0;
|
|
|
|
/*
|
|
* Ok, all validations passed, add the new lock
|
|
* to the previous lock's dependency list:
|
|
*/
|
|
ret = add_lock_to_list(hlock_class(next),
|
|
&hlock_class(prev)->locks_after,
|
|
next->acquire_ip, distance, trace);
|
|
|
|
if (!ret)
|
|
return 0;
|
|
|
|
ret = add_lock_to_list(hlock_class(prev),
|
|
&hlock_class(next)->locks_before,
|
|
next->acquire_ip, distance, trace);
|
|
if (!ret)
|
|
return 0;
|
|
|
|
return 2;
|
|
}
|
|
|
|
/*
|
|
* Add the dependency to all directly-previous locks that are 'relevant'.
|
|
* The ones that are relevant are (in increasing distance from curr):
|
|
* all consecutive trylock entries and the final non-trylock entry - or
|
|
* the end of this context's lock-chain - whichever comes first.
|
|
*/
|
|
static int
|
|
check_prevs_add(struct task_struct *curr, struct held_lock *next)
|
|
{
|
|
int depth = curr->lockdep_depth;
|
|
struct held_lock *hlock;
|
|
struct stack_trace trace = {
|
|
.nr_entries = 0,
|
|
.max_entries = 0,
|
|
.entries = NULL,
|
|
.skip = 0,
|
|
};
|
|
|
|
/*
|
|
* Debugging checks.
|
|
*
|
|
* Depth must not be zero for a non-head lock:
|
|
*/
|
|
if (!depth)
|
|
goto out_bug;
|
|
/*
|
|
* At least two relevant locks must exist for this
|
|
* to be a head:
|
|
*/
|
|
if (curr->held_locks[depth].irq_context !=
|
|
curr->held_locks[depth-1].irq_context)
|
|
goto out_bug;
|
|
|
|
for (;;) {
|
|
int distance = curr->lockdep_depth - depth + 1;
|
|
hlock = curr->held_locks + depth - 1;
|
|
|
|
/*
|
|
* Only non-recursive-read entries get new dependencies
|
|
* added:
|
|
*/
|
|
if (hlock->read != 2 && hlock->check) {
|
|
int ret = check_prev_add(curr, hlock, next, distance, &trace, save_trace);
|
|
if (!ret)
|
|
return 0;
|
|
|
|
/*
|
|
* Stop after the first non-trylock entry,
|
|
* as non-trylock entries have added their
|
|
* own direct dependencies already, so this
|
|
* lock is connected to them indirectly:
|
|
*/
|
|
if (!hlock->trylock)
|
|
break;
|
|
}
|
|
|
|
depth--;
|
|
/*
|
|
* End of lock-stack?
|
|
*/
|
|
if (!depth)
|
|
break;
|
|
/*
|
|
* Stop the search if we cross into another context:
|
|
*/
|
|
if (curr->held_locks[depth].irq_context !=
|
|
curr->held_locks[depth-1].irq_context)
|
|
break;
|
|
}
|
|
return 1;
|
|
out_bug:
|
|
if (!lockdep_logging_off_graph_unlock())
|
|
return 0;
|
|
|
|
/*
|
|
* Clearly we all shouldn't be here, but since we made it we
|
|
* can reliable say we messed up our state. See the above two
|
|
* gotos for reasons why we could possibly end up here.
|
|
*/
|
|
WARN_ON(1);
|
|
|
|
return 0;
|
|
}
|
|
|
|
unsigned long nr_lock_chains;
|
|
struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS];
|
|
int nr_chain_hlocks;
|
|
static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
|
|
|
|
struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i)
|
|
{
|
|
return lock_classes + chain_hlocks[chain->base + i];
|
|
}
|
|
|
|
/*
|
|
* Returns the index of the first held_lock of the current chain
|
|
*/
|
|
static inline int get_first_held_lock(struct task_struct *curr,
|
|
struct held_lock *hlock)
|
|
{
|
|
int i;
|
|
struct held_lock *hlock_curr;
|
|
|
|
for (i = curr->lockdep_depth - 1; i >= 0; i--) {
|
|
hlock_curr = curr->held_locks + i;
|
|
if (hlock_curr->irq_context != hlock->irq_context)
|
|
break;
|
|
|
|
}
|
|
|
|
return ++i;
|
|
}
|
|
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
/*
|
|
* Returns the next chain_key iteration
|
|
*/
|
|
static u64 print_chain_key_iteration(int class_idx, u64 chain_key)
|
|
{
|
|
u64 new_chain_key = iterate_chain_key(chain_key, class_idx);
|
|
|
|
printk(" class_idx:%d -> chain_key:%016Lx",
|
|
class_idx,
|
|
(unsigned long long)new_chain_key);
|
|
return new_chain_key;
|
|
}
|
|
|
|
static void
|
|
print_chain_keys_held_locks(struct task_struct *curr, struct held_lock *hlock_next)
|
|
{
|
|
struct held_lock *hlock;
|
|
u64 chain_key = 0;
|
|
int depth = curr->lockdep_depth;
|
|
int i;
|
|
|
|
printk("depth: %u\n", depth + 1);
|
|
for (i = get_first_held_lock(curr, hlock_next); i < depth; i++) {
|
|
hlock = curr->held_locks + i;
|
|
chain_key = print_chain_key_iteration(hlock->class_idx, chain_key);
|
|
|
|
print_lock(hlock);
|
|
}
|
|
|
|
print_chain_key_iteration(hlock_next->class_idx, chain_key);
|
|
print_lock(hlock_next);
|
|
}
|
|
|
|
static void print_chain_keys_chain(struct lock_chain *chain)
|
|
{
|
|
int i;
|
|
u64 chain_key = 0;
|
|
int class_id;
|
|
|
|
printk("depth: %u\n", chain->depth);
|
|
for (i = 0; i < chain->depth; i++) {
|
|
class_id = chain_hlocks[chain->base + i];
|
|
chain_key = print_chain_key_iteration(class_id + 1, chain_key);
|
|
|
|
print_lock_name(lock_classes + class_id);
|
|
printk("\n");
|
|
}
|
|
}
|
|
|
|
static void print_collision(struct task_struct *curr,
|
|
struct held_lock *hlock_next,
|
|
struct lock_chain *chain)
|
|
{
|
|
pr_warn("\n");
|
|
pr_warn("============================\n");
|
|
pr_warn("WARNING: chain_key collision\n");
|
|
print_kernel_ident();
|
|
pr_warn("----------------------------\n");
|
|
pr_warn("%s/%d: ", current->comm, task_pid_nr(current));
|
|
pr_warn("Hash chain already cached but the contents don't match!\n");
|
|
|
|
pr_warn("Held locks:");
|
|
print_chain_keys_held_locks(curr, hlock_next);
|
|
|
|
pr_warn("Locks in cached chain:");
|
|
print_chain_keys_chain(chain);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* Checks whether the chain and the current held locks are consistent
|
|
* in depth and also in content. If they are not it most likely means
|
|
* that there was a collision during the calculation of the chain_key.
|
|
* Returns: 0 not passed, 1 passed
|
|
*/
|
|
static int check_no_collision(struct task_struct *curr,
|
|
struct held_lock *hlock,
|
|
struct lock_chain *chain)
|
|
{
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
int i, j, id;
|
|
|
|
i = get_first_held_lock(curr, hlock);
|
|
|
|
if (lockdep_warn_on(chain->depth != curr->lockdep_depth - (i - 1))) {
|
|
print_collision(curr, hlock, chain);
|
|
return 0;
|
|
}
|
|
|
|
for (j = 0; j < chain->depth - 1; j++, i++) {
|
|
id = curr->held_locks[i].class_idx - 1;
|
|
|
|
if (lockdep_warn_on(chain_hlocks[chain->base + j] != id)) {
|
|
print_collision(curr, hlock, chain);
|
|
return 0;
|
|
}
|
|
}
|
|
#endif
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* This is for building a chain between just two different classes,
|
|
* instead of adding a new hlock upon current, which is done by
|
|
* add_chain_cache().
|
|
*
|
|
* This can be called in any context with two classes, while
|
|
* add_chain_cache() must be done within the lock owener's context
|
|
* since it uses hlock which might be racy in another context.
|
|
*/
|
|
static inline int add_chain_cache_classes(unsigned int prev,
|
|
unsigned int next,
|
|
unsigned int irq_context,
|
|
u64 chain_key)
|
|
{
|
|
struct hlist_head *hash_head = chainhashentry(chain_key);
|
|
struct lock_chain *chain;
|
|
|
|
/*
|
|
* Allocate a new chain entry from the static array, and add
|
|
* it to the hash:
|
|
*/
|
|
|
|
/*
|
|
* We might need to take the graph lock, ensure we've got IRQs
|
|
* disabled to make this an IRQ-safe lock.. for recursion reasons
|
|
* lockdep won't complain about its own locking errors.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return 0;
|
|
|
|
if (unlikely(nr_lock_chains >= MAX_LOCKDEP_CHAINS)) {
|
|
if (!debug_locks_off_graph_unlock())
|
|
return 0;
|
|
|
|
print_lockdep_off("BUG: MAX_LOCKDEP_CHAINS too low!");
|
|
dump_stack();
|
|
return 0;
|
|
}
|
|
|
|
chain = lock_chains + nr_lock_chains++;
|
|
chain->chain_key = chain_key;
|
|
chain->irq_context = irq_context;
|
|
chain->depth = 2;
|
|
if (likely(nr_chain_hlocks + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS)) {
|
|
chain->base = nr_chain_hlocks;
|
|
nr_chain_hlocks += chain->depth;
|
|
chain_hlocks[chain->base] = prev - 1;
|
|
chain_hlocks[chain->base + 1] = next -1;
|
|
}
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
/*
|
|
* Important for check_no_collision().
|
|
*/
|
|
else {
|
|
if (!debug_locks_off_graph_unlock())
|
|
return 0;
|
|
|
|
print_lockdep_off("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!");
|
|
dump_stack();
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
hlist_add_head_rcu(&chain->entry, hash_head);
|
|
debug_atomic_inc(chain_lookup_misses);
|
|
inc_chains();
|
|
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* Adds a dependency chain into chain hashtable. And must be called with
|
|
* graph_lock held.
|
|
*
|
|
* Return 0 if fail, and graph_lock is released.
|
|
* Return 1 if succeed, with graph_lock held.
|
|
*/
|
|
static inline int add_chain_cache(struct task_struct *curr,
|
|
struct held_lock *hlock,
|
|
u64 chain_key)
|
|
{
|
|
struct lock_class *class = hlock_class(hlock);
|
|
struct hlist_head *hash_head = chainhashentry(chain_key);
|
|
struct lock_chain *chain;
|
|
int i, j;
|
|
|
|
/*
|
|
* Allocate a new chain entry from the static array, and add
|
|
* it to the hash:
|
|
*/
|
|
|
|
/*
|
|
* We might need to take the graph lock, ensure we've got IRQs
|
|
* disabled to make this an IRQ-safe lock.. for recursion reasons
|
|
* lockdep won't complain about its own locking errors.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return 0;
|
|
|
|
if (unlikely(nr_lock_chains >= MAX_LOCKDEP_CHAINS)) {
|
|
if (!debug_locks_off_graph_unlock())
|
|
return 0;
|
|
|
|
print_lockdep_off("BUG: MAX_LOCKDEP_CHAINS too low!");
|
|
dump_stack();
|
|
return 0;
|
|
}
|
|
chain = lock_chains + nr_lock_chains++;
|
|
chain->chain_key = chain_key;
|
|
chain->irq_context = hlock->irq_context;
|
|
i = get_first_held_lock(curr, hlock);
|
|
chain->depth = curr->lockdep_depth + 1 - i;
|
|
|
|
BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks));
|
|
BUILD_BUG_ON((1UL << 6) <= ARRAY_SIZE(curr->held_locks));
|
|
BUILD_BUG_ON((1UL << 8*sizeof(chain_hlocks[0])) <= ARRAY_SIZE(lock_classes));
|
|
|
|
if (likely(nr_chain_hlocks + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS)) {
|
|
chain->base = nr_chain_hlocks;
|
|
for (j = 0; j < chain->depth - 1; j++, i++) {
|
|
int lock_id = curr->held_locks[i].class_idx - 1;
|
|
chain_hlocks[chain->base + j] = lock_id;
|
|
}
|
|
chain_hlocks[chain->base + j] = class - lock_classes;
|
|
}
|
|
|
|
if (nr_chain_hlocks < MAX_LOCKDEP_CHAIN_HLOCKS)
|
|
nr_chain_hlocks += chain->depth;
|
|
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
/*
|
|
* Important for check_no_collision().
|
|
*/
|
|
if (unlikely(nr_chain_hlocks > MAX_LOCKDEP_CHAIN_HLOCKS)) {
|
|
if (!debug_locks_off_graph_unlock())
|
|
return 0;
|
|
|
|
print_lockdep_off("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!");
|
|
dump_stack();
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
hlist_add_head_rcu(&chain->entry, hash_head);
|
|
debug_atomic_inc(chain_lookup_misses);
|
|
inc_chains();
|
|
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* Look up a dependency chain.
|
|
*/
|
|
static inline struct lock_chain *lookup_chain_cache(u64 chain_key)
|
|
{
|
|
struct hlist_head *hash_head = chainhashentry(chain_key);
|
|
struct lock_chain *chain;
|
|
|
|
/*
|
|
* We can walk it lock-free, because entries only get added
|
|
* to the hash:
|
|
*/
|
|
hlist_for_each_entry_rcu(chain, hash_head, entry) {
|
|
if (chain->chain_key == chain_key) {
|
|
debug_atomic_inc(chain_lookup_hits);
|
|
return chain;
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
* If the key is not present yet in dependency chain cache then
|
|
* add it and return 1 - in this case the new dependency chain is
|
|
* validated. If the key is already hashed, return 0.
|
|
* (On return with 1 graph_lock is held.)
|
|
*/
|
|
static inline int lookup_chain_cache_add(struct task_struct *curr,
|
|
struct held_lock *hlock,
|
|
u64 chain_key)
|
|
{
|
|
struct lock_class *class = hlock_class(hlock);
|
|
struct lock_chain *chain = lookup_chain_cache(chain_key);
|
|
|
|
if (chain) {
|
|
cache_hit:
|
|
if (!check_no_collision(curr, hlock, chain))
|
|
return 0;
|
|
|
|
if (very_verbose(class)) {
|
|
printk("\nhash chain already cached, key: "
|
|
"%016Lx tail class: [%px] %s\n",
|
|
(unsigned long long)chain_key,
|
|
class->key, class->name);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
if (very_verbose(class)) {
|
|
printk("\nnew hash chain, key: %016Lx tail class: [%px] %s\n",
|
|
(unsigned long long)chain_key, class->key, class->name);
|
|
}
|
|
|
|
if (!graph_lock())
|
|
return 0;
|
|
|
|
/*
|
|
* We have to walk the chain again locked - to avoid duplicates:
|
|
*/
|
|
chain = lookup_chain_cache(chain_key);
|
|
if (chain) {
|
|
graph_unlock();
|
|
goto cache_hit;
|
|
}
|
|
|
|
if (!add_chain_cache(curr, hlock, chain_key))
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
static int validate_chain(struct task_struct *curr, struct lockdep_map *lock,
|
|
struct held_lock *hlock, int chain_head, u64 chain_key)
|
|
{
|
|
/*
|
|
* Trylock needs to maintain the stack of held locks, but it
|
|
* does not add new dependencies, because trylock can be done
|
|
* in any order.
|
|
*
|
|
* We look up the chain_key and do the O(N^2) check and update of
|
|
* the dependencies only if this is a new dependency chain.
|
|
* (If lookup_chain_cache_add() return with 1 it acquires
|
|
* graph_lock for us)
|
|
*/
|
|
if (!hlock->trylock && hlock->check &&
|
|
lookup_chain_cache_add(curr, hlock, chain_key)) {
|
|
/*
|
|
* Check whether last held lock:
|
|
*
|
|
* - is irq-safe, if this lock is irq-unsafe
|
|
* - is softirq-safe, if this lock is hardirq-unsafe
|
|
*
|
|
* And check whether the new lock's dependency graph
|
|
* could lead back to the previous lock.
|
|
*
|
|
* any of these scenarios could lead to a deadlock. If
|
|
* All validations
|
|
*/
|
|
int ret = check_deadlock(curr, hlock, lock, hlock->read);
|
|
|
|
if (!ret)
|
|
return 1;
|
|
/*
|
|
* Mark recursive read, as we jump over it when
|
|
* building dependencies (just like we jump over
|
|
* trylock entries):
|
|
*/
|
|
if (ret == 2)
|
|
hlock->read = 2;
|
|
/*
|
|
* Add dependency only if this lock is not the head
|
|
* of the chain, and if it's not a secondary read-lock:
|
|
*/
|
|
if (!chain_head && ret != 2) {
|
|
if (!check_prevs_add(curr, hlock))
|
|
return 1;
|
|
}
|
|
|
|
graph_unlock();
|
|
} else {
|
|
/* after lookup_chain_cache_add(): */
|
|
if (unlikely(!debug_locks))
|
|
return 0;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
#else
|
|
static inline int validate_chain(struct task_struct *curr,
|
|
struct lockdep_map *lock, struct held_lock *hlock,
|
|
int chain_head, u64 chain_key)
|
|
{
|
|
return 1;
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* We are building curr_chain_key incrementally, so double-check
|
|
* it from scratch, to make sure that it's done correctly:
|
|
*/
|
|
static void check_chain_key(struct task_struct *curr)
|
|
{
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
struct held_lock *hlock, *prev_hlock = NULL;
|
|
unsigned int i;
|
|
u64 chain_key = 0;
|
|
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
hlock = curr->held_locks + i;
|
|
if (chain_key != hlock->prev_chain_key) {
|
|
debug_locks_off();
|
|
/*
|
|
* We got mighty confused, our chain keys don't match
|
|
* with what we expect, someone trample on our task state?
|
|
*/
|
|
WARN(1, "hm#1, depth: %u [%u], %016Lx != %016Lx\n",
|
|
curr->lockdep_depth, i,
|
|
(unsigned long long)chain_key,
|
|
(unsigned long long)hlock->prev_chain_key);
|
|
return;
|
|
}
|
|
/*
|
|
* Whoops ran out of static storage again?
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(hlock->class_idx > MAX_LOCKDEP_KEYS))
|
|
return;
|
|
|
|
if (prev_hlock && (prev_hlock->irq_context !=
|
|
hlock->irq_context))
|
|
chain_key = 0;
|
|
chain_key = iterate_chain_key(chain_key, hlock->class_idx);
|
|
prev_hlock = hlock;
|
|
}
|
|
if (chain_key != curr->curr_chain_key) {
|
|
debug_locks_off();
|
|
/*
|
|
* More smoking hash instead of calculating it, damn see these
|
|
* numbers float.. I bet that a pink elephant stepped on my memory.
|
|
*/
|
|
WARN(1, "hm#2, depth: %u [%u], %016Lx != %016Lx\n",
|
|
curr->lockdep_depth, i,
|
|
(unsigned long long)chain_key,
|
|
(unsigned long long)curr->curr_chain_key);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
static void
|
|
print_usage_bug_scenario(struct held_lock *lock)
|
|
{
|
|
struct lock_class *class = hlock_class(lock);
|
|
|
|
printk(" Possible unsafe locking scenario:\n\n");
|
|
printk(" CPU0\n");
|
|
printk(" ----\n");
|
|
printk(" lock(");
|
|
__print_lock_name(class);
|
|
printk(KERN_CONT ");\n");
|
|
printk(" <Interrupt>\n");
|
|
printk(" lock(");
|
|
__print_lock_name(class);
|
|
printk(KERN_CONT ");\n");
|
|
printk("\n *** DEADLOCK ***\n\n");
|
|
}
|
|
|
|
static int
|
|
print_usage_bug(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit prev_bit, enum lock_usage_bit new_bit)
|
|
{
|
|
if (!lockdep_logging_off_graph_unlock() || debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("================================\n");
|
|
pr_warn("WARNING: inconsistent lock state\n");
|
|
print_kernel_ident();
|
|
pr_warn("--------------------------------\n");
|
|
|
|
pr_warn("inconsistent {%s} -> {%s} usage.\n",
|
|
usage_str[prev_bit], usage_str[new_bit]);
|
|
|
|
pr_warn("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n",
|
|
curr->comm, task_pid_nr(curr),
|
|
trace_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT,
|
|
trace_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT,
|
|
trace_hardirqs_enabled(curr),
|
|
trace_softirqs_enabled(curr));
|
|
print_lock(this);
|
|
|
|
pr_warn("{%s} state was registered at:\n", usage_str[prev_bit]);
|
|
print_stack_trace(hlock_class(this)->usage_traces + prev_bit, 1);
|
|
|
|
print_irqtrace_events(curr);
|
|
pr_warn("\nother info that might help us debug this:\n");
|
|
print_usage_bug_scenario(this);
|
|
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Print out an error if an invalid bit is set:
|
|
*/
|
|
static inline int
|
|
valid_state(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit new_bit, enum lock_usage_bit bad_bit)
|
|
{
|
|
if (unlikely(hlock_class(this)->usage_mask & (1 << bad_bit)))
|
|
return print_usage_bug(curr, this, bad_bit, new_bit);
|
|
return 1;
|
|
}
|
|
|
|
static int mark_lock(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit new_bit);
|
|
|
|
#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING)
|
|
|
|
/*
|
|
* print irq inversion bug:
|
|
*/
|
|
static int
|
|
print_irq_inversion_bug(struct task_struct *curr,
|
|
struct lock_list *root, struct lock_list *other,
|
|
struct held_lock *this, int forwards,
|
|
const char *irqclass)
|
|
{
|
|
struct lock_list *entry = other;
|
|
struct lock_list *middle = NULL;
|
|
int depth;
|
|
|
|
if (!lockdep_logging_off_graph_unlock() || debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("========================================================\n");
|
|
pr_warn("WARNING: possible irq lock inversion dependency detected\n");
|
|
print_kernel_ident();
|
|
pr_warn("--------------------------------------------------------\n");
|
|
pr_warn("%s/%d just changed the state of lock:\n",
|
|
curr->comm, task_pid_nr(curr));
|
|
print_lock(this);
|
|
if (forwards)
|
|
pr_warn("but this lock took another, %s-unsafe lock in the past:\n", irqclass);
|
|
else
|
|
pr_warn("but this lock was taken by another, %s-safe lock in the past:\n", irqclass);
|
|
print_lock_name(other->class);
|
|
pr_warn("\n\nand interrupts could create inverse lock ordering between them.\n\n");
|
|
|
|
pr_warn("\nother info that might help us debug this:\n");
|
|
|
|
/* Find a middle lock (if one exists) */
|
|
depth = get_lock_depth(other);
|
|
do {
|
|
if (depth == 0 && (entry != root)) {
|
|
pr_warn("lockdep:%s bad path found in chain graph\n", __func__);
|
|
break;
|
|
}
|
|
middle = entry;
|
|
entry = get_lock_parent(entry);
|
|
depth--;
|
|
} while (entry && entry != root && (depth >= 0));
|
|
if (forwards)
|
|
print_irq_lock_scenario(root, other,
|
|
middle ? middle->class : root->class, other->class);
|
|
else
|
|
print_irq_lock_scenario(other, root,
|
|
middle ? middle->class : other->class, root->class);
|
|
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nthe shortest dependencies between 2nd lock and 1st lock:\n");
|
|
if (!save_trace(&root->trace))
|
|
return 0;
|
|
print_shortest_lock_dependencies(other, root);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Prove that in the forwards-direction subgraph starting at <this>
|
|
* there is no lock matching <mask>:
|
|
*/
|
|
static int
|
|
check_usage_forwards(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit bit, const char *irqclass)
|
|
{
|
|
int ret;
|
|
struct lock_list root;
|
|
struct lock_list *uninitialized_var(target_entry);
|
|
|
|
root.parent = NULL;
|
|
root.class = hlock_class(this);
|
|
ret = find_usage_forwards(&root, bit, &target_entry);
|
|
if (ret < 0)
|
|
return print_bfs_bug(ret);
|
|
if (ret == 1)
|
|
return ret;
|
|
|
|
return print_irq_inversion_bug(curr, &root, target_entry,
|
|
this, 1, irqclass);
|
|
}
|
|
|
|
/*
|
|
* Prove that in the backwards-direction subgraph starting at <this>
|
|
* there is no lock matching <mask>:
|
|
*/
|
|
static int
|
|
check_usage_backwards(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit bit, const char *irqclass)
|
|
{
|
|
int ret;
|
|
struct lock_list root;
|
|
struct lock_list *uninitialized_var(target_entry);
|
|
|
|
root.parent = NULL;
|
|
root.class = hlock_class(this);
|
|
ret = find_usage_backwards(&root, bit, &target_entry);
|
|
if (ret < 0)
|
|
return print_bfs_bug(ret);
|
|
if (ret == 1)
|
|
return ret;
|
|
|
|
return print_irq_inversion_bug(curr, &root, target_entry,
|
|
this, 0, irqclass);
|
|
}
|
|
|
|
void print_irqtrace_events(struct task_struct *curr)
|
|
{
|
|
printk("irq event stamp: %u\n", curr->irq_events);
|
|
printk("hardirqs last enabled at (%u): [<%px>] %pS\n",
|
|
curr->hardirq_enable_event, (void *)curr->hardirq_enable_ip,
|
|
(void *)curr->hardirq_enable_ip);
|
|
printk("hardirqs last disabled at (%u): [<%px>] %pS\n",
|
|
curr->hardirq_disable_event, (void *)curr->hardirq_disable_ip,
|
|
(void *)curr->hardirq_disable_ip);
|
|
printk("softirqs last enabled at (%u): [<%px>] %pS\n",
|
|
curr->softirq_enable_event, (void *)curr->softirq_enable_ip,
|
|
(void *)curr->softirq_enable_ip);
|
|
printk("softirqs last disabled at (%u): [<%px>] %pS\n",
|
|
curr->softirq_disable_event, (void *)curr->softirq_disable_ip,
|
|
(void *)curr->softirq_disable_ip);
|
|
}
|
|
|
|
static int HARDIRQ_verbose(struct lock_class *class)
|
|
{
|
|
#if HARDIRQ_VERBOSE
|
|
return class_filter(class);
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
static int SOFTIRQ_verbose(struct lock_class *class)
|
|
{
|
|
#if SOFTIRQ_VERBOSE
|
|
return class_filter(class);
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
#define STRICT_READ_CHECKS 1
|
|
|
|
static int (*state_verbose_f[])(struct lock_class *class) = {
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
__STATE##_verbose,
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
};
|
|
|
|
static inline int state_verbose(enum lock_usage_bit bit,
|
|
struct lock_class *class)
|
|
{
|
|
return state_verbose_f[bit >> 2](class);
|
|
}
|
|
|
|
typedef int (*check_usage_f)(struct task_struct *, struct held_lock *,
|
|
enum lock_usage_bit bit, const char *name);
|
|
|
|
static int
|
|
mark_lock_irq(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit new_bit)
|
|
{
|
|
int excl_bit = exclusive_bit(new_bit);
|
|
int read = new_bit & 1;
|
|
int dir = new_bit & 2;
|
|
|
|
/*
|
|
* mark USED_IN has to look forwards -- to ensure no dependency
|
|
* has ENABLED state, which would allow recursion deadlocks.
|
|
*
|
|
* mark ENABLED has to look backwards -- to ensure no dependee
|
|
* has USED_IN state, which, again, would allow recursion deadlocks.
|
|
*/
|
|
check_usage_f usage = dir ?
|
|
check_usage_backwards : check_usage_forwards;
|
|
|
|
/*
|
|
* Validate that this particular lock does not have conflicting
|
|
* usage states.
|
|
*/
|
|
if (!valid_state(curr, this, new_bit, excl_bit))
|
|
return 0;
|
|
|
|
/*
|
|
* Validate that the lock dependencies don't have conflicting usage
|
|
* states.
|
|
*/
|
|
if ((!read || !dir || STRICT_READ_CHECKS) &&
|
|
!usage(curr, this, excl_bit, state_name(new_bit & ~1)))
|
|
return 0;
|
|
|
|
/*
|
|
* Check for read in write conflicts
|
|
*/
|
|
if (!read) {
|
|
if (!valid_state(curr, this, new_bit, excl_bit + 1))
|
|
return 0;
|
|
|
|
if (STRICT_READ_CHECKS &&
|
|
!usage(curr, this, excl_bit + 1,
|
|
state_name(new_bit + 1)))
|
|
return 0;
|
|
}
|
|
|
|
if (state_verbose(new_bit, hlock_class(this)))
|
|
return 2;
|
|
|
|
return 1;
|
|
}
|
|
|
|
enum mark_type {
|
|
#define LOCKDEP_STATE(__STATE) __STATE,
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
};
|
|
|
|
/*
|
|
* Mark all held locks with a usage bit:
|
|
*/
|
|
static int
|
|
mark_held_locks(struct task_struct *curr, enum mark_type mark)
|
|
{
|
|
enum lock_usage_bit usage_bit;
|
|
struct held_lock *hlock;
|
|
int i;
|
|
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
hlock = curr->held_locks + i;
|
|
|
|
usage_bit = 2 + (mark << 2); /* ENABLED */
|
|
if (hlock->read)
|
|
usage_bit += 1; /* READ */
|
|
|
|
BUG_ON(usage_bit >= LOCK_USAGE_STATES);
|
|
|
|
if (!hlock->check)
|
|
continue;
|
|
|
|
if (!mark_lock(curr, hlock, usage_bit))
|
|
return 0;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* Hardirqs will be enabled:
|
|
*/
|
|
static void __trace_hardirqs_on_caller(unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
|
|
/* we'll do an OFF -> ON transition: */
|
|
curr->hardirqs_enabled = 1;
|
|
|
|
/*
|
|
* We are going to turn hardirqs on, so set the
|
|
* usage bit for all held locks:
|
|
*/
|
|
if (!mark_held_locks(curr, HARDIRQ))
|
|
return;
|
|
/*
|
|
* If we have softirqs enabled, then set the usage
|
|
* bit for all held locks. (disabled hardirqs prevented
|
|
* this bit from being set before)
|
|
*/
|
|
if (curr->softirqs_enabled)
|
|
if (!mark_held_locks(curr, SOFTIRQ))
|
|
return;
|
|
|
|
curr->hardirq_enable_ip = ip;
|
|
curr->hardirq_enable_event = ++curr->irq_events;
|
|
debug_atomic_inc(hardirqs_on_events);
|
|
}
|
|
|
|
void lockdep_hardirqs_on(unsigned long ip)
|
|
{
|
|
if (unlikely(!debug_locks || current->lockdep_recursion))
|
|
return;
|
|
|
|
if (unlikely(current->hardirqs_enabled)) {
|
|
/*
|
|
* Neither irq nor preemption are disabled here
|
|
* so this is racy by nature but losing one hit
|
|
* in a stat is not a big deal.
|
|
*/
|
|
__debug_atomic_inc(redundant_hardirqs_on);
|
|
return;
|
|
}
|
|
|
|
/*
|
|
* We're enabling irqs and according to our state above irqs weren't
|
|
* already enabled, yet we find the hardware thinks they are in fact
|
|
* enabled.. someone messed up their IRQ state tracing.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return;
|
|
|
|
/*
|
|
* See the fine text that goes along with this variable definition.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(unlikely(early_boot_irqs_disabled)))
|
|
return;
|
|
|
|
/*
|
|
* Can't allow enabling interrupts while in an interrupt handler,
|
|
* that's general bad form and such. Recursion, limited stack etc..
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(current->hardirq_context))
|
|
return;
|
|
|
|
current->lockdep_recursion = 1;
|
|
__trace_hardirqs_on_caller(ip);
|
|
current->lockdep_recursion = 0;
|
|
}
|
|
|
|
/*
|
|
* Hardirqs were disabled:
|
|
*/
|
|
void lockdep_hardirqs_off(unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
|
|
if (unlikely(!debug_locks || current->lockdep_recursion))
|
|
return;
|
|
|
|
/*
|
|
* So we're supposed to get called after you mask local IRQs, but for
|
|
* some reason the hardware doesn't quite think you did a proper job.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return;
|
|
|
|
if (curr->hardirqs_enabled) {
|
|
/*
|
|
* We have done an ON -> OFF transition:
|
|
*/
|
|
curr->hardirqs_enabled = 0;
|
|
curr->hardirq_disable_ip = ip;
|
|
curr->hardirq_disable_event = ++curr->irq_events;
|
|
debug_atomic_inc(hardirqs_off_events);
|
|
} else
|
|
debug_atomic_inc(redundant_hardirqs_off);
|
|
}
|
|
|
|
/*
|
|
* Softirqs will be enabled:
|
|
*/
|
|
void trace_softirqs_on(unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
|
|
if (unlikely(!debug_locks || current->lockdep_recursion))
|
|
return;
|
|
|
|
/*
|
|
* We fancy IRQs being disabled here, see softirq.c, avoids
|
|
* funny state and nesting things.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return;
|
|
|
|
if (curr->softirqs_enabled) {
|
|
debug_atomic_inc(redundant_softirqs_on);
|
|
return;
|
|
}
|
|
|
|
current->lockdep_recursion = 1;
|
|
/*
|
|
* We'll do an OFF -> ON transition:
|
|
*/
|
|
curr->softirqs_enabled = 1;
|
|
curr->softirq_enable_ip = ip;
|
|
curr->softirq_enable_event = ++curr->irq_events;
|
|
debug_atomic_inc(softirqs_on_events);
|
|
/*
|
|
* We are going to turn softirqs on, so set the
|
|
* usage bit for all held locks, if hardirqs are
|
|
* enabled too:
|
|
*/
|
|
if (curr->hardirqs_enabled)
|
|
mark_held_locks(curr, SOFTIRQ);
|
|
current->lockdep_recursion = 0;
|
|
}
|
|
|
|
/*
|
|
* Softirqs were disabled:
|
|
*/
|
|
void trace_softirqs_off(unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
|
|
if (unlikely(!debug_locks || current->lockdep_recursion))
|
|
return;
|
|
|
|
/*
|
|
* We fancy IRQs being disabled here, see softirq.c
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return;
|
|
|
|
if (curr->softirqs_enabled) {
|
|
/*
|
|
* We have done an ON -> OFF transition:
|
|
*/
|
|
curr->softirqs_enabled = 0;
|
|
curr->softirq_disable_ip = ip;
|
|
curr->softirq_disable_event = ++curr->irq_events;
|
|
debug_atomic_inc(softirqs_off_events);
|
|
/*
|
|
* Whoops, we wanted softirqs off, so why aren't they?
|
|
*/
|
|
DEBUG_LOCKS_WARN_ON(!softirq_count());
|
|
} else
|
|
debug_atomic_inc(redundant_softirqs_off);
|
|
}
|
|
|
|
static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
|
|
{
|
|
/*
|
|
* If non-trylock use in a hardirq or softirq context, then
|
|
* mark the lock as used in these contexts:
|
|
*/
|
|
if (!hlock->trylock) {
|
|
if (hlock->read) {
|
|
if (curr->hardirq_context)
|
|
if (!mark_lock(curr, hlock,
|
|
LOCK_USED_IN_HARDIRQ_READ))
|
|
goto out;
|
|
if (curr->softirq_context)
|
|
if (!mark_lock(curr, hlock,
|
|
LOCK_USED_IN_SOFTIRQ_READ))
|
|
goto out;
|
|
} else {
|
|
if (curr->hardirq_context)
|
|
if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ))
|
|
goto out;
|
|
if (curr->softirq_context)
|
|
if (!mark_lock(curr, hlock, LOCK_USED_IN_SOFTIRQ))
|
|
goto out;
|
|
}
|
|
}
|
|
if (!hlock->hardirqs_off) {
|
|
if (hlock->read) {
|
|
if (!mark_lock(curr, hlock,
|
|
LOCK_ENABLED_HARDIRQ_READ))
|
|
goto out;
|
|
if (curr->softirqs_enabled)
|
|
if (!mark_lock(curr, hlock,
|
|
LOCK_ENABLED_SOFTIRQ_READ))
|
|
goto out;
|
|
} else {
|
|
if (!mark_lock(curr, hlock,
|
|
LOCK_ENABLED_HARDIRQ))
|
|
goto out;
|
|
if (curr->softirqs_enabled)
|
|
if (!mark_lock(curr, hlock,
|
|
LOCK_ENABLED_SOFTIRQ))
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
out:
|
|
return 1;
|
|
}
|
|
|
|
static inline unsigned int task_irq_context(struct task_struct *task)
|
|
{
|
|
return 2 * !!task->hardirq_context + !!task->softirq_context;
|
|
}
|
|
|
|
static int separate_irq_context(struct task_struct *curr,
|
|
struct held_lock *hlock)
|
|
{
|
|
unsigned int depth = curr->lockdep_depth;
|
|
|
|
/*
|
|
* Keep track of points where we cross into an interrupt context:
|
|
*/
|
|
if (depth) {
|
|
struct held_lock *prev_hlock;
|
|
|
|
prev_hlock = curr->held_locks + depth-1;
|
|
/*
|
|
* If we cross into another context, reset the
|
|
* hash key (this also prevents the checking and the
|
|
* adding of the dependency to 'prev'):
|
|
*/
|
|
if (prev_hlock->irq_context != hlock->irq_context)
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
#else /* defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING) */
|
|
|
|
static inline
|
|
int mark_lock_irq(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit new_bit)
|
|
{
|
|
WARN_ON(1); /* Impossible innit? when we don't have TRACE_IRQFLAG */
|
|
return 1;
|
|
}
|
|
|
|
static inline int mark_irqflags(struct task_struct *curr,
|
|
struct held_lock *hlock)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
static inline unsigned int task_irq_context(struct task_struct *task)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int separate_irq_context(struct task_struct *curr,
|
|
struct held_lock *hlock)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#endif /* defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_PROVE_LOCKING) */
|
|
|
|
/*
|
|
* Mark a lock with a usage bit, and validate the state transition:
|
|
*/
|
|
static int mark_lock(struct task_struct *curr, struct held_lock *this,
|
|
enum lock_usage_bit new_bit)
|
|
{
|
|
unsigned int new_mask = 1 << new_bit, ret = 1;
|
|
|
|
/*
|
|
* If already set then do not dirty the cacheline,
|
|
* nor do any checks:
|
|
*/
|
|
if (likely(hlock_class(this)->usage_mask & new_mask))
|
|
return 1;
|
|
|
|
if (!graph_lock())
|
|
return 0;
|
|
/*
|
|
* Make sure we didn't race:
|
|
*/
|
|
if (unlikely(hlock_class(this)->usage_mask & new_mask)) {
|
|
graph_unlock();
|
|
return 1;
|
|
}
|
|
|
|
hlock_class(this)->usage_mask |= new_mask;
|
|
|
|
if (!save_trace(hlock_class(this)->usage_traces + new_bit))
|
|
return 0;
|
|
|
|
switch (new_bit) {
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
case LOCK_USED_IN_##__STATE: \
|
|
case LOCK_USED_IN_##__STATE##_READ: \
|
|
case LOCK_ENABLED_##__STATE: \
|
|
case LOCK_ENABLED_##__STATE##_READ:
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
ret = mark_lock_irq(curr, this, new_bit);
|
|
if (!ret)
|
|
return 0;
|
|
break;
|
|
case LOCK_USED:
|
|
debug_atomic_dec(nr_unused_locks);
|
|
break;
|
|
default:
|
|
if (!lockdep_logging_off_graph_unlock())
|
|
return 0;
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
|
|
graph_unlock();
|
|
|
|
/*
|
|
* We must printk outside of the graph_lock:
|
|
*/
|
|
if (ret == 2) {
|
|
printk("\nmarked lock as {%s}:\n", usage_str[new_bit]);
|
|
print_lock(this);
|
|
print_irqtrace_events(curr);
|
|
dump_stack();
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Initialize a lock instance's lock-class mapping info:
|
|
*/
|
|
static void __lockdep_init_map(struct lockdep_map *lock, const char *name,
|
|
struct lock_class_key *key, int subclass)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++)
|
|
lock->class_cache[i] = NULL;
|
|
|
|
#ifdef CONFIG_LOCK_STAT
|
|
lock->cpu = raw_smp_processor_id();
|
|
#endif
|
|
|
|
/*
|
|
* Can't be having no nameless bastards around this place!
|
|
*/
|
|
if (lockdep_warn_on(!name)) {
|
|
lock->name = "NULL";
|
|
return;
|
|
}
|
|
|
|
lock->name = name;
|
|
|
|
/*
|
|
* No key, no joy, we need to hash something.
|
|
*/
|
|
if (lockdep_warn_on(!key))
|
|
return;
|
|
/*
|
|
* Sanity check, the lock-class key must be persistent:
|
|
*/
|
|
if (!static_obj(key)) {
|
|
/*
|
|
* to make sure register_lock_class returns NULL
|
|
* for a non static key
|
|
*/
|
|
lock->key = key;
|
|
printk("BUG: key %px not in .data!\n", key);
|
|
/*
|
|
* What it says above ^^^^^, I suggest you read it.
|
|
*/
|
|
lockdep_warn_on(1);
|
|
return;
|
|
}
|
|
lock->key = key;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return;
|
|
|
|
if (subclass) {
|
|
unsigned long flags;
|
|
|
|
if (lockdep_warn_on(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
current->lockdep_recursion = 1;
|
|
register_lock_class(lock, subclass, 1);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
}
|
|
|
|
void lockdep_init_map(struct lockdep_map *lock, const char *name,
|
|
struct lock_class_key *key, int subclass)
|
|
{
|
|
__lockdep_init_map(lock, name, key, subclass);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lockdep_init_map);
|
|
|
|
struct lock_class_key __lockdep_no_validate__;
|
|
EXPORT_SYMBOL_GPL(__lockdep_no_validate__);
|
|
|
|
static int
|
|
print_lock_nested_lock_not_held(struct task_struct *curr,
|
|
struct held_lock *hlock,
|
|
unsigned long ip)
|
|
{
|
|
if (!lockdep_logging_off() || debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("==================================\n");
|
|
pr_warn("WARNING: Nested lock was not taken\n");
|
|
print_kernel_ident();
|
|
pr_warn("----------------------------------\n");
|
|
|
|
pr_warn("%s/%d is trying to lock:\n", curr->comm, task_pid_nr(curr));
|
|
print_lock(hlock);
|
|
|
|
pr_warn("\nbut this task is not holding:\n");
|
|
pr_warn("%s\n", hlock->nest_lock->name);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
pr_warn("\nother info that might help us debug this:\n");
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int __lock_is_held(const struct lockdep_map *lock, int read);
|
|
|
|
static unsigned long lockdep_walk_stack(unsigned long addr)
|
|
{
|
|
int ret;
|
|
struct stackframe frame;
|
|
struct task_struct *tsk = current;
|
|
bool end_search = false;
|
|
int counter = 0;
|
|
|
|
frame.fp = (unsigned long)__builtin_frame_address(0);
|
|
frame.pc = (unsigned long)lockdep_walk_stack;
|
|
|
|
while (counter < MAX_ITR) {
|
|
counter++;
|
|
if (frame.pc == addr)
|
|
end_search = true;
|
|
|
|
ret = unwind_frame(tsk, &frame);
|
|
if ((ret < 0) || end_search)
|
|
break;
|
|
}
|
|
|
|
if (unlikely(ret < 0) || unlikely(counter == MAX_ITR))
|
|
return 0;
|
|
else
|
|
return frame.pc;
|
|
}
|
|
|
|
/*
|
|
* This gets called for every mutex_lock*()/spin_lock*() operation.
|
|
* We maintain the dependency maps and validate the locking attempt:
|
|
*/
|
|
static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
|
|
int trylock, int read, int check, int hardirqs_off,
|
|
struct lockdep_map *nest_lock, unsigned long ip,
|
|
int references, int pin_count,
|
|
unsigned long ip_caller)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct lock_class *class = NULL;
|
|
struct held_lock *hlock;
|
|
unsigned int depth;
|
|
int chain_head = 0;
|
|
int class_idx;
|
|
u64 chain_key;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return 0;
|
|
|
|
/*
|
|
* Lockdep should run with IRQs disabled, otherwise we could
|
|
* get an interrupt which would want to take locks, which would
|
|
* end up in lockdep and have you got a head-ache already?
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
|
|
return 0;
|
|
|
|
if (!prove_locking || lock->key == &__lockdep_no_validate__)
|
|
check = 0;
|
|
|
|
if (subclass < NR_LOCKDEP_CACHING_CLASSES)
|
|
class = lock->class_cache[subclass];
|
|
/*
|
|
* Not cached?
|
|
*/
|
|
if (unlikely(!class)) {
|
|
class = register_lock_class(lock, subclass, 0);
|
|
if (!class)
|
|
return 0;
|
|
}
|
|
atomic_inc((atomic_t *)&class->ops);
|
|
if (very_verbose(class)) {
|
|
printk("\nacquire class [%px] %s", class->key, class->name);
|
|
if (class->name_version > 1)
|
|
printk(KERN_CONT "#%d", class->name_version);
|
|
printk(KERN_CONT "\n");
|
|
dump_stack();
|
|
}
|
|
|
|
/*
|
|
* Add the lock to the list of currently held locks.
|
|
* (we dont increase the depth just yet, up until the
|
|
* dependency checks are done)
|
|
*/
|
|
depth = curr->lockdep_depth;
|
|
/*
|
|
* Ran out of static storage for our per-task lock stack again have we?
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(depth >= MAX_LOCK_DEPTH))
|
|
return 0;
|
|
|
|
class_idx = class - lock_classes + 1;
|
|
|
|
if (depth) {
|
|
hlock = curr->held_locks + depth - 1;
|
|
if (hlock->class_idx == class_idx && nest_lock) {
|
|
if (!references)
|
|
references++;
|
|
|
|
if (!hlock->references)
|
|
hlock->references++;
|
|
|
|
hlock->references += references;
|
|
|
|
/* Overflow */
|
|
if (DEBUG_LOCKS_WARN_ON(hlock->references < references))
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
hlock = curr->held_locks + depth;
|
|
/*
|
|
* Plain impossible, we just registered it and checked it weren't no
|
|
* NULL like.. I bet this mushroom I ate was good!
|
|
*/
|
|
if (lockdep_warn_on(!class))
|
|
return 0;
|
|
hlock->class_idx = class_idx;
|
|
hlock->acquire_ip = ip;
|
|
hlock->instance = lock;
|
|
hlock->nest_lock = nest_lock;
|
|
hlock->irq_context = task_irq_context(curr);
|
|
hlock->trylock = trylock;
|
|
hlock->read = read;
|
|
hlock->check = check;
|
|
hlock->hardirqs_off = !!hardirqs_off;
|
|
hlock->references = references;
|
|
#ifdef CONFIG_LOCK_STAT
|
|
hlock->waittime_stamp = 0;
|
|
hlock->holdtime_stamp = lockstat_clock();
|
|
#endif
|
|
hlock->pin_count = pin_count;
|
|
if (!ip_caller)
|
|
hlock->acquire_ip_caller = lockdep_walk_stack(ip);
|
|
else
|
|
hlock->acquire_ip_caller = ip_caller;
|
|
|
|
if (check && !mark_irqflags(curr, hlock))
|
|
return 0;
|
|
|
|
/* mark it as used: */
|
|
mark_lock(curr, hlock, LOCK_USED);
|
|
|
|
/*
|
|
* Calculate the chain hash: it's the combined hash of all the
|
|
* lock keys along the dependency chain. We save the hash value
|
|
* at every step so that we can get the current hash easily
|
|
* after unlock. The chain hash is then used to cache dependency
|
|
* results.
|
|
*
|
|
* The 'key ID' is what is the most compact key value to drive
|
|
* the hash, not class->key.
|
|
*/
|
|
/*
|
|
* Whoops, we did it again.. ran straight out of our static allocation.
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(class_idx > MAX_LOCKDEP_KEYS))
|
|
return 0;
|
|
|
|
chain_key = curr->curr_chain_key;
|
|
if (!depth) {
|
|
/*
|
|
* How can we have a chain hash when we ain't got no keys?!
|
|
*/
|
|
if (lockdep_warn_on(chain_key != 0))
|
|
return 0;
|
|
chain_head = 1;
|
|
}
|
|
|
|
hlock->prev_chain_key = chain_key;
|
|
if (separate_irq_context(curr, hlock)) {
|
|
chain_key = 0;
|
|
chain_head = 1;
|
|
}
|
|
chain_key = iterate_chain_key(chain_key, class_idx);
|
|
|
|
if (nest_lock && !__lock_is_held(nest_lock, -1))
|
|
return print_lock_nested_lock_not_held(curr, hlock, ip);
|
|
|
|
if (!validate_chain(curr, lock, hlock, chain_head, chain_key))
|
|
return 0;
|
|
|
|
curr->curr_chain_key = chain_key;
|
|
curr->lockdep_depth++;
|
|
check_chain_key(curr);
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
if (unlikely(!debug_locks))
|
|
return 0;
|
|
#endif
|
|
if (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {
|
|
debug_locks_off();
|
|
print_lockdep_off("BUG: MAX_LOCK_DEPTH too low!");
|
|
printk(KERN_DEBUG "depth: %i max: %lu!\n",
|
|
curr->lockdep_depth, MAX_LOCK_DEPTH);
|
|
|
|
lockdep_print_held_locks(current);
|
|
debug_show_all_locks();
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
if (unlikely(curr->lockdep_depth > max_lockdep_depth))
|
|
max_lockdep_depth = curr->lockdep_depth;
|
|
|
|
return 1;
|
|
}
|
|
|
|
static int
|
|
print_unlock_imbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
|
|
unsigned long ip)
|
|
{
|
|
if (!lockdep_logging_off() || debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("=====================================\n");
|
|
pr_warn("WARNING: bad unlock balance detected!\n");
|
|
print_kernel_ident();
|
|
pr_warn("-------------------------------------\n");
|
|
pr_warn("%s/%d is trying to release lock (",
|
|
curr->comm, task_pid_nr(curr));
|
|
print_lockdep_cache(lock);
|
|
pr_cont(") at:\n");
|
|
print_ip_sym(ip);
|
|
pr_warn("but there are no more locks to release!\n");
|
|
pr_warn("\nother info that might help us debug this:\n");
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int match_held_lock(const struct held_lock *hlock,
|
|
const struct lockdep_map *lock)
|
|
{
|
|
if (hlock->instance == lock)
|
|
return 1;
|
|
|
|
if (hlock->references) {
|
|
const struct lock_class *class = lock->class_cache[0];
|
|
|
|
if (!class)
|
|
class = look_up_lock_class(lock, 0);
|
|
|
|
/*
|
|
* If look_up_lock_class() failed to find a class, we're trying
|
|
* to test if we hold a lock that has never yet been acquired.
|
|
* Clearly if the lock hasn't been acquired _ever_, we're not
|
|
* holding it either, so report failure.
|
|
*/
|
|
if (!class)
|
|
return 0;
|
|
|
|
/*
|
|
* References, but not a lock we're actually ref-counting?
|
|
* State got messed up, follow the sites that change ->references
|
|
* and try to make sense of it.
|
|
*/
|
|
if (lockdep_warn_on(!hlock->nest_lock))
|
|
return 0;
|
|
|
|
if (hlock->class_idx == class - lock_classes + 1)
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* @depth must not be zero */
|
|
static struct held_lock *find_held_lock(struct task_struct *curr,
|
|
struct lockdep_map *lock,
|
|
unsigned int depth, int *idx)
|
|
{
|
|
struct held_lock *ret, *hlock, *prev_hlock;
|
|
int i;
|
|
|
|
i = depth - 1;
|
|
hlock = curr->held_locks + i;
|
|
ret = hlock;
|
|
if (match_held_lock(hlock, lock))
|
|
goto out;
|
|
|
|
ret = NULL;
|
|
for (i--, prev_hlock = hlock--;
|
|
i >= 0;
|
|
i--, prev_hlock = hlock--) {
|
|
/*
|
|
* We must not cross into another context:
|
|
*/
|
|
if (prev_hlock->irq_context != hlock->irq_context) {
|
|
ret = NULL;
|
|
break;
|
|
}
|
|
if (match_held_lock(hlock, lock)) {
|
|
ret = hlock;
|
|
break;
|
|
}
|
|
}
|
|
|
|
out:
|
|
*idx = i;
|
|
return ret;
|
|
}
|
|
|
|
static int reacquire_held_locks(struct task_struct *curr, unsigned int depth,
|
|
int idx)
|
|
{
|
|
struct held_lock *hlock;
|
|
|
|
for (hlock = curr->held_locks + idx; idx < depth; idx++, hlock++) {
|
|
if (!__lock_acquire(hlock->instance,
|
|
hlock_class(hlock)->subclass,
|
|
hlock->trylock,
|
|
hlock->read, hlock->check,
|
|
hlock->hardirqs_off,
|
|
hlock->nest_lock, hlock->acquire_ip,
|
|
hlock->references, hlock->pin_count,
|
|
hlock->acquire_ip_caller))
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static int
|
|
__lock_set_class(struct lockdep_map *lock, const char *name,
|
|
struct lock_class_key *key, unsigned int subclass,
|
|
unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct held_lock *hlock;
|
|
struct lock_class *class;
|
|
unsigned int depth;
|
|
int i;
|
|
|
|
depth = curr->lockdep_depth;
|
|
/*
|
|
* This function is about (re)setting the class of a held lock,
|
|
* yet we're not actually holding any locks. Naughty user!
|
|
*/
|
|
if (lockdep_warn_on(!depth))
|
|
return 0;
|
|
|
|
hlock = find_held_lock(curr, lock, depth, &i);
|
|
if (!hlock)
|
|
return print_unlock_imbalance_bug(curr, lock, ip);
|
|
|
|
lockdep_init_map(lock, name, key, 0);
|
|
class = register_lock_class(lock, subclass, 0);
|
|
if (!class)
|
|
return 0;
|
|
|
|
hlock->class_idx = class - lock_classes + 1;
|
|
|
|
curr->lockdep_depth = i;
|
|
curr->curr_chain_key = hlock->prev_chain_key;
|
|
|
|
if (reacquire_held_locks(curr, depth, i))
|
|
return 0;
|
|
|
|
/*
|
|
* I took it apart and put it back together again, except now I have
|
|
* these 'spare' parts.. where shall I put them.
|
|
*/
|
|
if (lockdep_warn_on(curr->lockdep_depth != depth))
|
|
return 0;
|
|
return 1;
|
|
}
|
|
|
|
static int __lock_downgrade(struct lockdep_map *lock, unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct held_lock *hlock;
|
|
unsigned int depth;
|
|
int i;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return 0;
|
|
|
|
depth = curr->lockdep_depth;
|
|
/*
|
|
* This function is about (re)setting the class of a held lock,
|
|
* yet we're not actually holding any locks. Naughty user!
|
|
*/
|
|
if (lockdep_warn_on(!depth))
|
|
return 0;
|
|
|
|
hlock = find_held_lock(curr, lock, depth, &i);
|
|
if (!hlock)
|
|
return print_unlock_imbalance_bug(curr, lock, ip);
|
|
|
|
curr->lockdep_depth = i;
|
|
curr->curr_chain_key = hlock->prev_chain_key;
|
|
|
|
if (lockdep_logging_off())
|
|
WARN(hlock->read, "downgrading a read lock");
|
|
|
|
hlock->read = 1;
|
|
hlock->acquire_ip = ip;
|
|
hlock->acquire_ip_caller = lockdep_walk_stack(ip);
|
|
|
|
if (reacquire_held_locks(curr, depth, i))
|
|
return 0;
|
|
|
|
/*
|
|
* I took it apart and put it back together again, except now I have
|
|
* these 'spare' parts.. where shall I put them.
|
|
*/
|
|
if (lockdep_warn_on(curr->lockdep_depth != depth))
|
|
return 0;
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
* Remove the lock to the list of currently held locks - this gets
|
|
* called on mutex_unlock()/spin_unlock*() (or on a failed
|
|
* mutex_lock_interruptible()).
|
|
*
|
|
* @nested is an hysterical artifact, needs a tree wide cleanup.
|
|
*/
|
|
static int
|
|
__lock_release(struct lockdep_map *lock, int nested, unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct held_lock *hlock;
|
|
unsigned int depth;
|
|
int i;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return 0;
|
|
|
|
depth = curr->lockdep_depth;
|
|
/*
|
|
* So we're all set to release this lock.. wait what lock? We don't
|
|
* own any locks, you've been drinking again?
|
|
*/
|
|
if (lockdep_warn_on(depth <= 0))
|
|
return print_unlock_imbalance_bug(curr, lock, ip);
|
|
|
|
/*
|
|
* Check whether the lock exists in the current stack
|
|
* of held locks:
|
|
*/
|
|
hlock = find_held_lock(curr, lock, depth, &i);
|
|
if (!hlock)
|
|
return print_unlock_imbalance_bug(curr, lock, ip);
|
|
|
|
if (hlock->instance == lock)
|
|
lock_release_holdtime(hlock);
|
|
|
|
if (lockdep_logging_off())
|
|
WARN(hlock->pin_count, "releasing a pinned lock\n");
|
|
|
|
if (hlock->references) {
|
|
hlock->references--;
|
|
if (hlock->references) {
|
|
/*
|
|
* We had, and after removing one, still have
|
|
* references, the current lock stack is still
|
|
* valid. We're done!
|
|
*/
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* We have the right lock to unlock, 'hlock' points to it.
|
|
* Now we remove it from the stack, and add back the other
|
|
* entries (if any), recalculating the hash along the way:
|
|
*/
|
|
|
|
curr->lockdep_depth = i;
|
|
curr->curr_chain_key = hlock->prev_chain_key;
|
|
|
|
if (reacquire_held_locks(curr, depth, i + 1))
|
|
return 0;
|
|
|
|
/*
|
|
* We had N bottles of beer on the wall, we drank one, but now
|
|
* there's not N-1 bottles of beer left on the wall...
|
|
*/
|
|
if (lockdep_warn_on(curr->lockdep_depth != depth - 1))
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
static int __lock_is_held(const struct lockdep_map *lock, int read)
|
|
{
|
|
struct task_struct *curr = current;
|
|
int i;
|
|
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
struct held_lock *hlock = curr->held_locks + i;
|
|
|
|
if (match_held_lock(hlock, lock)) {
|
|
if (read == -1 || hlock->read == read)
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct pin_cookie __lock_pin_lock(struct lockdep_map *lock)
|
|
{
|
|
struct pin_cookie cookie = NIL_COOKIE;
|
|
struct task_struct *curr = current;
|
|
int i;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return cookie;
|
|
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
struct held_lock *hlock = curr->held_locks + i;
|
|
|
|
if (match_held_lock(hlock, lock)) {
|
|
/*
|
|
* Grab 16bits of randomness; this is sufficient to not
|
|
* be guessable and still allows some pin nesting in
|
|
* our u32 pin_count.
|
|
*/
|
|
cookie.val = 1 + (prandom_u32() >> 16);
|
|
hlock->pin_count += cookie.val;
|
|
return cookie;
|
|
}
|
|
}
|
|
|
|
if (lockdep_logging_off())
|
|
WARN(1, "pinning an unheld lock\n");
|
|
|
|
return cookie;
|
|
}
|
|
|
|
static void __lock_repin_lock(struct lockdep_map *lock, struct pin_cookie cookie)
|
|
{
|
|
struct task_struct *curr = current;
|
|
int i;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return;
|
|
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
struct held_lock *hlock = curr->held_locks + i;
|
|
|
|
if (match_held_lock(hlock, lock)) {
|
|
hlock->pin_count += cookie.val;
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (lockdep_logging_off())
|
|
WARN(1, "pinning an unheld lock\n");
|
|
}
|
|
|
|
static void __lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie cookie)
|
|
{
|
|
struct task_struct *curr = current;
|
|
int i;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return;
|
|
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
struct held_lock *hlock = curr->held_locks + i;
|
|
|
|
if (match_held_lock(hlock, lock)) {
|
|
if (!hlock->pin_count) {
|
|
if (lockdep_logging_off())
|
|
WARN(1, "unpinning an unpinned lock\n");
|
|
return;
|
|
}
|
|
|
|
hlock->pin_count -= cookie.val;
|
|
|
|
if ((int)hlock->pin_count < 0) {
|
|
if (lockdep_logging_off())
|
|
WARN(1, "pin count corrupted\n");
|
|
hlock->pin_count = 0;
|
|
}
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (lockdep_logging_off())
|
|
WARN(1, "unpinning an unheld lock\n");
|
|
}
|
|
|
|
/*
|
|
* Check whether we follow the irq-flags state precisely:
|
|
*/
|
|
static void check_flags(unsigned long flags)
|
|
{
|
|
#if defined(CONFIG_PROVE_LOCKING) && defined(CONFIG_DEBUG_LOCKDEP) && \
|
|
defined(CONFIG_TRACE_IRQFLAGS)
|
|
if (!debug_locks)
|
|
return;
|
|
|
|
if (irqs_disabled_flags(flags)) {
|
|
if (DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)) {
|
|
printk("possible reason: unannotated irqs-off.\n");
|
|
}
|
|
} else {
|
|
if (DEBUG_LOCKS_WARN_ON(!current->hardirqs_enabled)) {
|
|
printk("possible reason: unannotated irqs-on.\n");
|
|
}
|
|
}
|
|
|
|
/*
|
|
* We dont accurately track softirq state in e.g.
|
|
* hardirq contexts (such as on 4KSTACKS), so only
|
|
* check if not in hardirq contexts:
|
|
*/
|
|
if (!hardirq_count()) {
|
|
if (softirq_count()) {
|
|
/* like the above, but with softirqs */
|
|
DEBUG_LOCKS_WARN_ON(current->softirqs_enabled);
|
|
} else {
|
|
/* lick the above, does it taste good? */
|
|
DEBUG_LOCKS_WARN_ON(!current->softirqs_enabled);
|
|
}
|
|
}
|
|
|
|
if (!debug_locks)
|
|
print_irqtrace_events(current);
|
|
#endif
|
|
}
|
|
|
|
void lock_set_class(struct lockdep_map *lock, const char *name,
|
|
struct lock_class_key *key, unsigned int subclass,
|
|
unsigned long ip)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
current->lockdep_recursion = 1;
|
|
check_flags(flags);
|
|
if (__lock_set_class(lock, name, key, subclass, ip))
|
|
check_chain_key(current);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_set_class);
|
|
|
|
void lock_downgrade(struct lockdep_map *lock, unsigned long ip)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
current->lockdep_recursion = 1;
|
|
check_flags(flags);
|
|
if (__lock_downgrade(lock, ip))
|
|
check_chain_key(current);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_downgrade);
|
|
|
|
/*
|
|
* We are not always called with irqs disabled - do that here,
|
|
* and also avoid lockdep recursion:
|
|
*/
|
|
void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
|
|
int trylock, int read, int check,
|
|
struct lockdep_map *nest_lock, unsigned long ip)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
|
|
current->lockdep_recursion = 1;
|
|
trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
|
|
__lock_acquire(lock, subclass, trylock, read, check,
|
|
irqs_disabled_flags(flags), nest_lock, ip, 0, 0, 0);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_acquire);
|
|
|
|
void lock_release(struct lockdep_map *lock, int nested,
|
|
unsigned long ip)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
current->lockdep_recursion = 1;
|
|
trace_lock_release(lock, ip);
|
|
if (__lock_release(lock, nested, ip))
|
|
check_chain_key(current);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_release);
|
|
|
|
int lock_is_held_type(const struct lockdep_map *lock, int read)
|
|
{
|
|
unsigned long flags;
|
|
int ret = 0;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return 1; /* avoid false negative lockdep_assert_held() */
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
|
|
current->lockdep_recursion = 1;
|
|
ret = __lock_is_held(lock, read);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_is_held_type);
|
|
|
|
struct pin_cookie lock_pin_lock(struct lockdep_map *lock)
|
|
{
|
|
struct pin_cookie cookie = NIL_COOKIE;
|
|
unsigned long flags;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return cookie;
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
|
|
current->lockdep_recursion = 1;
|
|
cookie = __lock_pin_lock(lock);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
|
|
return cookie;
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_pin_lock);
|
|
|
|
void lock_repin_lock(struct lockdep_map *lock, struct pin_cookie cookie)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
|
|
current->lockdep_recursion = 1;
|
|
__lock_repin_lock(lock, cookie);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_repin_lock);
|
|
|
|
void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie cookie)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
|
|
current->lockdep_recursion = 1;
|
|
__lock_unpin_lock(lock, cookie);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_unpin_lock);
|
|
|
|
#ifdef CONFIG_LOCK_STAT
|
|
static int
|
|
print_lock_contention_bug(struct task_struct *curr, struct lockdep_map *lock,
|
|
unsigned long ip)
|
|
{
|
|
if (!lockdep_logging_off() || debug_locks_silent)
|
|
return 0;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("=================================\n");
|
|
pr_warn("WARNING: bad contention detected!\n");
|
|
print_kernel_ident();
|
|
pr_warn("---------------------------------\n");
|
|
pr_warn("%s/%d is trying to contend lock (",
|
|
curr->comm, task_pid_nr(curr));
|
|
print_lockdep_cache(lock);
|
|
pr_cont(") at:\n");
|
|
print_ip_sym(ip);
|
|
pr_warn("but there are no locks held!\n");
|
|
pr_warn("\nother info that might help us debug this:\n");
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void
|
|
__lock_contended(struct lockdep_map *lock, unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct held_lock *hlock;
|
|
struct lock_class_stats *stats;
|
|
unsigned int depth;
|
|
int i, contention_point, contending_point;
|
|
|
|
depth = curr->lockdep_depth;
|
|
/*
|
|
* Whee, we contended on this lock, except it seems we're not
|
|
* actually trying to acquire anything much at all..
|
|
*/
|
|
if (lockdep_warn_on(!depth))
|
|
return;
|
|
|
|
hlock = find_held_lock(curr, lock, depth, &i);
|
|
if (!hlock) {
|
|
print_lock_contention_bug(curr, lock, ip);
|
|
return;
|
|
}
|
|
|
|
if (hlock->instance != lock)
|
|
return;
|
|
|
|
hlock->waittime_stamp = lockstat_clock();
|
|
|
|
contention_point = lock_point(hlock_class(hlock)->contention_point, ip);
|
|
contending_point = lock_point(hlock_class(hlock)->contending_point,
|
|
lock->ip);
|
|
|
|
stats = get_lock_stats(hlock_class(hlock));
|
|
if (contention_point < LOCKSTAT_POINTS)
|
|
stats->contention_point[contention_point]++;
|
|
if (contending_point < LOCKSTAT_POINTS)
|
|
stats->contending_point[contending_point]++;
|
|
if (lock->cpu != smp_processor_id())
|
|
stats->bounces[bounce_contended + !!hlock->read]++;
|
|
}
|
|
|
|
static void
|
|
__lock_acquired(struct lockdep_map *lock, unsigned long ip)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct held_lock *hlock;
|
|
struct lock_class_stats *stats;
|
|
unsigned int depth;
|
|
u64 now, waittime = 0;
|
|
int i, cpu;
|
|
|
|
depth = curr->lockdep_depth;
|
|
/*
|
|
* Yay, we acquired ownership of this lock we didn't try to
|
|
* acquire, how the heck did that happen?
|
|
*/
|
|
if (lockdep_warn_on(!depth))
|
|
return;
|
|
|
|
hlock = find_held_lock(curr, lock, depth, &i);
|
|
if (!hlock) {
|
|
print_lock_contention_bug(curr, lock, _RET_IP_);
|
|
return;
|
|
}
|
|
|
|
if (hlock->instance != lock)
|
|
return;
|
|
|
|
cpu = smp_processor_id();
|
|
if (hlock->waittime_stamp) {
|
|
now = lockstat_clock();
|
|
waittime = now - hlock->waittime_stamp;
|
|
hlock->holdtime_stamp = now;
|
|
}
|
|
|
|
trace_lock_acquired(lock, ip);
|
|
|
|
stats = get_lock_stats(hlock_class(hlock));
|
|
if (waittime) {
|
|
if (hlock->read)
|
|
lock_time_inc(&stats->read_waittime, waittime);
|
|
else
|
|
lock_time_inc(&stats->write_waittime, waittime);
|
|
}
|
|
if (lock->cpu != cpu)
|
|
stats->bounces[bounce_acquired + !!hlock->read]++;
|
|
|
|
lock->cpu = cpu;
|
|
lock->ip = ip;
|
|
lock->ip_caller = lockdep_walk_stack(ip);
|
|
}
|
|
|
|
void lock_contended(struct lockdep_map *lock, unsigned long ip)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(!lock_stat || !debug_locks))
|
|
return;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
current->lockdep_recursion = 1;
|
|
trace_lock_contended(lock, ip);
|
|
__lock_contended(lock, ip);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_contended);
|
|
|
|
void lock_acquired(struct lockdep_map *lock, unsigned long ip)
|
|
{
|
|
unsigned long flags;
|
|
|
|
if (unlikely(!lock_stat || !debug_locks))
|
|
return;
|
|
|
|
if (unlikely(current->lockdep_recursion))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
check_flags(flags);
|
|
current->lockdep_recursion = 1;
|
|
__lock_acquired(lock, ip);
|
|
current->lockdep_recursion = 0;
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(lock_acquired);
|
|
#endif
|
|
|
|
/*
|
|
* Used by the testsuite, sanitize the validator state
|
|
* after a simulated failure:
|
|
*/
|
|
|
|
void lockdep_reset(void)
|
|
{
|
|
unsigned long flags;
|
|
int i;
|
|
|
|
raw_local_irq_save(flags);
|
|
current->curr_chain_key = 0;
|
|
current->lockdep_depth = 0;
|
|
current->lockdep_recursion = 0;
|
|
memset(current->held_locks, 0, MAX_LOCK_DEPTH*sizeof(struct held_lock));
|
|
nr_hardirq_chains = 0;
|
|
nr_softirq_chains = 0;
|
|
nr_process_chains = 0;
|
|
debug_locks = 1;
|
|
for (i = 0; i < CHAINHASH_SIZE; i++)
|
|
INIT_HLIST_HEAD(chainhash_table + i);
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
|
|
static void zap_class(struct lock_class *class)
|
|
{
|
|
int i;
|
|
|
|
/*
|
|
* Remove all dependencies this lock is
|
|
* involved in:
|
|
*/
|
|
for (i = 0; i < nr_list_entries; i++) {
|
|
if (list_entries[i].class == class)
|
|
list_del_rcu(&list_entries[i].entry);
|
|
}
|
|
/*
|
|
* Unhash the class and remove it from the all_lock_classes list:
|
|
*/
|
|
hlist_del_rcu(&class->hash_entry);
|
|
list_del_rcu(&class->lock_entry);
|
|
|
|
RCU_INIT_POINTER(class->key, NULL);
|
|
RCU_INIT_POINTER(class->name, NULL);
|
|
}
|
|
|
|
static inline int within(const void *addr, void *start, unsigned long size)
|
|
{
|
|
return addr >= start && addr < start + size;
|
|
}
|
|
|
|
/*
|
|
* Used in module.c to remove lock classes from memory that is going to be
|
|
* freed; and possibly re-used by other modules.
|
|
*
|
|
* We will have had one sync_sched() before getting here, so we're guaranteed
|
|
* nobody will look up these exact classes -- they're properly dead but still
|
|
* allocated.
|
|
*/
|
|
void lockdep_free_key_range(void *start, unsigned long size)
|
|
{
|
|
struct lock_class *class;
|
|
struct hlist_head *head;
|
|
unsigned long flags;
|
|
int i;
|
|
int locked;
|
|
|
|
raw_local_irq_save(flags);
|
|
locked = graph_lock();
|
|
|
|
/*
|
|
* Unhash all classes that were created by this module:
|
|
*/
|
|
for (i = 0; i < CLASSHASH_SIZE; i++) {
|
|
head = classhash_table + i;
|
|
hlist_for_each_entry_rcu(class, head, hash_entry) {
|
|
if (within(class->key, start, size))
|
|
zap_class(class);
|
|
else if (within(class->name, start, size))
|
|
zap_class(class);
|
|
}
|
|
}
|
|
|
|
if (locked)
|
|
graph_unlock();
|
|
raw_local_irq_restore(flags);
|
|
|
|
/*
|
|
* Wait for any possible iterators from look_up_lock_class() to pass
|
|
* before continuing to free the memory they refer to.
|
|
*
|
|
* sync_sched() is sufficient because the read-side is IRQ disable.
|
|
*/
|
|
synchronize_sched();
|
|
|
|
/*
|
|
* XXX at this point we could return the resources to the pool;
|
|
* instead we leak them. We would need to change to bitmap allocators
|
|
* instead of the linear allocators we have now.
|
|
*/
|
|
}
|
|
|
|
void lockdep_reset_lock(struct lockdep_map *lock)
|
|
{
|
|
struct lock_class *class;
|
|
struct hlist_head *head;
|
|
unsigned long flags;
|
|
int i, j;
|
|
int locked;
|
|
|
|
raw_local_irq_save(flags);
|
|
|
|
/*
|
|
* Remove all classes this lock might have:
|
|
*/
|
|
for (j = 0; j < MAX_LOCKDEP_SUBCLASSES; j++) {
|
|
/*
|
|
* If the class exists we look it up and zap it:
|
|
*/
|
|
class = look_up_lock_class(lock, j);
|
|
if (class)
|
|
zap_class(class);
|
|
}
|
|
/*
|
|
* Debug check: in the end all mapped classes should
|
|
* be gone.
|
|
*/
|
|
locked = graph_lock();
|
|
for (i = 0; i < CLASSHASH_SIZE; i++) {
|
|
head = classhash_table + i;
|
|
hlist_for_each_entry_rcu(class, head, hash_entry) {
|
|
int match = 0;
|
|
|
|
for (j = 0; j < NR_LOCKDEP_CACHING_CLASSES; j++)
|
|
match |= class == lock->class_cache[j];
|
|
|
|
if (unlikely(match)) {
|
|
if (lockdep_logging_off_graph_unlock()) {
|
|
/*
|
|
* We all just reset everything, how did it match?
|
|
*/
|
|
WARN_ON(1);
|
|
}
|
|
goto out_restore;
|
|
}
|
|
}
|
|
}
|
|
if (locked)
|
|
graph_unlock();
|
|
|
|
out_restore:
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
|
|
void __init lockdep_init(void)
|
|
{
|
|
printk("Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar\n");
|
|
|
|
printk("... MAX_LOCKDEP_SUBCLASSES: %lu\n", MAX_LOCKDEP_SUBCLASSES);
|
|
printk("... MAX_LOCK_DEPTH: %lu\n", MAX_LOCK_DEPTH);
|
|
printk("... MAX_LOCKDEP_KEYS: %lu\n", MAX_LOCKDEP_KEYS);
|
|
printk("... CLASSHASH_SIZE: %lu\n", CLASSHASH_SIZE);
|
|
printk("... MAX_LOCKDEP_ENTRIES: %lu\n", MAX_LOCKDEP_ENTRIES);
|
|
printk("... MAX_LOCKDEP_CHAINS: %lu\n", MAX_LOCKDEP_CHAINS);
|
|
printk("... CHAINHASH_SIZE: %lu\n", CHAINHASH_SIZE);
|
|
|
|
printk(" memory used by lock dependency info: %lu kB\n",
|
|
(sizeof(struct lock_class) * MAX_LOCKDEP_KEYS +
|
|
sizeof(struct list_head) * CLASSHASH_SIZE +
|
|
sizeof(struct lock_list) * MAX_LOCKDEP_ENTRIES +
|
|
sizeof(struct lock_chain) * MAX_LOCKDEP_CHAINS +
|
|
sizeof(struct list_head) * CHAINHASH_SIZE
|
|
#ifdef CONFIG_PROVE_LOCKING
|
|
+ sizeof(struct circular_queue)
|
|
#endif
|
|
) / 1024
|
|
);
|
|
|
|
printk(" per task-struct memory footprint: %lu bytes\n",
|
|
sizeof(struct held_lock) * MAX_LOCK_DEPTH);
|
|
}
|
|
|
|
static void
|
|
print_freed_lock_bug(struct task_struct *curr, const void *mem_from,
|
|
const void *mem_to, struct held_lock *hlock)
|
|
{
|
|
if (!lockdep_logging_off() || debug_locks_silent)
|
|
return;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("=========================\n");
|
|
pr_warn("WARNING: held lock freed!\n");
|
|
print_kernel_ident();
|
|
pr_warn("-------------------------\n");
|
|
pr_warn("%s/%d is freeing memory %px-%px, with a lock still held there!\n",
|
|
curr->comm, task_pid_nr(curr), mem_from, mem_to-1);
|
|
print_lock(hlock);
|
|
lockdep_print_held_locks(curr);
|
|
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
}
|
|
|
|
static inline int not_in_range(const void* mem_from, unsigned long mem_len,
|
|
const void* lock_from, unsigned long lock_len)
|
|
{
|
|
return lock_from + lock_len <= mem_from ||
|
|
mem_from + mem_len <= lock_from;
|
|
}
|
|
|
|
/*
|
|
* Called when kernel memory is freed (or unmapped), or if a lock
|
|
* is destroyed or reinitialized - this code checks whether there is
|
|
* any held lock in the memory range of <from> to <to>:
|
|
*/
|
|
void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct held_lock *hlock;
|
|
unsigned long flags;
|
|
int i;
|
|
|
|
if (unlikely(!debug_locks))
|
|
return;
|
|
|
|
raw_local_irq_save(flags);
|
|
for (i = 0; i < curr->lockdep_depth; i++) {
|
|
hlock = curr->held_locks + i;
|
|
|
|
if (not_in_range(mem_from, mem_len, hlock->instance,
|
|
sizeof(*hlock->instance)))
|
|
continue;
|
|
|
|
print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock);
|
|
break;
|
|
}
|
|
raw_local_irq_restore(flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
|
|
|
|
static void print_held_locks_bug(void)
|
|
{
|
|
if (!lockdep_logging_off() || debug_locks_silent)
|
|
return;
|
|
|
|
pr_warn("\n");
|
|
pr_warn("====================================\n");
|
|
pr_warn("WARNING: %s/%d still has locks held!\n",
|
|
current->comm, task_pid_nr(current));
|
|
print_kernel_ident();
|
|
pr_warn("------------------------------------\n");
|
|
lockdep_print_held_locks(current);
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
}
|
|
|
|
void debug_check_no_locks_held(void)
|
|
{
|
|
if (unlikely(current->lockdep_depth > 0))
|
|
print_held_locks_bug();
|
|
}
|
|
EXPORT_SYMBOL_GPL(debug_check_no_locks_held);
|
|
|
|
#ifdef __KERNEL__
|
|
void debug_show_all_locks(void)
|
|
{
|
|
struct task_struct *g, *p;
|
|
|
|
if (unlikely(!debug_locks)) {
|
|
pr_warn("INFO: lockdep is turned off.\n");
|
|
return;
|
|
}
|
|
pr_warn("\nShowing all locks held in the system:\n");
|
|
|
|
rcu_read_lock();
|
|
for_each_process_thread(g, p) {
|
|
if (!p->lockdep_depth)
|
|
continue;
|
|
lockdep_print_held_locks(p);
|
|
touch_nmi_watchdog();
|
|
touch_all_softlockup_watchdogs();
|
|
}
|
|
rcu_read_unlock();
|
|
|
|
pr_warn("\n");
|
|
pr_warn("=============================================\n\n");
|
|
}
|
|
EXPORT_SYMBOL_GPL(debug_show_all_locks);
|
|
#endif
|
|
|
|
/*
|
|
* Careful: only use this function if you are sure that
|
|
* the task cannot run in parallel!
|
|
*/
|
|
void debug_show_held_locks(struct task_struct *task)
|
|
{
|
|
if (unlikely(!debug_locks)) {
|
|
printk("INFO: lockdep is turned off.\n");
|
|
return;
|
|
}
|
|
lockdep_print_held_locks(task);
|
|
}
|
|
EXPORT_SYMBOL_GPL(debug_show_held_locks);
|
|
|
|
asmlinkage __visible void lockdep_sys_exit(void)
|
|
{
|
|
struct task_struct *curr = current;
|
|
|
|
if (unlikely(curr->lockdep_depth)) {
|
|
if (!lockdep_logging_off())
|
|
return;
|
|
pr_warn("\n");
|
|
pr_warn("================================================\n");
|
|
pr_warn("WARNING: lock held when returning to user space!\n");
|
|
print_kernel_ident();
|
|
pr_warn("------------------------------------------------\n");
|
|
pr_warn("%s/%d is leaving the kernel with locks still held!\n",
|
|
curr->comm, curr->pid);
|
|
lockdep_print_held_locks(curr);
|
|
}
|
|
|
|
/*
|
|
* The lock history for each syscall should be independent. So wipe the
|
|
* slate clean on return to userspace.
|
|
*/
|
|
lockdep_invariant_state(false);
|
|
}
|
|
|
|
void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
|
|
{
|
|
struct task_struct *curr = current;
|
|
|
|
if (!lockdep_logging_off())
|
|
return;
|
|
|
|
/* Note: the following can be executed concurrently, so be careful. */
|
|
pr_warn("\n");
|
|
pr_warn("=============================\n");
|
|
pr_warn("WARNING: suspicious RCU usage\n");
|
|
print_kernel_ident();
|
|
pr_warn("-----------------------------\n");
|
|
pr_warn("%s:%d %s!\n", file, line, s);
|
|
pr_warn("\nother info that might help us debug this:\n\n");
|
|
pr_warn("\n%srcu_scheduler_active = %d, debug_locks = %d\n",
|
|
!rcu_lockdep_current_cpu_online()
|
|
? "RCU used illegally from offline CPU!\n"
|
|
: !rcu_is_watching()
|
|
? "RCU used illegally from idle CPU!\n"
|
|
: "",
|
|
rcu_scheduler_active, debug_locks);
|
|
|
|
/*
|
|
* If a CPU is in the RCU-free window in idle (ie: in the section
|
|
* between rcu_idle_enter() and rcu_idle_exit(), then RCU
|
|
* considers that CPU to be in an "extended quiescent state",
|
|
* which means that RCU will be completely ignoring that CPU.
|
|
* Therefore, rcu_read_lock() and friends have absolutely no
|
|
* effect on a CPU running in that state. In other words, even if
|
|
* such an RCU-idle CPU has called rcu_read_lock(), RCU might well
|
|
* delete data structures out from under it. RCU really has no
|
|
* choice here: we need to keep an RCU-free window in idle where
|
|
* the CPU may possibly enter into low power mode. This way we can
|
|
* notice an extended quiescent state to other CPUs that started a grace
|
|
* period. Otherwise we would delay any grace period as long as we run
|
|
* in the idle task.
|
|
*
|
|
* So complain bitterly if someone does call rcu_read_lock(),
|
|
* rcu_read_lock_bh() and so on from extended quiescent states.
|
|
*/
|
|
if (!rcu_is_watching())
|
|
pr_warn("RCU used illegally from extended quiescent state!\n");
|
|
|
|
lockdep_print_held_locks(curr);
|
|
pr_warn("\nstack backtrace:\n");
|
|
dump_stack();
|
|
}
|
|
EXPORT_SYMBOL_GPL(lockdep_rcu_suspicious);
|