Files
kernel_google_redbull/kernel/time/clocksource.c
Lucas Wei b2bed6615a Merge android-4.19-stable (4.19.202) into android-msm-pixel-4.19-lts
Merge 4.19.202 into android-4.19-stable
Linux 4.19.202
    spi: mediatek: Fix fifo transfer
  * padata: add separate cpuhp node for CPUHP_PADATA_DEAD
      include/linux/padata.h
  * padata: validate cpumask without removed CPU during offline
      include/linux/cpuhotplug.h
    Revert "watchdog: iTCO_wdt: Account for rebooting on second timeout"
    firmware: arm_scmi: Ensure drivers provide a probe function
    drm/i915: Ensure intel_engine_init_execlist() builds with Clang
  * Revert "Bluetooth: Shutdown controller after workqueues are flushed or cancelled"
      net/bluetooth/hci_core.c
  * bdi: add a ->dev_name field to struct backing_dev_info
      include/linux/backing-dev-defs.h
      mm/backing-dev.c
  * bdi: use bdi_dev_name() to get device name
      block/blk-cgroup.c
      include/trace/events/wbt.h
  * bdi: move bdi_dev_name out of line
      include/linux/backing-dev.h
      mm/backing-dev.c
  * net: Fix zero-copy head len calculation.
      net/core/skbuff.c
    qed: fix possible unpaired spin_{un}lock_bh in _qed_mcp_cmd_and_union()
  * r8152: Fix potential PM refcount imbalance
      drivers/net/usb/r8152.c
    ASoC: tlv320aic31xx: fix reversed bclk/wclk master bits
  * regulator: rt5033: Fix n_voltages settings for BUCK and LDO
      include/linux/mfd/rt5033-private.h
    btrfs: mark compressed range uptodate only if all bio succeed
    Merge 4.19.201 into android-4.19-stable
Linux 4.19.201
    i40e: Add additional info to PHY type error
    Revert "perf map: Fix dso->nsinfo refcounting"
    powerpc/pseries: Fix regression while building external modules
    can: hi311x: fix a signedness bug in hi3110_cmd()
    sis900: Fix missing pci_disable_device() in probe and remove
    tulip: windbond-840: Fix missing pci_disable_device() in probe and remove
  * sctp: fix return value check in __sctp_rcv_asconf_lookup
      net/sctp/input.c
    net/mlx5: Fix flow table chaining
  * net: llc: fix skb_over_panic
      include/net/llc_pdu.h
    mlx4: Fix missing error code in mlx4_load_one()
  * tipc: fix sleeping in tipc accept routine
      net/tipc/socket.c
    i40e: Fix log TC creation failure when max num of queues is exceeded
    i40e: Fix logic of disabling queues
    netfilter: nft_nat: allow to specify layer 4 protocol NAT only
  * netfilter: conntrack: adjust stop timestamp to real expiry value
      net/netfilter/nf_conntrack_core.c
  * cfg80211: Fix possible memory leak in function cfg80211_bss_update
      net/wireless/scan.c
    nfc: nfcsim: fix use after free during module unload
    NIU: fix incorrect error return, missed in previous revert
    can: esd_usb2: fix memory leak
    can: ems_usb: fix memory leak
    can: usb_8dev: fix memory leak
    can: mcba_usb_start(): add missing urb->transfer_dma initialization
    can: raw: raw_setsockopt(): fix raw_rcv panic for sock UAF
    ocfs2: issue zeroout to EOF blocks
    ocfs2: fix zero out valid data
    x86/kvm: fix vcpu-id indexed array sizes
    btrfs: fix rw device counting in __btrfs_free_extra_devids
    x86/asm: Ensure asm/proto.h can be included stand-alone
  * gro: ensure frag0 meets IP header alignment
      include/linux/skbuff.h
      net/core/dev.c
  * virtio_net: Do not pull payload in skb->head
      include/linux/virtio_net.h
    Merge 4.19.200 into android-4.19-stable
Linux 4.19.200
    ARM: dts: versatile: Fix up interrupt controller node names
    cifs: fix the out of range assignment to bit fields in parse_server_interfaces
    firmware: arm_scmi: Fix range check for the maximum number of pending messages
    firmware: arm_scmi: Fix possible scmi_linux_errmap buffer overflow
    hfs: add lock nesting notation to hfs_find_init
    hfs: fix high memory mapping in hfs_bnode_read
    hfs: add missing clean-up in hfs_fill_super
  * sctp: move 198 addresses from unusable to private scope
      include/net/sctp/constants.h
      net/sctp/protocol.c
  * net: annotate data race around sk_ll_usec
      include/net/busy_poll.h
      net/core/sock.c
    net/802/garp: fix memleak in garp_request_join()
    net/802/mrp: fix memleak in mrp_request_join()
  * workqueue: fix UAF in pwq_unbound_release_workfn()
      kernel/workqueue.c
  * af_unix: fix garbage collect vs MSG_PEEK
      net/unix/af_unix.c
  * net: split out functions related to registering inflight socket files
      include/net/af_unix.h
      net/Makefile
      net/unix/Kconfig
      net/unix/Makefile
      net/unix/af_unix.c
      net/unix/garbage.c
      net/unix/scm.c
      net/unix/scm.h
    KVM: x86: determine if an exception has an error code only when injecting it.
    iio: dac: ds4422/ds4424 drop of_node check
    selftest: fix build error in tools/testing/selftests/vm/userfaultfd.c
  * ANDROID: staging: ion: move buffer kmap from begin/end_cpu_access()
      drivers/staging/android/ion/ion.c
    Merge 4.19.199 into android-4.19-stable
