3.13.6-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 3.13.6-stable review
This is the start of the stable review cycle for the 3.13.6 release. There are 172 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Mar 6 20:02:29 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.13.6-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.13.6-rc1
Jani Nikula <[email protected]>
drm/i915/dp: add native aux defer retry limit
Jani Nikula <[email protected]>
drm/i915/dp: increase native aux defer retry timeout
Jerome Glisse <[email protected]>
drm/radeon: free uvd ring on unload
Alex Deucher <[email protected]>
drm/radeon: disable pll sharing for DP on DCE4.1
Christian König <[email protected]>
drm/radeon: fix missing bo reservation
Alex Deucher <[email protected]>
drm/radeon: print the supported atpx function mask
Alex Deucher <[email protected]>
drm/radeon: fix audio disable on dce6+
Mike Snitzer <[email protected]>
dm thin: fix the error path for the thin device constructor
Mike Snitzer <[email protected]>
dm thin: avoid metadata commit if a pool's thin devices haven't changed
Mike Snitzer <[email protected]>
dm cache: move hook_info into common portion of per_bio_data structure
Hannes Reinecke <[email protected]>
dm mpath: fix stalls when handling invalid ioctls
Linus Walleij <[email protected]>
dma: ste_dma40: don't dereference free:d descriptor
Sebastian Capella <[email protected]>
PM / hibernate: Fix restore hang in freeze_processes()
Jean Delvare <[email protected]>
i7300_edac: Fix device reference count
Dr. Greg Wettstein <[email protected]>
qla2xxx: Fix kernel panic on selective retransmission request
Olof Johansson <[email protected]>
ARM64: unwind: Fix PC calculation
James Hogan <[email protected]>
irq-metag*: stop set_affinity vectoring to offline cpus
Kirill A. Shutemov <[email protected]>
mm, thp: fix infinite loop on memcg OOM
Charles Keepax <[email protected]>
Input - arizona-haptics: Fix double lock of dapm_mutex
Davidlohr Bueso <[email protected]>
ipc,mqueue: remove limits for the amount of system-wide queues
Jan Kara <[email protected]>
quota: Fix race between dqput() and dquot_scan_active()
Dan Williams <[email protected]>
ioat: fix tasklet tear down
Eric Paris <[email protected]>
SELinux: bigendian problems with filename trans rules
Max Filippov <[email protected]>
xtensa: introduce spill_registers_kernel macro
Max Filippov <[email protected]>
xtensa: save current register frame in fast_syscall_spill_registers_fixup
Andrew Lunn <[email protected]>
irqchip: orion: Fix getting generic chip pointer.
Sebastian Hesselbarth <[email protected]>
irqchip: orion: clear stale interrupts in irq_startup
Sebastian Hesselbarth <[email protected]>
irqchip: orion: use handle_edge_irq on bridge irqs
Sebastian Hesselbarth <[email protected]>
irqchip: orion: clear bridge cause register on init
Takashi Iwai <[email protected]>
ALSA: hda - Add a fixup for HP Folio 13 mute LED
Peter Zijlstra <[email protected]>
perf: Fix hotplug splat
Ben Hutchings <[email protected]>
perf trace: Add fallback definition of EFD_SEMAPHORE
Will Deacon <[email protected]>
iommu/arm-smmu: set CBARn.BPSHCFG to NSH for s1-s2-bypass contexts
Will Deacon <[email protected]>
iommu/arm-smmu: fix table flushing during initial allocations
Will Deacon <[email protected]>
iommu/arm-smmu: really fix page table locking
Yifan Zhang <[email protected]>
iommu/arm-smmu: fix pud/pmd entry fill sequence
Denis CIOCCA <[email protected]>
iio:gyro: bug on L3GD20H gyroscope support
Manu Gupta <[email protected]>
staging: r8188eu: Add new device ID
Juergen Beisert <[email protected]>
staging:iio:adc:MXS:LRADC: fix touchscreen statemachine
Arve Hjønnevåg <[email protected]>
staging: binder: Fix death notifications
Pekon Gupta <[email protected]>
mtd: nand: omap: fix ecclayout->oobfree->length
Pekon Gupta <[email protected]>
mtd: nand: omap: fix ecclayout->oobfree->offset
Pekon Gupta <[email protected]>
mtd: nand: omap: fix ecclayout to be in sync with u-boot NAND driver
Steve Twiss <[email protected]>
regulator: da9063: Bug fix when setting max voltage on LDOs 5-11
Lai Jiangshan <[email protected]>
workqueue: ensure @task is valid across kthread_stop()
Guenter Roeck <[email protected]>
hwmon: (max1668) Fix writing the minimum temperature
Chao Bi <[email protected]>
mei: set client's read_cb to NULL when flow control fails
Joerg Dorchain <[email protected]>
USB: ftdi_sio: add Cressi Leonardo PID
Stanislaw Gruszka <[email protected]>
usb: ehci: fix deadlock when threadirqs option is used
Alan Stern <[email protected]>
USB: EHCI: add delay during suspend to prevent erroneous wakeups
Aleksander Morgado <[email protected]>
USB: serial: option: blacklist interface 4 for Cinterion PHS8 and PXS8
Florian Fainelli <[email protected]>
usb: gadget: bcm63xx_udc: fix build failure on DMA channel code
Matthieu CASTET <[email protected]>
usb: chipidea: need to mask when writting endptflush and endptprime
Olivier Sobrie <[email protected]>
can: kvaser_usb: check number of channels returned by HW
Dirk Brandewie <[email protected]>
intel_pstate: Use LFM bus ratio as min ratio/P state
Lan Tianyu <[email protected]>
ACPI / processor: Rework processor throttling with work_on_cpu()
Hans de Goede <[email protected]>
ACPI / video: Filter the _BCL table for duplicate brightness values
Jean Delvare <[email protected]>
i7core_edac: Fix PCI device reference count
Tomasz Nowicki <[email protected]>
ACPI / PCI: Fix memory leak in acpi_pci_irq_enable()
Bjorn Helgaas <[email protected]>
PCI: Enable INTx if BIOS left them disabled
Andrew Lunn <[email protected]>
PCI: mvebu: Use Device ID and revision from underlying endpoint
Jan Kara <[email protected]>
Revert "writeback: do not sync data dirtied after sync start"
Srivatsa S. Bhat <[email protected]>
cpufreq: powernow-k8: Initialize per-cpu data-structures properly
Tejun Heo <[email protected]>
sata_sil: apply MOD15WRITE quirk to TOSHIBA MK2561GSYN
Denis V. Lunev <[email protected]>
ata: enable quirk from jmicron JMB350 for JMB394
Peter Zijlstra <[email protected]>
perf/x86: Fix event scheduling
Arnaldo Carvalho de Melo <[email protected]>
perf trace: Fix ioctl 'request' beautifier build problems on !(i386 || x86_64) arches
Marek Szyprowski <[email protected]>
x86: dma-mapping: fix GFP_ATOMIC macro usage
Levente Kurusa <[email protected]>
ahci: disable NCQ on Samsung pci-e SSDs on macbooks
Benjamin Herrenschmidt <[email protected]>
powerpc/powernv: Fix indirect XSCOM unmangling
Benjamin Herrenschmidt <[email protected]>
powerpc/powernv: Fix opal_xscom_{read,write} prototype
Laurent Dufour <[email protected]>
powerpc/crashdump : Fix page frame number check in copy_oldmem_page
Tony Breeds <[email protected]>
powerpc/le: Ensure that the 'stop-self' RTAS token is handled correctly
Paul Mackerras <[email protected]>
powerpc: Increase stack redzone for 64-bit userspace to 512 bytes
Trond Myklebust <[email protected]>
SUNRPC: Ensure that gss_auth isn't freed before its upcall messages
Trond Myklebust <[email protected]>
SUNRPC: Fix races in xs_nospace()
Lars-Peter Clausen <[email protected]>
ASoC: wm8958-dsp: Fix firmware block loading
Takashi Iwai <[email protected]>
ASoC: sta32x: Fix array access overflow
Takashi Iwai <[email protected]>
ASoC: sta32x: Fix wrong enum for limiter2 release rate
Lars-Peter Clausen <[email protected]>
ASoC: sta32x: Fix cache sync
Mark Brown <[email protected]>
ASoC: da732x: Mark DC offset control registers volatile
Takashi Iwai <[email protected]>
ASoC: wm8770: Fix wrong number of enum items
Dylan Reid <[email protected]>
ASoC: max98090: sync regcache on entering STANDBY
Shawn Guo <[email protected]>
ASoC: fsl: fix pm support of machine drivers
Alexander Shiyan <[email protected]>
ASoC: txx9aclc_ac97: Fix kernel crash on probe
Jarkko Nikula <[email protected]>
ASoC: rt5640: Add ACPI ID for Intel Baytrail
Adam Thomson <[email protected]>
ASoC: da9055: Fix device registration of PMIC and CODEC devices
Paolo Bonzini <[email protected]>
kvm, vmx: Really fix lazy FPU on nested guest
Andrew Honig <[email protected]>
kvm: x86: fix emulator buffer overflow (CVE-2014-0049)
Johannes Berg <[email protected]>
export: declare ksymtab symbols
Christoph Hellwig <[email protected]>
fs: fix iversion handling
Tejun Heo <[email protected]>
cgroup: update cgroup_enable_task_cg_lists() to grab siglock
Tejun Heo <[email protected]>
cgroup: fix locking in cgroup_cfts_commit()
Tejun Heo <[email protected]>
cgroup: fix error return from cgroup_create()
Tejun Heo <[email protected]>
cgroup: fix error return value in cgroup_mount()
Hui Wang <[email protected]>
ALSA: hda - Enable front audio jacks on one HP desktop model
Hsin-Yu Chao <[email protected]>
ALSA: hda/ca0132 - Fix recording from mode id 0x8
Hsin-Yu Chao <[email protected]>
ALSA: hda/ca0132 - setup/cleanup streams
Hui Wang <[email protected]>
ALSA: hda - add headset mic detect quirks for two Dell laptops
Clemens Ladisch <[email protected]>
ALSA: usb-audio: work around KEF X300A firmware bug
Antonio Quartulli <[email protected]>
batman-adv: fix potential kernel paging error for unicast transmissions
Antonio Quartulli <[email protected]>
batman-adv: avoid double free when orig_node initialization fails
Antonio Quartulli <[email protected]>
batman-adv: free skb on TVLV parsing success
Antonio Quartulli <[email protected]>
batman-adv: fix TT CRC computation by ensuring byte order
Simon Wunderlich <[email protected]>
batman-adv: fix potential orig_node reference leak
Antonio Quartulli <[email protected]>
batman-adv: avoid potential race condition when adding a new neighbour
Antonio Quartulli <[email protected]>
batman-adv: properly check pskb_may_pull return value
Antonio Quartulli <[email protected]>
batman-adv: release vlan object after checking the CRC
Antonio Quartulli <[email protected]>
batman-adv: fix TT-TVLV parsing on OGM reception
Antonio Quartulli <[email protected]>
batman-adv: fix soft-interface MTU computation
Eric Dumazet <[email protected]>
net: use __GFP_NORETRY for high order allocations
willy tarreau <[email protected]>
net: mvneta: replace Tx timer with a real interrupt
willy tarreau <[email protected]>
net: mvneta: add missing bit descriptions for interrupt masks and causes
willy tarreau <[email protected]>
net: mvneta: do not schedule in mvneta_tx_timeout
willy tarreau <[email protected]>
net: mvneta: use per_cpu stats to fix an SMP lock up
willy tarreau <[email protected]>
net: mvneta: increase the 64-bit rx/tx stats out of the hot path
Florian Westphal <[email protected]>
net: ip, ipv6: handle gso skbs in forwarding path
Florian Westphal <[email protected]>
net: core: introduce netif_skb_dev_features
Florian Westphal <[email protected]>
net: add and use skb_gso_transport_seglen()
Daniel Borkmann <[email protected]>
net: sctp: fix sctp_connectx abi for ia32 emulation/compat mode
Duan Jiong <[email protected]>
ipv4: fix counter in_slow_tot
Jiri Bohac <[email protected]>
bonding: 802.3ad: make aggregator_identifier bond-private
Emil Goode <[email protected]>
usbnet: remove generic hard_header_len check
Nicolas Dichtel <[email protected]>
gre: add link local route when local addr is any
Emil Goode <[email protected]>
net: asix: add missing flag to struct driver_info
Haiyang Zhang <[email protected]>
hyperv: Fix the carrier status setting
Michael S. Tsirkin <[email protected]>
vhost: fix ref cnt checking deadlock
Nithin Sujir <[email protected]>
tg3: Fix deadlock in tg3_change_mtu()
John Ogness <[email protected]>
tcp: tsq: fix nonagle handling
Bjørn Mork <[email protected]>
net: qmi_wwan: add Netgear Aircard 340U
Sabrina Dubroca <[email protected]>
netpoll: fix netconsole IPv6 setup
Maciej Żenczykowski <[email protected]>
net: fix 'ip rule' iif/oif device rename
Geert Uytterhoeven <[email protected]>
ipv4: Fix runtime WARNING in rtmsg_ifa()
Oliver Hartkopp <[email protected]>
can: add destructor for self generated skbs
Cong Wang <[email protected]>
bridge: fix netconsole setup over bridge
Richard Yao <[email protected]>
9p/trans_virtio.c: Fix broken zero-copy on vmalloc() buffers
Eric Dumazet <[email protected]>
6lowpan: fix lockdep splats
Andy Adamson <[email protected]>
NFS fix error return in nfs4_select_rw_stateid
Trond Myklebust <[email protected]>
NFS: Do not set NFS_INO_INVALID_LABEL unless server supports labeled NFS
Olivier Langlois <[email protected]>
rtlwifi: rtl8192ce: Fix too long disable of IRQs
Olivier Langlois <[email protected]>
rtlwifi: Fix incorrect return from rtl_ps_enable_nic()
Stanislaw Gruszka <[email protected]>
rtl8187: fix regression on MIPS without coherent DMA
Pavel Shilovsky <[email protected]>
CIFS: Fix too big maxBuf size for SMB3 mounts
Jeff Layton <[email protected]>
cifs: ensure that uncached writes handle unmapped areas correctly
Chen Gang <[email protected]>
avr32: Makefile: add '-D__linux__' flag for gcc-4.4.7 use
Paul Gortmaker <[email protected]>
avr32: fix missing module.h causing build failure in mimc200/fram.c
Dan Carpenter <[email protected]>
jbd2: fix use after free in jbd2_journal_start_reserved()
Gavin Shan <[email protected]>
powerpc/powernv: Rework EEH reset
Kevin Hao <[email protected]>
powerpc: Set the correct ksp_limit on ppc32 when switching to irq stack
Stephen Warren <[email protected]>
ARM: tegra: only run PL310 init on systems with one
Shawn Guo <[email protected]>
ARM: imx6: build pm-imx6q.c independently of CONFIG_PM
Pekon Gupta <[email protected]>
ARM: OMAP2+: gpmc: fix: DT ONENAND child nodes not probed when MTD_ONENAND is built as module
Pekon Gupta <[email protected]>
ARM: OMAP2+: gpmc: fix: DT NAND child nodes not probed when MTD_NAND is built as module
Vinayak Kale <[email protected]>
ARM: 7957/1: add DSB after icache flush in __flush_icache_all()
Will Deacon <[email protected]>
ARM: 7955/1: spinlock: ensure we have a compiler barrier before sev
Will Deacon <[email protected]>
ARM: 7953/1: mm: ensure TLB invalidation is complete before enabling MMU
Christoffer Dall <[email protected]>
ARM: 7950/1: mm: Fix stage-2 device memory attributes
Marek Szyprowski <[email protected]>
ARM: dma-mapping: fix GFP_ATOMIC macro usage
Theodore Ts'o <[email protected]>
ext4: don't leave i_crtime.tv_sec uninitialized
Theodore Ts'o <[email protected]>
ext4: fix online resize with a non-standard blocks per group setting
Theodore Ts'o <[email protected]>
ext4: fix online resize with very large inode tables
Theodore Ts'o <[email protected]>
ext4: don't try to modify s_flags if the the file system is read-only
Zheng Liu <[email protected]>
ext4: fix error paths in swap_inode_boot_loader()
Eric Whitney <[email protected]>
ext4: fix xfstest generic/299 block validity failures
Ville Syrjälä <[email protected]>
drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB
Ville Syrjälä <[email protected]>
drm/i915: Add intel_ring_cachline_align()
Ilia Mirkin <[email protected]>
drm/nv50/disp: use correct register to determine DP display bpp
Emil Velikov <[email protected]>
drm/nouveau/fb: use correct ram oclass for nv1a hardware
Ilia Mirkin <[email protected]>
drm/nouveau: set irq_enabled manually
Christian König <[email protected]>
drm/radeon: fix CP semaphores on CIK
Alex Deucher <[email protected]>
drm/radeon: fix display tiling setup on SI
Alex Deucher <[email protected]>
drm/radeon/ni: fix typo in dpm sq ramping setup
-------------
Diffstat:
Makefile | 4 +- arch/arm/include/asm/cacheflush.h | 1 + arch/arm/include/asm/pgtable-3level.h | 15 +- arch/arm/include/asm/spinlock.h | 15 +- arch/arm/mach-imx/Makefile | 2 - arch/arm/mach-imx/common.h | 4 +- arch/arm/mach-omap2/gpmc.c | 4 +- arch/arm/mach-tegra/tegra.c | 10 ++ arch/arm/mm/dma-mapping.c | 2 +- arch/arm/mm/mm.h | 1 + arch/arm/mm/mmu.c | 7 +- arch/arm/mm/proc-v6.S | 3 +- arch/arm/mm/proc-v7.S | 2 +- arch/arm64/kernel/stacktrace.c | 6 +- arch/avr32/Makefile | 2 +- arch/avr32/boards/mimc200/fram.c | 1 + arch/powerpc/include/asm/compat.h | 5 +- arch/powerpc/include/asm/opal.h | 4 +- arch/powerpc/include/asm/ptrace.h | 16 +- arch/powerpc/kernel/crash_dump.c | 8 +- arch/powerpc/kernel/misc_32.S | 5 +- arch/powerpc/kernel/signal_64.c | 4 +- arch/powerpc/platforms/powernv/eeh-ioda.c | 29 +--- arch/powerpc/platforms/powernv/opal-xscom.c | 21 ++- arch/powerpc/platforms/pseries/hotplug-cpu.c | 22 +-- arch/x86/kernel/cpu/perf_event.c | 3 + arch/x86/kernel/pci-dma.c | 4 +- arch/x86/kvm/vmx.c | 2 +- arch/x86/kvm/x86.c | 2 +- arch/xtensa/include/asm/traps.h | 44 +++-- arch/xtensa/kernel/entry.S | 72 ++++++-- drivers/acpi/pci_irq.c | 1 + drivers/acpi/processor_throttling.c | 69 ++++---- drivers/acpi/video.c | 8 +- drivers/ata/ahci.c | 14 ++ drivers/ata/libata-pmp.c | 7 +- drivers/ata/sata_sil.c | 1 + drivers/base/firmware_class.c | 1 + drivers/cpufreq/intel_pstate.c | 2 +- drivers/cpufreq/powernow-k8.c | 10 +- drivers/dma/ioat/dma.c | 52 +++++- drivers/dma/ioat/dma.h | 1 + drivers/dma/ioat/dma_v2.c | 11 +- drivers/dma/ioat/dma_v3.c | 3 + drivers/dma/ste_dma40.c | 4 +- drivers/edac/i7300_edac.c | 38 +++-- drivers/edac/i7core_edac.c | 9 +- drivers/gpu/drm/i915/intel_display.c | 14 ++ drivers/gpu/drm/i915/intel_dp.c | 19 ++- drivers/gpu/drm/i915/intel_ringbuffer.c | 21 +++ drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | 2 +- drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c | 2 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 + drivers/gpu/drm/radeon/atombios_crtc.c | 29 +++- drivers/gpu/drm/radeon/dce6_afmt.c | 2 +- drivers/gpu/drm/radeon/evergreen.c | 2 +- drivers/gpu/drm/radeon/ni_dpm.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 4 +- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 3 +- drivers/gpu/drm/radeon/radeon_kms.c | 6 + drivers/gpu/drm/radeon/radeon_ring.c | 2 +- drivers/gpu/drm/radeon/radeon_semaphore.c | 19 ++- drivers/gpu/drm/radeon/radeon_uvd.c | 2 + drivers/gpu/drm/radeon/rv770.c | 2 +- drivers/hwmon/max1668.c | 2 +- drivers/iio/gyro/Kconfig | 2 +- drivers/iio/gyro/st_gyro.h | 1 - drivers/iio/gyro/st_gyro_core.c | 9 +- drivers/iio/gyro/st_gyro_i2c.c | 1 - drivers/iio/gyro/st_gyro_spi.c | 1 - drivers/input/misc/arizona-haptics.c | 11 +- drivers/iommu/arm-smmu.c | 101 ++++++----- drivers/irqchip/irq-metag-ext.c | 2 +- drivers/irqchip/irq-metag.c | 2 +- drivers/irqchip/irq-orion.c | 22 ++- drivers/md/dm-cache-target.c | 2 +- drivers/md/dm-mpath.c | 7 +- drivers/md/dm-thin-metadata.c | 17 ++ drivers/md/dm-thin-metadata.h | 2 + drivers/md/dm-thin.c | 8 +- drivers/mfd/da9055-i2c.c | 12 +- drivers/misc/mei/client.c | 4 +- drivers/mtd/nand/omap2.c | 61 ++++--- drivers/net/bonding/bond_3ad.c | 6 +- drivers/net/bonding/bond_3ad.h | 1 + drivers/net/can/dev.c | 15 +- drivers/net/can/janz-ican3.c | 18 +- drivers/net/can/usb/kvaser_usb.c | 2 + drivers/net/can/vcan.c | 9 +- drivers/net/ethernet/broadcom/tg3.c | 4 +- drivers/net/ethernet/marvell/mvneta.c | 217 +++++++++++++----------- drivers/net/hyperv/netvsc_drv.c | 53 ++++-- drivers/net/usb/asix_devices.c | 3 +- drivers/net/usb/ax88179_178a.c | 4 + drivers/net/usb/gl620a.c | 4 + drivers/net/usb/mcs7830.c | 5 +- drivers/net/usb/net1080.c | 4 + drivers/net/usb/qmi_wwan.c | 9 +- drivers/net/usb/rndis_host.c | 4 + drivers/net/usb/smsc75xx.c | 4 + drivers/net/usb/smsc95xx.c | 4 + drivers/net/usb/usbnet.c | 25 ++- drivers/net/wireless/rtl818x/rtl8187/rtl8187.h | 10 +- drivers/net/wireless/rtlwifi/ps.c | 2 +- drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 18 +- drivers/pci/host/pci-mvebu.c | 11 +- drivers/pci/pci.c | 10 ++ drivers/regulator/da9063-regulator.c | 4 +- drivers/scsi/qla2xxx/qla_target.c | 3 +- drivers/staging/android/binder.c | 3 +- drivers/staging/iio/adc/mxs-lradc.c | 1 + drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + drivers/usb/chipidea/udc.c | 4 +- drivers/usb/gadget/bcm63xx_udc.c | 58 ++++--- drivers/usb/host/ehci-hcd.c | 13 +- drivers/usb/host/ehci-hub.c | 26 ++- drivers/usb/serial/ftdi_sio.c | 2 + drivers/usb/serial/ftdi_sio_ids.h | 6 + drivers/usb/serial/option.c | 3 +- drivers/vhost/net.c | 41 +++-- fs/attr.c | 5 - fs/btrfs/inode.c | 8 +- fs/cifs/file.c | 37 +++- fs/cifs/smb2glob.h | 3 + fs/cifs/smb2ops.c | 14 +- fs/cifs/smb2pdu.c | 4 +- fs/ext4/ext4.h | 2 + fs/ext4/extents.c | 1 + fs/ext4/inode.c | 4 + fs/ext4/ioctl.c | 3 +- fs/ext4/resize.c | 34 ++-- fs/ext4/super.c | 20 ++- fs/fs-writeback.c | 33 ++-- fs/jbd2/transaction.c | 6 +- fs/nfs/inode.c | 14 +- fs/nfs/internal.h | 9 + fs/nfs/nfs4state.c | 5 +- fs/quota/dquot.c | 14 +- fs/sync.c | 15 +- fs/xfs/xfs_super.c | 2 +- include/linux/can/skb.h | 38 +++++ include/linux/export.h | 1 + include/linux/ipc_namespace.h | 2 - include/linux/netdevice.h | 7 +- include/linux/skbuff.h | 18 ++ include/linux/writeback.h | 2 +- include/trace/events/writeback.h | 6 +- ipc/mq_sysctl.c | 18 +- ipc/mqueue.c | 6 +- kernel/cgroup.c | 32 ++-- kernel/events/core.c | 12 +- kernel/workqueue.c | 7 + mm/huge_memory.c | 9 +- mm/memory.c | 14 +- net/9p/trans_virtio.c | 5 +- net/batman-adv/bat_iv_ogm.c | 30 ++-- net/batman-adv/hard-interface.c | 22 ++- net/batman-adv/originator.c | 36 ++++ net/batman-adv/originator.h | 4 + net/batman-adv/routing.c | 4 +- net/batman-adv/send.c | 9 +- net/batman-adv/translation-table.c | 23 ++- net/bridge/br_device.c | 51 +++--- net/can/af_can.c | 3 +- net/can/bcm.c | 4 +- net/core/dev.c | 22 +-- net/core/fib_rules.c | 7 + net/core/netpoll.c | 4 +- net/core/skbuff.c | 25 +++ net/core/sock.c | 6 +- net/ieee802154/6lowpan.c | 20 +++ net/ipv4/devinet.c | 3 +- net/ipv4/ip_forward.c | 71 +++++++- net/ipv4/route.c | 4 +- net/ipv4/tcp_output.c | 13 +- net/ipv6/addrconf.c | 2 + net/ipv6/ip6_output.c | 17 +- net/sched/sch_tbf.c | 13 +- net/sctp/socket.c | 41 ++++- net/sunrpc/auth_gss/auth_gss.c | 13 +- net/sunrpc/xprtsock.c | 6 +- security/selinux/ss/policydb.c | 8 +- sound/pci/hda/patch_ca0132.c | 68 +------- sound/pci/hda/patch_realtek.c | 2 + sound/pci/hda/patch_sigmatel.c | 33 ++++ sound/soc/codecs/da732x.c | 12 ++ sound/soc/codecs/da9055.c | 11 +- sound/soc/codecs/max98090.c | 20 +-- sound/soc/codecs/rt5640.c | 1 + sound/soc/codecs/sta32x.c | 76 ++++----- sound/soc/codecs/wm8770.c | 4 +- sound/soc/codecs/wm8958-dsp2.c | 2 +- sound/soc/fsl/imx-mc13783.c | 1 - sound/soc/fsl/imx-sgtl5000.c | 10 +- sound/soc/fsl/imx-wm8962.c | 11 +- sound/soc/txx9/txx9aclc-ac97.c | 8 +- sound/usb/mixer_maps.c | 9 + tools/perf/builtin-trace.c | 22 +++ 199 files changed, 1792 insertions(+), 929 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/172 drm/radeon/ni: fix typo in dpm sq ramping setup
3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 21ed4947fdfe19b60a27b84162622e56439c7937 upstream.
inverted logic.
--- drivers/gpu/drm/radeon/ni_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ni_dpm.c +1 -1
@@ -2586,7 +2586,7 @@ static int ni_populate_sq_ramping_valuesif (NISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >>STI_SIZE_SHIFT )) enable_sq_ramping = false; -if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO <= (LTI_RATIO_MASK >>LTI_RATIO_SHIFT )) +if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >>LTI_RATIO_SHIFT )) enable_sq_ramping = false;for (i =0 ; i < state->performance_level_count; i++) {
Greg Kroah-Hartman
maintainerPATCH 2/172 drm/radeon: fix display tiling setup on SI
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 6d8ea7de3f5035610f3bfacbe35e7b71ad1e4663 upstream.
Apply the same logic as CI to SI for setting up the display tiling parameters. The num banks may vary per tiling index just like CI.
Bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=71488
https://bugs.freedesktop.org/show_bug.cgi?id=73946
https://bugs.freedesktop.org/show_bug.cgi?id=74927
--- drivers/gpu/drm/radeon/atombios_crtc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +7 -6
@@ -1169,7 +1169,7 @@ static int dce4_crtc_do_set_base(structevergreen_tiling_fields (tiling_flags, &bankw, &bankh, &mtaspect, &tile_split);/* Set NUM_BANKS. */ -if (rdev->family >=CHIP_BONAIRE ) { +if (rdev->family >=CHIP_TAHITI ) {unsigned tileb, index, num_banks, tile_split_bytes;/* Calculate the macrotile mode index. */
@@ -1187,13 +1187,14 @@ static int dce4_crtc_do_set_base(structreturn -EINVAL ; } - num_banks = (rdev->config.cik.macrotile_mode_array[index] >>6 ) &0x3 ; +if (rdev->family >=CHIP_BONAIRE ) + num_banks = (rdev->config.cik.macrotile_mode_array[index] >>6 ) &0x3 ; +else + num_banks = (rdev->config.si.tile_mode_array[index] >>20 ) &0x3 ; fb_format |=EVERGREEN_GRPH_NUM_BANKS (num_banks); }else { -/* SI and older. */ -if (rdev->family >=CHIP_TAHITI ) - tmp = rdev->config.si.tile_config; -else if (rdev->family >=CHIP_CAYMAN ) +/* NI and older. */ +if (rdev->family >=CHIP_CAYMAN ) tmp = rdev->config.cayman.tile_config;else tmp = rdev->config.evergreen.tile_config;
Greg Kroah-Hartman
maintainerPATCH 4/172 drm/nouveau: set irq_enabled manually
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilia Mirkin <[email protected]>
commit 7d3428cd4b2ad51af86fdbdf8284ca38fa95e601 upstream.
Since commit 0fa9061ae8c ("drm/nouveau/mc: handle irq-related setup ourselves"), drm_device->irq_enabled remained unset. This is needed in order to properly wait for a vblank event in the generic drm code.
See https://bugs.freedesktop.org/show_bug.cgi?id=74195
--- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +3 -0
@@ -376,6 +376,8 @@ nouveau_drm_load(struct drm_device *dev,if (ret) goto fail_device; + dev->irq_enabled = true; +/* workaround an odd issue on nvc1 by disabling the device's * nosnoop capability. hopefully won't cause issues until a * better fix is found - assuming there is one...
@@ -475,6 +477,7 @@ nouveau_drm_remove(struct pci_dev *pdev)struct nouveau_drm *drm =nouveau_drm (dev);struct nouveau_object *device; + dev->irq_enabled = false; device = drm->client.base.device;drm_put_dev (dev);
Greg Kroah-Hartman
maintainerPATCH 5/172 drm/nouveau/fb: use correct ram oclass for nv1a hardware
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Velikov <[email protected]>
commit 95ca5b550ac255bf3cee108c123407785c47e3cc upstream.
commit 8613e7314ac254fdd67ed46192f021d76141e4c9
Author: Ben Skeggs <[email protected]> Date: Mon Oct 21 08:50:25 2013 +1000
drm/nouveau/fb: remove ram oclass argument from base fb constructor
Introduced a unfortunate regression by using nv10 ram oclass for nv1a hardware, causing corruption and eventually system lockup.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74866
--- drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c +1 -1
@@ -36,7 +36,7 @@ nv1a_fb_oclass = &(struct nv04_fb_impl) .fini = _nouveau_fb_fini, }, .base.memtype = nv04_fb_memtype_valid, - .base.ram = &nv10_ram_oclass, + .base.ram = &nv1a_ram_oclass, .tile.regions = 8, .tile.init = nv10_fb_tile_init, .tile.fini = nv10_fb_tile_fini,
Greg Kroah-Hartman
maintainerPATCH 6/172 drm/nv50/disp: use correct register to determine DP display bpp
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilia Mirkin <[email protected]>
commit a7f1c1e65b68e1e1ab70898528d5977ed68a0a7d upstream.
Commit 0a0afd282f ("drm/nv50-/disp: move DP link training to core and train from supervisor") added code that uses the wrong register for computing the display bpp, used for bandwidth calculation. Adjust to use the same register as used by exec_clkcmp and nv50_disp_intr_unk20_2_dp.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67628
--- drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +1 -1
@@ -1112,7 +1112,7 @@ nv50_disp_intr_unk20_2(struct nv50_disp_if (conf != ~0 ) {if (outp.location ==0 && outp.type ==DCB_OUTPUT_DP ) {u32 soff = (ffs (outp.or) -1 ) *0x08 ; -u32 ctrl =nv_rd32 (priv,0x610798 + soff); +u32 ctrl =nv_rd32 (priv,0x610794 + soff);u32 datarate;switch ((ctrl &0x000f0000 ) >>16 ) {
Greg Kroah-Hartman
maintainerPATCH 9/172 ext4: fix xfstest generic/299 block validity failures
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Whitney <[email protected]>
commit 15cc17678547676c82a5da9ccf357447333fc342 upstream.
Commit a115f749c1 (ext4: remove wait for unwritten extent conversion from ext4_truncate) exposed a bug in ext4_ext_handle_uninitialized_extents(). It can be triggered by xfstest generic/299 when run on a test file system created without a journal. This test continuously fallocates and truncates files to which random dio/aio writes are simultaneously performed by a separate process. The test completes successfully, but if the test filesystem is mounted with the block_validity option, a warning message stating that a logical block has been mapped to an illegal physical block is posted in the kernel log.
The bug occurs when an extent is being converted to the written state by ext4_end_io_dio() and ext4_ext_handle_uninitialized_extents() discovers a mapping for an existing uninitialized extent. Although it sets EXT4_MAP_MAPPED in map->m_flags, it fails to set map->m_pblk to the discovered physical block number. Because map->m_pblk is not otherwise initialized or set by this function or its callers, its uninitialized value is returned to ext4_map_blocks(), where it is stored as a bogus mapping in the extent status tree.
Since map->m_pblk can accidentally contain illegal values that are larger than the physical size of the file system, calls to check_block_validity() in ext4_map_blocks() that are enabled if the block_validity mount option is used can fail, resulting in the logged warning message.
--- fs/ext4/extents.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/extents.c +1 -0
@@ -3906,6 +3906,7 @@ ext4_ext_handle_uninitialized_extents(ha }else err = ret; map->m_flags |=EXT4_MAP_MAPPED ; + map->m_pblk = newblock;if (allocated > map->m_len) allocated = map->m_len; map->m_len = allocated;
Greg Kroah-Hartman
maintainerPATCH 10/172 ext4: fix error paths in swap_inode_boot_loader()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Liu <[email protected]>
commit 30d29b119ef01776e0a301444ab24defe8d8bef3 upstream.
In swap_inode_boot_loader() we forgot to release ->i_mutex and resume unlocked dio for inode and inode_bl if there is an error starting the journal handle. This commit fixes this issue.
--- fs/ext4/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/ioctl.c +2 -1
@@ -144,7 +144,7 @@ static long swap_inode_boot_loader(struc handle =ext4_journal_start (inode_bl,EXT4_HT_MOVE_EXTENTS ,2 );if (IS_ERR (handle)) { err = -EINVAL ; - goto swap_boot_out; + goto journal_err_out; }/* Protect extent tree against block allocations via delalloc */
@@ -202,6 +202,7 @@ static long swap_inode_boot_loader(strucext4_double_up_write_data_sem (inode, inode_bl); +journal_err_out:ext4_inode_resume_unlocked_dio (inode);ext4_inode_resume_unlocked_dio (inode_bl);
Greg Kroah-Hartman
maintainerPATCH 11/172 ext4: dont try to modify s_flags if the the file system is read-only
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 23301410972330c0ae9a8afc379ba2005e249cc6 upstream.
If an ext4 file system is created by some tool other than mke2fs (perhaps by someone who has a pathalogical fear of the GPL) that doesn't set one or the other of the EXT2_FLAGS_{UN}SIGNED_HASH flags, and that file system is then mounted read-only, don't try to modify the s_flags field. Otherwise, if dm_verity is in use, the superblock will change, causing an dm_verity failure.
--- fs/ext4/super.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
fs/ext4/super.c +13 -7
@@ -3695,16 +3695,22 @@ static int ext4_fill_super(struct super_for (i =0 ; i <4 ; i++) sbi->s_hash_seed[i] =le32_to_cpu (es->s_hash_seed[i]); sbi->s_def_hash_version = es->s_def_hash_version; - i =le32_to_cpu (es->s_flags); -if (i &EXT2_FLAGS_UNSIGNED_HASH ) - sbi->s_hash_unsigned =3 ; -else if ((i &EXT2_FLAGS_SIGNED_HASH ) ==0 ) { +if (EXT4_HAS_COMPAT_FEATURE (sb,EXT4_FEATURE_COMPAT_DIR_INDEX )) { + i =le32_to_cpu (es->s_flags); +if (i &EXT2_FLAGS_UNSIGNED_HASH ) + sbi->s_hash_unsigned =3 ; +else if ((i &EXT2_FLAGS_SIGNED_HASH ) ==0 ) {#ifdef __CHAR_UNSIGNED__ - es->s_flags |=cpu_to_le32 (EXT2_FLAGS_UNSIGNED_HASH ); - sbi->s_hash_unsigned =3 ; +if (!(sb->s_flags &MS_RDONLY )) + es->s_flags |= +cpu_to_le32 (EXT2_FLAGS_UNSIGNED_HASH ); + sbi->s_hash_unsigned =3 ;#else - es->s_flags |=cpu_to_le32 (EXT2_FLAGS_SIGNED_HASH ); +if (!(sb->s_flags &MS_RDONLY )) + es->s_flags |= +cpu_to_le32 (EXT2_FLAGS_SIGNED_HASH );#endif + } }/* Handle clustersize */
Greg Kroah-Hartman
maintainerPATCH 12/172 ext4: fix online resize with very large inode tables
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit b93c95353413041a8cebad915a8109619f66bcc6 upstream.
If a file system has a large number of inodes per block group, all of the metadata blocks in a flex_bg may be larger than what can fit in a single block group. Unfortunately, ext4_alloc_group_tables() in resize.c was never tested to see if it would handle this case correctly, and there were a large number of bugs which caused the following sequence to result in a BUG_ON:
kernel bug at fs/ext4/resize.c:409!
...
call trace:
[<ffffffff81256768>] ext4_flex_group_add+0x1448/0x1830 [<ffffffff81257de2>] ext4_resize_fs+0x7b2/0xe80 [<ffffffff8123ac50>] ext4_ioctl+0xbf0/0xf00 [<ffffffff811c111d>] do_vfs_ioctl+0x2dd/0x4b0 [<ffffffff811b9df2>] ? final_putname+0x22/0x50 [<ffffffff811c1371>] sys_ioctl+0x81/0xa0 [<ffffffff81676aa9>] system_call_fastpath+0x16/0x1b
code: c8 4c 89 df e8 41 96 f8 ff 44 89 e8 49 01 c4 44 29 6d d4 0 rip [<ffffffff81254fa1>] set_flexbg_block_bitmap+0x171/0x180
This can be reproduced with the following command sequence:
mke2fs -t ext4 -i 4096 /dev/vdd 1G
mount -t ext4 /dev/vdd /vdd
resize2fs /dev/vdd 8G
To fix this, we need to make sure the right thing happens when a block group's inode table straddles two block groups, which means the following bugs had to be fixed:
1) Not clearing the BLOCK_UNINIT flag in the second block group in ext4_alloc_group_tables --- the was proximate cause of the BUG_ON.
2) Incorrectly determining how many block groups contained contiguous free blocks in ext4_alloc_group_tables().
3) Incorrectly setting the start of the next block range to be marked in use after a discontinuity in setup_new_flex_group_blocks().
--- fs/ext4/resize.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
fs/ext4/resize.c +20 -12
@@ -243,6 +243,7 @@ static int ext4_alloc_group_tables(strucext4_group_t group;ext4_group_t last_group;unsigned overhead; +__u16 uninit_mask = (flexbg_size >1 ) ? ~EXT4_BG_BLOCK_UNINIT : ~0 ;BUG_ON (flex_gd->count ==0 || group_data ==NULL );
@@ -266,7 +267,7 @@ next_group: src_group++;for (; src_group <= last_group; src_group++) { overhead =ext4_group_overhead_blocks (sb, src_group); -if (overhead !=0 ) +if (overhead ==0 ) last_blk += group_data[src_group - group].blocks_count;else break ;
@@ -280,8 +281,7 @@ next_group: group =ext4_get_group_number (sb, start_blk -1 ); group -= group_data[0 ].group; group_data[group].free_blocks_count--; -if (flexbg_size >1 ) - flex_gd->bg_flags[group] &= ~EXT4_BG_BLOCK_UNINIT ; + flex_gd->bg_flags[group] &= uninit_mask; }/* Allocate inode bitmaps */
@@ -292,22 +292,30 @@ next_group: group =ext4_get_group_number (sb, start_blk -1 ); group -= group_data[0 ].group; group_data[group].free_blocks_count--; -if (flexbg_size >1 ) - flex_gd->bg_flags[group] &= ~EXT4_BG_BLOCK_UNINIT ; + flex_gd->bg_flags[group] &= uninit_mask; }/* Allocate inode tables */ for (; it_index < flex_gd->count; it_index++) { -if (start_blk +EXT4_SB (sb)->s_itb_per_group > last_blk) +unsigned int itb =EXT4_SB (sb)->s_itb_per_group; +ext4_fsblk_t next_group_start; + +if (start_blk + itb > last_blk) goto next_group; group_data[it_index].inode_table = start_blk; - group =ext4_get_group_number (sb, start_blk -1 ); + group =ext4_get_group_number (sb, start_blk); + next_group_start =ext4_group_first_block_no (sb, group +1 ); group -= group_data[0 ].group; - group_data[group].free_blocks_count -= -EXT4_SB (sb)->s_itb_per_group; -if (flexbg_size >1 ) - flex_gd->bg_flags[group] &= ~EXT4_BG_BLOCK_UNINIT ; +if (start_blk + itb > next_group_start) { + flex_gd->bg_flags[group +1 ] &= uninit_mask; + overhead = start_blk + itb - next_group_start; + group_data[group +1 ].free_blocks_count -= overhead; + itb -= overhead; + } + + group_data[group].free_blocks_count -= itb; + flex_gd->bg_flags[group] &= uninit_mask; start_blk +=EXT4_SB (sb)->s_itb_per_group; }
@@ -620,7 +628,7 @@ handle_ib:if (err) goto out; count = group_table_count[j]; - start = group_data[i].block_bitmap; + start = (&group_data[i].block_bitmap)[j]; block = start; }
Greg Kroah-Hartman
maintainerPATCH 13/172 ext4: fix online resize with a non-standard blocks per group setting
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 3d2660d0c9c2f296837078c189b68a47f6b2e3b5 upstream.
The set_flexbg_block_bitmap() function assumed that the number of blocks in a blockgroup was sb->blocksize * 8, which is normally true, but not always! Use EXT4_BLOCKS_PER_GROUP(sb) instead, to fix block bitmap corruption after:
mke2fs -t ext4 -g 3072 -i 4096 /dev/vdd 1G
mount -t ext4 /dev/vdd /vdd
resize2fs /dev/vdd 8G
--- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/resize.c +1 -1
@@ -409,7 +409,7 @@ static int set_flexbg_block_bitmap(struc start =ext4_group_first_block_no (sb, group); group -= flex_gd->groups[0 ].group; - count2 = sb->s_blocksize *8 - (block - start); + count2 =EXT4_BLOCKS_PER_GROUP (sb) - (block - start);if (count2 > count) count2 = count;
Greg Kroah-Hartman
maintainerPATCH 14/172 ext4: dont leave i_crtime.tv_sec uninitialized
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 19ea80603715d473600cd993b9987bc97d042e02 upstream.
If the i_crtime field is not present in the inode, don't leave the field uninitialized.
--- fs/ext4/ext4.h | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/ext4.h +2 -0
@@ -771,6 +771,8 @@ do { \if (EXT4_FITS_IN_INODE (raw_inode, einode, xtime)) \ (einode)->xtime.tv_sec = \ (signed )le32_to_cpu ((raw_inode)->xtime); \ +else \ + (einode)->xtime.tv_sec =0 ; \ if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ext4_decode_extra_time (&(einode)->xtime, \ raw_inode->xtime ## _extra); \
Greg Kroah-Hartman
maintainerPATCH 15/172 ARM: dma-mapping: fix GFP_ATOMIC macro usage
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 10c8562f932d89c030083e15f9279971ed637136 upstream.
GFP_ATOMIC is not a single gfp flag, but a macro which expands to the other flags and LACK of __GFP_WAIT flag. To check if caller wanted to perform an atomic allocation, the code must test __GFP_WAIT flag presence. This patch fixes the issue introduced in v3.6-rc5
--- arch/arm/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/dma-mapping.c +1 -1
@@ -1358,7 +1358,7 @@ static void *arm_iommu_alloc_attrs(struc *handle =DMA_ERROR_CODE ; size =PAGE_ALIGN (size); -if (gfp &GFP_ATOMIC ) +if (!(gfp & __GFP_WAIT))return __iommu_alloc_atomic (dev, size, handle);/*
Greg Kroah-Hartman
maintainerPATCH 16/172 ARM: 7950/1: mm: Fix stage-2 device memory attributes
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoffer Dall <[email protected]>
commit 4d9c5b89cf3605bbc39c6e274351ff25f0d83e6a upstream.
The stage-2 memory attributes are distinct from the Hyp memory attributes and the Stage-1 memory attributes. We were using the stage-1 memory attributes for stage-2 mappings causing device mappings to be mapped as normal memory. Add the S2 equivalent defines for memory attributes and fix the comments explaining the defines while at it.
Add a prot_pte_s2 field to the mem_type struct and fill out the field for device mappings accordingly.
--- arch/arm/include/asm/pgtable-3level.h | 15 +++++++++------ arch/arm/mm/mm.h | 1 + arch/arm/mm/mmu.c | 7 ++++++- 3 files changed, 16 insertions(+), 7 deletions(-)
arch/arm/include/asm/pgtable-3level.h +9 -6
@@ -120,13 +120,16 @@/* * 2nd stage PTE definitions for LPAE. */ -#define L_PTE_S2_MT_UNCACHED (_AT(pteval_t, 0x5) << 2)/* MemAttr[3:0] */ -#define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2)/* MemAttr[3:0] */ -#define L_PTE_S2_MT_WRITEBACK (_AT(pteval_t, 0xf) << 2)/* MemAttr[3:0] */ -#define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6)/* HAP[1] */ -#define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6)/* HAP[2:1] */ +#define L_PTE_S2_MT_UNCACHED (_AT(pteval_t, 0x0) << 2)/* strongly ordered */ +#define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2)/* normal inner write-through */ +#define L_PTE_S2_MT_WRITEBACK (_AT(pteval_t, 0xf) << 2)/* normal inner write-back */ +#define L_PTE_S2_MT_DEV_SHARED (_AT(pteval_t, 0x1) << 2)/* device */ +#define L_PTE_S2_MT_MASK (_AT(pteval_t, 0xf) << 2) -#define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6)/* HAP[2:1] */ +#define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6)/* HAP[1] */ +#define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6)/* HAP[2:1] */ + +#define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6)/* HAP[2:1] */ /* * Hyp-mode PL2 PTE definitions for LPAE.
arch/arm/mm/mm.h +1 -0
@@ -38,6 +38,7 @@ static inline pmd_t *pmd_off_k(unsignedstruct mem_type {pteval_t prot_pte; +pteval_t prot_pte_s2;pmdval_t prot_l1;pmdval_t prot_sect;unsigned int domain;
arch/arm/mm/mmu.c +6 -1
@@ -231,12 +231,16 @@ __setup("noalign", noalign_setup);#endif /* ifdef CONFIG_CPU_CP15 / else */ #define PROT_PTE_DEVICE L_PTE_PRESENT|L_PTE_YOUNG|L_PTE_DIRTY|L_PTE_XN +#define PROT_PTE_S2_DEVICE PROT_PTE_DEVICE#define PROT_SECT_DEVICE PMD_TYPE_SECT|PMD_SECT_AP_WRITEstatic struct mem_type mem_types[] = { [MT_DEVICE ] = {/* Strongly ordered / ARMv6 shared device */ .prot_pte =PROT_PTE_DEVICE |L_PTE_MT_DEV_SHARED |L_PTE_SHARED , + .prot_pte_s2 =s2_policy (PROT_PTE_S2_DEVICE ) | +s2_policy (L_PTE_S2_MT_DEV_SHARED ) | +L_PTE_SHARED , .prot_l1 =PMD_TYPE_TABLE , .prot_sect =PROT_SECT_DEVICE |PMD_SECT_S , .domain =DOMAIN_IO ,
@@ -458,7 +462,8 @@ static void __init build_mem_type_table( cp = &cache_policies[cachepolicy]; vecs_pgprot = kern_pgprot = user_pgprot = cp->pte; s2_pgprot = cp->pte_s2; - hyp_device_pgprot = s2_device_pgprot = mem_types[MT_DEVICE ].prot_pte; + hyp_device_pgprot = mem_types[MT_DEVICE ].prot_pte; + s2_device_pgprot = mem_types[MT_DEVICE ].prot_pte_s2;/* * ARMv6 and above have extended page tables.
Greg Kroah-Hartman
maintainerPATCH 17/172 ARM: 7953/1: mm: ensure TLB invalidation is complete before enabling MMU
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit bae0ca2bc550d1ec6a118fb8f2696f18c4da3d8e upstream.
During __v{6,7}_setup, we invalidate the TLBs since we are about to enable the MMU on return to head.S. Unfortunately, without a subsequent dsb instruction, the invalidation is not guaranteed to have completed by the time we write to the sctlr, potentially exposing us to junk/stale translations cached in the TLB.
This patch reworks the init functions so that the dsb used to ensure completion of cache/predictor maintenance is also used to ensure completion of the TLB invalidation.
--- arch/arm/mm/proc-v6.S | 3 ++- arch/arm/mm/proc-v7.S | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mm/proc-v6.S +2 -1
@@ -208,7 +208,6 @@ __v6_setup: mcr p15, 0, r0, c7, c14, 0 @ clean+invalidate D cache mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache mcr p15, 0, r0, c7, c15, 0 @ clean+invalidate cache - mcr p15, 0, r0, c7, c10, 4 @ drain write buffer #ifdef CONFIG_MMU mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs mcr p15, 0, r0, c2, c0, 2 @ TTB control register
@@ -218,6 +217,8 @@ __v6_setup: ALT_UP(orr r8, r8, #TTB_FLAGS_UP) mcr p15, 0, r8, c2, c0, 1 @ load TTB1 #endif /* CONFIG_MMU */ + mcr p15, 0, r0, c7, c10, 4 @ drain write buffer and + @ complete invalidations adr r5, v6_crval ldmia r5, {r5, r6} ARM_BE8(orr r6, r6, #1 << 25) @ big-endian page tables
arch/arm/mm/proc-v7.S +1 -1
@@ -351,7 +351,6 @@ __v7_setup: 4: mov r10, #0 mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate - dsb #ifdef CONFIG_MMU mcr p15, 0, r10, c8, c7, 0 @ invalidate I + D TLBs v7_ttb_setup r10, r4, r8, r5 @ TTBCR, TTBRx setup
@@ -360,6 +359,7 @@ __v7_setup: mcr p15, 0, r5, c10, c2, 0 @ write PRRR mcr p15, 0, r6, c10, c2, 1 @ write NMRR #endif + dsb @ Complete invalidations #ifndef CONFIG_ARM_THUMBEE mrc p15, 0, r0, c0, c1, 0 @ read ID_PFR0 for ThumbEE and r0, r0, #(0xf << 12) @ ThumbEE enabled field
Greg Kroah-Hartman
maintainerPATCH 18/172 ARM: 7955/1: spinlock: ensure we have a compiler barrier before sev
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 7c8746a9eb287642deaad0e7c2cdf482dce5e4be upstream.
When unlocking a spinlock, we require the following, strictly ordered sequence of events:
<barrier> /* dmb */ <unlock> <barrier> /* dsb */ <sev>
Whilst the code does indeed reflect this in terms of the architecture, the final <barrier> + <sev> have been contracted into a single inline asm without a "memory" clobber, therefore the compiler is at liberty to reorder the unlock to the end of the above sequence. In such a case, a waiting CPU may be woken up before the lock has been unlocked, leading to extremely poor performance.
This patch reworks the dsb_sev() function to make use of the dsb() macro and ensure ordering against the unlock.
--- arch/arm/include/asm/spinlock.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
arch/arm/include/asm/spinlock.h +3 -12
@@ -37,18 +37,9 @@static inline void dsb_sev (void ) { -#if __LINUX_ARM_ARCH__ >=7 - __asm__ __volatile__ ( -"dsb ishst\n" -SEV - ); -#else - __asm__ __volatile__ ( -"mcr p15, 0, %0, c7, c10, 4\n" -SEV - : :"r" (0 ) - ); -#endif + +dsb (ishst); + __asm__(SEV); }/*
Greg Kroah-Hartman
maintainerPATCH 19/172 ARM: 7957/1: add DSB after icache flush in __flush_icache_all()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinayak Kale <[email protected]>
commit 39544ac9df20f73e49fc6b9ac19ff533388c82c0 upstream.
Add DSB after icache flush to complete the cache maintenance operation.
--- arch/arm/include/asm/cacheflush.h | 1 + 1 file changed, 1 insertion(+)
arch/arm/include/asm/cacheflush.h +1 -0
@@ -212,6 +212,7 @@ extern void copy_to_user_page(struct vm_static inline void __flush_icache_all (void ) {__flush_icache_preferred (); +dsb (); }/*
Greg Kroah-Hartman
maintainerPATCH 20/172 ARM: OMAP2+: gpmc: fix: DT NAND child nodes not probed when MTD_NAND is built as module
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekon Gupta <[email protected]>
commit 6b187b21c92b6e2c7e8ef0b450181c37a3f31681 upstream.
ARM: OMAP: gpmc: add DT bindings for GPMC timings and NAND
OMAP SoC(s) depend on GPMC controller driver to parse GPMC DT child nodes and register them platform_device for NAND driver to probe later. However this does not happen if generic MTD_NAND framework is built as module (CONFIG_MTD_NAND=m).
Therefore, when MTD/NAND and MTD/NAND/OMAP2 modules are loaded, they are unable to find any matching platform_device and remain un-binded. This causes on board NAND flash to remain un-detected.
This patch causes GPMC controller to parse DT nodes when CONFIG_MTD_NAND=y || CONFIG_MTD_NAND=m
--- arch/arm/mach-omap2/gpmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/gpmc.c +1 -1
@@ -1339,7 +1339,7 @@ static void __maybe_unused gpmc_read_timof_property_read_bool (np,"gpmc,time-para-granularity" ); } -#ifdef CONFIG_MTD_NAND +#if IS_ENABLED (CONFIG_MTD_NAND )static const char *const nand_xfer_types[] = { [NAND_OMAP_PREFETCH_POLLED] = "prefetch-polled",
Greg Kroah-Hartman
maintainerPATCH 21/172 ARM: OMAP2+: gpmc: fix: DT ONENAND child nodes not probed when MTD_ONENAND is built as module
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekon Gupta <[email protected]>
commit 980386d2d6d49e0b42f48550853ef1ad6aa5d79a upstream.
ARM: OMAP2+: gpmc: add DT bindings for OneNAND
OMAP SoC(s) depend on GPMC controller driver to parse GPMC DT child nodes and register them platform_device for ONENAND driver to probe later. However this does not happen if generic MTD_ONENAND framework is built as module (CONFIG_MTD_ONENAND=m).
Therefore, when MTD/ONENAND and MTD/ONENAND/OMAP2 modules are loaded, they are unable to find any matching platform_device and remain un-binded. This causes on board ONENAND flash to remain un-detected.
This patch causes GPMC controller to parse DT nodes when CONFIG_MTD_ONENAND=y || CONFIG_MTD_ONENAND=m
--- arch/arm/mach-omap2/gpmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/gpmc.c +1 -1
@@ -1429,7 +1429,7 @@ static int gpmc_probe_nand_child(struct }#endif -#ifdef CONFIG_MTD_ONENAND +#if IS_ENABLED (CONFIG_MTD_ONENAND )static int gpmc_probe_onenand_child (struct platform_device *pdev,struct device_node *child) {
Greg Kroah-Hartman
maintainerPATCH 22/172 ARM: imx6: build pm-imx6q.c independently of CONFIG_PM
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Guo <[email protected]>
commit 28a9f3b078c545064dcf4b46d2c6917554d1642e upstream.
When building a kernel image with only CONFIG_CPU_IDLE but no CONFIG_PM, we will get the following link error.
LD init/built-in.oarch/arm/mach-imx/built-in.o: In function `imx6q_enter_wait':
platform-spi_imx.c:(.text+0x25c0): undefined reference to imx6q_set_lpm' platform-spi_imx.c:(.text+0x25d4): undefined reference to imx6q_set_lpm' arch/arm/mach-imx/built-in.o: In function `imx6q_cpuidle_init':
platform-spi_imx.c:(.init.text+0x75d4): undefined reference to `imx6q_set_chicken_bit' make[1]: *** [vmlinux] Error 1
Since pm-imx6q.c has been a collection of library functions that access CCM low-power registers used by not only suspend but also cpuidle and other drivers, let's build pm-imx6q.c independently of CONFIG_PM to fix above error.
--- arch/arm/mach-imx/Makefile | 2 -- arch/arm/mach-imx/common.h | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-)
arch/arm/mach-imx/Makefile +0 -2
@@ -100,11 +100,9 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o -ifeq ($(CONFIG_PM),y) obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o # i.MX6SL reuses i.MX6Q code obj-$(CONFIG_SOC_IMX6SL) += pm-imx6q.o headsmp.o -endif # i.MX5 based machines obj-$(CONFIG_MACH_MX51_BABBAGE) += mach-mx51_babbage.o
arch/arm/mach-imx/common.h +1 -3
@@ -143,13 +143,11 @@ void imx6q_set_chicken_bit(void);void imx_cpu_die (unsigned int cpu);int imx_cpu_kill (unsigned int cpu); -#ifdef CONFIG_PM void imx6q_pm_init (void );void imx6q_pm_set_ccm_base (void __iomem *base); +#ifdef CONFIG_PM void imx5_pm_init (void );#else -static inline void imx6q_pm_init (void ) {} -static inline void imx6q_pm_set_ccm_base (void __iomem *base) {}static inline void imx5_pm_init (void ) {}#endif
Greg Kroah-Hartman
maintainerPATCH 23/172 ARM: tegra: only run PL310 init on systems with one
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
commit 8859685785bfafadf9bc922dd3a2278e59886947 upstream.
Fix tegra_init_cache() to check whether the system has a PL310 cache before touching the PL310 registers. This prevents access to non-existent registers on Tegra114 and later.
Note for stable kernels:
In <= v3.12, the file to patch is arch/arm/mach-tegra/common.c.
--- arch/arm/mach-tegra/tegra.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-tegra/tegra.c +10 -0
@@ -74,10 +74,20 @@ u32 tegra_uart_config[4] = {static void __init tegra_init_cache (void ) {#ifdef CONFIG_CACHE_L2X0 +static const struct of_device_id pl310_ids[]__initconst = { + { .compatible ="arm,pl310-cache" , }, + {} + }; + +struct device_node *np;int ret;void __iomem *p =IO_ADDRESS (TEGRA_ARM_PERIF_BASE ) +0x3000 ;u32 aux_ctrl, cache_type; + np =of_find_matching_node (NULL , pl310_ids); +if (!np) +return ; + cache_type =readl (p +L2X0_CACHE_TYPE ); aux_ctrl = (cache_type &0x700 ) << (17 -8 ); aux_ctrl |=0x7C400001 ;
Greg Kroah-Hartman
maintainerPATCH 24/172 powerpc: Set the correct ksp_limit on ppc32 when switching to irq stack
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Hao <[email protected]>
commit 1a18a66446f3f289b05b634f18012424d82aa63a upstream.
Guenter Roeck has got the following call trace on a p2020 board:
Kernel stack overflow in process eb3e5a00, r1=eb79df90
CPU: 0 PID: 2838 Comm: ssh Not tainted 3.13.0-rc8-juniper-00146-g19eca00 #4
task: eb3e5a00 ti: c0616000 task.ti: ef440000
NIP: c003a420 LR: c003a410 CTR: c0017518
REGS: eb79dee0 TRAP: 0901 Not tainted (3.13.0-rc8-juniper-00146-g19eca00)
MSR: 00029000 <CE,EE,ME> CR: 24008444 XER: 00000000
GPR00: c003a410 eb79df90 eb3e5a00 00000000 eb05d900 00000001 65d87646 00000000
GPR08: 00000000 020b8000 00000000 00000000 44008442
NIP [c003a420] __do_softirq+0x94/0x1ec
LR [c003a410] __do_softirq+0x84/0x1ec
Call Trace:
[eb79df90] [c003a410] __do_softirq+0x84/0x1ec (unreliable)
[eb79dfe0] [c003a970] irq_exit+0xbc/0xc8
[eb79dff0] [c000cc1c] call_do_irq+0x24/0x3c
[ef441f20] [c00046a8] do_IRQ+0x8c/0xf8
[ef441f40] [c000e7f4] ret_from_except+0x0/0x18
--- Exception: 501 at 0xfcda524
LR = 0x10024900
Instruction dump:
7c781b78 3b40000a 3a73b040 543c0024 3a800000 3b3913a0 7ef5bb78 48201bf9
5463103a 7d3b182e 7e89b92e 7c008146 <3ba00000> 7e7e9b78 48000014 57fff87f
Kernel panic - not syncing: kernel stack overflow
CPU: 0 PID: 2838 Comm: ssh Not tainted 3.13.0-rc8-juniper-00146-g19eca00 #4
Call Trace:The reason is that we have used the wrong register to calculate the ksp_limit in commit cbc9565ee826 (powerpc: Remove ksp_limit on ppc64). Just fix it.
As suggested by Benjamin Herrenschmidt, also add the C prototype of the function in the comment in order to avoid such kind of errors in the future.
--- arch/powerpc/kernel/misc_32.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kernel/misc_32.S +4 -1
@@ -57,11 +57,14 @@ _GLOBAL(call_do_softirq) mtlr r0 blr +/* + * void call_do_irq(struct pt_regs *regs, struct thread_info *irqtp); + */ _GLOBAL(call_do_irq) mflr r0 stw r0,4(r1) lwz r10,THREAD+KSP_LIMIT(r2) - addi r11,r3,THREAD_INFO_GAP + addi r11,r4,THREAD_INFO_GAP stwu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r4) mr r1,r4 stw r10,8(r1)
Greg Kroah-Hartman
maintainerPATCH 25/172 powerpc/powernv: Rework EEH reset
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit 5b2e198e50f6ba57081586b853163ea1bb95f1a8 upstream.
When doing reset in order to recover the affected PE, we issue hot reset on PE primary bus if it's not root bus. Otherwise, we issue hot or fundamental reset on root port or PHB accordingly. For the later case, we didn't cover the situation where PE only includes root port and it potentially causes kernel crash upon EEH error to the PE.
The patch reworks the logic of EEH reset to improve the code readability and also avoid the kernel crash.
--- arch/powerpc/platforms/powernv/eeh-ioda.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-)
arch/powerpc/platforms/powernv/eeh-ioda.c +4 -25
@@ -490,8 +490,7 @@ static int ioda_eeh_bridge_reset(structstatic int ioda_eeh_reset (struct eeh_pe *pe,int option) {struct pci_controller *hose = pe->phb; -struct eeh_dev *edev; -struct pci_dev *dev; +struct pci_bus *bus;int ret;/*
@@ -520,31 +519,11 @@ static int ioda_eeh_reset(struct eeh_peif (pe->type &EEH_PE_PHB ) { ret =ioda_eeh_phb_reset (hose, option); }else { -if (pe->type &EEH_PE_DEVICE ) { -/* -* If it's device PE, we didn't refer to the parent -* PCI bus yet. So we have to figure it out indirectly. -*/ - edev =list_first_entry (&pe->edevs, - struct eeh_dev, list); - dev =eeh_dev_to_pci_dev (edev); - dev = dev->bus->self; - }else { -/* -* If it's bus PE, the parent PCI bus is already there -* and just pick it up. -*/ - dev = pe->bus->self; - } - -/* -* Do reset based on the fact that the direct upstream bridge -* is root bridge (port) or not. -*/ -if (dev->bus->number ==0 ) + bus =eeh_pe_bus_get (pe); +if (pci_is_root_bus (bus)) ret =ioda_eeh_root_reset (hose, option);else - ret =ioda_eeh_bridge_reset (hose, dev, option); + ret =ioda_eeh_bridge_reset (hose, bus->self, option); }return ret;
Greg Kroah-Hartman
maintainerPATCH 26/172 jbd2: fix use after free in jbd2_journal_start_reserved()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 92e3b40537707001d17bbad800d150ab04e53bf4 upstream.
If start_this_handle() fails then it leads to a use after free of "handle".
--- fs/jbd2/transaction.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/jbd2/transaction.c +4 -2
@@ -514,11 +514,13 @@ int jbd2_journal_start_reserved(handle_t* similarly constrained call sites */ ret =start_this_handle (journal, handle,GFP_NOFS ); -if (ret <0 ) +if (ret <0 ) {jbd2_journal_free_reserved (handle); +return ret; + } handle->h_type = type; handle->h_line_no = line_no; -return ret; +return 0 ; }EXPORT_SYMBOL (jbd2_journal_start_reserved);
Greg Kroah-Hartman
maintainerPATCH 27/172 avr32: fix missing module.h causing build failure in mimc200/fram.c
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
commit 5745d6a41a4f4aec29e2ccd591c6fb09ed73a955 upstream.
Causing this:
In file included from arch/avr32/boards/mimc200/fram.c:13:include/linux/miscdevice.h:51: error: field 'list' has incomplete type include/linux/miscdevice.h:55: error: expected specifier-qualifier-list before 'mode_t' arch/avr32/boards/mimc200/fram.c:42: error: 'THIS_MODULE' undeclared here (not in a function)
--- arch/avr32/boards/mimc200/fram.c | 1 + 1 file changed, 1 insertion(+)
arch/avr32/boards/mimc200/fram.c +1 -0
@@ -11,6 +11,7 @@#define FRAM_VERSION "1.0"#include <linux/miscdevice.h> +#include <linux/module.h> #include <linux/proc_fs.h> #include <linux/mm.h> #include <linux/io.h>
Greg Kroah-Hartman
maintainerPATCH 28/172 avr32: Makefile: add -D__linux__ flag for gcc-4.4.7 use
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Gang <[email protected]>
commit 8d80390cfc9434d5aa4fb9e5f9768a66b30cb8a6 upstream.
For avr32 cross compiler, do not define '__linux__' internally, so it will cause issue with allmodconfig.
The related error:
CC [M] fs/coda/psdev.o
In file included from include/linux/coda.h:64,
from fs/coda/psdev.c:45:
include/uapi/linux/coda.h:221: error: expected specifier-qualifier-list before 'u_quad_t'
The related toolchain version (which only download, not re-compile):
[root@gchen linux-next]# /upstream/toolchain/download/avr32-gnu-toolchain-linux_x86/bin/avr32-gcc -v
Using built-in specs.
Target: avr32
Configured with: /data2/home/toolsbuild/jenkins-knuth/workspace/avr32-gnu-toolchain/src/gcc/configure --target=avr32 --host=i686-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/home/toolsbuild/jenkins-knuth/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86 --enable-languages=c,c++ --disable-nls --disable-libssp --disable-libstdcxx-pch --with-dwarf2 --enable-version-specific-runtime-libs --disable-shared --enable-doc --with-mpfr-lib=/home/toolsbuild/jenkins-knuth/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86/lib --with-mpfr-include=/home/toolsbuild/jenkins-knuth/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86/include
--with-gmp=/home/toolsbuild/jenkins-knuth/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86 --with-mpc=/home/toolsbuild/jenkins-knuth/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86 --enable-__cxa_atexit --disable-shared --with-newlib --with-pkgversion=AVR_32_bit_GNU_Toolchain_3.4.2_435 --with-bugurl=http://www
.atmel.com/avr
Thread model: single
gcc version 4.4.7 (AVR_32_bit_GNU_Toolchain_3.4.2_435)
--- arch/avr32/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/Makefile +1 -1
@@ -11,7 +11,7 @@ all: uImage vmlinux.elf KBUILD_DEFCONFIG := atstk1002_defconfig -KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic +KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic -D__linux__ KBUILD_AFLAGS += -mrelax -mno-pic KBUILD_CFLAGS_MODULE += -mno-relax LDFLAGS_vmlinux += --relax
Greg Kroah-Hartman
maintainerPATCH 29/172 cifs: ensure that uncached writes handle unmapped areas correctly
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 5d81de8e8667da7135d3a32a964087c0faf5483f upstream.
It's possible for userland to pass down an iovec via writev() that has a bogus user pointer in it. If that happens and we're doing an uncached write, then we can end up getting less bytes than we expect from the call to iov_iter_copy_from_user. This is CVE-2014-0069
cifs_iovec_write isn't set up to handle that situation however. It'll blindly keep chugging through the page array and not filling those pages with anything useful. Worse yet, we'll later end up with a negative number in wdata->tailsz, which will confuse the sending routines and cause an oops at the very least.
Fix this by having the copy phase of cifs_iovec_write stop copying data in this situation and send the last write as a short one. At the same time, we want to avoid sending a zero-length write to the server, so break out of the loop and set rc to -EFAULT if that happens. This also allows us to handle the case where no address in the iovec is valid.
[Note: Marking this for stable on v3.4+ kernels, but kernels as old as
v2.6.38 may have a similar problem and may need similar fix]
--- fs/cifs/file.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-)
fs/cifs/file.c +34 -3
@@ -2381,7 +2381,7 @@ cifs_iovec_write(struct file *file, cons unsigned long nr_segs, loff_t *poffset) { unsigned long nr_pages, i; -size_t copied, len, cur_len; +size_t bytes, copied, len, cur_len;ssize_t total_written =0 ;loff_t offset;struct iov_iter it;
@@ -2436,14 +2436,45 @@ cifs_iovec_write(struct file *file, cons save_len = cur_len;for (i =0 ; i < nr_pages; i++) { - copied = min_t(const size_t, cur_len, PAGE_SIZE); + bytes = min_t(const size_t, cur_len, PAGE_SIZE); copied =iov_iter_copy_from_user (wdata->pages[i], &it, -0 , copied); +0 , bytes); cur_len -= copied;iov_iter_advance (&it, copied); +/* +* If we didn't copy as much as we expected, then that +* may mean we trod into an unmapped area. Stop copying +* at that point. On the next pass through the big +* loop, we'll likely end up getting a zero-length +* write and bailing out of it. +*/ +if (copied < bytes) +break ; } cur_len = save_len - cur_len; +/* +* If we have no data to send, then that probably means that +* the copy above failed altogether. That's most likely because +* the address in the iovec was bogus. Set the rc to -EFAULT, +* free anything we allocated and bail out. +*/ +if (!cur_len) { +for (i =0 ; i < nr_pages; i++) +put_page (wdata->pages[i]); +kfree (wdata); + rc = -EFAULT ; +break ; + } + +/* +* i + 1 now represents the number of pages we actually used in +* the copy phase above. Bring nr_pages down to that, and free +* any pages that we didn't use. +*/ +for ( ; nr_pages > i +1 ; nr_pages--) +put_page (wdata->pages[nr_pages -1 ]); + wdata->sync_mode =WB_SYNC_ALL ; wdata->nr_pages = nr_pages; wdata->offset = (__u64 )offset;
Greg Kroah-Hartman
maintainerPATCH 30/172 CIFS: Fix too big maxBuf size for SMB3 mounts
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Shilovsky <[email protected]>
commit 2365c4eaf077c48574ab6f143960048fc0f31518 upstream.
SMB3 servers can respond with MaxTransactSize of more than 4M that can cause a memory allocation error returned from kmalloc in a lock codepath. Also the client doesn't support multicredit requests now and allows buffer sizes of 65536 bytes only. Set MaxTransactSize to this maximum supported value.
--- fs/cifs/smb2glob.h | 3 +++ fs/cifs/smb2ops.c | 14 ++++---------- fs/cifs/smb2pdu.c | 4 +++- 3 files changed, 10 insertions(+), 11 deletions(-)
fs/cifs/smb2glob.h +3 -0
@@ -57,4 +57,7 @@#define SMB2_CMACAES_SIZE (16)#define SMB3_SIGNKEY_SIZE (16) +/* Maximum buffer size value we can send with 1 credit */ +#define SMB2_MAX_BUFFER_SIZE 65536 +#endif /* _SMB2_GLOB_H */
fs/cifs/smb2ops.c +4 -10
@@ -182,11 +182,8 @@ smb2_negotiate_wsize(struct cifs_tcon *t/* start with specified wsize, or default */ wsize = volume_info->wsize ? volume_info->wsize :CIFS_DEFAULT_IOSIZE ; wsize = min_t(unsigned int, wsize, server->max_write); -/* -* limit write size to 2 ** 16, because we don't support multicredit -* requests now. -*/ - wsize = min_t(unsigned int, wsize, 2 << 15); +/* set it to the maximum buffer size value we can send with 1 credit */ + wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE);return wsize; }
@@ -200,11 +197,8 @@ smb2_negotiate_rsize(struct cifs_tcon *t/* start with specified rsize, or default */ rsize = volume_info->rsize ? volume_info->rsize :CIFS_DEFAULT_IOSIZE ; rsize = min_t(unsigned int, rsize, server->max_read); -/* -* limit write size to 2 ** 16, because we don't support multicredit -* requests now. -*/ - rsize = min_t(unsigned int, rsize, 2 << 15); +/* set it to the maximum buffer size value we can send with 1 credit */ + rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE);return rsize; }
fs/cifs/smb2pdu.c +3 -1
@@ -413,7 +413,9 @@ SMB2_negotiate(const unsigned int xid, s/* SMB2 only has an extended negflavor */ server->negflavor =CIFS_NEGFLAVOR_EXTENDED ; - server->maxBuf =le32_to_cpu (rsp->MaxTransactSize); +/* set it to the maximum buffer size value we can send with 1 credit */ + server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize), +SMB2_MAX_BUFFER_SIZE ); server->max_read =le32_to_cpu (rsp->MaxReadSize); server->max_write =le32_to_cpu (rsp->MaxWriteSize);/* BB Do we need to validate the SecurityMode? */
Greg Kroah-Hartman
maintainerPATCH 31/172 rtl8187: fix regression on MIPS without coherent DMA
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit b6213e413a4e0c66548153516b074df14f9d08e0 upstream.
This patch fixes regression caused by commit a16dad77634 "MIPS: Fix potencial corruption". That commit fixes one corruption scenario in cost of adding another one, which actually start to cause crashes on Yeeloong laptop when rtl8187 driver is used.
For correct DMA read operation on machines without DMA coherence, kernel have to invalidate cache, such it will refill later with new data that device wrote to memory, when that data is needed to process. We can only invalidate full cache line. Hence when cache line includes both dma buffer and some other data (written in cache, but not yet in main memory), the other data can not hit memory due to invalidation. That happen on rtl8187 where struct rtl8187_priv fields are located just before and after small buffers that are passed to USB layer and DMA is performed on them.
To fix the problem we align buffers and reserve space after them to make them match cache line.
This patch does not resolve all possible MIPS problems entirely, for that we have to assure that we always map cache aligned buffers for DMA, what can be complex or even not possible. But patch fixes visible and reproducible regression and seems other possible corruptions do not happen in practice, since Yeeloong laptop works stable without rtl8187 driver.
Bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=54391
--- drivers/net/wireless/rtl818x/rtl8187/rtl8187.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/rtl818x/rtl8187/rtl8187.h +8 -2
@@ -15,6 +15,8 @@#ifndef RTL8187_H #define RTL8187_H +#include <linux/cache.h> +#include "rtl818x.h" #include "leds.h"
@@ -139,7 +141,10 @@ struct rtl8187_priv {u8 aifsn[4 ];u8 rfkill_mask;struct { -__le64 buf; +union { +__le64 buf; +u8 dummy1[L1_CACHE_BYTES ]; + }____cacheline_aligned ;struct sk_buff_head queue; } b_tx_status;/* This queue is used by both -b and non-b devices */ struct mutex io_mutex;
@@ -147,7 +152,8 @@ struct rtl8187_priv {u8 bits8;__le16 bits16;__le32 bits32; - } *io_dmabuf; +u8 dummy2[L1_CACHE_BYTES ]; + } *io_dmabuf____cacheline_aligned ;bool rfkill_off;u16 seqno; };
Greg Kroah-Hartman
maintainerPATCH 32/172 rtlwifi: Fix incorrect return from rtl_ps_enable_nic()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Langlois <[email protected]>
commit 2e8c5e56b307271c2dab6f8bfd1d8a3822ca2390 upstream.
rtl_ps_enable_nic() is called from loops that will loop until this function returns true or a maximum number of retries is performed.
hw_init() returns non-zero on error. In that situation return false to restore the original design intent to retry hw init when it fails.
--- drivers/net/wireless/rtlwifi/ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/ps.c +1 -1
@@ -48,7 +48,7 @@ bool rtl_ps_enable_nic(struct ieee80211_/*<2> Enable Adapter */ if (rtlpriv->cfg->ops->hw_init (hw)) -return 1 ; +return false;RT_CLEAR_PS_LEVEL (ppsc,RT_RF_OFF_LEVL_HALT_NIC );/*<3> Enable Interrupt */
Greg Kroah-Hartman
maintainerPATCH 33/172 rtlwifi: rtl8192ce: Fix too long disable of IRQs
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Langlois <[email protected]>
commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 upstream.
rtl8192ce is disabling for too long the local interrupts during hw initiatialisation when performing scans
The observable symptoms in dmesg can be:
- underruns from ALSA playback
- clock freezes (tstamps do not change for several dmesg entries until irqs are finaly reenabled):
[ 250.817669] rtlwifi:rtl_op_config():<0-0-0> 0x100 [ 250.817685] rtl8192ce:_rtl92ce_phy_set_rf_power_state():<0-1-0> IPS Set eRf nic enable [ 250.817732] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.817796] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.817910] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818024] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818139] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818253] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818367] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11 [ 250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:98053f15:10 [ 250.818472] rtl8192ce:rtl92ce_sw_led_on():<0-1-0> LedAddr:4E ledpin=1 [ 250.818472] rtl8192c_common:rtl92c_download_fw():<0-1-0> Firmware Version(49), Signature(0x88c1),Size(32) [ 250.818472] rtl8192ce:rtl92ce_enable_hw_security_config():<0-1-0> PairwiseEncAlgorithm = 0 GroupEncAlgorithm = 0 [ 250.818472] rtl8192ce:rtl92ce_enable_hw_security_config():<0-1-0> The SECR-value cc [ 250.818472] rtl8192c_common:rtl92c_dm_check_txpower_tracking_thermal_meter():<0-1-0> Schedule TxPowerTracking direct call!! [ 250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> rtl92c_dm_txpower_tracking_callback_thermalmeter [ 250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Readback Thermal Meter = 0xe pre thermal meter 0xf eeprom_thermalmeter 0xf [ 250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Initial pathA ele_d reg0xc80 = 0x40000000, ofdm_index=0xc [ 250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Initial reg0xa24 = 0x90e1317, cck_index=0xc, ch14 0 [ 250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Readback Thermal Meter = 0xe pre thermal meter 0xf eeprom_thermalmeter 0xf delta 0x1 delta_lck 0x0 delta_iqk 0x0 [ 250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> <=== [ 250.818472] rtl8192c_common:rtl92c_dm_initialize_txpower_tracking_thermalmeter():<0-1-0> pMgntInfo->txpower_tracking = 1 [ 250.818472] rtl8192ce:rtl92ce_led_control():<0-1-0> ledaction 3 [ 250.818472] rtl8192ce:rtl92ce_sw_led_on():<0-1-0> LedAddr:4E ledpin=1 [ 250.818472] rtlwifi:rtl_ips_nic_on():<0-1-0> before spin_unlock_irqrestore [ 251.154656] PCM: Lost interrupts? [Q]-0 (stream=0, delta=15903, new_hw_ptr=293408, old_hw_ptr=277505)
The exact code flow that causes that is:
1. wpa_supplicant send a start_scan request to the nl80211 driver
2. mac80211 module call rtl_op_config with IEEE80211_CONF_CHANGE_IDLE
3. rtl_ips_nic_on is called which disable local irqs
4. rtl92c_phy_set_rf_power_state() is called
5. rtl_ps_enable_nic() is called and hw_init()is executed and then the interrupts on the device are enabled
A good solution could be to refactor the code to avoid calling rtl92ce_hw_init() with the irqs disabled but a quick and dirty solution that has proven to work is
to reenable the irqs during the function rtl92ce_hw_init().
I think that it is safe doing so since the device interrupt will only be enabled after the init function succeed.
--- drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +16 -2
@@ -937,14 +937,26 @@ int rtl92ce_hw_init(struct ieee80211_hwbool is92c;int err;u8 tmp_u1b; +unsigned long flags; rtlpci->being_init_adapter = true; + +/* Since this function can take a very long time (up to 350 ms) +* and can be called with irqs disabled, reenable the irqs +* to let the other devices continue being serviced. +* +* It is safe doing so since our own interrupts will only be enabled +* in a subsequent step. +*/ +local_save_flags (flags); +local_irq_enable (); + rtlpriv->intf_ops->disable_aspm (hw); rtstatus =_rtl92ce_init_mac (hw);if (!rtstatus) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"Init MAC failed\n" ); err =1 ; -return err; + goto exit; } err =rtl92c_download_fw (hw);
@@ -952,7 +964,7 @@ int rtl92ce_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_ERR ,DBG_WARNING ,"Failed to download FW. Init HW without FW now..\n" ); err =1 ; -return err; + goto exit; } rtlhal->last_hmeboxnum =0 ;
@@ -1032,6 +1044,8 @@ int rtl92ce_hw_init(struct ieee80211_hwRT_TRACE (rtlpriv,COMP_INIT ,DBG_TRACE ,"under 1.5V\n" ); }rtl92c_dm_init (hw); +exit: +local_irq_restore (flags); rtlpci->being_init_adapter = false;return err; }
Greg Kroah-Hartman
maintainerPATCH 34/172 NFS: Do not set NFS_INO_INVALID_LABEL unless server supports labeled NFS
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit fd1defc257e2b12ab69bc0b379105c00eca4e112 upstream.
Commit aa9c2669626c (NFS: Client implementation of Labeled-NFS) introduces a performance regression. When nfs_zap_caches_locked is called, it sets the NFS_INO_INVALID_LABEL flag irrespectively of whether or not the NFS server supports security labels. Since that flag is never cleared, it means that all calls to nfs_revalidate_inode() will now trigger an on-the-wire GETATTR call.
This patch ensures that we never set the NFS_INO_INVALID_LABEL unless the server advertises support for labeled NFS.
It also causes nfs_setsecurity() to clear NFS_INO_INVALID_LABEL when it has successfully set the security label for the inode.
Finally it gets rid of the NFS_INO_INVALID_LABEL cruft from nfs_update_inode, which has nothing to do with labeled NFS.
--- fs/nfs/inode.c | 14 ++++++++++---- fs/nfs/internal.h | 9 +++++++++ 2 files changed, 19 insertions(+), 4 deletions(-)
fs/nfs/inode.c +10 -4
@@ -164,17 +164,16 @@ static void nfs_zap_caches_locked(structif (S_ISREG (mode) ||S_ISDIR (mode) ||S_ISLNK (mode)) {nfs_fscache_invalidate (inode); nfsi->cache_validity |=NFS_INO_INVALID_ATTR - |NFS_INO_INVALID_LABEL |NFS_INO_INVALID_DATA |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL |NFS_INO_REVAL_PAGECACHE ; }else nfsi->cache_validity |=NFS_INO_INVALID_ATTR - |NFS_INO_INVALID_LABEL |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL |NFS_INO_REVAL_PAGECACHE ; +nfs_zap_label_cache_locked (nfsi); }void nfs_zap_caches (struct inode *inode)
@@ -266,6 +265,13 @@ nfs_init_locked(struct inode *inode, voi }#ifdef CONFIG_NFS_V4_SECURITY_LABEL +static void nfs_clear_label_invalid (struct inode *inode) +{ +spin_lock (&inode->i_lock); +NFS_I (inode)->cache_validity &= ~NFS_INO_INVALID_LABEL ; +spin_unlock (&inode->i_lock); +} +void nfs_setsecurity (struct inode *inode,struct nfs_fattr *fattr,struct nfs4_label *label) {
@@ -283,6 +289,7 @@ void nfs_setsecurity(struct inode *inode __func__, (char *)label->label, label->len, error); +nfs_clear_label_invalid (inode); } }
@@ -1597,7 +1604,7 @@ static int nfs_update_inode(struct inode inode->i_blocks = fattr->du.nfs2.blocks;/* Update attrtimeo value if we're out of the unstable period */ -if (invalid & (NFS_INO_INVALID_ATTR |NFS_INO_INVALID_LABEL )) { +if (invalid &NFS_INO_INVALID_ATTR ) {nfs_inc_stats (inode,NFSIOS_ATTRINVALIDATE ); nfsi->attrtimeo =NFS_MINATTRTIMEO (inode); nfsi->attrtimeo_timestamp = now;
@@ -1610,7 +1617,6 @@ static int nfs_update_inode(struct inode } } invalid &= ~NFS_INO_INVALID_ATTR ; - invalid &= ~NFS_INO_INVALID_LABEL ;/* Don't invalidate the data if we were to blame */ if (!(S_ISREG (inode->i_mode) ||S_ISDIR (inode->i_mode) ||S_ISLNK (inode->i_mode)))
fs/nfs/internal.h +9 -0
@@ -279,9 +279,18 @@ static inline void nfs4_label_free(struc }return ; } + +static inline void nfs_zap_label_cache_locked (struct nfs_inode *nfsi) +{ +if (nfs_server_capable (&nfsi->vfs_inode,NFS_CAP_SECURITY_LABEL )) + nfsi->cache_validity |=NFS_INO_INVALID_LABEL ; +}#else static inline struct nfs4_label *nfs4_label_alloc (struct nfs_server *server,gfp_t flags) {return NULL ; }static inline void nfs4_label_free (void *label) {} +static inline void nfs_zap_label_cache_locked (struct nfs_inode *nfsi) +{ +}#endif /* CONFIG_NFS_V4_SECURITY_LABEL */ /* proc.c */
Greg Kroah-Hartman
maintainerPATCH 35/172 NFS fix error return in nfs4_select_rw_stateid
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Adamson <[email protected]>
commit 146d70caaa1b87f64597743429d7da4b8073d0c9 upstream.
Do not return an error when nfs4_copy_delegation_stateid succeeds.
--- fs/nfs/nfs4state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +4 -1
@@ -1015,8 +1015,11 @@ int nfs4_select_rw_stateid(nfs4_stateidif (ret == -EIO )/* A lost lock - don't even consider delegations */ goto out; -if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) +/* returns true if delegation stateid found and copied */ +if (nfs4_copy_delegation_stateid (dst, state->inode, fmode)) { + ret =0 ; goto out; + }if (ret != -ENOENT )/* nfs4_copy_delegation_stateid() didn't over-write * dst, so it still has the lock stateid which we now
Greg Kroah-Hartman
maintainerPATCH 36/172 6lowpan: fix lockdep splats
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 20e7c4e80dcd01dad5e6c8b32455228b8fe9c619 ]
When a device ndo_start_xmit() calls again dev_queue_xmit(), lockdep can complain because dev_queue_xmit() is re-entered and the spinlocks protecting tx queues share a common lockdep class.
Same issue was fixed for bonding/l2tp/ppp in commits
0daa2303028a6 ("[PATCH] bonding: lockdep annotation") 49ee49202b4ac ("bonding: set qdisc_tx_busylock to avoid LOCKDEP splat") 23d3b8bfb8eb2 ("net: qdisc busylock needs lockdep annotations ") 303c07db487be ("ppp: set qdisc_tx_busylock to avoid LOCKDEP splat ")
--- net/ieee802154/6lowpan.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
net/ieee802154/6lowpan.c +20 -0
@@ -1249,7 +1249,27 @@ static struct header_ops lowpan_header_o .create = lowpan_header_create, }; +static struct lock_class_key lowpan_tx_busylock; +static struct lock_class_key lowpan_netdev_xmit_lock_key; + +static void lowpan_set_lockdep_class_one (struct net_device *dev, +struct netdev_queue *txq, +void *_unused) +{ +lockdep_set_class (&txq->_xmit_lock, + &lowpan_netdev_xmit_lock_key); +} + + +static int lowpan_dev_init (struct net_device *dev) +{ +netdev_for_each_tx_queue (dev, lowpan_set_lockdep_class_one,NULL ); + dev->qdisc_tx_busylock = &lowpan_tx_busylock; +return 0 ; +} +static const struct net_device_ops lowpan_netdev_ops = { + .ndo_init = lowpan_dev_init, .ndo_start_xmit = lowpan_xmit, .ndo_set_mac_address = lowpan_set_address, };
Greg Kroah-Hartman
maintainerPATCH 37/172 9p/trans_virtio.c: Fix broken zero-copy on vmalloc() buffers
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Yao <[email protected]>
[ Upstream commit b6f52ae2f0d32387bde2b89883e3b64d88b9bfe8 ]
The 9p-virtio transport does zero copy on things larger than 1024 bytes in size. It accomplishes this by returning the physical addresses of pages to the virtio-pci device. At present, the translation is usually a bit shift.
That approach produces an invalid page address when we read/write to vmalloc buffers, such as those used for Linux kernel modules. Any attempt to load a Linux kernel module from 9p-virtio produces the following stack.
[<ffffffff814878ce>] p9_virtio_zc_request+0x45e/0x510 [<ffffffff814814ed>] p9_client_zc_rpc.constprop.16+0xfd/0x4f0 [<ffffffff814839dd>] p9_client_read+0x15d/0x240 [<ffffffff811c8440>] v9fs_fid_readn+0x50/0xa0 [<ffffffff811c84a0>] v9fs_file_readn+0x10/0x20 [<ffffffff811c84e7>] v9fs_file_read+0x37/0x70 [<ffffffff8114e3fb>] vfs_read+0x9b/0x160 [<ffffffff81153571>] kernel_read+0x41/0x60 [<ffffffff810c83ab>] copy_module_from_fd.isra.34+0xfb/0x180
Subsequently, QEMU will die printing:
qemu-system-x86_64: virtio: trying to map MMIO memory
This patch enables 9p-virtio to correctly handle this case. This not only enables us to load Linux kernel modules off virtfs, but also enables ZFS file-based vdevs on virtfs to be used without killing QEMU.
Special thanks to both Avi Kivity and Alexander Graf for their interpretation of QEMU backtraces. Without their guidence, tracking down this bug would have taken much longer. Also, special thanks to Linus Torvalds for his insightful explanation of why this should use is_vmalloc_addr() instead of is_vmalloc_or_module_addr():
https://lkml.org/lkml/2014/2/8/272
--- net/9p/trans_virtio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/9p/trans_virtio.c +4 -1
@@ -340,7 +340,10 @@ static int p9_get_mapped_pages(struct viint count = nr_pages;while (nr_pages) { s =rest_of_page (data); - pages[index++] =kmap_to_page (data); +if (is_vmalloc_addr (data)) + pages[index++] =vmalloc_to_page (data); +else + pages[index++] =kmap_to_page (data); data += s; nr_pages--; }
Greg Kroah-Hartman
maintainerPATCH 38/172 bridge: fix netconsole setup over bridge
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit dbe173079ab58a444e12dbebe96f5aec1e0bed1a ]
Commit 93d8bf9fb8f3 ("bridge: cleanup netpoll code") introduced a check in br_netpoll_enable(), but this check is incorrect for br_netpoll_setup(). This patch moves the code after the check into __br_netpoll_enable() and calls it in br_netpoll_setup(). For br_add_if(), the check is still needed.
--- net/bridge/br_device.c | 51 ++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-)
net/bridge/br_device.c +28 -23
@@ -226,6 +226,33 @@ static void br_netpoll_cleanup(struct nebr_netpoll_disable (p); } +static int __br_netpoll_enable (struct net_bridge_port *p,gfp_t gfp) +{ +struct netpoll *np; +int err; + + np =kzalloc (sizeof (*p->np), gfp); +if (!np) +return -ENOMEM ; + + err =__netpoll_setup (np, p->dev, gfp); +if (err) { +kfree (np); +return err; + } + + p->np = np; +return err; +} + +int br_netpoll_enable (struct net_bridge_port *p,gfp_t gfp) +{ +if (!p->br->dev->npinfo) +return 0 ; + +return __br_netpoll_enable (p, gfp); +} +static int br_netpoll_setup (struct net_device *dev,struct netpoll_info *ni,gfp_t gfp) {
@@ -236,7 +263,7 @@ static int br_netpoll_setup(struct net_dlist_for_each_entry (p, &br->port_list, list) {if (!p->dev)continue ; - err =br_netpoll_enable (p, gfp); + err =__br_netpoll_enable (p, gfp);if (err) goto fail; }
@@ -249,28 +276,6 @@ fail: goto out; } -int br_netpoll_enable (struct net_bridge_port *p,gfp_t gfp) -{ -struct netpoll *np; -int err; - -if (!p->br->dev->npinfo) -return 0 ; - - np =kzalloc (sizeof (*p->np), gfp); -if (!np) -return -ENOMEM ; - - err =__netpoll_setup (np, p->dev, gfp); -if (err) { -kfree (np); -return err; - } - - p->np = np; -return err; -} -void br_netpoll_disable (struct net_bridge_port *p) {struct netpoll *np = p->np;
Greg Kroah-Hartman
maintainerPATCH 39/172 can: add destructor for self generated skbs
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
[ Upstream commit 0ae89beb283a0db5980d1d4781c7d7be2f2810d6 ]
Self generated skbuffs in net/can/bcm.c are setting a skb->sk reference but no explicit destructor which is enforced since Linux 3.11 with commit 376c7311bdb6 (net: add a temporary sanity check in skb_orphan()).
This patch adds some helper functions to make sure that a destructor is properly defined when a sock reference is assigned to a CAN related skb. To create an unshared skb owned by the original sock a common helper function has been introduced to replace open coded functions to create CAN echo skbs.
--- drivers/net/can/dev.c | 15 +++------------ drivers/net/can/janz-ican3.c | 18 ++++-------------- drivers/net/can/vcan.c | 9 ++++----- include/linux/can/skb.h | 38 ++++++++++++++++++++++++++++++++++++++ net/can/af_can.c | 3 ++- net/can/bcm.c | 4 ++-- 6 files changed, 53 insertions(+), 34 deletions(-)
drivers/net/can/dev.c +3 -12
@@ -324,19 +324,10 @@ void can_put_echo_skb(struct sk_buff *sk }if (!priv->echo_skb[idx]) { -struct sock *srcsk = skb->sk; -if (atomic_read (&skb->users) !=1 ) { -struct sk_buff *old_skb = skb; - - skb =skb_clone (old_skb,GFP_ATOMIC ); -kfree_skb (old_skb); -if (!skb) -return ; - }else -skb_orphan (skb); - - skb->sk = srcsk; + skb =can_create_echo_skb (skb); +if (!skb) +return ;/* make settings for echo to reduce code in irq context */ skb->protocol =htons (ETH_P_CAN );
drivers/net/can/janz-ican3.c +4 -14
@@ -19,6 +19,7 @@#include <linux/netdevice.h> #include <linux/can.h> #include <linux/can/dev.h> +#include <linux/can/skb.h> #include <linux/can/error.h> #include <linux/mfd/janz.h>
@@ -1134,20 +1135,9 @@ static void ican3_handle_message(struct*/ static void ican3_put_echo_skb (struct ican3_dev *mod,struct sk_buff *skb) { -struct sock *srcsk = skb->sk; - -if (atomic_read (&skb->users) !=1 ) { -struct sk_buff *old_skb = skb; - - skb =skb_clone (old_skb,GFP_ATOMIC ); -kfree_skb (old_skb); -if (!skb) -return ; - }else { -skb_orphan (skb); - } - - skb->sk = srcsk; + skb =can_create_echo_skb (skb); +if (!skb) +return ;/* save this skb for tx interrupt echo handling */ skb_queue_tail (&mod->echoq, skb);
drivers/net/can/vcan.c +4 -5
@@ -46,6 +46,7 @@#include <linux/if_ether.h> #include <linux/can.h> #include <linux/can/dev.h> +#include <linux/can/skb.h> #include <linux/slab.h> #include <net/rtnetlink.h>
@@ -109,25 +110,23 @@ static netdev_tx_t vcan_tx(struct sk_buf stats->rx_packets++; stats->rx_bytes += cfd->len; } -kfree_skb (skb); +consume_skb (skb);return NETDEV_TX_OK ; }/* perform standard echo handling for CAN network interfaces */ if (loop) { -struct sock *srcsk = skb->sk; - skb =skb_share_check (skb,GFP_ATOMIC ); + skb =can_create_echo_skb (skb);if (!skb)return NETDEV_TX_OK ;/* receive with packet counting */ - skb->sk = srcsk;vcan_rx (skb, dev); }else {/* no looped packets => no counting */ -kfree_skb (skb); +consume_skb (skb); }return NETDEV_TX_OK ; }
include/linux/can/skb.h +38 -0
@@ -11,7 +11,9 @@#define CAN_SKB_H #include <linux/types.h> +#include <linux/skbuff.h> #include <linux/can.h> +#include <net/sock.h> /* * The struct can_skb_priv is used to transport additional information along
@@ -42,4 +44,40 @@ static inline void can_skb_reserve(strucskb_reserve (skb,sizeof (struct can_skb_priv )); } +static inline void can_skb_destructor (struct sk_buff *skb) +{ +sock_put (skb->sk); +} + +static inline void can_skb_set_owner (struct sk_buff *skb,struct sock *sk) +{ +if (sk) { +sock_hold (sk); + skb->destructor = can_skb_destructor; + skb->sk = sk; + } +} + +/* +* returns an unshared skb owned by the original sock to be echo'ed back +*/ +static inline struct sk_buff *can_create_echo_skb (struct sk_buff *skb) +{ +if (skb_shared (skb)) { +struct sk_buff *nskb =skb_clone (skb,GFP_ATOMIC ); + +if (likely (nskb)) { +can_skb_set_owner (nskb, skb->sk); +consume_skb (skb); +return nskb; + }else { +kfree_skb (skb); +return NULL ; + } + } + +/* we can assume to have an unshared skb with proper owner */ +return skb; +} +#endif /* CAN_SKB_H */
net/can/af_can.c +2 -1
@@ -57,6 +57,7 @@#include <linux/skbuff.h> #include <linux/can.h> #include <linux/can/core.h> +#include <linux/can/skb.h> #include <linux/ratelimit.h> #include <net/net_namespace.h> #include <net/sock.h>
@@ -290,7 +291,7 @@ int can_send(struct sk_buff *skb, int loreturn -ENOMEM ; } - newskb->sk = skb->sk; +can_skb_set_owner (newskb, skb->sk); newskb->ip_summed =CHECKSUM_UNNECESSARY ; newskb->pkt_type =PACKET_BROADCAST ; }
net/can/bcm.c +2 -2
@@ -268,7 +268,7 @@ static void bcm_can_tx(struct bcm_op *op/* send with loopback */ skb->dev = dev; - skb->sk = op->sk; +can_skb_set_owner (skb, op->sk);can_send (skb,1 );/* update statistics */
@@ -1223,7 +1223,7 @@ static int bcm_tx_send(struct msghdr *mscan_skb_prv (skb)->ifindex = dev->ifindex; skb->dev = dev; - skb->sk = sk; +can_skb_set_owner (skb, sk); err =can_send (skb,1 );/* send with loopback */ dev_put (dev);
Greg Kroah-Hartman
maintainerPATCH 40/172 ipv4: Fix runtime WARNING in rtmsg_ifa()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 63b5f152eb4a5bb79b9caf7ec37b4201d12f6e66 ]
On m68k/ARAnyM:
WARNING: CPU: 0 PID: 407 at net/ipv4/devinet.c:1599 0x316a99()
Modules linked in:
CPU: 0 PID: 407 Comm: ifconfig Not tainted
3.13.0-atari-09263-g0c71d68014d1 #1378
Stack from 10c4fdf0:
10c4fdf0 002ffabb 000243e8 00000000 008ced6c 00024416 00316a99 0000063f
00316a99 00000009 00000000 002501b4 00316a99 0000063f c0a86117 00000080
c0a86117 00ad0c90 00250a5a 00000014 00ad0c90 00000000 00000000 00000001
00b02dd0 00356594 00000000 00356594 c0a86117 eff6c9e4 008ced6c 00000002
008ced60 0024f9b4 00250b52 00ad0c90 00000000 00000000 00252390 00ad0c90
eff6c9e4 0000004f 00000000 00000000 eff6c9e4 8000e25c eff6c9e4 80001020
Call Trace: [<000243e8>] warn_slowpath_common+0x52/0x6c
[<00024416>] warn_slowpath_null+0x14/0x1a
[<002501b4>] rtmsg_ifa+0xdc/0xf0
[<00250a5a>] __inet_insert_ifa+0xd6/0x1c2
[<0024f9b4>] inet_abc_len+0x0/0x42
[<00250b52>] inet_insert_ifa+0xc/0x12
[<00252390>] devinet_ioctl+0x2ae/0x5d6Adding some debugging code reveals that net_fill_ifaddr() fails in
put_cacheinfo(skb, ifa->ifa_cstamp, ifa->ifa_tstamp,
preferred, valid))nla_put complains:
lib/nlattr.c:454: skb_tailroom(skb) = 12, nla_total_size(attrlen) = 20
Apparently commit 5c766d642bcaffd0c2a5b354db2068515b3846cf ("ipv4:
introduce address lifetime") forgot to take into account the addition of struct ifa_cacheinfo in inet_nlmsg_size(). Hence add it, like is already done for ipv6.
--- net/ipv4/devinet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/devinet.c +2 -1
@@ -1435,7 +1435,8 @@ static size_t inet_nlmsg_size(void) +nla_total_size (4 )/* IFA_ADDRESS */ +nla_total_size (4 )/* IFA_LOCAL */ +nla_total_size (4 )/* IFA_BROADCAST */ - +nla_total_size (IFNAMSIZ );/* IFA_LABEL */ + +nla_total_size (IFNAMSIZ )/* IFA_LABEL */ + +nla_total_size (sizeof (struct ifa_cacheinfo ));/* IFA_CACHEINFO */ }static inline u32 cstamp_delta (unsigned long cstamp)
Greg Kroah-Hartman
maintainerPATCH 42/172 netpoll: fix netconsole IPv6 setup
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 00fe11b3c67dc670fe6391d22f1fe64e7c99a8ec ]
Currently, to make netconsole start over IPv6, the source address needs to be specified. Without a source address, netpoll_parse_options assumes we're setting up over IPv4 and the destination IPv6 address is rejected.
Check if the IP version has been forced by a source address before checking for a version mismatch when parsing the destination address.
--- net/core/netpoll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/netpoll.c +3 -1
@@ -948,6 +948,7 @@ int netpoll_parse_options(struct netpoll {char *cur=opt, *delim;int ipv6; +bool ipversion_set = false;if (*cur !='@' ) {if ((delim =strchr (cur,'@' )) ==NULL )
@@ -960,6 +961,7 @@ int netpoll_parse_options(struct netpoll cur++;if (*cur !='/' ) { + ipversion_set = true;if ((delim =strchr (cur,'/' )) ==NULL ) goto parse_failed; *delim =0 ;
@@ -1002,7 +1004,7 @@ int netpoll_parse_options(struct netpoll ipv6 =netpoll_parse_ip_addr (cur, &np->remote_ip);if (ipv6 <0 ) goto parse_failed; -else if (np->ipv6 != (bool )ipv6) +else if (ipversion_set && np->ipv6 != (bool )ipv6) goto parse_failed;else np->ipv6 = (bool )ipv6;
Greg Kroah-Hartman
maintainerPATCH 44/172 tcp: tsq: fix nonagle handling
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
[ Upstream commit bf06200e732de613a1277984bf34d1a21c2de03d ]
Commit 46d3ceabd8d9 ("tcp: TCP Small Queues") introduced a possible regression for applications using TCP_NODELAY.
If TCP session is throttled because of tsq, we should consult tp->nonagle when TX completion is done and allow us to send additional segment, especially if this segment is not a full MSS. Otherwise this segment is sent after an RTO.
[edumazet] : Cooked the changelog, added another fix about testing sk_wmem_alloc twice because TX completion can happen right before setting TSQ_THROTTLED bit.
This problem is particularly visible with recent auto corking, but might also be triggered with low tcp_limit_output_bytes values or NIC drivers delaying TX completion by hundred of usec, and very low rtt.
Thomas Glanzmann for example reported an iscsi regression, caused by tcp auto corking making this bug quite visible.
--- net/ipv4/tcp_output.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/ipv4/tcp_output.c +11 -2
@@ -696,7 +696,8 @@ static void tcp_tsq_handler(struct sockif ((1 << sk->sk_state) & (TCPF_ESTABLISHED |TCPF_FIN_WAIT1 |TCPF_CLOSING |TCPF_CLOSE_WAIT |TCPF_LAST_ACK )) -tcp_write_xmit (sk,tcp_current_mss (sk),0 ,0 ,GFP_ATOMIC ); +tcp_write_xmit (sk,tcp_current_mss (sk),tcp_sk (sk)->nonagle, +0 ,GFP_ATOMIC ); }/* * One tasklest per cpu tries to send more skbs.
@@ -1884,7 +1885,15 @@ static bool tcp_write_xmit(struct sock *if (atomic_read (&sk->sk_wmem_alloc) > limit) {set_bit (TSQ_THROTTLED , &tp->tsq_flags); -break ; +/* It is possible TX completion already happened +* before we set TSQ_THROTTLED, so we must +* test again the condition. +* We abuse smp_mb__after_clear_bit() because +* there is no smp_mb__after_set_bit() yet +*/ +smp_mb__after_clear_bit (); +if (atomic_read (&sk->sk_wmem_alloc) > limit) +break ; } limit = mss_now;
Greg Kroah-Hartman
maintainerPATCH 45/172 tg3: Fix deadlock in tg3_change_mtu()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nithin Sujir <[email protected]>
[ Upstream commit c6993dfd7db9b0c6b7ca7503a56fda9236a4710f ]
Quoting David Vrabel -
"5780 cards cannot have jumbo frames and TSO enabled together. When jumbo frames are enabled by setting the MTU, the TSO feature must be cleared. This is done indirectly by calling netdev_update_features() which will call tg3_fix_features() to actually clear the flags.
netdev_update_features() will also trigger a new netlink message for the feature change event which will result in a call to tg3_get_stats64() which deadlocks on the tg3 lock."
tg3_set_mtu() does not need to be under the tg3 lock since converting the flags to use set_bit(). Move it out to after tg3_netif_stop().
--- drivers/net/ethernet/broadcom/tg3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +2 -2
@@ -13965,12 +13965,12 @@ static int tg3_change_mtu(struct net_devtg3_netif_stop (tp); +tg3_set_mtu (dev, tp, new_mtu); +tg3_full_lock (tp,1 );tg3_halt (tp,RESET_KIND_SHUTDOWN ,1 ); -tg3_set_mtu (dev, tp, new_mtu); -/* Reset PHY, otherwise the read DMA engine will be in a mode that * breaks all requests to 256 bytes. */
Greg Kroah-Hartman
maintainerPATCH 46/172 vhost: fix ref cnt checking deadlock
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit 0ad8b480d6ee916aa84324f69acf690142aecd0e ]
vhost checked the counter within the refcnt before decrementing. It really wanted to know that it is the one that has the last reference, as a way to batch freeing resources a bit more efficiently.
Note: we only let refcount go to 0 on device release.
This works well but we now access the ref counter twice so there's a
race: all users might see a high count and decide to defer freeing resources.
In the end no one initiates freeing resources until the last reference is gone (which is on VM shotdown so might happen after a looooong time).
Let's do what we probably should have done straight away:
switch from kref to plain atomic, documenting the semantics, return the refcount value atomically after decrement, then use that to avoid the deadlock.
--- drivers/vhost/net.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
drivers/vhost/net.c +20 -21
@@ -70,7 +70,12 @@ enum { };struct vhost_net_ubuf_ref { -struct kref kref; +/* refcount follows semantics similar to kref: +* 0: object is released +* 1: no outstanding ubufs +* >1: outstanding ubufs +*/ +atomic_t refcount;wait_queue_head_t wait;struct vhost_virtqueue *vq; };
@@ -116,14 +121,6 @@ static void vhost_net_enable_zcopy(int v vhost_net_zcopy_mask |=0x1 << vq; } -static void vhost_net_zerocopy_done_signal (struct kref *kref) -{ -struct vhost_net_ubuf_ref *ubufs; - - ubufs = container_of(kref, struct vhost_net_ubuf_ref, kref); -wake_up (&ubufs->wait); -} -static struct vhost_net_ubuf_ref *vhost_net_ubuf_alloc (struct vhost_virtqueue *vq,bool zcopy) {
@@ -134,21 +131,24 @@ vhost_net_ubuf_alloc(struct vhost_virtqu ubufs =kmalloc (sizeof (*ubufs),GFP_KERNEL );if (!ubufs)return ERR_PTR (-ENOMEM ); -kref_init (&ubufs->kref); +atomic_set (&ubufs->refcount,1 );init_waitqueue_head (&ubufs->wait); ubufs->vq = vq;return ubufs; } -static void vhost_net_ubuf_put (struct vhost_net_ubuf_ref *ubufs) +static int vhost_net_ubuf_put (struct vhost_net_ubuf_ref *ubufs) { -kref_put (&ubufs->kref, vhost_net_zerocopy_done_signal); +int r =atomic_sub_return (1 , &ubufs->refcount); +if (unlikely (!r)) +wake_up (&ubufs->wait); +return r; }static void vhost_net_ubuf_put_and_wait (struct vhost_net_ubuf_ref *ubufs) { -kref_put (&ubufs->kref, vhost_net_zerocopy_done_signal); -wait_event (ubufs->wait, !atomic_read (&ubufs->kref.refcount)); +vhost_net_ubuf_put (ubufs); +wait_event (ubufs->wait, !atomic_read (&ubufs->refcount)); }static void vhost_net_ubuf_put_wait_and_free (struct vhost_net_ubuf_ref *ubufs)
@@ -306,22 +306,21 @@ static void vhost_zerocopy_callback(stru {struct vhost_net_ubuf_ref *ubufs = ubuf->ctx;struct vhost_virtqueue *vq = ubufs->vq; -int cnt =atomic_read (&ubufs->kref.refcount); +int cnt;/* set len to mark this desc buffers done DMA */ vq->heads[ubuf->desc].len = success ?VHOST_DMA_DONE_LEN :VHOST_DMA_FAILED_LEN ; -vhost_net_ubuf_put (ubufs); + cnt =vhost_net_ubuf_put (ubufs);/* * Trigger polling thread if guest stopped submitting new buffers: -* in this case, the refcount after decrement will eventually reach 1 -* so here it is 2. +* in this case, the refcount after decrement will eventually reach 1. * We also trigger polling periodically after each 16 packets * (the value 16 here is more or less arbitrary, it's tuned to trigger * less than 10% of times). */ -if (cnt <=2 || !(cnt %16 )) +if (cnt <=1 || !(cnt %16 ))vhost_poll_queue (&vq->poll); }
@@ -420,7 +419,7 @@ static void handle_tx(struct vhost_net * msg.msg_control = ubuf; msg.msg_controllen =sizeof (ubuf); ubufs = nvq->ubufs; -kref_get (&ubufs->kref); +atomic_inc (&ubufs->refcount); nvq->upend_idx = (nvq->upend_idx +1 ) %UIO_MAXIOV ; }else { msg.msg_control =NULL ;
@@ -785,7 +784,7 @@ static void vhost_net_flush(struct vhostvhost_net_ubuf_put_and_wait (n->vqs[VHOST_NET_VQ_TX ].ubufs);mutex_lock (&n->vqs[VHOST_NET_VQ_TX ].vq.mutex); n->tx_flush = false; -kref_init (&n->vqs[VHOST_NET_VQ_TX ].ubufs->kref); +atomic_set (&n->vqs[VHOST_NET_VQ_TX ].ubufs->refcount,1 );mutex_unlock (&n->vqs[VHOST_NET_VQ_TX ].vq.mutex); } }
Greg Kroah-Hartman
maintainerPATCH 47/172 hyperv: Fix the carrier status setting
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haiyang Zhang <[email protected]>
[ Upstream commit 891de74d693bb4fefe2efcc6432a4a9a9bee561e ]
Without this patch, the "cat /sys/class/net/ethN/operstate" shows "unknown", and "ethtool ethN" shows "Link detected: yes", when VM boots up with or without vNIC connected.
This patch fixed the problem.
--- drivers/net/hyperv/netvsc_drv.c | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 15 deletions(-)
drivers/net/hyperv/netvsc_drv.c +38 -15
@@ -89,8 +89,12 @@ static int netvsc_open(struct net_device {struct net_device_context *net_device_ctx =netdev_priv (net);struct hv_device *device_obj = net_device_ctx->device_ctx; +struct netvsc_device *nvdev; +struct rndis_device *rdev;int ret =0 ; +netif_carrier_off (net); +/* Open up the device */ ret =rndis_filter_open (device_obj);if (ret !=0 ) {
@@ -100,6 +104,11 @@ static int netvsc_open(struct net_devicenetif_start_queue (net); + nvdev =hv_get_drvdata (device_obj); + rdev = nvdev->extension; +if (!rdev->link_state) +netif_carrier_on (net); +return ret; }
@@ -230,23 +239,24 @@ void netvsc_linkstatus_callback(struct hstruct net_device *net;struct net_device_context *ndev_ctx;struct netvsc_device *net_device; +struct rndis_device *rdev; net_device =hv_get_drvdata (device_obj); + rdev = net_device->extension; + + rdev->link_state = status !=1 ; + net = net_device->ndev; -if (!net) { -netdev_err (net,"got link status but net device " -"not initialized yet\n" ); +if (!net || net->reg_state !=NETREG_REGISTERED )return ; - } + ndev_ctx =netdev_priv (net);if (status ==1 ) { -netif_carrier_on (net); - ndev_ctx =netdev_priv (net);schedule_delayed_work (&ndev_ctx->dwork,0 );schedule_delayed_work (&ndev_ctx->dwork,msecs_to_jiffies (20 )); }else { -netif_carrier_off (net); +schedule_delayed_work (&ndev_ctx->dwork,0 ); } }
@@ -389,17 +399,35 @@ static const struct net_device_ops devic* current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add * another netif_notify_peers() into a delayed work, otherwise GARP packet * will not be sent after quick migration, and cause network disconnection. +* Also, we update the carrier status here. */ -static void netvsc_send_garp (struct work_struct *w) +static void netvsc_link_change (struct work_struct *w) {struct net_device_context *ndev_ctx;struct net_device *net;struct netvsc_device *net_device; +struct rndis_device *rdev; +bool notify; + +rtnl_lock (); ndev_ctx = container_of(w, struct net_device_context, dwork.work); net_device =hv_get_drvdata (ndev_ctx->device_ctx); + rdev = net_device->extension; net = net_device->ndev; -netdev_notify_peers (net); + +if (rdev->link_state) { +netif_carrier_off (net); + notify = false; + }else { +netif_carrier_on (net); + notify = true; + } + +rtnl_unlock (); + +if (notify) +netdev_notify_peers (net); }
@@ -415,13 +443,10 @@ static int netvsc_probe(struct hv_deviceif (!net)return -ENOMEM ; -/* Set initial state */ -netif_carrier_off (net); - net_device_ctx =netdev_priv (net); net_device_ctx->device_ctx = dev;hv_set_drvdata (dev, net); -INIT_DELAYED_WORK (&net_device_ctx->dwork, netvsc_send_garp); +INIT_DELAYED_WORK (&net_device_ctx->dwork, netvsc_link_change);INIT_WORK (&net_device_ctx->work, do_set_multicast); net->netdev_ops = &device_ops;
@@ -444,8 +469,6 @@ static int netvsc_probe(struct hv_device }memcpy (net->dev_addr, device_info.mac_adr,ETH_ALEN ); -netif_carrier_on (net); - ret =register_netdev (net);if (ret !=0 ) {pr_err ("Unable to register netdev.\n" );
Greg Kroah-Hartman
maintainerPATCH 49/172 gre: add link local route when local addr is any
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
[ Upstream commit 08b44656c08c8c2f73cdac2a058be2880e3361f2 ]
This bug was reported by Steinar H. Gunderson and was introduced by commit f7cb8886335d ("sit/gre6: don't try to add the same route two times").
root@morgental:~# ip tunnel add foo mode gre remote 1.2.3.4 ttl 64 root@morgental:~# ip link set foo up mtu 1468 root@morgental:~# ip -6 route show dev foo fe80::/64 proto kernel metric 256
but after the above commit, no such route shows up.
There is no link local route because dev->dev_addr is 0 (because local ipv4 address is 0), hence no link local address is configured.
In this scenario, the link local address is added manually: 'ip -6 addr add fe80::1 dev foo' and because prefix is /128, no link local route is added by the kernel.
Even if the right things to do is to add the link local address with a /64 prefix, we need to restore the previous behavior to avoid breaking userpace.
--- net/ipv6/addrconf.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/addrconf.c +2 -0
@@ -2726,6 +2726,8 @@ static void addrconf_gre_config(struct nipv6_addr_set (&addr,htonl (0xFE800000 ),0 ,0 ,0 );if (!ipv6_generate_eui64 (addr.s6_addr +8 , dev))addrconf_add_linklocal (idev, &addr); +else + addrconf_prefix_route(&addr, 64, dev, 0, 0); }#endif
Greg Kroah-Hartman
maintainerPATCH 50/172 usbnet: remove generic hard_header_len check
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Goode <[email protected]>
[ Upstream commit eb85569fe2d06c2fbf4de7b66c263ca095b397aa ]
This patch removes a generic hard_header_len check from the usbnet module that is causing dropped packages under certain circumstances for devices that send rx packets that cross urb boundaries.
One example is the AX88772B which occasionally send rx packets that cross urb boundaries where the remaining partial packet is sent with no hardware header. When the buffer with a partial packet is of less number of octets than the value of hard_header_len the buffer is discarded by the usbnet module.
With AX88772B this can be reproduced by using ping with a packet size between 1965-1976.
The bug has been reported here:
https://bugzilla.kernel.org/show_bug.cgi?id=29082
This patch introduces the following changes:
- Removes the generic hard_header_len check in the rx_complete function in the usbnet module.
- Introduces a ETH_HLEN check for skbs that are not cloned from within a rx_fixup callback.
- For safety a hard_header_len check is added to each rx_fixup callback function that could be affected by this change. These extra checks could possibly be removed by someone who has the hardware to test.
- Removes a call to dev_kfree_skb_any() and instead utilizes the dev->done list to queue skbs for cleanup.
The changes place full responsibility on the rx_fixup callback functions that clone skbs to only pass valid skbs to the usbnet_skb_return function.
--- drivers/net/usb/ax88179_178a.c | 4 ++++ drivers/net/usb/gl620a.c | 4 ++++ drivers/net/usb/mcs7830.c | 5 +++-- drivers/net/usb/net1080.c | 4 ++++ drivers/net/usb/qmi_wwan.c | 8 ++++---- drivers/net/usb/rndis_host.c | 4 ++++ drivers/net/usb/smsc75xx.c | 4 ++++ drivers/net/usb/smsc95xx.c | 4 ++++ drivers/net/usb/usbnet.c | 25 ++++++++++--------------- 9 files changed, 41 insertions(+), 21 deletions(-)
drivers/net/usb/ax88179_178a.c +4 -0
@@ -1119,6 +1119,10 @@ static int ax88179_rx_fixup(struct usbneu16 hdr_off;u32 *pkt_hdr; +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) +return 0 ; +skb_trim (skb, skb->len -4 );memcpy (&rx_hdr,skb_tail_pointer (skb),4 );le32_to_cpus (&rx_hdr);
drivers/net/usb/gl620a.c +4 -0
@@ -86,6 +86,10 @@ static int genelink_rx_fixup(struct usbnu32 size;u32 count; +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) +return 0 ; + header = (struct gl_header *) skb->data;// get the packet count of the received skb
drivers/net/usb/mcs7830.c +3 -2
@@ -528,8 +528,9 @@ static int mcs7830_rx_fixup(struct usbne {u8 status; -if (skb->len ==0 ) { -dev_err (&dev->udev->dev,"unexpected empty rx frame\n" ); +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) { +dev_err (&dev->udev->dev,"unexpected tiny rx frame\n" );return 0 ; }
drivers/net/usb/net1080.c +4 -0
@@ -366,6 +366,10 @@ static int net1080_rx_fixup(struct usbnestruct nc_trailer *trailer;u16 hdr_len, packet_len; +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) +return 0 ; +if (!(skb->len &0x01 )) { netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n", skb->len, dev->net->hard_header_len, dev->hard_mtu,
drivers/net/usb/qmi_wwan.c +4 -4
@@ -80,10 +80,10 @@ static int qmi_wwan_rx_fixup(struct usbn {__be16 proto; -/* usbnet rx_complete guarantees that skb->len is at least -* hard_header_len, so we can inspect the dest address without -* checking skb->len -*/ +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) +return 0 ; +switch (skb->data[0 ] &0xf0 ) {case 0x40 : proto =htons (ETH_P_IP );
drivers/net/usb/rndis_host.c +4 -0
@@ -494,6 +494,10 @@ EXPORT_SYMBOL_GPL(rndis_unbind);*/ int rndis_rx_fixup (struct usbnet *dev,struct sk_buff *skb) { +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) +return 0 ; +/* peripheral may have batched packets to us... */ while (likely (skb->len)) {struct rndis_data_hdr *hdr = (void *)skb->data;
drivers/net/usb/smsc75xx.c +4 -0
@@ -2108,6 +2108,10 @@ static void smsc75xx_rx_csum_offload(strstatic int smsc75xx_rx_fixup (struct usbnet *dev,struct sk_buff *skb) { +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) +return 0 ; +while (skb->len >0 ) {u32 rx_cmd_a, rx_cmd_b, align_count, size;struct sk_buff *ax_skb;
drivers/net/usb/smsc95xx.c +4 -0
@@ -1725,6 +1725,10 @@ static void smsc95xx_rx_csum_offload(strstatic int smsc95xx_rx_fixup (struct usbnet *dev,struct sk_buff *skb) { +/* This check is no longer done by usbnet */ +if (skb->len < dev->net->hard_header_len) +return 0 ; +while (skb->len >0 ) {u32 header, align_count;struct sk_buff *ax_skb;
drivers/net/usb/usbnet.c +10 -15
@@ -543,17 +543,19 @@ static inline void rx_process (struct us }// else network stack removes extra byte if we forced a short packet -if (skb->len) { -/* all data was already cloned from skb inside the driver */ -if (dev->driver_info->flags &FLAG_MULTI_PACKET ) -dev_kfree_skb_any (skb); -else -usbnet_skb_return (dev, skb); +/* all data was already cloned from skb inside the driver */ +if (dev->driver_info->flags &FLAG_MULTI_PACKET ) + goto done; + +if (skb->len <ETH_HLEN ) { + dev->net->stats.rx_errors++; + dev->net->stats.rx_length_errors++; +netif_dbg (dev, rx_err, dev->net,"rx length %d\n" , skb->len); + }else { +usbnet_skb_return (dev, skb);return ; } -netif_dbg (dev, rx_err, dev->net,"drop\n" ); - dev->net->stats.rx_errors++; done:skb_queue_tail (&dev->done, skb); }
@@ -575,13 +577,6 @@ static void rx_complete (struct urb *urbswitch (urb_status) {/* success */ case 0 : -if (skb->len < dev->net->hard_header_len) { - state = rx_cleanup; - dev->net->stats.rx_errors++; - dev->net->stats.rx_length_errors++; -netif_dbg (dev, rx_err, dev->net, -"rx length %d\n" , skb->len); - }break ;/* stalls need manual reset. this is rare ... except that
Greg Kroah-Hartman
maintainerPATCH 51/172 bonding: 802.3ad: make aggregator_identifier bond-private
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Bohac <[email protected]>
[ Upstream commit 163c8ff30dbe473abfbb24a7eac5536c87f3baa9 ]
aggregator_identifier is used to assign unique aggregator identifiers to aggregators of a bond during device enslaving.
aggregator_identifier is currently a global variable that is zeroed in bond_3ad_initialize().
This sequence will lead to duplicate aggregator identifiers for eth1 and eth3:
create bond0
change bond0 mode to 802.3ad
enslave eth0 to bond0 //eth0 gets agg id 1
enslave eth1 to bond0 //eth1 gets agg id 2
create bond1
change bond1 mode to 802.3ad
enslave eth2 to bond1 //aggregator_identifier is reset to 0
//eth2 gets agg id 1
enslave eth3 to bond0 //eth3 gets agg id 2
Fix this by making aggregator_identifier private to the bond.
--- drivers/net/bonding/bond_3ad.c | 6 ++---- drivers/net/bonding/bond_3ad.h | 1 + 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/bonding/bond_3ad.c +2 -4
@@ -1806,8 +1806,6 @@ void bond_3ad_initiate_agg_selection(strBOND_AD_INFO (bond).agg_select_timer = timeout; } -static u16 aggregator_identifier; -/** * bond_3ad_initialize - initialize a bond's 802.3ad parameters and structures * @bond: bonding struct to work on
@@ -1821,7 +1819,7 @@ void bond_3ad_initialize(struct bondingif (MAC_ADDRESS_COMPARE (&(BOND_AD_INFO (bond).system.sys_mac_addr), bond->dev->dev_addr)) { - aggregator_identifier =0 ; +BOND_AD_INFO (bond).aggregator_identifier =0 ;BOND_AD_INFO (bond).system.sys_priority =0xFFFF ;BOND_AD_INFO (bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr);
@@ -1892,7 +1890,7 @@ int bond_3ad_bind_slave(struct slave *slad_initialize_agg (aggregator); aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr); - aggregator->aggregator_identifier = (++aggregator_identifier); + aggregator->aggregator_identifier = ++BOND_AD_INFO (bond).aggregator_identifier; aggregator->slave = slave; aggregator->is_active =0 ; aggregator->num_of_ports =0 ;
drivers/net/bonding/bond_3ad.h +1 -0
@@ -253,6 +253,7 @@ struct ad_system {struct ad_bond_info {struct ad_system system;/* 802.3ad system structure */ u32 agg_select_timer;// Timer to select aggregator after all adapter's hand shakes +u16 aggregator_identifier; };struct ad_slave_info {
Greg Kroah-Hartman
maintainerPATCH 52/172 ipv4: fix counter in_slow_tot
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duan Jiong <[email protected]>
[ Upstream commit a6254864c08109c66a194612585afc0439005286 ]
since commit 89aef8921bf("ipv4: Delete routing cache."), the counter in_slow_tot can't work correctly.
The counter in_slow_tot increase by one when fib_lookup() return successfully in ip_route_input_slow(), but actually the dst struct maybe not be created and cached, so we can increase in_slow_tot after the dst struct is created.
--- net/ipv4/route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/route.c +2 -2
@@ -1600,6 +1600,7 @@ static int __mkroute_input(struct sk_buf rth->rt_gateway =0 ; rth->rt_uses_gateway =0 ;INIT_LIST_HEAD (&rth->rt_uncached); +RT_CACHE_STAT_INC (in_slow_tot); rth->dst.input = ip_forward; rth->dst.output = ip_output;
@@ -1701,8 +1702,6 @@ static int ip_route_input_slow(struct skif (err !=0 ) goto no_route; -RT_CACHE_STAT_INC (in_slow_tot); -if (res.type ==RTN_BROADCAST ) goto brd_input;
@@ -1771,6 +1770,7 @@ local_input: rth->rt_gateway =0 ; rth->rt_uses_gateway =0 ;INIT_LIST_HEAD (&rth->rt_uncached); +RT_CACHE_STAT_INC (in_slow_tot);if (res.type ==RTN_UNREACHABLE ) { rth->dst.input= ip_error; rth->dst.error= -err;
Greg Kroah-Hartman
maintainerPATCH 53/172 net: sctp: fix sctp_connectx abi for ia32 emulation/compat mode
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit ffd5939381c609056b33b7585fb05a77b4c695f3 ]
SCTP's sctp_connectx() abi breaks for 64bit kernels compiled with 32bit emulation (e.g. ia32 emulation or x86_x32). Due to internal usage of 'struct sctp_getaddrs_old' which includes a struct sockaddr pointer, sizeof(param) check will always fail in kernel as the structure in 64bit kernel space is 4bytes larger than for user binaries compiled in 32bit mode. Thus, applications making use of sctp_connectx() won't be able to run under such circumstances.
Introduce a compat interface in the kernel to deal with such situations by using a 'struct compat_sctp_getaddrs_old' structure where user data is copied into it, and then sucessively transformed into a 'struct sctp_getaddrs_old' structure with the help of compat_ptr(). That fixes sctp_connectx() abi without any changes needed in user space, and lets the SCTP test suite pass when compiled in 32bit and run on 64bit kernels.
--- net/sctp/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-)
net/sctp/socket.c +32 -9
@@ -65,6 +65,7 @@#include <linux/crypto.h> #include <linux/slab.h> #include <linux/file.h> +#include <linux/compat.h> #include <net/ip.h> #include <net/icmp.h>
@@ -1369,11 +1370,19 @@ static int sctp_setsockopt_connectx(stru/* * New (hopefully final) interface for the API. * We use the sctp_getaddrs_old structure so that use-space library -* can avoid any unnecessary allocations. The only defferent part +* can avoid any unnecessary allocations. The only different part * is that we store the actual length of the address buffer into the -* addrs_num structure member. That way we can re-use the existing +* addrs_num structure member. That way we can re-use the existing * code. */ +#ifdef CONFIG_COMPAT +struct compat_sctp_getaddrs_old { +sctp_assoc_t assoc_id; +s32 addr_num; +compat_uptr_t addrs;/* struct sockaddr * */ +}; +#endif +static int sctp_getsockopt_connectx3 (struct sock * sk,int len,char __user *optval,int __user *optlen)
@@ -1382,16 +1391,30 @@ static int sctp_getsockopt_connectx3(strsctp_assoc_t assoc_id =0 ;int err =0 ; -if (len <sizeof (param)) -return -EINVAL ; +#ifdef CONFIG_COMPAT +if (is_compat_task ()) { +struct compat_sctp_getaddrs_old param32; -if (copy_from_user (¶m, optval,sizeof (param))) -return -EFAULT ; +if (len <sizeof (param32)) +return -EINVAL ; +if (copy_from_user (¶m32, optval,sizeof (param32))) +return -EFAULT ; - err =__sctp_setsockopt_connectx (sk, - (struct sockaddr __user *)param.addrs, - param.addr_num, &assoc_id); + param.assoc_id = param32.assoc_id; + param.addr_num = param32.addr_num; + param.addrs =compat_ptr (param32.addrs); + } else +#endif + { +if (len <sizeof (param)) +return -EINVAL ; +if (copy_from_user (¶m, optval,sizeof (param))) +return -EFAULT ; + } + err =__sctp_setsockopt_connectx (sk, (struct sockaddr __user *) + param.addrs, param.addr_num, + &assoc_id);if (err ==0 || err == -EINPROGRESS ) {if (copy_to_user (optval, &assoc_id,sizeof (assoc_id)))return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 54/172 net: add and use skb_gso_transport_seglen()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit de960aa9ab4decc3304959f69533eef64d05d8e8 upstream.
This moves part of Eric Dumazets skb_gso_seglen helper from tbf sched to skbuff core so it may be reused by upcoming ip forwarding path patch.
--- include/linux/skbuff.h | 1 + net/core/skbuff.c | 25 +++++++++++++++++++++++++ net/sched/sch_tbf.c | 13 +++---------- 3 files changed, 29 insertions(+), 10 deletions(-)
include/linux/skbuff.h +1 -0
@@ -2371,6 +2371,7 @@ void skb_copy_and_csum_dev(const structvoid skb_split (struct sk_buff *skb,struct sk_buff *skb1,const u32 len);int skb_shift (struct sk_buff *tgt,struct sk_buff *skb,int shiftlen);void skb_scrub_packet (struct sk_buff *skb,bool xnet); +unsigned int skb_gso_transport_seglen (const struct sk_buff *skb);struct sk_buff *skb_segment (struct sk_buff *skb,netdev_features_t features);struct skb_checksum_ops {
net/core/skbuff.c +25 -0
@@ -47,6 +47,8 @@#include <linux/in.h> #include <linux/inet.h> #include <linux/slab.h> +#include <linux/tcp.h> +#include <linux/udp.h> #include <linux/netdevice.h> #ifdef CONFIG_NET_CLS_ACT #include <net/pkt_sched.h>
@@ -3562,3 +3564,26 @@ void skb_scrub_packet(struct sk_buff *sknf_reset_trace (skb); }EXPORT_SYMBOL_GPL (skb_scrub_packet); + +/** +* skb_gso_transport_seglen - Return length of individual segments of a gso packet +* +* @skb: GSO skb +* +* skb_gso_transport_seglen is used to determine the real size of the +* individual segments, including Layer4 headers (TCP/UDP). +* +* The MAC/L2 or network (IP, IPv6) headers are not accounted for. +*/ +unsigned int skb_gso_transport_seglen (const struct sk_buff *skb) +{ +const struct skb_shared_info *shinfo =skb_shinfo (skb); +unsigned int hdr_len; + +if (likely (shinfo->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ))) + hdr_len =tcp_hdrlen (skb); +else + hdr_len =sizeof (struct udphdr ); +return hdr_len + shinfo->gso_size; +} +EXPORT_SYMBOL_GPL (skb_gso_transport_seglen);
net/sched/sch_tbf.c +3 -10
@@ -21,7 +21,6 @@#include <net/netlink.h> #include <net/sch_generic.h> #include <net/pkt_sched.h> -#include <net/tcp.h> /* Simple Token Bucket Filter.
@@ -148,16 +147,10 @@ static u64 psched_ns_t2l(const struct ps* Return length of individual segments of a gso packet, * including all headers (MAC, IP, TCP/UDP) */ -static unsigned int skb_gso_seglen (const struct sk_buff *skb) +static unsigned int skb_gso_mac_seglen (const struct sk_buff *skb) {unsigned int hdr_len =skb_transport_header (skb) -skb_mac_header (skb); -const struct skb_shared_info *shinfo =skb_shinfo (skb); - -if (likely (shinfo->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ))) - hdr_len +=tcp_hdrlen (skb); -else - hdr_len +=sizeof (struct udphdr ); -return hdr_len + shinfo->gso_size; +return hdr_len +skb_gso_transport_seglen (skb); }/* GSO packet is too big, segment it so that tbf can transmit
@@ -202,7 +195,7 @@ static int tbf_enqueue(struct sk_buff *sint ret;if (qdisc_pkt_len (skb) > q->max_size) { -if (skb_is_gso (skb) &&skb_gso_seglen (skb) <= q->max_size) +if (skb_is_gso (skb) &&skb_gso_mac_seglen (skb) <= q->max_size)return tbf_segment (skb, sch);return qdisc_reshape_fail (skb, sch); }
Greg Kroah-Hartman
maintainerPATCH 55/172 net: core: introduce netif_skb_dev_features
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit d206940319c41df4299db75ed56142177bb2e5f6 upstream.
Will be used by upcoming ipv4 forward path change that needs to determine feature mask using skb->dst->dev instead of skb->dev.
--- include/linux/netdevice.h | 7 ++++++- net/core/dev.c | 22 ++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-)
include/linux/netdevice.h +6 -1
@@ -2984,7 +2984,12 @@ void netdev_change_features(struct net_dvoid netif_stacked_transfer_operstate (const struct net_device *rootdev,struct net_device *dev); -netdev_features_t netif_skb_features (struct sk_buff *skb); +netdev_features_t netif_skb_dev_features (struct sk_buff *skb, +const struct net_device *dev); +static inline netdev_features_t netif_skb_features (struct sk_buff *skb) +{ +return netif_skb_dev_features (skb, skb->dev); +}static inline bool net_gso_ok (netdev_features_t features,int gso_type) {
net/core/dev.c +12 -10
@@ -2404,7 +2404,7 @@ EXPORT_SYMBOL(netdev_rx_csum_fault);* 2. No high memory really exists on this machine. */ -static int illegal_highdma (struct net_device *dev,struct sk_buff *skb) +static int illegal_highdma (const struct net_device *dev,struct sk_buff *skb) {#ifdef CONFIG_HIGHMEM int i;
@@ -2484,34 +2484,36 @@ static int dev_gso_segment(struct sk_buf }static netdev_features_t harmonize_features (struct sk_buff *skb, -netdev_features_t features) +const struct net_device *dev, +netdev_features_t features) {if (skb->ip_summed !=CHECKSUM_NONE && !can_checksum_protocol (features,skb_network_protocol (skb))) { features &= ~NETIF_F_ALL_CSUM ; - }else if (illegal_highdma (skb->dev, skb)) { + }else if (illegal_highdma (dev, skb)) { features &= ~NETIF_F_SG ; }return features; } -netdev_features_t netif_skb_features (struct sk_buff *skb) +netdev_features_t netif_skb_dev_features (struct sk_buff *skb, +const struct net_device *dev) {__be16 protocol = skb->protocol; -netdev_features_t features = skb->dev->features; +netdev_features_t features = dev->features; -if (skb_shinfo (skb)->gso_segs > skb->dev->gso_max_segs) +if (skb_shinfo (skb)->gso_segs > dev->gso_max_segs) features &= ~NETIF_F_GSO_MASK ;if (protocol ==htons (ETH_P_8021Q ) || protocol ==htons (ETH_P_8021AD )) {struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; protocol = veh->h_vlan_encapsulated_proto; }else if (!vlan_tx_tag_present (skb)) { -return harmonize_features (skb, features); +return harmonize_features (skb, dev, features); } - features &= (skb->dev->vlan_features |NETIF_F_HW_VLAN_CTAG_TX | + features &= (dev->vlan_features |NETIF_F_HW_VLAN_CTAG_TX |NETIF_F_HW_VLAN_STAG_TX );if (protocol ==htons (ETH_P_8021Q ) || protocol ==htons (ETH_P_8021AD ))
@@ -2519,9 +2521,9 @@ netdev_features_t netif_skb_features(strNETIF_F_GEN_CSUM |NETIF_F_HW_VLAN_CTAG_TX |NETIF_F_HW_VLAN_STAG_TX ; -return harmonize_features (skb, features); +return harmonize_features (skb, dev, features); } -EXPORT_SYMBOL (netif_skb_features); +EXPORT_SYMBOL (netif_skb_dev_features);/* * Returns true if either:
Greg Kroah-Hartman
maintainerPATCH 56/172 net: ip, ipv6: handle gso skbs in forwarding path
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit fe6cc55f3a9a053482a76f5a6b2257cee51b4663 upstream.
Marcelo Ricardo Leitner reported problems when the forwarding link path has a lower mtu than the incoming one if the inbound interface supports GRO.
Given:
Host <mtu1500> R1 <mtu1200> R2
Host sends tcp stream which is routed via R1 and R2. R1 performs GRO.
In this case, the kernel will fail to send ICMP fragmentation needed messages (or pkt too big for ipv6), as GSO packets currently bypass dstmtu checks in forward path. Instead, Linux tries to send out packets exceeding the mtu.
When locking route MTU on Host (i.e., no ipv4 DF bit set), R1 does not fragment the packets when forwarding, and again tries to send out packets exceeding R1-R2 link mtu.
This alters the forwarding dstmtu checks to take the individual gso segment lengths into account.
For ipv6, we send out pkt too big error for gso if the individual segments are too big.
For ipv4, we either send icmp fragmentation needed, or, if the DF bit is not set, perform software segmentation and let the output path create fragments when the packet is leaving the machine.
It is not 100% correct as the error message will contain the headers of the GRO skb instead of the original/segmented one, but it seems to work fine in my (limited) tests.
Eric Dumazet suggested to simply shrink mss via ->gso_size to avoid sofware segmentation.
However it turns out that skb_segment() assumes skb nr_frags is related to mss size so we would BUG there. I don't want to mess with it considering Herbert and Eric disagree on what the correct behavior should be.
Hannes Frederic Sowa notes that when we would shrink gso_size skb_segment would then also need to deal with the case where SKB_MAX_FRAGS would be exceeded.
This uses sofware segmentation in the forward path when we hit ipv4 non-DF packets and the outgoing link mtu is too small. Its not perfect, but given the lack of bug reports wrt. GRO fwd being broken this is a rare case anyway. Also its not like this could not be improved later once the dust settles.
--- include/linux/skbuff.h | 17 +++++++++++ net/ipv4/ip_forward.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++-- net/ipv6/ip6_output.c | 17 ++++++++++- 3 files changed, 101 insertions(+), 4 deletions(-)
include/linux/skbuff.h +17 -0
@@ -2811,5 +2811,22 @@ static inline bool skb_head_is_locked(co {return !skb->head_frag ||skb_cloned (skb); } + +/** +* skb_gso_network_seglen - Return length of individual segments of a gso packet +* +* @skb: GSO skb +* +* skb_gso_network_seglen is used to determine the real size of the +* individual segments, including Layer3 (IP, IPv6) and L4 headers (TCP/UDP). +* +* The MAC/L2 header is not accounted for. +*/ +static inline unsigned int skb_gso_network_seglen (const struct sk_buff *skb) +{ +unsigned int hdr_len =skb_transport_header (skb) - +skb_network_header (skb); +return hdr_len +skb_gso_transport_seglen (skb); +}#endif /* __KERNEL__ */ #endif /* _LINUX_SKBUFF_H */
net/ipv4/ip_forward.c +69 -2
89 lines not on this page · raw message
net/ipv6/ip6_output.c +15 -2
@@ -321,6 +321,20 @@ static inline int ip6_forward_finish(strreturn dst_output (skb); } +static bool ip6_pkt_too_big (const struct sk_buff *skb,unsigned int mtu) +{ +if (skb->len <= mtu || skb->local_df) +return false; + +if (IP6CB (skb)->frag_max_size &&IP6CB (skb)->frag_max_size > mtu) +return true; + +if (skb_is_gso (skb) &&skb_gso_network_seglen (skb) <= mtu) +return false; + +return true; +} +int ip6_forward (struct sk_buff *skb) {struct dst_entry *dst =skb_dst (skb);
@@ -443,8 +457,7 @@ int ip6_forward(struct sk_buff *skb)if (mtu <IPV6_MIN_MTU ) mtu =IPV6_MIN_MTU ; -if ((!skb->local_df && skb->len > mtu && !skb_is_gso (skb)) || - (IP6CB (skb)->frag_max_size &&IP6CB (skb)->frag_max_size > mtu)) { +if (ip6_pkt_too_big (skb, mtu)) {/* Again, force OUTPUT device used as source address */ skb->dev = dst->dev;icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu);
Greg Kroah-Hartman
maintainerPATCH 57/172 net: mvneta: increase the 64-bit rx/tx stats out of the hot path
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: willy tarreau <[email protected]>
[ Upstream commit dc4277dd41a80fd5f29a90412ea04bc3ba54fbf1 ]
Better count packets and bytes in the stack and on 32 bit then accumulate them at the end for once. This saves two memory writes and two memory barriers per packet. The incoming packet rate was increased by 4.7% on the Openblocks AX3 thanks to this.
--- drivers/net/ethernet/marvell/mvneta.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +11 -4
@@ -1391,6 +1391,8 @@ static int mvneta_rx(struct mvneta_port {struct net_device *dev = pp->dev;int rx_done, rx_filled; +u32 rcvd_pkts =0 ; +u32 rcvd_bytes =0 ;/* Get number of received packets */ rx_done =mvneta_rxq_busy_desc_num_get (pp, rxq);
@@ -1428,10 +1430,8 @@ static int mvneta_rx(struct mvneta_port rx_bytes = rx_desc->data_size - (ETH_FCS_LEN +MVNETA_MH_SIZE ); -u64_stats_update_begin (&pp->rx_stats.syncp); - pp->rx_stats.packets++; - pp->rx_stats.bytes += rx_bytes; -u64_stats_update_end (&pp->rx_stats.syncp); + rcvd_pkts++; + rcvd_bytes += rx_bytes;/* Linux processing */ skb_reserve (skb,MVNETA_MH_SIZE );
@@ -1452,6 +1452,13 @@ static int mvneta_rx(struct mvneta_port } } +if (rcvd_pkts) { +u64_stats_update_begin (&pp->rx_stats.syncp); + pp->rx_stats.packets += rcvd_pkts; + pp->rx_stats.bytes += rcvd_bytes; +u64_stats_update_end (&pp->rx_stats.syncp); + } +/* Update rxq management counters */ mvneta_rxq_desc_num_update (pp, rxq, rx_done, rx_filled);
Greg Kroah-Hartman
maintainerPATCH 58/172 net: mvneta: use per_cpu stats to fix an SMP lock up
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: willy tarreau <[email protected]>
[ Upstream commit 74c41b048db1073a04827d7f39e95ac1935524cc ]
Stats writers are mvneta_rx() and mvneta_tx(). They don't lock anything when they update the stats, and as a result, it randomly happens that the stats freeze on SMP if two updates happen during stats retrieval. This is very easily reproducible by starting two HTTP servers and binding each of them to a different CPU, then consulting /proc/net/dev in loops during transfers, the interface should immediately lock up. This issue also randomly happens upon link state changes during transfers, because the stats are collected in this situation, but it takes more attempts to reproduce it.
The comments in netdevice.h suggest using per_cpu stats instead to get rid of this issue.
This patch implements this. It merges both rx_stats and tx_stats into a single "stats" member with a single syncp. Both mvneta_rx() and mvneta_rx() now only update the a single CPU's counters.
In turn, mvneta_get_stats64() does the summing by iterating over all CPUs to get their respective stats.
With this change, stats are still correct and no more lockup is encountered.
Note that this bug was present since the first import of the mvneta driver. It might make sense to backport it to some stable trees. If so, it depends on "d33dc73 net: mvneta: increase the 64-bit rx/tx stats out of the hot path".
--- drivers/net/ethernet/marvell/mvneta.c | 88 ++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 31 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +57 -31
@@ -221,10 +221,12 @@#define MVNETA_RX_BUF_SIZE (pkt_size) ((pkt_size) + NET_SKB_PAD) -struct mvneta_stats { +struct mvneta_pcpu_stats {struct u64_stats_sync syncp; -u64 packets; -u64 bytes; +u64 rx_packets; +u64 rx_bytes; +u64 tx_packets; +u64 tx_bytes; };struct mvneta_port {
@@ -250,8 +252,7 @@ struct mvneta_port {u8 mcast_count[256 ];u16 tx_ring_size;u16 rx_ring_size; -struct mvneta_stats tx_stats; -struct mvneta_stats rx_stats; +struct mvneta_pcpu_stats *stats;struct mii_bus *mii_bus;struct phy_device *phy_dev;
@@ -461,21 +462,29 @@ struct rtnl_link_stats64 *mvneta_get_sta {struct mvneta_port *pp =netdev_priv (dev);unsigned int start; +int cpu; -memset (stats,0 ,sizeof (struct rtnl_link_stats64 )); - -do { - start =u64_stats_fetch_begin_bh (&pp->rx_stats.syncp); - stats->rx_packets = pp->rx_stats.packets; - stats->rx_bytes = pp->rx_stats.bytes; - }while (u64_stats_fetch_retry_bh (&pp->rx_stats.syncp, start)); - - -do { - start =u64_stats_fetch_begin_bh (&pp->tx_stats.syncp); - stats->tx_packets = pp->tx_stats.packets; - stats->tx_bytes = pp->tx_stats.bytes; - }while (u64_stats_fetch_retry_bh (&pp->tx_stats.syncp, start)); +for_each_possible_cpu (cpu) { +struct mvneta_pcpu_stats *cpu_stats; +u64 rx_packets; +u64 rx_bytes; +u64 tx_packets; +u64 tx_bytes; + + cpu_stats =per_cpu_ptr (pp->stats, cpu); +do { + start =u64_stats_fetch_begin_bh (&cpu_stats->syncp); + rx_packets = cpu_stats->rx_packets; + rx_bytes = cpu_stats->rx_bytes; + tx_packets = cpu_stats->tx_packets; + tx_bytes = cpu_stats->tx_bytes; + }while (u64_stats_fetch_retry_bh (&cpu_stats->syncp, start)); + + stats->rx_packets += rx_packets; + stats->rx_bytes += rx_bytes; + stats->tx_packets += tx_packets; + stats->tx_bytes += tx_bytes; + } stats->rx_errors = dev->stats.rx_errors; stats->rx_dropped = dev->stats.rx_dropped;
@@ -1453,10 +1462,12 @@ static int mvneta_rx(struct mvneta_port }if (rcvd_pkts) { -u64_stats_update_begin (&pp->rx_stats.syncp); - pp->rx_stats.packets += rcvd_pkts; - pp->rx_stats.bytes += rcvd_bytes; -u64_stats_update_end (&pp->rx_stats.syncp); +struct mvneta_pcpu_stats *stats =this_cpu_ptr (pp->stats); + +u64_stats_update_begin (&stats->syncp); + stats->rx_packets += rcvd_pkts; + stats->rx_bytes += rcvd_bytes; +u64_stats_update_end (&stats->syncp); }/* Update rxq management counters */
@@ -1589,11 +1600,12 @@ static int mvneta_tx(struct sk_buff *skb out:if (frags >0 ) { -u64_stats_update_begin (&pp->tx_stats.syncp); - pp->tx_stats.packets++; - pp->tx_stats.bytes += skb->len; -u64_stats_update_end (&pp->tx_stats.syncp); +struct mvneta_pcpu_stats *stats =this_cpu_ptr (pp->stats); +u64_stats_update_begin (&stats->syncp); + stats->tx_packets++; + stats->tx_bytes += skb->len; +u64_stats_update_end (&stats->syncp); }else { dev->stats.tx_dropped++;dev_kfree_skb_any (skb);
@@ -2758,6 +2770,7 @@ static int mvneta_probe(struct platform_const char *mac_from;int phy_mode;int err; +int cpu;/* Our multiqueue support is not complete, so for now, only * allow the usage of the first RX queue
@@ -2799,9 +2812,6 @@ static int mvneta_probe(struct platform_ pp =netdev_priv (dev); -u64_stats_init (&pp->tx_stats.syncp); -u64_stats_init (&pp->rx_stats.syncp); - pp->weight =MVNETA_RX_POLL_WEIGHT ; pp->phy_node = phy_node; pp->phy_interface = phy_mode;
@@ -2820,6 +2830,19 @@ static int mvneta_probe(struct platform_ goto err_clk; } +/* Alloc per-cpu stats */ + pp->stats = alloc_percpu(struct mvneta_pcpu_stats); +if (!pp->stats) { + err = -ENOMEM ; + goto err_unmap; + } + +for_each_possible_cpu (cpu) { +struct mvneta_pcpu_stats *stats; + stats =per_cpu_ptr (pp->stats, cpu); +u64_stats_init (&stats->syncp); + } + dt_mac_addr =of_get_mac_address (dn);if (dt_mac_addr) { mac_from ="device tree" ;
@@ -2849,7 +2872,7 @@ static int mvneta_probe(struct platform_ err =mvneta_init (pp, phy_addr);if (err <0 ) {dev_err (&pdev->dev,"can't init eth hal\n" ); - goto err_unmap; + goto err_free_stats; }mvneta_port_power_up (pp, phy_mode);
@@ -2879,6 +2902,8 @@ static int mvneta_probe(struct platform_ err_deinit:mvneta_deinit (pp); +err_free_stats: +free_percpu (pp->stats); err_unmap:iounmap (pp->base); err_clk:
@@ -2899,6 +2924,7 @@ static int mvneta_remove(struct platformunregister_netdev (dev);mvneta_deinit (pp);clk_disable_unprepare (pp->clk); +free_percpu (pp->stats);iounmap (pp->base);irq_dispose_mapping (dev->irq);free_netdev (dev);
Greg Kroah-Hartman
maintainerPATCH 59/172 net: mvneta: do not schedule in mvneta_tx_timeout
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: willy tarreau <[email protected]>
[ Upstream commit 290213667ab53a95456397763205e4b1e30f46b5 ]
If a queue timeout is reported, we can oops because of some schedules while the caller is atomic, as shown below :
mvneta d0070000.ethernet eth0: tx timeout
BUG: scheduling while atomic: bash/1528/0x00000100 Modules linked in: slhttp_ethdiv(C) [last unloaded: slhttp_ethdiv] CPU: 2 PID: 1528 Comm: bash Tainted: G WC 3.13.0-rc4-mvebu-nf #180 [<c0011bd9>] (unwind_backtrace+0x1/0x98) from [<c000f1ab>] (show_stack+0xb/0xc) [<c000f1ab>] (show_stack+0xb/0xc) from [<c02ad323>] (dump_stack+0x4f/0x64) [<c02ad323>] (dump_stack+0x4f/0x64) from [<c02abe67>] (__schedule_bug+0x37/0x4c) [<c02abe67>] (__schedule_bug+0x37/0x4c) from [<c02ae261>] (__schedule+0x325/0x3ec) [<c02ae261>] (__schedule+0x325/0x3ec) from [<c02adb97>] (schedule_timeout+0xb7/0x118) [<c02adb97>] (schedule_timeout+0xb7/0x118) from [<c0020a67>] (msleep+0xf/0x14) [<c0020a67>] (msleep+0xf/0x14) from [<c01dcbe5>] (mvneta_stop_dev+0x21/0x194) [<c01dcbe5>] (mvneta_stop_dev+0x21/0x194) from [<c01dcfe9>] (mvneta_tx_timeout+0x19/0x24) [<c01dcfe9>] (mvneta_tx_timeout+0x19/0x24) from [<c024afc7>] (dev_watchdog+0x18b/0x1c4) [<c024afc7>] (dev_watchdog+0x18b/0x1c4) from [<c0020b53>] (call_timer_fn.isra.27+0x17/0x5c) [<c0020b53>] (call_timer_fn.isra.27+0x17/0x5c) from [<c0020cad>] (run_timer_softirq+0x115/0x170) [<c0020cad>] (run_timer_softirq+0x115/0x170) from [<c001ccb9>] (__do_softirq+0xbd/0x1a8) [<c001ccb9>] (__do_softirq+0xbd/0x1a8) from [<c001cfad>] (irq_exit+0x61/0x98) [<c001cfad>] (irq_exit+0x61/0x98) from [<c000d4bf>] (handle_IRQ+0x27/0x60) [<c000d4bf>] (handle_IRQ+0x27/0x60) from [<c000843b>] (armada_370_xp_handle_irq+0x33/0xc8) [<c000843b>] (armada_370_xp_handle_irq+0x33/0xc8) from [<c000fba9>] (__irq_usr+0x49/0x60)
Ben Hutchings attempted to propose a better fix consisting in using a scheduled work for this, but while it fixed this panic, it caused other random freezes and panics proving that the reset sequence in the driver is unreliable and that additional fixes should be investigated.
When sending multiple streams over a link limited to 100 Mbps, Tx timeouts happen from time to time, and the driver correctly recovers only when the function is disabled.
--- drivers/net/ethernet/marvell/mvneta.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +0 -11
@@ -2244,16 +2244,6 @@ static void mvneta_stop_dev(struct mvnetmvneta_rx_reset (pp); } -/* tx timeout callback - display a message and stop/start the network device */ -static void mvneta_tx_timeout (struct net_device *dev) -{ -struct mvneta_port *pp =netdev_priv (dev); - -netdev_info (dev,"tx timeout\n" ); -mvneta_stop_dev (pp); -mvneta_start_dev (pp); -} -/* Return positive if MTU is valid */ static int mvneta_check_mtu_valid (struct net_device *dev,int mtu) {
@@ -2634,7 +2624,6 @@ static const struct net_device_ops mvnet .ndo_set_rx_mode = mvneta_set_rx_mode, .ndo_set_mac_address = mvneta_set_mac_addr, .ndo_change_mtu = mvneta_change_mtu, - .ndo_tx_timeout = mvneta_tx_timeout, .ndo_get_stats64 = mvneta_get_stats64, .ndo_do_ioctl = mvneta_ioctl, };
Greg Kroah-Hartman
maintainerPATCH 60/172 net: mvneta: add missing bit descriptions for interrupt masks and causes
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: willy tarreau <[email protected]>
[ Upstream commit 40ba35e74fa56866918d2f3bc0528b5b92725d5e ]
Marvell has not published the chip's datasheet yet, so it's very hard to find the relevant bits to manipulate to change the IRQ behaviour. Fortunately, these bits are described in the proprietary LSP patch set which is publicly available here :
http://www.plugcomputer.org/downloads/mirabox/
So let's put them back in the driver in order to reduce the burden of current and future maintenance.
--- drivers/net/ethernet/marvell/mvneta.c | 44 ++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +42 -2
@@ -101,16 +101,56 @@#define MVNETA_CPU_RXQ_ACCESS_ALL_MASK 0x000000ff#define MVNETA_CPU_TXQ_ACCESS_ALL_MASK 0x0000ff00#define MVNETA_RXQ_TIME_COAL_REG (q) (0x2580 + ((q) << 2)) + +/* Exception Interrupt Port/Queue Cause register */ +#define MVNETA_INTR_NEW_CAUSE 0x25a0 -#define MVNETA_RX_INTR_MASK (nr_rxqs) (((1 << nr_rxqs) - 1) << 8)#define MVNETA_INTR_NEW_MASK 0x25a4 + +/* bits 0..7 = TXQ SENT, one bit per queue. +* bits 8..15 = RXQ OCCUP, one bit per queue. +* bits 16..23 = RXQ FREE, one bit per queue. +* bit 29 = OLD_REG_SUM, see old reg ? +* bit 30 = TX_ERR_SUM, one bit for 4 ports +* bit 31 = MISC_SUM, one bit for 4 ports +*/ +#define MVNETA_TX_INTR_MASK (nr_txqs) (((1 << nr_txqs) - 1) << 0) +#define MVNETA_TX_INTR_MASK_ALL (0xff << 0) +#define MVNETA_RX_INTR_MASK (nr_rxqs) (((1 << nr_rxqs) - 1) << 8) +#define MVNETA_RX_INTR_MASK_ALL (0xff << 8) +#define MVNETA_INTR_OLD_CAUSE 0x25a8#define MVNETA_INTR_OLD_MASK 0x25ac + +/* Data Path Port/Queue Cause Register */ #define MVNETA_INTR_MISC_CAUSE 0x25b0#define MVNETA_INTR_MISC_MASK 0x25b4 + +#define MVNETA_CAUSE_PHY_STATUS_CHANGE BIT(0) +#define MVNETA_CAUSE_LINK_CHANGE BIT(1) +#define MVNETA_CAUSE_PTP BIT(4) + +#define MVNETA_CAUSE_INTERNAL_ADDR_ERR BIT(7) +#define MVNETA_CAUSE_RX_OVERRUN BIT(8) +#define MVNETA_CAUSE_RX_CRC_ERROR BIT(9) +#define MVNETA_CAUSE_RX_LARGE_PKT BIT(10) +#define MVNETA_CAUSE_TX_UNDERUN BIT(11) +#define MVNETA_CAUSE_PRBS_ERR BIT(12) +#define MVNETA_CAUSE_PSC_SYNC_CHANGE BIT(13) +#define MVNETA_CAUSE_SERDES_SYNC_ERR BIT(14) + +#define MVNETA_CAUSE_BMU_ALLOC_ERR_SHIFT 16 +#define MVNETA_CAUSE_BMU_ALLOC_ERR_ALL_MASK (0xF << MVNETA_CAUSE_BMU_ALLOC_ERR_SHIFT) +#define MVNETA_CAUSE_BMU_ALLOC_ERR_MASK (pool) (1 << (MVNETA_CAUSE_BMU_ALLOC_ERR_SHIFT + (pool))) + +#define MVNETA_CAUSE_TXQ_ERROR_SHIFT 24 +#define MVNETA_CAUSE_TXQ_ERROR_ALL_MASK (0xFF << MVNETA_CAUSE_TXQ_ERROR_SHIFT) +#define MVNETA_CAUSE_TXQ_ERROR_MASK (q) (1 << (MVNETA_CAUSE_TXQ_ERROR_SHIFT + (q))) +#define MVNETA_INTR_ENABLE 0x25b8#define MVNETA_TXQ_INTR_ENABLE_ALL_MASK 0x0000ff00 -#define MVNETA_RXQ_INTR_ENABLE_ALL_MASK 0xff000000 +#define MVNETA_RXQ_INTR_ENABLE_ALL_MASK 0xff000000 // note: neta says it's 0x000000FF +#define MVNETA_RXQ_CMD 0x2680#define MVNETA_RXQ_DISABLE_SHIFT 8#define MVNETA_RXQ_ENABLE_MASK 0x000000ff
Greg Kroah-Hartman
maintainerPATCH 61/172 net: mvneta: replace Tx timer with a real interrupt
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: willy tarreau <[email protected]>
[ Upstream commit 71f6d1b31fb1f278a345a30a2180515adc7d80ae ]
Right now the mvneta driver doesn't handle Tx IRQ, and relies on two mechanisms to flush Tx descriptors : a flush at the end of mvneta_tx() and a timer. If a burst of packets is emitted faster than the device can send them, then the queue is stopped until next wake-up of the timer 10ms later. This causes jerky output traffic with bursts and pauses, making it difficult to reach line rate with very few streams.
A test on UDP traffic shows that it's not possible to go beyond 134 Mbps / 12 kpps of outgoing traffic with 1500-bytes IP packets. Routed traffic tends to observe pauses as well if the traffic is bursty, making it even burstier after the wake-up.
It seems that this feature was inherited from the original driver but nothing there mentions any reason for not using the interrupt instead, which the chip supports.
Thus, this patch enables Tx interrupts and removes the timer. It does the two at once because it's not really possible to make the two mechanisms coexist, so a split patch doesn't make sense.
First tests performed on a Mirabox (Armada 370) show that less CPU seems to be used when sending traffic. One reason might be that we now call the mvneta_tx_done_gbe() with a mask indicating which queues have been done instead of looping over all of them.
The same UDP test above now happily reaches 987 Mbps / 87.7 kpps. Single-stream TCP traffic can now more easily reach line rate. HTTP transfers of 1 MB objects over a single connection went from 730 to 840 Mbps. It is even possible to go significantly higher (>900 Mbps) by tweaking tcp_tso_win_divisor.
--- drivers/net/ethernet/marvell/mvneta.c | 71 +++++----------------------------- 1 file changed, 12 insertions(+), 59 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +12 -59
@@ -216,9 +216,6 @@#define MVNETA_RX_COAL_PKTS 32#define MVNETA_RX_COAL_USEC 100 -/* Timer */ -#define MVNETA_TX_DONE_TIMER_PERIOD 10 -/* Napi polling weight */ #define MVNETA_RX_POLL_WEIGHT 64
@@ -274,16 +271,11 @@ struct mvneta_port {void __iomem *base;struct mvneta_rx_queue *rxqs;struct mvneta_tx_queue *txqs; -struct timer_list tx_done_timer;struct net_device *dev;u32 cause_rx_tx;struct napi_struct napi; -/* Flags */ -unsigned long flags; -#define MVNETA_F_TX_DONE_TIMER_BIT 0 -/* Napi weight */ int weight;
@@ -1149,17 +1141,6 @@ static void mvneta_tx_done_pkts_coal_set txq->done_pkts_coal = value; } -/* Trigger tx done timer in MVNETA_TX_DONE_TIMER_PERIOD msecs */ -static void mvneta_add_tx_done_timer (struct mvneta_port *pp) -{ -if (test_and_set_bit (MVNETA_F_TX_DONE_TIMER_BIT , &pp->flags) ==0 ) { - pp->tx_done_timer.expires = jiffies + -msecs_to_jiffies (MVNETA_TX_DONE_TIMER_PERIOD ); -add_timer (&pp->tx_done_timer); - } -} - -/* Handle rx descriptor fill by setting buf_cookie and buf_phys_addr */ static void mvneta_rx_desc_fill (struct mvneta_rx_desc *rx_desc,u32 phys_addr,u32 cookie)
@@ -1651,15 +1632,6 @@ out:dev_kfree_skb_any (skb); } -if (txq->count >=MVNETA_TXDONE_COAL_PKTS ) -mvneta_txq_done (pp, txq); - -/* If after calling mvneta_txq_done, count equals -* frags, we need to set the timer -*/ -if (txq->count == frags && frags >0 ) -mvneta_add_tx_done_timer (pp); -return NETDEV_TX_OK ; }
@@ -1935,14 +1907,22 @@ static int mvneta_poll(struct napi_struc/* Read cause register */ cause_rx_tx =mvreg_read (pp,MVNETA_INTR_NEW_CAUSE ) & -MVNETA_RX_INTR_MASK (rxq_number); + (MVNETA_RX_INTR_MASK (rxq_number) |MVNETA_TX_INTR_MASK (txq_number)); + +/* Release Tx descriptors */ +if (cause_rx_tx &MVNETA_TX_INTR_MASK_ALL ) { +int tx_todo =0 ; + +mvneta_tx_done_gbe (pp, (cause_rx_tx &MVNETA_TX_INTR_MASK_ALL ), &tx_todo); + cause_rx_tx &= ~MVNETA_TX_INTR_MASK_ALL ; + }/* For the case where the last mvneta_poll did not process all * RX packets */ cause_rx_tx |= pp->cause_rx_tx;if (rxq_number >1 ) { -while ((cause_rx_tx !=0 ) && (budget >0 )) { +while ((cause_rx_tx &MVNETA_RX_INTR_MASK_ALL ) && (budget >0 )) {int count;struct mvneta_rx_queue *rxq;/* get rx queue number from cause_rx_tx */
@@ -1974,7 +1954,7 @@ static int mvneta_poll(struct napi_strucnapi_complete (napi);local_irq_save (flags);mvreg_write (pp,MVNETA_INTR_NEW_MASK , -MVNETA_RX_INTR_MASK (rxq_number)); +MVNETA_RX_INTR_MASK (rxq_number) |MVNETA_TX_INTR_MASK (txq_number));local_irq_restore (flags); }
@@ -1982,26 +1962,6 @@ static int mvneta_poll(struct napi_strucreturn rx_done; } -/* tx done timer callback */ -static void mvneta_tx_done_timer_callback (unsigned long data) -{ -struct net_device *dev = (struct net_device *)data; -struct mvneta_port *pp =netdev_priv (dev); -int tx_done =0 , tx_todo =0 ; - -if (!netif_running (dev)) -return ; - -clear_bit (MVNETA_F_TX_DONE_TIMER_BIT , &pp->flags); - - tx_done =mvneta_tx_done_gbe (pp, - (((1 << txq_number) -1 ) & -MVNETA_CAUSE_TXQ_SENT_DESC_ALL_MASK ), - &tx_todo); -if (tx_todo >0 ) -mvneta_add_tx_done_timer (pp); -} -/* Handle rxq fill: allocates rxq skbs; called when initializing a port */ static int mvneta_rxq_fill (struct mvneta_port *pp,struct mvneta_rx_queue *rxq,int num)
@@ -2251,7 +2211,7 @@ static void mvneta_start_dev(struct mvne/* Unmask interrupts */ mvreg_write (pp,MVNETA_INTR_NEW_MASK , -MVNETA_RX_INTR_MASK (rxq_number)); +MVNETA_RX_INTR_MASK (rxq_number) |MVNETA_TX_INTR_MASK (txq_number));phy_start (pp->phy_dev);netif_tx_start_all_queues (pp->dev);
@@ -2527,8 +2487,6 @@ static int mvneta_stop(struct net_devicefree_irq (dev->irq, pp);mvneta_cleanup_rxqs (pp);mvneta_cleanup_txqs (pp); -del_timer (&pp->tx_done_timer); -clear_bit (MVNETA_F_TX_DONE_TIMER_BIT , &pp->flags);return 0 ; }
@@ -2887,11 +2845,6 @@ static int mvneta_probe(struct platform_ } } - pp->tx_done_timer.data = (unsigned long )dev; - pp->tx_done_timer.function = mvneta_tx_done_timer_callback; -init_timer (&pp->tx_done_timer); -clear_bit (MVNETA_F_TX_DONE_TIMER_BIT , &pp->flags); - pp->tx_ring_size =MVNETA_MAX_TXD ; pp->rx_ring_size =MVNETA_MAX_RXD ;
Greg Kroah-Hartman
maintainerPATCH 62/172 net: use __GFP_NORETRY for high order allocations
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ed98df3361f059db42786c830ea96e2d18b8d4db ]
sock_alloc_send_pskb() & sk_page_frag_refill()
have a loop trying high order allocations to prepare skb with low number of fragments as this increases performance.
Problem is that under memory pressure/fragmentation, this can trigger OOM while the intent was only to try the high order allocations, then fallback to order-0 allocations.
We had various reports from unexpected regressions.
According to David, setting __GFP_NORETRY should be fine, as the asynchronous compaction is still enabled, and this will prevent OOM from kicking as in :
CFSClientEventm invoked oom-killer: gfp_mask=0x42d0, order=3, oom_adj=0, oom_score_adj=0, oom_score_badness=2 (enabled),memcg_scoring=disabled CFSClientEventm
Call Trace: [<ffffffff8043766c>] dump_header+0xe1/0x23e [<ffffffff80437a02>] oom_kill_process+0x6a/0x323 [<ffffffff80438443>] out_of_memory+0x4b3/0x50d [<ffffffff8043a4a6>] __alloc_pages_may_oom+0xa2/0xc7 [<ffffffff80236f42>] __alloc_pages_nodemask+0x1002/0x17f0 [<ffffffff8024bd23>] alloc_pages_current+0x103/0x2b0 [<ffffffff8028567f>] sk_page_frag_refill+0x8f/0x160 [<ffffffff80295fa0>] tcp_sendmsg+0x560/0xee0 [<ffffffff802a5037>] inet_sendmsg+0x67/0x100 [<ffffffff80283c9c>] __sock_sendmsg_nosec+0x6c/0x90 [<ffffffff80283e85>] sock_sendmsg+0xc5/0xf0 [<ffffffff802847b6>] __sys_sendmsg+0x136/0x430 [<ffffffff80284ec8>] sys_sendmsg+0x88/0x110 [<ffffffff80711472>] system_call_fastpath+0x16/0x1b
Out of Memory: Kill process 2856 (bash) score 9999 or sacrifice child
--- net/core/sock.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/sock.c +4 -2
@@ -1800,7 +1800,9 @@ struct sk_buff *sock_alloc_send_pskb(strwhile (order) {if (npages >=1 << order) { page =alloc_pages (sk->sk_allocation | - __GFP_COMP | __GFP_NOWARN, + __GFP_COMP | + __GFP_NOWARN | + __GFP_NORETRY, order);if (page) goto fill_page;
@@ -1872,7 +1874,7 @@ bool skb_page_frag_refill(unsigned int sgfp_t gfp = prio;if (order) - gfp |= __GFP_COMP | __GFP_NOWARN; + gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY; pfrag->page =alloc_pages (gfp, order);if (likely (pfrag->page)) { pfrag->offset =0 ;
Greg Kroah-Hartman
maintainerPATCH 63/172 batman-adv: fix soft-interface MTU computation
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit 930cd6e46eadce8b8ed2a232ee536e5fd286c152 ]
The current MTU computation always returns a value smaller than 1500bytes even if the real interfaces have an MTU large enough to compensate the batman-adv overhead.
Fix the computation by properly returning the highest admitted value.
Introduced by a19d3d85e1b854e4a483a55d740a42458085560d ("batman-adv: limit local translation table max size")
--- net/batman-adv/hard-interface.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
net/batman-adv/hard-interface.c +14 -8
@@ -244,7 +244,7 @@ int batadv_hardif_min_mtu(struct net_dev {struct batadv_priv *bat_priv =netdev_priv (soft_iface);const struct batadv_hard_iface *hard_iface; -int min_mtu =ETH_DATA_LEN ; +int min_mtu =INT_MAX ;rcu_read_lock ();list_for_each_entry_rcu (hard_iface, &batadv_hardif_list, list) {
@@ -259,8 +259,6 @@ int batadv_hardif_min_mtu(struct net_dev }rcu_read_unlock (); -atomic_set (&bat_priv->packet_size_max, min_mtu); -if (atomic_read (&bat_priv->fragmentation) ==0 ) goto out;
@@ -271,13 +269,21 @@ int batadv_hardif_min_mtu(struct net_dev min_mtu =min_t (int, min_mtu,BATADV_FRAG_MAX_FRAG_SIZE ); min_mtu -=sizeof (struct batadv_frag_packet ); min_mtu *=BATADV_FRAG_MAX_FRAGMENTS ; -atomic_set (&bat_priv->packet_size_max, min_mtu); - -/* with fragmentation enabled we can fragment external packets easily */ - min_mtu =min_t (int, min_mtu,ETH_DATA_LEN ); out: -return min_mtu -batadv_max_header_len (); +/* report to the other components the maximum amount of bytes that +* batman-adv can send over the wire (without considering the payload +* overhead). For example, this value is used by TT to compute the +* maximum local table table size +*/ +atomic_set (&bat_priv->packet_size_max, min_mtu); + +/* the real soft-interface MTU is computed by removing the payload +* overhead from the maximum amount of bytes that was just computed. +* +* However batman-adv does not support MTUs bigger than ETH_DATA_LEN +*/ +return min_t (int, min_mtu -batadv_max_header_len (),ETH_DATA_LEN ); }/* adjusts the MTU if a new interface with a smaller MTU appeared. */
Greg Kroah-Hartman
maintainerPATCH 64/172 batman-adv: fix TT-TVLV parsing on OGM reception
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit e889241f45f9cecbc84a6ffed577083ab52e62ee ]
When accessing a TT-TVLV container in the OGM RX path the variable pointing to the list of changes to apply is altered by mistake.
This makes the TT component read data at the wrong position in the OGM packet buffer.
Fix it by removing the bogus pointer alteration.
--- net/batman-adv/translation-table.c | 1 - 1 file changed, 1 deletion(-)
net/batman-adv/translation-table.c +0 -1
@@ -3204,7 +3204,6 @@ static void batadv_tt_update_orig(structspin_lock_bh (&orig_node->tt_lock); - tt_change = (struct batadv_tvlv_tt_change *)tt_buff;batadv_tt_update_changes (bat_priv, orig_node, tt_num_changes, ttvn, tt_change);
Greg Kroah-Hartman
maintainerPATCH 65/172 batman-adv: release vlan object after checking the CRC
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit 91c2b1a9f680ff105369d49abc7e19ca7efb33e1 ]
There is a refcounter unbalance in the CRC checking routine invoked on OGM reception. A vlan object is retrieved (thus its refcounter is increased by one) but it is never properly released. This leads to a memleak because the vlan object will never be free'd.
Fix this by releasing the vlan object after having read the CRC.
--- net/batman-adv/translation-table.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/batman-adv/translation-table.c +5 -1
@@ -2248,6 +2248,7 @@ static bool batadv_tt_global_check_crc(s {struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;struct batadv_orig_node_vlan *vlan; +uint32_t crc;int i;/* check if each received CRC matches the locally stored one */
@@ -2267,7 +2268,10 @@ static bool batadv_tt_global_check_crc(sif (!vlan)return false; -if (vlan->tt.crc !=ntohl (tt_vlan_tmp->crc)) + crc = vlan->tt.crc; +batadv_orig_node_vlan_free_ref (vlan); + +if (crc !=ntohl (tt_vlan_tmp->crc))return false; }
Greg Kroah-Hartman
maintainerPATCH 66/172 batman-adv: properly check pskb_may_pull return value
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit f1791425cf0bcda43ab9a9a37df1ad3ccb1f6654 ]
pskb_may_pull() returns 1 on success and 0 in case of failure, therefore checking for the return value being negative does not make sense at all.
This way if the function fails we will probably read beyond the current skb data buffer. Fix this by doing the proper check.
--- net/batman-adv/routing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/routing.c +1 -1
@@ -833,7 +833,7 @@ static int batadv_check_unicast_ttvn(strint is_old_ttvn;/* check if there is enough data before accessing it */ -if (pskb_may_pull (skb, hdr_len +ETH_HLEN ) <0 ) +if (!pskb_may_pull (skb, hdr_len +ETH_HLEN ))return 0 ;/* create a copy of the skb (in case of for re-routing) to modify it. */
Greg Kroah-Hartman
maintainerPATCH 67/172 batman-adv: avoid potential race condition when adding a new neighbour
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit 08bf0ed29c7ded45c477d08618220dd200c3524a ]
When adding a new neighbour it is important to atomically perform the following:
- check if the neighbour already exists
- append the neighbour to the proper list
If the two operations are not performed in an atomic context it is possible that two concurrent insertions add the same neighbour twice.
--- net/batman-adv/bat_iv_ogm.c | 22 ++++++++++++++++------ net/batman-adv/originator.c | 36 ++++++++++++++++++++++++++++++++++++ net/batman-adv/originator.h | 4 ++++ 3 files changed, 56 insertions(+), 6 deletions(-)
net/batman-adv/bat_iv_ogm.c +16 -6
@@ -268,7 +268,7 @@ batadv_iv_ogm_neigh_new(struct batadv_ha struct batadv_orig_node *orig_neigh) {struct batadv_priv *bat_priv =netdev_priv (hard_iface->soft_iface); -struct batadv_neigh_node *neigh_node; +struct batadv_neigh_node *neigh_node, *tmp_neigh_node; neigh_node =batadv_neigh_node_new (hard_iface, neigh_addr, orig_node);if (!neigh_node)
@@ -276,14 +276,24 @@ batadv_iv_ogm_neigh_new(struct batadv_haspin_lock_init (&neigh_node->bat_iv.lq_update_lock); -batadv_dbg (BATADV_DBG_BATMAN , bat_priv, -"Creating new neighbor %pM for orig_node %pM on interface %s\n" , - neigh_addr, orig_node->orig, hard_iface->net_dev->name); -spin_lock_bh (&orig_node->neigh_list_lock); -hlist_add_head_rcu (&neigh_node->list, &orig_node->neigh_list); + tmp_neigh_node =batadv_neigh_node_get (orig_node, hard_iface, + neigh_addr); +if (!tmp_neigh_node) { +hlist_add_head_rcu (&neigh_node->list, &orig_node->neigh_list); + }else { +kfree (neigh_node); +batadv_hardif_free_ref (hard_iface); + neigh_node = tmp_neigh_node; + }spin_unlock_bh (&orig_node->neigh_list_lock); +if (!tmp_neigh_node) +batadv_dbg (BATADV_DBG_BATMAN , bat_priv, +"Creating new neighbor %pM for orig_node %pM on interface %s\n" , + neigh_addr, orig_node->orig, + hard_iface->net_dev->name); + out:return neigh_node; }
net/batman-adv/originator.c +36 -0
@@ -511,6 +511,42 @@ void batadv_purge_orig_ref(struct batadv_batadv_purge_orig (bat_priv); } +/** +* batadv_neigh_node_get - retrieve a neighbour from the list +* @orig_node: originator which the neighbour belongs to +* @hard_iface: the interface where this neighbour is connected to +* @addr: the address of the neighbour +* +* Looks for and possibly returns a neighbour belonging to this originator list +* which is connected through the provided hard interface. +* Returns NULL if the neighbour is not found. +*/ +struct batadv_neigh_node * +batadv_neigh_node_get (const struct batadv_orig_node *orig_node, +const struct batadv_hard_iface *hard_iface, +const uint8_t *addr) +{ +struct batadv_neigh_node *tmp_neigh_node, *res =NULL ; + +rcu_read_lock (); +hlist_for_each_entry_rcu (tmp_neigh_node, &orig_node->neigh_list, list) { +if (!batadv_compare_eth (tmp_neigh_node->addr, addr)) +continue ; + +if (tmp_neigh_node->if_incoming != hard_iface) +continue ; + +if (!atomic_inc_not_zero (&tmp_neigh_node->refcount)) +continue ; + + res = tmp_neigh_node; +break ; + } +rcu_read_unlock (); + +return res; +} +int batadv_orig_seq_print_text (struct seq_file *seq,void *offset) {struct net_device *net_dev = (struct net_device *)seq->private;
net/batman-adv/originator.h +4 -0
@@ -31,6 +31,10 @@ void batadv_orig_node_free_ref_now(strucstruct batadv_orig_node *batadv_orig_node_new (struct batadv_priv *bat_priv,const uint8_t *addr);struct batadv_neigh_node * +batadv_neigh_node_get (const struct batadv_orig_node *orig_node, +const struct batadv_hard_iface *hard_iface, +const uint8_t *addr); +struct batadv_neigh_node *batadv_neigh_node_new (struct batadv_hard_iface *hard_iface,const uint8_t *neigh_addr,struct batadv_orig_node *orig_node);
Greg Kroah-Hartman
maintainerPATCH 68/172 batman-adv: fix potential orig_node reference leak
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Wunderlich <[email protected]>
[ Upstream commit b2262df7fcf2c395eca564df83238e931d88d7bf ]
Since batadv_orig_node_new() sets the refcount to two, assuming that the calling function will use a reference for putting the orig_node into a hash or similar, both references must be freed if initialization of the orig_node fails. Otherwise that object may be leaked in that error case.
--- net/batman-adv/bat_iv_ogm.c | 2 ++ 1 file changed, 2 insertions(+)
net/batman-adv/bat_iv_ogm.c +2 -0
@@ -256,6 +256,8 @@ batadv_iv_ogm_orig_get(struct batadv_pri free_bcast_own:kfree (orig_node->bat_iv.bcast_own); free_orig_node: +/* free twice, as batadv_orig_node_new sets refcount to 2 */ +batadv_orig_node_free_ref (orig_node);batadv_orig_node_free_ref (orig_node);return NULL ;
Greg Kroah-Hartman
maintainerPATCH 69/172 batman-adv: fix TT CRC computation by ensuring byte order
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit a30e22ca8464c2dc573e0144a972221c2f06c2cd ]
When computing the CRC on a 2byte variable the order of the bytes obviously alters the final result. This means that computing the CRC over the same value on two archs having different endianess leads to different numbers.
The global and local translation table CRC computation routine makes this mistake while processing the clients VIDs. The result is a continuous CRC mismatching between nodes having different endianess.
Fix this by converting the VID to Network Order before processing it. This guarantees that every node uses the same byte order.
Introduced by 7ea7b4a142758deaf46c1af0ca9ceca6dd55138b ("batman-adv: make the TT CRC logic VLAN specific")
--- net/batman-adv/translation-table.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
net/batman-adv/translation-table.c +12 -4
@@ -1961,6 +1961,7 @@ static uint32_t batadv_tt_global_crc(strstruct hlist_head *head;uint32_t i, crc_tmp, crc =0 ;uint8_t flags; +__be16 tmp_vid;for (i =0 ; i < hash->size; i++) { head = &hash->table[i];
@@ -1997,8 +1998,11 @@ static uint32_t batadv_tt_global_crc(str orig_node))continue ; - crc_tmp =crc32c (0 , &tt_common->vid, -sizeof (tt_common->vid)); +/* use network order to read the VID: this ensures that +* every node reads the bytes in the same order. +*/ + tmp_vid =htons (tt_common->vid); + crc_tmp =crc32c (0 , &tmp_vid,sizeof (tmp_vid));/* compute the CRC on flags that have to be kept in sync * among nodes
@@ -2032,6 +2036,7 @@ static uint32_t batadv_tt_local_crc(strustruct hlist_head *head;uint32_t i, crc_tmp, crc =0 ;uint8_t flags; +__be16 tmp_vid;for (i =0 ; i < hash->size; i++) { head = &hash->table[i];
@@ -2050,8 +2055,11 @@ static uint32_t batadv_tt_local_crc(struif (tt_common->flags &BATADV_TT_CLIENT_NEW )continue ; - crc_tmp =crc32c (0 , &tt_common->vid, -sizeof (tt_common->vid)); +/* use network order to read the VID: this ensures that +* every node reads the bytes in the same order. +*/ + tmp_vid =htons (tt_common->vid); + crc_tmp =crc32c (0 , &tmp_vid,sizeof (tmp_vid));/* compute the CRC on flags that have to be kept in sync * among nodes
Greg Kroah-Hartman
maintainerPATCH 70/172 batman-adv: free skb on TVLV parsing success
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit 05c3c8a636aa9ee35ce13f65afc5b665615cc786 ]
When the TVLV parsing routine succeed the skb is left untouched thus leading to a memory leak.
Fix this by consuming the skb in case of success.
Introduced by ef26157747d42254453f6b3ac2bd8bd3c53339c3 ("batman-adv: tvlv - basic infrastructure")
--- net/batman-adv/routing.c | 2 ++ 1 file changed, 2 insertions(+)
net/batman-adv/routing.c +2 -0
@@ -1063,6 +1063,8 @@ int batadv_recv_unicast_tvlv(struct sk_bif (ret !=NET_RX_SUCCESS ) ret =batadv_route_unicast_packet (skb, recv_if); +else +consume_skb (skb);return ret; }
Greg Kroah-Hartman
maintainerPATCH 71/172 batman-adv: avoid double free when orig_node initialization fails
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
[ Upstream commit a5a5cb8cab526af2f6cbe9715f8ca843192f0d81 ]
In the failure path of the orig_node initialization routine the orig_node->bat_iv.bcast_own field is free'd twice: first in batadv_iv_ogm_orig_get() and then later in batadv_orig_node_free_rcu().
Fix it by removing the kfree in batadv_iv_ogm_orig_get().
--- net/batman-adv/bat_iv_ogm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/batman-adv/bat_iv_ogm.c +2 -4
@@ -243,18 +243,16 @@ batadv_iv_ogm_orig_get(struct batadv_pri size = bat_priv->num_ifaces *sizeof (uint8_t ); orig_node->bat_iv.bcast_own_sum =kzalloc (size,GFP_ATOMIC );if (!orig_node->bat_iv.bcast_own_sum) - goto free_bcast_own; + goto free_orig_node; hash_added =batadv_hash_add (bat_priv->orig_hash, batadv_compare_orig, batadv_choose_orig, orig_node, &orig_node->hash_entry);if (hash_added !=0 ) - goto free_bcast_own; + goto free_orig_node;return orig_node; -free_bcast_own: -kfree (orig_node->bat_iv.bcast_own); free_orig_node:/* free twice, as batadv_orig_node_new sets refcount to 2 */ batadv_orig_node_free_ref (orig_node);
Greg Kroah-Hartman
maintainerPATCH 73/172 ALSA: usb-audio: work around KEF X300A firmware bug
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clemens Ladisch <[email protected]>
commit 624aef494f86ed0c58056361c06347ad62b26806 upstream.
When the driver tries to access Function Unit 10, the KEF X300A speakers' firmware apparently locks up, making even PCM streaming impossible. Work around this by ignoring this FU.
--- sound/usb/mixer_maps.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/usb/mixer_maps.c +9 -0
@@ -322,6 +322,11 @@ static struct usbmix_name_map hercules_u { 0 } /* terminator */ }; +static const struct usbmix_name_map kef_x300a_map[] = { + {10 ,NULL },/* firmware locks up (?) when we try to access this FU */ + {0 } +}; +/* * Control map entries */
@@ -409,6 +414,10 @@ static struct usbmix_ctl_map usbmix_ctl_ .id = USB_ID(0x200c, 0x1018), .map = ebox44_map, }, + { + .id = USB_ID(0x27ac, 0x1000), + .map = kef_x300a_map, + }, { 0 } /* terminator */ };
Greg Kroah-Hartman
maintainerPATCH 74/172 ALSA: hda - add headset mic detect quirks for two Dell laptops
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Wang <[email protected]>
commit 4913e0bf239dafee356bc7fab61806cc2518930c upstream.
When we plug a 3-ring headset on the Dell machines (Vendor ID:0x10ec0255, Subsystem ID: 0x10280657; Vendor ID: 0x10ec0255, Subsystem ID: 0x1028065f), the headset mic can't be detected, after apply this patch, the headset mic can work well.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -4295,7 +4295,9 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x0651 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0652 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0653 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x0657 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0658 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x065f ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0662 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x15cc ,"Dell X5 Precision" ,ALC269_FIXUP_DELL2_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 75/172 ALSA: hda/ca0132 - setup/cleanup streams
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsin-Yu Chao <[email protected]>
commit 28fba95087a7f3d107a3a6728aef7dbfaf3fd782 upstream.
When a HDMI stream is opened with the same stream tag as a following opened stream to ca0132, audio will be heard from two ports simultaneously.
Fix this issue by change to use snd_hda_codec_setup_stream and snd_hda_codec_cleanup_stream instead, so that an inactive stream can be marked as 'dirty' when found with a conflict stream tag, and then get purified.
--- sound/pci/hda/patch_ca0132.c | 66 ++++--------------------------------------- 1 file changed, 7 insertions(+), 59 deletions(-)
sound/pci/hda/patch_ca0132.c +7 -59
@@ -2662,60 +2662,6 @@ static bool dspload_wait_loaded(struct h }/* -* PCM stuffs -*/ -static void ca0132_setup_stream (struct hda_codec *codec,hda_nid_t nid, -u32 stream_tag, -int channel_id,int format) -{ -unsigned int oldval, newval; - -if (!nid) -return ; - -snd_printdd ( -"ca0132_setup_stream: NID=0x%x, stream=0x%x, " -"channel=%d, format=0x%x\n" , - nid, stream_tag, channel_id, format); - -/* update the format-id if changed */ - oldval =snd_hda_codec_read (codec, nid,0 , -AC_VERB_GET_STREAM_FORMAT , -0 ); -if (oldval != format) { -msleep (20 ); -snd_hda_codec_write (codec, nid,0 , -AC_VERB_SET_STREAM_FORMAT , - format); - } - - oldval =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_CONV ,0 ); - newval = (stream_tag <<4 ) | channel_id; -if (oldval != newval) { -snd_hda_codec_write (codec, nid,0 , -AC_VERB_SET_CHANNEL_STREAMID , - newval); - } -} - -static void ca0132_cleanup_stream (struct hda_codec *codec,hda_nid_t nid) -{ -unsigned int val; - -if (!nid) -return ; - -snd_printdd (KERN_INFO "ca0132_cleanup_stream: NID=0x%x\n" , nid); - - val =snd_hda_codec_read (codec, nid,0 ,AC_VERB_GET_CONV ,0 ); -if (!val) -return ; - -snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_STREAM_FORMAT ,0 ); -snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_CHANNEL_STREAMID ,0 ); -} - -/* * PCM callbacks */ static int ca0132_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
@@ -2726,7 +2672,7 @@ static int ca0132_playback_pcm_prepare(s {struct ca0132_spec *spec = codec->spec; -ca0132_setup_stream (codec, spec->dacs[0 ], stream_tag,0 , format); +snd_hda_codec_setup_stream (codec, spec->dacs[0 ], stream_tag,0 , format);return 0 ; }
@@ -2745,7 +2691,7 @@ static int ca0132_playback_pcm_cleanup(sif (spec->effects_switch[PLAY_ENHANCEMENT -EFFECT_START_NID ])msleep (50 ); -ca0132_cleanup_stream (codec, spec->dacs[0 ]); +snd_hda_codec_cleanup_stream (codec, spec->dacs[0 ]);return 0 ; }
@@ -2824,8 +2770,8 @@ static int ca0132_capture_pcm_prepare(st {struct ca0132_spec *spec = codec->spec; -ca0132_setup_stream (codec, spec->adcs[substream->number], - stream_tag,0 , format); +snd_hda_codec_setup_stream (codec, spec->adcs[substream->number], + stream_tag,0 , format);return 0 ; }
@@ -2839,7 +2785,7 @@ static int ca0132_capture_pcm_cleanup(stif (spec->dsp_state ==DSP_DOWNLOADING )return 0 ; -ca0132_cleanup_stream (codec, hinfo->nid); +snd_hda_codec_cleanup_stream (codec, hinfo->nid);return 0 ; }
@@ -4742,6 +4688,8 @@ static int patch_ca0132(struct hda_codecreturn err; codec->patch_ops = ca0132_patch_ops; + codec->pcm_format_first =1 ; + codec->no_sticky_stream =1 ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 76/172 ALSA: hda/ca0132 - Fix recording from mode id 0x8
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsin-Yu Chao <[email protected]>
commit 13c12dbe3a2ce17227f7ddef652b6a53c78fa51f upstream.
Incorrect ADC is picked in ca0132_capture_pcm_prepare(), where it assumes multiple streams while there is one stream per ADC. Note that ca0132_capture_pcm_cleanup() already does the right thing.
The Chromebook Pixel has a microphone under the keyboard that is attached to node id 0x8. Before this fix, recording would always go to the main internal mic (node id 0x7).
--- sound/pci/hda/patch_ca0132.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/pci/hda/patch_ca0132.c +1 -3
@@ -2768,9 +2768,7 @@ static int ca0132_capture_pcm_prepare(stunsigned int format, struct snd_pcm_substream *substream) { - struct ca0132_spec *spec = codec->spec; - -snd_hda_codec_setup_stream (codec, spec->adcs[substream->number], + snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 77/172 ALSA: hda - Enable front audio jacks on one HP desktop model
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Wang <[email protected]>
commit 1de7ca5e844866f56bebb2fc47fa18e090677e88 upstream.
The front headphone and mic jackes on a HP desktop model (Vendor Id:0x111d76c7 Subsystem Id: 0x103c2b17) can not work, the codec on this machine has 8 physical ports, 6 of them are routed to rear jackes and all of them work very well, while the remaining 2 ports are routed to front headphone and mic jackes, but the corresponding pin complex node are not defined correctly.
After apply this fix, the front audio jackes can work very well.
[trivial fix of enum definition by tiwai]
--- sound/pci/hda/patch_sigmatel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/pci/hda/patch_sigmatel.c +13 -0
@@ -83,6 +83,7 @@ enum {STAC_DELL_M6_BOTH ,STAC_DELL_EQ ,STAC_ALIENWARE_M17X , +STAC_92HD89XX_HP_FRONT_JACK , STAC_92HD73XX_MODELS };
@@ -1777,6 +1778,12 @@ static const struct hda_pintbl intel_dg4 {} }; +static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = { + {0x0a ,0x02214030 }, + {0x0b ,0x02A19010 }, + {} +}; +static void stac92hd73xx_fixup_ref (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -1895,6 +1902,10 @@ static const struct hda_fixup stac92hd73 [STAC_92HD73XX_NO_JD ] = { .type =HDA_FIXUP_FUNC , .v.func = stac92hd73xx_fixup_no_jd, + }, + [STAC_92HD89XX_HP_FRONT_JACK ] = { + .type =HDA_FIXUP_PINS , + .v.pins = stac92hd89xx_hp_front_jack_pin_configs, } };
@@ -1955,6 +1966,8 @@ static const struct snd_pci_quirk stac92 "Alienware M17x", STAC_ALIENWARE_M17X), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, "Alienware M17x R3", STAC_DELL_EQ), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, + "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), {}/* terminator */ };
Greg Kroah-Hartman
maintainerPATCH 78/172 cgroup: fix error return value in cgroup_mount()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit eb46bf89696972b856a9adb6aebd5c7b65c266e4 upstream.
When cgroup_mount() fails to allocate an id for the root, it didn't set ret before jumping to unlock_drop ending up returning 0 after a failure. Fix it.
--- kernel/cgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/cgroup.c +3 -3
@@ -1580,10 +1580,10 @@ static struct dentry *cgroup_mount(strucmutex_lock (&cgroup_mutex);mutex_lock (&cgroup_root_mutex); - root_cgrp->id =idr_alloc (&root->cgroup_idr, root_cgrp, -0 ,1 ,GFP_KERNEL ); -if (root_cgrp->id <0 ) + ret =idr_alloc (&root->cgroup_idr, root_cgrp,0 ,1 ,GFP_KERNEL ); +if (ret <0 ) goto unlock_drop; + root_cgrp->id = ret;/* Check for name clashes with existing mounts */ ret = -EBUSY ;
Greg Kroah-Hartman
maintainerPATCH 79/172 cgroup: fix error return from cgroup_create()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit b58c89986a77a23658682a100eb15d8edb571ebb upstream.
cgroup_create() was returning 0 after allocation failures. Fix it.
--- kernel/cgroup.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/cgroup.c +7 -3
@@ -4348,7 +4348,7 @@ static long cgroup_create(struct cgroupstruct cgroup *cgrp;struct cgroup_name *name;struct cgroupfs_root *root = parent->root; -int err =0 ; +int err;struct cgroup_subsys *ss;struct super_block *sb = root->sb;
@@ -4358,8 +4358,10 @@ static long cgroup_create(struct cgroupreturn -ENOMEM ; name =cgroup_alloc_name (dentry); -if (!name) +if (!name) { + err = -ENOMEM ; goto err_free_cgrp; + }rcu_assign_pointer (cgrp->name, name);/*
@@ -4367,8 +4369,10 @@ static long cgroup_create(struct cgroup* a half-baked cgroup. */ cgrp->id =idr_alloc (&root->cgroup_idr,NULL ,1 ,0 ,GFP_KERNEL ); -if (cgrp->id <0 ) +if (cgrp->id <0 ) { + err = -ENOMEM ; goto err_free_name; + }/* * Only live parents can have children. Note that the liveliness
Greg Kroah-Hartman
maintainerPATCH 80/172 cgroup: fix locking in cgroup_cfts_commit()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 48573a893303986e3b0b2974d6fb11f3d1bb7064 upstream.
cgroup_cfts_commit() walks the cgroup hierarchy that the target subsystem is attached to and tries to apply the file changes. Due to the convolution with inode locking, it can't keep cgroup_mutex locked while iterating. It currently holds only RCU read lock around the actual iteration and then pins the found cgroup using dget().
Unfortunately, this is incorrect. Although the iteration does check cgroup_is_dead() before invoking dget(), there's nothing which prevents the dentry from going away inbetween. Note that this is different from the usual css iterations where css_tryget() is used to pin the css - css_tryget() tests whether the css can be pinned and fails if not.
The problem can be solved by simply holding cgroup_mutex instead of RCU read lock around the iteration, which actually reduces LOC.
--- kernel/cgroup.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
kernel/cgroup.c +2 -9
@@ -2845,10 +2845,7 @@ static int cgroup_cfts_commit(struct cft*/ update_before = cgroup_serial_nr_next; -mutex_unlock (&cgroup_mutex); -/* add/rm files for all cgroups created before */ -rcu_read_lock ();css_for_each_descendant_pre (css,cgroup_css (root, ss)) {struct cgroup *cgrp = css->cgroup;
@@ -2857,23 +2854,19 @@ static int cgroup_cfts_commit(struct cft inode = cgrp->dentry->d_inode;dget (cgrp->dentry); -rcu_read_unlock (); -dput (prev); prev = cgrp->dentry; +mutex_unlock (&cgroup_mutex);mutex_lock (&inode->i_mutex);mutex_lock (&cgroup_mutex);if (cgrp->serial_nr < update_before && !cgroup_is_dead (cgrp)) ret =cgroup_addrm_files (cgrp, cfts, is_add); -mutex_unlock (&cgroup_mutex);mutex_unlock (&inode->i_mutex); - -rcu_read_lock ();if (ret)break ; } -rcu_read_unlock (); +mutex_unlock (&cgroup_mutex);dput (prev);deactivate_super (sb);return ret;
Greg Kroah-Hartman
maintainerPATCH 81/172 cgroup: update cgroup_enable_task_cg_lists() to grab siglock
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 532de3fc72adc2a6525c4d53c07bf81e1732083d upstream.
Currently, there's nothing preventing cgroup_enable_task_cg_lists() from missing set PF_EXITING and race against cgroup_exit(). Depending on the timing, cgroup_exit() may finish with the task still linked on css_set leading to list corruption. Fix it by grabbing siglock in cgroup_enable_task_cg_lists() so that PF_EXITING is guaranteed to be visible.
This whole on-demand cg_list optimization is extremely fragile and has ample possibility to lead to bugs which can cause things like once-a-year oops during boot. I'm wondering whether the better approach would be just adding "cgroup_disable=all" handling which disables the whole cgroup rather than tempting fate with this on-demand craziness.
--- kernel/cgroup.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/cgroup.c +5 -0
@@ -2985,9 +2985,14 @@ static void cgroup_enable_task_cg_lists(* We should check if the process is exiting, otherwise * it will race with cgroup_exit() in that the list * entry won't be deleted though the process has exited. +* Do it while holding siglock so that we don't end up +* racing against cgroup_exit(). */ +spin_lock_irq (&p->sighand->siglock);if (!(p->flags &PF_EXITING ) &&list_empty (&p->cg_list))list_add (&p->cg_list, &task_css_set (p)->tasks); +spin_unlock_irq (&p->sighand->siglock); +task_unlock (p); }while_each_thread (g, p);read_unlock (&tasklist_lock);
Greg Kroah-Hartman
maintainerPATCH 82/172 fs: fix iversion handling
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit dff6efc326a4d5f305797d4a6bba14f374fdd633 upstream.
Currently notify_change directly updates i_version for size updates, which not only is counter to how all other fields are updated through struct iattr, but also breaks XFS, which need inode updates to happen under its own lock, and synchronized to the structure that gets written to the log.
Remove the update in the common code, and it to btrfs and ext4, XFS already does a proper updaste internally and currently gets a double update with the existing code.
IMHO this is 3.13 and -stable material and should go in through the XFS tree.
--- fs/attr.c | 5 ----- fs/btrfs/inode.c | 8 ++++++-- fs/ext4/inode.c | 4 ++++ 3 files changed, 10 insertions(+), 7 deletions(-)
fs/attr.c +0 -5
@@ -202,11 +202,6 @@ int notify_change(struct dentry * dentryreturn -EPERM ; } -if ((ia_valid &ATTR_SIZE ) &&IS_I_VERSION (inode)) { -if (attr->ia_size != inode->i_size) -inode_inc_iversion (inode); - } -if ((ia_valid &ATTR_MODE )) {umode_t amode = attr->ia_mode;/* Flag setting protected by i_mutex */
fs/btrfs/inode.c +6 -2
@@ -4354,8 +4354,12 @@ static int btrfs_setsize(struct inode *i* these flags set. For all other operations the VFS set these flags * explicitly if it wants a timestamp update. */ -if (newsize != oldsize && (!(mask & (ATTR_CTIME |ATTR_MTIME )))) - inode->i_ctime = inode->i_mtime =current_fs_time (inode->i_sb); +if (newsize != oldsize) { +inode_inc_iversion (inode); +if (!(mask & (ATTR_CTIME |ATTR_MTIME ))) + inode->i_ctime = inode->i_mtime = +current_fs_time (inode->i_sb); + }if (newsize > oldsize) {truncate_pagecache (inode, newsize);
fs/ext4/inode.c +4 -0
@@ -4586,6 +4586,10 @@ int ext4_setattr(struct dentry *dentry,if (attr->ia_size > sbi->s_bitmap_maxbytes)return -EFBIG ; } + +if (IS_I_VERSION (inode) && attr->ia_size != inode->i_size) +inode_inc_iversion (inode); +if (S_ISREG (inode->i_mode) && (attr->ia_size < inode->i_size)) {if (ext4_should_order_data (inode)) {
Greg Kroah-Hartman
maintainerPATCH 83/172 export: declare ksymtab symbols
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 7b4ec8dd7d4ac467e9eee4d49f2c9574d773efbb upstream.
sparse complains about any __ksymtab symbols with the following:
warning: symbol '__ksymtab_...' was not declared. Should it be static?
due to Andi's patch making it non-static.
Mollify sparse by declaring the symbol extern, otherwise we get drowned in sparse warnings for anything that uses EXPORT_SYMBOL in the sources, making it easy to miss real warnings.
--- include/linux/export.h | 1 + 1 file changed, 1 insertion(+)
include/linux/export.h +1 -0
@@ -59,6 +59,7 @@ extern struct module __this_module; static const char __kstrtab_##sym[] \ __attribute__((section("__ksymtab_strings"), aligned(1))) \ = VMLINUX_SYMBOL_STR(sym); \ + extern const struct kernel_symbol __ksymtab_##sym; \ __visible const struct kernel_symbol __ksymtab_##sym \ __used \ __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
Greg Kroah-Hartman
maintainerPATCH 84/172 kvm: x86: fix emulator buffer overflow (CVE-2014-0049)
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Honig <[email protected]>
commit a08d3b3b99efd509133946056531cdf8f3a0c09b upstream.
The problem occurs when the guest performs a pusha with the stack address pointing to an mmio address (or an invalid guest physical address) to start with, but then extending into an ordinary guest physical address. When doing repeated emulated pushes emulator_read_write sets mmio_needed to 1 on the first one. On a later push when the stack points to regular memory, mmio_nr_fragments is set to 0, but mmio_is_needed is not set to 0.
As a result, KVM exits to userspace, and then returns to complete_emulated_mmio. In complete_emulated_mmio vcpu->mmio_cur_fragment is incremented. The termination condition of vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments is never achieved. The code bounces back and fourth to userspace incrementing mmio_cur_fragment past it's buffer. If the guest does nothing else it eventually leads to a a crash on a memcpy from invalid memory address.
However if a guest code can cause the vm to be destroyed in another vcpu with excellent timing, then kvm_clear_async_pf_completion_queue can be used by the guest to control the data that's pointed to by the call to cancel_work_item, which can be used to gain execution.
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -6163,7 +6163,7 @@ static int complete_emulated_mmio(struct frag->len -= len; } -if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { +if (vcpu->mmio_cur_fragment >= vcpu->mmio_nr_fragments) { vcpu->mmio_needed =0 ;/* FIXME: return into emulator if single-stepping. */
Greg Kroah-Hartman
maintainerPATCH 85/172 kvm, vmx: Really fix lazy FPU on nested guest
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 1b385cbdd74aa803e966e01e5fe49490d6044e30 upstream.
Commit e504c9098ed6 (kvm, vmx: Fix lazy FPU on nested guest, 2013-11-13) highlighted a real problem, but the fix was subtly wrong.
nested_read_cr0 is the CR0 as read by L2, but here we want to look at the CR0 value reflecting L1's setup. In other words, L2 might think that TS=0 (so nested_read_cr0 has the bit clear); but if L1 is actually running it with TS=1, we should inject the fault into L1.
The effective value of CR0 in L2 is contained in vmcs12->guest_cr0, use it.
--- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx.c +1 -1
@@ -6644,7 +6644,7 @@ static bool nested_vmx_exit_handled(struelse if (is_page_fault (intr_info))return enable_ept;else if (is_no_device (intr_info) && - !(nested_read_cr0 (vmcs12) &X86_CR0_TS )) + !(vmcs12->guest_cr0 &X86_CR0_TS ))return 0 ;return vmcs12->exception_bitmap & (1u << (intr_info &INTR_INFO_VECTOR_MASK ));
Greg Kroah-Hartman
maintainerPATCH 86/172 ASoC: da9055: Fix device registration of PMIC and CODEC devices
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Thomson <[email protected]>
commit 07b0e5b10258b48e5edfb6c8ac156f05510eb775 upstream.
Currently the I2C device Ids conflict for the MFD and CODEC so cannot be both instantiated on one platform. This patch updates the Ids and names to make them unique from each other.
It should be noted that the I2C addresses for both PMIC and CODEC are modifiable so instantiation of the two are kept as separate devices, rather than instantiating the CODEC from the MFD code.
--- drivers/mfd/da9055-i2c.c | 12 ++++++++++-- sound/soc/codecs/da9055.c | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-)
drivers/mfd/da9055-i2c.c +10 -2
@@ -53,17 +53,25 @@ static int da9055_i2c_remove(struct i2c_return 0 ; } +/* +* DO NOT change the device Ids. The naming is intentionally specific as both +* the PMIC and CODEC parts of this chip are instantiated separately as I2C +* devices (both have configurable I2C addresses, and are to all intents and +* purposes separate). As a result there are specific DA9055 ids for PMIC +* and CODEC, which must be different to operate together. +*/ static struct i2c_device_id da9055_i2c_id[] = { - {"da9055" ,0 }, + {"da9055-pmic" ,0 }, { } }; +MODULE_DEVICE_TABLE (i2c, da9055_i2c_id);static struct i2c_driver da9055_i2c_driver = { .probe = da9055_i2c_probe, .remove = da9055_i2c_remove, .id_table = da9055_i2c_id, .driver = { - .name ="da9055" , + .name ="da9055-pmic" , .owner =THIS_MODULE , }, };
sound/soc/codecs/da9055.c +9 -2
@@ -1523,8 +1523,15 @@ static int da9055_remove(struct i2c_cliereturn 0 ; } +/* +* DO NOT change the device Ids. The naming is intentionally specific as both +* the CODEC and PMIC parts of this chip are instantiated separately as I2C +* devices (both have configurable I2C addresses, and are to all intents and +* purposes separate). As a result there are specific DA9055 Ids for CODEC +* and PMIC, which must be different to operate together. +*/ static const struct i2c_device_id da9055_i2c_id[] = { - {"da9055" ,0 }, + {"da9055-codec" ,0 }, { } };MODULE_DEVICE_TABLE (i2c, da9055_i2c_id);
@@ -1532,7 +1539,7 @@ MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);/* I2C codec control layer */ static struct i2c_driver da9055_i2c_driver = { .driver = { - .name ="da9055" , + .name ="da9055-codec" , .owner =THIS_MODULE , }, .probe = da9055_i2c_probe,
Greg Kroah-Hartman
maintainerPATCH 87/172 ASoC: rt5640: Add ACPI ID for Intel Baytrail
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Nikula <[email protected]>
commit b31b2b6d5de71c569413d8dc4f7b050cbe25a09e upstream.
Realtek RT5640 uses ACPI ID "10EC5640" for Intel Baytrail platforms.
--- sound/soc/codecs/rt5640.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt5640.c +1 -0
@@ -2093,6 +2093,7 @@ MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);#ifdef CONFIG_ACPI static struct acpi_device_id rt5640_acpi_match[] = { {"INT33CA" ,0 }, + {"10EC5640" ,0 }, { }, };MODULE_DEVICE_TABLE (acpi, rt5640_acpi_match);
Greg Kroah-Hartman
maintainerPATCH 88/172 ASoC: txx9aclc_ac97: Fix kernel crash on probe
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shiyan <[email protected]>
commit 9febd494d15c4a351e9c9cae7184643144eea892 upstream.
This patch fixes a crash caused by commit 3bed3344c826 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated.
--- sound/soc/txx9/txx9aclc-ac97.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/txx9/txx9aclc-ac97.c +5 -3
@@ -183,14 +183,16 @@ static int txx9aclc_ac97_dev_probe(struc irq =platform_get_irq (pdev,0 );if (irq <0 )return irq; + + drvdata =devm_kzalloc (&pdev->dev,sizeof (*drvdata),GFP_KERNEL ); +if (!drvdata) +return -ENOMEM ; + r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); drvdata->base =devm_ioremap_resource (&pdev->dev, r);if (IS_ERR (drvdata->base))return PTR_ERR (drvdata->base); - drvdata =devm_kzalloc (&pdev->dev,sizeof (*drvdata),GFP_KERNEL ); -if (!drvdata) -return -ENOMEM ;platform_set_drvdata (pdev, drvdata); drvdata->physbase = r->start; if (sizeof(drvdata->physbase) > sizeof(r->start) &&
Greg Kroah-Hartman
maintainerPATCH 89/172 ASoC: fsl: fix pm support of machine drivers
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Guo <[email protected]>
commit 47cf84e17ebb79a20e6244b954c4ea4e18a82d43 upstream.
The commit 1abe729 (ASoC: fsl: Add missing pm to current machine drivers) enables pm support for a few IMX machine drivers. But it does not update dev drvdata to be the pointer to 'card'. This causes the kernel dump below in system suspend, because snd_soc_suspend() expects that the dev drvdata points to 'card', while it still points to the private data of machine driver.
This patch fixes imx-sgtl5000 and imx-wm8962 by attaching 'card' to dev drvdata and private data to card drvdata. For imx-mc13783, I simply revert the pm change because it must be broken for the same reason and I don't have hardware to test pm enabling code.
$ echo mem > /sys/power/state PM: Syncing filesystems ... done. PM: Preparing system for mem sleep mmc1: card e624 removed Freezing user space processes ... (elapsed 0.002 seconds) done. Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done. PM: Entering mem sleep INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 1861 Comm: bash Not tainted 3.14.0-rc1+ #1648 Backtrace: [<80012144>] (dump_backtrace) from [<800122e4>] (show_stack+0x18/0x1c) r6:8079c77c r5:00000c5a r4:00000000 r3:00000000 [<800122cc>] (show_stack) from [<80637ac0>] (dump_stack+0x78/0x94) [<80637a48>] (dump_stack) from [<80028918>] (warn_slowpath_common+0x6c/0x8c) r4:bdb21c38 r3:be62df00 [<800288ac>] (warn_slowpath_common) from [<800289dc>] (warn_slowpath_fmt+0x38/0x40) r8:be62e3a8 r7:bf122960 r6:00000005 r5:00000000 r4:00000000 [<800289a8>] (warn_slowpath_fmt) from [<8006518c>] (__lock_acquire+0x1ae0/0x1ce0) r3:8079d598 r2:80799e70 [<800636ac>] (__lock_acquire) from [<80065894>] (lock_acquire+0x68/0x7c) r10:bdb20000 r9:be62df00 r8:00000000 r7:00000000 r6:60000013 r5:bdb20000 r4:00000000 [<8006582c>] (lock_acquire) from [<8063c938>] (mutex_lock_nested+0x5c/0x3b8) r7:00000000 r6:80dfc78c r5:804be444 r4:bf122928 [<8063c8dc>] (mutex_lock_nested) from [<804be444>] (snd_soc_suspend+0x34/0x42c) r10:00000000 r9:00000000 r8:00000000 r7:bf1c4444 r6:bf1c4410 r5:be978150 r4:be978010 [<804be410>] (snd_soc_suspend) from [<8034392c>] (platform_pm_suspend+0x34/0x64) r10:00000000 r8:00000000 r7:bf1c4444 r6:bf1c4410 r5:803438f8 r4:bf1c4410 [<803438f8>] (platform_pm_suspend) from [<80348e18>] (dpm_run_callback.isra.7+0x34/0x6c) [<80348de4>] (dpm_run_callback.isra.7) from [<80349354>] (__device_suspend+0x10c/0x220) r9:808dd974 r8:808c4a5c r6:00000002 r5:80e5001c r4:bf1c4410 [<80349248>] (__device_suspend) from [<8034a338>] (dpm_suspend+0x60/0x220) r7:bf1c4410 r6:808dd90c r5:80e5001c r4:bf1c44c0 [<8034a2d8>] (dpm_suspend) from [<8034a790>] (dpm_suspend_start+0x60/0x68) r10:8079a818 r9:00000000 r8:00000004 r7:80dfbe90 r6:80641eec r5:00000000 r4:00000002 [<8034a730>] (dpm_suspend_start) from [<8006a788>] (suspend_devices_and_enter+0x74/0x318) r4:00000003 r3:80dfbe98 [<8006a714>] (suspend_devices_and_enter) from [<8006abd8>] (pm_suspend+0x1ac/0x244) r10:8079a818 r8:00000004 r7:00000003 r6:80641eec r5:00000000 r4:00000003 [<8006aa2c>] (pm_suspend) from [<80069a4c>] (state_store+0x70/0xc0) r5:00000003 r4:bd85ea40 [<800699dc>] (state_store) from [<80294034>] (kobj_attr_store+0x1c/0x28) r10:beb9fe08 r8:00000000 r7:bdb21f78 r6:bd85ea40 r5:00000004 r4:beb9fe00 [<80294018>] (kobj_attr_store) from [<80140f90>] (sysfs_kf_write+0x54/0x58) [<80140f3c>] (sysfs_kf_write) from [<8014474c>] (kernfs_fop_write+0xc4/0x160) r6:bd85ea40 r5:beb9fe00 r4:00000004 r3:80140f3c [<80144688>] (kernfs_fop_write) from [<800dfa14>] (vfs_write+0xbc/0x184) r10:00000000 r9:00000000 r8:00000000 r7:bdb21f78 r6:00500c08 r5:00000004 r4:be782600 [<800df958>] (vfs_write) from [<800dfe00>] (SyS_write+0x48/0x70) r10:00000000 r8:00000000 r7:00000004 r6:00500c08 r5:00000000 r4:be782600 [<800dfdb8>] (SyS_write) from [<8000e800>] (ret_fast_syscall+0x0/0x48) r9:bdb20000 r8:8000e9c4 r7:00000004 r6:00500c08 r5:00000004 r4:76eb65e0
--- sound/soc/fsl/imx-mc13783.c | 1 - sound/soc/fsl/imx-sgtl5000.c | 10 ++++++---- sound/soc/fsl/imx-wm8962.c | 11 +++++++---- 3 files changed, 13 insertions(+), 9 deletions(-)
sound/soc/fsl/imx-mc13783.c +0 -1
@@ -160,7 +160,6 @@ static struct platform_driver imx_mc1378 .driver = { .name = "imx_mc13783", .owner = THIS_MODULE, - .pm = &snd_soc_pm_ops, }, .probe = imx_mc13783_probe, .remove = imx_mc13783_remove
sound/soc/fsl/imx-sgtl5000.c +6 -4
@@ -33,8 +33,7 @@ struct imx_sgtl5000_data {static int imx_sgtl5000_dai_init (struct snd_soc_pcm_runtime *rtd) { -struct imx_sgtl5000_data *data =container_of (rtd->card, - struct imx_sgtl5000_data, card); +struct imx_sgtl5000_data *data =snd_soc_card_get_drvdata (rtd->card);struct device *dev = rtd->card->dev;int ret;
@@ -159,13 +158,15 @@ static int imx_sgtl5000_probe(struct pla data->card.dapm_widgets = imx_sgtl5000_dapm_widgets; data->card.num_dapm_widgets =ARRAY_SIZE (imx_sgtl5000_dapm_widgets); +platform_set_drvdata (pdev, &data->card); +snd_soc_card_set_drvdata (&data->card, data); + ret =devm_snd_soc_register_card (&pdev->dev, &data->card);if (ret) {dev_err (&pdev->dev,"snd_soc_register_card failed (%d)\n" , ret); goto fail; } -platform_set_drvdata (pdev, data);of_node_put (ssi_np);of_node_put (codec_np);
@@ -184,7 +185,8 @@ fail:static int imx_sgtl5000_remove (struct platform_device *pdev) { -struct imx_sgtl5000_data *data =platform_get_drvdata (pdev); +struct snd_soc_card *card =platform_get_drvdata (pdev); +struct imx_sgtl5000_data *data =snd_soc_card_get_drvdata (card);clk_put (data->codec_clk);
sound/soc/fsl/imx-wm8962.c +7 -4
@@ -71,7 +71,7 @@ static int imx_wm8962_set_bias_level(str {struct snd_soc_dai *codec_dai = card->rtd[0 ].codec_dai;struct imx_priv *priv = &card_priv; -struct imx_wm8962_data *data =platform_get_drvdata (priv->pdev); +struct imx_wm8962_data *data =snd_soc_card_get_drvdata (card);struct device *dev = &priv->pdev->dev;unsigned int pll_out;int ret;
@@ -137,7 +137,7 @@ static int imx_wm8962_late_probe(struct {struct snd_soc_dai *codec_dai = card->rtd[0 ].codec_dai;struct imx_priv *priv = &card_priv; -struct imx_wm8962_data *data =platform_get_drvdata (priv->pdev); +struct imx_wm8962_data *data =snd_soc_card_get_drvdata (card);struct device *dev = &priv->pdev->dev;int ret;
@@ -264,13 +264,15 @@ static int imx_wm8962_probe(struct platf data->card.late_probe = imx_wm8962_late_probe; data->card.set_bias_level = imx_wm8962_set_bias_level; +platform_set_drvdata (pdev, &data->card); +snd_soc_card_set_drvdata (&data->card, data); + ret =devm_snd_soc_register_card (&pdev->dev, &data->card);if (ret) {dev_err (&pdev->dev,"snd_soc_register_card failed (%d)\n" , ret); goto clk_fail; } -platform_set_drvdata (pdev, data);of_node_put (ssi_np);of_node_put (codec_np);
@@ -289,7 +291,8 @@ fail:static int imx_wm8962_remove (struct platform_device *pdev) { -struct imx_wm8962_data *data =platform_get_drvdata (pdev); +struct snd_soc_card *card =platform_get_drvdata (pdev); +struct imx_wm8962_data *data =snd_soc_card_get_drvdata (card);if (!IS_ERR (data->codec_clk))clk_disable_unprepare (data->codec_clk);
Greg Kroah-Hartman
maintainerPATCH 90/172 ASoC: max98090: sync regcache on entering STANDBY
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dylan Reid <[email protected]>
commit c42c8922c46d33ed769e99618bdfba06866a0c72 upstream.
Sync regcache when entering STANDBY from OFF. ON isn't entered with OFF as the current state, so the registers were not being re-synced after suspend/resume.
The 98088 and 98095 already call regcache_sync from STANDBY.
--- sound/soc/codecs/max98090.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
sound/soc/codecs/max98090.c +10 -10
@@ -1769,16 +1769,6 @@ static int max98090_set_bias_level(strucswitch (level) {case SND_SOC_BIAS_ON : -if (codec->dapm.bias_level ==SND_SOC_BIAS_OFF ) { - ret =regcache_sync (max98090->regmap); - -if (ret !=0 ) { -dev_err (codec->dev, -"Failed to sync cache: %d\n" , ret); -return ret; - } - } -if (max98090->jack_state ==M98090_JACK_STATE_HEADSET ) {/* * Set to normal bias level.
@@ -1792,6 +1782,16 @@ static int max98090_set_bias_level(strucbreak ;case SND_SOC_BIAS_STANDBY : +if (codec->dapm.bias_level ==SND_SOC_BIAS_OFF ) { + ret =regcache_sync (max98090->regmap); +if (ret !=0 ) { +dev_err (codec->dev, +"Failed to sync cache: %d\n" , ret); +return ret; + } + } +break ; +case SND_SOC_BIAS_OFF :/* Set internal pull-up to lowest power mode */ snd_soc_update_bits(codec, M98090_REG_JACK_DETECT,
Greg Kroah-Hartman
maintainerPATCH 91/172 ASoC: wm8770: Fix wrong number of enum items
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 7a6c0a58dc824523966f212c76322d47c5b0e6fe upstream.
wm8770 codec driver defines ain_enum with a wrong number of items.
Use SOC_ENUM_DOUBLE_DECL() macro and it's automatically fixed.
--- sound/soc/codecs/wm8770.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8770.c +2 -2
@@ -196,8 +196,8 @@ static const char *ain_text[] = {"AIN5" ,"AIN6" ,"AIN7" ,"AIN8" }; -static const struct soc_enum ain_enum = -SOC_ENUM_DOUBLE (WM8770_ADCMUX ,0 ,4 ,8 , ain_text); +static SOC_ENUM_DOUBLE_DECL(ain_enum, + WM8770_ADCMUX, 0, 4, ain_text);static const struct snd_kcontrol_new ain_mux =SOC_DAPM_ENUM ("Capture Mux" , ain_enum);
Greg Kroah-Hartman
maintainerPATCH 92/172 ASoC: da732x: Mark DC offset control registers volatile
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 75306820248e26d15d84acf4e297b9fb27dd3bb2 upstream.
The driver reads from the DC offset control registers during callibration but since the registers are marked as volatile and there is a register cache the values will not be read from the hardware after the first reading rendering the callibration ineffective.
It appears that the driver was originally written for the ASoC level register I/O code but converted to regmap prior to merge and this issue was missed during the conversion as the framework level volatile register functionality was not being used.
--- sound/soc/codecs/da732x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/codecs/da732x.c +12 -0
@@ -1268,11 +1268,23 @@ static struct snd_soc_dai_driver da732x_ }, }; +static bool da732x_volatile (struct device *dev,unsigned int reg) +{ +switch (reg) { +case DA732X_REG_HPL_DAC_OFF_CNTL : +case DA732X_REG_HPR_DAC_OFF_CNTL : +return true; +default : +return false; + } +} +static const struct regmap_config da732x_regmap = { .reg_bits =8 , .val_bits =8 , .max_register =DA732X_MAX_REG , + .volatile_reg = da732x_volatile, .reg_defaults = da732x_reg_cache, .num_reg_defaults =ARRAY_SIZE (da732x_reg_cache), .cache_type =REGCACHE_RBTREE ,
Greg Kroah-Hartman
maintainerPATCH 93/172 ASoC: sta32x: Fix cache sync
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit 70ff00f82a6af0ff68f8f7b411738634ce2f20d0 upstream.
codec->control_data contains a pointer to the regmap struct of the device, not to the device private data. Use snd_soc_codec_get_drvdata() instead.
The issue was introduced in commit 29fdf4fbbe ("ASoC: sta32x: Convert to regmap").
--- sound/soc/codecs/sta32x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/sta32x.c +1 -1
@@ -331,7 +331,7 @@ static int sta32x_sync_coef_shadow(strucstatic int sta32x_cache_sync (struct snd_soc_codec *codec) { -struct sta32x_priv *sta32x = codec->control_data; +struct sta32x_priv *sta32x =snd_soc_codec_get_drvdata (codec);unsigned int mute;int rc;
Greg Kroah-Hartman
maintainerPATCH 95/172 ASoC: sta32x: Fix array access overflow
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 025c3fa9256d4c54506b7a29dc3befac54f5c68d upstream.
Preset EQ enum of sta32x codec driver declares too many number of items and it may lead to the access over the actual array size.
Use SOC_ENUM_SINGLE_DECL() helper and it's automatically fixed.
--- sound/soc/codecs/sta32x.c | 72 +++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 36 deletions(-)
sound/soc/codecs/sta32x.c +36 -36
@@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0), }; -static const struct soc_enum sta32x_drc_ac_enum = -SOC_ENUM_SINGLE (STA32X_CONFD ,STA32X_CONFD_DRC_SHIFT , -2 , sta32x_drc_ac); -static const struct soc_enum sta32x_auto_eq_enum = -SOC_ENUM_SINGLE (STA32X_AUTO1 ,STA32X_AUTO1_AMEQ_SHIFT , -3 , sta32x_auto_eq_mode); -static const struct soc_enum sta32x_auto_gc_enum = -SOC_ENUM_SINGLE (STA32X_AUTO1 ,STA32X_AUTO1_AMGC_SHIFT , -4 , sta32x_auto_gc_mode); -static const struct soc_enum sta32x_auto_xo_enum = -SOC_ENUM_SINGLE (STA32X_AUTO2 ,STA32X_AUTO2_XO_SHIFT , -16 , sta32x_auto_xo_mode); -static const struct soc_enum sta32x_preset_eq_enum = -SOC_ENUM_SINGLE (STA32X_AUTO3 ,STA32X_AUTO3_PEQ_SHIFT , -32 , sta32x_preset_eq_mode); -static const struct soc_enum sta32x_limiter_ch1_enum = -SOC_ENUM_SINGLE (STA32X_C1CFG , STA32X_CxCFG_LS_SHIFT, -3 , sta32x_limiter_select); -static const struct soc_enum sta32x_limiter_ch2_enum = -SOC_ENUM_SINGLE (STA32X_C2CFG , STA32X_CxCFG_LS_SHIFT, -3 , sta32x_limiter_select); -static const struct soc_enum sta32x_limiter_ch3_enum = -SOC_ENUM_SINGLE (STA32X_C3CFG , STA32X_CxCFG_LS_SHIFT, -3 , sta32x_limiter_select); -static const struct soc_enum sta32x_limiter1_attack_rate_enum = -SOC_ENUM_SINGLE (STA32X_L1AR , STA32X_LxA_SHIFT, -16 , sta32x_limiter_attack_rate); -static const struct soc_enum sta32x_limiter2_attack_rate_enum = -SOC_ENUM_SINGLE (STA32X_L2AR , STA32X_LxA_SHIFT, -16 , sta32x_limiter_attack_rate); -static const struct soc_enum sta32x_limiter1_release_rate_enum = -SOC_ENUM_SINGLE (STA32X_L1AR , STA32X_LxR_SHIFT, -16 , sta32x_limiter_release_rate); -static const struct soc_enum sta32x_limiter2_release_rate_enum = -SOC_ENUM_SINGLE (STA32X_L2AR , STA32X_LxR_SHIFT, -16 , sta32x_limiter_release_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum, + STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, + sta32x_drc_ac); +static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum, + STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, + sta32x_auto_eq_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum, + STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, + sta32x_auto_gc_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum, + STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, + sta32x_auto_xo_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum, + STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, + sta32x_preset_eq_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum, + STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, + sta32x_limiter_select); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum, + STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, + sta32x_limiter_select); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum, + STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, + sta32x_limiter_select); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum, + STA32X_L1AR, STA32X_LxA_SHIFT, + sta32x_limiter_attack_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum, + STA32X_L2AR, STA32X_LxA_SHIFT, + sta32x_limiter_attack_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum, + STA32X_L1AR, STA32X_LxR_SHIFT, + sta32x_limiter_release_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum, + STA32X_L2AR, STA32X_LxR_SHIFT, + sta32x_limiter_release_rate);/* byte array controls for setting biquad, mixer, scaling coefficients; * for biquads all five coefficients need to be set in one go,
Greg Kroah-Hartman
maintainerPATCH 96/172 ASoC: wm8958-dsp: Fix firmware block loading
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit 548da08fc1e245faf9b0d7c41ecd8e07984fc332 upstream.
The codec->control_data contains a pointer to the device's regmap struct. But wm8994_bulk_write() expects a pointer to the parent wm8998 device.
The issue was introduced in commit d9a7666f ("ASoC: Remove ASoC-specific WM8994 I/O code").
--- sound/soc/codecs/wm8958-dsp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8958-dsp2.c +1 -1
@@ -153,7 +153,7 @@ static int wm8958_dsp2_fw(struct snd_soc data32 &=0xffffff ; -wm8994_bulk_write (codec->control_data, +wm8994_bulk_write (wm8994->wm8994, data32 &0xffffff , block_len /2 , (void *)(data +8 ));
Greg Kroah-Hartman
maintainerPATCH 97/172 SUNRPC: Fix races in xs_nospace()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 06ea0bfe6e6043cb56a78935a19f6f8ebc636226 upstream.
When a send failure occurs due to the socket being out of buffer space, we call xs_nospace() in order to have the RPC task wait until the socket has drained enough to make it worth while trying again. The current patch fixes a race in which the socket is drained before we get round to setting up the machinery in xs_nospace(), and which is reported to cause hangs.
--- net/sunrpc/xprtsock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sunrpc/xprtsock.c +5 -1
@@ -504,6 +504,7 @@ static int xs_nospace(struct rpc_task *tstruct rpc_rqst *req = task->tk_rqstp;struct rpc_xprt *xprt = req->rq_xprt; struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); +struct sock *sk = transport->inet;int ret = -EAGAIN ; dprintk("RPC: %5u xmit incomplete (%u left of %u)\n",
@@ -521,7 +522,7 @@ static int xs_nospace(struct rpc_task *t* window size */ set_bit (SOCK_NOSPACE , &transport->sock->flags); - transport->inet->sk_write_pending++; + sk->sk_write_pending++;/* ...and wait for more buffer space */ xprt_wait_for_buffer_space (task, xs_nospace_callback); }
@@ -531,6 +532,9 @@ static int xs_nospace(struct rpc_task *t }spin_unlock_bh (&xprt->transport_lock); + +/* Race breaker in case memory is freed before above code is called */ + sk->sk_write_space (sk);return ret; }
Greg Kroah-Hartman
maintainerPATCH 98/172 SUNRPC: Ensure that gss_auth isnt freed before its upcall messages
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 9eb2ddb48ce3a7bd745c14a933112994647fa3cd upstream.
Fix a race in which the RPC client is shutting down while the gss daemon is processing a downcall. If the RPC client manages to shut down before the gss daemon is done, then the struct gss_auth used in gss_release_msg() may have already been freed.
--- net/sunrpc/auth_gss/auth_gss.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +11 -2
@@ -108,6 +108,7 @@ struct gss_auth {static DEFINE_SPINLOCK (pipe_version_lock);static struct rpc_wait_queue pipe_version_rpc_waitqueue;static DECLARE_WAIT_QUEUE_HEAD (pipe_version_waitqueue); +static void gss_put_auth (struct gss_auth *gss_auth);static void gss_free_ctx (struct gss_cl_ctx *);static const struct rpc_pipe_ops gss_upcall_ops_v0;
@@ -320,6 +321,7 @@ gss_release_msg(struct gss_upcall_msg *gif (gss_msg->ctx !=NULL )gss_put_ctx (gss_msg->ctx);rpc_destroy_wait_queue (&gss_msg->rpc_waitqueue); +gss_put_auth (gss_msg->auth);kfree (gss_msg); }
@@ -500,6 +502,7 @@ gss_alloc_msg(struct gss_auth *gss_auth,if (err) goto err_free_msg; }; +kref_get (&gss_auth->kref);return gss_msg; err_free_msg:kfree (gss_msg);
@@ -1071,6 +1074,12 @@ gss_free_callback(struct kref *kref) }static void +gss_put_auth (struct gss_auth *gss_auth) +{ +kref_put (&gss_auth->kref, gss_free_callback); +} + +static void gss_destroy (struct rpc_auth *auth) { struct gss_auth *gss_auth = container_of(auth,
@@ -1091,7 +1100,7 @@ gss_destroy(struct rpc_auth *auth) gss_auth->gss_pipe[1 ] =NULL ;rpcauth_destroy_credcache (auth); -kref_put (&gss_auth->kref, gss_free_callback); +gss_put_auth (gss_auth); }/*
@@ -1262,7 +1271,7 @@ gss_destroy_nullcred(struct rpc_cred *crcall_rcu (&cred->cr_rcu, gss_free_cred_callback);if (ctx)gss_put_ctx (ctx); -kref_put (&gss_auth->kref, gss_free_callback); +gss_put_auth (gss_auth); } static void
Greg Kroah-Hartman
maintainerPATCH 99/172 powerpc: Increase stack redzone for 64-bit userspace to 512 bytes
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit 573ebfa6601fa58b439e7f15828762839ccd306a upstream.
The new ELFv2 little-endian ABI increases the stack redzone -- the area below the stack pointer that can be used for storing data -- from 288 bytes to 512 bytes. This means that we need to allow more space on the user stack when delivering a signal to a 64-bit process.
To make the code a bit clearer, we define new USER_REDZONE_SIZE and KERNEL_REDZONE_SIZE symbols in ptrace.h. For now, we leave the kernel redzone size at 288 bytes, since increasing it to 512 bytes would increase the size of interrupt stack frames correspondingly.
Gcc currently only makes use of 288 bytes of redzone even when compiling for the new little-endian ABI, and the kernel cannot currently be compiled with the new ABI anyway.
In the future, hopefully gcc will provide an option to control the amount of redzone used, and then we could reduce it even more.
This also changes the code in arch_compat_alloc_user_space() to preserve the expanded redzone. It is not clear why this function would ever be used on a 64-bit process, though.
--- arch/powerpc/include/asm/compat.h | 5 +++-- arch/powerpc/include/asm/ptrace.h | 16 +++++++++++++++- arch/powerpc/kernel/signal_64.c | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/compat.h +3 -2
@@ -200,10 +200,11 @@ static inline void __user *arch_compat_a/* * We can't access below the stack pointer in the 32bit ABI and -* can access 288 bytes in the 64bit ABI +* can access 288 bytes in the 64bit big-endian ABI, +* or 512 bytes with the new ELFv2 little-endian ABI. */ if (!is_32bit_task ()) - usp -=288 ; + usp -=USER_REDZONE_SIZE ;return (void __user *) (usp - len); }
arch/powerpc/include/asm/ptrace.h +15 -1
@@ -28,11 +28,23 @@#ifdef __powerpc64__ +/* +* Size of redzone that userspace is allowed to use below the stack +* pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in +* the new ELFv2 little-endian ABI, so we allow the larger amount. +* +* For kernel code we allow a 288-byte redzone, in order to conserve +* kernel stack space; gcc currently only uses 288 bytes, and will +* hopefully allow explicit control of the redzone size in future. +*/ +#define USER_REDZONE_SIZE 512 +#define KERNEL_REDZONE_SIZE 288 +#define STACK_FRAME_OVERHEAD 112/* size of minimum stack frame */ #define STACK_FRAME_LR_SAVE 2/* Location of LR in stack frame */ #define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265)#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \ - STACK_FRAME_OVERHEAD + 288) + STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)#define STACK_FRAME_MARKER 12/* Size of dummy stack frame allocated when calling signal handler. */
@@ -41,6 +53,8 @@#else /* __powerpc64__ */ +#define USER_REDZONE_SIZE 0 +#define KERNEL_REDZONE_SIZE 0#define STACK_FRAME_OVERHEAD 16/* size of minimum stack frame */ #define STACK_FRAME_LR_SAVE 1/* Location of LR in stack frame */ #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773)
arch/powerpc/kernel/signal_64.c +2 -2
@@ -65,8 +65,8 @@ struct rt_sigframe {struct siginfo __user *pinfo;void __user *puc;struct siginfo info; -/* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ -char abigap[288 ]; +/* New 64 bit little-endian ABI allows redzone of 512 bytes below sp */ +char abigap[USER_REDZONE_SIZE ]; } __attribute__ ((aligned (16)));static const char fmt32[] =KERN_INFO \
Greg Kroah-Hartman
maintainerPATCH 100/172 powerpc/le: Ensure that the stop-self RTAS token is handled correctly
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Breeds <[email protected]>
commit 41dd03a94c7d408d2ef32530545097f7d1befe5c upstream.
Currently we're storing a host endian RTAS token in rtas_stop_self_args.token. We then pass that directly to rtas. This is fine on big endian however on little endian the token is not what we expect.
This will typically result in hitting:
panic("Alas, I survived.\n");To fix this we always use the stop-self token in host order and always convert it to be32 before passing this to rtas.
--- arch/powerpc/platforms/pseries/hotplug-cpu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +11 -11
@@ -35,12 +35,7 @@#include "offline_states.h" /* This version can't take the spinlock, because it never returns */ -static struct rtas_args rtas_stop_self_args = { - .token =RTAS_UNKNOWN_SERVICE , - .nargs =0 , - .nret =1 , - .rets = &rtas_stop_self_args.args[0 ], -}; +static int rtas_stop_self_token =RTAS_UNKNOWN_SERVICE ; static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) =CPU_STATE_OFFLINE ;
@@ -93,15 +88,20 @@ void set_default_offline_state(int cpu)static void rtas_stop_self (void ) { -struct rtas_args *args = &rtas_stop_self_args; +struct rtas_args args = { + .token =cpu_to_be32 (rtas_stop_self_token), + .nargs =0 , + .nret =1 , + .rets = &args.args[0 ], + };local_irq_disable (); -BUG_ON (args->token ==RTAS_UNKNOWN_SERVICE ); +BUG_ON (rtas_stop_self_token ==RTAS_UNKNOWN_SERVICE );printk ("cpu %u (hwid %u) Ready to die...\n" ,smp_processor_id (),hard_smp_processor_id ()); -enter_rtas (__pa (args)); +enter_rtas (__pa (&args));panic ("Alas, I survived.\n" ); }
@@ -392,10 +392,10 @@ static int __init pseries_cpu_hotplug_in } } - rtas_stop_self_args.token =rtas_token ("stop-self" ); + rtas_stop_self_token =rtas_token ("stop-self" ); qcss_tok =rtas_token ("query-cpu-stopped-state" ); -if (rtas_stop_self_args.token ==RTAS_UNKNOWN_SERVICE || +if (rtas_stop_self_token ==RTAS_UNKNOWN_SERVICE || qcss_tok ==RTAS_UNKNOWN_SERVICE ) {printk (KERN_INFO "CPU Hotplug not supported by firmware " "- disabling.\n" );
Greg Kroah-Hartman
maintainerPATCH 101/172 powerpc/crashdump : Fix page frame number check in copy_oldmem_page
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Dufour <[email protected]>
commit f5295bd8ea8a65dc5eac608b151386314cb978f1 upstream.
In copy_oldmem_page, the current check using max_pfn and min_low_pfn to decide if the page is backed or not, is not valid when the memory layout is not continuous.
This happens when running as a QEMU/KVM guest, where RTAS is mapped higher in the memory. In that case max_pfn points to the end of RTAS, and a hole between the end of the kdump kernel and RTAS is not backed by PTEs. As a consequence, the kdump kernel is crashing in copy_oldmem_page when accessing in a direct way the pages in that hole.
This fix relies on the memblock's service memblock_is_region_memory to check if the read page is part or not of the directly accessible memory.
--- arch/powerpc/kernel/crash_dump.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/kernel/crash_dump.c +5 -3
@@ -98,17 +98,19 @@ ssize_t copy_oldmem_page(unsigned long p size_t csize, unsigned long offset, int userbuf) { void *vaddr; +phys_addr_t paddr;if (!csize)return 0 ; csize =min_t (size_t, csize,PAGE_SIZE ); + paddr = pfn <<PAGE_SHIFT ; -if ((min_low_pfn < pfn) && (pfn < max_pfn)) { - vaddr =__va (pfn <<PAGE_SHIFT ); +if (memblock_is_region_memory (paddr, csize)) { + vaddr =__va (paddr); csize =copy_oldmem_vaddr (vaddr, buf, csize, offset, userbuf); }else { - vaddr =__ioremap (pfn <<PAGE_SHIFT ,PAGE_SIZE ,0 ); + vaddr =__ioremap (paddr,PAGE_SIZE ,0 ); csize =copy_oldmem_vaddr (vaddr, buf, csize, offset, userbuf);iounmap (vaddr); }
Greg Kroah-Hartman
maintainerPATCH 102/172 powerpc/powernv: Fix opal_xscom_{read,write} prototype
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit 2f3f38e4d3d03dd4125cc9a1f49ab3cc91d8d670 upstream.
The OPAL firmware functions opal_xscom_read and opal_xscom_write take a 64-bit argument for the XSCOM (PCB) address in order to support the indirect mode on P8.
--- arch/powerpc/include/asm/opal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/opal.h +2 -2
@@ -720,8 +720,8 @@ int64_t opal_pci_next_error(uint64_t phbint64_t opal_pci_poll (uint64_t phb_id);int64_t opal_return_cpu (void ); -int64_t opal_xscom_read (uint32_t gcid,uint32_t pcb_addr,__be64 *val); -int64_t opal_xscom_write (uint32_t gcid,uint32_t pcb_addr,uint64_t val); +int64_t opal_xscom_read (uint32_t gcid,uint64_t pcb_addr,__be64 *val); +int64_t opal_xscom_write (uint32_t gcid,uint64_t pcb_addr,uint64_t val);int64_t opal_lpc_write (uint32_t chip_id,enum OpalLPCAddressType addr_type,uint32_t addr,uint32_t data,uint32_t sz);
Greg Kroah-Hartman
maintainerPATCH 103/172 powerpc/powernv: Fix indirect XSCOM unmangling
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit e0cf957614976896111e676e5134ac98ee227d3d upstream.
We need to unmangle the full address, not just the register number, and we also need to support the real indirect bit being set for in-kernel uses.
--- arch/powerpc/platforms/powernv/opal-xscom.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
arch/powerpc/platforms/powernv/opal-xscom.c +12 -9
@@ -71,11 +71,11 @@ static int opal_xscom_err_xlate(int64_t } } -static u64 opal_scom_unmangle (u64 reg) +static u64 opal_scom_unmangle (u64 addr) {/* * XSCOM indirect addresses have the top bit set. Additionally -* the reset of the top 3 nibbles is always 0. +* the rest of the top 3 nibbles is always 0. * * Because the debugfs interface uses signed offsets and shifts * the address left by 3, we basically cannot use the top 4 bits
@@ -86,10 +86,13 @@ static u64 opal_scom_unmangle(u64 reg)* conversion here. To leave room for further xscom address * expansion, we only clear out the top byte * +* For in-kernel use, we also support the real indirect bit, so +* we test for any of the top 5 bits +* */ -if (reg & (1ull <<59 )) - reg = (reg & ~(0xffull <<56 )) | (1ull <<63 ); -return reg; +if (addr & (0x1full <<59 )) + addr = (addr & ~(0xffull <<56 )) | (1ull <<63 ); +return addr; }static int opal_scom_read (scom_map_t map,u64 reg,u64 *value)
@@ -98,8 +101,8 @@ static int opal_scom_read(scom_map_t mapint64_t rc;__be64 v; - reg =opal_scom_unmangle (reg); - rc =opal_xscom_read (m->chip, m->addr + reg, (__be64 *)__pa (&v)); + reg =opal_scom_unmangle (m->addr + reg); + rc =opal_xscom_read (m->chip, reg, (__be64 *)__pa (&v)); *value =be64_to_cpu (v);return opal_xscom_err_xlate (rc); }
@@ -109,8 +112,8 @@ static int opal_scom_write(scom_map_t mastruct opal_scom_map *m = map;int64_t rc; - reg =opal_scom_unmangle (reg); - rc =opal_xscom_write (m->chip, m->addr + reg, value); + reg =opal_scom_unmangle (m->addr + reg); + rc =opal_xscom_write (m->chip, reg, value);return opal_xscom_err_xlate (rc); }
Greg Kroah-Hartman
maintainerPATCH 104/172 ahci: disable NCQ on Samsung pci-e SSDs on macbooks
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Levente Kurusa <[email protected]>
commit 67809f85d31eac600f6b28defa5386c9d2a13b1d upstream.
Samsung's pci-e SSDs with device ID 0x1600 which are found on some macbooks time out on NCQ commands. Blacklist NCQ on the device so that the affected machines can at least boot.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60731
--- drivers/ata/ahci.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/ata/ahci.c +14 -0
@@ -61,6 +61,7 @@ enum board_ids {/* board IDs by feature in alphabetical order */ board_ahci, board_ahci_ign_iferr, + board_ahci_noncq, board_ahci_nosntf, board_ahci_yes_fbs,
@@ -119,6 +120,13 @@ static const struct ata_port_info ahci_p .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, + [board_ahci_noncq] = { + AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ), + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_ops, + }, [board_ahci_nosntf] = { AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF), .flags = AHCI_FLAG_COMMON,
@@ -450,6 +458,12 @@ static const struct pci_device_id ahci_p { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ +/* +* Samsung SSDs found on some macbooks. NCQ times out. +* https://bugzilla.kernel.org/show_bug.cgi?id=60731 +*/ + { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq }, +/* Enmotus */ { PCI_DEVICE(0x1c44, 0x8000), board_ahci },
Greg Kroah-Hartman
maintainerPATCH 105/172 x86: dma-mapping: fix GFP_ATOMIC macro usage
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit c091c71ad2218fc50a07b3d1dab85783f3b77efd upstream.
GFP_ATOMIC is not a single gfp flag, but a macro which expands to the other flags, where meaningful is the LACK of __GFP_WAIT flag. To check if caller wants to perform an atomic allocation, the code must test for a lack of the __GFP_WAIT flag. This patch fixes the issue introduced in v3.5-rc1.
--- arch/x86/kernel/pci-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/pci-dma.c +3 -1
@@ -100,8 +100,10 @@ void *dma_generic_alloc_coherent(struct flag |= __GFP_ZERO; again: page =NULL ; -if (!(flag &GFP_ATOMIC )) +/* CMA can be used only in the context which permits sleeping */ +if (flag & __GFP_WAIT) page =dma_alloc_from_contiguous (dev, count,get_order (size)); +/* fallback */ if (!page) page =alloc_pages_node (dev_to_node (dev), flag,get_order (size));if (!page)
Greg Kroah-Hartman
maintainerPATCH 106/172 perf trace: Fix ioctl request beautifier build problems on !(i386 || x86_64) arches
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 844ae5b46c08dbc7ba695b543c023f9cf3bbf9ff upstream.
Supporting decoding the ioctl 'request' parameter needs more work to properly support more architectures, the current approach doesn't work on at least powerpc and sparc, as reported by Ben Hutchings in
http://lkml.kernel.org/r/[email protected] .
Work around that by making it to be ifdefed for the architectures known to work with the current, limited approach, i386 and x86_64 till better code is written.
--- tools/perf/builtin-trace.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tools/perf/builtin-trace.c +18 -0
@@ -275,6 +275,11 @@ static size_t syscall_arg__scnprintf_str#define SCA_STRARRAY syscall_arg__scnprintf_strarray +#if defined(__i386__) || defined(__x86_64__) +/* +* FIXME: Make this available to all arches as soon as the ioctl beautifier +* gets rewritten to support all arches. +*/ static size_t syscall_arg__scnprintf_strhexarray (char *bf,size_t size,struct syscall_arg *arg) {
@@ -282,6 +287,7 @@ static size_t syscall_arg__scnprintf_str }#define SCA_STRHEXARRAY syscall_arg__scnprintf_strhexarray +#endif /* defined(__i386__) || defined(__x86_64__) */ static size_t syscall_arg__scnprintf_fd (char *bf,size_t size,struct syscall_arg *arg);
@@ -835,6 +841,10 @@ static size_t syscall_arg__scnprintf_sig#define SCA_SIGNUM syscall_arg__scnprintf_signum +#if defined(__i386__) || defined(__x86_64__) +/* +* FIXME: Make this available to all arches. +*/ #define TCGETS 0x5401 static const char *tioctls[] = {
@@ -856,6 +866,7 @@ static const char *tioctls[] = { }; static DEFINE_STRARRAY_OFFSET(tioctls, 0x5401); +#endif /* defined(__i386__) || defined(__x86_64__) */ #define STRARRAY (arg, name, array) \ .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \
@@ -937,9 +948,16 @@ static struct syscall_fmt { { .name = "getrlimit", .errmsg = true, STRARRAY(0, resource, rlimit_resources), }, { .name = "ioctl", .errmsg = true, .arg_scnprintf = { [0] = SCA_FD, /* fd */ +#if defined(__i386__) || defined(__x86_64__) +/* + * FIXME: Make this available to all arches. + */ [1] = SCA_STRHEXARRAY, /* cmd */ [2] = SCA_HEX, /* arg */ }, .arg_parm = { [1] = &strarray__tioctls, /* cmd */ }, }, +#else + [2] = SCA_HEX, /* arg */ }, }, +#endif { .name = "kill", .errmsg = true, .arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, }, { .name = "linkat", .errmsg = true,
Greg Kroah-Hartman
maintainerPATCH 107/172 perf/x86: Fix event scheduling
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 26e61e8939b1fe8729572dabe9a9e97d930dd4f6 upstream.
Vince "Super Tester" Weaver reported a new round of syscall fuzzing (Trinity) failures, with perf WARN_ON()s triggering. He also provided traces of the failures.
This is I think the relevant bit:
> pec_1076_warn-2804 [000] d... 147.926153: x86_pmu_disable: x86_pmu_disable
> pec_1076_warn-2804 [000] d... 147.926153: x86_pmu_state: Events: {
> pec_1076_warn-2804 [000] d... 147.926156: x86_pmu_state: 0: state: .R config: ffffffffffffffff ( (null))
> pec_1076_warn-2804 [000] d... 147.926158: x86_pmu_state: 33: state: AR config: 0 (ffff88011ac99800)
> pec_1076_warn-2804 [000] d... 147.926159: x86_pmu_state: }
> pec_1076_warn-2804 [000] d... 147.926160: x86_pmu_state: n_events: 1, n_added: 0, n_txn: 1
> pec_1076_warn-2804 [000] d... 147.926161: x86_pmu_state: Assignment: {
> pec_1076_warn-2804 [000] d... 147.926162: x86_pmu_state: 0->33 tag: 1 config: 0 (ffff88011ac99800)
> pec_1076_warn-2804 [000] d... 147.926163: x86_pmu_state: }
> pec_1076_warn-2804 [000] d... 147.926166: collect_events: Adding event: 1 (ffff880119ec8800)So we add the insn:p event (fd[23]).
At this point we should have:
n_events = 2, n_added = 1, n_txn = 1
> pec_1076_warn-2804 [000] d... 147.926170: collect_events: Adding event: 0 (ffff8800c9e01800) > pec_1076_warn-2804 [000] d... 147.926172: collect_events: Adding event: 4 (ffff8800cbab2c00)
We try and add the {BP,cycles,br_insn} group (fd[3], fd[4], fd[15]). These events are 0:cycles and 4:br_insn, the BP event isn't x86_pmu so that's not visible.
group_sched_in() pmu->start_txn() /* nop - BP pmu */ event_sched_in() event->pmu->add()
So here we should end up with:
0: n_events = 3, n_added = 2, n_txn = 2
4: n_events = 4, n_added = 3, n_txn = 3
But seeing the below state on x86_pmu_enable(), the must have failed, because the 0 and 4 events aren't there anymore.
Looking at group_sched_in(), since the BP is the leader, its event_sched_in() must have succeeded, for otherwise we would not have seen the sibling adds.
But since neither 0 or 4 are in the below state; their event_sched_in() must have failed; but I don't see why, the complete state: 0,0,1:p,4 fits perfectly fine on a core2.
However, since we try and schedule 4 it means the 0 event must have succeeded! Therefore the 4 event must have failed, its failure will have put group_sched_in() into the fail path, which will call:
event_sched_out() event->pmu->del()
on 0 and the BP event.
Now x86_pmu_del() will reduce n_events; but it will not reduce n_added; giving what we see below:
n_event = 2, n_added = 2, n_txn = 2
> pec_1076_warn-2804 [000] d... 147.926177: x86_pmu_enable: x86_pmu_enable
> pec_1076_warn-2804 [000] d... 147.926177: x86_pmu_state: Events: {
> pec_1076_warn-2804 [000] d... 147.926179: x86_pmu_state: 0: state: .R config: ffffffffffffffff ( (null))
> pec_1076_warn-2804 [000] d... 147.926181: x86_pmu_state: 33: state: AR config: 0 (ffff88011ac99800)
> pec_1076_warn-2804 [000] d... 147.926182: x86_pmu_state: }
> pec_1076_warn-2804 [000] d... 147.926184: x86_pmu_state: n_events: 2, n_added: 2, n_txn: 2
> pec_1076_warn-2804 [000] d... 147.926184: x86_pmu_state: Assignment: {
> pec_1076_warn-2804 [000] d... 147.926186: x86_pmu_state: 0->33 tag: 1 config: 0 (ffff88011ac99800)
> pec_1076_warn-2804 [000] d... 147.926188: x86_pmu_state: 1->0 tag: 1 config: 1 (ffff880119ec8800)
> pec_1076_warn-2804 [000] d... 147.926188: x86_pmu_state: }
> pec_1076_warn-2804 [000] d... 147.926190: x86_pmu_enable: S0: hwc->idx: 33, hwc->last_cpu: 0, hwc->last_tag: 1 hwc->state: 0So the problem is that x86_pmu_del(), when called from a group_sched_in() that fails (for whatever reason), and without x86_pmu TXN support (because the leader is !x86_pmu), will corrupt the n_added state.
--- arch/x86/kernel/cpu/perf_event.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/perf_event.c +3 -0
@@ -1192,6 +1192,9 @@ static void x86_pmu_del(struct perf_evenfor (i =0 ; i < cpuc->n_events; i++) {if (event == cpuc->event_list[i]) { +if (i >= cpuc->n_events - cpuc->n_added) + --cpuc->n_added; +if (x86_pmu.put_event_constraints) x86_pmu.put_event_constraints (cpuc, event);
Greg Kroah-Hartman
maintainerPATCH 108/172 ata: enable quirk from jmicron JMB350 for JMB394
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Denis V. Lunev" <[email protected]>
commit efb9e0f4f43780f0ae0c6428d66bd03e805c7539 upstream.
Without the patch the kernel generates the following error.
ata11.15: SATA link up 1.5 Gbps (SStatus 113 SControl 310) ata11.15: Port Multiplier vendor mismatch '0x197b' != '0x123' ata11.15: PMP revalidation failed (errno=-19) ata11.15: failed to recover PMP after 5 tries, giving up
This patch helps to bypass this error and the device becomes functional.
--- drivers/ata/libata-pmp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/ata/libata-pmp.c +5 -2
@@ -447,8 +447,11 @@ static void sata_pmp_quirks(struct ata_p* otherwise. Don't try hard to recover it. */ ap->pmp_link[ap->nr_pmp_links -1 ].flags |=ATA_LFLAG_NO_RETRY ; - }else if (vendor ==0x197b && devid ==0x2352 ) { -/* chip found in Thermaltake BlackX Duet, jmicron JMB350? */ + }else if (vendor ==0x197b && (devid ==0x2352 || devid ==0x0325 )) { +/* +* 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350? +* 0x0325: jmicron JMB394. +*/ ata_for_each_link (link, ap,EDGE ) {/* SRST breaks detection and disks get misclassified * LPM disabled to avoid potential problems
Greg Kroah-Hartman
maintainerPATCH 109/172 sata_sil: apply MOD15WRITE quirk to TOSHIBA MK2561GSYN
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 9f9c47f00ce99329b1a82e2ac4f70f0fe3db549c upstream.
It's a bit odd to see a newer device showing mod15write; however, the reported behavior is highly consistent and other factors which could contribute seem to have been verified well enough. Also, both sata_sil itself and the drive are fairly outdated at this point making the risk of this change fairly low. It is possible, probably likely, that other drive models in the same family have the same problem; however, for now, let's just add the specific model which was tested.
References: http://lkml.kernel.org/g/[email protected]
--- drivers/ata/sata_sil.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/sata_sil.c +1 -0
@@ -157,6 +157,7 @@ static const struct sil_drivelist { { "ST380011ASL", SIL_QUIRK_MOD15WRITE }, { "ST3120022ASL", SIL_QUIRK_MOD15WRITE }, { "ST3160021ASL", SIL_QUIRK_MOD15WRITE }, + { "TOSHIBA MK2561GSYN", SIL_QUIRK_MOD15WRITE }, { "Maxtor 4D060H3", SIL_QUIRK_UDMA5MAX }, { } };
Greg Kroah-Hartman
maintainerPATCH 110/172 cpufreq: powernow-k8: Initialize per-cpu data-structures properly
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Srivatsa S. Bhat" <[email protected]>
commit c3274763bfc3bf1ececa269ed6e6c4d7ec1c3e5e upstream.
The powernow-k8 driver maintains a per-cpu data-structure called powernow_data that is used to perform the frequency transitions. It initializes this data structure only for the policy->cpu. So, accesses to this data structure by other CPUs results in various problems because they would have been uninitialized.
Specifically, if a cpu (!= policy->cpu) invokes the drivers' ->get() function, it returns 0 as the KHz value, since its per-cpu memory doesn't point to anything valid. This causes problems during suspend/resume since cpufreq_update_policy() tries to enforce this (0 KHz) as the current frequency of the CPU, and this madness gets propagated to adjust_jiffies() as well. Eventually, lots of things start breaking down, including the r8169 ethernet card, in one particularly interesting case reported by Pierre Ossman.
Fix this by initializing the per-cpu data-structures of all the CPUs in the policy appropriately.
References: https://bugzilla.kernel.org/show_bug.cgi?id=70311
--- drivers/cpufreq/powernow-k8.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/cpufreq/powernow-k8.c +7 -3
@@ -1081,7 +1081,7 @@ static int powernowk8_cpu_init(struct cp {struct powernow_k8_data *data;struct init_on_cpu init_on_cpu; -int rc; +int rc, cpu;smp_call_function_single (pol->cpu, check_supported_cpu, &rc,1 );if (rc)
@@ -1145,7 +1145,9 @@ static int powernowk8_cpu_init(struct cppr_debug ("cpu_init done, current fid 0x%x, vid 0x%x\n" , data->currfid, data->currvid); -per_cpu (powernow_data, pol->cpu) = data; +/* Point all the CPUs in this policy to the same data */ +for_each_cpu (cpu, pol->cpus) +per_cpu (powernow_data, cpu) = data;return 0 ;
@@ -1160,6 +1162,7 @@ err_out:static int powernowk8_cpu_exit (struct cpufreq_policy *pol) {struct powernow_k8_data *data =per_cpu (powernow_data, pol->cpu); +int cpu;if (!data)return -EINVAL ;
@@ -1170,7 +1173,8 @@ static int powernowk8_cpu_exit(struct cpkfree (data->powernow_table);kfree (data); -per_cpu (powernow_data, pol->cpu) =NULL ; +for_each_cpu (cpu, pol->cpus) +per_cpu (powernow_data, cpu) =NULL ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 111/172 Revert "writeback: do not sync data dirtied after sync start"
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 0dc83bd30b0bf5410c0933cfbbf8853248eff0a9 upstream.
This reverts commit c4a391b53a72d2df4ee97f96f78c1d5971b47489. Dave Chinner <[email protected]> has reported the commit may cause some inodes to be left out from sync(2). This is because we can call redirty_tail() for some inode (which sets i_dirtied_when to current time) after sync(2) has started or similarly requeue_inode() can set i_dirtied_when to current time if writeback had to skip some pages. The real problem is in the functions clobbering i_dirtied_when but fixing that isn't trivial so revert is a safer choice for now.
--- fs/fs-writeback.c | 33 +++++++++++---------------------- fs/sync.c | 15 ++++++--------- fs/xfs/xfs_super.c | 2 +- include/linux/writeback.h | 2 +- include/trace/events/writeback.h | 6 +++--- 5 files changed, 22 insertions(+), 36 deletions(-)
fs/fs-writeback.c +11 -22
@@ -40,18 +40,13 @@struct wb_writeback_work {long nr_pages;struct super_block *sb; -/* -* Write only inodes dirtied before this time. Don't forget to set -* older_than_this_is_set when you set this. -*/ -unsigned long older_than_this; +unsigned long *older_than_this;enum writeback_sync_modes sync_mode;unsigned int tagged_writepages:1 ;unsigned int for_kupdate:1 ;unsigned int range_cyclic:1 ;unsigned int for_background:1 ;unsigned int for_sync:1 ;/* sync(2) WB_SYNC_ALL writeback */ -unsigned int older_than_this_is_set:1 ;enum wb_reason reason;/* why was writeback initiated? */ struct list_head list;/* pending work list */
@@ -252,10 +247,10 @@ static int move_expired_inodes(struct liint do_sb_sort =0 ;int moved =0 ; -WARN_ON_ONCE (!work->older_than_this_is_set);while (!list_empty (delaying_queue)) { inode =wb_inode (delaying_queue->prev); -if (inode_dirtied_after (inode, work->older_than_this)) +if (work->older_than_this && +inode_dirtied_after (inode, *work->older_than_this))break ;list_move (&inode->i_wb_list, &tmp); moved++;
@@ -742,8 +737,6 @@ static long writeback_inodes_wb(struct b .sync_mode = WB_SYNC_NONE, .range_cyclic = 1, .reason = reason, - .older_than_this = jiffies, - .older_than_this_is_set = 1, };spin_lock (&wb->list_lock);
@@ -802,13 +795,12 @@ static long wb_writeback(struct bdi_writ {unsigned long wb_start = jiffies;long nr_pages = work->nr_pages; +unsigned long oldest_jif;struct inode *inode;long progress; -if (!work->older_than_this_is_set) { - work->older_than_this = jiffies; - work->older_than_this_is_set =1 ; - } + oldest_jif = jiffies; + work->older_than_this = &oldest_jif;spin_lock (&wb->list_lock);for (;;) {
@@ -842,10 +834,10 @@ static long wb_writeback(struct bdi_writ* safe. */ if (work->for_kupdate) { - work->older_than_this = jiffies - + oldest_jif = jiffies -msecs_to_jiffies (dirty_expire_interval *10 ); }else if (work->for_background) - work->older_than_this = jiffies; + oldest_jif = jiffies;trace_writeback_start (wb->bdi, work);if (list_empty (&wb->b_io))
@@ -1357,21 +1349,18 @@ EXPORT_SYMBOL(try_to_writeback_inodes_sb/** * sync_inodes_sb - sync sb inode pages -* @sb: the superblock -* @older_than_this: timestamp +* @sb: the superblock * * This function writes and waits on any dirty inode belonging to this -* superblock that has been dirtied before given timestamp. +* super_block. */ -void sync_inodes_sb (struct super_block *sb,unsigned long older_than_this) +void sync_inodes_sb (struct super_block *sb) {DECLARE_COMPLETION_ONSTACK (done);struct wb_writeback_work work = { .sb = sb, .sync_mode =WB_SYNC_ALL , .nr_pages =LONG_MAX , - .older_than_this = older_than_this, - .older_than_this_is_set =1 , .range_cyclic =0 , .done = &done, .reason =WB_REASON_SYNC ,
fs/sync.c +6 -9
@@ -27,11 +27,10 @@* wait == 1 case since in that case write_inode() functions do * sync_dirty_buffer() and thus effectively write one block at a time. */ -static int __sync_filesystem (struct super_block *sb,int wait, -unsigned long start) +static int __sync_filesystem (struct super_block *sb,int wait) {if (wait) -sync_inodes_sb (sb, start); +sync_inodes_sb (sb);else writeback_inodes_sb (sb,WB_REASON_SYNC );
@@ -48,7 +47,6 @@ static int __sync_filesystem(struct supeint sync_filesystem (struct super_block *sb) {int ret; -unsigned long start = jiffies;/* * We need to be protected against the filesystem going from
@@ -62,17 +60,17 @@ int sync_filesystem(struct super_block *if (sb->s_flags &MS_RDONLY )return 0 ; - ret =__sync_filesystem (sb,0 , start); + ret =__sync_filesystem (sb,0 );if (ret <0 )return ret; -return __sync_filesystem (sb,1 , start); +return __sync_filesystem (sb,1 ); }EXPORT_SYMBOL_GPL (sync_filesystem);static void sync_inodes_one_sb (struct super_block *sb,void *arg) {if (!(sb->s_flags &MS_RDONLY )) -sync_inodes_sb (sb, *((unsigned long *)arg)); +sync_inodes_sb (sb); }static void sync_fs_one_sb (struct super_block *sb,void *arg)
@@ -104,10 +102,9 @@ static void fdatawait_one_bdev(struct blSYSCALL_DEFINE0 (sync) {int nowait =0 , wait =1 ; -unsigned long start = jiffies;wakeup_flusher_threads (0 ,WB_REASON_SYNC ); -iterate_supers (sync_inodes_one_sb, &start); +iterate_supers (sync_inodes_one_sb,NULL );iterate_supers (sync_fs_one_sb, &nowait);iterate_supers (sync_fs_one_sb, &wait);iterate_bdevs (fdatawrite_one_bdev,NULL );
fs/xfs/xfs_super.c +1 -1
@@ -913,7 +913,7 @@ xfs_flush_inodes(struct super_block *sb = mp->m_super;if (down_read_trylock (&sb->s_umount)) { -sync_inodes_sb (sb, jiffies); +sync_inodes_sb (sb);up_read (&sb->s_umount); } }
include/linux/writeback.h +1 -1
@@ -97,7 +97,7 @@ void writeback_inodes_sb_nr(struct superint try_to_writeback_inodes_sb (struct super_block *,enum wb_reason reason);int try_to_writeback_inodes_sb_nr (struct super_block *,unsigned long nr,enum wb_reason reason); -void sync_inodes_sb (struct super_block *sb,unsigned long older_than_this); +void sync_inodes_sb (struct super_block *);void wakeup_flusher_threads (long nr_pages,enum wb_reason reason);void inode_wait_for_writeback (struct inode *inode);
include/trace/events/writeback.h +3 -3
@@ -287,11 +287,11 @@ TRACE_EVENT(writeback_queue_io,__field (int, reason) ),TP_fast_assign ( - unsigned long older_than_this = work->older_than_this; + unsigned long *older_than_this = work->older_than_this;strncpy (__entry->name,dev_name (wb->bdi->dev),32 ); - __entry->older = older_than_this; + __entry->older = older_than_this ? *older_than_this :0 ; __entry->age = older_than_this ? - (jiffies - older_than_this) *1000 /HZ :-1 ; + (jiffies - *older_than_this) *1000 /HZ :-1 ; __entry->moved = moved; __entry->reason = work->reason; ),
Greg Kroah-Hartman
maintainerPATCH 112/172 PCI: mvebu: Use Device ID and revision from underlying endpoint
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Lunn <[email protected]>
commit 322a8e91844f4ae2093e0d3d8a318d0ef2596756 upstream.
Marvell SoCs place the SoC number into the PCIe endpoint device ID. The SoC stepping is placed into the PCIe revision. The old plat-orion PCIe driver allowed this information to be seen in user space with a simple lspci command.
The new driver places a virtual PCI-PCI bridge on top of these endpoints. It has its own hard coded PCI device ID. Thus it is no longer possible to see what the SoC is using lspci.
When initializing the PCI-PCI bridge, set its device ID and revision from the underlying endpoint, thus restoring this functionality. Debian would like to use this in order to aid installing the correct DTB file.
--- drivers/pci/host/pci-mvebu.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/pci/host/pci-mvebu.c +2 -9
@@ -60,14 +60,6 @@#define PCIE_DEBUG_CTRL 0x1a60#define PCIE_DEBUG_SOFT_RESET BIT(20) -/* -* This product ID is registered by Marvell, and used when the Marvell -* SoC is not the root complex, but an endpoint on the PCIe bus. It is -* therefore safe to re-use this PCI ID for our emulated PCI-to-PCI -* bridge. -*/ -#define MARVELL_EMULATED_PCI_PCI_BRIDGE_ID 0x7846 -/* PCI configuration space of a PCI-to-PCI bridge */ struct mvebu_sw_pci_bridge {u16 vendor;
@@ -377,7 +369,8 @@ static void mvebu_sw_pci_bridge_init(str bridge->class =PCI_CLASS_BRIDGE_PCI ; bridge->vendor =PCI_VENDOR_ID_MARVELL ; - bridge->device =MARVELL_EMULATED_PCI_PCI_BRIDGE_ID ; + bridge->device =mvebu_readl (port,PCIE_DEV_ID_OFF ) >>16 ; + bridge->revision =mvebu_readl (port,PCIE_DEV_REV_OFF ) &0xff ; bridge->header_type =PCI_HEADER_TYPE_BRIDGE ; bridge->cache_line_size =0x10 ;
Greg Kroah-Hartman
maintainerPATCH 113/172 PCI: Enable INTx if BIOS left them disabled
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 1f42db786b14a31bf807fc41ee5583a00c08fcb1 upstream.
Some firmware leaves the Interrupt Disable bit set even if the device uses INTx interrupts. Clear Interrupt Disable so we get those interrupts.
Based on the report mentioned below, if the user selects the "EHCI only" option in the Intel Baytrail BIOS, the EHCI device is handed off to the OS with the PCI_COMMAND_INTX_DISABLE bit set.
--- drivers/pci/pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/pci.c +10 -0
@@ -1120,6 +1120,8 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_savestatic int do_pci_enable_device (struct pci_dev *dev,int bars) {int err; +u16 cmd; +u8 pin; err =pci_set_power_state (dev,PCI_D0 );if (err <0 && err != -EIO )
@@ -1129,6 +1131,14 @@ static int do_pci_enable_device(struct preturn err;pci_fixup_device (pci_fixup_enable, dev); +pci_read_config_byte (dev,PCI_INTERRUPT_PIN , &pin); +if (pin) { +pci_read_config_word (dev,PCI_COMMAND , &cmd); +if (cmd &PCI_COMMAND_INTX_DISABLE ) +pci_write_config_word (dev,PCI_COMMAND , + cmd & ~PCI_COMMAND_INTX_DISABLE ); + } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 114/172 ACPI / PCI: Fix memory leak in acpi_pci_irq_enable()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Nowicki <[email protected]>
commit b685f3b1744061aa9ad822548ba9c674de5be7c6 upstream.
acpi_pci_link_allocate_irq() can return negative gsi even if entry != NULL. For that case we have a memory leak, so free entry before returning from acpi_pci_irq_enable() for gsi < 0.
--- drivers/acpi/pci_irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/pci_irq.c +1 -0
@@ -432,6 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev * pin_name(pin)); } +kfree (entry);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 115/172 i7core_edac: Fix PCI device reference count
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit c0f5eeed0f4cef4f05b74883a7160e7edde58b6a upstream.
The reference count changes done by pci_get_device can be a little misleading when the usage diverges from the most common scheme. The reference count of the device passed as the last parameter is always decreased, even if the function returns no new device. So if we are going to try alternative device IDs, we must manually increment the device reference count before each retry. If we don't, we end up decreasing the reference count, and after a few modprobe/rmmod cycles the PCI devices will vanish.
In other words and as Alan put it: without this fix the EDAC code corrupts the PCI device list.
This fixes kernel bug #50491:
https://bugzilla.kernel.org/show_bug.cgi?id=50491
--- drivers/edac/i7core_edac.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/edac/i7core_edac.c +7 -2
@@ -1334,14 +1334,19 @@ static int i7core_get_onedevice(struct p* is at addr 8086:2c40, instead of 8086:2c41. So, we need * to probe for the alternate address in case of failure */ -if (dev_descr->dev_id ==PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) +if (dev_descr->dev_id ==PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) { +pci_dev_get (*prev);/* pci_get_device will put it */ pdev =pci_get_device (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT , *prev); + } -if (dev_descr->dev_id ==PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev) +if (dev_descr->dev_id ==PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && + !pdev) { +pci_dev_get (*prev);/* pci_get_device will put it */ pdev =pci_get_device (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT , *prev); + }if (!pdev) {if (*prev) {
Greg Kroah-Hartman
maintainerPATCH 116/172 ACPI / video: Filter the _BCL table for duplicate brightness values
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit bd8ba20597f0cfef3ef65c3fd2aa92ab23d4c8e1 upstream.
Some devices have duplicate entries in there brightness levels table, ie on my Dell Latitude E6430 the table looks like this:
[ 3.686060] acpi backlight index 0, val 80 [ 3.686095] acpi backlight index 1, val 50 [ 3.686122] acpi backlight index 2, val 5 [ 3.686147] acpi backlight index 3, val 5 [ 3.686172] acpi backlight index 4, val 5 [ 3.686197] acpi backlight index 5, val 5 [ 3.686223] acpi backlight index 6, val 5 [ 3.686248] acpi backlight index 7, val 5 [ 3.686273] acpi backlight index 8, val 6 [ 3.686332] acpi backlight index 9, val 7 [ 3.686356] acpi backlight index 10, val 8 [ 3.686380] acpi backlight index 11, val 9
etc.
Notice that brightness values 0-5 are all mapped to 5. This means that if userspace writes any value between 0 and 5 to the brightness sysfs attribute and then reads it, it will always return 0, which is somewhat unexpected.
This is a problem for ie gnome-settings-daemon, which uses read-modify-write logic when the users presses the brightness up or down keys. This is done this way to take brightness changes from other sources into account.
On this specific laptop what happens once the brightness has been set to 0, is that gsd reads 0, adds 5, writes 5, and on the next brightness up key press again reads 0, so things get stuck at the lowest brightness setting.
Filtering out the duplicate table entries, makes any write to brightness read back as the written value as one would expect, fixing this.
--- drivers/acpi/video.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/acpi/video.c +7 -1
@@ -686,6 +686,7 @@ acpi_video_init_brightness(struct acpi_vunion acpi_object *o;struct acpi_video_device_brightness *br =NULL ;int result = -EINVAL ; +u32 value;if (!ACPI_SUCCESS (acpi_video_device_lcd_query_levels (device, &obj))) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available "
@@ -716,7 +717,12 @@ acpi_video_init_brightness(struct acpi_v printk(KERN_ERR PREFIX "Invalid data\n");continue ; } - br->levels[count] = (u32 ) o->integer.value; + value = (u32 ) o->integer.value; +/* Skip duplicate entries */ +if (count >2 && br->levels[count -1 ] == value) +continue ; + + br->levels[count] = value;if (br->levels[count] > max_level) max_level = br->levels[count];
Greg Kroah-Hartman
maintainerPATCH 117/172 ACPI / processor: Rework processor throttling with work_on_cpu()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit f3ca4164529b875374c410193bbbac0ee960895f upstream.
acpi_processor_set_throttling() uses set_cpus_allowed_ptr() to make sure that the (struct acpi_processor)->acpi_processor_set_throttling() callback will run on the right CPU. However, the function may be called from a worker thread already bound to a different CPU in which case that won't work.
Make acpi_processor_set_throttling() use work_on_cpu() as appropriate instead of abusing set_cpus_allowed_ptr().
--- drivers/acpi/processor_throttling.c | 69 ++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 37 deletions(-)
drivers/acpi/processor_throttling.c +32 -37
@@ -59,6 +59,12 @@ struct throttling_tstate {int target_state;/* target T-state */ }; +struct acpi_processor_throttling_arg { +struct acpi_processor *pr; +int target_state; +bool force; +}; +#define THROTTLING_PRECHANGE (1)#define THROTTLING_POSTCHANGE (2)
@@ -1063,16 +1069,24 @@ static int acpi_processor_set_throttlingreturn 0 ; } +static long acpi_processor_throttling_fn (void *data) +{ +struct acpi_processor_throttling_arg *arg = data; +struct acpi_processor *pr = arg->pr; + +return pr->throttling.acpi_processor_set_throttling (pr, + arg->target_state, arg->force); +} +int acpi_processor_set_throttling (struct acpi_processor *pr,int state,bool force) { -cpumask_var_t saved_mask;int ret =0 ;unsigned int i;struct acpi_processor *match_pr;struct acpi_processor_throttling *p_throttling; +struct acpi_processor_throttling_arg arg;struct throttling_tstate t_state; -cpumask_var_t online_throttling_cpus;if (!pr)return -EINVAL ;
@@ -1083,14 +1097,6 @@ int acpi_processor_set_throttling(structif ((state <0 ) || (state > (pr->throttling.state_count -1 )))return -EINVAL ; -if (!alloc_cpumask_var (&saved_mask,GFP_KERNEL )) -return -ENOMEM ; - -if (!alloc_cpumask_var (&online_throttling_cpus,GFP_KERNEL )) { -free_cpumask_var (saved_mask); -return -ENOMEM ; - } -if (cpu_is_offline (pr->id)) {/* * the cpu pointed by pr->id is offline. Unnecessary to change
@@ -1099,17 +1105,15 @@ int acpi_processor_set_throttling(structreturn -ENODEV ; } -cpumask_copy (saved_mask, ¤t->cpus_allowed); t_state.target_state = state; p_throttling = &(pr->throttling); -cpumask_and (online_throttling_cpus, cpu_online_mask, - p_throttling->shared_cpu_map); +/* * The throttling notifier will be called for every * affected cpu in order to get one proper T-state. * The notifier event is THROTTLING_PRECHANGE. */ -for_each_cpu (i, online_throttling_cpus) { +for_each_cpu_and (i, cpu_online_mask, p_throttling->shared_cpu_map) { t_state.cpu = i;acpi_processor_throttling_notifier (THROTTLING_PRECHANGE , &t_state);
@@ -1121,21 +1125,18 @@ int acpi_processor_set_throttling(struct* it can be called only for the cpu pointed by pr. */ if (p_throttling->shared_type ==DOMAIN_COORD_TYPE_SW_ANY ) { -/* FIXME: use work_on_cpu() */ -if (set_cpus_allowed_ptr (current,cpumask_of (pr->id))) { -/* Can't migrate to the pr->id CPU. Exit */ - ret = -ENODEV ; - goto exit; - } - ret = p_throttling->acpi_processor_set_throttling (pr, - t_state.target_state, force); + arg.pr = pr; + arg.target_state = state; + arg.force = force; + ret =work_on_cpu (pr->id, acpi_processor_throttling_fn, &arg); }else {/* * When the T-state coordination is SW_ALL or HW_ALL, * it is necessary to set T-state for every affected * cpus. */ -for_each_cpu (i, online_throttling_cpus) { +for_each_cpu_and (i, cpu_online_mask, + p_throttling->shared_cpu_map) { match_pr =per_cpu (processors, i);/* * If the pointer is invalid, we will report the
@@ -1156,13 +1157,12 @@ int acpi_processor_set_throttling(struct "on CPU %d\n", i));continue ; } - t_state.cpu = i; -/* FIXME: use work_on_cpu() */ -if (set_cpus_allowed_ptr (current,cpumask_of (i))) -continue ; - ret = match_pr->throttling. -acpi_processor_set_throttling ( - match_pr, t_state.target_state, force); + + arg.pr = match_pr; + arg.target_state = state; + arg.force = force; + ret =work_on_cpu (pr->id, acpi_processor_throttling_fn, + &arg); } }/*
@@ -1171,17 +1171,12 @@ int acpi_processor_set_throttling(struct* affected cpu to update the T-states. * The notifier event is THROTTLING_POSTCHANGE */ -for_each_cpu (i, online_throttling_cpus) { +for_each_cpu_and (i, cpu_online_mask, p_throttling->shared_cpu_map) { t_state.cpu = i;acpi_processor_throttling_notifier (THROTTLING_POSTCHANGE , &t_state); } -/* restore the previous state */ -/* FIXME: use work_on_cpu() */ -set_cpus_allowed_ptr (current, saved_mask); -exit: -free_cpumask_var (online_throttling_cpus); -free_cpumask_var (saved_mask); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 118/172 intel_pstate: Use LFM bus ratio as min ratio/P state
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit 4042e7570cff740460b75c6fc604c629621d3dd2 upstream.
LFM (max efficiency ratio) is the max frequency at minimum voltage supported by the processor. Using LFM as the minimum P state increases performmance without affecting power. By not using P states below LFM we avoid using P states that are less power efficient.
--- drivers/cpufreq/intel_pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +1 -1
@@ -348,7 +348,7 @@ static int byt_get_min_pstate(void) {u64 value;rdmsrl (BYT_RATIOS , value); -return value &0xFF ; +return (value >>8 ) &0xFF ; }static int byt_get_max_pstate (void )
Greg Kroah-Hartman
maintainerPATCH 119/172 can: kvaser_usb: check number of channels returned by HW
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Sobrie <[email protected]>
commit 862474f8b46f6c1e600d4934e40ba40646c696ec upstream.
It is needed to check the number of channels returned by the HW because it cannot be greater than MAX_NET_DEVICES otherwise it will crash.
--- drivers/net/can/usb/kvaser_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/can/usb/kvaser_usb.c +2 -0
@@ -474,6 +474,8 @@ static int kvaser_usb_get_card_info(strureturn err; dev->nchannels = msg.u.cardinfo.nchannels; +if (dev->nchannels >MAX_NET_DEVICES ) +return -EINVAL ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 120/172 usb: chipidea: need to mask when writting endptflush and endptprime
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu CASTET <[email protected]>
commit 5bf5dbeda2454296f1984adfbfc8e6f5965ac389 upstream.
ENDPTFLUSH and ENDPTPRIME registers are set by software and clear by hardware. There is a bit for each endpoint. When we are setting a bit for an endpoint we should make sure we do not touch other endpoint bit. There is a race condition if the hardware clear the bit between the read and the write in hw_write.
--- drivers/usb/chipidea/udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/chipidea/udc.c +2 -2
@@ -105,7 +105,7 @@ static int hw_ep_flush(struct ci_hdrc *cdo {/* flush any pending transfer */ -hw_write (ci,OP_ENDPTFLUSH ,BIT (n),BIT (n)); +hw_write (ci,OP_ENDPTFLUSH , ~0 ,BIT (n));while (hw_read (ci,OP_ENDPTFLUSH ,BIT (n)))cpu_relax (); }while (hw_read (ci,OP_ENDPTSTAT ,BIT (n)));
@@ -205,7 +205,7 @@ static int hw_ep_prime(struct ci_hdrc *cif (is_ctrl && dir ==RX &&hw_read (ci,OP_ENDPTSETUPSTAT ,BIT (num)))return -EAGAIN ; -hw_write (ci,OP_ENDPTPRIME ,BIT (n),BIT (n)); +hw_write (ci,OP_ENDPTPRIME , ~0 ,BIT (n));while (hw_read (ci,OP_ENDPTPRIME ,BIT (n)))cpu_relax ();
Greg Kroah-Hartman
maintainerPATCH 121/172 usb: gadget: bcm63xx_udc: fix build failure on DMA channel code
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 2d1f7af3d60dd09794e0738a915d272c6c27abc5 upstream.
Commit 3dc6475 ("bcm63xx_enet: add support Broadcom BCM6345 Ethernet") changed the ENETDMA[CS] macros such that they are no longer macros, but actual register offset definitions. The bcm63xx_udc driver was not updated, and as a result, causes the following build error to pop up:
CC drivers/usb/gadget/u_ether.odrivers/usb/gadget/bcm63xx_udc.c: In function 'iudma_write':drivers/usb/gadget/bcm63xx_udc.c:642:24: error: called object '0' is not a functiondrivers/usb/gadget/bcm63xx_udc.c: In function 'iudma_reset_channel':drivers/usb/gadget/bcm63xx_udc.c:698:46: error: called object '0' is not a functiondrivers/usb/gadget/bcm63xx_udc.c:700:49: error: called object '0' is not a function
Fix this by updating usb_dmac_{read,write}l and usb_dmas_{read,write}l to take an extra channel argument, and use the channel width (ENETDMA_CHAN_WIDTH) to offset the register we want to access, hence doing again what the macro implicitely did for us.
--- drivers/usb/gadget/bcm63xx_udc.c | 58 +++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 26 deletions(-)
drivers/usb/gadget/bcm63xx_udc.c +32 -26
@@ -361,24 +361,30 @@ static inline void usb_dma_writel(structbcm_writel (val, udc->iudma_regs + off); } -static inline u32 usb_dmac_readl (struct bcm63xx_udc *udc,u32 off) +static inline u32 usb_dmac_readl (struct bcm63xx_udc *udc,u32 off,int chan) { -return bcm_readl (udc->iudma_regs +IUDMA_DMAC_OFFSET + off); +return bcm_readl (udc->iudma_regs +IUDMA_DMAC_OFFSET + off + + (ENETDMA_CHAN_WIDTH * chan)); } -static inline void usb_dmac_writel (struct bcm63xx_udc *udc,u32 val,u32 off) +static inline void usb_dmac_writel (struct bcm63xx_udc *udc,u32 val,u32 off, +int chan) { -bcm_writel (val, udc->iudma_regs +IUDMA_DMAC_OFFSET + off); +bcm_writel (val, udc->iudma_regs +IUDMA_DMAC_OFFSET + off + + (ENETDMA_CHAN_WIDTH * chan)); } -static inline u32 usb_dmas_readl (struct bcm63xx_udc *udc,u32 off) +static inline u32 usb_dmas_readl (struct bcm63xx_udc *udc,u32 off,int chan) { -return bcm_readl (udc->iudma_regs +IUDMA_DMAS_OFFSET + off); +return bcm_readl (udc->iudma_regs +IUDMA_DMAS_OFFSET + off + + (ENETDMA_CHAN_WIDTH * chan)); } -static inline void usb_dmas_writel (struct bcm63xx_udc *udc,u32 val,u32 off) +static inline void usb_dmas_writel (struct bcm63xx_udc *udc,u32 val,u32 off, +int chan) { -bcm_writel (val, udc->iudma_regs +IUDMA_DMAS_OFFSET + off); +bcm_writel (val, udc->iudma_regs +IUDMA_DMAS_OFFSET + off + + (ENETDMA_CHAN_WIDTH * chan)); }static inline void set_clocks (struct bcm63xx_udc *udc,bool is_enabled)
@@ -639,7 +645,7 @@ static void iudma_write(struct bcm63xx_u }while (!last_bd);usb_dmac_writel (udc,ENETDMAC_CHANCFG_EN_MASK , -ENETDMAC_CHANCFG_REG (iudma->ch_idx)); +ENETDMAC_CHANCFG_REG , iudma->ch_idx); }/**
@@ -695,9 +701,9 @@ static void iudma_reset_channel(struct bbcm63xx_fifo_reset_ep (udc,max (0 , iudma->ep_num));/* stop DMA, then wait for the hardware to wrap up */ -usb_dmac_writel (udc,0 ,ENETDMAC_CHANCFG_REG (ch_idx)); +usb_dmac_writel (udc,0 ,ENETDMAC_CHANCFG_REG , ch_idx); -while (usb_dmac_readl (udc,ENETDMAC_CHANCFG_REG (ch_idx)) & +while (usb_dmac_readl (udc,ENETDMAC_CHANCFG_REG , ch_idx) &ENETDMAC_CHANCFG_EN_MASK ) {udelay (1 );
@@ -714,10 +720,10 @@ static void iudma_reset_channel(struct bdev_warn (udc->dev,"forcibly halting IUDMA channel %d\n" , ch_idx);usb_dmac_writel (udc,ENETDMAC_CHANCFG_BUFHALT_MASK , -ENETDMAC_CHANCFG_REG (ch_idx)); +ENETDMAC_CHANCFG_REG , ch_idx); } } -usb_dmac_writel (udc, ~0 ,ENETDMAC_IR_REG (ch_idx)); +usb_dmac_writel (udc, ~0 ,ENETDMAC_IR_REG , ch_idx);/* don't leave "live" HW-owned entries for the next guy to step on */ for (d = iudma->bd_ring; d <= iudma->end_bd; d++)
@@ -729,11 +735,11 @@ static void iudma_reset_channel(struct b/* set up IRQs, UBUS burst size, and BD base for this channel */ usb_dmac_writel (udc,ENETDMAC_IR_BUFDONE_MASK , -ENETDMAC_IRMASK_REG (ch_idx)); -usb_dmac_writel (udc,8 ,ENETDMAC_MAXBURST_REG (ch_idx)); +ENETDMAC_IRMASK_REG , ch_idx); +usb_dmac_writel (udc,8 ,ENETDMAC_MAXBURST_REG , ch_idx); -usb_dmas_writel (udc, iudma->bd_ring_dma,ENETDMAS_RSTART_REG (ch_idx)); -usb_dmas_writel (udc,0 ,ENETDMAS_SRAM2_REG (ch_idx)); +usb_dmas_writel (udc, iudma->bd_ring_dma,ENETDMAS_RSTART_REG , ch_idx); +usb_dmas_writel (udc,0 ,ENETDMAS_SRAM2_REG , ch_idx); }/**
@@ -2036,7 +2042,7 @@ static irqreturn_t bcm63xx_udc_data_isr(spin_lock (&udc->lock);usb_dmac_writel (udc,ENETDMAC_IR_BUFDONE_MASK , -ENETDMAC_IR_REG (iudma->ch_idx)); +ENETDMAC_IR_REG , iudma->ch_idx); bep = iudma->bep; rc =iudma_read (udc, iudma);
@@ -2176,18 +2182,18 @@ static int bcm63xx_iudma_dbg_show(structseq_printf (s," [ep%d]:\n" ,max_t (int, iudma_defaults[ch_idx].ep_num,0 ));seq_printf (s," cfg: %08x; irqstat: %08x; irqmask: %08x; maxburst: %08x\n" , -usb_dmac_readl (udc,ENETDMAC_CHANCFG_REG (ch_idx)), -usb_dmac_readl (udc,ENETDMAC_IR_REG (ch_idx)), -usb_dmac_readl (udc,ENETDMAC_IRMASK_REG (ch_idx)), -usb_dmac_readl (udc,ENETDMAC_MAXBURST_REG (ch_idx))); +usb_dmac_readl (udc,ENETDMAC_CHANCFG_REG , ch_idx), +usb_dmac_readl (udc,ENETDMAC_IR_REG , ch_idx), +usb_dmac_readl (udc,ENETDMAC_IRMASK_REG , ch_idx), +usb_dmac_readl (udc,ENETDMAC_MAXBURST_REG , ch_idx)); - sram2 =usb_dmas_readl (udc,ENETDMAS_SRAM2_REG (ch_idx)); - sram3 =usb_dmas_readl (udc,ENETDMAS_SRAM3_REG (ch_idx)); + sram2 =usb_dmas_readl (udc,ENETDMAS_SRAM2_REG , ch_idx); + sram3 =usb_dmas_readl (udc,ENETDMAS_SRAM3_REG , ch_idx);seq_printf (s," base: %08x; index: %04x_%04x; desc: %04x_%04x %08x\n" , -usb_dmas_readl (udc,ENETDMAS_RSTART_REG (ch_idx)), +usb_dmas_readl (udc,ENETDMAS_RSTART_REG , ch_idx), sram2 >>16 , sram2 &0xffff , sram3 >>16 , sram3 &0xffff , -usb_dmas_readl (udc,ENETDMAS_SRAM4_REG (ch_idx))); +usb_dmas_readl (udc,ENETDMAS_SRAM4_REG , ch_idx));seq_printf (s," desc: %d/%d used" , iudma->n_bds_used, iudma->n_bds);
Greg Kroah-Hartman
maintainerPATCH 122/172 USB: serial: option: blacklist interface 4 for Cinterion PHS8 and PXS8
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksander Morgado <[email protected]>
commit 12df84d4a80278a5b1abfec3206795291da52fc9 upstream.
This interface is to be handled by the qmi_wwan driver.
--- drivers/usb/serial/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +2 -1
@@ -1526,7 +1526,8 @@ static const struct usb_device_id option/* Cinterion */ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
Greg Kroah-Hartman
maintainerPATCH 123/172 USB: EHCI: add delay during suspend to prevent erroneous wakeups
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 3e8d6d85adedc59115a564c0a54b36e42087c4d9 upstream.
High-speed USB connections revert back to full-speed signalling when the device goes into suspend. This takes several milliseconds, and during that time it's not possible to tell reliably whether the device has been disconnected.
On some platforms, the Wake-On-Disconnect circuitry gets confused during this intermediate state. It generates a false wakeup signal, which can prevent the controller from going to sleep.
To avoid this problem, this patch adds a 5-ms delay to the ehci_bus_suspend() routine if any ports have to switch over to full-speed signalling. (Actually, the delay was already present for devices using a particular kind of PHY power management; the patch merely causes the delay to be used more widely.)
--- drivers/usb/host/ehci-hub.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-hub.c +22 -4
@@ -238,6 +238,7 @@ static int ehci_bus_suspend (struct usb_int port;int mask;int changed; +bool fs_idle_delay;ehci_dbg (ehci,"suspend root hub\n" );
@@ -272,6 +273,7 @@ static int ehci_bus_suspend (struct usb_ ehci->bus_suspended =0 ; ehci->owned_ports =0 ; changed =0 ; + fs_idle_delay = false; port =HCS_N_PORTS (ehci->hcs_params);while (port--) {u32 __iomem *reg = &ehci->regs->port_status [port];
@@ -300,16 +302,32 @@ static int ehci_bus_suspend (struct usb_ }if (t1 != t2) { +/* +* On some controllers, Wake-On-Disconnect will +* generate false wakeup signals until the bus +* switches over to full-speed idle. For their +* sake, add a delay if we need one. +*/ +if ((t2 &PORT_WKDISC_E ) && +ehci_port_speed (ehci, t2) == +USB_PORT_STAT_HIGH_SPEED ) + fs_idle_delay = true;ehci_writel (ehci, t2, reg); changed =1 ; } } +spin_unlock_irq (&ehci->lock); + +if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) { +/* +* Wait for HCD to enter low-power mode or for the bus +* to switch to full-speed idle. +*/ +usleep_range (5000 ,5500 ); + }if (changed && ehci->has_tdi_phy_lpm) { -spin_unlock_irq (&ehci->lock); -msleep (5 );/* 5 ms for HCD to enter low-power mode */ spin_lock_irq (&ehci->lock); - port =HCS_N_PORTS (ehci->hcs_params);while (port--) {u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port];
@@ -322,8 +340,8 @@ static int ehci_bus_suspend (struct usb_ port, (t3 &HOSTPC_PHCD ) ? "succeeded" : "failed"); } +spin_unlock_irq (&ehci->lock); } -spin_unlock_irq (&ehci->lock);/* Apparently some devices need a >= 1-uframe delay here */ if (ehci->bus_suspended)
Greg Kroah-Hartman
maintainerPATCH 124/172 usb: ehci: fix deadlock when threadirqs option is used
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit a1227f3c1030e96ebc51d677d2f636268845c5fb upstream.
ehci_irq() and ehci_hrtimer_func() can deadlock on ehci->lock when threadirqs option is used. To prevent the deadlock use spin_lock_irqsave() in ehci_irq().
This change can be reverted when hrtimer callbacks become threaded.
--- drivers/usb/host/ehci-hcd.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-hcd.c +10 -3
@@ -686,8 +686,15 @@ static irqreturn_t ehci_irq (struct usb_struct ehci_hcd *ehci =hcd_to_ehci (hcd);u32 status, masked_status, pcd_status =0 , cmd;int bh; +unsigned long flags; -spin_lock (&ehci->lock); +/* +* For threadirqs option we use spin_lock_irqsave() variant to prevent +* deadlock with ehci hrtimer callback, because hrtimer callbacks run +* in interrupt context even when threadirqs is specified. We can go +* back to spin_lock() variant when hrtimer callbacks become threaded. +*/ +spin_lock_irqsave (&ehci->lock, flags); status =ehci_readl (ehci, &ehci->regs->status);
@@ -705,7 +712,7 @@ static irqreturn_t ehci_irq (struct usb_/* Shared IRQ? */ if (!masked_status ||unlikely (ehci->rh_state ==EHCI_RH_HALTED )) { -spin_unlock (&ehci->lock); +spin_unlock_irqrestore (&ehci->lock, flags);return IRQ_NONE ; }
@@ -823,7 +830,7 @@ dead:if (bh)ehci_work (ehci); -spin_unlock (&ehci->lock); +spin_unlock_irqrestore (&ehci->lock, flags);if (pcd_status)usb_hcd_poll_rh_status (hcd);return IRQ_HANDLED ;
Greg Kroah-Hartman
maintainerPATCH 125/172 USB: ftdi_sio: add Cressi Leonardo PID
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Dorchain <[email protected]>
commit 6dbd46c849e071e6afc1e0cad489b0175bca9318 upstream.
Hello,
the following patch adds an entry for the PID of a Cressi Leonardo diving computer interface to kernel 3.13.0.
It is detected as FT232RL.
Works with subsurface.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 8 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -908,6 +908,8 @@ static struct usb_device_id id_table_com/* Crucible Devices */ { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, +/* Cressi Devices */ + { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -1320,3 +1320,9 @@* Manufacturer: Smart GSM Team */ #define FTDI_Z3X_PID 0x0011 + +/* +* Product: Cressi PC Interface +* Manufacturer: Cressi +*/ +#define FTDI_CRESSI_PID 0x87d0
Greg Kroah-Hartman
maintainerPATCH 126/172 mei: set clients read_cb to NULL when flow control fails
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Bi <[email protected]>
commit accb884b32e82f943340688c9cd30290531e73e0 upstream.
In mei_cl_read_start(), if it fails to send flow control request, it will release "cl->read_cb" but forget to set pointer to NULL, leaving "cl->read_cb" still pointing to random memory, next time this client is operated like mei_release(), it has chance to refer to this wrong pointer.
[228781.826904] Call Trace: [228781.829737] [<c16249b8>] ? mei_cl_unlink+0x48/0xa0 [228781.835283] [<c1624487>] mei_io_cb_free+0x17/0x30 [228781.840733] [<c16265d8>] mei_release+0xa8/0x180 [228781.845989] [<c135c610>] ? __fsnotify_parent+0xa0/0xf0 [228781.851925] [<c1325a69>] __fput+0xd9/0x200 [228781.856696] [<c1325b9d>] ____fput+0xd/0x10 [228781.861467] [<c125cae1>] task_work_run+0x81/0xb0 [228781.866821] [<c1242e53>] do_exit+0x283/0xa00 [228781.871786] [<c1a82b36>] ? kprobe_flush_task+0x66/0xc0 [228781.877722] [<c124eeb8>] ? __dequeue_signal+0x18/0x1a0 [228781.883657] [<c124f072>] ? dequeue_signal+0x32/0x190 [228781.889397] [<c1243744>] do_group_exit+0x34/0xa0 [228781.894750] [<c12517b6>] get_signal_to_deliver+0x206/0x610 [228781.901075] [<c12018d8>] do_signal+0x38/0x100 [228781.906136] [<c1626d1c>] ? mei_read+0x42c/0x4e0 [228781.911393] [<c12600a0>] ? wake_up_bit+0x30/0x30 [228781.916745] [<c16268f0>] ? mei_poll+0x120/0x120 [228781.922001] [<c1324be9>] ? vfs_read+0x89/0x160 [228781.927158] [<c16268f0>] ? mei_poll+0x120/0x120 [228781.932414] [<c133ca34>] ? fget_light+0x44/0xe0 [228781.937670] [<c1324e58>] ? SyS_read+0x68/0x80 [228781.942730] [<c12019f5>] do_notify_resume+0x55/0x70 [228781.948376] [<c1a7de5d>] work_notifysig+0x29/0x30 [228781.953827] [<c1a70000>] ? bad_area+0x5/0x3e
--- drivers/misc/mei/client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/mei/client.c +3 -1
@@ -667,7 +667,6 @@ int mei_cl_read_start(struct mei_cl *cl, goto err; cb->fop_type =MEI_FOP_READ ; - cl->read_cb = cb;if (dev->hbuf_is_ready) { dev->hbuf_is_ready = false;if (mei_hbm_cl_flow_control_req (dev, cl)) {
@@ -679,6 +678,9 @@ int mei_cl_read_start(struct mei_cl *cl, }else {list_add_tail (&cb->list, &dev->ctrl_wr_list.list); } + + cl->read_cb = cb; +return rets; err:mei_io_cb_free (cb);
Greg Kroah-Hartman
maintainerPATCH 127/172 hwmon: (max1668) Fix writing the minimum temperature
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 500a91571f0a5d0d3242d83802ea2fd1faccc66e upstream.
When trying to set the minimum temperature, the driver was erroneously writing the maximum temperature into the chip.
--- drivers/hwmon/max1668.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/max1668.c +1 -1
@@ -243,7 +243,7 @@ static ssize_t set_temp_min(struct devic data->temp_min[index] =clamp_val (temp/1000 ,-128 ,127 );if (i2c_smbus_write_byte_data (client,MAX1668_REG_LIML_WR (index), - data->temp_max[index])) + data->temp_min[index])) count = -EIO ;mutex_unlock (&data->update_lock);
Greg Kroah-Hartman
maintainerPATCH 128/172 workqueue: ensure @task is valid across kthread_stop()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lai Jiangshan <[email protected]>
commit 5bdfff96c69a4d5ab9c49e60abf9e070ecd2acbb upstream.
When a kworker should die, the kworkre is notified through WORKER_DIE flag instead of kthread_should_stop(). This, IIRC, is primarily to keep the test synchronized inside worker_pool lock. WORKER_DIE is first set while holding pool->lock, the lock is dropped and kthread_stop() is called.
Unfortunately, this means that there's a slight chance that the target kworker may see WORKER_DIE before kthread_stop() finishes and exits and frees the target task before or during kthread_stop().
Fix it by pinning the target task before setting WORKER_DIE and putting it after kthread_stop() is done.
tj: Improved patch description and comment. Moved pinning above
WORKER_DIE for better signify what it's protecting.
--- kernel/workqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/workqueue.c +7 -0
@@ -1851,6 +1851,12 @@ static void destroy_worker(struct workerif (worker->flags &WORKER_IDLE ) pool->nr_idle--; +/* +* Once WORKER_DIE is set, the kworker may destroy itself at any +* point. Pin to ensure the task stays until we're done with it. +*/ +get_task_struct (worker->task); +list_del_init (&worker->entry); worker->flags |=WORKER_DIE ;
@@ -1859,6 +1865,7 @@ static void destroy_worker(struct workerspin_unlock_irq (&pool->lock);kthread_stop (worker->task); +put_task_struct (worker->task);kfree (worker);spin_lock_irq (&pool->lock);
Greg Kroah-Hartman
maintainerPATCH 129/172 regulator: da9063: Bug fix when setting max voltage on LDOs 5-11
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Twiss <[email protected]>
commit ebf6dad0de89677aa58a4d8b009014ff88a23452 upstream.
Bug fix to allow the setting of maximum voltage for certain LDOs.
What the bug is:
There is a problem caused by an invalid calculation of n_voltages in the driver. This n_voltages value has the potential to be different for each regulator.
The value for linear_min_sel is set as DA9063_V##regl_name# which can be different depending upon the regulator. This is chosen according to the following definitions in the DA9063 registers.h file:
DA9063_VLDO1_BIAS 0DA9063_VLDO2_BIAS 0DA9063_VLDO3_BIAS 0DA9063_VLDO4_BIAS 0DA9063_VLDO5_BIAS 2DA9063_VLDO6_BIAS 2DA9063_VLDO7_BIAS 2DA9063_VLDO8_BIAS 2DA9063_VLDO9_BIAS 3DA9063_VLDO10_BIAS 2DA9063_VLDO11_BIAS 2
The calculation for n_voltages is valid for LDOs whose BIAS value is zero but this is not correct for those LDOs which have a non-zero value.
What the fix is:
In order to take into account the non-zero linear_min_sel value which is set for the regulators LDO5, LDO6, LDO7, LDO8, LDO9, LDO10 and LDO11, the calculation for n_voltages should take into account the missing term defined by DA9063_V##regl_name#.
This will in turn allow the core constraints calculation to set the maximum voltage limits correctly and therefore allow users to apply the maximum expected voltage to all of the LDOs.
--- drivers/regulator/da9063-regulator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/regulator/da9063-regulator.c +3 -1
@@ -1,3 +1,4 @@ +/* * Regulator driver for DA9063 PMIC series *
@@ -60,7 +61,8 @@ struct da9063_regulator_info { .desc.ops = &da9063_ldo_ops, \ .desc.min_uV = (min_mV) * 1000, \ .desc.uV_step = (step_mV) * 1000, \ - .desc.n_voltages = (((max_mV) - (min_mV))/(step_mV) + 1), \ + .desc.n_voltages = (((max_mV) - (min_mV))/(step_mV) + 1 \ + + (DA9063_V##regl_name##_BIAS)), \ .desc.enable_reg = DA9063_REG_##regl_name##_CONT, \ .desc.enable_mask = DA9063_LDO_EN, \ .desc.vsel_reg = DA9063_REG_V##regl_name##_A, \
Greg Kroah-Hartman
maintainerPATCH 130/172 mtd: nand: omap: fix ecclayout to be in sync with u-boot NAND driver
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekon Gupta <[email protected]>
commit eae39cb4934d3daab3ec828c5201c955b2e56af9 upstream.
mtd: nand: omap2: clean-up BCHx_HW and BCHx_SW ECC configurations in device_probe
Fixes ecclayout mismatch introduced in above commit for following ecc-schemes:
- OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
- OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
However, this patch also touches other ecc-schemes as the fix required refactoring common code, into ecc-scheme specific code.
This patch aligns ecc-layout for below ecc-schemes as per reference [1],[2],[3]
+---+------------+-------------++-------------+-------------+ |OOB|BCH8_CODE_HW|BCH8_CODE_HW_||HAM1_CODE_HW |HAM1_CODE_HW | |pos| | DETECTION_SW||(x8 device) |(x16 device) | +---+------------+-------------++-------------+-------------+ | 0 |BADBLK_MARK | BADBLK_MARK || BADBLK_MARK | BADBLK_MARK | | 1 |BADBLK_MARK | BADBLK_MARK || eccpos[0] | BADBLK_MARK | | 2 | eccpos[0] | eccpos[0] || eccpos[1] | eccpos[0] | | 3 | eccpos[1] | eccpos[1] || eccpos[2] | eccpos[1] | | 4 | eccpos[2] | eccpos[2] || eccpos[3] | eccpos[2] | | 5 | eccpos[3] | eccpos[3] || eccpos[4] | eccpos[3] | | 6 | eccpos[4] | eccpos[4] || eccpos[5] | eccpos[4] | | 7 | eccpos[5] | eccpos[5] || eccpos[6] | eccpos[5] | | 8 | eccpos[6] | eccpos[6] || eccpos[7] | eccpos[6] | | 9 | eccpos[7] | eccpos[7] || eccpos[8] | eccpos[7] | |10 | eccpos[8] | eccpos[8] || eccpos[9] | eccpos[8] | |11 | eccpos[9] | eccpos[9] || eccpos[10] | eccpos[9] | |12 | eccpos[10] | eccpos[10] || eccpos[11] | eccpos[10] | |13 | eccpos[11] | eccpos[11] || oobfree[0] | eccpos[11] | |14 | eccpos[12] | eccpos[12] || oobfree[1] | oobfree[0] | |15 | eccpos[13] | <reserved> || oobfree[2] | oobfree[1] | +---+------------+-------------++-------------+-------------+ |16 | eccpos[14] | eccpos[13] || oobfree[3] | oobfree[2] | |...| [...] | [...] || [...] | [...] | |56 | eccpos[54] | eccpos[51] || oobfree[43] | oobfree[42] | |57 | eccpos[55] | <reserved> || oobfree[44] | oobfree[43] | +===+============+=============+==============+=============+ |58 | oobfree[0] | oobfree[0] || oobfree[45] | oobfree[44] | |59 | oobfree[1] | oobfree[1] || oobfree[46] | oobfree[45] | |60 | oobfree[2] | oobfree[2] || oobfree[47] | oobfree[46] | |61 | oobfree[3] | oobfree[3] || oobfree[48] | oobfree[47] | |62 | oobfree[4] | oobfree[4] || oobfree[49] | oobfree[48] | |63 | oobfree[5] | oobfree[5] || oobfree[50] | oobfree[49] | +---+------------+-------------+--------------+-------------+
[1] ecc-layout expected by ROM code, as specified in SoC TRM under:
Chapter="Initialization"
Section="Device Initialization by ROM code"
Sub-Section="Memory Booting"
Heading="NAND"
Figure="ECC Locations in NAND Spare Areas"
[2] ecc-layout updates in u-boot
http://lists.denx.de/pipermail/u-boot/2013-November/167551.html
[3] u-boot configurations to match above ecc-layout are documented at
https://processors.wiki.ti.com/index.php/Linux_Core_NAND_User%27s_Guide
--- drivers/mtd/nand/omap2.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/mtd/nand/omap2.c +23 -8
@@ -1633,6 +1633,7 @@ static int omap_nand_probe(struct platfoint i;dma_cap_mask_t mask;unsigned sig; +unsigned oob_index;struct resource *res;struct mtd_part_parser_data ppdata = {};
@@ -1832,9 +1833,11 @@ static int omap_nand_probe(struct platfo (mtd->writesize / nand_chip->ecc.size);if (nand_chip->options &NAND_BUSWIDTH_16 ) - ecclayout->eccpos[0 ] =BADBLOCK_MARKER_LENGTH ; + oob_index =BADBLOCK_MARKER_LENGTH ;else - ecclayout->eccpos[0 ] =1 ; + oob_index =1 ; +for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) + ecclayout->eccpos[i] = oob_index; ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + ecclayout->eccbytes;break ;
@@ -1853,7 +1856,12 @@ static int omap_nand_probe(struct platfo ecclayout->eccbytes = nand_chip->ecc.bytes * (mtd->writesize / nand_chip->ecc.size); - ecclayout->eccpos[0 ] =BADBLOCK_MARKER_LENGTH ; + oob_index =BADBLOCK_MARKER_LENGTH ; +for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) { + ecclayout->eccpos[i] = oob_index; +if (((i +1 ) % nand_chip->ecc.bytes) ==0 ) + oob_index++; + } ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + ecclayout->eccbytes;/* software bch library is used for locating errors */
@@ -1889,7 +1897,9 @@ static int omap_nand_probe(struct platfo ecclayout->eccbytes = nand_chip->ecc.bytes * (mtd->writesize / nand_chip->ecc.size); - ecclayout->eccpos[0 ] =BADBLOCK_MARKER_LENGTH ; + oob_index =BADBLOCK_MARKER_LENGTH ; +for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) + ecclayout->eccpos[i] = oob_index; ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + ecclayout->eccbytes;/* This ECC scheme requires ELM H/W block */
@@ -1919,7 +1929,12 @@ static int omap_nand_probe(struct platfo ecclayout->eccbytes = nand_chip->ecc.bytes * (mtd->writesize / nand_chip->ecc.size); - ecclayout->eccpos[0 ] =BADBLOCK_MARKER_LENGTH ; + oob_index =BADBLOCK_MARKER_LENGTH ; +for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) { + ecclayout->eccpos[i] = oob_index; +if (((i +1 ) % nand_chip->ecc.bytes) ==0 ) + oob_index++; + } ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + ecclayout->eccbytes;/* software bch library is used for locating errors */
@@ -1962,7 +1977,9 @@ static int omap_nand_probe(struct platfo ecclayout->eccbytes = nand_chip->ecc.bytes * (mtd->writesize / nand_chip->ecc.size); - ecclayout->eccpos[0 ] =BADBLOCK_MARKER_LENGTH ; + oob_index =BADBLOCK_MARKER_LENGTH ; +for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) + ecclayout->eccpos[i] = oob_index; ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + ecclayout->eccbytes;break ;
@@ -1981,8 +1998,6 @@ static int omap_nand_probe(struct platfo/* populate remaining ECC layout data */ ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH + ecclayout->eccbytes); -for (i =1 ; i < ecclayout->eccbytes; i++) - ecclayout->eccpos[i] = ecclayout->eccpos[0 ] + i;/* check if NAND device's OOB is enough to store ECC signatures */ if (mtd->oobsize < (ecclayout->eccbytes +BADBLOCK_MARKER_LENGTH )) { pr_err("not enough OOB bytes required = %d, available=%d\n",
Greg Kroah-Hartman
maintainerPATCH 131/172 mtd: nand: omap: fix ecclayout->oobfree->offset
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekon Gupta <[email protected]>
commit aa6092f9835893290e77c3e24649def49dac1583 upstream.
1) In current implementation, ecclayout->oobfree->offset is calculated with respect to ecclayout->eccpos[0] which is incorrect because ECC bytes may not be stored contiguously in OOB.
So, this patch calculates ecclayout->oobfree->offset with respect to last ECC byte-position 'eccpos[ecclayout->eccbytes-1]'.
2) ECC layout of some ecc-schemes expects reserved-markers at specific eccpos[] which should not be over-written by any file-system metadata.
So this patch aligns oobfree->offset taking into account of such markers.
--- drivers/mtd/nand/omap2.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
drivers/mtd/nand/omap2.c +15 -10
@@ -1838,8 +1838,9 @@ static int omap_nand_probe(struct platfo oob_index =1 ;for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) ecclayout->eccpos[i] = oob_index; - ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + - ecclayout->eccbytes; +/* no reserved-marker in ecclayout for this ecc-scheme */ + ecclayout->oobfree->offset = + ecclayout->eccpos[ecclayout->eccbytes -1 ] +1 ;break ;case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW :
@@ -1862,8 +1863,9 @@ static int omap_nand_probe(struct platfoif (((i +1 ) % nand_chip->ecc.bytes) ==0 ) oob_index++; } - ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + - ecclayout->eccbytes; +/* include reserved-marker in ecclayout->oobfree calculation */ + ecclayout->oobfree->offset =1 + + ecclayout->eccpos[ecclayout->eccbytes -1 ] +1 ;/* software bch library is used for locating errors */ nand_chip->ecc.priv = nand_bch_init(mtd, nand_chip->ecc.size,
@@ -1900,8 +1902,9 @@ static int omap_nand_probe(struct platfo oob_index =BADBLOCK_MARKER_LENGTH ;for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) ecclayout->eccpos[i] = oob_index; - ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + - ecclayout->eccbytes; +/* reserved marker already included in ecclayout->eccbytes */ + ecclayout->oobfree->offset = + ecclayout->eccpos[ecclayout->eccbytes -1 ] +1 ;/* This ECC scheme requires ELM H/W block */ if (is_elm_present (info, pdata->elm_of_node,BCH4_ECC ) <0 ) {pr_err ("nand: error: could not initialize ELM\n" );
@@ -1935,8 +1938,9 @@ static int omap_nand_probe(struct platfoif (((i +1 ) % nand_chip->ecc.bytes) ==0 ) oob_index++; } - ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + - ecclayout->eccbytes; +/* include reserved-marker in ecclayout->oobfree calculation */ + ecclayout->oobfree->offset =1 + + ecclayout->eccpos[ecclayout->eccbytes -1 ] +1 ;/* software bch library is used for locating errors */ nand_chip->ecc.priv = nand_bch_init(mtd, nand_chip->ecc.size,
@@ -1980,8 +1984,9 @@ static int omap_nand_probe(struct platfo oob_index =BADBLOCK_MARKER_LENGTH ;for (i =0 ; i < ecclayout->eccbytes; i++, oob_index++) ecclayout->eccpos[i] = oob_index; - ecclayout->oobfree->offset = ecclayout->eccpos[0 ] + - ecclayout->eccbytes; +/* reserved marker already included in ecclayout->eccbytes */ + ecclayout->oobfree->offset = + ecclayout->eccpos[ecclayout->eccbytes -1 ] +1 ;break ;#else pr_err ("nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled\n" );
Greg Kroah-Hartman
maintainerPATCH 132/172 mtd: nand: omap: fix ecclayout->oobfree->length
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekon Gupta <[email protected]>
commit bb38eefb6858ce16b34716145b9597a5680aa54c upstream.
This patch excludes reserved-marker byte-position from oobfree->length calculation. Thus all bytes from oobfree->offset till end of OOB are free.
--- drivers/mtd/nand/omap2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mtd/nand/omap2.c +2 -3
@@ -2000,9 +2000,8 @@ static int omap_nand_probe(struct platfo goto return_error; } -/* populate remaining ECC layout data */ - ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH + - ecclayout->eccbytes); +/* all OOB bytes from oobfree->offset till end off OOB are free */ + ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset;/* check if NAND device's OOB is enough to store ECC signatures */ if (mtd->oobsize < (ecclayout->eccbytes +BADBLOCK_MARKER_LENGTH )) { pr_err("not enough OOB bytes required = %d, available=%d\n",
Greg Kroah-Hartman
maintainerPATCH 134/172 staging:iio:adc:MXS:LRADC: fix touchscreen statemachine
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Beisert <[email protected]>
commit 760dbe1dcb6d3dd3ead73dc69b23f206b52273bb upstream.
Releasing the touchscreen lets the internal statemachine left in a wrong state. Due to this the release coordinate will be reported again by accident when the next touchscreen event happens. This change sets up the correct state when waiting for the next touchscreen event.
This has led to reported issues with calibrating the touchscreen. Bug was introduced somewhere in the series that began with 18da755de59b406ce2371a55fb15ed676eb08ed2 Staging/iio/adc/touchscreen/MXS: add proper clock handling in which the way this driver worked was substantially changed to be interrupt driven rather than relying on a busy loop. This was a regression in the 3.13 kernel.
--- drivers/staging/iio/adc/mxs-lradc.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/iio/adc/mxs-lradc.c +1 -0
@@ -698,6 +698,7 @@ static void mxs_lradc_finish_touch_event }/* if it is released, wait for the next touch via IRQ */ + lradc->cur_plate =LRADC_TOUCH ;mxs_lradc_reg_clear (lradc,LRADC_CTRL1_TOUCH_DETECT_IRQ ,LRADC_CTRL1 );mxs_lradc_reg_set (lradc,LRADC_CTRL1_TOUCH_DETECT_IRQ_EN ,LRADC_CTRL1 ); }
Greg Kroah-Hartman
maintainerPATCH 135/172 staging: r8188eu: Add new device ID
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manu Gupta <[email protected]>
commit 260ea9c2e2d330303163e286ab01b66dbcfe3a6f upstream.
The D-Link DWA-123 REV D1 with USB ID 2001:3310 uses this driver.
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -0
@@ -55,6 +55,7 @@ static struct usb_device_id rtw_usb_id_t/****** 8188EUS ********/ {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ + {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ {} /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 136/172 iio:gyro: bug on L3GD20H gyroscope support
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis CIOCCA <[email protected]>
commit a0657716416f834ef7710a9044614d50a36c3bdc upstream.
The driver was not able to manage the sensor: during probe function and wai check, the driver stops and writes: "device name and WhoAmI mismatch." The correct value of L3GD20H wai is 0xd7 instead of 0xd4.
Dropped support for the sensor.
--- drivers/iio/gyro/Kconfig | 2 +- drivers/iio/gyro/st_gyro.h | 1 - drivers/iio/gyro/st_gyro_core.c | 9 ++++----- drivers/iio/gyro/st_gyro_i2c.c | 1 - drivers/iio/gyro/st_gyro_spi.c | 1 - 5 files changed, 5 insertions(+), 9 deletions(-)
drivers/iio/gyro/Kconfig +1 -1
@@ -70,7 +70,7 @@ config IIO_ST_GYRO_3AXIS select IIO_TRIGGERED_BUFFER if (IIO_BUFFER) help Say yes here to build support for STMicroelectronics gyroscopes: - L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330. + L3G4200D, LSM330DL, L3GD20, LSM330DLC, L3G4IS, LSM330. This driver can also be built as a module. If so, these modules will be created:
drivers/iio/gyro/st_gyro.h +0 -1
@@ -19,7 +19,6 @@#define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro"#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro"#define L3GD20_GYRO_DEV_NAME "l3gd20" -#define L3GD20H_GYRO_DEV_NAME "l3gd20h"#define L3G4IS_GYRO_DEV_NAME "l3g4is_ui"#define LSM330_GYRO_DEV_NAME "lsm330_gyro"
drivers/iio/gyro/st_gyro_core.c +4 -5
@@ -167,11 +167,10 @@ static const struct st_sensors st_gyro_s .wai = ST_GYRO_2_WAI_EXP, .sensors_supported = { [0] = L3GD20_GYRO_DEV_NAME, - [1] = L3GD20H_GYRO_DEV_NAME, - [2] = LSM330D_GYRO_DEV_NAME, - [3] = LSM330DLC_GYRO_DEV_NAME, - [4] = L3G4IS_GYRO_DEV_NAME, - [5] = LSM330_GYRO_DEV_NAME, + [1] = LSM330D_GYRO_DEV_NAME, + [2] = LSM330DLC_GYRO_DEV_NAME, + [3] = L3G4IS_GYRO_DEV_NAME, + [4] = LSM330_GYRO_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, .odr = {
drivers/iio/gyro/st_gyro_i2c.c +0 -1
@@ -55,7 +55,6 @@ static const struct i2c_device_id st_gyr { LSM330DL_GYRO_DEV_NAME }, { LSM330DLC_GYRO_DEV_NAME }, { L3GD20_GYRO_DEV_NAME }, - { L3GD20H_GYRO_DEV_NAME }, { L3G4IS_GYRO_DEV_NAME }, { LSM330_GYRO_DEV_NAME }, {},
drivers/iio/gyro/st_gyro_spi.c +0 -1
@@ -54,7 +54,6 @@ static const struct spi_device_id st_gyr { LSM330DL_GYRO_DEV_NAME }, { LSM330DLC_GYRO_DEV_NAME }, { L3GD20_GYRO_DEV_NAME }, - { L3GD20H_GYRO_DEV_NAME }, { L3G4IS_GYRO_DEV_NAME }, { LSM330_GYRO_DEV_NAME }, {},
Greg Kroah-Hartman
maintainerPATCH 137/172 iommu/arm-smmu: fix pud/pmd entry fill sequence
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <[email protected]>
commit 97a644208d1a08b7104d1fe2ace8cef011222711 upstream.
The ARM SMMU driver's population of puds and pmds is broken, since we iterate over the next level of table repeatedly setting the current level descriptor to point at the pmd being initialised. This is clearly wrong when dealing with multiple pmds/puds.
This patch fixes the problem by moving the pud/pmd population out of the loop and instead performing it when we allocate the next level (like we correctly do for ptes already). The starting address for the next level is then calculated prior to entering the loop.
--- drivers/iommu/arm-smmu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/iommu/arm-smmu.c +10 -4
@@ -1317,6 +1317,11 @@ static int arm_smmu_alloc_init_pmd(struc pmd =pmd_alloc_one (NULL , addr);if (!pmd)return -ENOMEM ; + +pud_populate (NULL , pud, pmd); +arm_smmu_flush_pgtable (smmu, pud,sizeof (*pud)); + + pmd +=pmd_index (addr); } else#endif pmd =pmd_offset (pud, addr);
@@ -1325,8 +1330,6 @@ static int arm_smmu_alloc_init_pmd(struc next =pmd_addr_end (addr, end); ret =arm_smmu_alloc_init_pte (smmu, pmd, addr, end, pfn, flags, stage); -pud_populate (NULL , pud, pmd); -arm_smmu_flush_pgtable (smmu, pud,sizeof (*pud)); phys += next - addr; }while (pmd++, addr = next, addr < end);
@@ -1346,6 +1349,11 @@ static int arm_smmu_alloc_init_pud(struc pud =pud_alloc_one (NULL , addr);if (!pud)return -ENOMEM ; + +pgd_populate (NULL , pgd, pud); +arm_smmu_flush_pgtable (smmu, pgd,sizeof (*pgd)); + + pud +=pud_index (addr); } else#endif pud =pud_offset (pgd, addr);
@@ -1354,8 +1362,6 @@ static int arm_smmu_alloc_init_pud(struc next =pud_addr_end (addr, end); ret =arm_smmu_alloc_init_pmd (smmu, pud, addr, next, phys, flags, stage); -pgd_populate (NULL , pud, pgd); -arm_smmu_flush_pgtable (smmu, pgd,sizeof (*pgd)); phys += next - addr; }while (pud++, addr = next, addr < end);
Greg Kroah-Hartman
maintainerPATCH 138/172 iommu/arm-smmu: really fix page table locking
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit c9d09e2748eaa55cac2af274574baa6368189bc1 upstream.
Commit a44a9791e778 ("iommu/arm-smmu: use mutex instead of spinlock for locking page tables") replaced the page table spinlock with a mutex, to allow blocking allocations to satisfy lazy mapping requests.
Unfortunately, it turns out that IOMMU mappings are created from atomic context (e.g. spinlock held during a dma_map), so this change doesn't really help us in practice.
This patch is a partial revert of the offending commit, bringing back the original spinlock but replacing our page table allocations for any levels below the pgd (which is allocated during domain init) with GFP_ATOMIC instead of GFP_KERNEL.
--- drivers/iommu/arm-smmu.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/iommu/arm-smmu.c +10 -10
@@ -392,7 +392,7 @@ struct arm_smmu_domain {struct arm_smmu_cfg root_cfg;phys_addr_t output_mask; -struct mutex lock; +spinlock_t lock; };static DEFINE_SPINLOCK (arm_smmu_devices_lock);
@@ -900,7 +900,7 @@ static int arm_smmu_domain_init(struct i goto out_free_domain; smmu_domain->root_cfg.pgd = pgd; -mutex_init (&smmu_domain->lock); +spin_lock_init (&smmu_domain->lock); domain->priv = smmu_domain;return 0 ;
@@ -1137,7 +1137,7 @@ static int arm_smmu_attach_dev(struct io* Sanity check the domain. We don't currently support domains * that cross between different SMMU chains. */ -mutex_lock (&smmu_domain->lock); +spin_lock (&smmu_domain->lock);if (!smmu_domain->leaf_smmu) {/* Now that we have a master, we can finalise the domain */ ret =arm_smmu_init_domain_context (domain, dev);
@@ -1152,7 +1152,7 @@ static int arm_smmu_attach_dev(struct io dev_name(device_smmu->dev)); goto err_unlock; } -mutex_unlock (&smmu_domain->lock); +spin_unlock (&smmu_domain->lock);/* Looks ok, so add the device to the domain */ master =find_smmu_master (smmu_domain->leaf_smmu, dev->of_node);
@@ -1162,7 +1162,7 @@ static int arm_smmu_attach_dev(struct ioreturn arm_smmu_domain_add_master (smmu_domain, master); err_unlock: -mutex_unlock (&smmu_domain->lock); +spin_unlock (&smmu_domain->lock);return ret; }
@@ -1209,7 +1209,7 @@ static int arm_smmu_alloc_init_pte(strucif (pmd_none (*pmd)) {/* Allocate a new set of tables */ -pgtable_t table =alloc_page (PGALLOC_GFP ); +pgtable_t table =alloc_page (GFP_ATOMIC |__GFP_ZERO);if (!table)return -ENOMEM ;
@@ -1314,7 +1314,7 @@ static int arm_smmu_alloc_init_pmd(struc#ifndef __PAGETABLE_PMD_FOLDEDif (pud_none (*pud)) { - pmd =pmd_alloc_one (NULL , addr); + pmd = (pmd_t *)get_zeroed_page (GFP_ATOMIC );if (!pmd)return -ENOMEM ;
@@ -1346,7 +1346,7 @@ static int arm_smmu_alloc_init_pud(struc#ifndef __PAGETABLE_PUD_FOLDEDif (pgd_none (*pgd)) { - pud =pud_alloc_one (NULL , addr); + pud = (pud_t *)get_zeroed_page (GFP_ATOMIC );if (!pud)return -ENOMEM ;
@@ -1400,7 +1400,7 @@ static int arm_smmu_handle_mapping(strucif (paddr & ~output_mask)return -ERANGE ; -mutex_lock (&smmu_domain->lock); +spin_lock (&smmu_domain->lock); pgd +=pgd_index (iova); end = iova + size; do {
@@ -1416,7 +1416,7 @@ static int arm_smmu_handle_mapping(struc }while (pgd++, iova != end); out_unlock: -mutex_unlock (&smmu_domain->lock); +spin_unlock (&smmu_domain->lock);/* Ensure new page tables are visible to the hardware walker */ if (smmu->features &ARM_SMMU_FEAT_COHERENT_WALK )
Greg Kroah-Hartman
maintainerPATCH 139/172 iommu/arm-smmu: fix table flushing during initial allocations
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 6dd35f45b8dac827b6f9dd86f5aca6436cdd2410 upstream.
Now that we populate page tables as we traverse them ("iommu/arm-smmu:
fix pud/pmd entry fill sequence"), we need to ensure that we flush out our zeroed tables after initial allocation, to prevent speculative TLB fills using bogus data.
This patch adds additional calls to arm_smmu_flush_pgtable during initial table allocation, and moves the dsb required by coherent table walkers into the helper.
--- drivers/iommu/arm-smmu.c | 51 ++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/iommu/arm-smmu.c +27 -24
@@ -78,7 +78,6 @@#define ARM_SMMU_PTE_CONT_SIZE (PAGE_SIZE * ARM_SMMU_PTE_CONT_ENTRIES)#define ARM_SMMU_PTE_CONT_MASK (~(ARM_SMMU_PTE_CONT_SIZE - 1)) -#define ARM_SMMU_PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(pte_t))/* Stage-1 PTE */ #define ARM_SMMU_PTE_AP_UNPRIV (((pteval_t)1) << 6)
@@ -631,6 +630,28 @@ static irqreturn_t arm_smmu_global_faultreturn IRQ_HANDLED ; } +static void arm_smmu_flush_pgtable (struct arm_smmu_device *smmu,void *addr, +size_t size) +{ +unsigned long offset = (unsigned long )addr & ~PAGE_MASK ; + + +/* Ensure new page tables are visible to the hardware walker */ +if (smmu->features &ARM_SMMU_FEAT_COHERENT_WALK ) { +dsb (); + }else { +/* +* If the SMMU can't walk tables in the CPU caches, treat them +* like non-coherent DMA since we need to flush the new entries +* all the way out to memory. There's no possibility of +* recursion here as the SMMU table walker will not be wired +* through another SMMU. +*/ +dma_map_page (smmu->dev,virt_to_page (addr), offset, size, +DMA_TO_DEVICE ); + } +} +static void arm_smmu_init_context_bank (struct arm_smmu_domain *smmu_domain) {u32 reg;
@@ -714,6 +735,8 @@ static void arm_smmu_init_context_bank(s }/* TTBR0 */ +arm_smmu_flush_pgtable (smmu, root_cfg->pgd, +PTRS_PER_PGD *sizeof (pgd_t)); reg =__pa (root_cfg->pgd);writel_relaxed (reg, cb_base +ARM_SMMU_CB_TTBR0_LO ); reg = (phys_addr_t )__pa (root_cfg->pgd) >>32 ;
@@ -1176,23 +1199,6 @@ static void arm_smmu_detach_dev(struct iarm_smmu_domain_remove_master (smmu_domain, master); } -static void arm_smmu_flush_pgtable (struct arm_smmu_device *smmu,void *addr, -size_t size) -{ -unsigned long offset = (unsigned long )addr & ~PAGE_MASK ; - -/* -* If the SMMU can't walk tables in the CPU caches, treat them -* like non-coherent DMA since we need to flush the new entries -* all the way out to memory. There's no possibility of recursion -* here as the SMMU table walker will not be wired through another -* SMMU. -*/ -if (!(smmu->features &ARM_SMMU_FEAT_COHERENT_WALK )) -dma_map_page (smmu->dev,virt_to_page (addr), offset, size, -DMA_TO_DEVICE ); -} -static bool arm_smmu_pte_is_contiguous_range (unsigned long addr,unsigned long end) {
@@ -1213,8 +1219,7 @@ static int arm_smmu_alloc_init_pte(strucif (!table)return -ENOMEM ; -arm_smmu_flush_pgtable (smmu,page_address (table), -ARM_SMMU_PTE_HWTABLE_SIZE ); +arm_smmu_flush_pgtable (smmu,page_address (table),PAGE_SIZE );if (!pgtable_page_ctor (table)) {__free_page (table);return -ENOMEM ;
@@ -1318,6 +1323,7 @@ static int arm_smmu_alloc_init_pmd(strucif (!pmd)return -ENOMEM ; +arm_smmu_flush_pgtable (smmu, pmd,PAGE_SIZE );pud_populate (NULL , pud, pmd);arm_smmu_flush_pgtable (smmu, pud,sizeof (*pud));
@@ -1350,6 +1356,7 @@ static int arm_smmu_alloc_init_pud(strucif (!pud)return -ENOMEM ; +arm_smmu_flush_pgtable (smmu, pud,PAGE_SIZE );pgd_populate (NULL , pgd, pud);arm_smmu_flush_pgtable (smmu, pgd,sizeof (*pgd));
@@ -1418,10 +1425,6 @@ static int arm_smmu_handle_mapping(struc out_unlock:spin_unlock (&smmu_domain->lock); -/* Ensure new page tables are visible to the hardware walker */ -if (smmu->features &ARM_SMMU_FEAT_COHERENT_WALK ) -dsb (); -return ret; }
Greg Kroah-Hartman
maintainerPATCH 140/172 iommu/arm-smmu: set CBARn.BPSHCFG to NSH for s1-s2-bypass contexts
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 57ca90f6800987ac274d7ba065ae6692cdf9bcd7 upstream.
Whilst trying to bring-up an SMMUv2 implementation with the table walker plumbed into a coherent interconnect, I noticed that the memory transactions targetting the CPU caches from the SMMU were marked as outer-shareable instead of inner-shareable.
After a bunch of digging, it seems that we actually need to program CBARn.BPSHCFG for s1-s2-bypass contexts to act as non-shareable in order for the shareability configured in the corresponding TTBCR not to be overridden with an outer-shareable attribute.
--- drivers/iommu/arm-smmu.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/iommu/arm-smmu.c +12 -4
@@ -189,6 +189,9 @@#define ARM_SMMU_GR1_CBAR (n) (0x0 + ((n) << 2))#define CBAR_VMID_SHIFT 0#define CBAR_VMID_MASK 0xff +#define CBAR_S1_BPSHCFG_SHIFT 8 +#define CBAR_S1_BPSHCFG_MASK 3 +#define CBAR_S1_BPSHCFG_NSH 3#define CBAR_S1_MEMATTR_SHIFT 12#define CBAR_S1_MEMATTR_MASK 0xf#define CBAR_S1_MEMATTR_WB 0xf
@@ -670,11 +673,16 @@ static void arm_smmu_init_context_bank(sif (smmu->version ==1 ) reg |= root_cfg->irptndx <<CBAR_IRPTNDX_SHIFT ; -/* Use the weakest memory type, so it is overridden by the pte */ -if (stage1) - reg |= (CBAR_S1_MEMATTR_WB <<CBAR_S1_MEMATTR_SHIFT ); -else +/* +* Use the weakest shareability/memory types, so they are +* overridden by the ttbcr/pte. +*/ +if (stage1) { + reg |= (CBAR_S1_BPSHCFG_NSH <<CBAR_S1_BPSHCFG_SHIFT ) | + (CBAR_S1_MEMATTR_WB <<CBAR_S1_MEMATTR_SHIFT ); + }else { reg |=ARM_SMMU_CB_VMID (root_cfg) <<CBAR_VMID_SHIFT ; + }writel_relaxed (reg, gr1_base +ARM_SMMU_GR1_CBAR (root_cfg->cbndx));if (smmu->version >1 ) {
Greg Kroah-Hartman
maintainerPATCH 141/172 perf trace: Add fallback definition of EFD_SEMAPHORE
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 79d26a6a19ace19faabf8d8d27d3430be2e26d34 upstream.
glibc 2.17 is missing this on sparc, despite the fact that it's not architecture-specific.
--- tools/perf/builtin-trace.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/builtin-trace.c +4 -0
@@ -35,6 +35,10 @@# define MADV_UNMERGEABLE 13#endif +#ifndef EFD_SEMAPHORE +# define EFD_SEMAPHORE 1 +#endif +struct tp_field {int offset;union {
Greg Kroah-Hartman
maintainerPATCH 142/172 perf: Fix hotplug splat
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit e3703f8cdfcf39c25c4338c3ad8e68891cca3731 upstream.
Drew Richardson reported that he could make the kernel go *boom* when hotplugging while having perf events active.
It turned out that when you have a group event, the code in __perf_event_exit_context() fails to remove the group siblings from the context.
We then proceed with destroying and freeing the event, and when you re-plug the CPU and try and add another event to that CPU, things go *boom* because you've still got dead entries there.
--- kernel/events/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/events/core.c +6 -6
@@ -7833,14 +7833,14 @@ static void perf_pmu_rotate_stop(structstatic void __perf_event_exit_context (void *__info) {struct perf_event_context *ctx = __info; -struct perf_event *event, *tmp; +struct perf_event *event;perf_pmu_rotate_stop (ctx->pmu); -list_for_each_entry_safe (event, tmp, &ctx->pinned_groups, group_entry) -__perf_remove_from_context (event); -list_for_each_entry_safe (event, tmp, &ctx->flexible_groups, group_entry) +rcu_read_lock (); +list_for_each_entry_rcu (event, &ctx->event_list, event_entry)__perf_remove_from_context (event); +rcu_read_unlock (); }static void perf_event_exit_cpu_context (int cpu)
@@ -7864,11 +7864,11 @@ static void perf_event_exit_cpu(int cpu) {struct swevent_htable *swhash = &per_cpu (swevent_htable, cpu); +perf_event_exit_cpu_context (cpu); +mutex_lock (&swhash->hlist_mutex);swevent_hlist_release (swhash);mutex_unlock (&swhash->hlist_mutex); - -perf_event_exit_cpu_context (cpu); }#else static inline void perf_event_exit_cpu (int cpu) { }
Greg Kroah-Hartman
maintainerPATCH 143/172 ALSA: hda - Add a fixup for HP Folio 13 mute LED
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 37c367ecdb9a01c9acc980e6e17913570a1788a7 upstream.
HP Folio 13 may have a broken BIOS that doesn't set up the mute LED GPIO properly, and the driver guesses it wrongly, too. Add a new fixup entry for setting the GPIO pin statically for this laptop.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70991
--- sound/pci/hda/patch_sigmatel.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
sound/pci/hda/patch_sigmatel.c +20 -0
@@ -98,6 +98,7 @@ enum {STAC_92HD83XXX_HP_LED ,STAC_92HD83XXX_HP_INV_LED ,STAC_92HD83XXX_HP_MIC_LED , +STAC_HP_LED_GPIO10 ,STAC_92HD83XXX_HEADSET_JACK ,STAC_92HD83XXX_HP , STAC_HP_ENVY_BASS,
@@ -2112,6 +2113,17 @@ static void stac92hd83xxx_fixup_hp_mic_l } } +static void stac92hd83xxx_fixup_hp_led_gpio10 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct sigmatel_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->gpio_led =0x10 ;/* GPIO4 */ + spec->default_polarity =0 ; + } +} +static void stac92hd83xxx_fixup_headset_jack (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -2606,6 +2618,12 @@ static const struct hda_fixup stac92hd83 .chained = true, .chain_id = STAC_92HD83XXX_HP, }, + [STAC_HP_LED_GPIO10] = { + .type = HDA_FIXUP_FUNC, + .v.func = stac92hd83xxx_fixup_hp_led_gpio10, + .chained = true, + .chain_id = STAC_92HD83XXX_HP, + }, [STAC_92HD83XXX_HEADSET_JACK] = { .type = HDA_FIXUP_FUNC, .v.func = stac92hd83xxx_fixup_headset_jack,
@@ -2684,6 +2702,8 @@ static const struct snd_pci_quirk stac92 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),SND_PCI_QUIRK (PCI_VENDOR_ID_HP ,0x1888 ,"HP Envy Spectre" ,STAC_HP_ENVY_BASS ), +SND_PCI_QUIRK (PCI_VENDOR_ID_HP ,0x1899 , +"HP Folio 13" ,STAC_HP_LED_GPIO10 ),SND_PCI_QUIRK (PCI_VENDOR_ID_HP ,0x18df ,"HP Folio" ,STAC_HP_BNB13_EQ ), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8,
Greg Kroah-Hartman
maintainerPATCH 144/172 irqchip: orion: clear bridge cause register on init
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Hesselbarth <[email protected]>
commit 7b119fd1bdc59a8060df5b659b9f7a70e0169fd6 upstream.
It is good practice to mask and clear pending irqs on init. We already mask all irqs, so also clear the bridge irq cause register.
--- drivers/irqchip/irq-orion.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-orion.c +2 -1
@@ -180,8 +180,9 @@ static int __init orion_bridge_irq_init( gc->chip_types[0 ].chip.irq_mask = irq_gc_mask_clr_bit; gc->chip_types[0 ].chip.irq_unmask = irq_gc_mask_set_bit; -/* mask all interrupts */ +/* mask and clear all interrupts */ writel (0 , gc->reg_base +ORION_BRIDGE_IRQ_MASK ); +writel (0 , gc->reg_base +ORION_BRIDGE_IRQ_CAUSE );irq_set_handler_data (irq, domain);irq_set_chained_handler (irq, orion_bridge_irq_handler);
Greg Kroah-Hartman
maintainerPATCH 145/172 irqchip: orion: use handle_edge_irq on bridge irqs
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Hesselbarth <[email protected]>
commit 5f40067fc86f0e49329ad4a852c278998ff4394e upstream.
Bridge irqs are edge-triggered, i.e. they get asserted on low-to-high transitions and not on the level of the downstream interrupt line. This replaces handle_level_irq by the more appropriate handle_edge_irq.
--- drivers/irqchip/irq-orion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-orion.c +1 -1
@@ -143,7 +143,7 @@ static int __init orion_bridge_irq_init( } ret =irq_alloc_domain_generic_chips (domain, nrirqs,1 , np->name, - handle_level_irq, clr,0 ,IRQ_GC_INIT_MASK_CACHE ); + handle_edge_irq, clr,0 ,IRQ_GC_INIT_MASK_CACHE );if (ret) {pr_err ("%s: unable to alloc irq domain gc\n" , np->name);return ret;
Greg Kroah-Hartman
maintainerPATCH 146/172 irqchip: orion: clear stale interrupts in irq_startup
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Hesselbarth <[email protected]>
commit e0318ec3bf3f1502cd11b21b1eb00aa355b40b67 upstream.
Bridge IRQ_CAUSE bits are asserted regardless of the corresponding bit in IRQ_MASK register. To avoid interrupt events on stale irqs, we have to clear them before unmask. This installs an .irq_startup callback to ensure stale irqs are cleared before initial unmask.
--- drivers/irqchip/irq-orion.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/irqchip/irq-orion.c +14 -0
@@ -123,6 +123,19 @@ static void orion_bridge_irq_handler(uns } } +/* +* Bridge IRQ_CAUSE is asserted regardless of IRQ_MASK register. +* To avoid interrupt events on stale irqs, we clear them before unmask. +*/ +static unsigned int orion_bridge_irq_startup (struct irq_data *d) +{ +struct irq_chip_type *ct =irq_data_get_chip_type (d); + + ct->chip.irq_ack (d); + ct->chip.irq_unmask (d); +return 0 ; +} +static int __init orion_bridge_irq_init (struct device_node *np,struct device_node *parent) {
@@ -176,6 +189,7 @@ static int __init orion_bridge_irq_init( gc->chip_types[0 ].regs.ack =ORION_BRIDGE_IRQ_CAUSE ; gc->chip_types[0 ].regs.mask =ORION_BRIDGE_IRQ_MASK ; + gc->chip_types[0 ].chip.irq_startup = orion_bridge_irq_startup; gc->chip_types[0 ].chip.irq_ack = irq_gc_ack_clr_bit; gc->chip_types[0 ].chip.irq_mask = irq_gc_mask_clr_bit; gc->chip_types[0 ].chip.irq_unmask = irq_gc_mask_set_bit;
Greg Kroah-Hartman
maintainerPATCH 147/172 irqchip: orion: Fix getting generic chip pointer.
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Lunn <[email protected]>
commit d86e9af6336c0ad586a5dbd70064253d40bbb5ff upstream.
Enabling SPARSE_IRQ shows up a bug in the irq-orion bridge interrupt handler. The bridge interrupt is implemented using a single generic chip. Thus the parameter passed to irq_get_domain_generic_chip() should always be zero.
--- drivers/irqchip/irq-orion.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-orion.c +2 -1
@@ -111,7 +111,8 @@ IRQCHIP_DECLARE(orion_intc, "marvell,oristatic void orion_bridge_irq_handler (unsigned int irq,struct irq_desc *desc) {struct irq_domain *d =irq_get_handler_data (irq); -struct irq_chip_generic *gc =irq_get_domain_generic_chip (d, irq); + +struct irq_chip_generic *gc =irq_get_domain_generic_chip (d,0 );u32 stat =readl_relaxed (gc->reg_base +ORION_BRIDGE_IRQ_CAUSE ) & gc->mask_cache;
Greg Kroah-Hartman
maintainerPATCH 148/172 xtensa: save current register frame in fast_syscall_spill_registers_fixup
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 3251f1e27a5a17f0efd436cfd1e7b9896cfab0a0 upstream.
We need it saved because it contains a3 where we track which register windows we still need to spill, and fixup handler may call C exception handlers. Also fix comments.
--- arch/xtensa/kernel/entry.S | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/xtensa/kernel/entry.S +12 -0
@@ -1117,6 +1117,13 @@ ENDPROC(fast_syscall_spill_registers) * We basically restore WINDOWBASE and WINDOWSTART to the condition when * we entered the spill routine and jump to the user exception handler. * + * Note that we only need to restore the bits in windowstart that have not + * been spilled yet by the _spill_register routine. Luckily, a3 contains a + * rotated windowstart with only those bits set for frames that haven't been + * spilled yet. Because a3 is rotated such that bit 0 represents the register + * frame for the current windowbase - 1, we need to rotate a3 left by the + * value of the current windowbase + 1 and move it to windowstart. + * * a0: value of depc, original value in depc * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE * a3: exctable, original value in excsave1
@@ -1131,10 +1138,15 @@ ENTRY(fast_syscall_spill_registers_fixup /* We need to make sure the current registers (a0-a3) are preserved. * To do this, we simply set the bit for the current window frame * in WS, so that the exception handlers save them to the task stack. + * + * Note: we use a3 to set the windowbase, so we take a special care + * of it, saving it in the original _spill_registers frame across + * the exception handler call. */ xsr a3, excsave1 # get spill-mask slli a3, a3, 1 # shift left by one + addi a3, a3, 1 # set the bit for the current window frame slli a2, a3, 32-WSBITS src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy......
Greg Kroah-Hartman
maintainerPATCH 149/172 xtensa: introduce spill_registers_kernel macro
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit e2fd1374c705abe4661df3fb6fadb3879c7c1846 upstream.
Most in-kernel users want registers spilled on the kernel stack and don't require PS.EXCM to be set. That means that they don't need fixup routine and could reuse regular window overflow mechanism for that, which makes spill routine very simple.
--- arch/xtensa/include/asm/traps.h | 44 ++++++++++++++++++----------- arch/xtensa/kernel/entry.S | 60 ++++++++++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 28 deletions(-)
arch/xtensa/include/asm/traps.h +28 -16
@@ -22,25 +22,37 @@ extern void do_unhandled(struct pt_regsstatic inline void spill_registers (void ) { - +#if XCHAL_NUM_AREGS >16 __asm__ __volatile__ ( - "movi a14, "__stringify((1 << PS_EXCM_BIT) | LOCKLEVEL)"\n\t" - "mov a12, a0\n\t" - "rsr a13, sar\n\t" - "xsr a14, ps\n\t" - "movi a0, _spill_registers\n\t" - "rsync\n\t" - "callx0 a0\n\t" - "mov a0, a12\n\t" - "wsr a13, sar\n\t" - "wsr a14, ps\n\t" - : : -#if defined(CONFIG_FRAME_POINTER ) - : "a2", "a3", "a4", "a11", "a12", "a13", "a14", "a15", +" call12 1f\n" +" _j 2f\n" +" retw\n" +" .align 4\n" +"1:\n" +" _entry a1, 48\n" +" addi a12, a0, 3\n" +#if XCHAL_NUM_AREGS > 32 + " .rept (" __stringify(XCHAL_NUM_AREGS) " - 32) / 12\n" +" _entry a1, 48\n" +" mov a12, a0\n" + " .endr\n" +#endif + " _entry a1, 48\n" +#if XCHAL_NUM_AREGS %12 ==0 + " mov a8, a8\n" +#elif XCHAL_NUM_AREGS %12 ==4 + " mov a12, a12\n" +#elif XCHAL_NUM_AREGS %12 ==8 + " mov a4, a4\n" +#endif + " retw\n" + "2:\n" + : : : "a12", "a13", "memory");#else - : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", + __asm__ __volatile__ ( +" mov a12, a12\n" + : : :"memory" );#endif - "memory"); }#endif /* _XTENSA_TRAPS_H */
arch/xtensa/kernel/entry.S +48 -12
95 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 150/172 SELinux: bigendian problems with filename trans rules
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Paris <[email protected]>
commit 9085a6422900092886da8c404e1c5340c4ff1cbf upstream.
When writing policy via /sys/fs/selinux/policy I wrote the type and class of filename trans rules in CPU endian instead of little endian. On x86_64 this works just fine, but it means that on big endian arch's like ppc64 and s390 userspace reads the policy and converts it from le32_to_cpu. So the values are all screwed up. Write the values in le format like it should have been to start.
--- security/selinux/ss/policydb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
security/selinux/ss/policydb.c +4 -4
@@ -3260,10 +3260,10 @@ static int filename_write_helper(void *kif (rc)return rc; - buf[0 ] = ft->stype; - buf[1 ] = ft->ttype; - buf[2 ] = ft->tclass; - buf[3 ] = otype->otype; + buf[0 ] =cpu_to_le32 (ft->stype); + buf[1 ] =cpu_to_le32 (ft->ttype); + buf[2 ] =cpu_to_le32 (ft->tclass); + buf[3 ] =cpu_to_le32 (otype->otype); rc =put_entry (buf,sizeof (u32),4 , fp);if (rc)
Greg Kroah-Hartman
maintainerPATCH 151/172 ioat: fix tasklet tear down
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit da87ca4d4ca101f177fffd84f1f0a5e4c0343557 upstream.
Since commit 77873803363c "net_dma: mark broken" we no longer pin dma engines active for the network-receive-offload use case. As a result the ->free_chan_resources() that occurs after the driver self test no longer has a NET_DMA induced ->alloc_chan_resources() to back it up. A late firing irq can lead to ksoftirqd spinning indefinitely due to the tasklet_disable() performed by ->free_chan_resources(). Only ->alloc_chan_resources() can clear this condition in affected kernels.
This problem has been present since commit 3e037454bcfa "I/OAT: Add support for MSI and MSI-X" in 2.6.24, but is now exposed. Given the NET_DMA use case is deprecated we can revisit moving the driver to use threaded irqs. For now, just tear down the irq and tasklet properly by:
1/ Disable the irq from triggering the tasklet
2/ Disable the irq from re-arming
3/ Flush inflight interrupts
4/ Flush the timer
5/ Flush inflight tasklets
References:
https://lkml.org/lkml/2014/1/27/282
https://lkml.org/lkml/2014/2/19/672
--- drivers/dma/ioat/dma.c | 52 +++++++++++++++++++++++++++++++++++++++------- drivers/dma/ioat/dma.h | 1 drivers/dma/ioat/dma_v2.c | 11 ++++----- drivers/dma/ioat/dma_v3.c | 3 ++ 4 files changed, 54 insertions(+), 13 deletions(-)
drivers/dma/ioat/dma.c +45 -7
@@ -77,7 +77,8 @@ static irqreturn_t ioat_dma_do_interrupt attnstatus =readl (instance->reg_base +IOAT_ATTNSTATUS_OFFSET );for_each_set_bit (bit, &attnstatus,BITS_PER_LONG ) { chan =ioat_chan_by_index (instance, bit); -tasklet_schedule (&chan->cleanup_task); +if (test_bit (IOAT_RUN , &chan->state)) +tasklet_schedule (&chan->cleanup_task); }writeb (intrctrl, instance->reg_base +IOAT_INTRCTRL_OFFSET );
@@ -93,7 +94,8 @@ static irqreturn_t ioat_dma_do_interrupt {struct ioat_chan_common *chan = data; -tasklet_schedule (&chan->cleanup_task); +if (test_bit (IOAT_RUN , &chan->state)) +tasklet_schedule (&chan->cleanup_task);return IRQ_HANDLED ; }
@@ -116,7 +118,6 @@ void ioat_init_channel(struct ioatdma_de chan->timer.function = device->timer_fn; chan->timer.data = data;tasklet_init (&chan->cleanup_task, device->cleanup_fn, data); -tasklet_disable (&chan->cleanup_task); }/**
@@ -354,13 +355,49 @@ static int ioat1_dma_alloc_chan_resourcewritel (((u64 ) chan->completion_dma) >>32 , chan->reg_base +IOAT_CHANCMP_OFFSET_HIGH ); -tasklet_enable (&chan->cleanup_task); +set_bit (IOAT_RUN , &chan->state);ioat1_dma_start_null_desc (ioat);/* give chain to dma device */ dev_dbg (to_dev (chan),"%s: allocated %d descriptors\n" , __func__, ioat->desccount);return ioat->desccount; } +void ioat_stop (struct ioat_chan_common *chan) +{ +struct ioatdma_device *device = chan->device; +struct pci_dev *pdev = device->pdev; +int chan_id =chan_num (chan); +struct msix_entry *msix; + +/* 1/ stop irq from firing tasklets +* 2/ stop the tasklet from re-arming irqs +*/ +clear_bit (IOAT_RUN , &chan->state); + +/* flush inflight interrupts */ +switch (device->irq_mode) { +case IOAT_MSIX : + msix = &device->msix_entries[chan_id]; +synchronize_irq (msix->vector); +break ; +case IOAT_MSI : +case IOAT_INTX : +synchronize_irq (pdev->irq); +break ; +default : +break ; + } + +/* flush inflight timers */ +del_timer_sync (&chan->timer); + +/* flush inflight tasklet runs */ +tasklet_kill (&chan->cleanup_task); + +/* final cleanup now that everything is quiesced and can't re-arm */ + device->cleanup_fn ((unsigned long ) &chan->common); +} +/** * ioat1_dma_free_chan_resources - release all the descriptors * @chan: the channel to be cleaned
@@ -379,9 +416,7 @@ static void ioat1_dma_free_chan_resourceif (ioat->desccount ==0 )return ; -tasklet_disable (&chan->cleanup_task); -del_timer_sync (&chan->timer); -ioat1_cleanup (ioat); +ioat_stop (chan);/* Delay 100ms after reset to allow internal DMA logic to quiesce * before removing DMA descriptor resources.
@@ -526,8 +561,11 @@ ioat1_dma_prep_memcpy(struct dma_chan *cstatic void ioat1_cleanup_event (unsigned long data) {struct ioat_dma_chan *ioat =to_ioat_chan ((void *) data); +struct ioat_chan_common *chan = &ioat->base;ioat1_cleanup (ioat); +if (!test_bit (IOAT_RUN , &chan->state)) +return ;writew (IOAT_CHANCTRL_RUN , ioat->base.reg_base +IOAT_CHANCTRL_OFFSET ); }
drivers/dma/ioat/dma.h +1 -0
@@ -356,6 +356,7 @@ bool ioat_cleanup_preamble(struct ioat_cvoid ioat_kobject_add (struct ioatdma_device *device,struct kobj_type *type);void ioat_kobject_del (struct ioatdma_device *device);int ioat_dma_setup_interrupts (struct ioatdma_device *device); +void ioat_stop (struct ioat_chan_common *chan);extern const struct sysfs_ops ioat_sysfs_ops;extern struct ioat_sysfs_entry ioat_version_attr;extern struct ioat_sysfs_entry ioat_cap_attr;
drivers/dma/ioat/dma_v2.c +5 -6
@@ -190,8 +190,11 @@ static void ioat2_cleanup(struct ioat2_dvoid ioat2_cleanup_event (unsigned long data) {struct ioat2_dma_chan *ioat =to_ioat2_chan ((void *) data); +struct ioat_chan_common *chan = &ioat->base;ioat2_cleanup (ioat); +if (!test_bit (IOAT_RUN , &chan->state)) +return ;writew (IOAT_CHANCTRL_RUN , ioat->base.reg_base +IOAT_CHANCTRL_OFFSET ); }
@@ -553,10 +556,10 @@ int ioat2_alloc_chan_resources(struct dm ioat->issued =0 ; ioat->tail =0 ; ioat->alloc_order = order; +set_bit (IOAT_RUN , &chan->state);spin_unlock_bh (&ioat->prep_lock);spin_unlock_bh (&chan->cleanup_lock); -tasklet_enable (&chan->cleanup_task);ioat2_start_null_desc (ioat);/* check that we got off the ground */
@@ -566,7 +569,6 @@ int ioat2_alloc_chan_resources(struct dm }while (i++ <20 && !is_ioat_active (status) && !is_ioat_idle (status));if (is_ioat_active (status) ||is_ioat_idle (status)) { -set_bit (IOAT_RUN , &chan->state);return 1 << ioat->alloc_order; }else {u32 chanerr =readl (chan->reg_base +IOAT_CHANERR_OFFSET );
@@ -809,11 +811,8 @@ void ioat2_free_chan_resources(struct dmif (!ioat->ring)return ; -tasklet_disable (&chan->cleanup_task); -del_timer_sync (&chan->timer); - device->cleanup_fn ((unsigned long ) c); +ioat_stop (chan); device->reset_hw (chan); -clear_bit (IOAT_RUN , &chan->state);spin_lock_bh (&chan->cleanup_lock);spin_lock_bh (&ioat->prep_lock);
drivers/dma/ioat/dma_v3.c +3 -0
@@ -464,8 +464,11 @@ static void ioat3_cleanup(struct ioat2_dstatic void ioat3_cleanup_event (unsigned long data) {struct ioat2_dma_chan *ioat =to_ioat2_chan ((void *) data); +struct ioat_chan_common *chan = &ioat->base;ioat3_cleanup (ioat); +if (!test_bit (IOAT_RUN , &chan->state)) +return ;writew (IOAT_CHANCTRL_RUN , ioat->base.reg_base +IOAT_CHANCTRL_OFFSET ); }
Greg Kroah-Hartman
maintainerPATCH 152/172 quota: Fix race between dqput() and dquot_scan_active()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 1362f4ea20fa63688ba6026e586d9746ff13a846 upstream.
Currently last dqput() can race with dquot_scan_active() causing it to call callback for an already deactivated dquot. The race is as follows:
CPU1 CPU2
dqput()
spin_lock(&dq_list_lock);
if (atomic_read(&dquot->dq_count) > 1) {
- not taken
if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
spin_unlock(&dq_list_lock);
->release_dquot(dquot);
if (atomic_read(&dquot->dq_count) > 1)
- not taken
dquot_scan_active()
spin_lock(&dq_list_lock);
if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
- not taken
atomic_inc(&dquot->dq_count);
spin_unlock(&dq_list_lock);
- proceeds to release dquot
ret = fn(dquot, priv);
- called for inactive dquotFix the problem by making sure possible ->release_dquot() is finished by the time we call the callback and new calls to it will notice reference dquot_scan_active() has taken and bail out.
--- fs/quota/dquot.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/quota/dquot.c +11 -3
@@ -581,9 +581,17 @@ int dquot_scan_active(struct super_blockdqstats_inc (DQST_LOOKUPS );dqput (old_dquot); old_dquot = dquot; - ret =fn (dquot, priv); -if (ret <0 ) - goto out; +/* +* ->release_dquot() can be racing with us. Our reference +* protects us from new calls to it so just wait for any +* outstanding call and recheck the DQ_ACTIVE_B after that. +*/ +wait_on_dquot (dquot); +if (test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) { + ret =fn (dquot, priv); +if (ret <0 ) + goto out; + }spin_lock (&dq_list_lock);/* We are safe to continue now because our dquot could not * be moved out of the inuse list while we hold the reference */
Greg Kroah-Hartman
maintainerPATCH 153/172 ipc,mqueue: remove limits for the amount of system-wide queues
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
commit f3713fd9cff733d9df83116422d8e4af6e86b2bb upstream.
Commit 93e6f119c0ce ("ipc/mqueue: cleanup definition names and locations") added global hardcoded limits to the amount of message queues that can be created. While these limits are per-namespace, reality is that it ends up breaking userspace applications. Historically users have, at least in theory, been able to create up to INT_MAX queues, and limiting it to just 1024 is way too low and dramatic for some workloads and use cases. For instance, Madars reports:
"This update imposes bad limits on our multi-process application. As
our app uses approaches that each process opens its own set of queues (usually something about 3-5 queues per process). In some scenarios we might run up to 3000 processes or more (which of-course for linux is not a problem). Thus we might need up to 9000 queues or more. All processes run under one user."
Other affected users can be found in launchpad bug #1155695:
https://bugs.launchpad.net/ubuntu/+source/manpages/+bug/1155695
Instead of increasing this limit, revert it entirely and fallback to the original way of dealing queue limits -- where once a user's resource limit is reached, and all memory is used, new queues cannot be created.
--- include/linux/ipc_namespace.h | 2 -- ipc/mq_sysctl.c | 18 ++++++++++++------ ipc/mqueue.c | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-)
include/linux/ipc_namespace.h +0 -2
@@ -119,9 +119,7 @@ extern int mq_init_ns(struct ipc_namespa* the new maximum will handle anyone else. I may have to revisit this * in the future. */ -#define MIN_QUEUESMAX 1#define DFLT_QUEUESMAX 256 -#define HARD_QUEUESMAX 1024#define MIN_MSGMAX 1#define DFLT_MSG 10U#define DFLT_MSGMAX 10
ipc/mq_sysctl.c +12 -6
@@ -22,6 +22,16 @@ static void *get_mq(ctl_table *table)return which; } +static int proc_mq_dointvec (ctl_table *table,int write, +void __user *buffer,size_t *lenp,loff_t *ppos) +{ +struct ctl_table mq_table; +memcpy (&mq_table, table,sizeof (mq_table)); + mq_table.data =get_mq (table); + +return proc_dointvec (&mq_table, write, buffer, lenp, ppos); +} +static int proc_mq_dointvec_minmax (ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos) {
@@ -33,12 +43,10 @@ static int proc_mq_dointvec_minmax(ctl_t lenp, ppos); }#else +#define proc_mq_dointvec NULL#define proc_mq_dointvec_minmax NULL#endif -static int msg_queues_limit_min =MIN_QUEUESMAX ; -static int msg_queues_limit_max =HARD_QUEUESMAX ; -static int msg_max_limit_min =MIN_MSGMAX ;static int msg_max_limit_max =HARD_MSGMAX ;
@@ -51,9 +59,7 @@ static ctl_table mq_sysctls[] = { .data = &init_ipc_ns.mq_queues_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_mq_dointvec_minmax, - .extra1 = &msg_queues_limit_min, - .extra2 = &msg_queues_limit_max, + .proc_handler = proc_mq_dointvec, }, { .procname = "msg_max",
ipc/mqueue.c +3 -3
@@ -433,9 +433,9 @@ static int mqueue_create(struct inode *d error = -EACCES ; goto out_unlock; } -if (ipc_ns->mq_queues_count >=HARD_QUEUESMAX || - (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && - !capable (CAP_SYS_RESOURCE ))) { + +if (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && + !capable (CAP_SYS_RESOURCE )) { error = -ENOSPC ; goto out_unlock; }
Greg Kroah-Hartman
maintainerPATCH 154/172 Input - arizona-haptics: Fix double lock of dapm_mutex
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit c4204960e9d0ba99459dbf1db918f99a45e7a62a upstream.
snd_soc_dapm_sync takes the dapm_mutex internally, but we currently take it externally as well. This patch fixes this.
--- drivers/input/misc/arizona-haptics.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/input/misc/arizona-haptics.c +4 -7
@@ -77,16 +77,14 @@ static void arizona_haptics_work(structreturn ; } +mutex_unlock (dapm_mutex); + ret =snd_soc_dapm_sync (arizona->dapm);if (ret !=0 ) {dev_err (arizona->dev,"Failed to sync DAPM: %d\n" , ret); -mutex_unlock (dapm_mutex);return ; } - -mutex_unlock (dapm_mutex); - }else {/* This disable sequence will be a noop if already enabled */ mutex_lock_nested (dapm_mutex,SND_SOC_DAPM_CLASS_RUNTIME );
@@ -99,16 +97,15 @@ static void arizona_haptics_work(structreturn ; } +mutex_unlock (dapm_mutex); + ret =snd_soc_dapm_sync (arizona->dapm);if (ret !=0 ) {dev_err (arizona->dev,"Failed to sync DAPM: %d\n" , ret); -mutex_unlock (dapm_mutex);return ; } -mutex_unlock (dapm_mutex); - ret = regmap_update_bits(arizona->regmap, ARIZONA_HAPTICS_CONTROL_1, ARIZONA_HAP_CTRL_MASK,
Greg Kroah-Hartman
maintainerPATCH 155/172 mm, thp: fix infinite loop on memcg OOM
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kirill A. Shutemov" <[email protected]>
commit 9845cbbd113fbb5b769a45d8e88dc47bc12df4e0 upstream.
Masayoshi Mizuma reported a bug with the hang of an application under the memcg limit. It happens on write-protection fault to huge zero page
If we successfully allocate a huge page to replace zero page but hit the memcg limit we need to split the zero page with split_huge_page_pmd() and fallback to small pages.
The other part of the problem is that VM_FAULT_OOM has special meaning in do_huge_pmd_wp_page() context. __handle_mm_fault() expects the page to be split if it sees VM_FAULT_OOM and it will will retry page fault handling. This causes an infinite loop if the page was not split.
do_huge_pmd_wp_zero_page_fallback() can return VM_FAULT_OOM if it failed to allocate one small page, so fallback to small pages will not help.
The solution for this part is to replace VM_FAULT_OOM with VM_FAULT_FALLBACK is fallback required.
--- mm/huge_memory.c | 9 ++++++--- mm/memory.c | 14 +++----------- 2 files changed, 9 insertions(+), 14 deletions(-)
mm/huge_memory.c +6 -3
@@ -1160,8 +1160,10 @@ alloc: }else { ret =do_huge_pmd_wp_page_fallback (mm, vma, address, pmd, orig_pmd, page, haddr); -if (ret &VM_FAULT_OOM ) +if (ret &VM_FAULT_OOM ) {split_huge_page (page); + ret |=VM_FAULT_FALLBACK ; + }put_page (page); }count_vm_event (THP_FAULT_FALLBACK );
@@ -1173,9 +1175,10 @@ alloc:if (page) {split_huge_page (page);put_page (page); - } + }else +split_huge_page_pmd (vma, address, pmd); + ret |=VM_FAULT_FALLBACK ;count_vm_event (THP_FAULT_FALLBACK ); - ret |=VM_FAULT_OOM ; goto out; }
mm/memory.c +3 -11
@@ -3700,7 +3700,6 @@ static int __handle_mm_fault(struct mm_sif (unlikely (is_vm_hugetlb_page (vma)))return hugetlb_fault (mm, vma, address, flags); -retry: pgd =pgd_offset (mm, address); pud =pud_alloc (mm, pgd, address);if (!pud)
@@ -3738,20 +3737,13 @@ retry:if (dirty && !pmd_write (orig_pmd)) { ret =do_huge_pmd_wp_page (mm, vma, address, pmd, orig_pmd); -/* -* If COW results in an oom, the huge pmd will -* have been split, so retry the fault on the -* pte for a smaller charge. -*/ -if (unlikely (ret &VM_FAULT_OOM )) - goto retry; -return ret; +if (!(ret &VM_FAULT_FALLBACK )) +return ret; }else {huge_pmd_set_accessed (mm, vma, address, pmd, orig_pmd, dirty); +return 0 ; } - -return 0 ; } }
Greg Kroah-Hartman
maintainerPATCH 156/172 irq-metag*: stop set_affinity vectoring to offline cpus
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit f229006ec6beabf7b844653d92fa61f025fe3dcf upstream.
Fix irq_set_affinity callbacks in the Meta IRQ chip drivers to AND cpu_online_mask into the cpumask when picking a CPU to vector the interrupt to.
As Thomas pointed out, the /proc/irq/$N/smp_affinity interface doesn't filter out offline CPUs, so without this patch if you offline CPU0 and set an IRQ affinity to 0x3 it vectors the interrupt onto CPU0 even though it is offline.
--- drivers/irqchip/irq-metag-ext.c | 2 +- drivers/irqchip/irq-metag.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-metag-ext.c +1 -1
@@ -515,7 +515,7 @@ static int meta_intc_set_affinity(struct* one cpu (the interrupt code doesn't support it), so we just * pick the first cpu we find in 'cpumask'. */ - cpu =cpumask_any (cpumask); + cpu =cpumask_any_and (cpumask, cpu_online_mask); thread = cpu_2_hwthread_id[cpu];metag_out32 (TBI_TRIG_VEC (TBID_SIGNUM_TR2 (thread)), vec_addr);
drivers/irqchip/irq-metag.c +1 -1
@@ -201,7 +201,7 @@ static int metag_internal_irq_set_affini* one cpu (the interrupt code doesn't support it), so we just * pick the first cpu we find in 'cpumask'. */ - cpu =cpumask_any (cpumask); + cpu =cpumask_any_and (cpumask, cpu_online_mask); thread = cpu_2_hwthread_id[cpu]; metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)),
Greg Kroah-Hartman
maintainerPATCH 157/172 ARM64: unwind: Fix PC calculation
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olof Johansson <[email protected]>
commit e306dfd06fcb44d21c80acb8e5a88d55f3d1cf63 upstream.
The frame PC value in the unwind code used to just take the saved LR value and use that. That's incorrect as a stack trace, since it shows the return path stack, not the call path stack.
In particular, it shows faulty information in case the bl is done as the very last instruction of one label, since the return point will be in the next label. That can easily be seen with tail calls to panic(), which is marked __noreturn and thus doesn't have anything useful after it.
Easiest here is to just correct the unwind code and do a -4, to get the actual call site for the backtrace instead of the return site.
--- arch/arm64/kernel/stacktrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kernel/stacktrace.c +5 -1
@@ -48,7 +48,11 @@ int unwind_frame(struct stackframe *fram frame->sp = fp +0x10 ; frame->fp = *(unsigned long *)(fp); - frame->pc = *(unsigned long *)(fp +8 ); +/* +* -4 here because we care about the PC at time of bl, +* not where the return will go. +*/ + frame->pc = *(unsigned long *)(fp +8 ) -4 ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 158/172 qla2xxx: Fix kernel panic on selective retransmission request
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Dr. Greg Wettstein" <[email protected]>
commit 6f58c780e5a5b43a6d2121e0d43cdcba1d3cc5fc upstream.
A selective retransmission request (SRR) is a fibre-channel protocol control request which provides support for requesting retransmission of a data sequence in response to an issue such as frame loss or corruption. These events are experienced infrequently in fibre-channel based networks which makes it difficult to test and assess codepaths which handle these events.
We were fortunate enough, for some definition of fortunate, to have a metro-area single-mode SAN link which, at 10 GBPS sustained load levels, would consistently generate SRR's in a SCST based target implementation using our SCST/in-kernel Qlogic target interface driver. In response to an SRR the in-kernel Qlogic target driver immediately panics resulting in a catastrophic storage failure for serviced initiators.
The culprit was a debug statement in the qla_target.c file which does not verify that a pointer to the SCSI CDB is not null. The unchecked pointer dereference results in the kernel panic and resultant system failure.
The other two references to the SCSI CDB by the SRR handling code use a ternary operator to verify a non-null pointer is being acted on. This patch simply adds a similar test to the implicated debug statement.
This patch is a candidate for any stable kernel being maintained since it addresses a potentially catastrophic event with minimal downside.
--- drivers/scsi/qla2xxx/qla_target.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.c +2 -1
@@ -3186,7 +3186,8 @@ restart:ql_dbg (ql_dbg_tgt_mgt, vha,0xf02c ,"SRR cmd %p (se_cmd %p, tag %d, op %x), " "sg_cnt=%d, offset=%d" , cmd, &cmd->se_cmd, cmd->tag, - se_cmd->t_task_cdb[0 ], cmd->sg_cnt, cmd->offset); + se_cmd->t_task_cdb ? se_cmd->t_task_cdb[0 ] :0 , + cmd->sg_cnt, cmd->offset);qlt_handle_srr (vha, sctio, imm);
Greg Kroah-Hartman
maintainerPATCH 159/172 i7300_edac: Fix device reference count
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 75135da0d68419ef8a925f4c1d5f63d8046e314d upstream.
pci_get_device() decrements the reference count of "from" (last argument) so when we break off the loop successfully we have only one device reference - and we don't know which device we have. If we want a reference to each device, we must take them explicitly and let the pci_get_device() walk complete to avoid duplicate references.
This is serious, as over-putting device references will cause the device to eventually disappear. Without this fix, the kernel crashes after a few insmod/rmmod cycles.
Tested on an Intel S7000FC4UR system with a 7300 chipset.
--- drivers/edac/i7300_edac.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
drivers/edac/i7300_edac.c +20 -18
@@ -943,33 +943,35 @@ static int i7300_get_devices(struct mem_/* Attempt to 'get' the MCH register we want */ pdev =NULL ; -while (!pvt->pci_dev_16_1_fsb_addr_map || - !pvt->pci_dev_16_2_fsb_err_regs) { - pdev =pci_get_device (PCI_VENDOR_ID_INTEL , -PCI_DEVICE_ID_INTEL_I7300_MCH_ERR , pdev); -if (!pdev) { -/* End of list, leave */ -i7300_printk (KERN_ERR , -"'system address,Process Bus' " -"device not found:" -"vendor 0x%x device 0x%x ERR funcs " -"(broken BIOS?)\n" , -PCI_VENDOR_ID_INTEL , -PCI_DEVICE_ID_INTEL_I7300_MCH_ERR ); - goto error; - } - +while ((pdev =pci_get_device (PCI_VENDOR_ID_INTEL , +PCI_DEVICE_ID_INTEL_I7300_MCH_ERR , + pdev))) {/* Store device 16 funcs 1 and 2 */ switch (PCI_FUNC (pdev->devfn)) {case 1 : - pvt->pci_dev_16_1_fsb_addr_map = pdev; +if (!pvt->pci_dev_16_1_fsb_addr_map) + pvt->pci_dev_16_1_fsb_addr_map = +pci_dev_get (pdev);break ;case 2 : - pvt->pci_dev_16_2_fsb_err_regs = pdev; +if (!pvt->pci_dev_16_2_fsb_err_regs) + pvt->pci_dev_16_2_fsb_err_regs = +pci_dev_get (pdev);break ; } } +if (!pvt->pci_dev_16_1_fsb_addr_map || + !pvt->pci_dev_16_2_fsb_err_regs) { +/* At least one device was not found */ +i7300_printk (KERN_ERR , +"'system address,Process Bus' device not found:" +"vendor 0x%x device 0x%x ERR funcs (broken BIOS?)\n" , +PCI_VENDOR_ID_INTEL , +PCI_DEVICE_ID_INTEL_I7300_MCH_ERR ); + goto error; + } + edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", pci_name(pvt->pci_dev_16_0_fsb_ctlr), pvt->pci_dev_16_0_fsb_ctlr->vendor,
Greg Kroah-Hartman
maintainerPATCH 160/172 PM / hibernate: Fix restore hang in freeze_processes()
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Capella <[email protected]>
commit f8d5b9e9e5372f0deb7bc1ab1088a9b60b0a793d upstream.
During restore, pm_notifier chain are called with PM_RESTORE_PREPARE. The firmware_class driver handler fw_pm_notify does not have a handler for this. As a result, it keeps a reader on the kmod.c umhelper_sem. During freeze_processes, the call to __usermodehelper_disable tries to take a write lock on this semaphore and hangs waiting.
--- drivers/base/firmware_class.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/firmware_class.c +1 -0
@@ -1541,6 +1541,7 @@ static int fw_pm_notify(struct notifier_switch (mode) {case PM_HIBERNATION_PREPARE :case PM_SUSPEND_PREPARE : +case PM_RESTORE_PREPARE :kill_requests_without_uevent ();device_cache_fw_images ();break ;
Greg Kroah-Hartman
maintainerPATCH 161/172 dma: ste_dma40: dont dereference free:d descriptor
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit e9baa9d9d520fb0e24cca671e430689de2d4a4b2 upstream.
It appears that in the DMA40 driver the DMA tasklet will very often dereference memory for a descriptor just free:d from the DMA40 slab. Nothing happens because no other part of the driver has yet had a chance to claim this memory, but it's really nasty to dereference free:d memory, so let's check the flag before the descriptor is free and store it in a bool variable.
--- drivers/dma/ste_dma40.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/ste_dma40.c +3 -1
@@ -1641,6 +1641,7 @@ static void dma_tasklet(unsigned long dastruct d40_chan *d40c = (struct d40_chan *) data;struct d40_desc *d40d;unsigned long flags; +bool callback_active;dma_async_tx_callback callback;void *callback_param;
@@ -1668,6 +1669,7 @@ static void dma_tasklet(unsigned long da }/* Callback to client */ + callback_active = !!(d40d->txd.flags &DMA_PREP_INTERRUPT ); callback = d40d->txd.callback; callback_param = d40d->txd.callback_param;
@@ -1690,7 +1692,7 @@ static void dma_tasklet(unsigned long daspin_unlock_irqrestore (&d40c->lock, flags); -if (callback && (d40d->txd.flags &DMA_PREP_INTERRUPT )) +if (callback_active && callback)callback (callback_param);return ;
Greg Kroah-Hartman
maintainerPATCH 162/172 dm mpath: fix stalls when handling invalid ioctls
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
commit a1989b330093578ea5470bea0a00f940c444c466 upstream.
An invalid ioctl will never be valid, irrespective of whether multipath has active paths or not. So for invalid ioctls we do not have to wait for multipath to activate any paths, but can rather return an error code immediately. This fix resolves numerous instances of:
udevd[]: worker [] unexpectedly returned with status 0x0100
that have been seen during testing.
--- drivers/md/dm-mpath.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/dm-mpath.c +5 -2
@@ -1626,8 +1626,11 @@ static int multipath_ioctl(struct dm_tar/* * Only pass ioctls through if the device sizes match exactly. */ -if (!r && ti->len !=i_size_read (bdev->bd_inode) >>SECTOR_SHIFT ) - r =scsi_verify_blk_ioctl (NULL , cmd); +if (!bdev || ti->len !=i_size_read (bdev->bd_inode) >>SECTOR_SHIFT ) { +int err =scsi_verify_blk_ioctl (NULL , cmd); +if (err) + r = err; + }if (r == -ENOTCONN && !fatal_signal_pending (current))queue_work (kmultipathd, &m->process_queued_ios);
Greg Kroah-Hartman
maintainerPATCH 163/172 dm cache: move hook_info into common portion of per_bio_data structure
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit c6eda5e81c4fcc77185117255c7419eda771f67f upstream.
Commit c9d28d5d ("dm cache: promotion optimisation for writes") incorrectly placed the 'hook_info' member in the writethrough-only portion of the per_bio_data structure.
Given that the overwrite optimization may be used for writeback the 'hook_info' member must be placed above the 'cache' member of the per_bio_data structure. Any members above 'cache' are available from both writeback and writethrough modes' per_bio_data structure.
--- drivers/md/dm-cache-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-cache-target.c +1 -1
@@ -283,6 +283,7 @@ struct per_bio_data { bool tick:1; unsigned req_nr:2;struct dm_deferred_entry *all_io_entry; +struct dm_hook_info hook_info;/* * writethrough fields. These MUST remain at the end of this
@@ -291,7 +292,6 @@ struct per_bio_data {*/ struct cache *cache;dm_cblock_t cblock; -struct dm_hook_info hook_info;struct dm_bio_details bio_details; };
Greg Kroah-Hartman
maintainerPATCH 164/172 dm thin: avoid metadata commit if a pools thin devices havent changed
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 4d1662a30dde6e545086fe0e8fd7e474c4e0b639 upstream.
Commit 905e51b ("dm thin: commit outstanding data every second") introduced a periodic commit. This commit occurs regardless of whether any thin devices have made changes.
Fix the periodic commit to check if any of a pool's thin devices have changed using dm_pool_changed_this_transaction().
--- drivers/md/dm-thin-metadata.c | 17 +++++++++++++++++ drivers/md/dm-thin-metadata.h | 2 ++ drivers/md/dm-thin.c | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-)
drivers/md/dm-thin-metadata.c +17 -0
@@ -1489,6 +1489,23 @@ bool dm_thin_changed_this_transaction(streturn r; } +bool dm_pool_changed_this_transaction (struct dm_pool_metadata *pmd) +{ +bool r = false; +struct dm_thin_device *td, *tmp; + +down_read (&pmd->root_lock); +list_for_each_entry_safe (td, tmp, &pmd->thin_devices, list) { +if (td->changed) { + r = td->changed; +break ; + } + } +up_read (&pmd->root_lock); + +return r; +} +bool dm_thin_aborted_changes (struct dm_thin_device *td) {bool r;
drivers/md/dm-thin-metadata.h +2 -0
@@ -161,6 +161,8 @@ int dm_thin_remove_block(struct dm_thin_*/ bool dm_thin_changed_this_transaction (struct dm_thin_device *td); +bool dm_pool_changed_this_transaction (struct dm_pool_metadata *pmd); +bool dm_thin_aborted_changes (struct dm_thin_device *td); int dm_thin_get_highest_mapped_block(struct dm_thin_device *td,
drivers/md/dm-thin.c +2 -1
@@ -1354,7 +1354,8 @@ static void process_deferred_bios(structbio_list_init (&pool->deferred_flush_bios);spin_unlock_irqrestore (&pool->lock, flags); -if (bio_list_empty (&bios) && !need_commit_due_to_time (pool)) +if (bio_list_empty (&bios) && + !(dm_pool_changed_this_transaction (pool->pmd) &&need_commit_due_to_time (pool)))return ;if (commit (pool)) {
Greg Kroah-Hartman
maintainerPATCH 165/172 dm thin: fix the error path for the thin device constructor
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 1acacc0784aab45627b6009e0e9224886279ac0b upstream.
dm_pool_close_thin_device() must be called if dm_set_target_max_io_len() fails in thin_ctr(). Otherwise __pool_destroy() will fail because the pool will still have an open thin device:
device-mapper: thin metadata: attempt to close pmd when 1 device(s) are still open
device-mapper: thin: __pool_destroy: dm_pool_metadata_close() failed.
Also, must establish error code if failing thin_ctr() because the pool is in fail_io mode.
--- drivers/md/dm-thin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/dm-thin.c +4 -1
@@ -2848,6 +2848,7 @@ static int thin_ctr(struct dm_target *tiif (get_pool_mode (tc->pool) ==PM_FAIL ) { ti->error ="Couldn't open thin device, Pool is in fail mode" ; + r = -EINVAL ; goto bad_thin_open; }
@@ -2859,7 +2860,7 @@ static int thin_ctr(struct dm_target *ti r =dm_set_target_max_io_len (ti, tc->pool->sectors_per_block);if (r) - goto bad_thin_open; + goto bad_target_max_io_len; ti->num_flush_bios =1 ; ti->flush_supported = true;
@@ -2880,6 +2881,8 @@ static int thin_ctr(struct dm_target *tireturn 0 ; +bad_target_max_io_len: +dm_pool_close_thin_device (tc->td); bad_thin_open:__pool_dec (tc->pool); bad_pool_lookup:
Greg Kroah-Hartman
maintainerPATCH 167/172 drm/radeon: print the supported atpx function mask
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 9f050c7f9738ffa746c63415136645ad231b1348 upstream.
Print the supported functions mask in addition to the version. This is useful in debugging PX problems since we can see what functions are available.
--- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_atpx_handler.c +2 -1
@@ -219,7 +219,8 @@ static int radeon_atpx_verify_interface(memcpy (&output, info->buffer.pointer, size);/* TODO: check version? */ -printk ("ATPX version %u\n" , output.version); +printk ("ATPX version %u, functions 0x%08x\n" , + output.version, output.function_bits);radeon_atpx_parse_functions (&atpx->functions, output.function_bits);
Greg Kroah-Hartman
maintainerPATCH 169/172 drm/radeon: disable pll sharing for DP on DCE4.1
In reply to Greg Kroah-Hartman3.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 9ef4e1d000a5b335fcebfcf8aef3405e59574c89 upstream.
Causes display problems. We had already disabled
sharing for non-DP displays.
Based on a patch from:
Niels Ole Salscheider <[email protected]>
bug:
https://bugzilla.kernel.org/show_bug.cgi?id=58121
--- drivers/gpu/drm/radeon/atombios_crtc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/atombios_crtc.c +15 -1
@@ -1767,6 +1767,20 @@ static int radeon_atom_pick_pll(struct dreturn ATOM_PPLL1 ;DRM_ERROR ("unable to allocate a PPLL\n" );return ATOM_PPLL_INVALID ; + }else if (ASIC_IS_DCE41 (rdev)) { +/* Don't share PLLs on DCE4.1 chips */ +if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (radeon_crtc->encoder))) { +if (rdev->clock.dp_extclk) +/* skip PPLL programming if using ext clock */ +return ATOM_PPLL_INVALID ; + } + pll_in_use =radeon_get_pll_use_mask (crtc); +if (!(pll_in_use & (1 <<ATOM_PPLL1 ))) +return ATOM_PPLL1 ; +if (!(pll_in_use & (1 <<ATOM_PPLL2 ))) +return ATOM_PPLL2 ; +DRM_ERROR ("unable to allocate a PPLL\n" ); +return ATOM_PPLL_INVALID ; }else if (ASIC_IS_DCE4 (rdev)) {/* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, * depending on the asic:
@@ -1794,7 +1808,7 @@ static int radeon_atom_pick_pll(struct dif (pll !=ATOM_PPLL_INVALID )return pll; } - }else if (!ASIC_IS_DCE41 (rdev)) {/* Don't share PLLs on DCE4.1 chips */ + }else {/* use the same PPLL for all monitors with the same clock */ pll =radeon_get_shared_nondp_ppll (crtc);if (pll !=ATOM_PPLL_INVALID )