Merge 4.9.219 into android-4.9-q
Linux 4.9.219
* drm/msm: Use the correct dma_sync calls in msm_gem
drivers/gpu/drm/msm/msm_gem.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
* 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
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
tools/accounting/getdelays.c: fix netlink attribute length
* random: always use batched entropy for get_random_u{32,64}
drivers/char/random.c
net: phy: micrel: kszphy_resume(): add delay after genphy_resume() before accessing PHY registers
slcan: Don't transmit uninitialized stack data in padding
net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting
net: dsa: bcm_sf2: Ensure correct sub-node is parsed
mm: mempolicy: require at least one nodeid for MPOL_PREFERRED
padata: always acquire cpu_hotplug_lock before pinst->lock
net: dsa: tag_brcm: Fix skb->fwd_offload_mark location
* coresight: do not use the BIT() macro in the UAPI header
include/uapi/linux/coresight-stm.h
* 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
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
drm/bochs: downgrade pci_request_region failure from error to warning
* l2tp: fix race between l2tp_session_delete() and l2tp_tunnel_closeall()
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h
* l2tp: ensure sessions are freed after their PPPOL2TP socket
net/l2tp/l2tp_ppp.c
ANDROID: cuttlefish_defconfig: Minimally enable EFI
Merge 4.9.218 into android-4.9-q
Linux 4.9.218
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
* bpf: Explicitly memset the bpf_attr structure
kernel/bpf/syscall.c
* vt: vt_ioctl: fix use-after-free in vt_in_use()
drivers/tty/vt/vt_ioctl.c
* locking/atomic, kref: Add kref_read()
include/linux/kref.h
* 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
tools: Let O= makes handle a relative path with -C option
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
* vti[6]: fix packet tx through bpf_redirect() in XinY cases
net/ipv4/Kconfig
net/ipv4/ip_vti.c
net/ipv6/ip6_vti.c
* genirq: Fix reference leaks on irq affinity notifiers
kernel/irq/manage.c
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
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
i2c: hix5hd2: add missed clk_disable_unprepare in remove
sxgbe: Fix off by one in samsung driver strncpy size arg
mac80211: Do not send mesh HWMP PREQ if HWMP is disabled
scsi: ipr: Fix softlockup when rescanning devices in petitboot
dt-bindings: net: FMan erratum A050385
cpupower: avoid multiple definition with gcc -fno-common
* net: ipv4: don't let PMTU updates increase route MTU
net/ipv4/route.c
KVM: VMX: Do not allow reexecute_instruction() when skipping MMIO instr
hsr: set .netnsok flag
hsr: add restart routine into hsr_get_node_list()
hsr: use rcu_read_lock() in hsr_get_node_{list/status}()
net: mvneta: Fix the case where the last poll did not process all rx
vxlan: check return value of gro_cells_init()
slcan: not call free_netdev before rtnl_unlock in slcan_open
NFC: fdp: Fix a signedness bug in fdp_nci_send_patch()
net_sched: keep alloc_hash updated after hash allocation
net_sched: cls_route: remove the right filter from hashtable
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
* arm64: smp: fix smp_send_stop() behaviour
arch/arm64/kernel/smp.c
ALSA: hda/realtek: Fix pop noise on ALC225
* 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
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
* 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
* rtc: max8907: add missing select REGMAP_IRQ
drivers/rtc/Kconfig
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
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: 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
altera-stapl: altera_get_note: prevent write beyond end of 'key'
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
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
drivers/spi/spi-qup.c
* 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 the bpf_attr structure
kernel/bpf/syscall.c
Merge 4.9.217 into android-4.9-q
Linux 4.9.217
* 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
* 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
* 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: Use explicit tvlv padding for ELP packets
batman-adv: Avoid probe ELP information leak
batman-adv: update data pointers after skb_cow()
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: Prevent duplicated gateway_node entry
batman-adv: Fix multicast TT issues with bogus ROAM flags
batman-adv: Avoid storing non-TT-sync flags on singular entries too
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: 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
batman-adv: fix TT sync flag inconsistencies
batman-adv: Accept only filled wifi station info
batman-adv: Use default throughput value on cfg80211 error
batman-adv: Fix rx packet/bytes stats on local ARP reply
batman-adv: Initialize gw sel_class via batadv_algo
batman-adv: Fix transmission of final, 16th fragment
batman-adv: Fix double free during fragment merge error
efi: Add a sanity check to efivar_store_raw()
* ipv6: restrict IPV6_ADDRFORM operation
net/ipv6/ipv6_sockglue.c
iommu/vt-d: Ignore devices with out-of-spec domain number
iommu/vt-d: Fix the wrong printing in RHSA parsing
mwifiex: Fix heap overflow in mmwifiex_process_tdls_action_frame()
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
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
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
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
* net: phy: fix MDIO bus PM PHY resuming
drivers/net/phy/phy_device.c
include/linux/phy.h
* cgroup: memcg: net: do not associate sock with unrelated cgroup
kernel/cgroup.c
mm/memcontrol.c
* bonding/alb: make sure arp header is pulled before accessing it
drivers/net/bonding/bond_alb.c
* slip: make slhc_compress() more robust against malicious packets
drivers/net/slip/slhc.c
net: fec: validate the new settings in fec_enet_set_coalesce()
macvlan: add cond_resched() during multicast processing
ipvlan: don't deref eth hdr before checking it's set
ipvlan: do not use cond_resched_rcu() in ipvlan_process_multicast()
ipvlan: egress mcast packets are not exceptional
ipvlan: do not add hardware address of master to its unicast filter list
ipvlan: add cond_resched_rcu() while processing muticast backlog
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
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
bnxt_en: reinitialize IRQs when MTU is modified
* r8152: check disconnect status after long sleep
drivers/net/usb/r8152.c
net: nfc: fix bounds checking bugs on "pipe"
net: macsec: update SCI upon MAC address change.
* ipv6/addrconf: call ipv6_mc_up() for non-Ethernet interface
net/ipv6/addrconf.c
gre: fix uninit-value in __iptunnel_pull_header
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
NFS: Remove superfluous kmap in nfs_readdir_xdr_to_array
Merge 4.9.216 into android-4.9-q
Linux 4.9.216
crypto: algif_skcipher - use ZERO_OR_NULL_PTR in skcipher_recvmsg_async
dm cache: fix a crash due to incorrect work item cancelling
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
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
ARM: dts: ls1021a: Restore MDIO compatible to gianfar
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
tty:serial:mvebu-uart:fix a wrong return
* fat: fix uninit-memory access for partial initialized inode
fs/fat/inode.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: 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
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
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
serial: ar933x_uart: set UART_CS_{RX,TX}_READY_ORIDE
vhost: Check docket sk_family instead of call getname
* audit: always check the netlink payload length in audit_receive_msg()
kernel/audit.c
mm/huge_memory.c: use head to check huge zero page
perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc
drivers: net: xgene: Fix the order of the arguments of 'alloc_etherdev_mqs()'
* tuntap: correctly set SOCKWQ_ASYNC_NOSPACE
drivers/net/tun.c
slip: stop double free sl->dev in slip_open
KVM: Check for a bad hva before dropping into the ghc slow path
* namei: only return -ECHILD from follow_dotdot_rcu()
fs/namei.c
net: ena: make ena rxfh support ETH_RSS_HASH_NO_CHANGE
* 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
serial: 8250: Check UPF_IRQ_SHARED in advance
* ecryptfs: Fix up bad backport of fe2e082f5da5b4a0a92ae32978f81507ef37ec66
fs/ecryptfs/keystore.c
i2c: jz4780: silence log flood on txabrt
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
* 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
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
nfc: pn544: Fix occasional HW initialization failure
sctp: move the format error check out of __sctp_sf_do_9_1_abort
* 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
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: 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 potential crash when rxfh key is NULL
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
* 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
iwlwifi: pcie: fix rb_allocator workqueue allocation
* FROMLIST: HID: nintendo: add nintendo switch controller driver
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-nintendo.c
Merge 4.9.215 into android-4.9-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.9.215
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
* ecryptfs: replace BUG_ON with error handling code
fs/ecryptfs/crypto.c
staging: greybus: use after free in gb_audio_manager_remove_all()
* 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
KVM: apic: avoid calculating pending eoi from an uninitialized val
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
* netfilter: xt_bpf: add overflow checks
net/netfilter/xt_bpf.c
KVM: nVMX: Don't emulate instructions in guest mode
lib/stackdepot.c: fix global out-of-bounds in stack_slabs
* 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
KVM: x86: don't notify userspace IOAPIC on edge-triggered interrupt EOI
* xhci: apply XHCI_PME_STUCK_QUIRK to Intel Comet Lake platforms
drivers/usb/host/xhci-pci.c
Revert "ipc,sem: remove uneeded sem_undo_list lock usage in exit_sem()"
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: rtl8188eu: Fix potential overuse of kernel memory
staging: rtl8188eu: Fix potential security hole
* 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
* 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
net/sched: flower: add missing validation of TCA_FLOWER_FLAGS
net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS
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
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
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: 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
remoteproc: Initialize rproc_class before use
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
* 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
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
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
soc/tegra: fuse: Correct straps' address for older Tegra124 device trees
udf: Fix free space reporting for metadata and virtual partitions
usbip: Fix unsafe unaligned pointer usage
tools lib api fs: Fix gcc9 stringop-truncation compilation error
ALSA: sh: Fix compile warning wrt const
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
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
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
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
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
* 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
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()
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
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
Revert "KVM: VMX: Add non-canonical check on writes to RTIT address MSRs"
scsi: qla2xxx: fix a potential NULL pointer dereference
btrfs: print message when tree-log replay starts
* 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
padata: Remove broken queue flushing
perf/x86/amd: Add missing L2 misses event spec to AMD Family 17h's event map
btrfs: log message when rw remount is attempted with unclean tree-log
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: don't assume that mmp_nodename/bdevname have NUL
fs/ext4/mmp.c
* ALSA: usb-audio: Apply sample rate quirk for Audioengine D1
sound/usb/quirks.c
* 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
ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs
KVM: x86: emulate RDPID
x86/vdso: Use RDPID in preference to LSL when available
Merge 4.9.214 into android-4.9-q
Linux 4.9.214
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()
* 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
powerpc/pseries: Allow not having ibm, hypertas-functions::hcall-multi-tce for DDW
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
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
NFSv4: try lease recovery on NFS4ERR_EXPIRED
* 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
* 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
* 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: 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
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: use bool argument in free_root_pointers()
Btrfs: fix assertion failure on fsync with NO_HOLES enabled
* ext4: fix deadlock allocating crypto bounce page from mempool
fs/ext4/page-io.c
NFS: Directory page cache pages need to be locked when read
NFS: Fix bool initialization/comparison
NFS: Fix memory leaks and corruption in readdir
NFS: switch back to to ->iterate()
* bonding/alb: properly access headers in bond_alb_xmit()
drivers/net/bonding/bond_alb.c
net: systemport: Avoid RBUF stuck in Wake-on-LAN mode
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/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
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
sunrpc: expiry_time should be seconds not timeval
mwifiex: fix unbalanced locking in mwifiex_process_country_ie()
ARM: tegra: Enable PLLP bypass during Tegra124 LP1
btrfs: set trans->drity in btrfs_commit_transaction
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
dm space map common: fix to ensure new block isn't already in use
* of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc
drivers/of/Kconfig
drivers/of/address.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
ubifs: Fix deadlock in concurrent bulk-read and writepage
ubifs: Change gfp flags in page allocation for bulk read
PCI: keystone: Fix link training retries initiation
mmc: spi: Toggle SPI polarity, do not hardcode it
powerpc/pseries: Advance pfn if section is not present in lmb_is_removable()
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
usb: gadget: legacy: set max_speed to super-speed
brcmfmac: Fix memory leak in brcmf_usbdev_qinit
mfd: dln2: More sanity checking for endpoints
media: uvcvideo: Avoid cyclic entity chains due to malformed USB descriptors
* 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
rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect
rxrpc: Fix insufficient receive notification generation
net_sched: fix an OOB access in cls_tcindex
net: hsr: fix possible NULL deref in hsr_handle_frame()
gtp: use __GFP_NOWARN to avoid memalloc warning
cls_rsvp: fix rsvp_policy
ASoC: qcom: Fix of-node refcount unbalance to link->codec_of_node
sparc32: fix struct ipc64_perm type definition
x86/cpu: Update cached HLE state on write to TSX_CTRL_CPUID_CLEAR
media: iguanair: fix endpoint sanity check
Merge 4.9.213 into android-4.9-q
Linux 4.9.213
btrfs: do not zero f_bavail if we have available space
* net: Fix skb->csum update in inet_proto_csum_replace16().
net/core/utils.c
l2t_seq_next should increase position index
seq_tab_next() should increase position index
net/sonic: Quiesce SONIC before re-initializing descriptor memory
net/sonic: Fix receive buffer handling
net/sonic: Use MMIO accessors
net/sonic: Add mutual exclusion for accessing shared state
net: fsl/fman: rename IF_MODE_XGMII to IF_MODE_10G
net/fsl: treat fsl,erratum-a011043
powerpc/fsl/dts: add fsl,erratum-a011043
qlcnic: Fix CPU soft lockup while collecting firmware dump
* r8152: get default setting of WOL before initializing
drivers/net/usb/r8152.c
airo: Add missing CAP_NET_ADMIN check in AIROOLDIOCTL/SIOCDEVPRIVATE
airo: Fix possible info leak in AIROOLDIOCTL/SIOCDEVPRIVATE
scsi: fnic: do not queue commands during fwreset
* vti[6]: fix packet tx through bpf_redirect()
net/ipv4/ip_vti.c
net/ipv6/ip6_vti.c
* wireless: wext: avoid gcc -O3 warning
net/wireless/wext-core.c
mac80211: Fix TKIP replay protection immediately after key setup
* wireless: fix enabling channel 12 for custom regulatory domain
net/wireless/reg.c
ixgbe: Fix calculation of queue with VFs and flow director on interface flap
ixgbevf: Remove limit of 10 entries for unicast filter list
clk: mmp2: Fix the order of timer mux parents
mac80211: mesh: restrict airtime metric to peered established plinks
soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
ARM: dts: beagle-x15-common: Model 5V0 regulator
media: si470x-i2c: Move free() past last use of 'radio'
* usb: dwc3: turn off VBUS when leaving host mode
drivers/usb/dwc3/core.c
* Bluetooth: Fix race condition in hci_release_sock()
net/bluetooth/hci_sock.c
ttyprintk: fix a potential deadlock in interrupt context issue
media: dvb-usb/dvb-usb-urb.c: initialize actlen to 0
media: gspca: zero usb_buf
media: af9005: uninitialized variable printked
media: digitv: don't continue if remote control state can't be read
reiserfs: Fix memory leak of journal device string
mm/mempolicy.c: fix out of bounds write in mpol_parse_str()
* arm64: kbuild: remove compressed images on 'make ARCH=arm64 (dist)clean'
arch/arm64/boot/Makefile
tools lib: Fix builds when glibc contains strlcpy()
iio: gyro: st_gyro: fix L3GD20H support
iio: gyro: st_gyro: inline per-sensor data
crypto: pcrypt - Fix user-after-free on module unload
* vfs: fix do_last() regression
fs/namei.c
crypto: af_alg - Use bh_lock_sock in sk_destruct
* net_sched: ematch: reject invalid TCF_EM_SIMPLE
net/sched/ematch.c
usb-storage: Disable UAS on JMicron SATA enclosure
atm: eni: fix uninitialized variable warning
* gpio: max77620: Add missing dependency on GPIOLIB_IRQCHIP
drivers/gpio/Kconfig
net: wan: sdla: Fix cast from pointer to integer of different size
drivers/net/b44: Change to non-atomic bit operations on pwol_mask
watchdog: rn5t618_wdt: fix module aliases
arc: eznps: fix allmodconfig kconfig warning
zd1211rw: fix storage endpoint lookup
rtl8xxxu: fix interface sanity check
brcmfmac: fix interface sanity check
ath9k: fix storage endpoint lookup
serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
staging: vt6656: Fix false Tx excessive retries reporting.
staging: vt6656: use NULLFUCTION stack on mac80211
staging: vt6656: correct packet types for CTS protect, mode.
staging: wlan-ng: ensure error return is actually returned
staging: most: net: fix buffer overflow
USB: serial: ir-usb: fix IrLAP framing
USB: serial: ir-usb: fix link-speed handling
USB: serial: ir-usb: add missing endpoint sanity check
rsi_91x_usb: fix interface sanity check
orinoco_usb: fix interface sanity check
* ALSA: pcm: Add missing copy ops check before clearing buffer
sound/core/pcm_native.c
UPSTREAM: staging: most: net: fix buffer overflow
* UPSTREAM: ALSA: pcm: Add missing copy ops check before clearing buffer
sound/core/pcm_native.c
Merge 4.9.212 into android-4.9-q
Linux 4.9.212
net/x25: fix nonblocking connect
netfilter: ipset: use bitmap infrastructure completely
* bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()
include/linux/bitmap.h
lib/bitmap.c
md: Avoid namespace collision with bitmap API
scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func
bcache: silence static checker warning
libertas: Fix two buffer overflows at parsing bss descriptor
coresight: tmc-etf: Do not call smp_processor_id from preemptible
coresight: etb10: Do not call smp_processor_id from preemptible
* arm64: kpti: Whitelist Cortex-A CPUs that don't implement the CSV3 field
arch/arm64/kernel/cpufeature.c
Documentation: Document arm64 kpti control
* do_last(): fetch directory ->i_mode and ->i_uid before it's too late
fs/namei.c
tracing: xen: Ordered comparison of function pointers
scsi: RDMA/isert: Fix a recently introduced regression related to logout
hwmon: (nct7802) Fix voltage limits to wrong registers
Input: sun4i-ts - add a check for devm_thermal_zone_of_sensor_register
Input: pegasus_notetaker - fix endpoint sanity check
Input: aiptek - fix endpoint sanity check
Input: gtco - fix endpoint sanity check
Input: sur40 - fix interface sanity checks
* mmc: sdhci: fix minimum clock rate for v3 controller
drivers/mmc/host/sdhci.c
mmc: tegra: fix SDR50 tuning override
ARM: 8950/1: ftrace/recordmcount: filter relocation types
Input: keyspan-remote - fix control-message timeouts
* hwmon: (core) Do not use device managed functions for memory allocations
drivers/hwmon/hwmon.c
* hwmon: (core) Fix double-free in __hwmon_device_register()
drivers/hwmon/hwmon.c
* hwmon: Deal with errors from the thermal subsystem
drivers/hwmon/hwmon.c
* hwmon: (core) Simplify sysfs attribute name allocation
drivers/hwmon/hwmon.c
hwmon: (adt7475) Make volt2reg return same reg as reg2volt input
gtp: make sure only SOCK_DGRAM UDP sockets are accepted
net: usb: lan78xx: Add .ndo_features_check
tcp_bbr: improve arithmetic division in bbr_update_bw()
* net_sched: fix datalen for ematch
net/sched/ematch.c
* net, ip_tunnel: fix namespaces move
net/ipv4/ip_tunnel.c
* net, ip6_tunnel: fix namespaces move
net/ipv6/ip6_tunnel.c
net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM
firestream: fix memory leaks
can, slip: Protect tty->disc_data in write_wakeup and close with RCU
* net: phy: Keep reporting transceiver type
drivers/net/phy/phy.c
* net: ethtool: Add back transceiver type
include/uapi/linux/ethtool.h
net/core/ethtool.c
m68k: Call timer_interrupt() with interrupts disabled
IB/iser: Fix dma_nents type definition
arm64: dts: juno: Fix UART frequency
drm/radeon: fix bad DMA from INTERRUPT_CNTL2
dmaengine: ti: edma: fix missed failure handling
* packet: fix data-race in fanout_flow_is_huge()
net/packet/af_packet.c
* net: neigh: use long type to store jiffies delta
net/core/neighbour.c
MIPS: Loongson: Fix return value of loongson_hwmon_init
media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support
media: ov6650: Fix some format attributes not under control
media: ov6650: Fix incorrect use of JPEG colorspace
afs: Fix large file support
net: qca_spi: Move reset_count to struct qcaspi
* net: netem: correct the parent's backlog when corrupted packet was dropped
net/sched/sch_netem.c
* net: netem: fix error path for corrupted GSO frames
net/sched/sch_netem.c
dmaengine: imx-sdma: fix size check for sdma script_number
drm/msm/dsi: Implement reset correctly
* act_mirred: Fix mirred_init_module error handling
net/sched/act_mirred.c
net: stmmac: fix length of PTP clock's name string
llc: fix sk_buff refcounting in llc_conn_state_process()
llc: fix another potential sk_buff leak in llc_ui_sendmsg()
mac80211: accept deauth frames in IBSS mode
net: stmmac: gmac4+: Not all Unicast addresses may be available
nvme: retain split access workaround for capability reads
net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse()
* of: mdio: Fix a signedness bug in of_phy_get_and_connect()
drivers/of/of_mdio.c
net: stmmac: dwmac-meson8b: Fix signedness bug in probe
net: broadcom/bcmsysport: Fix signedness in bcm_sysport_probe()
net: hisilicon: Fix signedness bug in hix5hd2_dev_probe()
iommu/amd: Wait for completion of IOTLB flush in attach_device
net/rds: Fix 'ib_evt_handler_call' element in 'rds_ib_stat_names'
net: sonic: replace dev_kfree_skb in sonic_send_packet
hwmon: (shtc1) fix shtc1 and shtw1 id mask
Btrfs: fix hang when loading existing inode cache off disk
net: sonic: return NETDEV_TX_OK if failed to map buffer
ath9k: dynack: fix possible deadlock in ath_dynack_node_{de}init
iio: dac: ad5380: fix incorrect assignment to val
bcma: fix incorrect update of BCMA_CORE_PCI_MDIO_DATA
staging: greybus: light: fix a couple double frees
x86, perf: Fix the dependency of the x86 insn decoder selftest
* power: supply: Init device wakeup after device_add()
drivers/power/supply/power_supply_core.c
hwmon: (lm75) Fix write operations for negative temperatures
* Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()"
lib/kfifo.c
ahci: Do not export local variable ahci_em_messages
mips: avoid explicit UB in assignment of mips_io_port_base
mac80211: minstrel_ht: fix per-group max throughput rate initialization
dmaengine: dw: platform: Switch to acpi_dma_controller_register()
ASoC: sun4i-i2s: RX and TX counter registers are swapped
* signal: Allow cifs and drbd to receive their terminating signals
include/linux/signal.h
kernel/signal.c
ASoC: wm8737: Fix copy-paste error in wm8737_snd_controls
ASoC: cs4349: Use PM ops 'cs4349_runtime_pm'
ASoC: es8328: Fix copy-paste error in es8328_right_line_controls
* ext4: set error return correctly when ext4_htree_store_dirent fails
fs/ext4/inline.c
crypto: caam - free resources in case caam_rng registration failed
cifs: fix rmmod regression in cifs.ko caused by force_sig changes
net/mlx5: Fix mlx5_ifc_query_lag_out_bits
ALSA: aoa: onyx: always initialize register read value
x86/kgbd: Use NMI_VECTOR not APIC_DM_NMI
mic: avoid statically declaring a 'struct device'.
* usb: host: xhci-hub: fix extra endianness conversion
drivers/usb/host/xhci-hub.c
qed: reduce maximum stack frame size
libertas_tf: Use correct channel range in lbtf_geo_init
scsi: libfc: fix null pointer dereference on a null lport
net: pasemi: fix an use-after-free in pasemi_mac_phy_init()
RDMA/hns: Fixs hw access invalid dma memory error
* devres: allow const resource arguments
include/linux/device.h
lib/devres.c
rxrpc: Fix uninitialized error code in rxrpc_send_data_packet()
mfd: intel-lpss: Release IDA resources
iommu/amd: Make iommu_disable safer
clk: qcom: Fix -Wunused-const-variable
dmaengine: hsu: Revert "set HSU_CH_MTSR to memory width"
* perf/ioctl: Add check for the sample_period value
kernel/events/core.c
drm/msm/a3xx: remove TPL1 regs from snapshot
rtc: pcf8563: Clear event flags and disable interrupts before requesting irq
ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs
net/af_iucv: always register net_device notifier
* net: netem: fix backlog accounting for corrupted GSO frames
net/sched/sch_netem.c
drm/msm/mdp5: Fix mdp5_cfg_init error return
powerpc/cacheinfo: add cacheinfo_teardown, cacheinfo_rebuild
media: vivid: fix incorrect assignment operation when setting video mode
* inet: frags: call inet_frags_fini() after unregister_pernet_subsys()
net/ipv6/reassembly.c
signal/cifs: Fix cifs_put_tcp_session to call send_sig instead of force_sig
* iommu: Use right function to get group for device
drivers/iommu/iommu.c
misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa
serial: stm32: fix transmit_chars when tx is stopped
crypto: ccp - fix AES CFB error exposed by new test vectors
spi: spi-fsl-spi: call spi_finalize_current_message() at the end
dmaengine: tegra210-adma: Fix crash during probe
* thermal: cpu_cooling: Actually trace CPU load in thermal_power_cpu_get_power
drivers/thermal/cpu_cooling.c
backlight: lm3630a: Return 0 on success in update_status functions
* kdb: do a sanity check on the cpu in kdb_per_cpu()
kernel/debug/kdb/kdb_main.c
ARM: riscpc: fix lack of keyboard interrupts after irq conversion
pwm: meson: Don't disable PWM when setting duty repeatedly
* netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
net/bridge/netfilter/ebtables.c
platform/x86: alienware-wmi: printing the wrong error code
media: davinci/vpbe: array underflow in vpbe_enum_outputs()
media: omap_vout: potential buffer overflow in vidioc_dqbuf()
* l2tp: Fix possible NULL pointer dereference
net/l2tp/l2tp_core.c
dmaengine: tegra210-adma: restore channel status
net: ena: fix ena_com_fill_hash_function() implementation
net: ena: fix incorrect test of supported hash function
net: ena: fix: Free napi resources when ena_up() fails
net: ena: fix swapped parameters when calling ena_com_indirect_table_fill_entry
iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU
IB/mlx5: Add missing XRC options to QP optional params mask
* usb: gadget: fsl: fix link error against usb-gadget module
drivers/usb/phy/Kconfig
* ASoC: fix valid stream condition
sound/soc/soc-pcm.c
* packet: in recvmsg msg_name return at least sizeof sockaddr_ll
net/packet/af_packet.c
* ALSA: usb-audio: Handle the error from snd_usb_mixer_apply_create_quirk()
sound/usb/mixer.c
dmaengine: axi-dmac: Don't check the number of frames for alignment
6lowpan: Off by one handling ->nexthdr
media: ov2659: fix unbalanced mutex_lock/unlock
ARM: dts: ls1021: Fix SGMII PCS link remaining down after PHY disconnect
powerpc: vdso: Make vdso32 installation conditional in vdso_install
tipc: set sysctl_tipc_rmem and named_timeout right range
hwmon: (w83627hf) Use request_muxed_region for Super-IO accesses
ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data"
scsi: qla2xxx: Unregister chrdev if module initialization fails
ehea: Fix a copy-paste err in ehea_init_port_res
spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
soc/fsl/qe: Fix an error code in qe_pin_request()
spi: tegra114: fix for unpacked mode transfers
spi: tegra114: clear packed bit for unpacked mode
media: tw5864: Fix possible NULL pointer dereference in tw5864_handle_frame
media: davinci-isif: avoid uninitialized variable use
ARM: OMAP2+: Fix potentially uninitialized return value for _setup_reset()
m68k: mac: Fix VIA timer counter accesses
tipc: tipc clang warning
jfs: fix bogus variable self-initialization
regulator: tps65086: Fix tps65086_ldoa1_ranges for selector 0xB
media: cx23885: check allocation return
media: wl128x: Fix an error code in fm_download_firmware()
media: cx18: update *pos correctly in cx18_read_pos()
media: ivtv: update *pos correctly in ivtv_read_pos()
net: sh_eth: fix a missing check of of_get_phy_mode
xen, cpu_hotplug: Prevent an out of bounds access
drivers/rapidio/rio_cm.c: fix potential oops in riocm_ch_listen()
scsi: megaraid_sas: reduce module load time
nios2: ksyms: Add missing symbol exports
regulator: wm831x-dcdc: Fix list of wm831x_dcdc_ilim from mA to uA
ARM: 8848/1: virt: Align GIC version check with arm64 counterpart
ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used
mmc: sdhci-brcmstb: handle mmc_of_parse() errors during probe
clocksource/drivers/exynos_mct: Fix error path in timer resources initialization
clocksource/drivers/sun5i: Fail gracefully when clock rate is unavailable
NFS: Fix a soft lockup in the delegation recovery code
fs/nfs: Fix nfs_parse_devname to not modify it's argument
ASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of()
drm/nouveau/pmu: don't print reply values if exec is false
drm/nouveau/bios/ramcfg: fix missing parentheses when calculating RON
net: dsa: qca8k: Enable delay for RGMII_ID mode
regulator: pv88090: Fix array out-of-bounds access
regulator: pv88080: Fix array out-of-bounds access
regulator: pv88060: Fix array out-of-bounds access
cdc-wdm: pass return value of recover_from_urb_loss
dmaengine: mv_xor: Use correct device for DMA API
vfio_pci: Enable memory accesses before calling pci_map_rom
* keys: Timestamp new keys
security/keys/key.c
* block: don't use bio->bi_vcnt to figure out segment number
block/blk-merge.c
usb: phy: twl6030-usb: fix possible use-after-free on remove
pinctrl: sh-pfc: sh73a0: Fix fsic_spdif pin groups
pinctrl: sh-pfc: r8a7792: Fix vin1_data18_b pin group
pinctrl: sh-pfc: r8a7791: Fix scifb2_data_c pin group
pinctrl: sh-pfc: emev2: Add missing pinmux functions
iw_cxgb4: use tos when finding ipv6 routes
iw_cxgb4: use tos when importing the endpoint
fbdev: chipsfb: remove set but not used variable 'size'
rtc: pm8xxx: fix unintended sign extension
rtc: 88pm80x: fix unintended sign extension
rtc: 88pm860x: fix unintended sign extension
* net: phy: fixed_phy: Fix fixed_phy not checking GPIO
drivers/net/phy/fixed_phy.c
thermal: mediatek: fix register index error
rtc: ds1672: fix unintended sign extension
staging: most: cdev: add missing check for cdev_add failure
iwlwifi: mvm: fix RSS config command
ARM: dts: lpc32xx: phy3250: fix SD card regulator voltage
ARM: dts: lpc32xx: fix ARM PrimeCell LCD controller clocks property
ARM: dts: lpc32xx: fix ARM PrimeCell LCD controller variant
ARM: dts: lpc32xx: reparent keypad controller to SIC1
ARM: dts: lpc32xx: add required clocks property to keypad device node
crypto: crypto4xx - Fix wrong ppc4xx_trng_probe()/ppc4xx_trng_remove() arguments
tty: ipwireless: Fix potential NULL pointer dereference
iwlwifi: mvm: fix A-MPDU reference assignment
clk: sunxi-ng: sun8i-a23: Enable PLL-MIPI LDOs when ungating it
rtc: cmos: ignore bogus century byte
IB/iser: Pass the correct number of entries for dma mapped SGL
ASoC: imx-sgtl5000: put of nodes if finding codec fails
crypto: tgr192 - fix unaligned memory access
media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVAL
drm/etnaviv: NULL vs IS_ERR() buf in etnaviv_core_dump()
arm64: dts: apq8016-sbc: Increase load on l11 for SDCARD
RDMA/qedr: Fix out of bounds index check in query pkey
RDMA/ocrdma: Fix out of bounds index check in query pkey
IB/usnic: Fix out of bounds index check in query pkey
clk: dove: fix refcount leak in dove_clk_init()
clk: armada-xp: fix refcount leak in axp_clk_init()
clk: kirkwood: fix refcount leak in kirkwood_clk_init()
clk: armada-370: fix refcount leak in a370_clk_init()
clk: vf610: fix refcount leak in vf610_clocks_init()
clk: imx7d: fix refcount leak in imx7d_clocks_init()
clk: imx6sx: fix refcount leak in imx6sx_clocks_init()
clk: imx6q: fix refcount leak in imx6q_clocks_init()
clk: samsung: exynos4: fix refcount leak in exynos4_get_xom()
clk: socfpga: fix refcount leak
clk: qoriq: fix refcount leak in clockgen_init()
clk: highbank: fix refcount leak in hb_clk_init()
Input: nomadik-ske-keypad - fix a loop timeout test
pinctrl: sh-pfc: sh7734: Remove bogus IPSR10 value
pinctrl: sh-pfc: sh7269: Add missing PCIOR0 field
pinctrl: sh-pfc: sh7734: Add missing IPSR11 field
pinctrl: sh-pfc: r8a7794: Remove bogus IPSR9 field
pinctrl: sh-pfc: sh73a0: Add missing TO pin to tpu4_to3 group
pinctrl: sh-pfc: r8a7791: Remove bogus marks from vin1_b_data18 group
pinctrl: sh-pfc: r8a7791: Remove bogus ctrl marks from qspi_data4_b group
pinctrl: sh-pfc: r8a7740: Add missing LCD0 marks to lcd0_data24_1 group
pinctrl: sh-pfc: r8a7740: Add missing REF125CK pin to gether_gmii group
* net: phy: Fix not to call phy_resume() if PHY is not attached
drivers/net/phy/phy_device.c
* drm/dp_mst: Skip validating ports during destruction, just ref
drivers/gpu/drm/drm_dp_mst_topology.c
exportfs: fix 'passing zero to ERR_PTR()' warning
pcrypt: use format specifier in kobject_add
mlxsw: reg: QEEC: Add minimum shaper fields
pwm: lpss: Release runtime-pm reference from the driver's remove callback
staging: comedi: ni_mio_common: protect register write overflow
* ALSA: usb-audio: update quirk for B&W PX to remove microphone
sound/usb/quirks-table.h
IB/rxe: replace kvfree with vfree
ALSA: hda: fix unused variable warning
drm/virtio: fix bounds check in virtio_gpu_cmd_get_capset()
drm/sti: do not remove the drm_bridge that was never added
mt7601u: fix bbp version check in mt7601u_wait_bbp_ready
powerpc/archrandom: fix arch_get_random_seed_int()
xfs: Sanity check flags of Q_XQUOTARM call
* UPSTREAM: mm/page_io.c: annotate refault stalls from swap_readpage
mm/page_io.c
* ANDROID: selinux: modify RTM_GETLINK permission
security/selinux/include/classmap.h
security/selinux/include/security.h
security/selinux/nlmsgtab.c
security/selinux/ss/policydb.c
security/selinux/ss/policydb.h
security/selinux/ss/services.c
Merge 4.9.211 into android-4.9-q
Linux 4.9.211
regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id
perf probe: Fix wrong address verification
* scsi: core: scsi_trace: Use get_unaligned_be*()
drivers/scsi/scsi_trace.c
scsi: target: core: Fix a pr_debug() argument
scsi: bnx2i: fix potential use after free
scsi: qla4xxx: fix double free bug
scsi: esas2r: unlock on error in esas2r_nvram_read_direct()
reiserfs: fix handling of -EOPNOTSUPP in reiserfs_for_each_xattr
* cfg80211: check for set_wiphy_params
net/wireless/rdev-ops.h
cw1200: Fix a signedness bug in cw1200_load_firmware()
xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk
net: usb: lan78xx: limit size of local TSO packets
* tcp: fix marked lost packets not being retransmitted
net/ipv4/tcp_input.c
* r8152: add missing endpoint sanity check
drivers/net/usb/r8152.c
net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info
net: dsa: tag_qca: fix doubled Tx statistics
macvlan: use skb_reset_mac_header() in macvlan_queue_xmit()
batman-adv: Fix DAT candidate selection on little endian systems
* netfilter: arp_tables: init netns pointer in xt_tgdtor_param struct
net/ipv4/netfilter/arp_tables.c
netfilter: fix a use-after-free in mtype_destroy()
* cfg80211: fix page refcount issue in A-MSDU decap
net/wireless/util.c
arm64: dts: agilex/stratix10: fix pmu interrupt numbers
scsi: fnic: fix invalid stack access
scsi: fnic: use kernel's '%pM' format option to print MAC
USB: serial: keyspan: handle unbound ports
USB: serial: io_edgeport: handle unbound ports on URB completion
USB: serial: io_edgeport: use irqsave() in USB's complete callback
net: stmmac: Enable 16KB buffer size
net: stmmac: 16KB buffer must be 16 byte aligned
* mm/page-writeback.c: avoid potential division by zero in wb_min_max_ratio()
mm/page-writeback.c
perf report: Fix incorrectly added dimensions as switch perf data file
perf hists: Fix variable name's inconsistency in hists__for_each() macro
x86/efistub: Disable paging at mixed mode entry
* usb: core: hub: Improved device recognition on remote wakeup
drivers/usb/core/hub.c
scsi: mptfusion: Fix double fetch bug in ioctl
USB: serial: quatech2: handle unbound ports
USB: serial: io_edgeport: add missing active-port sanity check
USB: serial: ch341: handle unbound port at reset_resume
USB: serial: suppress driver bind attributes
USB: serial: opticon: fix control-message timeouts
USB: serial: simple: Add Motorola Solutions TETRA MTP3xxx and MTP85xx
iio: buffer: align the size of scan bytes to size of the largest element
* block: fix an integer overflow in logical block size
block/blk-settings.c
include/linux/blkdev.h
* Fix built-in early-load Intel microcode alignment
firmware/Makefile
ALSA: seq: Fix racy access for queue timer in proc read
* clk: Don't try to enable critical clocks if prepare failed
drivers/clk/clk.c
dt-bindings: reset: meson8b: fix duplicate reset IDs
ocfs2: call journal flush to mark journal as empty after journal recovery when mount
hexagon: work around compiler crash
hexagon: parenthesize registers in asm predicates
ioat: ioat_alloc_ring() failure handling.
MIPS: Prevent link failure with kcov instrumentation
rseq/selftests: Turn off timeout setting
scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy()
gpio: mpc8xxx: Add platform device to gpiochip->parent
rtc: msm6242: Fix reading of 10-hour digit
* f2fs: fix potential overflow
fs/f2fs/data.c
fs/f2fs/file.c
rtlwifi: Remove unnecessary NULL check in rtl_regd_init
spi: atmel: fix handling of cs_change set on non-last xfer
mtd: spi-nor: fix silent truncation in spi_nor_read()
media: exynos4-is: Fix recursive locking in isp_video_release()
tty: serial: pch_uart: correct usage of dma_unmap_sg
tty: serial: imx: use the sg count from dma_map_sg
powerpc/powernv: Disable native PCIe port management
PCI/PTM: Remove spurious "d" from granularity message
* compat_ioctl: handle SIOCOUTQNSD
net/socket.c
clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume
mei: fix modalias documentation
iio: imu: adis16480: assign bias value only if operation succeeded
platform/x86: asus-wmi: Fix keyboard brightness cannot be set to 0
* scsi: sd: Clear sdkp->protection_type if disk is reformatted without PI
drivers/scsi/sd.c
scsi: enclosure: Fix stale device oops with hot replug
RDMA/srpt: Report the SCSI residual to the initiator
cifs: Adjust indentation in smb2_open_file
hsr: reset network header when supervision frame is created
* gpio: Fix error message on out-of-range GPIO in lookup table
drivers/gpio/gpiolib.c
* iommu: Remove device link to group on failure
drivers/iommu/iommu.c
rtc: mt6397: fix alarm register overwrite
dccp: Fix memleak in __feat_register_sp
* ext4: add more paranoia checking in ext4_expand_extra_isize handling
fs/ext4/inode.c
fs/ext4/super.c
* ext4: fix use-after-free race with debug_want_extra_isize
fs/ext4/super.c
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
wimax: i2400: fix memory leak
media: usb:zr364xx:Fix KASAN:null-ptr-deref Read in zr364xx_vidioc_querycap
mac80211: Do not send Layer 2 Update frame before authorization
* cfg80211/mac80211: make ieee80211_send_layer2_update a public function
include/net/cfg80211.h
net/wireless/util.c
* arm64: Make sure permission updates happen for pmd/pud
arch/arm64/mm/mmu.c
* arm64: Enforce BBM for huge IO/VMAP mappings
arch/arm64/mm/mmu.c
* arm64: mm: Change page table pointer name in p[md]_set_huge()
arch/arm64/mm/mmu.c
* arm64: don't open code page table entry creation
arch/arm64/include/asm/pgtable.h
arch/arm64/mm/mmu.c
* arm64: mm: BUG on unsupported manipulations of live kernel mappings
arch/arm64/mm/mmu.c
rsi: add fix for crash during assertions
* fs/select: avoid clang stack usage warning
include/linux/poll.h
* ethtool: reduce stack usage with clang
net/core/ethtool.c
* HID: hidraw, uhid: Always report EPOLLOUT
drivers/hid/uhid.c
HID: hidraw: Fix returning EPOLLOUT from hidraw_poll
hidraw: Return EPOLLOUT from hidraw_poll
Change-Id: I65d36338fa1ba89ad6ec2ff878fb4c89ff79b0be
Signed-off-by: lucaswei <lucaswei@google.com>
1090 lines
30 KiB
C
1090 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;
|
|
}
|
|
|
|
/*[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 (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;
|
|
cycle_t 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->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;
|
|
|
|
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);
|