Linux 4.19.199
  * xhci: add xhci_get_virt_ep() helper
      drivers/usb/host/xhci-ring.c
      drivers/usb/host/xhci.h
    spi: spi-fsl-dspi: Fix a resource leak in an error handling path
  * PCI: Mark AMD Navi14 GPU ATS as broken
      drivers/pci/quirks.c
    btrfs: compression: don't try to compress if we don't have enough pages
    iio: accel: bma180: Fix BMA25x bandwidth register values
    iio: accel: bma180: Use explicit member assignment
    net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear
    net: dsa: mv88e6xxx: use correct .stats_set_histogram() on Topaz
    KVM: Use kvm_pfn_t for local PFN variable in hva_to_pfn_remapped()
    KVM: do not allow mapping valid but non-reference-counted pages
    KVM: do not assume PTE is writable after follow_pfn
  * drm: Return -ENOTTY for non-drm ioctls
      drivers/gpu/drm/drm_ioctl.c
      include/drm/drm_ioctl.h
    nds32: fix up stack guard gap
    selftest: use mmap instead of posix_memalign to allocate memory
    ixgbe: Fix packet corruption due to missing DMA sync
    media: ngene: Fix out-of-bounds bug in ngene_command_config_free_buf()
  * tracing: Fix bug in rb_per_cpu_empty() that might cause deadloop.
      kernel/trace/ring_buffer.c
    usb: dwc2: gadget: Fix sending zero length packet in DDMA mode.
    USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick
    USB: serial: cp210x: fix comments for GE CS1000
    USB: serial: option: add support for u-blox LARA-R6 family
    usb: renesas_usbhs: Fix superfluous irqs happen after usb_pkt_pop()
    usb: max-3421: Prevent corruption of freed memory
    USB: usb-storage: Add LaCie Rugged USB3-FW to IGNORE_UAS
  * usb: hub: Fix link power management max exit latency (MEL) calculations
      drivers/usb/core/hub.c
  * usb: hub: Disable USB 3 device initiated lpm if exit latency is too high
      drivers/usb/core/hub.c
    KVM: PPC: Book3S: Fix H_RTAS rets buffer overflow
  * xhci: Fix lost USB 2 remote wake
      drivers/usb/host/xhci-hub.c
    ALSA: sb: Fix potential ABBA deadlock in CSP driver
  * ALSA: usb-audio: Add registration quirk for JBL Quantum headsets
      sound/usb/quirks.c
    s390/ftrace: fix ftrace_update_ftrace_func implementation
    Revert "MIPS: add PMD table accounting into MIPS'pmd_alloc_one"
  * proc: Avoid mixing integer types in mem_rw()
      fs/proc/base.c
    drm/panel: raspberrypi-touchscreen: Prevent double-free
  * net: sched: cls_api: Fix the the wrong parameter
      net/sched/cls_api.c
  * sctp: update active_key for asoc when old key is being replaced
      net/sctp/auth.c
  * Revert "USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem"
      drivers/usb/core/quirks.c
    nvme-pci: don't WARN_ON in nvme_reset_work if ctrl.state is not RESETTING
    net/sched: act_skbmod: Skip non-Ethernet packets
  * net/tcp_fastopen: fix data races around tfo_active_disable_stamp
      net/ipv4/tcp_fastopen.c
    spi: cadence: Correct initialisation of runtime PM again
    scsi: target: Fix protect handling in WRITE SAME(32)
    scsi: iscsi: Fix iface sysfs attr detection
    netrom: Decrease sock refcount when sock timers expire
    KVM: PPC: Fix kvm_arch_vcpu_ioctl vcpu_load leak
    net: decnet: Fix sleeping inside in af_decnet
    net: fix uninit-value in caif_seqpkt_sendmsg
    bpftool: Check malloc return value in mount_bpffs_for_pin
    s390/bpf: Perform r1 range checking before accessing jit->seen_reg[r1]
    liquidio: Fix unintentional sign extension issue on left shift of u16
    spi: mediatek: fix fifo rx mode
    perf probe-file: Delete namelist in del_events() on the error path
    perf test bpf: Free obj_buf
    perf lzma: Close lzma stream on exit
    perf dso: Fix memory leak in dso__new_map()
    perf probe: Fix dso->nsinfo refcounting
    perf map: Fix dso->nsinfo refcounting
    nvme-pci: do not call nvme_dev_remove_admin from nvme_remove
  * ipv6: fix 'disable_policy' for fwd packets
      net/ipv6/ip6_output.c
    igb: Fix position of assignment to *ring
    igb: Check if num of q_vectors is smaller than max before array access
    iavf: Fix an error handling path in 'iavf_probe()'
    e1000e: Fix an error handling path in 'e1000_probe()'
    fm10k: Fix an error handling path in 'fm10k_probe()'
    igb: Fix an error handling path in 'igb_probe()'
    ixgbe: Fix an error handling path in 'ixgbe_probe()'
    igb: Fix use-after-free error during reset
  * net: ip_tunnel: fix mtu calculation for ETHER tunnel devices
      net/ipv4/ip_tunnel.c
  * udp: annotate data races around unix_sk(sk)->gso_size
      net/ipv4/udp.c
      net/ipv6/udp.c
    bpftool: Properly close va_list 'ap' by va_end() on error
  * ipv6: tcp: drop silly ICMPv6 packet too big messages
      net/ipv4/tcp_output.c
      net/ipv6/tcp_ipv6.c
  * tcp: annotate data races around tp->mtu_info
      net/ipv4/tcp_ipv4.c
      net/ipv6/tcp_ipv6.c
  * dma-buf/sync_file: Don't leak fences on merge failure
      drivers/dma-buf/sync_file.c
  * net: validate lwtstate->data before returning from skb_tunnel_info()
      include/net/dst_metadata.h
  * net: send SYNACK packet with accepted fwmark
      net/ipv6/tcp_ipv6.c
    net: ti: fix UAF in tlan_remove_one
    net: qcom/emac: fix UAF in emac_remove
    net: moxa: fix UAF in moxart_mac_probe
    net: bcmgenet: Ensure all TX/RX queues DMAs are disabled
  * net: bridge: sync fdb to new unicast-filtering ports
      net/bridge/br_if.c
  * netfilter: ctnetlink: suspicious RCU usage in ctnetlink_dump_helpinfo
      net/netfilter/nf_conntrack_netlink.c
  * net: ipv6: fix return value of ip6_skb_dst_mtu
      include/net/ip6_route.h
      net/ipv6/xfrm6_output.c
    net: dsa: mv88e6xxx: enable .rmu_disable() on Topaz
    dm writecache: fix writing beyond end of underlying device when shrinking
    dm writecache: return the exact table values that were set
  * mm: slab: fix kmem_cache_create failed when sysfs node not destroyed
      mm/slab_common.c
  * sched/fair: Fix CFS bandwidth hrtimer expiry type
      kernel/sched/fair.c
    scsi: libfc: Fix array index out of bound exception
    scsi: libsas: Add LUN number check in .slave_alloc callback
    scsi: aic7xxx: Fix unintentional sign extension issue on left shift of u8
    rtc: max77686: Do not enforce (incorrect) interrupt trigger type
  * kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set
      scripts/mkcompile_h
  * thermal/core: Correct function name thermal_zone_device_unregister()
      drivers/thermal/thermal_core.c
    arm64: dts: ls208xa: remove bus-num from dspi node
    soc/tegra: fuse: Fix Tegra234-only builds
    ARM: dts: stm32: move stmmac axi config in ethernet node on stm32mp15
    ARM: dts: stm32: fix i2c node name on stm32f746 to prevent warnings
    ARM: dts: rockchip: fix supply properties in io-domains nodes
    arm64: dts: juno: Update SCPI nodes as per the YAML schema
    ARM: dts: stm32: fix timer nodes on STM32 MCU to prevent warnings
    ARM: dts: stm32: fix RCC node name on stm32f429 MCU
    ARM: dts: stm32: fix gpio-keys node on STM32 MCU boards
    rtc: mxc_v2: add missing MODULE_DEVICE_TABLE
    ARM: imx: pm-imx5: Fix references to imx5_cpu_suspend_info
    ARM: dts: imx6: phyFLEX: Fix UART hardware flow control
    ARM: dts: Hurricane 2: Fix NAND nodes names
    ARM: dts: BCM63xx: Fix NAND nodes names
    ARM: NSP: dts: fix NAND nodes names
    ARM: Cygnus: dts: fix NAND nodes names
    ARM: brcmstb: dts: fix NAND nodes names
    reset: ti-syscon: fix to_ti_syscon_reset_data macro
    arm64: dts: rockchip: Fix power-controller node names for rk3328
    ARM: dts: rockchip: Fix power-controller node names for rk3288
    ARM: dts: rockchip: Fix IOMMU nodes properties on rk322x
    ARM: dts: rockchip: Fix the timer clocks order
    arm64: dts: rockchip: fix pinctrl sleep nodename for rk3399.dtsi
    ARM: dts: rockchip: fix pinctrl sleep nodename for rk3036-kylin and rk3288
    ARM: dts: gemini: add device_type on pci
    ARM: dts: gemini: rename mdio to the right name
  * ANDROID: generate_initcall_order.pl: Use two dash long options for llvm-nm
      scripts/generate_initcall_order.pl
  * Revert "media: subdev: disallow ioctl for saa6588/davinci"
      include/media/v4l2-subdev.h
  * ANDROID: GKI: fix up crc change in ip.h
      include/net/ip.h
    Merge 4.19.198 into android-4.19-stable
