Merge 4.14.176 into android-4.14-q
Linux 4.14.176
* drm/msm: Use the correct dma_sync calls in msm_gem
drivers/gpu/drm/msm/msm_gem.c
* rpmsg: glink: smem: Support rx peak for size less than 4 bytes
drivers/rpmsg/qcom_glink_smem.c
* drm_dp_mst_topology: fix broken drm_dp_sideband_parse_remote_dpcd_read()
drivers/gpu/drm/drm_dp_mst_topology.c
* usb: dwc3: don't set gadget->is_otg flag
drivers/usb/dwc3/gadget.c
* rpmsg: glink: Remove chunk size word align warning
drivers/rpmsg/qcom_glink_native.c
* arm64: Fix size of __early_cpu_boot_status
arch/arm64/kernel/head.S
* drm/msm: stop abusing dma_map/unmap for cache
drivers/gpu/drm/msm/msm_gem.c
* clk: qcom: rcg: Return failure for RCG update
drivers/clk/qcom/clk-rcg2.c
acpi/nfit: Fix bus command validation
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
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
* random: always use batched entropy for get_random_u{32,64}
drivers/char/random.c
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
* ipv6: don't auto-add link-local address to lag ports
net/ipv6/addrconf.c
mm: mempolicy: require at least one nodeid for MPOL_PREFERRED
padata: always acquire cpu_hotplug_lock before pinst->lock
* coresight: do not use the BIT() macro in the UAPI header
include/uapi/linux/coresight-stm.h
misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices
* blk-mq: Allow blocking queue tag iter callbacks
block/blk-mq-tag.c
* blk-mq: sync the update nr_hw_queues with blk_mq_queue_tag_busy_iter
block/blk-mq-tag.c
block/blk-mq.c
drm/etnaviv: replace MMU flush marker with flush sequence
tools/power turbostat: Fix gcc build warnings
* initramfs: restore default compression behavior
usr/Kconfig
drm/bochs: downgrade pci_request_region failure from error to warning
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
net/ipv4/ip_tunnel.c
* ipv4: fix a RCU-list lock in fib_triestat_seq_show
net/ipv4/fib_trie.c
ANDROID: cuttlefish_defconfig: Minimally enable EFI
* UPSTREAM: loop: Only freeze block queue when needed.
drivers/block/loop.c
* UPSTREAM: loop: Only change blocksize when needed.
drivers/block/loop.c
Merge 4.14.175 into android-4.14-q
Linux 4.14.175
arm64: dts: ls1046ardb: set RGMII interfaces to RGMII_ID mode
arm64: dts: ls1043a-rdb: correct RGMII delay mode to rgmii-id
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
arch/arm64/include/asm/alternative.h
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
kernel/bpf/syscall.c
* bpf: Explicitly memset the bpf_attr structure
kernel/bpf/syscall.c
platform/x86: pmc_atom: Add Lex 2I385SW to critclk_systems DMI table
* vt: vt_ioctl: fix use-after-free in vt_in_use()
drivers/tty/vt/vt_ioctl.c
* vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console
drivers/tty/vt/vt.c
drivers/tty/vt/vt_ioctl.c
* vt: vt_ioctl: remove unnecessary console allocation checks
drivers/tty/vt/vt_ioctl.c
* vt: switch vt_dont_switch to bool
drivers/tty/vt/vt_ioctl.c
include/linux/vt_kern.h
* vt: ioctl, switch VT_IS_IN_USE and VT_BUSY to inlines
drivers/tty/vt/vt_ioctl.c
* vt: selection, introduce vc_is_sel
drivers/tty/vt/selection.c
drivers/tty/vt/vt.c
drivers/tty/vt/vt_ioctl.c
include/linux/selection.h
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()
fs/libfs.c
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
afs: Fix some tracing details
Input: raydium_i2c_ts - fix error codes in raydium_i2c_boot_trigger()
Input: raydium_i2c_ts - use true and false for boolean values
* vti6: Fix memory leak of skb if input policy check fails
net/ipv6/ip6_vti.c
netfilter: nft_fwd_netdev: validate family and chain type
* xfrm: policy: Fix doulbe free in xfrm_policy_timer
net/xfrm/xfrm_policy.c
* xfrm: add the missing verify_sec_ctx_len check in xfrm_add_acquire
net/xfrm/xfrm_user.c
* xfrm: fix uctx len check in verify_sec_ctx_len
net/xfrm/xfrm_user.c
RDMA/mlx5: Block delay drop to unprivileged users
* vti[6]: fix packet tx through bpf_redirect() in XinY cases
net/ipv4/Kconfig
net/ipv4/ip_vti.c
net/ipv6/ip6_vti.c
* xfrm: handle NETDEV_UNREGISTER for xfrm device
net/xfrm/xfrm_device.c
* genirq: Fix reference leaks on irq affinity notifiers
kernel/irq/manage.c
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
* scsi: sd: Fix optimal I/O size for devices that change reported values
drivers/scsi/sd.c
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
* Input: avoid BIT() macro usage in the serio.h UAPI header
include/uapi/linux/serio.h
Input: synaptics - enable RMI on HP Envy 13-ad105ng
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()
* arm64: compat: map SPSR_ELx<->PSR for signals
arch/arm64/kernel/signal32.c
* arm64: ptrace: map SPSR_ELx<->PSR for compat tasks
arch/arm64/kernel/ptrace.c
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
* fsl/fman: detect FMan erratum A050385
drivers/net/ethernet/freescale/fman/Kconfig
arm64: dts: ls1043a: FMan erratum A050385
dt-bindings: net: FMan erratum A050385
* cgroup1: don't call release_agent when it is ""
kernel/cgroup/cgroup-v1.c
* drivers/of/of_mdio.c:fix of_mdiobus_register()
drivers/of/of_mdio.c
cpupower: avoid multiple definition with gcc -fno-common
* cgroup-v1: cgroup_pidlist_next should update position index
kernel/cgroup/cgroup-v1.c
* net: ipv4: don't let PMTU updates increase route MTU
net/ipv4/route.c
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()
net: dsa: mt7530: Change the LINK bit to reflect the link status
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/packet/af_packet.c
net/packet/internal.h
net: mvneta: Fix the case where the last poll did not process all rx
net: dsa: Fix duplicate frames flooded by learning
macsec: restrict to ethernet devices
hsr: fix general protection fault in hsr_addr_is_self()
* Revert "drm/dp_mst: Skip validating ports during destruction, just ref"
drivers/gpu/drm/drm_dp_mst_topology.c
staging: greybus: loopback_test: fix potential path truncations
staging: greybus: loopback_test: fix potential path truncation
drm/bridge: dw-hdmi: fix AVI frame colorimetry
* arm64: smp: fix crash_smp_send_stop() behaviour
arch/arm64/kernel/smp.c
* arm64: smp: fix smp_send_stop() behaviour
arch/arm64/kernel/smp.c
ALSA: hda/realtek: Fix pop noise on ALC225
* Revert "ipv6: Fix handling of LLA with VRF and sockets bound to VRF"
net/ipv6/tcp_ipv6.c
Revert "vrf: mark skb for multicast or link-local as enslaved to VRF"
* futex: Unbreak futex hashing
kernel/futex.c
* futex: Fix inode life-time issue
fs/inode.c
include/linux/fs.h
include/linux/futex.h
kernel/futex.c
* kbuild: Disable -Wpointer-to-enum-cast
scripts/Makefile.extrawarn
iio: adc: at91-sama5d2_adc: fix differential channels in triggered mode
iio: adc: at91-sama5d2_adc: fix channel configuration for differential channels
USB: cdc-acm: fix rounding error in TIOCSSERIAL
USB: cdc-acm: fix close_delay and closing_wait units in TIOCSSERIAL
* x86/mm: split vmalloc_sync_all()
include/linux/vmalloc.h
kernel/notifier.c
mm/vmalloc.c
* page-flags: fix a crash at SetPageError(THP_SWAP)
include/linux/page-flags.h
* mm, slub: prevent kmalloc_node crashes and memory leaks
mm/slub.c
* mm: slub: be more careful about the double cmpxchg of freelist
mm/slub.c
* memcg: fix NULL pointer dereference in __mem_cgroup_usage_unregister_event
mm/memcontrol.c
* xhci: Do not open code __print_symbolic() in xhci trace events
drivers/usb/host/xhci-trace.h
* rtc: max8907: add missing select REGMAP_IRQ
drivers/rtc/Kconfig
intel_th: pci: Add Elkhart Lake CPU support
intel_th: Fix user-visible error codes
staging/speakup: fix get_word non-space look-ahead
staging: rtl8188eu: Add device id for MERCUSYS MW150US v2
mmc: sdhci-of-at91: fix cd-gpios for SAMA5D2
iio: magnetometer: ak8974: Fix negative raw values in sysfs
iio: trigger: stm32-timer: disable master mode when stopping
ALSA: pcm: oss: Remove WARNING from snd_pcm_plug_alloc() checks
ALSA: pcm: oss: Avoid plugin buffer overflow
ALSA: seq: oss: Fix running status after receiving sysex
ALSA: seq: virmidi: Fix running status after receiving sysex
ALSA: line6: Fix endless MIDI read loop
* usb: xhci: apply XHCI_SUSPEND_DELAY to AMD XHCI controller 1022:145c
drivers/usb/host/xhci-pci.c
USB: serial: pl2303: add device-id for HP LD381
* usb: host: xhci-plat: add a shutdown
drivers/usb/host/xhci-plat.c
USB: serial: option: add ME910G1 ECM composition 0x110b
* usb: quirks: add NO_LPM quirk for RTL8153 based ethernet adapters
drivers/usb/core/quirks.c
* USB: Disable LPM on WD19's Realtek Hub
drivers/usb/core/quirks.c
parse-maintainers: Mark as executable
block, bfq: fix overwrite of bfq_group pointer in bfq_find_set_group()
xenbus: req->err should be updated before req->state
xenbus: req->body should be updated before req->state
dm bio record: save/restore bi_end_io and bi_integrity
altera-stapl: altera_get_note: prevent write beyond end of 'key'
drivers/perf: arm_pmu_acpi: Fix incorrect checking of gicc pointer
drm/exynos: dsi: fix workaround for the legacy clock name
drm/exynos: dsi: propagate error value and silence meaningless warning
spi/zynqmp: remove entry that causes a cs glitch
spi: pxa2xx: Add CS control clock quirk
ARM: dts: dra7: Add "dma-ranges" property to PCIe RC DT nodes
powerpc: Include .BTF section
spi: qup: call spi_qup_pm_resume_runtime before suspending
* UPSTREAM: ipv6: ndisc: add support for 'PREF64' dns64 prefix identifier
include/net/ndisc.h
net/ipv6/ndisc.c
ANDROID: dm-bow: Fix free_show value is incorrect
* UPSTREAM: bpf: Explicitly memset some bpf info structures declared on the stack
kernel/bpf/syscall.c
* UPSTREAM: bpf: Explicitly memset the bpf_attr structure
kernel/bpf/syscall.c
Merge 4.14.174 into android-4.14-q
Linux 4.14.174
* ipv4: ensure rcu_read_lock() in cipso_v4_error()
net/ipv4/cipso_ipv4.c
* mm: slub: add missing TID bump in kmem_cache_alloc_bulk()
mm/slub.c
ARM: 8958/1: rename missed uaccess .fixup section
ARM: 8957/1: VDSO: Match ARMv8 timer in cntvct_functional()
* jbd2: fix data races at struct journal_head
fs/jbd2/transaction.c
* net: rmnet: fix NULL pointer dereference in rmnet_newlink()
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
hinic: fix a bug of setting hw_ioctxt
slip: not call free_netdev before rtnl_unlock in slip_open
* signal: avoid double atomic counter increments for user accounting
kernel/signal.c
mac80211: rx: avoid RCU list traversal under mutex
net: ks8851-ml: Fix IRQ handling and locking
net: usb: qmi_wwan: restore mtu min/max values after raw_ip switch
scsi: libfc: free response frame from GPN_ID
* cfg80211: check reg_rule for NULL in handle_channel_custom()
net/wireless/reg.c
HID: i2c-hid: add Trekstor Surfbook E11B to descriptor override
* HID: apple: Add support for recent firmware on Magic Keyboards
drivers/hid/hid-apple.c
ACPI: watchdog: Allow disabling WDAT at boot
perf/amd/uncore: Replace manual sampling check with CAP_NO_INTERRUPT flag
batman-adv: Don't schedule OGM for disabled interface
batman-adv: Avoid free/alloc race when handling OGM buffer
batman-adv: Avoid free/alloc race when handling OGM2 buffer
batman-adv: Fix duplicated OGMs on NETDEV_UP
batman-adv: Fix debugfs path for renamed softif
batman-adv: Fix debugfs path for renamed hardif
batman-adv: prevent TT request storms by not sending inconsistent TT TLVLs
batman-adv: Fix TT sync flags for intermediate TT responses
batman-adv: Avoid race in TT TVLV allocator helper
batman-adv: update data pointers after skb_cow()
batman-adv: Fix internal interface indices types
batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq
batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible
batman-adv: Always initialize fragment header priority
batman-adv: Avoid spurious warnings from bat_v neigh_cmp implementation
efi: Add a sanity check to efivar_store_raw()
net/smc: check for valid ib_client_data
* ipv6: restrict IPV6_ADDRFORM operation
net/ipv6/ipv6_sockglue.c
i2c: acpi: put device when verifying client fails
iommu/vt-d: Ignore devices with out-of-spec domain number
iommu/vt-d: Fix the wrong printing in RHSA parsing
netfilter: nft_payload: add missing attribute validation for payload csum flags
netfilter: cthelper: add missing attribute validation for cthelper
* nl80211: add missing attribute validation for channel switch
net/wireless/nl80211.c
* nl80211: add missing attribute validation for beacon report scanning
net/wireless/nl80211.c
* nl80211: add missing attribute validation for critical protocol indication
net/wireless/nl80211.c
* pinctrl: core: Remove extra kref_get which blocks hogs being freed
drivers/pinctrl/core.c
pinctrl: meson-gxl: fix GPIOX sdio pins
iommu/vt-d: Fix a bug in intel_iommu_iova_to_phys() for huge page
iommu/vt-d: dmar: replace WARN_TAINT with pr_warn + add_taint
* iommu/dma: Fix MSI reservation allocation
drivers/iommu/dma-iommu.c
x86/mce: Fix logic and comments around MSR_PPIN_CTL
efi: Fix a race and a buffer overflow while reading efivars via sysfs
ARC: define __ALIGN_STR and __ALIGN symbols for ARC
KVM: x86: clear stale x86_emulate_ctxt->intercept value
gfs2_atomic_open(): fix O_EXCL|O_CREAT handling on cold dcache
* cifs_atomic_open(): fix double-put on late allocation failure
fs/open.c
ktest: Add timeout for ssh sync testing
drm/amd/display: remove duplicated assignment to grph_obj_type
* workqueue: don't use wq_select_unbound_cpu() for bound works
kernel/workqueue.c
iommu/vt-d: quirk_ioat_snb_local_iommu: replace WARN_TAINT with pr_warn + add_taint
virtio-blk: fix hw_queue stopped on arbitrary error
iwlwifi: mvm: Do not require PHY_SKU NVM section for 3168 devices
* cgroup: Iterate tasks that did not finish do_exit()
include/linux/cgroup.h
kernel/cgroup/cgroup.c
* cgroup: cgroup_procs_next should increase position index
kernel/cgroup/cgroup.c
ipvlan: don't deref eth hdr before checking it's set
ipvlan: egress mcast packets are not exceptional
ipvlan: do not add hardware address of master to its unicast filter list
* inet_diag: return classid for all socket types
include/linux/inet_diag.h
net/ipv4/inet_diag.c
net/ipv4/udp_diag.c
macvlan: add cond_resched() during multicast processing
net: fec: validate the new settings in fec_enet_set_coalesce()
* slip: make slhc_compress() more robust against malicious packets
drivers/net/slip/slhc.c
* bonding/alb: make sure arp header is pulled before accessing it
drivers/net/bonding/bond_alb.c
* net: phy: fix MDIO bus PM PHY resuming
drivers/net/phy/phy_device.c
include/linux/phy.h
nfc: add missing attribute validation for vendor subcommand
nfc: add missing attribute validation for SE API
team: add missing attribute validation for array index
team: add missing attribute validation for port ifindex
net: fq: add missing attribute validation for orphan mask
macsec: add missing attribute validation for port
can: add missing attribute validation for termination
nl802154: add missing attribute validation for dev_type
nl802154: add missing attribute validation
* fib: add missing attribute validation for tun_id
include/net/fib_rules.h
* net: memcg: fix lockdep splat in inet_csk_accept()
net/ipv4/inet_connection_sock.c
* net: memcg: late association of sock to memcg
mm/memcontrol.c
net/core/sock.c
net/ipv4/inet_connection_sock.c
* cgroup: memcg: net: do not associate sock with unrelated cgroup
kernel/cgroup/cgroup.c
mm/memcontrol.c
bnxt_en: reinitialize IRQs when MTU is modified
sfc: detach from cb_page in efx_copy_channel()
* r8152: check disconnect status after long sleep
drivers/net/usb/r8152.c
* net/packet: tpacket_rcv: do not increment ring index on drop
net/packet/af_packet.c
net: nfc: fix bounds checking bugs on "pipe"
net: macsec: update SCI upon MAC address change.
* netlink: Use netlink header as base to calculate bad attribute offset
net/netlink/af_netlink.c
ipvlan: do not use cond_resched_rcu() in ipvlan_process_multicast()
ipvlan: add cond_resched_rcu() while processing muticast backlog
* ipv6/addrconf: call ipv6_mc_up() for non-Ethernet interface
net/ipv6/addrconf.c
* gre: fix uninit-value in __iptunnel_pull_header
net/ipv4/gre_demux.c
cgroup, netclassid: periodically release file_lock on classid updating
* net: phy: Avoid multiple suspends
drivers/net/phy/phy_device.c
* phy: Revert toggling reset changes.
drivers/net/phy/phy_device.c
Merge 4.14.173 into android-4.14-q
Linux 4.14.173
ASoC: topology: Fix memleak in soc_tplg_manifest_load()
* xhci: handle port status events for removed USB3 hcd
drivers/usb/host/xhci-ring.c
dm integrity: fix a deadlock due to offloading to an incorrect workqueue
powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems
dmaengine: coh901318: Fix a double lock bug in dma_tc_handle()
hwmon: (adt7462) Fix an error return in ADT7462_REG_VOLT()
ARM: imx: build v7_cpu_resume() unconditionally
IB/hfi1, qib: Ensure RCU is locked when accessing list
RMDA/cm: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen()
RDMA/iwcm: Fix iwcm work deallocation
* ASoC: dapm: Correct DAPM handling of active widgets during shutdown
sound/soc/soc-dapm.c
ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path
* ASoC: pcm: Fix possible buffer overflow in dpcm state sysfs output
sound/soc/soc-pcm.c
ASoC: intel: skl: Fix possible buffer overflow in debug outputs
ASoC: intel: skl: Fix pin debug prints
ASoC: topology: Fix memleak in soc_tplg_link_elems_load()
ARM: dts: ls1021a: Restore MDIO compatible to gianfar
dm cache: fix a crash due to incorrect work item cancelling
dmaengine: tegra-apb: Prevent race conditions of tasklet vs free list
dmaengine: tegra-apb: Fix use-after-free
x86/pkeys: Manually set X86_FEATURE_OSPKE to preserve existing changes
* vt: selection, push sel_lock up
drivers/tty/vt/selection.c
* vt: selection, push console lock down
drivers/tty/vt/selection.c
drivers/tty/vt/vt.c
* vt: selection, close sel_buffer race
drivers/tty/vt/selection.c
serial: 8250_exar: add support for ACCES cards
tty:serial:mvebu-uart:fix a wrong return
arm: dts: dra76x: Fix mmc3 max-frequency
* fat: fix uninit-memory access for partial initialized inode
fs/fat/inode.c
* mm, numa: fix bad pmd by atomically check for pmd_trans_huge when marking page tables prot_numa
mm/mprotect.c
vgacon: Fix a UAF in vgacon_invert_region
* usb: core: port: do error out if usb_autopm_get_interface() fails
drivers/usb/core/port.c
* usb: core: hub: do error out if usb_autopm_get_interface() fails
drivers/usb/core/hub.c
* usb: core: hub: fix unhandled return by employing a void function
drivers/usb/core/hub.c
* usb: quirks: add NO_LPM quirk for Logitech Screen Share
drivers/usb/core/quirks.c
* usb: storage: Add quirk for Samsung Fit flash
drivers/usb/storage/unusual_devs.h
cifs: don't leak -EAGAIN for stat() during reconnect
net: thunderx: workaround BGX TX Underflow issue
x86/xen: Distribute switch variables for initialization
nvme: Fix uninitialized-variable warning
x86/boot/compressed: Don't declare __force_order in kaslr_64.c
s390/cio: cio_ignore_proc_seq_next should increase position index
watchdog: da9062: do not ping the hw during stop()
net: ks8851-ml: Fix 16-bit IO operation
net: ks8851-ml: Fix 16-bit data access
net: ks8851-ml: Remove 8-bit bus accessors
drm/msm/dsi: save pll state before dsi host is powered off
drm: msm: Fix return type of dsi_mgr_connector_mode_valid for kCFI
drm/msm/mdp5: rate limit pp done timeout warnings
usb: gadget: serial: fix Tx stall after buffer overflow
* usb: gadget: ffs: ffs_aio_cancel(): Save/restore IRQ flags
drivers/usb/gadget/function/f_fs.c
* usb: gadget: composite: Support more than 500mA MaxPower
drivers/usb/gadget/composite.c
selftests: fix too long argument
serial: ar933x_uart: set UART_CS_{RX,TX}_READY_ORIDE
kprobes: Fix optimize_kprobe()/unoptimize_kprobe() cancellation logic
RDMA/core: Fix use of logical OR in get_new_pps
RDMA/core: Fix pkey and port assignment in get_new_pps
net: dsa: bcm_sf2: Forcibly configure IMP port for 1Gb/sec
EDAC/amd64: Set grain per DIMM
x86/mce: Handle varying MCA bank counts
vhost: Check docket sk_family instead of call getname
* audit: always check the netlink payload length in audit_receive_msg()
kernel/audit.c
* Revert "char/random: silence a lockdep splat with printk()"
drivers/char/random.c
mm, thp: fix defrag setting if newline is not used
mm/huge_memory.c: use head to check huge zero page
perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc
kprobes: Set unoptimized flag after unoptimizing code
drivers: net: xgene: Fix the order of the arguments of 'alloc_etherdev_mqs()'
* tuntap: correctly set SOCKWQ_ASYNC_NOSPACE
drivers/net/tun.c
KVM: Check for a bad hva before dropping into the ghc slow path
KVM: SVM: Override default MMIO mask if memory encryption is enabled
mwifiex: drop most magic numbers from mwifiex_process_tdls_action_frame()
* namei: only return -ECHILD from follow_dotdot_rcu()
fs/namei.c
net: ena: make ena rxfh support ETH_RSS_HASH_NO_CHANGE
net: atlantic: fix potential error handling
* net: netlink: cap max groups which will be considered in netlink_bind()
net/netlink/af_netlink.c
* include/linux/bitops.h: introduce BITS_PER_TYPE
include/linux/bitops.h
* ecryptfs: Fix up bad backport of fe2e082f5da5b4a0a92ae32978f81507ef37ec66
fs/ecryptfs/keystore.c
* usb: charger: assign specific number for enum value
include/uapi/linux/usb/charger.h
drm/i915/gvt: Separate display reset from ALL_ENGINES reset
i2c: jz4780: silence log flood on txabrt
i2c: altera: Fix potential integer overflow
MIPS: VPE: Fix a double free and a memory leak in 'release_vpe()'
* HID: hiddev: Fix race in in hiddev_disconnect()
drivers/hid/usbhid/hiddev.c
* Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
drivers/devfreq/devfreq.c
* tracing: Disable trace_printk() on post poned tests
kernel/trace/trace.c
* HID: core: increase HID report buffer size to 8KiB
include/linux/hid.h
* HID: core: fix off-by-one memset in hid_report_raw_event()
drivers/hid/hid-core.c
HID: ite: Only bind to keyboard USB interface on Acer SW5-012 keyboard dock
KVM: VMX: check descriptor table exits on instruction emulation
ACPI: watchdog: Fix gas->access_width usage
* ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
include/acpi/actypes.h
* audit: fix error handling in audit_data_to_entry()
kernel/auditfilter.c
* ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
fs/ext4/super.c
* net: sched: correct flower port blocking
include/net/flow_dissector.h
qede: Fix race between rdma destroy workqueue and link change event
* ipv6: Fix route replacement with dev-only route
net/ipv6/ip6_fib.c
* ipv6: Fix nlmsg_flags when splitting a multipath route
net/ipv6/route.c
sctp: move the format error check out of __sctp_sf_do_9_1_abort
nfc: pn544: Fix occasional HW initialization failure
net: phy: restore mdio regs in the iproc mdio driver
* net: fib_rules: Correctly set table field when table number exceeds 8 bits
net/core/fib_rules.c
* sysrq: Remove duplicated sysrq message
drivers/tty/sysrq.c
* sysrq: Restore original console_loglevel when sysrq disabled
drivers/tty/sysrq.c
* cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE
net/wireless/nl80211.c
cifs: Fix mode output in debugging statements
net: ena: ena-com.c: prevent NULL pointer dereference
net: ena: ethtool: use correct value for crc32 hash
net: ena: fix incorrectly saving queue numbers when setting RSS indirection table
net: ena: rss: store hash function as values and not bits
net: ena: rss: fix failure to get indirection table
net: ena: fix incorrect default RSS key
net: ena: add missing ethtool TX timestamping indication
net: ena: fix uses of round_jiffies()
net: ena: fix potential crash when rxfh key is NULL
qmi_wwan: unconditionally reject 2 ep interfaces
qmi_wwan: re-add DW5821e pre-production variant
* cfg80211: check wiphy driver existence for drvinfo report
net/wireless/ethtool.c
mac80211: consider more elements in parsing CRC
dax: pass NOWAIT flag to iomap_apply
* drm/msm: Set dma maximum segment size for mdss
drivers/gpu/drm/msm/msm_drv.c
ipmi:ssif: Handle a possible NULL pointer reference
* ext4: fix potential race between s_group_info online resizing and access
fs/ext4/ext4.h
fs/ext4/mballoc.c
* ext4: fix potential race between s_flex_groups online resizing and access
fs/ext4/ext4.h
fs/ext4/ialloc.c
fs/ext4/mballoc.c
fs/ext4/resize.c
fs/ext4/super.c
* ext4: fix potential race between online resizing and write operations
fs/ext4/balloc.c
fs/ext4/ext4.h
fs/ext4/resize.c
fs/ext4/super.c
* netfilter: nf_conntrack: resolve clash for matching conntracks
net/netfilter/nf_conntrack_core.c
iwlwifi: pcie: fix rb_allocator workqueue allocation
* UPSTREAM: binder: fix incorrect calculation for num_valid
drivers/android/binder.c
Merge 4.14.172 into android-4.14-q
* UPSTREAM: sched/psi: Fix OOB write when writing 0 bytes to PSI files
kernel/sched/psi.c
* UPSTREAM: psi: Fix a division error in psi poll()
kernel/sched/psi.c
* UPSTREAM: sched/psi: Fix sampling error and rare div0 crashes with cgroups and high uptime
kernel/sched/psi.c
* UPSTREAM: sched/psi: Correct overly pessimistic size calculation
kernel/sched/psi.c
Linux 4.14.172
s390/mm: Explicitly compare PAGE_DEFAULT_KEY against zero in storage_key_init_range
xen: Enable interrupts when calling _cond_resched()
ata: ahci: Add shutdown to freeze hardware resources of ahci
* netfilter: xt_hashlimit: limit the max size of hashtable
net/netfilter/xt_hashlimit.c
ALSA: seq: Fix concurrent access to queue current tick/time
ALSA: seq: Avoid concurrent access to queue flags
* ALSA: rawmidi: Avoid bit fields for state flags
include/sound/rawmidi.h
* genirq/proc: Reject invalid affinity masks (again)
kernel/irq/internals.h
kernel/irq/manage.c
kernel/irq/proc.c
iommu/vt-d: Fix compile warning from intel-svm.h
* ecryptfs: replace BUG_ON with error handling code
fs/ecryptfs/crypto.c
staging: greybus: use after free in gb_audio_manager_remove_all()
staging: rtl8723bs: fix copy of overlapping memory
* usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus
drivers/usb/gadget/composite.c
scsi: Revert "target: iscsi: Wait for all commands to finish before freeing a session"
scsi: Revert "RDMA/isert: Fix a recently introduced regression related to logout"
Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents
btrfs: do not check delayed items are empty for single transaction cleanup
btrfs: fix bytes_may_use underflow in prealloc error condtition
KVM: apic: avoid calculating pending eoi from an uninitialized val
KVM: nVMX: handle nested posted interrupts when apicv is disabled for L1
KVM: nVMX: Check IO instruction VM-exit conditions
KVM: nVMX: Refactor IO bitmap checks into helper function
* ext4: fix race between writepages and enabling EXT4_EXTENTS_FL
fs/ext4/ext4.h
fs/ext4/migrate.c
* ext4: rename s_journal_flag_rwsem to s_writepages_rwsem
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/super.c
* ext4: fix mount failure with quota configured as module
fs/ext4/super.c
* ext4: add cond_resched() to __ext4_find_entry()
fs/ext4/namei.c
* ext4: fix a data race in EXT4_I(inode)->i_disksize
fs/ext4/ext4.h
fs/ext4/inode.c
KVM: nVMX: Don't emulate instructions in guest mode
lib/stackdepot.c: fix global out-of-bounds in stack_slabs
serial: 8250: Check UPF_IRQ_SHARED in advance
* vt: vt_ioctl: fix race in VT_RESIZEX
drivers/tty/vt/vt_ioctl.c
* VT_RESIZEX: get rid of field-by-field copyin
drivers/tty/vt/vt_ioctl.c
* xhci: apply XHCI_PME_STUCK_QUIRK to Intel Comet Lake platforms
drivers/usb/host/xhci-pci.c
KVM: x86: don't notify userspace IOAPIC on edge-triggered interrupt EOI
drm/amdgpu/soc15: fix xclk for raven
* mm/vmscan.c: don't round up scan size for online memory cgroup
mm/vmscan.c
Revert "ipc,sem: remove uneeded sem_undo_list lock usage in exit_sem()"
MAINTAINERS: Update drm/i915 bug filing URL
* serdev: ttyport: restore client ops on deregistration
drivers/tty/tty_port.c
include/linux/tty.h
tty: serial: imx: setup the correct sg entry for tx dma
tty/serial: atmel: manage shutdown in case of RS485 or ISO7816 mode
x86/mce/amd: Fix kobject lifetime
x86/mce/amd: Publish the bank pointer only after setup has succeeded
staging: rtl8723bs: Fix potential overuse of kernel memory
staging: rtl8723bs: Fix potential security hole
staging: rtl8188eu: Fix potential overuse of kernel memory
staging: rtl8188eu: Fix potential security hole
* USB: hub: Fix the broken detection of USB3 device in SMSC hub
drivers/usb/core/hub.c
drivers/usb/core/hub.h
* USB: hub: Don't record a connect-change event during reset-resume
drivers/usb/core/hub.c
* USB: Fix novation SourceControl XL after suspend
drivers/usb/core/quirks.c
usb: uas: fix a plug & unplug racing
* usb: host: xhci: update event ring dequeue pointer on purpose
drivers/usb/host/xhci-ring.c
* xhci: fix runtime pm enabling for quirky Intel hosts
drivers/usb/host/xhci-pci.c
* xhci: Force Maximum Packet size for Full-speed bulk devices to valid range.
drivers/usb/host/xhci-mem.c
staging: vt6656: fix sign of rx_dbm to bb_pre_ed_rssi.
* staging: android: ashmem: Disallow ashmem memory from being remapped
drivers/staging/android/ashmem.c
* vt: selection, handle pending signals in paste_selection
drivers/tty/vt/selection.c
floppy: check FDC index for errors before assigning it
USB: misc: iowarrior: add support for the 100 device
USB: misc: iowarrior: add support for the 28 and 28L devices
USB: misc: iowarrior: add support for 2 OEMed devices
thunderbolt: Prevent crash if non-active NVMem file is read
net/smc: fix leak of kernel memory to user space
net/sched: flower: add missing validation of TCA_FLOWER_FLAGS
net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS
net: dsa: tag_qca: Make sure there is headroom for tag
enic: prevent waking up stopped tx queues over watchdog reset
* selinux: ensure we cleanup the internal AVC counters on error in avc_update()
security/selinux/avc.c
mlxsw: spectrum_dpipe: Add missing error path
virtio_balloon: prevent pfn array overflow
help_next should increase position index
* brd: check and limit max_part par
drivers/block/brd.c
microblaze: Prevent the overflow of the start
iwlwifi: mvm: Fix thermal zone registration
* irqchip/gic-v3-its: Reference to its_invall_cmd descriptor when building INVALL
drivers/irqchip/irq-gic-v3-its.c
bcache: explicity type cast in bset_bkey_last()
reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
* lib/scatterlist.c: adjust indentation in __sg_alloc_table
lib/scatterlist.c
ocfs2: fix a NULL pointer dereference when call ocfs2_update_inode_fsync_trans()
radeon: insert 10ms sleep in dce5_crtc_load_lut
* trigger_next should increase position index
kernel/trace/trace_events_trigger.c
ftrace: fpid_next() should increase position index
drm/nouveau/disp/nv50-: prevent oops when no channel method map provided
* irqchip/gic-v3: Only provision redistributors that are enabled in ACPI
drivers/irqchip/irq-gic-v3.c
ceph: check availability of mds cluster on mount after wait timeout
cifs: fix NULL dereference in match_prepath
iwlegacy: ensure loop counter addr does not wrap and cause an infinite loop
hostap: Adjust indentation in prism2_hostapd_add_sta
ARM: 8951/1: Fix Kexec compilation issue.
* jbd2: make sure ESHUTDOWN to be recorded in the journal superblock
fs/jbd2/journal.c
* jbd2: switch to use jbd2_journal_abort() when failed to submit the commit record
fs/jbd2/commit.c
powerpc/sriov: Remove VF eeh_dev state when disabling SR-IOV
ALSA: hda - Add docking station support for Lenovo Thinkpad T420s
* driver core: platform: fix u32 greater or equal to zero comparison
drivers/base/platform.c
s390/ftrace: generate traced function stack frame
x86/decoder: Add TEST opcode to Group3-2
ALSA: hda/hdmi - add retry logic to parse_intel_hdmi()
irqchip/mbigen: Set driver .suppress_bind_attrs to avoid remove problems
remoteproc: Initialize rproc_class before use
btrfs: device stats, log when stats are zeroed
btrfs: safely advance counter when looking up bio csums
btrfs: fix possible NULL-pointer dereference in integrity checks
pwm: Remove set but not set variable 'pwm'
ide: serverworks: potential overflow in svwks_set_pio_mode()
cmd64x: potential buffer overflow in cmd64x_program_timings()
pwm: omap-dmtimer: Remove PWM chip in .remove before making it unfunctional
x86/mm: Fix NX bit clearing issue in kernel_map_pages_in_pgd
* f2fs: fix memleak of kobject
fs/f2fs/sysfs.c
watchdog/softlockup: Enforce that timestamp is valid on boot
* arm64: fix alternatives with LLVM's integrated assembler
arch/arm64/include/asm/alternative.h
scsi: iscsi: Don't destroy session if there are outstanding connections
* f2fs: free sysfs kobject
fs/f2fs/sysfs.c
iommu/arm-smmu-v3: Use WRITE_ONCE() when changing validity of an STE
usb: musb: omap2430: Get rid of musb .set_vbus for omap2430 glue
drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add
drm/nouveau: Fix copy-paste error in nouveau_fence_wait_uevent_handler
drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw
drm/nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()
vme: bridges: reduce stack usage
* driver core: Print device when resources present in really_probe()
drivers/base/dd.c
* driver core: platform: Prevent resouce overflow from causing infinite loops
drivers/base/platform.c
tty: synclink_gt: Adjust indentation in several functions
tty: synclinkmp: Adjust indentation in several functions
* ASoC: atmel: fix build error with CONFIG_SND_ATMEL_SOC_DMA=m
sound/soc/atmel/Kconfig
wan: ixp4xx_hss: fix compile-testing on 64-bit
Input: edt-ft5x06 - work around first register access error
* rcu: Use WRITE_ONCE() for assignments to ->pprev for hlist_nulls
include/linux/list_nulls.h
include/linux/rculist_nulls.h
efi/x86: Don't panic or BUG() on non-critical error conditions
soc/tegra: fuse: Correct straps' address for older Tegra124 device trees
IB/hfi1: Add software counter for ctxt0 seq drop
udf: Fix free space reporting for metadata and virtual partitions
usbip: Fix unsafe unaligned pointer usage
* drm: remove the newline for CRC source name.
drivers/gpu/drm/drm_debugfs_crc.c
tools lib api fs: Fix gcc9 stringop-truncation compilation error
ALSA: sh: Fix compile warning wrt const
ALSA: sh: Fix unused variable warnings
clk: sunxi-ng: add mux and pll notifiers for A64 CPU clock
RDMA/rxe: Fix error type of mmap_offset
pinctrl: sh-pfc: sh7269: Fix CAN function GPIOs
* PM / devfreq: rk3399_dmc: Add COMPILE_TEST and HAVE_ARM_SMCCC dependency
drivers/devfreq/Kconfig
drivers/devfreq/event/Kconfig
x86/vdso: Provide missing include file
* dmaengine: Store module owner in dma_device struct
drivers/dma/dmaengine.c
include/linux/dmaengine.h
ARM: dts: r8a7779: Add device node for ARM global timer
drm/mediatek: handle events when enabling/disabling crtc
scsi: aic7xxx: Adjust indentation in ahc_find_syncrate
* scsi: ufs: Complete pending requests in host reset and restore path
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h
ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
orinoco: avoid assertion in case of NULL pointer
rtlwifi: rtl_pci: Fix -Wcast-function-type
iwlegacy: Fix -Wcast-function-type
ipw2x00: Fix -Wcast-function-type
b43legacy: Fix -Wcast-function-type
ALSA: usx2y: Adjust indentation in snd_usX2Y_hwdep_dsp_status
fore200e: Fix incorrect checks of NULL pointer dereference
reiserfs: Fix spurious unlock in reiserfs_fill_super() error handling
* media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros
include/media/v4l2-device.h
ARM: dts: imx6: rdu2: Disable WP for USDHC2 and USDHC3
arm64: dts: qcom: msm8996: Disable USB2 PHY suspend by core
NFC: port100: Convert cpu_to_le16(le16_to_cpu(E1) + E2) to use le16_add_cpu().
PCI/IOV: Fix memory leak in pci_iov_add_virtfn()
net/wan/fsl_ucc_hdlc: reject muram offsets above 64K
regulator: rk808: Lower log level on optional GPIOs being not available
drm/amdgpu: remove 4 set but not used variable in amdgpu_atombios_get_connector_info_from_object_table
* clk: qcom: rcg2: Don't crash if our parent can't be found; return an error
drivers/clk/qcom/clk-rcg2.c
* kconfig: fix broken dependency in randconfig-generated .config
scripts/kconfig/confdata.c
KVM: s390: ENOTSUPP -> EOPNOTSUPP fixups
nbd: add a flush_workqueue in nbd_start_device
* ext4, jbd2: ensure panic when aborting with zero errno
fs/jbd2/checkpoint.c
fs/jbd2/journal.c
* tracing: Fix very unlikely race of registering two stat tracers
kernel/trace/trace_stat.c
* tracing: Fix tracing_stat return values in error handling paths
kernel/trace/trace_stat.c
x86/sysfb: Fix check for bad VRAM size
* jbd2: clear JBD2_ABORT flag before journal_reset to update log tail info when load journal
fs/jbd2/journal.c
kselftest: Minimise dependency of get_size on C library interfaces
clocksource/drivers/bcm2835_timer: Fix memory leak of timer
usb: dwc2: Fix IN FIFO allocation
usb: gadget: udc: fix possible sleep-in-atomic-context bugs in gr_probe()
uio: fix a sleep-in-atomic-context bug in uio_dmem_genirq_irqcontrol()
sparc: Add .exit.data section.
MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init()
efi/x86: Map the entire EFI vendor string before copying it
pinctrl: baytrail: Do not clear IRQ flags on direct-irq enabled pins
media: sti: bdisp: fix a possible sleep-in-atomic-context bug in bdisp_device_run()
* char/random: silence a lockdep splat with printk()
drivers/char/random.c
gpio: gpio-grgpio: fix possible sleep-in-atomic-context bugs in grgpio_irq_map/unmap()
powerpc/powernv/iov: Ensure the pdn for VFs always contains a valid PE number
media: i2c: mt9v032: fix enum mbus codes and frame sizes
pxa168fb: Fix the function used to release some memory in an error handling path
pinctrl: sh-pfc: sh7264: Fix CAN function GPIOs
gianfar: Fix TX timestamping with a stacked DSA driver
* ALSA: ctl: allow TLV read operation for callback type of element in locked case
sound/core/control.c
* ext4: fix ext4_dax_read/write inode locking sequence for IOCB_NOWAIT
fs/ext4/file.c
leds: pca963x: Fix open-drain initialization
brcmfmac: Fix use after free in brcmf_sdio_readframes()
* cpu/hotplug, stop_machine: Fix stop_machine vs hotplug order
kernel/cpu.c
drm/gma500: Fixup fbdev stolen size usage evaluation
KVM: nVMX: Use correct root level for nested EPT shadow page tables
Revert "KVM: VMX: Add non-canonical check on writes to RTIT address MSRs"
Revert "KVM: nVMX: Use correct root level for nested EPT shadow page tables"
scsi: qla2xxx: fix a potential NULL pointer dereference
* jbd2: do not clear the BH_Mapped flag when forgetting a metadata buffer
fs/jbd2/commit.c
* jbd2: move the clearing of b_modified flag to the journal_unmap_buffer()
fs/jbd2/commit.c
fs/jbd2/transaction.c
hwmon: (pmbus/ltc2978) Fix PMBus polling of MFR_COMMON definitions.
perf/x86/intel: Fix inaccurate period in context switch for auto-reload
s390/time: Fix clk type in get_tod_clock
RDMA/core: Fix protection fault in get_pkey_idx_qp_list
IB/hfi1: Close window for pq and request coliding
serial: imx: Only handle irqs that are actually enabled
serial: imx: ensure that RX irqs are off if RX is off
padata: Remove broken queue flushing
perf/x86/amd: Add missing L2 misses event spec to AMD Family 17h's event map
KVM: nVMX: Use correct root level for nested EPT shadow page tables
* arm64: ssbs: Fix context-switch when SSBS is present on all CPUs
arch/arm64/kernel/process.c
btrfs: log message when rw remount is attempted with unclean tree-log
btrfs: print message when tree-log replay starts
Btrfs: fix race between using extent maps and merging them
* ext4: improve explanation of a mount failure caused by a misconfigured kernel
fs/ext4/super.c
* ext4: fix checksum errors with indexed dirs
fs/ext4/dir.c
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/namei.c
* ext4: fix support for inode sizes > 1024 bytes
fs/ext4/super.c
* ext4: don't assume that mmp_nodename/bdevname have NUL
fs/ext4/mmp.c
ARM: 8723/2: always assume the "unified" syntax for assembly code
* arm64: nofpsimd: Handle TIF_FOREIGN_FPSTATE flag cleanly
arch/arm64/kernel/fpsimd.c
* arm64: ptrace: nofpsimd: Fail FP/SIMD regset operations
arch/arm64/kernel/ptrace.c
* arm64: cpufeature: Set the FP/SIMD compat HWCAP bits properly
arch/arm64/kernel/cpufeature.c
* ALSA: usb-audio: Apply sample rate quirk for Audioengine D1
sound/usb/quirks.c
Input: synaptics - remove the LEN0049 dmi id from topbuttonpad list
Input: synaptics - enable SMBus on ThinkPad L470
Input: synaptics - switch T470s to RMI4 by default
* ecryptfs: fix a memory leak bug in ecryptfs_init_messaging()
fs/ecryptfs/messaging.c
* ecryptfs: fix a memory leak bug in parse_tag_1_packet()
fs/ecryptfs/keystore.c
ASoC: sun8i-codec: Fix setting DAI data format
ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs
iommu/qcom: Fix bogus detach logic
KVM: x86: emulate RDPID
* ANDROID: net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head
net/core/filter.c
Merge 4.14.171 into android-4.14-q
Linux 4.14.171
libertas: make lbs_ibss_join_existing() return error code on rates overflow
libertas: don't exit from lbs_ibss_join_existing() with RCU read lock held
mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
serial: uartps: Move the spinlock after the read of the tx empty
* dm: fix potential for q->make_request_fn NULL pointer
drivers/md/dm.c
scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state
pinctrl: sh-pfc: r8a7778: Fix duplicate SDSELF_B and SD1_CLK_B
media: i2c: adv748x: Fix unsafe macros
crypto: atmel-sha - fix error handling when setting hmac key
crypto: artpec6 - return correct error code for failed setkey()
KVM: arm/arm64: Fix young bit from mmu notifier
* arm64: cpufeature: Fix the type of no FP/SIMD capability
arch/arm64/kernel/cpufeature.c
ARM: 8949/1: mm: mark free_memmap as __init
KVM: arm/arm64: vgic-its: Fix restoration of unmapped collections
powerpc/pseries: Allow not having ibm, hypertas-functions::hcall-multi-tce for DDW
powerpc/pseries/vio: Fix iommu_table use-after-free refcount warning
tools/power/acpi: fix compilation error
ARM: dts: at91: sama5d3: define clock rate range for tcb1
ARM: dts: at91: sama5d3: fix maximum peripheral clock rates
platform/x86: intel_mid_powerbtn: Take a copy of ddata
ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node
rtc: cmos: Stop using shared IRQ
rtc: hym8563: Return -EINVAL if the time is known to be invalid
serial: uartps: Add a timeout to the tx empty wait
NFSv4: try lease recovery on NFS4ERR_EXPIRED
NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes()
* nfs: NFS_SWAP should depend on SWAP
fs/nfs/Kconfig
* PCI: Don't disable bridge BARs when assigning bus resources
drivers/pci/setup-bus.c
PCI/switchtec: Fix vep_vector_number ioread width
* scsi: ufs: Fix ufshcd_probe_hba() reture value in case ufshcd_scsi_add_wlus() fails
drivers/scsi/ufs/ufshcd.c
RDMA/netlink: Do not always generate an ACK for some netlink operations
hv_sock: Remove the accept port restriction
* ASoC: pcm: update FE/BE trigger order based on the command
sound/soc/soc-pcm.c
rxrpc: Fix service call disconnection
* perf/core: Fix mlock accounting in perf_mmap()
kernel/events/core.c
* clocksource: Prevent double add_timer_on() for watchdog_timer
kernel/time/clocksource.c
cifs: fail i/o on soft mounts if sessionsetup errors out
KVM: s390: do not clobber registers during guest reset/store status
KVM: Play nice with read-only memslots when querying host page size
* KVM: Use vcpu-specific gva->hva translation when querying host page size
include/linux/kvm_host.h
KVM: nVMX: vmread should not set rflags to specify success in case of #PF
KVM: VMX: Add non-canonical check on writes to RTIT address MSRs
KVM: x86/mmu: Apply max PA check for MMIO sptes to 32-bit KVM
KVM: x86: Fix potential put_fpu() w/o load_fpu() on MPX platform
btrfs: flush write bio if we loop in extent_write_cache_pages
KVM: x86: Protect pmu_intel.c from Spectre-v1/L1TF attacks
drm: atmel-hlcdc: enable clock before configuring timing engine
Btrfs: fix race between adding and putting tree mod seq elements and nodes
btrfs: remove trivial locking wrappers of tree mod log
btrfs: free block groups after free'ing fs trees
btrfs: use bool argument in free_root_pointers()
Btrfs: fix missing hole after hole punching and fsync when using NO_HOLES
Btrfs: fix assertion failure on fsync with NO_HOLES enabled
btrfs: Get rid of the confusing btrfs_file_extent_inline_len
* ext4: fix deadlock allocating crypto bounce page from mempool
fs/ext4/page-io.c
* bonding/alb: properly access headers in bond_alb_xmit()
drivers/net/bonding/bond_alb.c
net: macb: Limit maximum GEM TX length in TSO
net: macb: Remove unnecessary alignment check for TSO
net: systemport: Avoid RBUF stuck in Wake-on-LAN mode
net_sched: fix a resource leak in tcindex_set_parms()
net: dsa: bcm_sf2: Only 7278 supports 2Gb/sec IMP port
mfd: rn5t618: Mark ADC control register volatile
mfd: da9062: Fix watchdog compatible string
ubi: Fix an error pointer dereference in error handling code
ubi: fastmap: Fix inverted logic in seen selfcheck
nfsd: fix jiffies/time_t mixup in LRU list
nfsd: fix delay timer on 32-bit architectures
IB/core: Fix ODP get user pages flow
IB/mlx5: Fix outstanding_pi index for GSI qps
net: tulip: Adjust indentation in {dmfe, uli526x}_init_module
net: smc911x: Adjust indentation in smc911x_phy_configure
* ppp: Adjust indentation into ppp_async_input
drivers/net/ppp/ppp_async.c
NFC: pn544: Adjust indentation in pn544_hci_check_presence
powerpc/44x: Adjust indentation in ibm4xx_denali_fixup_memsize
ext2: Adjust indentation in ext2_fill_super
phy: qualcomm: Adjust indentation in read_poll_timeout
* scsi: ufs: Recheck bkops level if bkops is disabled
drivers/scsi/ufs/ufshcd.c
scsi: qla4xxx: Adjust indentation in qla4xxx_mem_free
scsi: csiostor: Adjust indentation in csio_device_reset
scsi: qla2xxx: Fix the endianness of the qla82xx_get_fw_size() return type
clk: tegra: Mark fuse clock as critical
KVM: x86: Free wbinvd_dirty_mask if vCPU creation fails
KVM: PPC: Book3S PR: Free shared page if mmu initialization fails
KVM: PPC: Book3S HV: Uninit vCPU if vcore creation fails
KVM: x86: Protect MSR-based index computations in fixed_msr_to_seg_unit() from Spectre-v1/L1TF attacks
KVM: x86: Protect x86_decode_insn from Spectre-v1/L1TF attacks
KVM: x86: Protect MSR-based index computations from Spectre-v1/L1TF attacks in x86.c
KVM: x86: Protect ioapic_read_indirect() from Spectre-v1/L1TF attacks
KVM: x86: Protect MSR-based index computations in pmu.h from Spectre-v1/L1TF attacks
KVM: x86: Protect ioapic_write_indirect() from Spectre-v1/L1TF attacks
KVM: x86: Protect kvm_hv_msr_[get|set]_crash_data() from Spectre-v1/L1TF attacks
KVM: x86: Protect kvm_lapic_reg_write() from Spectre-v1/L1TF attacks
KVM: x86: Protect DR-based index computations from Spectre-v1/L1TF attacks
KVM: x86: Refactor prefix decoding to prevent Spectre-v1/L1TF attacks
KVM: x86: Refactor picdev_write() to prevent Spectre-v1/L1TF attacks
xen/balloon: Support xend-based toolstack take two
tools/kvm_stat: Fix kvm_exit filter name
sunrpc: expiry_time should be seconds not timeval
mwifiex: fix unbalanced locking in mwifiex_process_country_ie()
iwlwifi: don't throw error when trying to remove IGTK
ARM: tegra: Enable PLLP bypass during Tegra124 LP1
btrfs: set trans->drity in btrfs_commit_transaction
NFS: Directory page cache pages need to be locked when read
NFS: Fix memory leaks and corruption in readdir
scsi: qla2xxx: Fix unbound NVME response length
crypto: picoxcell - adjust the position of tasklet_init and fix missed tasklet_kill
* crypto: api - Fix race condition in crypto_spawn_alg
crypto/algapi.c
crypto/api.c
crypto/internal.h
crypto: atmel-aes - Fix counter overflow in CTR mode
crypto: pcrypt - Do not clear MAY_SLEEP flag in original request
crypto: ccp - set max RSA modulus size for v3 platform devices as well
samples/bpf: Don't try to remove user's homedir on clean
* ftrace: Protect ftrace_graph_hash with ftrace_sync
kernel/trace/trace.h
* ftrace: Add comment to why rcu_dereference_sched() is open coded
kernel/trace/trace.h
* tracing: Annotate ftrace_graph_notrace_hash pointer with __rcu
kernel/trace/trace.h
* tracing: Annotate ftrace_graph_hash pointer with __rcu
kernel/trace/trace.h
dm crypt: fix benbi IV constructor crash if used in authenticated mode
dm space map common: fix to ensure new block isn't already in use
dm zoned: support zone sizes smaller than 128MiB
* of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc
drivers/of/Kconfig
drivers/of/address.c
* PM: core: Fix handling of devices deleted during system-wide resume
drivers/base/power/main.c
* f2fs: code cleanup for f2fs_statfs_project()
fs/f2fs/super.c
* f2fs: fix miscounted block limit in f2fs_statfs_project()
fs/f2fs/super.c
* f2fs: choose hardlimit when softlimit is larger than hardlimit in f2fs_statfs_project()
fs/f2fs/super.c
power: supply: ltc2941-battery-gauge: fix use-after-free
scsi: qla2xxx: Fix mtcp dump collection failure
* crypto: api - Check spawn->alg under lock in crypto_drop_spawn
crypto/algapi.c
hv_balloon: Balloon up according to request page number
ubifs: don't trigger assertion on invalid no-key filename
mmc: sdhci-of-at91: fix memleak on clk_get failure
PCI: keystone: Fix link training retries initiation
ubifs: Fix deadlock in concurrent bulk-read and writepage
ubifs: Fix FS_IOC_SETFLAGS unexpectedly clearing encrypt flag
ubifs: Reject unsupported ioctl flags explicitly
* alarmtimer: Unregister wakeup source when module get fails
kernel/time/alarmtimer.c
ACPI: video: Do not export a non working backlight interface on MSI MS-7721 boards
mmc: spi: Toggle SPI polarity, do not hardcode it
powerpc/pseries: Advance pfn if section is not present in lmb_is_removable()
powerpc/xmon: don't access ASDR in VMs
s390/mm: fix dynamic pagetable upgrade for hugetlbfs
MIPS: fix indentation of the 'RELOCS' message
* KVM: arm64: Only sign-extend MMIO up to register width
arch/arm64/include/asm/kvm_mmio.h
platform/x86: intel_scu_ipc: Fix interrupt support
* irqdomain: Fix a memory leak in irq_domain_push_irq()
kernel/irq/irqdomain.c
lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more()
media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments
media/v4l2-core: set pages dirty upon releasing DMA buffers
ALSA: dummy: Fix PCM format loop in proc output
usb: gadget: f_ecm: Use atomic_t to track in-flight request
* usb: gadget: f_ncm: Use atomic_t to track in-flight request
drivers/usb/gadget/function/f_ncm.c
usb: gadget: legacy: set max_speed to super-speed
brcmfmac: Fix memory leak in brcmf_usbdev_qinit
* tracing: Fix sched switch start/stop refcount racy updates
kernel/trace/trace_sched_switch.c
mfd: dln2: More sanity checking for endpoints
media: uvcvideo: Avoid cyclic entity chains due to malformed USB descriptors
rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect
rxrpc: Fix insufficient receive notification generation
* tcp: clear tp->segs_{in|out} in tcp_disconnect()
net/ipv4/tcp.c
* tcp: clear tp->data_segs{in|out} in tcp_disconnect()
net/ipv4/tcp.c
* tcp: clear tp->delivered in tcp_disconnect()
net/ipv4/tcp.c
* tcp: clear tp->total_retrans in tcp_disconnect()
net/ipv4/tcp.c
bnxt_en: Fix TC queue mapping.
net_sched: fix an OOB access in cls_tcindex
net: hsr: fix possible NULL deref in hsr_handle_frame()
* l2tp: Allow duplicate session creation with UDP
net/l2tp/l2tp_core.c
gtp: use __GFP_NOWARN to avoid memalloc warning
cls_rsvp: fix rsvp_policy
sparc32: fix struct ipc64_perm type definition
iwlwifi: mvm: fix NVM check for 3168 devices
x86/cpu: Update cached HLE state on write to TSX_CTRL_CPUID_CLEAR
media: iguanair: fix endpoint sanity check
* kernel/module: Fix memleak in module_add_modinfo_attrs()
kernel/module.c
Change-Id: I481eceb2214ffd107b59f8745d72e418d8b5fefb
Signed-off-by: lucaswei <lucaswei@google.com>
1100 lines
30 KiB
C
1100 lines
30 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.
|
|
* 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 LIST_HEAD(clocksource_list);
|
|
static DEFINE_MUTEX(clocksource_mutex);
|
|
static char override_name[CS_NAME_LEN];
|
|
static int finished_booting;
|
|
|
|
#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 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)
|
|
|
|
static void clocksource_watchdog_work(struct work_struct *work)
|
|
{
|
|
/*
|
|
* 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 (cs->mark_unstable)
|
|
cs->mark_unstable(cs);
|
|
|
|
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 instead of clocksource_change_rating from
|
|
* cpu hotplug code to avoid a deadlock between the clocksource mutex
|
|
* and the cpu hotplug mutex. It defers the update of the clocksource
|
|
* to the watchdog thread.
|
|
*/
|
|
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->wd_list))
|
|
list_add(&cs->wd_list, &watchdog_list);
|
|
__clocksource_unstable(cs);
|
|
}
|
|
spin_unlock_irqrestore(&watchdog_lock, flags);
|
|
}
|
|
|
|
static void clocksource_watchdog(unsigned long data)
|
|
{
|
|
struct clocksource *cs;
|
|
u64 csnow, wdnow, cslast, wdlast, delta;
|
|
int64_t wd_nsec, cs_nsec;
|
|
int next_cpu, reset_pending;
|
|
|
|
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;
|
|
}
|
|
|
|
local_irq_disable();
|
|
csnow = cs->read(cs);
|
|
wdnow = watchdog->read(watchdog);
|
|
local_irq_enable();
|
|
|
|
/* 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;
|
|
init_timer(&watchdog_timer);
|
|
watchdog_timer.function = clocksource_watchdog;
|
|
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)
|
|
{
|
|
unsigned long flags;
|
|
|
|
INIT_LIST_HEAD(&cs->wd_list);
|
|
|
|
spin_lock_irqsave(&watchdog_lock, flags);
|
|
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;
|
|
}
|
|
spin_unlock_irqrestore(&watchdog_lock, flags);
|
|
}
|
|
|
|
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)
|
|
{
|
|
unsigned long flags;
|
|
|
|
spin_lock_irqsave(&watchdog_lock, flags);
|
|
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();
|
|
}
|
|
}
|
|
spin_unlock_irqrestore(&watchdog_lock, flags);
|
|
}
|
|
|
|
static int __clocksource_watchdog_kthread(void)
|
|
{
|
|
struct clocksource *cs, *tmp;
|
|
unsigned long flags;
|
|
LIST_HEAD(unstable);
|
|
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);
|
|
list_add(&cs->wd_list, &unstable);
|
|
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);
|
|
|
|
/* Needs to be done outside of watchdog lock */
|
|
list_for_each_entry_safe(cs, tmp, &unstable, wd_list) {
|
|
list_del_init(&cs->wd_list);
|
|
__clocksource_change_rating(cs, 0);
|
|
}
|
|
return select;
|
|
}
|
|
|
|
static int clocksource_watchdog_kthread(void *data)
|
|
{
|
|
mutex_lock(&clocksource_mutex);
|
|
if (__clocksource_watchdog_kthread())
|
|
clocksource_select(false);
|
|
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) { }
|
|
|
|
#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
|
|
|
|
/**
|
|
* 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;
|
|
|
|
/* 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;
|
|
}
|
|
|
|
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)
|
|
{
|
|
|
|
/* 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_enqueue(cs);
|
|
clocksource_enqueue_watchdog(cs);
|
|
clocksource_select(false);
|
|
clocksource_select_watchdog(false);
|
|
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)
|
|
{
|
|
mutex_lock(&clocksource_mutex);
|
|
__clocksource_change_rating(cs, rating);
|
|
clocksource_select(false);
|
|
clocksource_select_watchdog(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)
|
|
{
|
|
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;
|
|
}
|
|
clocksource_dequeue_watchdog(cs);
|
|
list_del_init(&cs->list);
|
|
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
|
|
/**
|
|
* sysfs_show_current_clocksources - 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
|
|
sysfs_show_current_clocksources(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;
|
|
}
|
|
|
|
/**
|
|
* sysfs_override_clocksource - 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 sysfs_override_clocksource(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;
|
|
}
|
|
|
|
/**
|
|
* sysfs_unbind_current_clocksource - 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 sysfs_unbind_clocksource(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;
|
|
}
|
|
|
|
/**
|
|
* sysfs_show_available_clocksources - 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
|
|
sysfs_show_available_clocksources(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;
|
|
}
|
|
|
|
/*
|
|
* Sysfs setup bits:
|
|
*/
|
|
static DEVICE_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources,
|
|
sysfs_override_clocksource);
|
|
|
|
static DEVICE_ATTR(unbind_clocksource, 0200, NULL, sysfs_unbind_clocksource);
|
|
|
|
static DEVICE_ATTR(available_clocksource, 0444,
|
|
sysfs_show_available_clocksources, NULL);
|
|
|
|
static struct bus_type clocksource_subsys = {
|
|
.name = "clocksource",
|
|
.dev_name = "clocksource",
|
|
};
|
|
|
|
static struct device device_clocksource = {
|
|
.id = 0,
|
|
.bus = &clocksource_subsys,
|
|
};
|
|
|
|
static int __init init_clocksource_sysfs(void)
|
|
{
|
|
int error = subsys_system_register(&clocksource_subsys, NULL);
|
|
|
|
if (!error)
|
|
error = device_register(&device_clocksource);
|
|
if (!error)
|
|
error = device_create_file(
|
|
&device_clocksource,
|
|
&dev_attr_current_clocksource);
|
|
if (!error)
|
|
error = device_create_file(&device_clocksource,
|
|
&dev_attr_unbind_clocksource);
|
|
if (!error)
|
|
error = device_create_file(
|
|
&device_clocksource,
|
|
&dev_attr_available_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);
|