Linux 4.19.198
  * seq_file: disallow extremely large seq buffer allocations
      fs/seq_file.c
    scsi: scsi_dh_alua: Fix signedness bug in alua_rtpg()
  * net: bridge: multicast: fix PIM hello router port marking race
      net/bridge/br_multicast.c
    MIPS: vdso: Invalid GIC access through VDSO
    mips: disable branch profiling in boot/decompress.o
    mips: always link byteswap helpers into decompressor
    scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe()
    ARM: dts: imx6q-dhcom: Add gpios pinctrl for i2c bus recovery
    ARM: dts: imx6q-dhcom: Fix ethernet plugin detection problems
    ARM: dts: imx6q-dhcom: Fix ethernet reset time properties
    ARM: dts: am437x: align ti,pindir-d0-out-d1-in property with dt-shema
    ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema
    memory: fsl_ifc: fix leak of private memory on probe failure
    memory: fsl_ifc: fix leak of IO mapping on probe failure
  * reset: bail if try_module_get() fails
      drivers/reset/core.c
    ARM: dts: BCM5301X: Fixup SPI binding
    ARM: dts: r8a7779, marzen: Fix DU clock names
    arm64: dts: renesas: v3msk: Fix memory size
  * rtc: fix snprintf() checking in is_rtc_hctosys()
      drivers/rtc/rtc-proc.c
    memory: atmel-ebi: add missing of_node_put for loop iteration
    ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4
    ARM: dts: exynos: fix PWM LED max brightness on Odroid HC1
    ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3
    reset: a10sr: add missing of_match_table reference
    hexagon: use common DISCARDS macro
    NFSv4/pNFS: Don't call _nfs4_pnfs_v3_ds_connect multiple times
    ALSA: isa: Fix error return code in snd_cmi8330_probe()
    virtio_net: move tx vq operation under tx queue lock
    x86/fpu: Limit xstate copy size in xstateregs_set()
    PCI: iproc: Support multi-MSI only on uniprocessor kernel
    PCI: iproc: Fix multi-MSI base vector number allocation
    ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode
    nfs: fix acl memory leak of posix_acl_create()
    watchdog: aspeed: fix hardware timeout calculation
    um: fix error return code in winch_tramp()
    um: fix error return code in slip_open()
    NFSv4: Initialise connection to the server in nfs4_alloc_client()
  * power: supply: rt5033_battery: Fix device tree enumeration
      drivers/power/supply/Kconfig
    PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun
  * f2fs: add MODULE_SOFTDEP to ensure crc32 is included in the initramfs
      fs/f2fs/super.c
    virtio_console: Assure used length from device is limited
    virtio_net: Fix error handling in virtnet_restore()
    virtio-blk: Fix memory leak among suspend/resume procedure
    ACPI: video: Add quirk for the Dell Vostro 3350
    ACPI: AMBA: Fix resource name in /proc/iomem
    pwm: tegra: Don't modify HW state in .remove callback
    power: supply: ab8500: add missing MODULE_DEVICE_TABLE
    power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
  * NFS: nfs_find_open_context() may only select open files
      include/linux/nfs_fs.h
    ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
    orangefs: fix orangefs df output.
    PCI: tegra: Add missing MODULE_DEVICE_TABLE
    x86/fpu: Return proper error codes from user access functions
    watchdog: iTCO_wdt: Account for rebooting on second timeout
    watchdog: Fix possible use-after-free by calling del_timer_sync()
    watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
    watchdog: Fix possible use-after-free in wdt_startup()
    ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
    power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
    power: supply: max17042: Do not enforce (incorrect) interrupt trigger type
    power: supply: ab8500: Avoid NULL pointers
    pwm: spear: Don't modify HW state in .remove callback
  * lib/decompress_unlz4.c: correctly handle zero-padding around initrds.
      lib/decompress_unlz4.c
  * i2c: core: Disable client irq on reboot/shutdown
      drivers/i2c/i2c-core-base.c
    intel_th: Wait until port is in reset before programming it
    staging: rtl8723bs: fix macro value for 2.4Ghz only device
    ALSA: hda: Add IRQ check for platform_get_irq()
    backlight: lm3630a: Fix return code of .update_status() callback
    powerpc/boot: Fixup device-tree on little endian
    usb: gadget: hid: fix error return code in hid_bind()
  * usb: gadget: f_hid: fix endianness issue with descriptors
      drivers/usb/gadget/function/f_hid.c
  * ALSA: bebob: add support for ToneWeal FW66
      sound/firewire/Kconfig
    Input: hideep - fix the uninitialized use in hideep_nvm_unlock()
  * ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
      sound/soc/soc-core.c
    gpio: pca953x: Add support for the On Semi pca9655
    selftests/powerpc: Fix "no_handler" EBB selftest
    ALSA: ppc: fix error return code in snd_pmac_probe()
    gpio: zynq: Check return value of pm_runtime_get_sync
    powerpc/ps3: Add dma_mask to ps3_dma_region
    ALSA: sb: Fix potential double-free of CSP mixer elements
    selftests: timers: rtcpie: skip test if default RTC device does not exist
    s390/sclp_vt220: fix console name to match device
    mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE
    scsi: qedi: Fix null ref during abort handling
    scsi: iscsi: Fix shost->max_id use
  * scsi: iscsi: Fix conn use after free during resets
      include/scsi/libiscsi.h
  * scsi: iscsi: Add iscsi_cls_conn refcount helpers
      include/scsi/scsi_transport_iscsi.h
    fs/jfs: Fix missing error code in lmLogInit()
    scsi: scsi_dh_alua: Check for negative result value
    tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
    ALSA: ac97: fix PM reference leak in ac97_bus_remove()
  * scsi: core: Cap scsi_host cmd_per_lun at can_queue
      drivers/scsi/hosts.c
    scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs
    scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
    w1: ds2438: fixing bug that would always get page0
  * Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"
      sound/firewire/Kconfig
    misc/libmasm/module: Fix two use after free in ibmasm_init_one
    tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero
    PCI: aardvark: Fix kernel panic during PIO transfer
    PCI: aardvark: Don't rely on jiffies while holding spinlock
    tracing: Do not reference char * as a string in histograms
  * scsi: core: Fix bad pointer dereference when ehandler kthread is invalid
      drivers/scsi/hosts.c
    KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
    KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
  * smackfs: restrict bytes count in smk_set_cipso()
      security/smack/smackfs.c
    jfs: fix GPF in diFree
    pinctrl: mcp23s08: Fix missing unlock on error in mcp23s08_irq()
    media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K
    media: gspca/sunplus: fix zero-length control requests
    media: gspca/sq905: fix control-request direction
    media: zr364xx: fix memory leak in zr364xx_start_readpipe
    media: dtv5100: fix control-request directions
  * media: subdev: disallow ioctl for saa6588/davinci
      include/media/v4l2-subdev.h
    PCI: aardvark: Fix checking for PIO Non-posted Request
  * PCI: Leave Apple Thunderbolt controllers on for s2idle or standby
      drivers/pci/quirks.c
    dm btree remove: assign new_root only when removal succeeds
  * coresight: tmc-etf: Fix global-out-of-bounds in tmc_update_etf_buffer()
      drivers/hwtracing/coresight/coresight-tmc-etf.c
    ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
  * tracing: Resize tgid_map to pid_max, not PID_MAX_DEFAULT
      kernel/trace/trace.c
  * tracing: Simplify & fix saved_tgids logic
      kernel/trace/trace.c
  * seq_buf: Fix overflow in seq_buf_putmem_hex()
      lib/seq_buf.c
  * power: supply: ab8500: Fix an old bug
      include/linux/mfd/abx500/ux500_chargalg.h
    ipmi/watchdog: Stop watchdog timer when the current action is 'none'
    qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
    ASoC: tegra: Set driver_name=tegra for all machine drivers
  * clocksource/arm_arch_timer: Improve Allwinner A64 timer workaround
      drivers/clocksource/arm_arch_timer.c
  * cpu/hotplug: Cure the cpusets trainwreck
      kernel/cpu.c
    ata: ahci_sunxi: Disable DIPM
    mmc: core: Allow UHS-I voltage switch for SDSC cards if supported
    mmc: core: clear flags before allowing to retune
    mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
    drm/msm/mdp4: Fix modifier support enabling
    pinctrl/amd: Add device HID for new AMD GPIO controller
    drm/amd/display: fix incorrrect valid irq check
    drm/radeon: Add the missed drm_gem_object_put() in radeon_user_framebuffer_create()
  * usb: gadget: f_fs: Fix setting of device and driver data cross-references
      drivers/usb/gadget/function/f_fs.c
    powerpc/barrier: Avoid collision with clang's __lwsync macro
  * fuse: reject internal errno
      fs/fuse/dev.c
    serial: mvebu-uart: fix calculation of clock divisor
    serial: mvebu-uart: clarify the baud rate derivation
  * bdi: Do not use freezable workqueue
      mm/backing-dev.c
  * fscrypt: don't ignore minor_hash when hash is 0
      fs/crypto/fname.c
    MIPS: set mips32r5 for virt extensions
  * sctp: add size validation when walking chunks
      net/sctp/input.c
  * sctp: validate from_addr_param return
      include/net/sctp/structs.h
      net/sctp/bind_addr.c
      net/sctp/input.c
      net/sctp/ipv6.c
      net/sctp/protocol.c
      net/sctp/sm_make_chunk.c
    Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.
  * Bluetooth: Shutdown controller after workqueues are flushed or cancelled
      net/bluetooth/hci_core.c
  * Bluetooth: Fix the HCI to MGMT status conversion table
      net/bluetooth/mgmt.c
    RDMA/cma: Fix rdma_resolve_route() memory leak
  * net: ip: avoid OOM kills with large UDP sends over loopback
      net/ipv4/ip_output.c
      net/ipv6/ip6_output.c
    media, bpf: Do not copy more entries than user space requested
  * wireless: wext-spy: Fix out-of-bounds warning
      net/wireless/wext-spy.c
    sfc: error code if SRIOV cannot be disabled
    sfc: avoid double pci_remove of VFs
    iwlwifi: pcie: free IML DMA memory allocation
    iwlwifi: mvm: don't change band on bound PHY contexts
    RDMA/rxe: Don't overwrite errno from ib_umem_get()
    vsock: notify server to shutdown when client has pending signal
    atm: nicstar: register the interrupt handler in the right place
    atm: nicstar: use 'dma_free_coherent' instead of 'kfree'
    MIPS: add PMD table accounting into MIPS'pmd_alloc_one
    rtl8xxxu: Fix device info for RTL8192EU devices
  * net: fix mistake path for netdev_features_strings
      include/linux/netdev_features.h
      include/uapi/linux/ethtool.h
    cw1200: add missing MODULE_DEVICE_TABLE
    wl1251: Fix possible buffer overflow in wl1251_cmd_scan
    wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP
  * xfrm: Fix error reporting in xfrm_state_construct.
      net/xfrm/xfrm_user.c
  * selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC
      security/selinux/avc.c
    fjes: check return value after calling platform_get_resource()
    net: micrel: check return value after calling platform_get_resource()
    net: mvpp2: check return value after calling platform_get_resource()
    net: bcmgenet: check return value after calling platform_get_resource()
    virtio_net: Remove BUG() to avoid machine dead
    ice: set the value of global config lock timeout longer
    pinctrl: mcp23s08: fix race condition in irq handler
    dm space maps: don't reset space map allocation cursor when committing
    RDMA/cxgb4: Fix missing error code in create_qp()
  * ipv6: use prandom_u32() for ID generation
      net/ipv6/output_core.c
    clk: tegra: Ensure that PLLU configuration is applied properly
    clk: renesas: r8a77995: Add ZA2 clock
    e100: handle eeprom as little endian
    udf: Fix NULL pointer dereference in udf_symlink function
    drm/virtio: Fix double free on probe failure
    reiserfs: add check for invalid 1st journal block
  * net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT
      net/core/dev.c
    atm: nicstar: Fix possible use-after-free in nicstar_cleanup()
    mISDN: fix possible use-after-free in HFC_cleanup()
    atm: iphase: fix possible use-after-free in ia_module_exit()
    hugetlb: clear huge pte during flush function on mips platform
    drm/amd/display: fix use_max_lb flag for 420 pixel formats
    net: pch_gbe: Use proper accessors to BE data in pch_ptp_match()
    drm/amd/amdgpu/sriov disable all ip hw status by default
  * drm/zte: Don't select DRM_KMS_FB_HELPER
      drivers/gpu/drm/zte/Kconfig
  * drm/mxsfb: Don't select DRM_KMS_FB_HELPER
      drivers/gpu/drm/mxsfb/Kconfig
    mmc: vub3000: fix control-request direction
    mmc: block: Disable CMDQ on the ioctl path
    perf llvm: Return -ENOMEM when asprintf() fails
    selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
    mm/huge_memory.c: don't discard hugepage if other processes are mapping it
    vfio/pci: Handle concurrent vma faults
    arm64: dts: marvell: armada-37xx: Fix reg for standard variant of UART
    serial: mvebu-uart: correctly calculate minimal possible baudrate
    powerpc: Offline CPU in stop_this_cpu()
    leds: ktd2692: Fix an error handling path
    leds: as3645a: Fix error return code in as3645a_parse_node()
  * configfs: fix memleak in configfs_release_bin_file
      fs/configfs/file.c
    ASoC: atmel-i2s: Fix usage of capture and playback at the same time
    extcon: max8997: Add missing modalias string
    extcon: sm5502: Drop invalid register write in sm5502_reg_data
    phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
    scsi: mpt3sas: Fix error return value in _scsih_expander_add()
    mtd: rawnand: marvell: add missing clk_disable_unprepare() on error in marvell_nfc_resume()
  * of: Fix truncation of memory sizes on 32-bit platforms
      drivers/of/fdt.c
      drivers/of/of_reserved_mem.c
    ASoC: cs42l42: Correct definition of CS42L42_ADC_PDN_MASK
    iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    serial: 8250: Actually allow UPF_MAGIC_MULTIPLIER baud rates
    staging: mt7621-dts: fix pci address for PCI memory range
    staging: gdm724x: check for overflow in gdm_lte_netif_rx()
    staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
    iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
    iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    eeprom: idt_89hpesx: Restore printing the unsupported fwnode name
    eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()
    s390: appldata depends on PROC_SYSCTL
    visorbus: fix error return code in visorchipset_init()
    fsi/sbefifo: Fix reset timeout
    fsi/sbefifo: Clean up correct FIFO when receiving reset request from SBE
    fsi: scom: Reset the FSI2PIB engine for any error
    fsi: core: Fix return of error values on failures
    scsi: FlashPoint: Rename si_flags field
    tty: nozomi: Fix the error handling path of 'nozomi_card_init()'
    char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol()
    Input: hil_kbd - fix error return code in hil_dev_connect()
    ASoC: rsnd: tidyup loop on rsnd_adg_clk_query()
    ASoC: hisilicon: fix missing clk_disable_unprepare() on error in hi6210_i2s_startup()
    iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
    iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
    iio: adis_buffer: do not return ints in irq handlers
    mwifiex: re-fix for unaligned accesses
    tty: nozomi: Fix a resource leak in an error handling function
    RDMA/mlx5: Don't access NULL-cleared mpi pointer
    net: sched: fix warning in tcindex_alloc_perfect_hash
  * net: lwtunnel: handle MTU calculation in forwading
      include/net/ip.h
      include/net/ip6_route.h
      net/ipv4/route.c
  * writeback: fix obtain a reference to a freeing memcg css
      fs/fs-writeback.c
  * Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event
      net/bluetooth/hci_event.c
  * Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
      net/bluetooth/mgmt.c
  * ipv6: fix out-of-bound access in ip6_parse_tlv()
      net/ipv6/exthdrs.c
    ibmvnic: free tx_pool if tso_pool alloc fails
    Revert "ibmvnic: remove duplicate napi_schedule call in open function"
    i40e: Fix autoneg disabling for non-10GBaseT links
    i40e: Fix error handling in i40e_vsi_open
  * bpf: Do not change gso_size during bpf_skb_change_proto()
      net/core/filter.c
  * ipv6: exthdrs: do not blindly use init_net
      net/ipv6/exthdrs.c
    net: bcmgenet: Fix attaching to PYH failed on RPi 4B
    mac80211: remove iwlwifi specific workaround NDPs of null_response
    ieee802154: hwsim: avoid possible crash in hwsim_del_edge_nl()
    ieee802154: hwsim: Fix memory leak in hwsim_add_one
  * net/ipv4: swap flow ports when validating source
      net/ipv4/fib_frontend.c
    vxlan: add missing rcu_read_lock() in neigh_reduce()
    pkt_sched: sch_qfq: fix qfq_change_class() error path
    net: ethernet: ezchip: fix error handling
    net: ethernet: ezchip: fix UAF in nps_enet_remove
    net: ethernet: aeroflex: fix UAF in greth_of_remove
    samples/bpf: Fix the error return code of xdp_redirect's main()
    RDMA/rxe: Fix qp reference counting for atomic ops
    netfilter: nft_tproxy: restrict support to TCP and UDP transport protocols
    netfilter: nft_osf: check for TCP packet before further processing
    netfilter: nft_exthdr: check for IPv6 packet before further processing
    RDMA/mlx5: Don't add slave port to unaffiliated list
  * netlabel: Fix memory leak in netlbl_mgmt_add_common
      net/netlabel/netlabel_mgmt.c
    ath10k: Fix an error code in ath10k_add_interface()
    brcmsmac: mac80211_if: Fix a resource leak in an error handling path
    brcmfmac: correctly report average RSSI in station info
    brcmfmac: fix setting of station info chains bitmask
    ssb: Fix error return code in ssb_bus_scan()
    wcn36xx: Move hal_buf allocation to devm_kmalloc in probe
    ieee802154: hwsim: Fix possible memory leak in hwsim_subscribe_all_others
  * wireless: carl9170: fix LEDS build errors & warnings
      drivers/net/wireless/ath/carl9170/Kconfig
    tools/bpftool: Fix error return code in do_batch()
    drm: qxl: ensure surf.data is ininitialized
    RDMA/rxe: Fix failure during driver load
    ehea: fix error return code in ehea_restart_qps()
    drm/rockchip: cdn-dp-core: add missing clk_disable_unprepare() on error in cdn_dp_grf_write()
    net: pch_gbe: Propagate error from devm_gpio_request_one()
    net: mvpp2: Put fwnode in error case during ->probe()
    ocfs2: fix snprintf() checking
    blk-wbt: make sure throttle is enabled properly
  * blk-wbt: introduce a new disable state to prevent false positive by rwb_enabled()
      block/blk-wbt.h
    ACPI: sysfs: Fix a buffer overrun problem with description_show()
    crypto: nx - Fix RCU warning in nx842_OF_upd_status
    spi: spi-sun6i: Fix chipselect/clock bug
    btrfs: clear log tree recovering status if starting transaction fails
    hwmon: (max31790) Fix fan speed reporting for fan7..12
    hwmon: (max31722) Remove non-standard ACPI device IDs
    media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
    mmc: usdhi6rol0: fix error return code in usdhi6_probe()
    media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
    media: gspca/gl860: fix zero-length control requests
    media: tc358743: Fix error return code in tc358743_probe_of()
    media: exynos4-is: Fix a use after free in isp_video_release
    pata_ep93xx: fix deferred probing
    media: rc: i2c: Fix an error message
    crypto: ccp - Fix a resource leak in an error handling path
    evm: fix writing <securityfs>/evm overflow
    pata_octeon_cf: avoid WARN_ON() in ata_host_activate()
    media: I2C: change 'RST' to "RSET" to fix multiple build errors
    pata_rb532_cf: fix deferred probing
    sata_highbank: fix deferred probing
    crypto: ux500 - Fix error return code in hash_hw_final()
    crypto: ixp4xx - dma_unmap the correct address
    media: s5p_cec: decrement usage count if disabled
    ia64: mca_drv: fix incorrect array size calculation
    HID: wacom: Correct base usage for capacitive ExpressKey status bits
    ACPI: tables: Add custom DSDT file as makefile prerequisite
  * clocksource: Retry clock read if long delays detected
      kernel/time/clocksource.c
    platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()
    ACPI: bus: Call kobject_put() in acpi_init() error path
    ACPICA: Fix memory leak caused by _CID repair function
    fs: dlm: fix memory leak when fenced
  * random32: Fix implicit truncation warning in prandom_seed_state()
      include/linux/prandom.h
    fs: dlm: cancel work sync othercon
  * block_dump: remove block_dump feature in mark_inode_dirty()
      fs/fs-writeback.c
    ACPI: EC: Make more Asus laptops use ECDT _GPE
  * lib: vsprintf: Fix handling of number field widths in vsscanf
      lib/kstrtox.c
      lib/kstrtox.h
      lib/vsprintf.c
    hv_utils: Fix passing zero to 'PTR_ERR' warning
    ACPI: processor idle: Fix up C-state latency if not ordered
    EDAC/ti: Add missing MODULE_DEVICE_TABLE
  * HID: do not use down_interruptible() when unbinding devices
      drivers/hid/hid-core.c
    regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
  * btrfs: disable build on platforms having page size 256K
      fs/btrfs/Kconfig
    btrfs: abort transaction if we fail to update the delayed inode
    btrfs: fix error handling in __btrfs_update_delayed_inode
    media: imx-csi: Skip first few frames from a BT.656 source
    media: siano: fix device register error path
    media: dvb_net: avoid speculation from net slot
  * crypto: shash - avoid comparing pointers to exported functions under CFI
      crypto/shash.c
      include/crypto/internal/hash.h
    mmc: via-sdmmc: add a check against NULL pointer dereference
    media: dvd_usb: memory leak in cinergyt2_fe_attach
    media: st-hva: Fix potential NULL pointer dereferences
    media: bt8xx: Fix a missing check bug in bt878_probe
  * media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
      drivers/media/v4l2-core/v4l2-fh.c
    media: em28xx: Fix possible memory leak of em28xx struct
  * sched/fair: Fix ascii art by relpacing tabs
      kernel/sched/fair.c
    crypto: qat - remove unused macro in FW loader
    crypto: qat - check return code of qat_hal_rd_rel_reg()
    media: pvrusb2: fix warning in pvr2_i2c_core_done
    media: cobalt: fix race condition in setting HPD
    media: cpia2: fix memory leak in cpia2_usb_probe
    crypto: nx - add missing MODULE_DEVICE_TABLE
    regulator: uniphier: Add missing MODULE_DEVICE_TABLE
    spi: omap-100k: Fix the length judgment problem
    spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()
    spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf'
  * spi: Make of_register_spi_device also set the fwnode
      drivers/spi/spi.c
  * fuse: check connected before queueing on fpq->io
      fs/fuse/dev.c
    evm: Refuse EVM_ALLOW_METADATA_WRITES only if an HMAC key is loaded
    evm: Execute evm_inode_init_security() only when an HMAC key is loaded
    powerpc/stacktrace: Fix spurious "stale" traces in raise_backtrace_ipi()
  * seq_buf: Make trace_seq_putmem_hex() support data longer than 8
      lib/seq_buf.c
  * tracepoint: Add tracepoint_probe_register_may_exist() for BPF tracing
      include/linux/tracepoint.h
      kernel/trace/bpf_trace.c
      kernel/tracepoint.c
    tracing/histograms: Fix parsing of "sym-offset" modifier
    rsi: fix AP mode with WPA failure due to encrypted EAPOL
    rsi: Assign beacon rate settings to the correct rate_info descriptor field
    ssb: sdio: Don't overwrite const buffer if block_write fails
    ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()
    serial_cs: remove wrong GLOBETROTTER.cis entry
    serial_cs: Add Option International GSM-Ready 56K/ISDN modem
    serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()
    iio: ltr501: ltr501_read_ps(): add missing endianness conversion
    iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
    iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
    iio: light: tcs3472: do not free unallocated IRQ
    rtc: stm32: Fix unbalanced clk_disable_unprepare() on probe error path
    s390/cio: dont call css_wait_for_slow_path() inside a lock
    SUNRPC: Should wake up the privileged task firstly.
    SUNRPC: Fix the batch tasks count wraparound.
    can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path
    can: gw: synchronize rcu operations before removing gw job entry
    can: bcm: delay release of struct bcm_op after synchronize_rcu()
  * ext4: use ext4_grp_locked_error in mb_find_extent
      fs/ext4/mballoc.c
  * ext4: fix avefreec in find_group_orlov
      fs/ext4/ialloc.c
  * ext4: remove check for zero nr_to_scan in ext4_es_scan()
      fs/ext4/extents_status.c
  * ext4: correct the cache_nr in tracepoint ext4_es_shrink_exit
      fs/ext4/extents_status.c
  * ext4: return error code when ext4_fill_flex_info() fails
      fs/ext4/super.c
  * ext4: fix kernel infoleak via ext4_extent_header
      fs/ext4/extents.c
  * ext4: cleanup in-core orphan list if ext4_truncate() failed to get a transaction handle
      fs/ext4/super.c
    btrfs: clear defrag status of a root if starting transaction fails
    btrfs: send: fix invalid path for unlink operations after parent orphanization
    ARM: dts: at91: sama5d4: fix pinctrl muxing
    arm_pmu: Fix write counter incorrect in ARMv7 big-endian mode
    Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
  * iov_iter_fault_in_readable() should do nothing in xarray case
      lib/iov_iter.c
    ntfs: fix validity check for file name attribute
  * xhci: solve a double free problem while doing s4
      drivers/usb/host/xhci-mem.c
  * usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()
      drivers/usb/typec/class.c
  * usb: dwc3: Fix debugfs creation flow
      drivers/usb/dwc3/core.c
    USB: cdc-acm: blacklist Heimann USB Appset device
    usb: gadget: eem: fix echo command packet response issue
    net: can: ems_usb: fix use-after-free in ems_usb_disconnect()
    Input: usbtouchscreen - fix control-request directions
    media: dvb-usb: fix wrong definition
  * ALSA: usb-audio: Fix OOB access at proc output
      sound/usb/mixer.c
  * ALSA: usb-audio: fix rate on Ozone Z90 USB headset
      sound/usb/format.c
  * scsi: core: Retry I/O for Notify (Enable Spinup) Required error
      drivers/scsi/scsi_lib.c
  * Revert "clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940"
      include/linux/cpuhotplug.h
    Merge 4.19.197 into android-4.19-stable
Linux 4.19.197
  * clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940
      include/linux/cpuhotplug.h
    clocksource/drivers/timer-ti-dm: Prepare to handle dra7 timer wrap issue
    clocksource/drivers/timer-ti-dm: Add clockevent and clocksource support
    ARM: OMAP: replace setup_irq() by request_irq()
    KVM: SVM: Call SEV Guest Decommission if ASID binding fails
    xen/events: reset active flag for lateeoi events later
  * kthread: prevent deadlock when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync()
      kernel/kthread.c
  * kthread_worker: split code for canceling the delayed work timer
      kernel/kthread.c
    ARM: dts: imx6qdl-sabresd: Remove incorrect power supply assignment
    KVM: SVM: Periodically schedule when unregistering regions on destroy
  * ext4: eliminate bogus error in ext4_data_block_valid_rcu()
      fs/ext4/block_validity.c
    drm/nouveau: fix dma_address check for CPU/GPU sync
    scsi: sr: Return appropriate error code when disk is ejected
  * mm, futex: fix shared futex pgoff on shmem huge page
      include/linux/hugetlb.h
      include/linux/pagemap.h
      kernel/futex.c
  * mm/thp: another PVMW_SYNC fix in page_vma_mapped_walk()
      mm/page_vma_mapped.c
  * mm/thp: fix page_vma_mapped_walk() if THP mapped by ptes
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): get vma_address_end() earlier
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): use goto instead of while (1)
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): add a level of indentation
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): crossing page table boundary
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): prettify PVMW_MIGRATION block
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): use pmde for *pvmw->pmd
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): settle PageHuge on entry
      mm/page_vma_mapped.c
  * mm: page_vma_mapped_walk(): use page for pvmw->page
      mm/page_vma_mapped.c
    mm: thp: replace DEBUG_VM BUG with VM_WARN when unmap fails for split
  * mm/thp: unmap_mapping_page() to fix THP truncate_cleanup_page()
      include/linux/mm.h
      mm/memory.c
      mm/truncate.c
  * mm/thp: fix page_address_in_vma() on file THP tails
      mm/rmap.c
  * mm/thp: fix vma_address() if virtual address below file offset
      mm/internal.h
      mm/page_vma_mapped.c
      mm/rmap.c
  * mm/thp: try_to_unmap() use TTU_SYNC for safe splitting
      include/linux/rmap.h
      mm/page_vma_mapped.c
      mm/rmap.c
  * mm/thp: make is_huge_zero_pmd() safe and quicker
      include/linux/huge_mm.h
  * mm/thp: fix __split_huge_pmd_locked() on shmem migration entry
      mm/pgtable-generic.c
  * mm/rmap: use page_not_mapped in try_to_unmap()
      mm/rmap.c
  * mm/rmap: remove unneeded semicolon in page_not_mapped()
      mm/rmap.c
  * mm: add VM_WARN_ON_ONCE_PAGE() macro
      include/linux/mmdebug.h

Bug: 196282886
Change-Id: I0af3abfa9aaa6da3e884f1a692da381e8e140bee
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-08-18 20:48:52 +08:00

1315 lines
36 KiB
C

/*
* linux/kernel/time/clocksource.c
*
* This file contains the functions which manage clocksource drivers.
*
* Copyright (C) 2004, 2005 IBM, John Stultz (johnstul@us.ibm.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* TODO WishList:
* o Allow clocksource drivers to be unregistered
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/device.h>
#include <linux/clocksource.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */
#include <linux/tick.h>
#include <linux/kthread.h>
#include "tick-internal.h"
#include "timekeeping_internal.h"
/**
* clocks_calc_mult_shift - calculate mult/shift factors for scaled math of clocks
* @mult: pointer to mult variable
* @shift: pointer to shift variable
* @from: frequency to convert from
* @to: frequency to convert to
* @maxsec: guaranteed runtime conversion range in seconds
*
* The function evaluates the shift/mult pair for the scaled math
* operations of clocksources and clockevents.
*
* @to and @from are frequency values in HZ. For clock sources @to is
* NSEC_PER_SEC == 1GHz and @from is the counter frequency. For clock
* event @to is the counter frequency and @from is NSEC_PER_SEC.
*
* The @maxsec conversion range argument controls the time frame in
* seconds which must be covered by the runtime conversion with the
* calculated mult and shift factors. This guarantees that no 64bit
* overflow happens when the input value of the conversion is
* multiplied with the calculated mult factor. Larger ranges may
* reduce the conversion accuracy by chosing smaller mult and shift
* factors.
*/
void
clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 maxsec)
{
u64 tmp;
u32 sft, sftacc= 32;
/*
* Calculate the shift factor which is limiting the conversion
* range:
*/
tmp = ((u64)maxsec * from) >> 32;
while (tmp) {
tmp >>=1;
sftacc--;
}
/*
* Find the conversion shift/mult pair which has the best
* accuracy and fits the maxsec conversion range:
*/
for (sft = 32; sft > 0; sft--) {
tmp = (u64) to << sft;
tmp += from / 2;
do_div(tmp, from);
if ((tmp >> sftacc) == 0)
break;
}
*mult = tmp;
*shift = sft;
}
EXPORT_SYMBOL_GPL(clocks_calc_mult_shift);
/*[Clocksource internal variables]---------
* curr_clocksource:
* currently selected clocksource.
* suspend_clocksource:
* used to calculate the suspend time.
* clocksource_list:
* linked list with the registered clocksources
* clocksource_mutex:
* protects manipulations to curr_clocksource and the clocksource_list
* override_name:
* Name of the user-specified clocksource.
*/
static struct clocksource *curr_clocksource;
static struct clocksource *suspend_clocksource;
static LIST_HEAD(clocksource_list);
static DEFINE_MUTEX(clocksource_mutex);
static char override_name[CS_NAME_LEN];
static int finished_booting;
static u64 suspend_start;
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
static void clocksource_watchdog_work(struct work_struct *work);
static void clocksource_select(bool force);
static LIST_HEAD(watchdog_list);
static struct clocksource *watchdog;
static struct timer_list watchdog_timer;
static DECLARE_WORK(watchdog_work, clocksource_watchdog_work);
static DEFINE_SPINLOCK(watchdog_lock);
static int watchdog_running;
static atomic_t watchdog_reset_pending;
static void inline clocksource_watchdog_lock(unsigned long *flags)
{
spin_lock_irqsave(&watchdog_lock, *flags);
}
static void inline clocksource_watchdog_unlock(unsigned long *flags)
{
spin_unlock_irqrestore(&watchdog_lock, *flags);
}
static int clocksource_watchdog_kthread(void *data);
static void __clocksource_change_rating(struct clocksource *cs, int rating);
/*
* Interval: 0.5sec Threshold: 0.0625s
*/
#define WATCHDOG_INTERVAL (HZ >> 1)
#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4)
/*
* Maximum permissible delay between two readouts of the watchdog
* clocksource surrounding a read of the clocksource being validated.
* This delay could be due to SMIs, NMIs, or to VCPU preemptions.
*/
#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC)
static void clocksource_watchdog_work(struct work_struct *work)
{
/*
* We cannot directly run clocksource_watchdog_kthread() here, because
* clocksource_select() calls timekeeping_notify() which uses
* stop_machine(). One cannot use stop_machine() from a workqueue() due
* lock inversions wrt CPU hotplug.
*
* Also, we only ever run this work once or twice during the lifetime
* of the kernel, so there is no point in creating a more permanent
* kthread for this.
*
* If kthread_run fails the next watchdog scan over the
* watchdog_list will find the unstable clock again.
*/
kthread_run(clocksource_watchdog_kthread, NULL, "kwatchdog");
}
static void __clocksource_unstable(struct clocksource *cs)
{
cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG);
cs->flags |= CLOCK_SOURCE_UNSTABLE;
/*
* If the clocksource is registered clocksource_watchdog_kthread() will
* re-rate and re-select.
*/
if (list_empty(&cs->list)) {
cs->rating = 0;
return;
}
if (cs->mark_unstable)
cs->mark_unstable(cs);
/* kick clocksource_watchdog_kthread() */
if (finished_booting)
schedule_work(&watchdog_work);
}
/**
* clocksource_mark_unstable - mark clocksource unstable via watchdog
* @cs: clocksource to be marked unstable
*
* This function is called by the x86 TSC code to mark clocksources as unstable;
* it defers demotion and re-selection to a kthread.
*/
void clocksource_mark_unstable(struct clocksource *cs)
{
unsigned long flags;
spin_lock_irqsave(&watchdog_lock, flags);
if (!(cs->flags & CLOCK_SOURCE_UNSTABLE)) {
if (!list_empty(&cs->list) && list_empty(&cs->wd_list))
list_add(&cs->wd_list, &watchdog_list);
__clocksource_unstable(cs);
}
spin_unlock_irqrestore(&watchdog_lock, flags);
}
static ulong max_cswd_read_retries = 3;
module_param(max_cswd_read_retries, ulong, 0644);
static bool cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow)
{
unsigned int nretries;
u64 wd_end, wd_delta;
int64_t wd_delay;
for (nretries = 0; nretries <= max_cswd_read_retries; nretries++) {
local_irq_disable();
*wdnow = watchdog->read(watchdog);
*csnow = cs->read(cs);
wd_end = watchdog->read(watchdog);
local_irq_enable();
wd_delta = clocksource_delta(wd_end, *wdnow, watchdog->mask);
wd_delay = clocksource_cyc2ns(wd_delta, watchdog->mult,
watchdog->shift);
if (wd_delay <= WATCHDOG_MAX_SKEW) {
if (nretries > 1 || nretries >= max_cswd_read_retries) {
pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n",
smp_processor_id(), watchdog->name, nretries);
}
return true;
}
}
pr_warn("timekeeping watchdog on CPU%d: %s read-back delay of %lldns, attempt %d, marking unstable\n",
smp_processor_id(), watchdog->name, wd_delay, nretries);
return false;
}
static void clocksource_watchdog(struct timer_list *unused)
{
u64 csnow, wdnow, cslast, wdlast, delta;
int next_cpu, reset_pending;
int64_t wd_nsec, cs_nsec;
struct clocksource *cs;
spin_lock(&watchdog_lock);
if (!watchdog_running)
goto out;
reset_pending = atomic_read(&watchdog_reset_pending);
list_for_each_entry(cs, &watchdog_list, wd_list) {
/* Clocksource already marked unstable? */
if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
if (finished_booting)
schedule_work(&watchdog_work);
continue;
}
if (!cs_watchdog_read(cs, &csnow, &wdnow)) {
/* Clock readout unreliable, so give it up. */
__clocksource_unstable(cs);
continue;
}
/* Clocksource initialized ? */
if (!(cs->flags & CLOCK_SOURCE_WATCHDOG) ||
atomic_read(&watchdog_reset_pending)) {
cs->flags |= CLOCK_SOURCE_WATCHDOG;
cs->wd_last = wdnow;
cs->cs_last = csnow;
continue;
}
delta = clocksource_delta(wdnow, cs->wd_last, watchdog->mask);
wd_nsec = clocksource_cyc2ns(delta, watchdog->mult,
watchdog->shift);
delta = clocksource_delta(csnow, cs->cs_last, cs->mask);
cs_nsec = clocksource_cyc2ns(delta, cs->mult, cs->shift);
wdlast = cs->wd_last; /* save these in case we print them */
cslast = cs->cs_last;
cs->cs_last = csnow;
cs->wd_last = wdnow;
if (atomic_read(&watchdog_reset_pending))
continue;
/* Check the deviation from the watchdog clocksource. */
if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
pr_warn("timekeeping watchdog on CPU%d: Marking clocksource '%s' as unstable because the skew is too large:\n",
smp_processor_id(), cs->name);
pr_warn(" '%s' wd_now: %llx wd_last: %llx mask: %llx\n",
watchdog->name, wdnow, wdlast, watchdog->mask);
pr_warn(" '%s' cs_now: %llx cs_last: %llx mask: %llx\n",
cs->name, csnow, cslast, cs->mask);
__clocksource_unstable(cs);
continue;
}
if (cs == curr_clocksource && cs->tick_stable)
cs->tick_stable(cs);
if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) &&
(cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) &&
(watchdog->flags & CLOCK_SOURCE_IS_CONTINUOUS)) {
/* Mark it valid for high-res. */
cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
/*
* clocksource_done_booting() will sort it if
* finished_booting is not set yet.
*/
if (!finished_booting)
continue;
/*
* If this is not the current clocksource let
* the watchdog thread reselect it. Due to the
* change to high res this clocksource might
* be preferred now. If it is the current
* clocksource let the tick code know about
* that change.
*/
if (cs != curr_clocksource) {
cs->flags |= CLOCK_SOURCE_RESELECT;
schedule_work(&watchdog_work);
} else {
tick_clock_notify();
}
}
}
/*
* We only clear the watchdog_reset_pending, when we did a
* full cycle through all clocksources.
*/
if (reset_pending)
atomic_dec(&watchdog_reset_pending);
/*
* Cycle through CPUs to check if the CPUs stay synchronized
* to each other.
*/
next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
if (next_cpu >= nr_cpu_ids)
next_cpu = cpumask_first(cpu_online_mask);
/*
* Arm timer if not already pending: could race with concurrent
* pair clocksource_stop_watchdog() clocksource_start_watchdog().
*/
if (!timer_pending(&watchdog_timer)) {
watchdog_timer.expires += WATCHDOG_INTERVAL;
add_timer_on(&watchdog_timer, next_cpu);
}
out:
spin_unlock(&watchdog_lock);
}
static inline void clocksource_start_watchdog(void)
{
if (watchdog_running || !watchdog || list_empty(&watchdog_list))
return;
timer_setup(&watchdog_timer, clocksource_watchdog, 0);
watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
add_timer_on(&watchdog_timer, cpumask_first(cpu_online_mask));
watchdog_running = 1;
}
static inline void clocksource_stop_watchdog(void)
{
if (!watchdog_running || (watchdog && !list_empty(&watchdog_list)))
return;
del_timer(&watchdog_timer);
watchdog_running = 0;
}
static inline void clocksource_reset_watchdog(void)
{
struct clocksource *cs;
list_for_each_entry(cs, &watchdog_list, wd_list)
cs->flags &= ~CLOCK_SOURCE_WATCHDOG;
}
static void clocksource_resume_watchdog(void)
{
atomic_inc(&watchdog_reset_pending);
}
static void clocksource_enqueue_watchdog(struct clocksource *cs)
{
INIT_LIST_HEAD(&cs->wd_list);
if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
/* cs is a clocksource to be watched. */
list_add(&cs->wd_list, &watchdog_list);
cs->flags &= ~CLOCK_SOURCE_WATCHDOG;
} else {
/* cs is a watchdog. */
if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
}
}
static void clocksource_select_watchdog(bool fallback)
{
struct clocksource *cs, *old_wd;
unsigned long flags;
spin_lock_irqsave(&watchdog_lock, flags);
/* save current watchdog */
old_wd = watchdog;
if (fallback)
watchdog = NULL;
list_for_each_entry(cs, &clocksource_list, list) {
/* cs is a clocksource to be watched. */
if (cs->flags & CLOCK_SOURCE_MUST_VERIFY)
continue;
/* Skip current if we were requested for a fallback. */
if (fallback && cs == old_wd)
continue;
/* Pick the best watchdog. */
if (!watchdog || cs->rating > watchdog->rating)
watchdog = cs;
}
/* If we failed to find a fallback restore the old one. */
if (!watchdog)
watchdog = old_wd;
/* If we changed the watchdog we need to reset cycles. */
if (watchdog != old_wd)
clocksource_reset_watchdog();
/* Check if the watchdog timer needs to be started. */
clocksource_start_watchdog();
spin_unlock_irqrestore(&watchdog_lock, flags);
}
static void clocksource_dequeue_watchdog(struct clocksource *cs)
{
if (cs != watchdog) {
if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
/* cs is a watched clocksource. */
list_del_init(&cs->wd_list);
/* Check if the watchdog timer needs to be stopped. */
clocksource_stop_watchdog();
}
}
}
static int __clocksource_watchdog_kthread(void)
{
struct clocksource *cs, *tmp;
unsigned long flags;
int select = 0;
spin_lock_irqsave(&watchdog_lock, flags);
list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) {
if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
list_del_init(&cs->wd_list);
__clocksource_change_rating(cs, 0);
select = 1;
}
if (cs->flags & CLOCK_SOURCE_RESELECT) {
cs->flags &= ~CLOCK_SOURCE_RESELECT;
select = 1;
}
}
/* Check if the watchdog timer needs to be stopped. */
clocksource_stop_watchdog();
spin_unlock_irqrestore(&watchdog_lock, flags);
return select;
}
static int clocksource_watchdog_kthread(void *data)
{
mutex_lock(&clocksource_mutex);
if (__clocksource_watchdog_kthread())
clocksource_select();
mutex_unlock(&clocksource_mutex);
return 0;
}
static bool clocksource_is_watchdog(struct clocksource *cs)
{
return cs == watchdog;
}
#else /* CONFIG_CLOCKSOURCE_WATCHDOG */
static void clocksource_enqueue_watchdog(struct clocksource *cs)
{
if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
}
static void clocksource_select_watchdog(bool fallback) { }
static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { }
static inline void clocksource_resume_watchdog(void) { }
static inline int __clocksource_watchdog_kthread(void) { return 0; }
static bool clocksource_is_watchdog(struct clocksource *cs) { return false; }
void clocksource_mark_unstable(struct clocksource *cs) { }
static inline void clocksource_watchdog_lock(unsigned long *flags) { }
static inline void clocksource_watchdog_unlock(unsigned long *flags) { }
#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
static bool clocksource_is_suspend(struct clocksource *cs)
{
return cs == suspend_clocksource;
}
static void __clocksource_suspend_select(struct clocksource *cs)
{
/*
* Skip the clocksource which will be stopped in suspend state.
*/
if (!(cs->flags & CLOCK_SOURCE_SUSPEND_NONSTOP))
return;
/*
* The nonstop clocksource can be selected as the suspend clocksource to
* calculate the suspend time, so it should not supply suspend/resume
* interfaces to suspend the nonstop clocksource when system suspends.
*/
if (cs->suspend || cs->resume) {
pr_warn("Nonstop clocksource %s should not supply suspend/resume interfaces\n",
cs->name);
}
/* Pick the best rating. */
if (!suspend_clocksource || cs->rating > suspend_clocksource->rating)
suspend_clocksource = cs;
}
/**
* clocksource_suspend_select - Select the best clocksource for suspend timing
* @fallback: if select a fallback clocksource
*/
static void clocksource_suspend_select(bool fallback)
{
struct clocksource *cs, *old_suspend;
old_suspend = suspend_clocksource;
if (fallback)
suspend_clocksource = NULL;
list_for_each_entry(cs, &clocksource_list, list) {
/* Skip current if we were requested for a fallback. */
if (fallback && cs == old_suspend)
continue;
__clocksource_suspend_select(cs);
}
}
/**
* clocksource_start_suspend_timing - Start measuring the suspend timing
* @cs: current clocksource from timekeeping
* @start_cycles: current cycles from timekeeping
*
* This function will save the start cycle values of suspend timer to calculate
* the suspend time when resuming system.
*
* This function is called late in the suspend process from timekeeping_suspend(),
* that means processes are freezed, non-boot cpus and interrupts are disabled
* now. It is therefore possible to start the suspend timer without taking the
* clocksource mutex.
*/
void clocksource_start_suspend_timing(struct clocksource *cs, u64 start_cycles)
{
if (!suspend_clocksource)
return;
/*
* If current clocksource is the suspend timer, we should use the
* tkr_mono.cycle_last value as suspend_start to avoid same reading
* from suspend timer.
*/
if (clocksource_is_suspend(cs)) {
suspend_start = start_cycles;
return;
}
if (suspend_clocksource->enable &&
suspend_clocksource->enable(suspend_clocksource)) {
pr_warn_once("Failed to enable the non-suspend-able clocksource.\n");
return;
}
suspend_start = suspend_clocksource->read(suspend_clocksource);
}
/**
* clocksource_stop_suspend_timing - Stop measuring the suspend timing
* @cs: current clocksource from timekeeping
* @cycle_now: current cycles from timekeeping
*
* This function will calculate the suspend time from suspend timer.
*
* Returns nanoseconds since suspend started, 0 if no usable suspend clocksource.
*
* This function is called early in the resume process from timekeeping_resume(),
* that means there is only one cpu, no processes are running and the interrupts
* are disabled. It is therefore possible to stop the suspend timer without
* taking the clocksource mutex.
*/
u64 clocksource_stop_suspend_timing(struct clocksource *cs, u64 cycle_now)
{
u64 now, delta, nsec = 0;
if (!suspend_clocksource)
return 0;
/*
* If current clocksource is the suspend timer, we should use the
* tkr_mono.cycle_last value from timekeeping as current cycle to
* avoid same reading from suspend timer.
*/
if (clocksource_is_suspend(cs))
now = cycle_now;
else
now = suspend_clocksource->read(suspend_clocksource);
if (now > suspend_start) {
delta = clocksource_delta(now, suspend_start,
suspend_clocksource->mask);
nsec = mul_u64_u32_shr(delta, suspend_clocksource->mult,
suspend_clocksource->shift);
}
/*
* Disable the suspend timer to save power if current clocksource is
* not the suspend timer.
*/
if (!clocksource_is_suspend(cs) && suspend_clocksource->disable)
suspend_clocksource->disable(suspend_clocksource);
return nsec;
}
/**
* clocksource_suspend - suspend the clocksource(s)
*/
void clocksource_suspend(void)
{
struct clocksource *cs;
list_for_each_entry_reverse(cs, &clocksource_list, list)
if (cs->suspend)
cs->suspend(cs);
}
/**
* clocksource_resume - resume the clocksource(s)
*/
void clocksource_resume(void)
{
struct clocksource *cs;
list_for_each_entry(cs, &clocksource_list, list)
if (cs->resume)
cs->resume(cs);
clocksource_resume_watchdog();
}
/**
* clocksource_touch_watchdog - Update watchdog
*
* Update the watchdog after exception contexts such as kgdb so as not
* to incorrectly trip the watchdog. This might fail when the kernel
* was stopped in code which holds watchdog_lock.
*/
void clocksource_touch_watchdog(void)
{
clocksource_resume_watchdog();
}
/**
* clocksource_max_adjustment- Returns max adjustment amount
* @cs: Pointer to clocksource
*
*/
static u32 clocksource_max_adjustment(struct clocksource *cs)
{
u64 ret;
/*
* We won't try to correct for more than 11% adjustments (110,000 ppm),
*/
ret = (u64)cs->mult * 11;
do_div(ret,100);
return (u32)ret;
}
/**
* clocks_calc_max_nsecs - Returns maximum nanoseconds that can be converted
* @mult: cycle to nanosecond multiplier
* @shift: cycle to nanosecond divisor (power of two)
* @maxadj: maximum adjustment value to mult (~11%)
* @mask: bitmask for two's complement subtraction of non 64 bit counters
* @max_cyc: maximum cycle value before potential overflow (does not include
* any safety margin)
*
* NOTE: This function includes a safety margin of 50%, in other words, we
* return half the number of nanoseconds the hardware counter can technically
* cover. This is done so that we can potentially detect problems caused by
* delayed timers or bad hardware, which might result in time intervals that
* are larger than what the math used can handle without overflows.
*/
u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cyc)
{
u64 max_nsecs, max_cycles;
/*
* Calculate the maximum number of cycles that we can pass to the
* cyc2ns() function without overflowing a 64-bit result.
*/
max_cycles = ULLONG_MAX;
do_div(max_cycles, mult+maxadj);
/*
* The actual maximum number of cycles we can defer the clocksource is
* determined by the minimum of max_cycles and mask.
* Note: Here we subtract the maxadj to make sure we don't sleep for
* too long if there's a large negative adjustment.
*/
max_cycles = min(max_cycles, mask);
max_nsecs = clocksource_cyc2ns(max_cycles, mult - maxadj, shift);
/* return the max_cycles value as well if requested */
if (max_cyc)
*max_cyc = max_cycles;
/* Return 50% of the actual maximum, so we can detect bad values */
max_nsecs >>= 1;
return max_nsecs;
}
/**
* clocksource_update_max_deferment - Updates the clocksource max_idle_ns & max_cycles
* @cs: Pointer to clocksource to be updated
*
*/
static inline void clocksource_update_max_deferment(struct clocksource *cs)
{
cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
cs->maxadj, cs->mask,
&cs->max_cycles);
}
#ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
static struct clocksource *clocksource_find_best(bool oneshot, bool skipcur,
bool force)
{
struct clocksource *cs;
if ((!finished_booting && !force) || list_empty(&clocksource_list))
return NULL;
/*
* We pick the clocksource with the highest rating. If oneshot
* mode is active, we pick the highres valid clocksource with
* the best rating.
*/
list_for_each_entry(cs, &clocksource_list, list) {
if (skipcur && cs == curr_clocksource)
continue;
if (oneshot && !(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES))
continue;
return cs;
}
return NULL;
}
static void __clocksource_select(bool skipcur, bool force)
{
bool oneshot = tick_oneshot_mode_active();
struct clocksource *best, *cs;
/* Find the best suitable clocksource */
best = clocksource_find_best(oneshot, skipcur, force);
if (!best)
return;
if (!strlen(override_name))
goto found;
/* Check for the override clocksource. */
list_for_each_entry(cs, &clocksource_list, list) {
if (skipcur && cs == curr_clocksource)
continue;
if (strcmp(cs->name, override_name) != 0)
continue;
/*
* Check to make sure we don't switch to a non-highres
* capable clocksource if the tick code is in oneshot
* mode (highres or nohz)
*/
if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) && oneshot) {
/* Override clocksource cannot be used. */
if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
pr_warn("Override clocksource %s is unstable and not HRT compatible - cannot switch while in HRT/NOHZ mode\n",
cs->name);
override_name[0] = 0;
} else {
/*
* The override cannot be currently verified.
* Deferring to let the watchdog check.
*/
pr_info("Override clocksource %s is not currently HRT compatible - deferring\n",
cs->name);
}
} else
/* Override clocksource can be used. */
best = cs;
break;
}
found:
if (curr_clocksource != best && !timekeeping_notify(best)) {
pr_info("Switched to clocksource %s\n", best->name);
curr_clocksource = best;
}
}
/**
* clocksource_select - Select the best clocksource available
*
* Private function. Must hold clocksource_mutex when called.
*
* Select the clocksource with the best rating, or the clocksource,
* which is selected by userspace override.
*/
static void clocksource_select(bool force)
{
return __clocksource_select(false, force);
}
static void clocksource_select_fallback(void)
{
__clocksource_select(true, false);
}
#else /* !CONFIG_ARCH_USES_GETTIMEOFFSET */
static inline void clocksource_select(bool force) { }
static inline void clocksource_select_fallback(void) { }
#endif
/**
* clocksource_select_force - Force re-selection of the best clocksource
* among registered clocksources
*
* clocksource_select() can't select the best clocksource before
* calling clocksource_done_booting() and since clocksource_select()
* should be called with clocksource_mutex held, provide a new API
* can be called from other files to select best clockrouce irrespective
* of finished_booting flag.
*/
void clocksource_select_force(void)
{
mutex_lock(&clocksource_mutex);
clocksource_select(true);
mutex_unlock(&clocksource_mutex);
}
/*
* clocksource_done_booting - Called near the end of core bootup
*
* Hack to avoid lots of clocksource churn at boot time.
* We use fs_initcall because we want this to start before
* device_initcall but after subsys_initcall.
*/
static int __init clocksource_done_booting(void)
{
mutex_lock(&clocksource_mutex);
curr_clocksource = clocksource_default_clock();
finished_booting = 1;
/*
* Run the watchdog first to eliminate unstable clock sources
*/
__clocksource_watchdog_kthread();
clocksource_select(false);
mutex_unlock(&clocksource_mutex);
return 0;
}
fs_initcall(clocksource_done_booting);
/*
* Enqueue the clocksource sorted by rating
*/
static void clocksource_enqueue(struct clocksource *cs)
{
struct list_head *entry = &clocksource_list;
struct clocksource *tmp;
list_for_each_entry(tmp, &clocksource_list, list) {
/* Keep track of the place, where to insert */
if (tmp->rating < cs->rating)
break;
entry = &tmp->list;
}
list_add(&cs->list, entry);
}
/**
* __clocksource_update_freq_scale - Used update clocksource with new freq
* @cs: clocksource to be registered
* @scale: Scale factor multiplied against freq to get clocksource hz
* @freq: clocksource frequency (cycles per second) divided by scale
*
* This should only be called from the clocksource->enable() method.
*
* This *SHOULD NOT* be called directly! Please use the
* __clocksource_update_freq_hz() or __clocksource_update_freq_khz() helper
* functions.
*/
void __clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq)
{
u64 sec;
/*
* Default clocksources are *special* and self-define their mult/shift.
* But, you're not special, so you should specify a freq value.
*/
if (freq) {
/*
* Calc the maximum number of seconds which we can run before
* wrapping around. For clocksources which have a mask > 32-bit
* we need to limit the max sleep time to have a good
* conversion precision. 10 minutes is still a reasonable
* amount. That results in a shift value of 24 for a
* clocksource with mask >= 40-bit and f >= 4GHz. That maps to
* ~ 0.06ppm granularity for NTP.
*/
sec = cs->mask;
do_div(sec, freq);
do_div(sec, scale);
if (!sec)
sec = 1;
else if (sec > 600 && cs->mask > UINT_MAX)
sec = 600;
clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
NSEC_PER_SEC / scale, sec * scale);
}
/*
* Ensure clocksources that have large 'mult' values don't overflow
* when adjusted.
*/
cs->maxadj = clocksource_max_adjustment(cs);
while (freq && ((cs->mult + cs->maxadj < cs->mult)
|| (cs->mult - cs->maxadj > cs->mult))) {
cs->mult >>= 1;
cs->shift--;
cs->maxadj = clocksource_max_adjustment(cs);
}
/*
* Only warn for *special* clocksources that self-define
* their mult/shift values and don't specify a freq.
*/
WARN_ONCE(cs->mult + cs->maxadj < cs->mult,
"timekeeping: Clocksource %s might overflow on 11%% adjustment\n",
cs->name);
clocksource_update_max_deferment(cs);
pr_info("%s: mask: 0x%llx max_cycles: 0x%llx, max_idle_ns: %lld ns\n",
cs->name, cs->mask, cs->max_cycles, cs->max_idle_ns);
}
EXPORT_SYMBOL_GPL(__clocksource_update_freq_scale);
/**
* __clocksource_register_scale - Used to install new clocksources
* @cs: clocksource to be registered
* @scale: Scale factor multiplied against freq to get clocksource hz
* @freq: clocksource frequency (cycles per second) divided by scale
*
* Returns -EBUSY if registration fails, zero otherwise.
*
* This *SHOULD NOT* be called directly! Please use the
* clocksource_register_hz() or clocksource_register_khz helper functions.
*/
int __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq)
{
unsigned long flags;
/* Initialize mult/shift and max_idle_ns */
__clocksource_update_freq_scale(cs, scale, freq);
/* Add clocksource to the clocksource list */
mutex_lock(&clocksource_mutex);
clocksource_watchdog_lock(&flags);
clocksource_enqueue(cs);
clocksource_enqueue_watchdog(cs);
clocksource_watchdog_unlock(&flags);
clocksource_select(false);
clocksource_select_watchdog(false);
__clocksource_suspend_select(cs);
mutex_unlock(&clocksource_mutex);
return 0;
}
EXPORT_SYMBOL_GPL(__clocksource_register_scale);
static void __clocksource_change_rating(struct clocksource *cs, int rating)
{
list_del(&cs->list);
cs->rating = rating;
clocksource_enqueue(cs);
}
/**
* clocksource_change_rating - Change the rating of a registered clocksource
* @cs: clocksource to be changed
* @rating: new rating
*/
void clocksource_change_rating(struct clocksource *cs, int rating)
{
unsigned long flags;
mutex_lock(&clocksource_mutex);
clocksource_watchdog_lock(&flags);
__clocksource_change_rating(cs, rating);
clocksource_watchdog_unlock(&flags);
clocksource_select(false);
clocksource_select_watchdog(false);
clocksource_suspend_select(false);
mutex_unlock(&clocksource_mutex);
}
EXPORT_SYMBOL(clocksource_change_rating);
/*
* Unbind clocksource @cs. Called with clocksource_mutex held
*/
static int clocksource_unbind(struct clocksource *cs)
{
unsigned long flags;
if (clocksource_is_watchdog(cs)) {
/* Select and try to install a replacement watchdog. */
clocksource_select_watchdog(true);
if (clocksource_is_watchdog(cs))
return -EBUSY;
}
if (cs == curr_clocksource) {
/* Select and try to install a replacement clock source */
clocksource_select_fallback();
if (curr_clocksource == cs)
return -EBUSY;
}
if (clocksource_is_suspend(cs)) {
/*
* Select and try to install a replacement suspend clocksource.
* If no replacement suspend clocksource, we will just let the
* clocksource go and have no suspend clocksource.
*/
clocksource_suspend_select(true);
}
clocksource_watchdog_lock(&flags);
clocksource_dequeue_watchdog(cs);
list_del_init(&cs->list);
clocksource_watchdog_unlock(&flags);
return 0;
}
/**
* clocksource_unregister - remove a registered clocksource
* @cs: clocksource to be unregistered
*/
int clocksource_unregister(struct clocksource *cs)
{
int ret = 0;
mutex_lock(&clocksource_mutex);
if (!list_empty(&cs->list))
ret = clocksource_unbind(cs);
mutex_unlock(&clocksource_mutex);
return ret;
}
EXPORT_SYMBOL(clocksource_unregister);
#ifdef CONFIG_SYSFS
/**
* current_clocksource_show - sysfs interface for current clocksource
* @dev: unused
* @attr: unused
* @buf: char buffer to be filled with clocksource list
*
* Provides sysfs interface for listing current clocksource.
*/
static ssize_t current_clocksource_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
ssize_t count = 0;
mutex_lock(&clocksource_mutex);
count = snprintf(buf, PAGE_SIZE, "%s\n", curr_clocksource->name);
mutex_unlock(&clocksource_mutex);
return count;
}
ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt)
{
size_t ret = cnt;
/* strings from sysfs write are not 0 terminated! */
if (!cnt || cnt >= CS_NAME_LEN)
return -EINVAL;
/* strip of \n: */
if (buf[cnt-1] == '\n')
cnt--;
if (cnt > 0)
memcpy(dst, buf, cnt);
dst[cnt] = 0;
return ret;
}
/**
* current_clocksource_store - interface for manually overriding clocksource
* @dev: unused
* @attr: unused
* @buf: name of override clocksource
* @count: length of buffer
*
* Takes input from sysfs interface for manually overriding the default
* clocksource selection.
*/
static ssize_t current_clocksource_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
ssize_t ret;
mutex_lock(&clocksource_mutex);
ret = sysfs_get_uname(buf, override_name, count);
if (ret >= 0)
clocksource_select(false);
mutex_unlock(&clocksource_mutex);
return ret;
}
static DEVICE_ATTR_RW(current_clocksource);
/**
* unbind_clocksource_store - interface for manually unbinding clocksource
* @dev: unused
* @attr: unused
* @buf: unused
* @count: length of buffer
*
* Takes input from sysfs interface for manually unbinding a clocksource.
*/
static ssize_t unbind_clocksource_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct clocksource *cs;
char name[CS_NAME_LEN];
ssize_t ret;
ret = sysfs_get_uname(buf, name, count);
if (ret < 0)
return ret;
ret = -ENODEV;
mutex_lock(&clocksource_mutex);
list_for_each_entry(cs, &clocksource_list, list) {
if (strcmp(cs->name, name))
continue;
ret = clocksource_unbind(cs);
break;
}
mutex_unlock(&clocksource_mutex);
return ret ? ret : count;
}
static DEVICE_ATTR_WO(unbind_clocksource);
/**
* available_clocksource_show - sysfs interface for listing clocksource
* @dev: unused
* @attr: unused
* @buf: char buffer to be filled with clocksource list
*
* Provides sysfs interface for listing registered clocksources
*/
static ssize_t available_clocksource_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct clocksource *src;
ssize_t count = 0;
mutex_lock(&clocksource_mutex);
list_for_each_entry(src, &clocksource_list, list) {
/*
* Don't show non-HRES clocksource if the tick code is
* in one shot mode (highres=on or nohz=on)
*/
if (!tick_oneshot_mode_active() ||
(src->flags & CLOCK_SOURCE_VALID_FOR_HRES))
count += snprintf(buf + count,
max((ssize_t)PAGE_SIZE - count, (ssize_t)0),
"%s ", src->name);
}
mutex_unlock(&clocksource_mutex);
count += snprintf(buf + count,
max((ssize_t)PAGE_SIZE - count, (ssize_t)0), "\n");
return count;
}
static DEVICE_ATTR_RO(available_clocksource);
static struct attribute *clocksource_attrs[] = {
&dev_attr_current_clocksource.attr,
&dev_attr_unbind_clocksource.attr,
&dev_attr_available_clocksource.attr,
NULL
};
ATTRIBUTE_GROUPS(clocksource);
static struct bus_type clocksource_subsys = {
.name = "clocksource",
.dev_name = "clocksource",
};
static struct device device_clocksource = {
.id = 0,
.bus = &clocksource_subsys,
.groups = clocksource_groups,
};
static int __init init_clocksource_sysfs(void)
{
int error = subsys_system_register(&clocksource_subsys, NULL);
if (!error)
error = device_register(&device_clocksource);
return error;
}
device_initcall(init_clocksource_sysfs);
#endif /* CONFIG_SYSFS */
/**
* boot_override_clocksource - boot clock override
* @str: override name
*
* Takes a clocksource= boot argument and uses it
* as the clocksource override name.
*/
static int __init boot_override_clocksource(char* str)
{
mutex_lock(&clocksource_mutex);
if (str)
strlcpy(override_name, str, sizeof(override_name));
mutex_unlock(&clocksource_mutex);
return 1;
}
__setup("clocksource=", boot_override_clocksource);
/**
* boot_override_clock - Compatibility layer for deprecated boot option
* @str: override name
*
* DEPRECATED! Takes a clock= boot argument and uses it
* as the clocksource override name
*/
static int __init boot_override_clock(char* str)
{
if (!strcmp(str, "pmtmr")) {
pr_warn("clock=pmtmr is deprecated - use clocksource=acpi_pm\n");
return boot_override_clocksource("acpi_pm");
}
pr_warn("clock= boot option is deprecated - use clocksource=xyz\n");
return boot_override_clocksource(str);
}
__setup("clock=", boot_override_clock);