3.4.26-stable review
Subsystems (77)
Greg Kroah-Hartman
maintainercover 3.4.26-stable review
This is the start of the stable review cycle for the 3.4.26 release. There are 171 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 Jan 17 22:42:47 UTC 2013. 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.4.26-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.4.26-rc1
Alan Stern <[email protected]>
USB: fix endpoint-disabling for failed config changes
Ian Abbott <[email protected]>
staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC
Ian Abbott <[email protected]>
staging: comedi: don't hijack hardware device private data
David Zafman <[email protected]>
libceph: Unlock unprocessed pages in start_read() error path
Yan, Zheng <[email protected]>
ceph: call handle_cap_grant() for cap import message
Yan, Zheng <[email protected]>
ceph: Fix __ceph_do_pending_vmtruncate
Yan, Zheng <[email protected]>
ceph: Don't add dirty inode to dirty list if caps is in migration
Yan, Zheng <[email protected]>
ceph: Fix infinite loop in __wake_requests
Yan, Zheng <[email protected]>
ceph: Don't update i_max_size when handling non-auth cap
Alex Elder <[email protected]>
rbd: do not allow remove of mounted-on image
Alex Elder <[email protected]>
rbd: fix bug in rbd_dev_id_put()
Sage Weil <[email protected]>
rbd: BUG on invalid layout
Alex Elder <[email protected]>
rbd: remove linger unconditionally
Alex Elder <[email protected]>
ceph: don't reference req after put
Sage Weil <[email protected]>
libceph: remove 'osdtimeout' option
Alex Elder <[email protected]>
rbd: kill notify_timeout option
Alex Elder <[email protected]>
rbd: add read_only rbd map option
Alex Elder <[email protected]>
rbd: kill create_snap sysfs entry
Alex Elder <[email protected]>
libceph: avoid using freed osd in __kick_osd_requests()
Sage Weil <[email protected]>
libceph: fix osdmap decode error paths
Sage Weil <[email protected]>
libceph: fix protocol feature mismatch failure path
Alex Elder <[email protected]>
libceph: WARN, don't BUG on unexpected connection states
Alex Elder <[email protected]>
libceph: always reset osds when kicking
Alex Elder <[email protected]>
libceph: move linger requests sooner in kick_requests()
Alex Elder <[email protected]>
libceph: register request before unregister linger
Alex Elder <[email protected]>
libceph: don't use rb_init_node() in ceph_osdc_alloc_request()
Alex Elder <[email protected]>
libceph: init event->node in ceph_osdc_create_event()
Alex Elder <[email protected]>
libceph: init osd->o_node in create_osd()
Alex Elder <[email protected]>
libceph: report connection fault with warning
Alex Elder <[email protected]>
libceph: socket can close in any connection state
Sage Weil <[email protected]>
ceph: propagate layout error on osd request creation
Alex Elder <[email protected]>
rbd: drop dev reference on error in rbd_open()
Sage Weil <[email protected]>
ceph: tolerate (and warn on) extraneous dentry from mds
Josh Durgin <[email protected]>
rbd: send header version when notifying
Josh Durgin <[email protected]>
rbd: use reference counting for the snap context
Josh Durgin <[email protected]>
rbd: set image size when header is updated
Josh Durgin <[email protected]>
rbd: expose the correct size of the device in sysfs
Josh Durgin <[email protected]>
rbd: only reset capacity when pointing to head
Josh Durgin <[email protected]>
rbd: return errors for mapped but deleted snapshot
Sage Weil <[email protected]>
ceph: close old con before reopening on mds reconnect
Daniel Vetter <[email protected]>
Revert "drm/i915: no lvds quirk for Zotac ZDBOX SD ID12/ID13"
Chris Wilson <[email protected]>
drm/i915: Flush the pending flips on the CRTC before modification
Daniel Vetter <[email protected]>
drm/i915: call drm_handle_vblank before finish_page_flip
Ben Widawsky <[email protected]>
drm/i915: Fix GT_MODE default value
Eugeni Dodonov <[email protected]>
drm/i915: prevent possible pin leak on error path
Chris Wilson <[email protected]>
drm/i915: Reduce a pin-leak BUG into a WARN
Jani Nikula <[email protected]>
drm/i915: only enable sdvo hotplug irq if needed
Alex Deucher <[email protected]>
drm/radeon: fix ordering in pll picking on dce4+
Chris Wilson <[email protected]>
drm/i915: SDVO hotplug have different interrupt status bits for i915/i965/g4x
Paulo Zanoni <[email protected]>
drm/i915: add some barriers when changing DIPs
Alex Deucher <[email protected]>
drm/radeon: fix up pll selection on DCE5/6
Daniel Vetter <[email protected]>
drm/i915: don't pwrite tiled objects through the gtt
Chris Wilson <[email protected]>
drm/i915: Wait for all pending operations to the fb before disabling the pipe
Sean Paul <[email protected]>
drm/i915: Add wait_for in init_ring_common
Takashi Iwai <[email protected]>
drm/i915: Check VBIOS value for determining LVDS dual channel mode, too
Daniel Vetter <[email protected]>
drm/i915: hold forcewake around ring hw init
Jesse Barnes <[email protected]>
drm/i915: move NEEDS_FORCE_WAKE to i915_drv.c
Daniel Vetter <[email protected]>
drm/i915: fix up ivb plane 3 pageflips
Chris Wilson <[email protected]>
drm/i915: Unpin the flip target if we fail to queue the flip
Adam Jackson <[email protected]>
drm/edid/quirks: ViewSonic VA2026w
Alexander Graf <[email protected]>
KVM: PPC: 44x: fix DCR read/write
Daniel Vetter <[email protected]>
drm/i915: disable cpt phase pointer fdi rx workaround
Benjamin Marzinski <[email protected]>
GFS2: Test bufdata with buffer locked and gfs2_log_lock held
Sarah Sharp <[email protected]>
xhci: Handle HS bulk/ctrl endpoints that don't NAK.
Oliver Neukum <[email protected]>
USB: hub: handle claim of enabled remote wakeup after reset
Sarah Sharp <[email protected]>
xhci: Avoid "dead ports", add roothub port polling.
Sarah Sharp <[email protected]>
USB: Handle warm reset failure on empty port.
Sarah Sharp <[email protected]>
USB: Ignore port state until reset completes.
Sarah Sharp <[email protected]>
USB: Increase reset timeout.
Sarah Sharp <[email protected]>
USB: Allow USB 3.0 ports to be disabled.
Sarah Sharp <[email protected]>
USB: Ignore xHCI Reset Device status.
Sarah Sharp <[email protected]>
USB: Handle auto-transition from hot to warm reset.
Marcin Slusarz <[email protected]>
drm/nouveau: fix blank LVDS screen regression on pre-nv50 cards
Sergei Shtylyov <[email protected]>
usb: musb: core: print new line in the driver banner again
Sebastian Andrzej Siewior <[email protected]>
usb: gadget: dummy: fix enumeration with g_multi
Denis N Ladin <[email protected]>
USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i"
Tomasz Mloduchowski <[email protected]>
usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added
Bjørn Mork <[email protected]>
USB: option: add Telekom Speedstick LTE II
Quentin.Li <[email protected]>
USB: option: Add new MEDIATEK PID support
Bjørn Mork <[email protected]>
USB: option: blacklist network interface on ZTE MF880
Dzianis Kahanovich <[email protected]>
USB: option: add Nexpring NP10T terminal id
Larry Finger <[email protected]>
b43: Fix firmware loading when driver is built into the kernel
Bing Zhao <[email protected]>
mwifiex: check wait_event_interruptible return value
Johannes Berg <[email protected]>
mac80211: use del_timer_sync for final sta cleanup timer deletion
Stanislaw Gruszka <[email protected]>
mac80211: fix ibss scanning
Jerome Glisse <[email protected]>
radeon/kms: force rn50 chip to always report connected on analog output
Samuel Thibault <[email protected]>
staging: speakup: avoid out-of-range access in synth_add()
Nickolai Zeldovich <[email protected]>
staging: speakup: avoid out-of-range access in synth_init()
Larry Finger <[email protected]>
staging: r8712u: Add new device ID
Ian Abbott <[email protected]>
staging: comedi: comedi_test: fix race when cancelling command
Éric Piel <[email protected]>
staging: comedi: fix minimum AO period for NI 625x and NI 628x
Ian Abbott <[email protected]>
staging: comedi: prevent auto-unconfig of manually configured devices
Mike Dunn <[email protected]>
ALSA: pxa27x: fix ac97 warm reset
Mike Dunn <[email protected]>
ALSA: pxa27x: fix ac97 cold reset
Hans de Goede <[email protected]>
udldrmfb: udl_get_edid: drop unneeded i--
Hans de Goede <[email protected]>
udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack
Hans de Goede <[email protected]>
udldrmfb: Fix EDID not working with monitors with EDID extension blocks
Mark Brown <[email protected]>
ASoC: wm5100: Remove DSP B and left justified formats
Mark Brown <[email protected]>
ASoC: wm2200: Remove DSP B and left justified AIF modes
Axel Lin <[email protected]>
ASoC: wm2200: Fix setting dai format in wm2200_set_fmt
Mark Brown <[email protected]>
ASoC: wm2000: Fix sense of speech clarity enable
Marek Vasut <[email protected]>
HID: add quirk for Freescale i.MX23 ROM recovery
Eric Wong <[email protected]>
epoll: prevent missed events on EPOLL_CTL_MOD
Mark Brown <[email protected]>
regmap: debugfs: Avoid overflows for very small reads
Zhang Rui <[email protected]>
ACPI : do not use Lid and Sleep button for S5 wakeup
Andre Przywara <[email protected]>
x86, amd: Disable way access filter on Piledriver CPUs
David Rientjes <[email protected]>
thp, memcg: split hugepage for memcg oom on cow
Namjae Jeon <[email protected]>
udf: don't increment lenExtents while writing to a hole
Namjae Jeon <[email protected]>
udf: fix memory leak while allocating blocks during write
Ed L. Cashin <[email protected]>
aoe: do not call bdi_init after blk_alloc_queue
Theodore Ts'o <[email protected]>
ext4: lock i_mutex when truncating orphan inodes
Michael Tokarev <[email protected]>
ext4: do not try to write superblock on ro remount w/o journal
Jan Kara <[email protected]>
jbd2: fix assertion failure in jbd2_journal_flush()
Jan Kara <[email protected]>
ext4: check dioread_nolock on remount
Forrest Liu <[email protected]>
ext4: fix extent tree corruption caused by hole punch
Seth Forshee <[email protected]>
samsung-laptop: Add quirk for broken acpi_video backlight on N250P
Lothar Waßmann <[email protected]>
video: mxsfb: fix crash when unblanking the display
Chris Verges <[email protected]>
hwmon: (lm73} Detect and report i2c bus errors
Malcolm Priestley <[email protected]>
staging: vt6656: 64bit fixes: vCommandTimerWait change calculation of timer.
Malcolm Priestley <[email protected]>
staging: vt6656: 64bit fixes: key.c/h change unsigned long to u32
Malcolm Priestley <[email protected]>
staging: vt6656: 64 bit fixes: fix long warning messages.
Malcolm Priestley <[email protected]>
staging: vt6656: 64 bit fixes : correct all type sizes
Malcolm Priestley <[email protected]>
staging: vt6656: 64 bit fixes: use u32 for QWORD definition.
Malcolm Priestley <[email protected]>
staging: vt6656: [BUG] out of bound array reference in RFbSetPower.
Alasdair G Kergon <[email protected]>
dm ioctl: prevent unsafe change to dm_ioctl data_size
Mikulas Patocka <[email protected]>
dm persistent data: rename node to btree_node
Steven Rostedt <[email protected]>
ring-buffer: Fix race between integrity check and readers
Tatyana Nikolova <[email protected]>
RDMA/nes: Fix for terminate timer crash
Tatyana Nikolova <[email protected]>
RDMA/nes: Fix for crash when registering zero length MR for CQ
Trond Myklebust <[email protected]>
SUNRPC: Fix validity issues with rpc_pipefs sb->s_fs_info
Paulo Zanoni <[email protected]>
drm/i915: make the panel fitter work on pipes B and C on IVB
Niels Ole Salscheider <[email protected]>
drm/radeon: Properly handle DDC probe for DP bridges
Alex Deucher <[email protected]>
drm/radeon: add WAIT_UNTIL to evergreen VM safe reg list
Alex Deucher <[email protected]>
drm/radeon: fix eDP clk and lane setup for scaled modes
Woodhouse, David <[email protected]>
intel-iommu: Free old page tables before creating superpage
Dan Williams <[email protected]>
i2400m: add Intel 6150 device IDs
Alexey Khoroshilov <[email protected]>
jffs2: hold erase_completion_lock on exit
Trond Myklebust <[email protected]>
SUNRPC: Ensure we release the socket write lock if the rpc_task exits early
Trond Myklebust <[email protected]>
SUNRPC: Ensure that we free the rpc_task after cleanups are done
Stanislav Kinsbursky <[email protected]>
SUNRPC: continue run over clients list on PipeFS event instead of break
Wolfram Sang <[email protected]>
mtd: nand: gpmi: reset BCH earlier, too, to avoid NAND startup problems
Nathan Williams <[email protected]>
mtd cs553x_nand: Initialise ecc.strength before nand_scan()
Theodore Ts'o <[email protected]>
ext4: fix possible use after free with metadata csum
Eugene Shatokhin <[email protected]>
ext4: fix memory leak in ext4_xattr_set_acl()'s error path
Charles Keepax <[email protected]>
mfd: Only unregister platform devices allocated by the mfd core
Mark Brown <[email protected]>
mfd: wm8994: Add support for WM1811 rev E
Yi Zou <[email protected]>
target/tcm_fc: fix the lockdep warning due to inconsistent lock state
Xiaotian Feng <[email protected]>
libata: fix Null pointer dereference on disk error
Aaron Lu <[email protected]>
libata: set dma_mode to 0xff in reset
Mikael Pettersson <[email protected]>
sata_promise: fix hardreset lockdep error
Wei Yongjun <[email protected]>
iscsit: use GFP_ATOMIC under spin lock
David Jeffery <[email protected]>
SCSI: qla2xxx: Test and clear FCPORT_UPDATE_NEEDED atomically.
Sasha Levin <[email protected]>
SCSI: prevent stack buffer overflow in host_reset
Xi Wang <[email protected]>
SCSI: mvsas: fix undefined bit shift
Jianpeng Ma <[email protected]>
SCSI: mvsas: Fix oops when ata commond timeout.
Lars-Peter Clausen <[email protected]>
ASoC: sigmadsp: Fix endianness conversion issue
Stephan Gatzka <[email protected]>
firewire: net: Fix handling of fragmented multicast/broadcast packets.
Felix Fietkau <[email protected]>
ath9k_hw: Fix signal strength / channel noise reporting
Gabor Juhos <[email protected]>
ath9k: ar9003: fix OTP register offsets for AR9340
Felix Fietkau <[email protected]>
Revert "ath9k_hw: Update AR9003 high_power tx gain table"
Laura Abbott <[email protected]>
mm: use aligned zone start for pfn_to_bitidx calculation
Jason Liu <[email protected]>
mm: compaction: fix echo 1 > compact_memory return error issue
Huacai Chen <[email protected]>
MIPS: Fix poweroff failure when HOTPLUG_CPU configured.
Sebastian Ott <[email protected]>
s390/cio: fix pgid reserved check
Alex Williamson <[email protected]>
KVM: Fix user memslot overlap check
Gabor Juhos <[email protected]>
powerpc: Add missing NULL terminator to avoid boot panic on PPC40x
Shan Hai <[email protected]>
powerpc/vdso: Remove redundant locking in update_vsyscall_tz()
Anton Blanchard <[email protected]>
powerpc: Fix CONFIG_RELOCATABLE=y CONFIG_CRASH_DUMP=n build
Rafał Miłecki <[email protected]>
bcma: mips: fix clearing device IRQ
Felix Fietkau <[email protected]>
ath5k: fix tx path skb leaks
Mark Brown <[email protected]>
regulator: wm831x: Set the new rather than old value for DVS VSEL
-------------
Diffstat:
Documentation/ABI/testing/sysfs-bus-rbd | 6 - Makefile | 4 +- arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | 3 + arch/arm/mach-pxa/pxa27x.c | 4 +- arch/mips/kernel/process.c | 4 +- arch/powerpc/kernel/head_64.S | 2 +- arch/powerpc/kernel/time.c | 5 - arch/powerpc/kvm/44x_emulate.c | 2 + arch/powerpc/platforms/40x/ppc40x_simple.c | 3 +- arch/x86/kernel/cpu/amd.c | 14 + drivers/acpi/scan.c | 7 +- drivers/ata/libata-core.c | 1 + drivers/ata/libata-eh.c | 1 + drivers/ata/libata-scsi.c | 6 +- drivers/ata/sata_promise.c | 15 +- drivers/base/regmap/regmap-debugfs.c | 2 +- drivers/bcma/driver_mips.c | 2 +- drivers/block/aoe/aoe.h | 2 +- drivers/block/aoe/aoeblk.c | 5 - drivers/block/rbd.c | 293 +++++++-------------- drivers/firewire/net.c | 13 +- drivers/gpu/drm/drm_edid.c | 22 +- drivers/gpu/drm/i915/i915_drv.c | 10 + drivers/gpu/drm/i915/i915_drv.h | 11 +- drivers/gpu/drm/i915/i915_gem.c | 4 +- drivers/gpu/drm/i915/i915_irq.c | 44 ++-- drivers/gpu/drm/i915/i915_reg.h | 23 +- drivers/gpu/drm/i915/intel_bios.c | 36 +++ drivers/gpu/drm/i915/intel_display.c | 190 +++++++------ drivers/gpu/drm/i915/intel_hdmi.c | 11 +- drivers/gpu/drm/i915/intel_lvds.c | 8 - drivers/gpu/drm/i915/intel_ringbuffer.c | 22 +- drivers/gpu/drm/i915/intel_sdvo.c | 30 ++- drivers/gpu/drm/nouveau/nv04_dfp.c | 2 +- drivers/gpu/drm/radeon/atombios_crtc.c | 6 +- drivers/gpu/drm/radeon/atombios_encoders.c | 2 +- drivers/gpu/drm/radeon/evergreen_cs.c | 1 + drivers/gpu/drm/radeon/radeon_connectors.c | 10 +- drivers/gpu/drm/radeon/radeon_display.c | 13 +- drivers/gpu/drm/radeon/radeon_i2c.c | 10 +- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 8 + drivers/gpu/drm/radeon/radeon_mode.h | 2 +- drivers/gpu/drm/udl/udl_connector.c | 17 +- drivers/hid/hid-ids.h | 3 + drivers/hid/usbhid/hid-quirks.c | 1 + drivers/hwmon/lm73.c | 16 +- drivers/infiniband/hw/nes/nes.h | 1 + drivers/infiniband/hw/nes/nes_hw.c | 9 +- drivers/infiniband/hw/nes/nes_verbs.c | 9 +- drivers/iommu/intel-iommu.c | 11 +- drivers/md/dm-ioctl.c | 8 + drivers/md/persistent-data/dm-btree-internal.h | 16 +- drivers/md/persistent-data/dm-btree-remove.c | 50 ++-- drivers/md/persistent-data/dm-btree-spine.c | 6 +- drivers/md/persistent-data/dm-btree.c | 22 +- drivers/mfd/mfd-core.c | 15 +- drivers/mfd/wm8994-core.c | 1 + drivers/mtd/nand/cs553x_nand.c | 3 +- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 9 + drivers/net/wimax/i2400m/i2400m-usb.h | 3 + drivers/net/wimax/i2400m/usb.c | 6 + drivers/net/wireless/ath/ath5k/base.c | 4 +- drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +- .../net/wireless/ath/ath9k/ar9003_2p2_initvals.h | 172 ++++++------ drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | 6 +- drivers/net/wireless/ath/ath9k/calib.c | 1 + drivers/net/wireless/ath/ath9k/calib.h | 3 + drivers/net/wireless/b43/b43.h | 5 + drivers/net/wireless/b43/main.c | 54 +++- drivers/net/wireless/b43/main.h | 5 +- drivers/net/wireless/mwifiex/sta_ioctl.c | 21 +- drivers/platform/x86/samsung-laptop.c | 10 + drivers/regulator/wm831x-dcdc.c | 2 +- drivers/s390/cio/device_pgid.c | 10 +- drivers/scsi/mvsas/mv_94xx.h | 14 +- drivers/scsi/mvsas/mv_sas.c | 2 +- drivers/scsi/mvsas/mv_sas.h | 2 +- drivers/scsi/qla2xxx/qla_os.c | 4 +- drivers/scsi/scsi_sysfs.c | 11 +- drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/comedi_fops.c | 21 ++ drivers/staging/comedi/comedidev.h | 1 + drivers/staging/comedi/drivers.c | 34 +-- drivers/staging/comedi/drivers/comedi_test.c | 2 +- drivers/staging/comedi/drivers/ni_pcimio.c | 16 +- drivers/staging/comedi/internal.h | 1 + drivers/staging/rtl8712/usb_intf.c | 2 + drivers/staging/speakup/synth.c | 4 +- drivers/staging/vt6656/dpc.c | 4 +- drivers/staging/vt6656/key.c | 53 ++-- drivers/staging/vt6656/key.h | 8 +- drivers/staging/vt6656/mac.c | 6 +- drivers/staging/vt6656/rf.c | 3 + drivers/staging/vt6656/rxtx.c | 18 +- drivers/staging/vt6656/ttype.h | 16 +- drivers/staging/vt6656/wcmd.c | 20 +- drivers/staging/vt6656/wpa2.h | 4 +- drivers/target/iscsi/iscsi_target.c | 2 +- drivers/target/tcm_fc/tfc_sess.c | 2 +- drivers/usb/class/cdc-acm.c | 3 + drivers/usb/core/hub.c | 120 +++++++-- drivers/usb/core/message.c | 53 ++-- drivers/usb/gadget/dummy_hcd.c | 9 +- drivers/usb/host/xhci-hub.c | 38 ++- drivers/usb/host/xhci-mem.c | 2 + drivers/usb/host/xhci-ring.c | 9 + drivers/usb/host/xhci.c | 10 + drivers/usb/musb/musb_core.c | 5 +- drivers/usb/serial/ftdi_sio.c | 2 + drivers/usb/serial/ftdi_sio_ids.h | 6 + drivers/usb/serial/option.c | 18 +- drivers/video/mxsfb.c | 3 +- fs/ceph/addr.c | 17 +- fs/ceph/caps.c | 16 +- fs/ceph/file.c | 4 +- fs/ceph/inode.c | 30 ++- fs/ceph/mds_client.c | 10 +- fs/ceph/super.c | 2 - fs/eventpoll.c | 22 +- fs/ext4/acl.c | 6 +- fs/ext4/extents.c | 22 +- fs/ext4/ialloc.c | 2 +- fs/ext4/super.c | 26 +- fs/gfs2/lops.c | 18 +- fs/gfs2/trans.c | 8 + fs/jbd2/transaction.c | 3 +- fs/jffs2/nodemgmt.c | 6 +- fs/udf/inode.c | 11 +- include/linux/ceph/libceph.h | 2 - kernel/trace/ring_buffer.c | 7 +- mm/compaction.c | 6 +- mm/huge_memory.c | 3 + mm/memory.c | 18 +- mm/page_alloc.c | 2 +- net/ceph/ceph_common.c | 3 +- net/ceph/messenger.c | 72 ++--- net/ceph/osd_client.c | 108 +++----- net/ceph/osdmap.c | 31 ++- net/mac80211/ibss.c | 9 +- net/mac80211/ieee80211_i.h | 6 +- net/mac80211/scan.c | 34 ++- net/mac80211/sta_info.c | 2 +- net/sunrpc/clnt.c | 2 +- net/sunrpc/rpc_pipe.c | 7 +- net/sunrpc/sched.c | 30 ++- net/sunrpc/xprt.c | 12 +- sound/arm/pxa2xx-ac97-lib.c | 26 +- sound/soc/codecs/sigmadsp.c | 2 +- sound/soc/codecs/wm2000.c | 4 +- sound/soc/codecs/wm2200.c | 8 +- sound/soc/codecs/wm5100.c | 6 - virt/kvm/kvm_main.c | 13 +- 152 files changed, 1520 insertions(+), 985 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/171 regulator: wm831x: Set the new rather than old value for DVS VSEL
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 13ae633cf729b0ecb677b75b04886ff8fada8fad upstream.
--- drivers/regulator/wm831x-dcdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/wm831x-dcdc.c +1 -1
@@ -330,7 +330,7 @@ static int wm831x_buckv_set_voltage(struif (vsel > dcdc->dvs_vsel) { ret =wm831x_set_bits (wm831x, dvs_reg,WM831X_DC1_DVS_VSEL_MASK , - dcdc->dvs_vsel); + vsel);if (ret ==0 ) dcdc->dvs_vsel = vsel;else
Greg Kroah-Hartman
maintainerPATCH 2/171 ath5k: fix tx path skb leaks
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 596ab5ec3bf10a22be30d7cb1d903a4b83fd607c upstream.
ieee80211_free_txskb() needs to be used instead of dev_kfree_skb_any for tx packets passed to the driver from mac80211
--- drivers/net/wireless/ath/ath5k/base.c | 4 ++-- drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +2 -2
@@ -843,7 +843,7 @@ ath5k_txbuf_free_skb(struct ath5k_hw *ahreturn ;dma_unmap_single (ah->dev, bf->skbaddr, bf->skb->len,DMA_TO_DEVICE ); -dev_kfree_skb_any (bf->skb); +ieee80211_free_txskb (ah->hw, bf->skb); bf->skb =NULL ; bf->skbaddr =0 ; bf->desc->ds_data =0 ;
@@ -1570,7 +1570,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw,return ; drop_packet: -dev_kfree_skb_any (skb); +ieee80211_free_txskb (hw, skb); } static void
drivers/net/wireless/ath/ath5k/mac80211-ops.c +1 -1
@@ -59,7 +59,7 @@ ath5k_tx(struct ieee80211_hw *hw, structu16 qnum =skb_get_queue_mapping (skb);if (WARN_ON (qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) { -dev_kfree_skb_any (skb); +ieee80211_free_txskb (hw, skb);return ; }
Greg Kroah-Hartman
maintainerPATCH 3/171 bcma: mips: fix clearing device IRQ
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
commit cbbc0138efe1dcd5426b8fc5d87741f5057aee72 upstream.
We were using wrong IRQ number so clearing wasn't working at all. Depending on a platform this could result in a one device having two interrupts assigned. On BCM4706 this resulted in all IRQs being broken.
--- drivers/bcma/driver_mips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bcma/driver_mips.c +1 -1
@@ -115,7 +115,7 @@ static void bcma_core_mips_set_irq(strucbcma_read32 (mdev,BCMA_MIPS_MIPS74K_INTMASK (0 )) & ~(1 << irqflag)); else - bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq), 0); + bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0);/* assign the new one */ if (irq ==0 ) {
Greg Kroah-Hartman
maintainerPATCH 4/171 powerpc: Fix CONFIG_RELOCATABLE=y CONFIG_CRASH_DUMP=n build
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 11ee7e99f35ecb15f59b21da6a82d96d2cd3fcc8 upstream.
If we build a kernel with CONFIG_RELOCATABLE=y CONFIG_CRASH_DUMP=n, the kernel fails when we run at a non zero offset. It turns out we were incorrectly wrapping some of the relocatable kernel code with CONFIG_CRASH_DUMP.
--- arch/powerpc/kernel/head_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/head_64.S +1 -1
@@ -422,7 +422,7 @@ _STATIC(__after_prom_start) tovirt(r6,r6) /* on booke, we already run at PAGE_OFFSET */ #endif -#ifdef CONFIG_CRASH_DUMP +#ifdef CONFIG_RELOCATABLE /* * Check if the kernel has to be running as relocatable kernel based on the * variable __run_at_load, if it is set the kernel is treated as relocatable
Greg Kroah-Hartman
maintainerPATCH 5/171 powerpc/vdso: Remove redundant locking in update_vsyscall_tz()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shan Hai <[email protected]>
commit ce73ec6db47af84d1466402781ae0872a9e7873c upstream.
The locking in update_vsyscall_tz() is not only unnecessary because the vdso code copies the data unproteced in __kernel_gettimeofday() but also introduces a hard to reproduce race condition between update_vsyscall() and update_vsyscall_tz(), which causes user space process to loop forever in vdso code.
The following patch removes the locking from update_vsyscall_tz().
Locking is not only unnecessary because the vdso code copies the data unprotected in __kernel_gettimeofday() but also erroneous because updating the tb_update_count is not atomic and introduces a hard to reproduce race condition between update_vsyscall() and update_vsyscall_tz(), which further causes user space process to loop forever in vdso code.
The below scenario describes the race condition,
x==0 Boot CPU other CPU
proc_P: x==0 timer interrupt update_vsyscall
x==1 x++;sync settimeofday
update_vsyscall_tz
x==2 x++;sync
x==3 sync;x++
sync;x++ proc_P: x==3 (loops until x becomes even)
Because the ++ operator would be implemented as three instructions and not atomic on powerpc.
A similar change was made for x86 in commit 6c260d58634 ("x86: vdso: Remove bogus locking in update_vsyscall_tz")
--- arch/powerpc/kernel/time.c | 5 ----- 1 file changed, 5 deletions(-)
arch/powerpc/kernel/time.c +0 -5
@@ -749,13 +749,8 @@ void update_vsyscall(struct timespec *wavoid update_vsyscall_tz (void ) { -/* Make userspace gettimeofday spin until we're done. */ - ++vdso_data->tb_update_count; -smp_mb (); vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; vdso_data->tz_dsttime = sys_tz.tz_dsttime; -smp_mb (); - ++vdso_data->tb_update_count; }static void __init clocksource_init (void )
Greg Kroah-Hartman
maintainerPATCH 6/171 powerpc: Add missing NULL terminator to avoid boot panic on PPC40x
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
commit e6449c9b2d90c1bd9a5985bf05ddebfd1631cd6b upstream.
The missing NULL terminator can cause a panic on
PPC405 boards during boot:
Linux/PowerPC load: console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd init=/etc/preinit Finalizing device tree... flat tree at 0x6a5160
bootconsole [udbg0] enabled
Page fault in user mode with in_atomic() = 1 mm = (null)
NIP = c0275f50 MSR = fffffffe
Oops: Weird page fault, sig: 11 [#1] PowerPC 40x Platform Modules linked in: NIP: c0275f50 LR: c0275f60 CTR: c0280000 REGS: c0275eb0 TRAP: 636f7265 Not tainted (3.7.1) MSR: fffffffe <VEC,VSX,EE,PR,FP,ME,SE,BE,IR,DR,PMM,RI> CR: c06a6190 XER: 00000001 TASK = c02662a8[0] 'swapper' THREAD: c0274000 GPR00: c0275ec0 c000c658 c027c4bf 00000000 c0275ee0 c000a0ec c020a1a8 c020a1f0 GPR08: c020f631 c020f404 c025f078 c025f080 c0275f10 Call Trace: ---[ end trace 31fd0ba7d8756001 ]--- Kernel panic - not syncing: Attempted to kill the idle task!
The panic happens since commit 9597abe00c1bab2aedce6b49866bf6d1e81c9eed (sections: fix section conflicts in arch/powerpc), however the root cause of this is that the NULL terminator were not added in commit a4f740cf33f7f6c164bbde3c0cdbcc77b0c4997c (of/flattree: Add of_flat_dt_match() helper function).
--- arch/powerpc/platforms/40x/ppc40x_simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/platforms/40x/ppc40x_simple.c +2 -1
@@ -57,7 +57,8 @@ static const char *board[] __initdata ="amcc,makalu" ,"apm,klondike" ,"est,hotfoot" , - "plathome,obs600" +"plathome,obs600" , + NULL };static int __init ppc40x_probe (void )
Greg Kroah-Hartman
maintainerPATCH 7/171 KVM: Fix user memslot overlap check
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit 5419369ed6bd4cf711fdda5e52a5999b940413f5 upstream.
Prior to memory slot sorting this loop compared all of the user memory slots for overlap with new entries. With memory slot sorting, we're just checking some number of entries in the array that may or may not be user slots. Instead, walk all the slots with kvm_for_each_memslot, which has the added benefit of terminating early when we hit the first empty slot, and skip comparison to private slots.
--- virt/kvm/kvm_main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
virt/kvm/kvm_main.c +5 -8
@@ -693,8 +693,7 @@ int __kvm_set_memory_region(struct kvm *int r;gfn_t base_gfn;unsigned long npages; -unsigned long i; -struct kvm_memory_slot *memslot; +struct kvm_memory_slot *memslot, *slot;struct kvm_memory_slot old, new;struct kvm_memslots *slots, *old_memslots;
@@ -741,13 +740,11 @@ int __kvm_set_memory_region(struct kvm */* Check for overlaps */ r = -EEXIST ; -for (i =0 ; i <KVM_MEMORY_SLOTS ; ++i) { -struct kvm_memory_slot *s = &kvm->memslots->memslots[i]; - -if (s == memslot || !s->npages) +kvm_for_each_memslot (slot, kvm->memslots) { +if (slot->id >=KVM_MEMORY_SLOTS || slot == memslot)continue ; -if (!((base_gfn + npages <= s->base_gfn) || - (base_gfn >= s->base_gfn + s->npages))) +if (!((base_gfn + npages <= slot->base_gfn) || + (base_gfn >= slot->base_gfn + slot->npages))) goto out_free; }
Greg Kroah-Hartman
maintainerPATCH 8/171 s390/cio: fix pgid reserved check
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Ott <[email protected]>
commit d99e79ec5574fc556c988f613ed6175f6de66f4a upstream.
The check to whom a device is reserved is done by checking the path state of the affected channel paths. If it turns out that one path is flagged as reserved by someone else the whole device is marked as such.
However the meaning of the RESVD_ELSE bit is that the addressed device is reserved to a different pathgroup (and not reserved to a different LPAR). If we do this test on a path which is currently not a member of the pathgroup we could erroneously mark the device as reserved to someone else.
To fix this collect the reserved state for all potential members of the pathgroup and only mark the device as reserved if all of those potential members have the RESVD_ELSE bit set.
--- drivers/s390/cio/device_pgid.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/s390/cio/device_pgid.c +5 -5
@@ -234,7 +234,7 @@ static int pgid_cmp(struct pgid *p1, str* Determine pathgroup state from PGID data. */ static void pgid_analyze (struct ccw_device *cdev,struct pgid **p, -int *mismatch,int *reserved,u8 *reset) +int *mismatch,u8 *reserved,u8 *reset) {struct pgid *pgid = &cdev->private->pgid[0 ];struct pgid *first =NULL ;
@@ -248,7 +248,7 @@ static void pgid_analyze(struct ccw_deviif ((cdev->private->pgid_valid_mask & lpm) ==0 )continue ;if (pgid->inf.ps.state2 ==SNID_STATE2_RESVD_ELSE ) - *reserved =1 ; + *reserved |= lpm;if (pgid_is_reset (pgid)) { *reset |= lpm;continue ;
@@ -316,14 +316,14 @@ static void snid_done(struct ccw_devicestruct subchannel *sch =to_subchannel (cdev->dev.parent);struct pgid *pgid;int mismatch =0 ; -int reserved =0 ; +u8 reserved =0 ;u8 reset =0 ;u8 donepm;if (rc) goto out;pgid_analyze (cdev, &pgid, &mismatch, &reserved, &reset); -if (reserved) +if (reserved == cdev->private->pgid_valid_mask) rc = -EUSERS ;else if (mismatch) rc = -EOPNOTSUPP ;
@@ -336,7 +336,7 @@ static void snid_done(struct ccw_device } out:CIO_MSG_EVENT (2 ,"snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " -"todo=%02x mism=%d rsvd=%d reset=%02x\n" , id->ssid, +"todo=%02x mism=%d rsvd=%02x reset=%02x\n" , id->ssid, id->devno, rc, cdev->private->pgid_valid_mask, sch->vpm, cdev->private->pgid_todo_mask, mismatch, reserved, reset);switch (rc) {
Greg Kroah-Hartman
maintainerPATCH 9/171 MIPS: Fix poweroff failure when HOTPLUG_CPU configured.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 8add1ecb81f541ef2fcb0b85a5470ad9ecfb4a84 upstream.
When poweroff machine, kernel_power_off() call disable_nonboot_cpus(). And if we have HOTPLUG_CPU configured, disable_nonboot_cpus() is not an empty function but attempt to actually disable the nonboot cpus. Since system state is SYSTEM_POWER_OFF, play_dead() won't be called and thus disable_nonboot_cpus() hangs. Therefore, we make this patch to avoid poweroff failure.
Patchwork: https://patchwork.linux-mips.org/patch/4211/
--- arch/mips/kernel/process.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/mips/kernel/process.c +1 -3
@@ -72,9 +72,7 @@ void __noreturn cpu_idle(void) } }#ifdef CONFIG_HOTPLUG_CPU -if (!cpu_online (cpu) && !cpu_isset (cpu, cpu_callin_map) && - (system_state ==SYSTEM_RUNNING || - system_state ==SYSTEM_BOOTING )) +if (!cpu_online (cpu) && !cpu_isset (cpu, cpu_callin_map))play_dead ();#endif rcu_idle_exit ();
Greg Kroah-Hartman
maintainerPATCH 10/171 mm: compaction: fix echo 1 > compact_memory return error issue
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Liu <[email protected]>
commit 7964c06d66c76507d8b6b662bffea770c29ef0ce upstream.
when run the folloing command under shell, it will return error
sh/$ echo 1 > /proc/sys/vm/compact_memory
sh/$ sh: write error: Bad address
After strace, I found the following log:
...
write(1, "1\n", 2) = 3
write(1, "", 4294967295) = -1 EFAULT (Bad address)
write(2, "echo: write error: Bad address\n", 31echo: write error: Bad address ) = 31
This tells system return 3(COMPACT_COMPLETE) after write data to compact_memory.
The fix is to make the system just return 0 instead 3(COMPACT_COMPLETE) from sysctl_compaction_handler after compaction_nodes finished.
--- mm/compaction.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
mm/compaction.c +2 -4
@@ -736,7 +736,7 @@ static int compact_node(int nid) }/* Compact all nodes in the system */ -static int compact_nodes (void ) +static void compact_nodes (void ) {int nid;
@@ -745,8 +745,6 @@ static int compact_nodes(void)for_each_online_node (nid)compact_node (nid); - -return COMPACT_COMPLETE ; }/* The written value is actually unused, all memory is compacted */
@@ -757,7 +755,7 @@ int sysctl_compaction_handler(struct ctl void __user *buffer, size_t *length, loff_t *ppos) { if (write) - return compact_nodes(); + compact_nodes();return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 11/171 mm: use aligned zone start for pfn_to_bitidx calculation
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <[email protected]>
commit c060f943d0929f3e429c5d9522290584f6281d6e upstream.
The current calculation in pfn_to_bitidx assumes that (pfn - zone->zone_start_pfn) >> pageblock_order will return the same bit for all pfn in a pageblock. If zone_start_pfn is not aligned to pageblock_nr_pages, this may not always be correct.
Consider the following with pageblock order = 10, zone start 2MB:
pfn | pfn - zone start | (pfn - zone start) >> page block order
----------------------------------------------------------------
0x26000 | 0x25e00 | 0x97 0x26100 | 0x25f00 | 0x97 0x26200 | 0x26000 | 0x98 0x26300 | 0x26100 | 0x98
This means that calling {get,set}_pageblock_migratetype on a single page will not set the migratetype for the full block. Fix this by rounding down zone_start_pfn when doing the bitidx calculation.
For our use case, the effects of this bug were mostly tied to the fact that CMA allocations would either take a long time or fail to happen. Depending on the driver using CMA, this could result in anything from visual glitches to application failures.
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -5340,7 +5340,7 @@ static inline int pfn_to_bitidx(struct z pfn &= (PAGES_PER_SECTION -1 );return (pfn >> pageblock_order) *NR_PAGEBLOCK_BITS ;#else - pfn = pfn - zone->zone_start_pfn; + pfn = pfn -round_down (zone->zone_start_pfn, pageblock_nr_pages);return (pfn >> pageblock_order) *NR_PAGEBLOCK_BITS ;#endif /* CONFIG_SPARSEMEM */ }
Greg Kroah-Hartman
maintainerPATCH 12/171 Revert "ath9k_hw: Update AR9003 high_power tx gain table"
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 9c170e068636deb3e3f96114034bb711675f0faa upstream.
This reverts commit f74b9d365ddd33a375802b064f96a5d0e99af7c0.
Turns out reverting commit a240dc7b3c7463bd60cf0a9b2a90f52f78aae0fd "ath9k_hw: Updated AR9003 tx gain table for 5GHz" was not enough to bring the tx power back to normal levels on devices like the Buffalo WZR-HP-G450H, this one needs to be reverted as well.
This revert improves tx power by ~10 db on that device
--- drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | 172 +++++++++---------- 1 file changed, 86 insertions(+), 86 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +86 -86
@@ -533,98 +533,98 @@ static const u32 ar9300_2p2_baseband_corstatic const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5 ] = {/* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc ,0x00033800 ,0x00033800 ,0x03aaa352 ,0x03aaa352 }, - {0x0000a2e0 ,0x0003c000 ,0x0003c000 ,0x03ccc584 ,0x03ccc584 }, - {0x0000a2e4 ,0x03fc0000 ,0x03fc0000 ,0x03f0f800 ,0x03f0f800 }, + {0x0000a2dc ,0x0380c7fc ,0x0380c7fc ,0x03aaa352 ,0x03aaa352 }, + {0x0000a2e0 ,0x0000f800 ,0x0000f800 ,0x03ccc584 ,0x03ccc584 }, + {0x0000a2e4 ,0x03ff0000 ,0x03ff0000 ,0x03f0f800 ,0x03f0f800 }, {0x0000a2e8 ,0x00000000 ,0x00000000 ,0x03ff0000 ,0x03ff0000 }, - {0x0000a410 ,0x000050d9 ,0x000050d9 ,0x000050d9 ,0x000050d9 }, - {0x0000a500 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, - {0x0000a504 ,0x06000003 ,0x06000003 ,0x04000002 ,0x04000002 }, - {0x0000a508 ,0x0a000020 ,0x0a000020 ,0x08000004 ,0x08000004 }, - {0x0000a50c ,0x10000023 ,0x10000023 ,0x0b000200 ,0x0b000200 }, - {0x0000a510 ,0x16000220 ,0x16000220 ,0x0f000202 ,0x0f000202 }, - {0x0000a514 ,0x1c000223 ,0x1c000223 ,0x12000400 ,0x12000400 }, - {0x0000a518 ,0x21002220 ,0x21002220 ,0x16000402 ,0x16000402 }, - {0x0000a51c ,0x27002223 ,0x27002223 ,0x19000404 ,0x19000404 }, - {0x0000a520 ,0x2b022220 ,0x2b022220 ,0x1c000603 ,0x1c000603 }, - {0x0000a524 ,0x2f022222 ,0x2f022222 ,0x21000a02 ,0x21000a02 }, - {0x0000a528 ,0x34022225 ,0x34022225 ,0x25000a04 ,0x25000a04 }, - {0x0000a52c ,0x3a02222a ,0x3a02222a ,0x28000a20 ,0x28000a20 }, - {0x0000a530 ,0x3e02222c ,0x3e02222c ,0x2c000e20 ,0x2c000e20 }, - {0x0000a534 ,0x4202242a ,0x4202242a ,0x30000e22 ,0x30000e22 }, - {0x0000a538 ,0x4702244a ,0x4702244a ,0x34000e24 ,0x34000e24 }, - {0x0000a53c ,0x4b02244c ,0x4b02244c ,0x38001640 ,0x38001640 }, - {0x0000a540 ,0x4e02246c ,0x4e02246c ,0x3c001660 ,0x3c001660 }, - {0x0000a544 ,0x52022470 ,0x52022470 ,0x3f001861 ,0x3f001861 }, - {0x0000a548 ,0x55022490 ,0x55022490 ,0x43001a81 ,0x43001a81 }, - {0x0000a54c ,0x59022492 ,0x59022492 ,0x47001a83 ,0x47001a83 }, - {0x0000a550 ,0x5d022692 ,0x5d022692 ,0x4a001c84 ,0x4a001c84 }, - {0x0000a554 ,0x61022892 ,0x61022892 ,0x4e001ce3 ,0x4e001ce3 }, - {0x0000a558 ,0x65024890 ,0x65024890 ,0x52001ce5 ,0x52001ce5 }, - {0x0000a55c ,0x69024892 ,0x69024892 ,0x56001ce9 ,0x56001ce9 }, - {0x0000a560 ,0x6e024c92 ,0x6e024c92 ,0x5a001ceb ,0x5a001ceb }, - {0x0000a564 ,0x74026e92 ,0x74026e92 ,0x5d001eec ,0x5d001eec }, - {0x0000a568 ,0x74026e92 ,0x74026e92 ,0x5d001eec ,0x5d001eec }, - {0x0000a56c ,0x74026e92 ,0x74026e92 ,0x5d001eec ,0x5d001eec }, - {0x0000a570 ,0x74026e92 ,0x74026e92 ,0x5d001eec ,0x5d001eec }, - {0x0000a574 ,0x74026e92 ,0x74026e92 ,0x5d001eec ,0x5d001eec }, - {0x0000a578 ,0x74026e92 ,0x74026e92 ,0x5d001eec ,0x5d001eec }, - {0x0000a57c ,0x74026e92 ,0x74026e92 ,0x5d001eec ,0x5d001eec }, - {0x0000a580 ,0x00800000 ,0x00800000 ,0x00800000 ,0x00800000 }, - {0x0000a584 ,0x06800003 ,0x06800003 ,0x04800002 ,0x04800002 }, - {0x0000a588 ,0x0a800020 ,0x0a800020 ,0x08800004 ,0x08800004 }, - {0x0000a58c ,0x10800023 ,0x10800023 ,0x0b800200 ,0x0b800200 }, - {0x0000a590 ,0x16800220 ,0x16800220 ,0x0f800202 ,0x0f800202 }, - {0x0000a594 ,0x1c800223 ,0x1c800223 ,0x12800400 ,0x12800400 }, - {0x0000a598 ,0x21802220 ,0x21802220 ,0x16800402 ,0x16800402 }, - {0x0000a59c ,0x27802223 ,0x27802223 ,0x19800404 ,0x19800404 }, - {0x0000a5a0 ,0x2b822220 ,0x2b822220 ,0x1c800603 ,0x1c800603 }, - {0x0000a5a4 ,0x2f822222 ,0x2f822222 ,0x21800a02 ,0x21800a02 }, - {0x0000a5a8 ,0x34822225 ,0x34822225 ,0x25800a04 ,0x25800a04 }, - {0x0000a5ac ,0x3a82222a ,0x3a82222a ,0x28800a20 ,0x28800a20 }, - {0x0000a5b0 ,0x3e82222c ,0x3e82222c ,0x2c800e20 ,0x2c800e20 }, - {0x0000a5b4 ,0x4282242a ,0x4282242a ,0x30800e22 ,0x30800e22 }, - {0x0000a5b8 ,0x4782244a ,0x4782244a ,0x34800e24 ,0x34800e24 }, - {0x0000a5bc ,0x4b82244c ,0x4b82244c ,0x38801640 ,0x38801640 }, - {0x0000a5c0 ,0x4e82246c ,0x4e82246c ,0x3c801660 ,0x3c801660 }, - {0x0000a5c4 ,0x52822470 ,0x52822470 ,0x3f801861 ,0x3f801861 }, - {0x0000a5c8 ,0x55822490 ,0x55822490 ,0x43801a81 ,0x43801a81 }, - {0x0000a5cc ,0x59822492 ,0x59822492 ,0x47801a83 ,0x47801a83 }, - {0x0000a5d0 ,0x5d822692 ,0x5d822692 ,0x4a801c84 ,0x4a801c84 }, - {0x0000a5d4 ,0x61822892 ,0x61822892 ,0x4e801ce3 ,0x4e801ce3 }, - {0x0000a5d8 ,0x65824890 ,0x65824890 ,0x52801ce5 ,0x52801ce5 }, - {0x0000a5dc ,0x69824892 ,0x69824892 ,0x56801ce9 ,0x56801ce9 }, - {0x0000a5e0 ,0x6e824c92 ,0x6e824c92 ,0x5a801ceb ,0x5a801ceb }, - {0x0000a5e4 ,0x74826e92 ,0x74826e92 ,0x5d801eec ,0x5d801eec }, - {0x0000a5e8 ,0x74826e92 ,0x74826e92 ,0x5d801eec ,0x5d801eec }, - {0x0000a5ec ,0x74826e92 ,0x74826e92 ,0x5d801eec ,0x5d801eec }, - {0x0000a5f0 ,0x74826e92 ,0x74826e92 ,0x5d801eec ,0x5d801eec }, - {0x0000a5f4 ,0x74826e92 ,0x74826e92 ,0x5d801eec ,0x5d801eec }, - {0x0000a5f8 ,0x74826e92 ,0x74826e92 ,0x5d801eec ,0x5d801eec }, - {0x0000a5fc ,0x74826e92 ,0x74826e92 ,0x5d801eec ,0x5d801eec }, + {0x0000a410 ,0x000050d8 ,0x000050d8 ,0x000050d9 ,0x000050d9 }, + {0x0000a500 ,0x00002220 ,0x00002220 ,0x00000000 ,0x00000000 }, + {0x0000a504 ,0x04002222 ,0x04002222 ,0x04000002 ,0x04000002 }, + {0x0000a508 ,0x09002421 ,0x09002421 ,0x08000004 ,0x08000004 }, + {0x0000a50c ,0x0d002621 ,0x0d002621 ,0x0b000200 ,0x0b000200 }, + {0x0000a510 ,0x13004620 ,0x13004620 ,0x0f000202 ,0x0f000202 }, + {0x0000a514 ,0x19004a20 ,0x19004a20 ,0x11000400 ,0x11000400 }, + {0x0000a518 ,0x1d004e20 ,0x1d004e20 ,0x15000402 ,0x15000402 }, + {0x0000a51c ,0x21005420 ,0x21005420 ,0x19000404 ,0x19000404 }, + {0x0000a520 ,0x26005e20 ,0x26005e20 ,0x1b000603 ,0x1b000603 }, + {0x0000a524 ,0x2b005e40 ,0x2b005e40 ,0x1f000a02 ,0x1f000a02 }, + {0x0000a528 ,0x2f005e42 ,0x2f005e42 ,0x23000a04 ,0x23000a04 }, + {0x0000a52c ,0x33005e44 ,0x33005e44 ,0x26000a20 ,0x26000a20 }, + {0x0000a530 ,0x38005e65 ,0x38005e65 ,0x2a000e20 ,0x2a000e20 }, + {0x0000a534 ,0x3c005e69 ,0x3c005e69 ,0x2e000e22 ,0x2e000e22 }, + {0x0000a538 ,0x40005e6b ,0x40005e6b ,0x31000e24 ,0x31000e24 }, + {0x0000a53c ,0x44005e6d ,0x44005e6d ,0x34001640 ,0x34001640 }, + {0x0000a540 ,0x49005e72 ,0x49005e72 ,0x38001660 ,0x38001660 }, + {0x0000a544 ,0x4e005eb2 ,0x4e005eb2 ,0x3b001861 ,0x3b001861 }, + {0x0000a548 ,0x53005f12 ,0x53005f12 ,0x3e001a81 ,0x3e001a81 }, + {0x0000a54c ,0x59025eb2 ,0x59025eb2 ,0x42001a83 ,0x42001a83 }, + {0x0000a550 ,0x5e025f12 ,0x5e025f12 ,0x44001c84 ,0x44001c84 }, + {0x0000a554 ,0x61027f12 ,0x61027f12 ,0x48001ce3 ,0x48001ce3 }, + {0x0000a558 ,0x6702bf12 ,0x6702bf12 ,0x4c001ce5 ,0x4c001ce5 }, + {0x0000a55c ,0x6b02bf14 ,0x6b02bf14 ,0x50001ce9 ,0x50001ce9 }, + {0x0000a560 ,0x6f02bf16 ,0x6f02bf16 ,0x54001ceb ,0x54001ceb }, + {0x0000a564 ,0x6f02bf16 ,0x6f02bf16 ,0x56001eec ,0x56001eec }, + {0x0000a568 ,0x6f02bf16 ,0x6f02bf16 ,0x56001eec ,0x56001eec }, + {0x0000a56c ,0x6f02bf16 ,0x6f02bf16 ,0x56001eec ,0x56001eec }, + {0x0000a570 ,0x6f02bf16 ,0x6f02bf16 ,0x56001eec ,0x56001eec }, + {0x0000a574 ,0x6f02bf16 ,0x6f02bf16 ,0x56001eec ,0x56001eec }, + {0x0000a578 ,0x6f02bf16 ,0x6f02bf16 ,0x56001eec ,0x56001eec }, + {0x0000a57c ,0x6f02bf16 ,0x6f02bf16 ,0x56001eec ,0x56001eec }, + {0x0000a580 ,0x00802220 ,0x00802220 ,0x00800000 ,0x00800000 }, + {0x0000a584 ,0x04802222 ,0x04802222 ,0x04800002 ,0x04800002 }, + {0x0000a588 ,0x09802421 ,0x09802421 ,0x08800004 ,0x08800004 }, + {0x0000a58c ,0x0d802621 ,0x0d802621 ,0x0b800200 ,0x0b800200 }, + {0x0000a590 ,0x13804620 ,0x13804620 ,0x0f800202 ,0x0f800202 }, + {0x0000a594 ,0x19804a20 ,0x19804a20 ,0x11800400 ,0x11800400 }, + {0x0000a598 ,0x1d804e20 ,0x1d804e20 ,0x15800402 ,0x15800402 }, + {0x0000a59c ,0x21805420 ,0x21805420 ,0x19800404 ,0x19800404 }, + {0x0000a5a0 ,0x26805e20 ,0x26805e20 ,0x1b800603 ,0x1b800603 }, + {0x0000a5a4 ,0x2b805e40 ,0x2b805e40 ,0x1f800a02 ,0x1f800a02 }, + {0x0000a5a8 ,0x2f805e42 ,0x2f805e42 ,0x23800a04 ,0x23800a04 }, + {0x0000a5ac ,0x33805e44 ,0x33805e44 ,0x26800a20 ,0x26800a20 }, + {0x0000a5b0 ,0x38805e65 ,0x38805e65 ,0x2a800e20 ,0x2a800e20 }, + {0x0000a5b4 ,0x3c805e69 ,0x3c805e69 ,0x2e800e22 ,0x2e800e22 }, + {0x0000a5b8 ,0x40805e6b ,0x40805e6b ,0x31800e24 ,0x31800e24 }, + {0x0000a5bc ,0x44805e6d ,0x44805e6d ,0x34801640 ,0x34801640 }, + {0x0000a5c0 ,0x49805e72 ,0x49805e72 ,0x38801660 ,0x38801660 }, + {0x0000a5c4 ,0x4e805eb2 ,0x4e805eb2 ,0x3b801861 ,0x3b801861 }, + {0x0000a5c8 ,0x53805f12 ,0x53805f12 ,0x3e801a81 ,0x3e801a81 }, + {0x0000a5cc ,0x59825eb2 ,0x59825eb2 ,0x42801a83 ,0x42801a83 }, + {0x0000a5d0 ,0x5e825f12 ,0x5e825f12 ,0x44801c84 ,0x44801c84 }, + {0x0000a5d4 ,0x61827f12 ,0x61827f12 ,0x48801ce3 ,0x48801ce3 }, + {0x0000a5d8 ,0x6782bf12 ,0x6782bf12 ,0x4c801ce5 ,0x4c801ce5 }, + {0x0000a5dc ,0x6b82bf14 ,0x6b82bf14 ,0x50801ce9 ,0x50801ce9 }, + {0x0000a5e0 ,0x6f82bf16 ,0x6f82bf16 ,0x54801ceb ,0x54801ceb }, + {0x0000a5e4 ,0x6f82bf16 ,0x6f82bf16 ,0x56801eec ,0x56801eec }, + {0x0000a5e8 ,0x6f82bf16 ,0x6f82bf16 ,0x56801eec ,0x56801eec }, + {0x0000a5ec ,0x6f82bf16 ,0x6f82bf16 ,0x56801eec ,0x56801eec }, + {0x0000a5f0 ,0x6f82bf16 ,0x6f82bf16 ,0x56801eec ,0x56801eec }, + {0x0000a5f4 ,0x6f82bf16 ,0x6f82bf16 ,0x56801eec ,0x56801eec }, + {0x0000a5f8 ,0x6f82bf16 ,0x6f82bf16 ,0x56801eec ,0x56801eec }, + {0x0000a5fc ,0x6f82bf16 ,0x6f82bf16 ,0x56801eec ,0x56801eec }, {0x0000a600 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, {0x0000a604 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, {0x0000a608 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, {0x0000a60c ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, - {0x0000a610 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }, - {0x0000a614 ,0x02004000 ,0x02004000 ,0x01404000 ,0x01404000 }, - {0x0000a618 ,0x02004801 ,0x02004801 ,0x01404501 ,0x01404501 }, - {0x0000a61c ,0x02808a02 ,0x02808a02 ,0x02008501 ,0x02008501 }, - {0x0000a620 ,0x0380ce03 ,0x0380ce03 ,0x0280ca03 ,0x0280ca03 }, - {0x0000a624 ,0x04411104 ,0x04411104 ,0x03010c04 ,0x03010c04 }, - {0x0000a628 ,0x04411104 ,0x04411104 ,0x04014c04 ,0x04014c04 }, - {0x0000a62c ,0x04411104 ,0x04411104 ,0x04015005 ,0x04015005 }, - {0x0000a630 ,0x04411104 ,0x04411104 ,0x04015005 ,0x04015005 }, - {0x0000a634 ,0x04411104 ,0x04411104 ,0x04015005 ,0x04015005 }, - {0x0000a638 ,0x04411104 ,0x04411104 ,0x04015005 ,0x04015005 }, - {0x0000a63c ,0x04411104 ,0x04411104 ,0x04015005 ,0x04015005 }, - {0x0000b2dc ,0x00033800 ,0x00033800 ,0x03aaa352 ,0x03aaa352 }, - {0x0000b2e0 ,0x0003c000 ,0x0003c000 ,0x03ccc584 ,0x03ccc584 }, - {0x0000b2e4 ,0x03fc0000 ,0x03fc0000 ,0x03f0f800 ,0x03f0f800 }, + {0x0000a610 ,0x00804000 ,0x00804000 ,0x00000000 ,0x00000000 }, + {0x0000a614 ,0x00804201 ,0x00804201 ,0x01404000 ,0x01404000 }, + {0x0000a618 ,0x0280c802 ,0x0280c802 ,0x01404501 ,0x01404501 }, + {0x0000a61c ,0x0280ca03 ,0x0280ca03 ,0x02008501 ,0x02008501 }, + {0x0000a620 ,0x04c15104 ,0x04c15104 ,0x0280ca03 ,0x0280ca03 }, + {0x0000a624 ,0x04c15305 ,0x04c15305 ,0x03010c04 ,0x03010c04 }, + {0x0000a628 ,0x04c15305 ,0x04c15305 ,0x04014c04 ,0x04014c04 }, + {0x0000a62c ,0x04c15305 ,0x04c15305 ,0x04015005 ,0x04015005 }, + {0x0000a630 ,0x04c15305 ,0x04c15305 ,0x04015005 ,0x04015005 }, + {0x0000a634 ,0x04c15305 ,0x04c15305 ,0x04015005 ,0x04015005 }, + {0x0000a638 ,0x04c15305 ,0x04c15305 ,0x04015005 ,0x04015005 }, + {0x0000a63c ,0x04c15305 ,0x04c15305 ,0x04015005 ,0x04015005 }, + {0x0000b2dc ,0x0380c7fc ,0x0380c7fc ,0x03aaa352 ,0x03aaa352 }, + {0x0000b2e0 ,0x0000f800 ,0x0000f800 ,0x03ccc584 ,0x03ccc584 }, + {0x0000b2e4 ,0x03ff0000 ,0x03ff0000 ,0x03f0f800 ,0x03f0f800 }, {0x0000b2e8 ,0x00000000 ,0x00000000 ,0x03ff0000 ,0x03ff0000 }, - {0x0000c2dc ,0x00033800 ,0x00033800 ,0x03aaa352 ,0x03aaa352 }, - {0x0000c2e0 ,0x0003c000 ,0x0003c000 ,0x03ccc584 ,0x03ccc584 }, - {0x0000c2e4 ,0x03fc0000 ,0x03fc0000 ,0x03f0f800 ,0x03f0f800 }, + {0x0000c2dc ,0x0380c7fc ,0x0380c7fc ,0x03aaa352 ,0x03aaa352 }, + {0x0000c2e0 ,0x0000f800 ,0x0000f800 ,0x03ccc584 ,0x03ccc584 }, + {0x0000c2e4 ,0x03ff0000 ,0x03ff0000 ,0x03f0f800 ,0x03f0f800 }, {0x0000c2e8 ,0x00000000 ,0x00000000 ,0x03ff0000 ,0x03ff0000 }, {0x00016044 ,0x012492d4 ,0x012492d4 ,0x012492d4 ,0x012492d4 }, {0x00016048 ,0x66480001 ,0x66480001 ,0x66480001 ,0x66480001 },
Greg Kroah-Hartman
maintainerPATCH 13/171 ath9k: ar9003: fix OTP register offsets for AR9340
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
commit b3cd8021379306c0be6932e4d3b4b01efc681769 upstream.
Trying to access the OTP memory on the AR9340 causes a data bus error like this:
Data bus error, epc == 86e84164, ra == 86e84164 Oops[#1]:
Cpu 0
$ 0 : 00000000 00000061 deadc0de 00000000
$ 4 : b8115f18 00015f18 00000007 00000004
$ 8 : 00000001 7c7c3c7c 7c7c7c7c 7c7c7c7c
$12 : 7c7c3c7c 001f0041 00000000 7c7c7c3c
$16 : 86ee0000 00015f18 00000000 00000007
$20 : 00000004 00000064 00000004 86d71c44
$24 : 00000000 86e6ca00
$28 : 86d70000 86d71b20 86ece0c0 86e84164
Hi : 00000000
Lo : 00000064
epc : 86e84164 ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
Tainted: G O
ra : 86e84164 ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
Status: 1100d403 KERNEL EXL IE
Cause : 4080801c
PrId : 0001974c (MIPS 74Kc)
Modules linked in: ath9k(O+) ath9k_common(O) ath9k_hw(O) ath(O) ar934x_nfc
mac80211(O) usbcore usb_common scsi_mod nls_base nand nand_ecc nand_ids
crc_ccitt cfg80211(O) compat(O) arc4 aes_generic crypto_blkcipher cryptomgr
aead crypto_hash crypto_algapi ledtrig_timer ledtrig_default_on leds_gpio
Process insmod (pid: 459, threadinfo=86d70000, task=87942140, tls=779ac440)
Stack : 802fb500 000200da 804db150 804e0000 87816130 86ee0000 00010000 86d71b88
86d71bc0 00000004 00000003 86e9fcd0 80305300 0002c0d0 86e74c50 800b4c20
000003e8 00000001 00000000 86ee0000 000003ff 86e9fd64 80305300 80123938
fffffffc 00000004 000058bc 00000000 86ea0000 86ee0000 000001ff 878d6000
99999999 86e9fdc0 86ee0fcc 86e9e664 0000c0d0 86ee0000 0000700000007000
...
Call Trace:
[<86e84164>] ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
[<86e9fcd0>] ath9k_hw_setup_statusring+0x16b8/0x1c7c [ath9k_hw]Code: 0000a812 0040f809 00000000 <00531024> 1054000b 24020001 0c05b5dc 2404000a 26520001
The cause of the error is that the OTP register offsets are different on the AR9340 than the actually used values.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +3 -3
@@ -69,13 +69,13 @@#define AR9300_BASE_ADDR 0x3ff#define AR9300_BASE_ADDR_512 0x1ff -#define AR9300_OTP_BASE 0x14000 -#define AR9300_OTP_STATUS 0x15f18 +#define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000) +#define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18)#define AR9300_OTP_STATUS_TYPE 0x7#define AR9300_OTP_STATUS_VALID 0x4#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2#define AR9300_OTP_STATUS_SM_BUSY 0x1 -#define AR9300_OTP_READ_DATA 0x15f1c +#define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c)enum targetPowerHTRates {HT_TARGET_RATE_0_8_16 ,
Greg Kroah-Hartman
maintainerPATCH 14/171 ath9k_hw: Fix signal strength / channel noise reporting
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit b7c0c238898d200e80487516e2b67aba2a522cc0 upstream.
While AR_PHY_CCA_NOM_VAL_* does contain the expected internal noise floor for a chip measured in clean air, it refers to the lowest expected reading.
Depending on the frequency, this measurement can vary by about 6db, thus causing a higher reported channel noise and signal strength.
Factor in the 6db offset when converting internal noisefloor to channel noise.
This patch makes the reported values more accurate for all chips without affecting NF calibration behavior.
--- drivers/net/wireless/ath/ath9k/calib.c | 1 + drivers/net/wireless/ath/ath9k/calib.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/net/wireless/ath/ath9k/calib.c +1 -0
@@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hwif (chan && chan->noisefloor) {s8 delta = chan->noisefloor - +ATH9K_NF_CAL_NOISE_THRESH -ath9k_hw_get_default_nf (ah, chan);if (delta >0 ) noise += delta;
drivers/net/wireless/ath/ath9k/calib.h +3 -0
@@ -21,6 +21,9 @@#define AR_PHY_CCA_FILTERWINDOW_LENGTH 5 +/* Internal noise floor can vary by about 6db depending on the frequency */ +#define ATH9K_NF_CAL_NOISE_THRESH 6 +#define NUM_NF_READINGS 6#define ATH9K_NF_CAL_HIST_MAX 5
Greg Kroah-Hartman
maintainerPATCH 15/171 firewire: net: Fix handling of fragmented multicast/broadcast packets.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gatzka <[email protected]>
commit 9d2373420900a39f5212a3b289331aa3535b1000 upstream.
This patch fixes both the transmit and receive portion of sending fragmented mutlicast and broadcast packets.
The transmit section was broken because the offset for INTFRAG and LASTFRAG packets were just miscalculated by IEEE1394_GASP_HDR_SIZE (which was reserved with skb_push() in fwnet_send_packet).
The receive section was broken because in fwnet_incoming_packet is a call to fwnet_peer_find_by_node_id(). Called with generation == -1 it will not find a peer and the partial datagrams are associated to a peer.
[Stefan R: The fix to use context->card->generation is not perfect. It relies on the IR tasklet which processes packets from the prior bus generation to run before the self-ID-complete worklet which sets the current card generation. Alas, there is no simple way of a race-free implementation. Let's do it this way for now.]
--- drivers/firewire/net.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/firewire/net.c +9 -4
@@ -861,8 +861,8 @@ static void fwnet_receive_broadcast(struif (specifier_id ==IANA_SPECIFIER_ID && ver ==RFC2734_SW_VERSION ) { buf_ptr +=2 ; length -=IEEE1394_GASP_HDR_SIZE ; -fwnet_incoming_packet (dev, buf_ptr, length, - source_node_id,-1 , true); +fwnet_incoming_packet (dev, buf_ptr, length, source_node_id, + context->card->generation, true); } packet.payload_length = dev->rcv_buffer_size;
@@ -958,7 +958,12 @@ static void fwnet_transmit_packet_done(sbreak ; } -skb_pull (skb, ptask->max_payload); +if (ptask->dest_node ==IEEE1394_ALL_NODES ) { +skb_pull (skb, + ptask->max_payload +IEEE1394_GASP_HDR_SIZE ); + }else { +skb_pull (skb, ptask->max_payload); + }if (ptask->outstanding_pkts >1 ) {fwnet_make_sf_hdr (&ptask->hdr,RFC2374_HDR_INTFRAG , dg_size, fg_off, datagram_label);
@@ -1062,7 +1067,7 @@ static int fwnet_send_packet(struct fwnesmp_rmb (); node_id = dev->card->node_id; - p =skb_push (ptask->skb,8 ); + p =skb_push (ptask->skb,IEEE1394_GASP_HDR_SIZE );put_unaligned_be32 (node_id <<16 |IANA_SPECIFIER_ID >>8 , p);put_unaligned_be32 ((IANA_SPECIFIER_ID &0xff ) <<24 |RFC2734_SW_VERSION , &p[4 ]);
Greg Kroah-Hartman
maintainerPATCH 16/171 ASoC: sigmadsp: Fix endianness conversion issue
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit a3adb1432d7a3ad86bb17a1638e44414537e4118 upstream.
The 'addr' field of the sigma_action struct is stored as big endian in the firmware file.
--- sound/soc/codecs/sigmadsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/sigmadsp.c +1 -1
@@ -225,7 +225,7 @@ EXPORT_SYMBOL(process_sigma_firmware);static int sigma_action_write_regmap (void *control_data,const struct sigma_action *sa,size_t len) { -return regmap_raw_write (control_data,le16_to_cpu (sa->addr), +return regmap_raw_write (control_data,be16_to_cpu (sa->addr), sa->payload, len -2 ); }
Greg Kroah-Hartman
maintainerPATCH 17/171 SCSI: mvsas: Fix oops when ata commond timeout.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianpeng Ma <[email protected]>
commit 95ab000388974d8ffef8257306b4be6e8778b768 upstream.
Kernel message follows:
[ 511.712011] sd 11:0:0:0: [sdf] command ffff8800a4e81400 timed out [ 511.712022] sas: Enter sas_scsi_recover_host busy: 1 failed: 1 [ 511.712024] sas: trying to find task 0xffff8800a4d24c80 [ 511.712026] sas: sas_scsi_find_task: aborting task 0xffff8800a4d24c80 [ 511.712029] drivers/scsi/mvsas/mv_sas.c 1631:mvs_abort_task() mvi=ffff8800b5300000 task=ffff8800a4d24c80 slot=ffff8800b5325038 slot_idx=x0 [ 511.712035] BUG: unable to handle kernel NULL pointer dereference at 0000000000000058 [ 511.712040] IP: [<ffffffff815f8c0c>] _raw_spin_lock_irqsave+0xc/0x30 [ 511.712047] PGD 0 [ 511.712049] Oops: 0002 [#1] SMP [ 511.712052] Modules linked in: mvsas libsas scsi_transport_sas raid456 async_pq async_xor xor async_memcpy async_raid6_recov raid6_pq async_tx [last unloaded: mvsas] [ 511.712062] CPU 3 [ 511.712066] Pid: 7322, comm: scsi_eh_11 Not tainted 3.5.0+ #106 To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M. [ 511.712068] RIP: 0010:[<ffffffff815f8c0c>] [<ffffffff815f8c0c>] _raw_spin_lock_irqsave+0xc/0x30 [ 511.712073] RSP: 0018:ffff880098d3bcb0 EFLAGS: 00010086 [ 511.712074] RAX: 0000000000000286 RBX: 0000000000000058 RCX: 00000000000000c3 [ 511.712076] RDX: 0000000000000100 RSI: 0000000000000046 RDI: 0000000000000058 [ 511.712078] RBP: ffff880098d3bcb0 R08: 000000000000000a R09: 0000000000000000 [ 511.712080] R10: 00000000000004e8 R11: 00000000000004e7 R12: ffff8800a4d24c80 [ 511.712082] R13: 0000000000000050 R14: ffff8800b5325038 R15: ffff8800a4eafe00 [ 511.712084] FS: 0000000000000000(0000) GS:ffff8800bdb80000(0000) knlGS:0000000000000000 [ 511.712086] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 511.712088] CR2: 0000000000000058 CR3: 00000000a4ce6000 CR4: 00000000000407e0 [ 511.712090] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 511.712091] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 511.712093] Process scsi_eh_11 (pid: 7322, threadinfo ffff880098d3a000, task ffff8800a61dde40) [ 511.712095] Stack: [ 511.712096] ffff880098d3bce0 ffffffff81060683 ffff880000000000 0000000000000000 [ 511.712099] ffff8800a4d24c80 ffff8800b5300000 ffff880098d3bcf0 ffffffffa0076a88 [ 511.712102] ffff880098d3bd50 ffffffffa0079bb5 ffff880000000000 ffff880000000018 [ 511.712106] Call Trace: [ 511.712110] [<ffffffff81060683>] complete+0x23/0x60 [ 511.712115] [<ffffffffa0076a88>] mvs_tmf_timedout+0x18/0x20 [mvsas] [ 511.712119] [<ffffffffa0079bb5>] mvs_slot_complete+0x765/0x7d0 [mvsas] [ 511.712125] [<ffffffffa005a17d>] sas_scsi_recover_host+0x55d/0xdb0 [libsas] [ 511.712128] [<ffffffff8106d600>] ? idle_balance+0xe0/0x130 [ 511.712133] [<ffffffff813b150c>] scsi_error_handler+0xcc/0x470 [ 511.712136] [<ffffffff815f7ad0>] ? __schedule+0x370/0x730 [ 511.712139] [<ffffffff8105f728>] ? __wake_up_common+0x58/0x90 [ 511.712142] [<ffffffff813b1440>] ? scsi_eh_get_sense+0x110/0x110 [ 511.712146] [<ffffffff810571be>] kthread+0x8e/0xa0 [ 511.712150] [<ffffffff816015f4>] kernel_thread_helper+0x4/0x10 [ 511.712153] [<ffffffff81057130>] ? flush_kthread_work+0x120/0x120 [ 511.712156] [<ffffffff816015f0>] ? gs_change+0xb/0xb [ 511.712157] Code: 8a 00 01 00 00 89 d0 f0 66 0f b1 0f 66 39 d0 0f 94 c0 0f b6 c0 5d c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 9c 58 fa ba 00 01 00 00 <f0> 66 0f c1 17 0f b6 ce 38 d1 74 11 0f 1f 84 00 00 00 00 00 f3 [ 511.712191] RIP [<ffffffff815f8c0c>] _raw_spin_lock_irqsave+0xc/0x30 [ 511.712194] RSP <ffff880098d3bcb0> [ 511.712196] CR2: 0000000000000058 [ 511.712198] ---[ end trace a781c7b1e65db92c ]---
--- drivers/scsi/mvsas/mv_sas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mvsas/mv_sas.c +1 -1
@@ -1629,7 +1629,7 @@ int mvs_abort_task(struct sas_task *taskmv_dprintk ("mvs_abort_task() mvi=%p task=%p " "slot=%p slot_idx=x%x\n" , mvi, task, slot, slot_idx); -mvs_tmf_timedout ((unsigned long )task); + task->task_state_flags |=SAS_TASK_STATE_ABORTED ;mvs_slot_task_free (mvi, task, slot, slot_idx); rc =TMF_RESP_FUNC_COMPLETE ; goto out;
Greg Kroah-Hartman
maintainerPATCH 18/171 SCSI: mvsas: fix undefined bit shift
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Wang <[email protected]>
commit beecadea1b8d67f591b13f7099559f32f3fd601d upstream.
The macro bit(n) is defined as ((u32)1 << n), and thus it doesn't work with n >= 32, such as in mvs_94xx_assign_reg_set():
if (i >= 32) {
mvi->sata_reg_set |= bit(i);
...
}The shift ((u32)1 << n) with n >= 32 also leads to undefined behavior. The result varies depending on the architecture.
This patch changes bit(n) to do a 64-bit shift. It also simplifies mv_ffc64() using __ffs64(), since invoking ffz() with ~0 is undefined.
--- drivers/scsi/mvsas/mv_94xx.h | 14 ++------------ drivers/scsi/mvsas/mv_sas.h | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-)
drivers/scsi/mvsas/mv_94xx.h +2 -12
@@ -258,21 +258,11 @@ enum sas_sata_phy_regs {#define SPI_ADDR_VLD_94XX (1U << 1)#define SPI_CTRL_SpiStart_94XX (1U << 0) -#define mv_ffc (x) ffz(x) -static inline int mv_ffc64 (u64 v) { -int i; - i =mv_ffc ((u32 )v); -if (i >=0 ) -return i; - i =mv_ffc ((u32)(v>>32 )); - -if (i !=0 ) -return 32 + i; - -return -1 ; +u64 x = ~v; +return x ?__ffs64 (x) :-1 ; }#define r_reg_set_enable (i) \
drivers/scsi/mvsas/mv_sas.h +1 -1
@@ -69,7 +69,7 @@ extern struct kmem_cache *mvs_task_list_#define DEV_IS_EXPANDER (type) \ ((type == EDGE_DEV) || (type == FANOUT_DEV)) -#define bit (n) ((u32)1 << n) +#define bit (n) ((u64)1 << n)#define for_each_phy (__lseq_mask, __mc, __lseq) \ for ((__mc) = (__lseq_mask), (__lseq) = 0; \
Greg Kroah-Hartman
maintainerPATCH 19/171 SCSI: prevent stack buffer overflow in host_reset
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit 072f19b4bea31cdd482d79f805413f2f9ac9e233 upstream.
store_host_reset() has tried to re-invent the wheel to compare sysfs strings. Unfortunately it did so poorly and never bothered to check the input from userspace before overwriting stack with it, so something simple as:
echo "WoopsieWoopsie" > /sys/devices/pseudo_0/adapter0/host0/scsi_host/host0/host_reset
would result in:
[ 316.310101] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff81f5bac7 [ 316.310101] [ 316.320051] Pid: 6655, comm: sh Tainted: G W 3.7.0-rc5-next-20121114-sasha-00016-g5c9d68d-dirty #129 [ 316.320051] Call Trace: [ 316.340058] pps pps0: PPS event at 1352918752.620355751 [ 316.340062] pps pps0: capture assert seq #303 [ 316.320051] [<ffffffff83b3856b>] panic+0xcd/0x1f4 [ 316.320051] [<ffffffff81f5bac7>] ? store_host_reset+0xd7/0x100 [ 316.320051] [<ffffffff8110b996>] __stack_chk_fail+0x16/0x20 [ 316.320051] [<ffffffff81f5bac7>] store_host_reset+0xd7/0x100 [ 316.320051] [<ffffffff81e55bb3>] dev_attr_store+0x13/0x30 [ 316.320051] [<ffffffff812f7db1>] sysfs_write_file+0x101/0x170 [ 316.320051] [<ffffffff8127acc8>] vfs_write+0xb8/0x180 [ 316.320051] [<ffffffff8127ae80>] sys_write+0x50/0xa0 [ 316.320051] [<ffffffff83c03418>] tracesys+0xe1/0xe6
Fix this by uninventing whatever was going on there and just use sysfs_streq.
Bug introduced by 29443691 ("[SCSI] scsi: Added support for adapter and firmware reset").
--- drivers/scsi/scsi_sysfs.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/scsi/scsi_sysfs.c +4 -7
@@ -246,11 +246,11 @@ show_shost_active_mode(struct device *de static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); -static int check_reset_type (char *str) +static int check_reset_type (const char *str) { -if (strncmp (str,"adapter" ,10 ) ==0 ) +if (sysfs_streq (str,"adapter" ))return SCSI_ADAPTER_RESET ; -else if (strncmp (str,"firmware" ,10 ) ==0 ) +else if (sysfs_streq (str,"firmware" ))return SCSI_FIRMWARE_RESET ;else return 0 ;
@@ -263,12 +263,9 @@ store_host_reset(struct device *dev, strstruct Scsi_Host *shost =class_to_shost (dev);struct scsi_host_template *sht = shost->hostt;int ret = -EINVAL ; -char str[10 ];int type; -sscanf (buf,"%s" , str); - type =check_reset_type (str); - + type =check_reset_type (buf);if (!type) goto exit_store_host_reset;
Greg Kroah-Hartman
maintainerPATCH 20/171 SCSI: qla2xxx: Test and clear FCPORT_UPDATE_NEEDED atomically.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Jeffery <[email protected]>
commit a394aac88506159e047630fc90dc2242568382d8 upstream.
When the qla2xxx driver loses access to multiple, remote ports, there is a race condition which can occur which will keep the request stuck on a scsi request queue indefinitely.
This bad state occurred do to a race condition with how the FCPORT_UPDATE_NEEDED bit is set in qla2x00_schedule_rport_del(), and how it is cleared in qla2x00_do_dpc(). The problem port has its drport pointer set, but it has never been processed by the driver to inform the fc transport that the port has been lost. qla2x00_schedule_rport_del() sets drport, and then sets the FCPORT_UPDATE_NEEDED bit. In qla2x00_do_dpc(), the port lists are walked and any drport pointer is handled and the fc transport informed of the port loss, then the FCPORT_UPDATE_NEEDED bit is cleared. This leaves a race where the dpc thread is processing one port removal, another port removal is marked with a call to qla2x00_schedule_rport_del(), and the dpc thread clears the bit for both removals, even though only the first removal was actually handled. Until another event occurs to set FCPORT_UPDATE_NEEDED, the later port removal is never finished and qla2xxx stays in a bad state which causes requests to become stuck on request queues.
This patch updates the driver to test and clear FCPORT_UPDATE_NEEDED atomically. This ensures the port state changes are processed and not lost.
--- drivers/scsi/qla2xxx/qla_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +2 -2
@@ -3735,9 +3735,9 @@ qla2x00_do_dpc(void *data) "ISP abort end.\n"); } -if (test_bit (FCPORT_UPDATE_NEEDED , &base_vha->dpc_flags)) { +if (test_and_clear_bit (FCPORT_UPDATE_NEEDED , + &base_vha->dpc_flags)) {qla2x00_update_fcports (base_vha); -clear_bit (FCPORT_UPDATE_NEEDED , &base_vha->dpc_flags); }if (test_bit (ISP_QUIESCE_NEEDED , &base_vha->dpc_flags)) {
Greg Kroah-Hartman
maintainerPATCH 21/171 iscsit: use GFP_ATOMIC under spin lock
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 3c989d7603872bf878840f7ce3ea49b73bea4c6c upstream.
The function iscsit_build_conn_drop_async_message() is called from iscsit_close_connection() with spin lock 'sess->conn_lock' held, so we should use GFP_ATOMIC instead of GFP_KERNEL.
--- drivers/target/iscsi/iscsi_target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target.c +1 -1
@@ -2359,7 +2359,7 @@ static void iscsit_build_conn_drop_asyncif (!conn_p)return ; - cmd =iscsit_allocate_cmd (conn_p,GFP_KERNEL ); + cmd =iscsit_allocate_cmd (conn_p,GFP_ATOMIC );if (!cmd) {iscsit_dec_conn_usage_count (conn_p);return ;
Greg Kroah-Hartman
maintainerPATCH 22/171 sata_promise: fix hardreset lockdep error
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikael Pettersson <[email protected]>
commit 3100d49d3cd236443faae9d81137c81b22d36003 upstream.
sata_promise's pdc_hard_reset_port() needs to serialize because it flips a port-specific bit in controller register that's shared by all ports. The code takes the ata host lock for this, but that's broken because an interrupt may arrive on our irq during the hard reset sequence, and that too will take the ata host lock. With lockdep enabled a big nasty warning is seen.
Fixed by adding private state to the ata host structure, containing a second lock used only for serializing the hard reset sequences. This eliminated the lockdep warnings both on my test rig and on the original reporter's machine.
--- drivers/ata/sata_promise.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/ata/sata_promise.c +13 -2
@@ -147,6 +147,10 @@ struct pdc_port_priv {dma_addr_t pkt_dma; }; +struct pdc_host_priv { +spinlock_t hard_reset_lock; +}; +static int pdc_sata_scr_read (struct ata_link *link,unsigned int sc_reg,u32 *val);static int pdc_sata_scr_write (struct ata_link *link,unsigned int sc_reg,u32 val);static int pdc_ata_init_one (struct pci_dev *pdev,const struct pci_device_id *ent);
@@ -801,9 +805,10 @@ static void pdc_hard_reset_port(struct avoid __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR ];void __iomem *pcictl_b1_mmio = host_mmio +PDC_PCI_CTL +1 ;unsigned int ata_no =pdc_ata_port_to_ata_no (ap); +struct pdc_host_priv *hpriv = ap->host->private_data;u8 tmp; -spin_lock (&ap->host->lock); +spin_lock (&hpriv->hard_reset_lock); tmp =readb (pcictl_b1_mmio); tmp &= ~(0x10 << ata_no);
@@ -814,7 +819,7 @@ static void pdc_hard_reset_port(struct awriteb (tmp, pcictl_b1_mmio);readb (pcictl_b1_mmio);/* flush */ -spin_unlock (&ap->host->lock); +spin_unlock (&hpriv->hard_reset_lock); } static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class,
@@ -1182,6 +1187,7 @@ static int pdc_ata_init_one(struct pci_dconst struct ata_port_info *pi = &pdc_port_info[ent->driver_data];const struct ata_port_info *ppi[PDC_MAX_PORTS ];struct ata_host *host; +struct pdc_host_priv *hpriv;void __iomem *host_mmio;int n_ports, i, rc;int is_sataii_tx4;
@@ -1218,6 +1224,11 @@ static int pdc_ata_init_one(struct pci_ddev_err (&pdev->dev,"failed to allocate host\n" );return -ENOMEM ; } + hpriv =devm_kzalloc (&pdev->dev,sizeof *hpriv,GFP_KERNEL ); +if (!hpriv) +return -ENOMEM ; +spin_lock_init (&hpriv->hard_reset_lock); + host->private_data = hpriv; host->iomap =pcim_iomap_table (pdev); is_sataii_tx4 =pdc_is_sataii_tx4 (pi->flags);
Greg Kroah-Hartman
maintainerPATCH 23/171 libata: set dma_mode to 0xff in reset
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
commit 5416912af75de9cba5d1c75b99a7888b0bbbd2fb upstream.
ata_device->dma_mode's initial value is zero, which is not a valid dma mode, but ata_dma_enabled will return true for this value. This patch sets dma_mode to 0xff in reset function, so that ata_dma_enabled will not return true for this case, or it will cause problem for pata_acpi.
The corrsponding bugzilla page is at:
https://bugzilla.kernel.org/show_bug.cgi?id=49151
--- drivers/ata/libata-core.c | 1 + drivers/ata/libata-eh.c | 1 + 2 files changed, 2 insertions(+)
drivers/ata/libata-core.c +1 -0
@@ -2536,6 +2536,7 @@ int ata_bus_probe(struct ata_port *ap)* bus as we may be talking too fast. */ dev->pio_mode =XFER_PIO_0 ; + dev->dma_mode =0xff ;/* If the controller has a pio mode setup function * then use it to set the chipset to rights. Don't
drivers/ata/libata-eh.c +1 -0
@@ -2600,6 +2600,7 @@ int ata_eh_reset(struct ata_link *link,* bus as we may be talking too fast. */ dev->pio_mode =XFER_PIO_0 ; + dev->dma_mode =0xff ;/* If the controller has a pio mode setup function * then use it to set the chipset to rights. Don't
Greg Kroah-Hartman
maintainerPATCH 24/171 libata: fix Null pointer dereference on disk error
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaotian Feng <[email protected]>
commit 26cd4d65deba587f3cf2329b6869ce02bcbe68ec upstream.
Following oops were observed when disk error happened:
[ 4272.896937] sd 0:0:0:0: [sda] Unhandled error code [ 4272.896939] sd 0:0:0:0: [sda] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [ 4272.896942] sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 5a de a7 00 00 08 00 [ 4272.896951] end_request: I/O error, dev sda, sector 5955239 [ 4291.574947] BUG: unable to handle kernel NULL pointer dereference at (null) [ 4291.658305] IP: [] ahci_activity_show+0x1/0x40 [ 4291.730090] PGD 76dbbc067 PUD 6c4fba067 PMD 0 [ 4291.783408] Oops: 0000 [#1] SMP [ 4291.822100] last sysfs file: /sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity [ 4291.934235] CPU 9 [ 4291.958301] Pid: 27942, comm: hwinfo ......
ata_scsi_find_dev could return NULL, so ata_scsi_activity_{show,store} should check if atadev is NULL.
--- drivers/ata/libata-scsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +4 -2
@@ -309,7 +309,8 @@ ata_scsi_activity_show(struct device *destruct ata_port *ap =ata_shost_to_port (sdev->host);struct ata_device *atadev =ata_scsi_find_dev (ap, sdev); -if (ap->ops->sw_activity_show && (ap->flags &ATA_FLAG_SW_ACTIVITY )) +if (atadev && ap->ops->sw_activity_show && + (ap->flags &ATA_FLAG_SW_ACTIVITY ))return ap->ops->sw_activity_show (atadev, buf);return -EINVAL ; }
@@ -324,7 +325,8 @@ ata_scsi_activity_store(struct device *denum sw_activity val;int rc; -if (ap->ops->sw_activity_store && (ap->flags &ATA_FLAG_SW_ACTIVITY )) { +if (atadev && ap->ops->sw_activity_store && + (ap->flags &ATA_FLAG_SW_ACTIVITY )) { val =simple_strtoul (buf,NULL ,0 );switch (val) {case OFF :case BLINK_ON :case BLINK_OFF :
Greg Kroah-Hartman
maintainerPATCH 25/171 target/tcm_fc: fix the lockdep warning due to inconsistent lock state
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Zou <[email protected]>
commit 9f4ad44b264f8bb61ffdd607148215566568430d upstream.
The lockdep warning below is in theory correct but it will be in really weird rare situation that ends up that deadlock since the tcm fc session is hashed based the rport id. Nonetheless, the complaining below is about rcu callback that does the transport_deregister_session() is happening in softirq, where transport_register_session() that happens earlier is not. This triggers the lockdep warning below. So, just fix this to make lockdep happy by disabling the soft irq before calling transport_register_session() in ft_prli.
BTW, this was found in FCoE VN2VN over two VMs, couple of create and destroy would get this triggered.
v1: was enforcing register to be in softirq context which was not righ. See,
http://www.spinics.net/lists/target-devel/msg03614.html
v2: following comments from Roland&Nick (thanks), it seems we don't have to do transport_deregister_session() in rcu callback, so move it into ft_sess_free() but still do kfree() of the corresponding ft_sess struct in rcu callback to make sure the ft_sess is not freed till the rcu callback.
...
[ 1328.370592] scsi2 : FCoE Driver
[ 1328.383429] fcoe: No FDMI support.
[ 1328.384509] host2: libfc: Link up on port (000000)
[ 1328.934229] host2: Assigned Port ID 00a292
[ 1357.232132] host2: rport 00a393: Remove port
[ 1357.232568] host2: rport 00a393: Port sending LOGO from Ready state
[ 1357.233692] host2: rport 00a393: Delete port
[ 1357.234472] host2: rport 00a393: work event 3
[ 1357.234969] host2: rport 00a393: callback ev 3
[ 1357.235979] host2: rport 00a393: Received a LOGO response closed
[ 1357.236706] host2: rport 00a393: work delete
[ 1357.237481]
[ 1357.237631] =================================
[ 1357.238064] [ INFO: inconsistent lock state ]
[ 1357.238450] 3.7.0-rc7-yikvm+ #3 Tainted: G O
[ 1357.238450] ---------------------------------
[ 1357.238450] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[ 1357.238450] ksoftirqd/0/3 [HC0[0]:SC1[1]:HE0:SE0] takes:
[ 1357.238450] (&(&se_tpg->session_lock)->rlock){+.?...}, at: [<ffffffffa01eacd4>] transport_deregister_session+0x41/0x148 [target_core_mod]
[ 1357.238450] {SOFTIRQ-ON-W} state was registered at:
[ 1357.238450] [<ffffffff810834f5>] mark_held_locks+0x6d/0x95
[ 1357.238450] [<ffffffff8108364a>] trace_hardirqs_on_caller+0x12d/0x197
[ 1357.238450] [<ffffffff810836c1>] trace_hardirqs_on+0xd/0xf
[ 1357.238450] [<ffffffff8149caba>] _raw_spin_unlock_irq+0x2d/0x45
[ 1357.238450] [<ffffffffa01e8d10>] __transport_register_session+0xb8/0x122 [target_core_mod]
[ 1357.238450] [<ffffffffa01e8dbe>] transport_register_session+0x44/0x5a [target_core_mod]
[ 1357.238450] [<ffffffffa018e32c>] ft_prli+0x1e3/0x275 [tcm_fc]
[ 1357.238450] [<ffffffffa0160e8d>] fc_rport_recv_req+0x95e/0xdc5 [libfc]
[ 1357.238450] [<ffffffffa015be88>] fc_lport_recv_els_req+0xc4/0xd5 [libfc]
[ 1357.238450] [<ffffffffa015c778>] fc_lport_recv_req+0x12f/0x18f [libfc]
[ 1357.238450] [<ffffffffa015a6d7>] fc_exch_recv+0x8ba/0x981 [libfc]
[ 1357.238450] [<ffffffffa0176d7a>] fcoe_percpu_receive_thread+0x47a/0x4e2 [fcoe]
[ 1357.238450] [<ffffffff810549f1>] kthread+0xb1/0xb9
[ 1357.238450] [<ffffffff814a40ec>] ret_from_fork+0x7c/0xb0
[ 1357.238450] irq event stamp: 275411
[ 1357.238450] hardirqs last enabled at (275410): [<ffffffff810bb6a0>] rcu_process_callbacks+0x229/0x42a
[ 1357.238450] hardirqs last disabled at (275411): [<ffffffff8149c2f7>] _raw_spin_lock_irqsave+0x22/0x8e
[ 1357.238450] softirqs last enabled at (275394): [<ffffffff8103d669>] __do_softirq+0x246/0x26f
[ 1357.238450] softirqs last disabled at (275399): [<ffffffff8103d6bb>] run_ksoftirqd+0x29/0x62
[ 1357.238450]
[ 1357.238450] other info that might help us debug this:
[ 1357.238450] Possible unsafe locking scenario:
[ 1357.238450]
[ 1357.238450] CPU0
[ 1357.238450] ----
[ 1357.238450] lock(&(&se_tpg->session_lock)->rlock);
[ 1357.238450] <Interrupt>
[ 1357.238450] lock(&(&se_tpg->session_lock)->rlock);
[ 1357.238450]
[ 1357.238450] *** DEADLOCK ***
[ 1357.238450]
[ 1357.238450] no locks held by ksoftirqd/0/3.
[ 1357.238450]
[ 1357.238450] stack backtrace:
[ 1357.238450] Pid: 3, comm: ksoftirqd/0 Tainted: G O 3.7.0-rc7-yikvm+ #3
[ 1357.238450] Call Trace:
[ 1357.238450] [<ffffffff8149399a>] print_usage_bug+0x1f5/0x206
[ 1357.238450] [<ffffffff8100da59>] ? save_stack_trace+0x2c/0x49
[ 1357.238450] [<ffffffff81082aae>] ? print_irq_inversion_bug.part.14+0x1ae/0x1ae
[ 1357.238450] [<ffffffff81083336>] mark_lock+0x106/0x258
[ 1357.238450] [<ffffffff81084e34>] __lock_acquire+0x2e7/0xe53
[ 1357.238450] [<ffffffff8102903d>] ? pvclock_clocksource_read+0x48/0xb4
[ 1357.238450] [<ffffffff810ba6a3>] ? rcu_process_gp_end+0xc0/0xc9
[ 1357.238450] [<ffffffffa01eacd4>] ? transport_deregister_session+0x41/0x148 [target_core_mod]
[ 1357.238450] [<ffffffff81085ef1>] lock_acquire+0x119/0x143
[ 1357.238450] [<ffffffffa01eacd4>] ? transport_deregister_session+0x41/0x148 [target_core_mod]
[ 1357.238450] [<ffffffff8149c329>] _raw_spin_lock_irqsave+0x54/0x8e
[ 1357.238450] [<ffffffffa01eacd4>] ? transport_deregister_session+0x41/0x148 [target_core_mod]
[ 1357.238450] [<ffffffffa01eacd4>] transport_deregister_session+0x41/0x148 [target_core_mod]
[ 1357.238450] [<ffffffff810bb6a0>] ? rcu_process_callbacks+0x229/0x42a
[ 1357.238450] [<ffffffffa018ddc5>] ft_sess_rcu_free+0x17/0x24 [tcm_fc]
[ 1357.238450] [<ffffffffa018ddae>] ? ft_sess_free+0x1b/0x1b [tcm_fc]
[ 1357.238450] [<ffffffff810bb6d7>] rcu_process_callbacks+0x260/0x42a
[ 1357.238450] [<ffffffff8103d55d>] __do_softirq+0x13a/0x26f
[ 1357.238450] [<ffffffff8149b34e>] ? __schedule+0x65f/0x68e
[ 1357.238450] [<ffffffff8103d6bb>] run_ksoftirqd+0x29/0x62
[ 1357.238450] [<ffffffff8105c83c>] smpboot_thread_fn+0x1a5/0x1aa
[ 1357.238450] [<ffffffff8105c697>] ? smpboot_unregister_percpu_thread+0x47/0x47
[ 1357.238450] [<ffffffff810549f1>] kthread+0xb1/0xb9
[ 1357.238450] [<ffffffff8149b49d>] ? wait_for_common+0xbb/0x10a
[ 1357.238450] [<ffffffff81054940>] ? __init_kthread_worker+0x59/0x59
[ 1357.238450] [<ffffffff814a40ec>] ret_from_fork+0x7c/0xb0
[ 1357.238450] [<ffffffff81054940>] ? __init_kthread_worker+0x59/0x59
[ 1417.440099] rport-2:0-0: blocked FC remote port time out: removing rport--- drivers/target/tcm_fc/tfc_sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/tcm_fc/tfc_sess.c +1 -1
@@ -431,7 +431,6 @@ static void ft_sess_rcu_free(struct rcu_ { struct ft_sess *sess = container_of(rcu, struct ft_sess, rcu); -transport_deregister_session (sess->se_sess);kfree (sess); }
@@ -439,6 +438,7 @@ static void ft_sess_free(struct kref *kr { struct ft_sess *sess = container_of(kref, struct ft_sess, kref); +transport_deregister_session (sess->se_sess);call_rcu (&sess->rcu, ft_sess_rcu_free); }
Greg Kroah-Hartman
maintainerPATCH 26/171 mfd: wm8994: Add support for WM1811 rev E
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit fee546ce8cfd9dea1f53175f627e17ef5ff05df4 upstream.
This is supported identically to the previous revisions.
--- drivers/mfd/wm8994-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/wm8994-core.c +1 -0
@@ -541,6 +541,7 @@ static __devinit int wm8994_device_init(case 1 :case 2 :case 3 : +case 4 : regmap_patch = wm1811_reva_patch; patch_regs =ARRAY_SIZE (wm1811_reva_patch);break ;
Greg Kroah-Hartman
maintainerPATCH 27/171 mfd: Only unregister platform devices allocated by the mfd core
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit b9fbb62eb61452d728c39b2e5020739c575aac53 upstream.
mfd_remove_devices would iterate over all devices sharing a parent with an mfd device regardless of whether they were allocated by the mfd core or not. This especially caused problems when the device structure was not contained within a platform_device, because to_platform_device is used on each device pointer.
This patch defines a device_type for mfd devices and checks this is present from mfd_remove_devices_fn before processing the device.
--- drivers/mfd/mfd-core.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/mfd/mfd-core.c +13 -2
@@ -19,6 +19,10 @@#include <linux/slab.h> #include <linux/module.h> +static struct device_type mfd_dev_type = { + .name ="mfd_device" , +}; +int mfd_cell_enable (struct platform_device *pdev) {const struct mfd_cell *cell =mfd_get_cell (pdev);
@@ -88,6 +92,7 @@ static int mfd_add_device(struct device goto fail_device; pdev->dev.parent = parent; + pdev->dev.type = &mfd_dev_type;if (cell->pdata_size) { ret = platform_device_add_data(pdev,
@@ -183,10 +188,16 @@ EXPORT_SYMBOL(mfd_add_devices);static int mfd_remove_devices_fn (struct device *dev,void *c) { -struct platform_device *pdev =to_platform_device (dev); -const struct mfd_cell *cell =mfd_get_cell (pdev); +struct platform_device *pdev; +const struct mfd_cell *cell;atomic_t **usage_count = c; +if (dev->type != &mfd_dev_type) +return 0 ; + + pdev =to_platform_device (dev); + cell =mfd_get_cell (pdev); +/* find the base address of usage_count pointers (for freeing) */ if (!*usage_count || (cell->usage_count < *usage_count)) *usage_count = cell->usage_count;
Greg Kroah-Hartman
maintainerPATCH 28/171 ext4: fix memory leak in ext4_xattr_set_acl()s error path
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugene Shatokhin <[email protected]>
commit 24ec19b0ae83a385ad9c55520716da671274b96c upstream.
In ext4_xattr_set_acl(), if ext4_journal_start() returns an error, posix_acl_release() will not be called for 'acl' which may result in a memory leak.
This patch fixes that.
--- fs/ext4/acl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext4/acl.c +4 -2
@@ -410,8 +410,10 @@ ext4_xattr_set_acl(struct dentry *dentry retry: handle =ext4_journal_start (inode,EXT4_DATA_TRANS_BLOCKS (inode->i_sb)); -if (IS_ERR (handle)) -return PTR_ERR (handle); +if (IS_ERR (handle)) { + error =PTR_ERR (handle); + goto release_and_out; + } error =ext4_set_acl (handle, inode, type, acl);ext4_journal_stop (handle);if (error == -ENOSPC &&ext4_should_retry_alloc (inode->i_sb, &retries))
Greg Kroah-Hartman
maintainerPATCH 29/171 ext4: fix possible use after free with metadata csum
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit aeb1e5d69a5be592e86a926be73efb38c55af404 upstream.
Commit fa77dcfafeaa introduces block bitmap checksum calculation into ext4_new_inode() in the case that block group was uninitialized. However we brelse() the bitmap buffer before we attempt to checksum it so we have no guarantee that the buffer is still there.
Fix this by releasing the buffer after the possible checksum computation.
--- fs/ext4/ialloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ialloc.c +1 -1
@@ -734,7 +734,6 @@ got:BUFFER_TRACE (block_bitmap_bh,"dirty block bitmap" ); err =ext4_handle_dirty_metadata (handle,NULL , block_bitmap_bh); -brelse (block_bitmap_bh);/* recheck and clear flag under lock if we still need to */ ext4_lock_group (sb, group);
@@ -746,6 +745,7 @@ got: gdp); }ext4_unlock_group (sb, group); +brelse (block_bitmap_bh);if (err) goto fail;
Greg Kroah-Hartman
maintainerPATCH 30/171 mtd cs553x_nand: Initialise ecc.strength before nand_scan()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Williams <[email protected]>
commit d1f3b65d2d6fdb4bf0edd4b67e86e191af48daee upstream.
Loading cs553x_nand with Hynix H27U1G8F2BTR NAND flash causes this bug:
kernel BUG at drivers/mtd/nand/nand_base.c:3345!
invalid opcode: 0000 [#1]
Modules linked in: cs553x_nand(+) vfat fat usb_storage ehci_hcd usbcore usb_comr
Pid: 436, comm: modprobe Not tainted 3.6.7 #1
EIP: 0060:[<c118d205>] EFLAGS: 00010296 CPU: 0
EIP is at nand_scan_tail+0x64c/0x69c
EAX: 00000034 EBX: cea6ed98 ECX: 00000000 EDX: 00000000
ESI: cea6ec00 EDI: cea6ec00 EBP: 20000000 ESP: cdd17e48
DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
CR0: 8005003b CR2: 0804e119 CR3: 0d850000 CR4: 00000090
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process modprobe (pid: 436, ti=cdd16000 task=cdd1c320 task.ti=cdd16000)
Stack: c12e962c c118f7ef 00000003 cea6ed98 d014b25c 20000000 fffff007 00000001 00000000 cdd53b00 d014b000 c1001021 cdd53b00 d01493c0 cdd53b00 cdd53b00 d01493c0 c1047f83 d014b4a0 00000000 cdd17f9c ce4be454 cdd17f48 cdd1c320 Call Trace: [<c118f7ef>] ? nand_scan+0x1b/0x4d [<d014b25c>] ? init_module+0x25c/0x2de [cs553x_nand] [<d014b000>] ? 0xd014afff [<c1001021>] ? do_one_initcall+0x21/0x111 [<c1047f83>] ? sys_init_module+0xe4/0x1261 [<c1031207>] ? task_work_run+0x36/0x43 [<c1265ced>] ? syscall_call+0x7/0xb Code: fa ff ff c7 86 d8 00 00 00 01 00 00 00 e9 5f fc ff ff 68 f8 26 2e c1 e8 a7 EIP: [<c118d205>] nand_scan_tail+0x64c/0x69c SS:ESP 0068:cdd17e48
Initialising ecc.strength before the call to nand_scan() fixes this.
--- drivers/mtd/nand/cs553x_nand.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/cs553x_nand.c +1 -2
@@ -237,6 +237,7 @@ static int __init cs553x_init_one(int cs this->ecc.hwctl = cs_enable_hwecc; this->ecc.calculate = cs_calculate_ecc; this->ecc.correct = nand_correct_data; + this->ecc.strength =1 ;/* Enable the following for a flash based bad block table */ this->bbt_options =NAND_BBT_USE_FLASH ;
@@ -248,8 +249,6 @@ static int __init cs553x_init_one(int cs goto out_ior; } - this->ecc.strength =1 ; - new_mtd->name =kasprintf (GFP_KERNEL ,"cs553x_nand_cs%d" , cs); cs553x_mtd[cs] = new_mtd;
Greg Kroah-Hartman
maintainerPATCH 31/171 mtd: nand: gpmi: reset BCH earlier, too, to avoid NAND startup problems
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 6f2a6a52560ad8d85710aabd92b7a3239b3a6b07 upstream.
It could happen (1 out of 100 times) that NAND did not start up correctly after warm rebooting, so the kernel could not find the UBI or DMA timed out due to a stalled BCH. When resetting BCH together with GPMI, the issue could not be observed anymore (after 10000+ reboots). We probably need the consistent state already before sending any command to NAND, even when no ECC is needed. I chose to keep the extra reset for BCH when changing the flash layout to be on the safe side.
--- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +9 -0
@@ -135,6 +135,15 @@ int gpmi_init(struct gpmi_nand_data *thiif (ret) goto err_out; +/* +* Reset BCH here, too. We got failures otherwise :( +* See later BCH reset for explanation of MX23 handling +*/ + ret =gpmi_reset_block (r->bch_regs,GPMI_IS_MX23 (this)); +if (ret) + goto err_out; + +/* Choose NAND mode. */ writel (BM_GPMI_CTRL1_GPMI_MODE , r->gpmi_regs +HW_GPMI_CTRL1_CLR );
Greg Kroah-Hartman
maintainerPATCH 32/171 SUNRPC: continue run over clients list on PipeFS event instead of break
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit cd6c5968582a273561464fe6b1e8cc8214be02df upstream.
There are SUNRPC clients, which program doesn't have pipe_dir_name. These clients can be skipped on PipeFS events, because nothing have to be created or destroyed. But instead of breaking in case of such a client was found, search for suitable client over clients list have to be continued. Otherwise some clients could not be covered by PipeFS event handler.
--- net/sunrpc/clnt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
@@ -236,7 +236,7 @@ static struct rpc_clnt *rpc_get_client_fspin_lock (&sn->rpc_client_lock);list_for_each_entry (clnt, &sn->all_clients, cl_clients) {if (clnt->cl_program->pipe_dir_name ==NULL ) -break ; +continue ;if (rpc_clnt_skip_event (clnt, event))continue ;if (atomic_inc_not_zero (&clnt->cl_count) ==0 )
Greg Kroah-Hartman
maintainerPATCH 33/171 SUNRPC: Ensure that we free the rpc_task after cleanups are done
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit c6567ed1402c55e19b012e66a8398baec2a726f3 upstream.
This patch ensures that we free the rpc_task after the cleanup callbacks are done in order to avoid a deadlock problem that can be triggered if the callback needs to wait for another workqueue item to complete.
--- net/sunrpc/sched.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
net/sunrpc/sched.c +23 -4
@@ -915,16 +915,35 @@ struct rpc_task *rpc_new_task(const strureturn task; } +/* +* rpc_free_task - release rpc task and perform cleanups +* +* Note that we free up the rpc_task _after_ rpc_release_calldata() +* in order to work around a workqueue dependency issue. +* +* Tejun Heo states: +* "Workqueue currently considers two work items to be the same if they're +* on the same address and won't execute them concurrently - ie. it +* makes a work item which is queued again while being executed wait +* for the previous execution to complete. +* +* If a work function frees the work item, and then waits for an event +* which should be performed by another work item and *that* work item +* recycles the freed work item, it can create a false dependency loop. +* There really is no reliable way to detect this short of verifying +* every memory free." +* +*/ static void rpc_free_task (struct rpc_task *task) { -const struct rpc_call_ops *tk_ops = task->tk_ops; -void *calldata = task->tk_calldata; +unsigned short tk_flags = task->tk_flags; -if (task->tk_flags &RPC_TASK_DYNAMIC ) { +rpc_release_calldata (task->tk_ops, task->tk_calldata); + +if (tk_flags &RPC_TASK_DYNAMIC ) {dprintk ("RPC: %5u freeing task\n" , task->tk_pid);mempool_free (task, rpc_task_mempool); } -rpc_release_calldata (tk_ops, calldata); }static void rpc_async_release (struct work_struct *work)
Greg Kroah-Hartman
maintainerPATCH 34/171 SUNRPC: Ensure we release the socket write lock if the rpc_task exits early
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 87ed50036b866db2ec2ba16b2a7aec4a2b0b7c39 upstream.
If the rpc_task exits while holding the socket write lock before it has allocated an rpc slot, then the usual mechanism for releasing the write lock in xprt_release() is defeated.
The problem occurs if the call to xprt_lock_write() initially fails, so that the rpc_task is put on the xprt->sending wait queue. If the task exits after being assigned the lock by __xprt_lock_write_func, but before it has retried the call to xprt_lock_and_alloc_slot(), then it calls xprt_release() while holding the write lock, but will immediately exit due to the test for task->tk_rqstp != NULL.
--- net/sunrpc/sched.c | 3 +-- net/sunrpc/xprt.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
net/sunrpc/sched.c +1 -2
@@ -953,8 +953,7 @@ static void rpc_async_release(struct worstatic void rpc_release_resources_task (struct rpc_task *task) { -if (task->tk_rqstp) -xprt_release (task); +xprt_release (task);if (task->tk_msg.rpc_cred) {put_rpccred (task->tk_msg.rpc_cred); task->tk_msg.rpc_cred =NULL ;
net/sunrpc/xprt.c +10 -2
@@ -1139,10 +1139,18 @@ static void xprt_request_init(struct rpcvoid xprt_release (struct rpc_task *task) {struct rpc_xprt *xprt; -struct rpc_rqst *req; +struct rpc_rqst *req = task->tk_rqstp; -if (!(req = task->tk_rqstp)) +if (req ==NULL ) { +if (task->tk_client) { +rcu_read_lock (); + xprt =rcu_dereference (task->tk_client->cl_xprt); +if (xprt->snd_task == task) +xprt_release_write (xprt, task); +rcu_read_unlock (); + }return ; + } xprt = req->rq_xprt;if (task->tk_ops->rpc_count_stats !=NULL )
Greg Kroah-Hartman
maintainerPATCH 35/171 jffs2: hold erase_completion_lock on exit
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Khoroshilov <[email protected]>
commit 2cbba75a56ea78e6876b4e2547a882f10b3fe72b upstream.
Users of jffs2_do_reserve_space() expect they still held erase_completion_lock after call to it. But there is a path where jffs2_do_reserve_space() leaves erase_completion_lock unlocked. The patch fixes it.
Found by Linux Driver Verification project (linuxtesting.org).
--- fs/jffs2/nodemgmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/jffs2/nodemgmt.c +4 -2
@@ -375,14 +375,16 @@ static int jffs2_do_reserve_space(structspin_unlock (&c->erase_completion_lock); ret =jffs2_prealloc_raw_node_refs (c, jeb,1 ); -if (ret) -return ret; +/* Just lock it again and continue. Nothing much can change because we hold c->alloc_sem anyway. In fact, it's not entirely clear why we hold c->erase_completion_lock in the majority of this function... but that's a question for another (more caffeine-rich) day. */ spin_lock (&c->erase_completion_lock); +if (ret) +return ret; + waste = jeb->free_size; jffs2_link_node_ref(c, jeb, (jeb->offset + c->sector_size - waste) | REF_OBSOLETE,
Greg Kroah-Hartman
maintainerPATCH 36/171 i2400m: add Intel 6150 device IDs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 999a7c5776a0ed2133645fa7e008bec05bda9254 upstream.
Add device IDs for WiMAX function of Intel 6150 cards.
--- drivers/net/wimax/i2400m/i2400m-usb.h | 3 +++ drivers/net/wimax/i2400m/usb.c | 6 ++++++ 2 files changed, 9 insertions(+)
drivers/net/wimax/i2400m/i2400m-usb.h +3 -0
@@ -152,6 +152,9 @@ enum {/* Device IDs */ USB_DEVICE_ID_I6050 =0x0186 ,USB_DEVICE_ID_I6050_2 =0x0188 , +USB_DEVICE_ID_I6150 =0x07d6 , +USB_DEVICE_ID_I6150_2 =0x07d7 , +USB_DEVICE_ID_I6150_3 =0x07d9 , USB_DEVICE_ID_I6250 = 0x0187, };
drivers/net/wimax/i2400m/usb.c +6 -0
@@ -510,6 +510,9 @@ int i2400mu_probe(struct usb_interface *switch (id->idProduct) {case USB_DEVICE_ID_I6050 :case USB_DEVICE_ID_I6050_2 : +case USB_DEVICE_ID_I6150 : +case USB_DEVICE_ID_I6150_2 : +case USB_DEVICE_ID_I6150_3 :case USB_DEVICE_ID_I6250 : i2400mu->i6050 =1 ;break ;
@@ -759,6 +762,9 @@ staticstruct usb_device_id i2400mu_id_table[] = { {USB_DEVICE (0x8086 ,USB_DEVICE_ID_I6050 ) }, {USB_DEVICE (0x8086 ,USB_DEVICE_ID_I6050_2 ) }, + {USB_DEVICE (0x8087 ,USB_DEVICE_ID_I6150 ) }, + {USB_DEVICE (0x8087 ,USB_DEVICE_ID_I6150_2 ) }, + {USB_DEVICE (0x8087 ,USB_DEVICE_ID_I6150_3 ) }, {USB_DEVICE (0x8086 ,USB_DEVICE_ID_I6250 ) }, {USB_DEVICE (0x8086 ,0x0181 ) }, {USB_DEVICE (0x8086 ,0x1403 ) },
Greg Kroah-Hartman
maintainerPATCH 37/171 intel-iommu: Free old page tables before creating superpage
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Woodhouse, David" <[email protected]>
commit 6491d4d02893d9787ba67279595990217177b351 upstream.
The dma_pte_free_pagetable() function will only free a page table page if it is asked to free the *entire* 2MiB range that it covers. So if a page table page was used for one or more small mappings, it's likely to end up still present in the page tables... but with no valid PTEs.
This was fine when we'd only be repopulating it with 4KiB PTEs anyway but the same virtual address range can end up being reused for a *large-page* mapping. And in that case were were trying to insert the large page into the second-level page table, and getting a complaint from the sanity check in __domain_mapping() because there was already a corresponding entry. This was *relatively* harmless; it led to a memory leak of the old page table page, but no other ill-effects.
Fix it by calling dma_pte_clear_range (hopefully redundant) and dma_pte_free_pagetable() before setting up the new large page.
--- drivers/iommu/intel-iommu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/iommu/intel-iommu.c +9 -2
@@ -1826,10 +1826,17 @@ static int __domain_mapping(struct dmar_if (!pte)return -ENOMEM ;/* It is large page*/ -if (largepage_lvl >1 ) +if (largepage_lvl >1 ) { pteval |=DMA_PTE_LARGE_PAGE ; -else +/* Ensure that old small page tables are removed to make room +for superpage, if they exist. */ +dma_pte_clear_range (domain, iov_pfn, + iov_pfn +lvl_to_nr_pages (largepage_lvl) -1 ); +dma_pte_free_pagetable (domain, iov_pfn, + iov_pfn +lvl_to_nr_pages (largepage_lvl) -1 ); + }else { pteval &= ~(uint64_t )DMA_PTE_LARGE_PAGE ; + } }/* We don't need lock here, nobody else
Greg Kroah-Hartman
maintainerPATCH 38/171 drm/radeon: fix eDP clk and lane setup for scaled modes
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 93927f9c1db5f55085457e820f0631064c7bfa34 upstream.
Need to use the adjusted mode since we are sending native timing and using the scaler for non-native modes.
--- drivers/gpu/drm/radeon/atombios_encoders.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/atombios_encoders.c +1 -1
@@ -95,7 +95,7 @@ static bool radeon_atom_mode_fixup(struc ((radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) || (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE))) {struct drm_connector *connector =radeon_get_connector_for_encoder (encoder); -radeon_dp_set_link_config (connector, mode); +radeon_dp_set_link_config (connector, adjusted_mode); }return true;
Greg Kroah-Hartman
maintainerPATCH 39/171 drm/radeon: add WAIT_UNTIL to evergreen VM safe reg list
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 668bbc81baf0f34df832d8aca5c7d5e19a493c68 upstream.
It's used in a recent mesa commit:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=24b1206ab2dcd506aaac3ef656aebc8bc20cd27a
and there may be some other cases in the future where it's required.
--- drivers/gpu/drm/radeon/evergreen_cs.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/evergreen_cs.c +1 -0
@@ -2670,6 +2670,7 @@ static bool evergreen_vm_reg_valid(u32 r/* check config regs */ switch (reg) { +case WAIT_UNTIL :case GRBM_GFX_INDEX :case CP_STRMOUT_CNTL :case CP_COHER_CNTL :
Greg Kroah-Hartman
maintainerPATCH 40/171 drm/radeon: Properly handle DDC probe for DP bridges
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niels Ole Salscheider <[email protected]>
commit 0a9069d34918659bc8a89e21e69e60b2b83291a3 upstream.
DDC information can be accessed using AUX CH
Fixes failure to probe monitors on some systems with DP bridge chips.
agd5f: minor fixes
--- drivers/gpu/drm/radeon/radeon_connectors.c | 10 ++++++---- drivers/gpu/drm/radeon/radeon_display.c | 13 +++++++++---- drivers/gpu/drm/radeon/radeon_i2c.c | 10 ++++++++-- drivers/gpu/drm/radeon/radeon_mode.h | 2 +- 4 files changed, 24 insertions(+), 11 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +6 -4
@@ -689,7 +689,7 @@ radeon_vga_detect(struct drm_connector * ret = connector_status_disconnected;if (radeon_connector->ddc_bus) - dret =radeon_ddc_probe (radeon_connector); + dret =radeon_ddc_probe (radeon_connector, false);if (dret) { radeon_connector->detected_by_load = false;if (radeon_connector->edid) {
@@ -895,7 +895,7 @@ radeon_dvi_detect(struct drm_connector *return connector->status;if (radeon_connector->ddc_bus) - dret =radeon_ddc_probe (radeon_connector); + dret =radeon_ddc_probe (radeon_connector, false);if (dret) { radeon_connector->detected_by_load = false;if (radeon_connector->edid) {
@@ -1335,7 +1335,8 @@ radeon_dp_detect(struct drm_connector *cif (encoder) {/* setup ddc on the bridge */ radeon_atom_ext_encoder_setup_ddc (encoder); -if (radeon_ddc_probe (radeon_connector))/* try DDC */ +/* bridge chips are always aux */ +if (radeon_ddc_probe (radeon_connector, true))/* try DDC */ ret = connector_status_connected;else if (radeon_connector->dac_load_detect) {/* try load detection */ struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
@@ -1353,7 +1354,8 @@ radeon_dp_detect(struct drm_connector *cif (radeon_dp_getdpcd (radeon_connector)) ret = connector_status_connected; }else { -if (radeon_ddc_probe (radeon_connector)) +/* try non-aux ddc (DP to DVI/HMDI/etc. adapter) */ +if (radeon_ddc_probe (radeon_connector, false)) ret = connector_status_connected; } }
drivers/gpu/drm/radeon/radeon_display.c +9 -4
@@ -713,10 +713,15 @@ int radeon_ddc_get_modes(struct radeon_cif (radeon_connector->router.ddc_valid)radeon_router_select_ddc_port (radeon_connector); -if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || - (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) || - (radeon_connector_encoder_get_dp_bridge_encoder_id (&radeon_connector->base) != -ENCODER_OBJECT_ID_NONE )) { +if (radeon_connector_encoder_get_dp_bridge_encoder_id (&radeon_connector->base) != +ENCODER_OBJECT_ID_NONE ) { +struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; + +if (dig->dp_i2c_bus) + radeon_connector->edid =drm_get_edid (&radeon_connector->base, + &dig->dp_i2c_bus->adapter); + }else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || + (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) {struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
drivers/gpu/drm/radeon/radeon_i2c.c +8 -2
@@ -39,7 +39,7 @@ extern u32 radeon_atom_hw_i2c_func(struc* radeon_ddc_probe * */ -bool radeon_ddc_probe (struct radeon_connector *radeon_connector) +bool radeon_ddc_probe (struct radeon_connector *radeon_connector,bool use_aux) {u8 out =0x0 ;u8 buf[8 ];
@@ -63,7 +63,13 @@ bool radeon_ddc_probe(struct radeon_connif (radeon_connector->router.ddc_valid)radeon_router_select_ddc_port (radeon_connector); - ret =i2c_transfer (&radeon_connector->ddc_bus->adapter, msgs,2 ); +if (use_aux) { +struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; + ret =i2c_transfer (&dig->dp_i2c_bus->adapter, msgs,2 ); + }else { + ret =i2c_transfer (&radeon_connector->ddc_bus->adapter, msgs,2 ); + } +if (ret !=2 )/* Couldn't find an accessible DDC on this connector */ return false;
drivers/gpu/drm/radeon/radeon_mode.h +1 -1
@@ -527,7 +527,7 @@ extern void radeon_i2c_put_byte(struct r u8 val);extern void radeon_router_select_ddc_port (struct radeon_connector *radeon_connector);extern void radeon_router_select_cd_port (struct radeon_connector *radeon_connector); -extern bool radeon_ddc_probe (struct radeon_connector *radeon_connector); +extern bool radeon_ddc_probe (struct radeon_connector *radeon_connector,bool use_aux);extern int radeon_ddc_get_modes (struct radeon_connector *radeon_connector);extern struct drm_encoder *radeon_best_encoder (struct drm_connector *connector);
Greg Kroah-Hartman
maintainerPATCH 41/171 drm/i915: make the panel fitter work on pipes B and C on IVB
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Zanoni <[email protected]>
commit 13888d78c664a1f61d7b09d282f5916993827a40 upstream.
I actually found this problem on Haswell, but then discovered Ivy Bridge also has it by reading the spec.
I don't have the hardware to test this.
--- drivers/gpu/drm/i915/i915_reg.h | 2 ++ drivers/gpu/drm/i915/intel_display.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -3015,6 +3015,8 @@#define _PFA_CTL_1 0x68080#define _PFB_CTL_1 0x68880#define PF_ENABLE (1<<31) +#define PF_PIPE_SEL_MASK_IVB (3<<29) +#define PF_PIPE_SEL_IVB (pipe) ((pipe)<<29)#define PF_FILTER_MASK (3<<23)#define PF_FILTER_PROGRAMMED (0<<23)#define PF_FILTER_MED_3x3 (1<<23)
drivers/gpu/drm/i915/intel_display.c +5 -1
@@ -3095,7 +3095,11 @@ static void ironlake_crtc_enable(struct* as some pre-programmed values are broken, * e.g. x201. */ -I915_WRITE (PF_CTL (pipe),PF_ENABLE | PF_FILTER_MED_3x3); +if (IS_IVYBRIDGE (dev)) +I915_WRITE (PF_CTL (pipe),PF_ENABLE | PF_FILTER_MED_3x3 | +PF_PIPE_SEL_IVB (pipe)); +else +I915_WRITE (PF_CTL (pipe),PF_ENABLE | PF_FILTER_MED_3x3);I915_WRITE (PF_WIN_POS (pipe), dev_priv->pch_pf_pos);I915_WRITE (PF_WIN_SZ (pipe), dev_priv->pch_pf_size); }
Greg Kroah-Hartman
maintainerPATCH 42/171 SUNRPC: Fix validity issues with rpc_pipefs sb->s_fs_info
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 642fe4d00db56d65060ce2fd4c105884414acb16 upstream.
rpc_kill_sb() must defer calling put_net() until after the notifier has been called, since most (all?) of the notifier callbacks assume that sb->s_fs_info points to a valid net namespace. It also must not call put_net() if the call to rpc_fill_super was unsuccessful.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=48421
--- net/sunrpc/rpc_pipe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/sunrpc/rpc_pipe.c +6 -1
@@ -1157,14 +1157,19 @@ static void rpc_kill_sb(struct super_blostruct sunrpc_net *sn =net_generic (net, sunrpc_net_id);mutex_lock (&sn->pipefs_sb_lock); +if (sn->pipefs_sb != sb) { +mutex_unlock (&sn->pipefs_sb_lock); + goto out; + } sn->pipefs_sb =NULL ;mutex_unlock (&sn->pipefs_sb_lock); -put_net (net);dprintk ("RPC: sending pipefs UMOUNT notification for net %p%s\n" , net,NET_NAME (net));blocking_notifier_call_chain (&rpc_pipefs_notifier_list,RPC_PIPEFS_UMOUNT , sb); +put_net (net); +out:kill_litter_super (sb); }
Greg Kroah-Hartman
maintainerPATCH 43/171 RDMA/nes: Fix for crash when registering zero length MR for CQ
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tatyana Nikolova <[email protected]>
commit 7d9c199a55200c9b9fcad08e150470d02fb385be upstream.
--- drivers/infiniband/hw/nes/nes_verbs.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/infiniband/hw/nes/nes_verbs.c +5 -0
@@ -2559,6 +2559,11 @@ static struct ib_mr *nes_reg_user_mr(strreturn ibmr;case IWNES_MEMREG_TYPE_QP :case IWNES_MEMREG_TYPE_CQ : +if (!region->length) { +nes_debug (NES_DBG_MR ,"Unable to register zero length region for CQ\n" ); +ib_umem_release (region); +return ERR_PTR (-EINVAL ); + } nespbl =kzalloc (sizeof (*nespbl),GFP_KERNEL );if (!nespbl) {nes_debug (NES_DBG_MR ,"Unable to allocate PBL\n" );
Greg Kroah-Hartman
maintainerPATCH 44/171 RDMA/nes: Fix for terminate timer crash
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tatyana Nikolova <[email protected]>
commit 7bfcfa51c35cdd2d37e0d70fc11790642dd11fb3 upstream.
The terminate timer needs to be initialized just once.
--- drivers/infiniband/hw/nes/nes.h | 1 + drivers/infiniband/hw/nes/nes_hw.c | 9 ++------- drivers/infiniband/hw/nes/nes_verbs.c | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-)
drivers/infiniband/hw/nes/nes.h +1 -0
@@ -524,6 +524,7 @@ void nes_iwarp_ce_handler(struct nes_devint nes_destroy_cqp (struct nes_device *);int nes_nic_cm_xmit (struct sk_buff *,struct net_device *);void nes_recheck_link_status (struct work_struct *work); +void nes_terminate_timeout (unsigned long context);/* nes_nic.c */ struct net_device *nes_netdev_init (struct nes_device *,void __iomem *);
drivers/infiniband/hw/nes/nes_hw.c +2 -7
@@ -75,7 +75,6 @@ static void nes_process_iwarp_aeqe(strucstatic void process_critical_error (struct nes_device *nesdev);static void nes_process_mac_intr (struct nes_device *nesdev,u32 mac_number);static unsigned int nes_reset_adapter_ne020 (struct nes_device *nesdev,u8 *OneG_Mode); -static void nes_terminate_timeout (unsigned long context);static void nes_terminate_start_timer (struct nes_qp *nesqp);#ifdef CONFIG_INFINIBAND_NES_DEBUG
@@ -3522,7 +3521,7 @@ static void nes_terminate_received(struc }/* Timeout routine in case terminate fails to complete */ -static void nes_terminate_timeout (unsigned long context) +void nes_terminate_timeout (unsigned long context) {struct nes_qp *nesqp = (struct nes_qp *)(unsigned long )context;
@@ -3532,11 +3531,7 @@ static void nes_terminate_timeout(unsign/* Set a timer in case hw cannot complete the terminate sequence */ static void nes_terminate_start_timer (struct nes_qp *nesqp) { -init_timer (&nesqp->terminate_timer); - nesqp->terminate_timer.function = nes_terminate_timeout; - nesqp->terminate_timer.expires = jiffies +HZ ; - nesqp->terminate_timer.data = (unsigned long )nesqp; -add_timer (&nesqp->terminate_timer); +mod_timer (&nesqp->terminate_timer, (jiffies +HZ )); }/**
drivers/infiniband/hw/nes/nes_verbs.c +3 -1
@@ -1404,6 +1404,9 @@ static struct ib_qp *nes_create_qp(struc } nesqp->sig_all = (init_attr->sq_sig_type ==IB_SIGNAL_ALL_WR ); +init_timer (&nesqp->terminate_timer); + nesqp->terminate_timer.function = nes_terminate_timeout; + nesqp->terminate_timer.data = (unsigned long )nesqp;/* update the QP table */ nesdev->nesadapter->qp_table[nesqp->hwqp.qp_id-NES_FIRST_QPN ] = nesqp;
@@ -1413,7 +1416,6 @@ static struct ib_qp *nes_create_qp(strucreturn &nesqp->ibqp; } -/** * nes_clean_cq */
Greg Kroah-Hartman
maintainerPATCH 45/171 ring-buffer: Fix race between integrity check and readers
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 9366c1ba13fbc41bdb57702e75ca4382f209c82f upstream.
The function rb_check_pages() was added to make sure the ring buffer's pages were sane. This check is done when the ring buffer size is modified as well as when the iterator is released (closing the "trace" file), as that was considered a non fast path and a good place to do a sanity check.
The problem is that the check does not have any locks around it. If one process were to read the trace file, and another were to read the raw binary file, the check could happen while the reader is reading the file.
The issues with this is that the check requires to clear the HEAD page before doing the full check and it restores it afterward. But readers require the HEAD page to exist before it can read the buffer, otherwise it gives a nasty warning and disables the buffer.
By adding the reader lock around the check, this keeps the race from happening.
--- kernel/trace/ring_buffer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/trace/ring_buffer.c +5 -2
@@ -2708,7 +2708,7 @@ unsigned long ring_buffer_oldest_event_tunsigned long flags;struct ring_buffer_per_cpu *cpu_buffer;struct buffer_page *bpage; -unsigned long ret; +unsigned long ret =0 ;if (!cpumask_test_cpu (cpu, buffer->cpumask))return 0 ;
@@ -2723,7 +2723,8 @@ unsigned long ring_buffer_oldest_event_t bpage = cpu_buffer->reader_page; else bpage =rb_set_head_page (cpu_buffer); - ret = bpage->page->time_stamp; +if (bpage) + ret = bpage->page->time_stamp;raw_spin_unlock_irqrestore (&cpu_buffer->reader_lock, flags);return ret;
@@ -3030,6 +3031,8 @@ rb_get_reader_page(struct ring_buffer_pe* Splice the empty reader page into the list around the head. */ reader =rb_set_head_page (cpu_buffer); +if (!reader) + goto out; cpu_buffer->reader_page->list.next =rb_list_head (reader->list.next); cpu_buffer->reader_page->list.prev = reader->list.prev;
Greg Kroah-Hartman
maintainerPATCH 46/171 dm persistent data: rename node to btree_node
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 550929faf89e2e2cdb3e9945ea87d383989274cf upstream.
This patch fixes a compilation failure on sparc32 by renaming struct node.
struct node is already defined in include/linux/node.h. On sparc32, it happens to be included through other dependencies and persistent-data doesn't compile because of conflicting declarations.
--- drivers/md/persistent-data/dm-btree-internal.h | 16 ++++---- drivers/md/persistent-data/dm-btree-remove.c | 50 ++++++++++++------------- drivers/md/persistent-data/dm-btree-spine.c | 6 +-- drivers/md/persistent-data/dm-btree.c | 22 +++++------ 4 files changed, 47 insertions(+), 47 deletions(-)
drivers/md/persistent-data/dm-btree-internal.h +8 -8
@@ -36,13 +36,13 @@ struct node_header {__le32 padding; } __packed; -struct node { +struct btree_node {struct node_header header;__le64 keys[0 ]; } __packed; -void inc_children (struct dm_transaction_manager *tm,struct node *n, +void inc_children (struct dm_transaction_manager *tm,struct btree_node *n,struct dm_btree_value_type *vt);int new_block (struct dm_btree_info *info,struct dm_block **result);
@@ -64,7 +64,7 @@ struct ro_spine {void init_ro_spine (struct ro_spine *s,struct dm_btree_info *info);int exit_ro_spine (struct ro_spine *s);int ro_step (struct ro_spine *s,dm_block_t new_child); -struct node *ro_node (struct ro_spine *s); +struct btree_node *ro_node (struct ro_spine *s);struct shadow_spine {struct dm_btree_info *info;
@@ -98,17 +98,17 @@ int shadow_root(struct shadow_spine *s);/* * Some inlines. */ -static inline __le64 *key_ptr (struct node *n,uint32_t index) +static inline __le64 *key_ptr (struct btree_node *n,uint32_t index) {return n->keys + index; } -static inline void *value_base (struct node *n) +static inline void *value_base (struct btree_node *n) {return &n->keys[le32_to_cpu (n->header.max_entries)]; } -static inline void *value_ptr (struct node *n,uint32_t index) +static inline void *value_ptr (struct btree_node *n,uint32_t index) {uint32_t value_size =le32_to_cpu (n->header.value_size);return value_base (n) + (value_size * index);
@@ -117,7 +117,7 @@ static inline void *value_ptr(struct nod/* * Assumes the values are suitably-aligned and converts to core format. */ -static inline uint64_t value64 (struct node *n,uint32_t index) +static inline uint64_t value64 (struct btree_node *n,uint32_t index) {__le64 *values_le =value_base (n);
@@ -127,7 +127,7 @@ static inline uint64_t value64(struct no/* * Searching for a key within a single node. */ -int lower_bound (struct node *n,uint64_t key); +int lower_bound (struct btree_node *n,uint64_t key);extern struct dm_block_validator btree_node_validator;
drivers/md/persistent-data/dm-btree-remove.c +25 -25
164 lines not on this page · raw message
drivers/md/persistent-data/dm-btree-spine.c +3 -3
@@ -23,7 +23,7 @@ static void node_prepare_for_write(struc struct dm_block *b, size_t block_size) { -struct node *n =dm_block_data (b); +struct btree_node *n =dm_block_data (b);struct node_header *h = &n->header; h->blocknr =cpu_to_le64 (dm_block_location (b));
@@ -38,7 +38,7 @@ static int node_check(struct dm_block_va struct dm_block *b, size_t block_size) { -struct node *n =dm_block_data (b); +struct btree_node *n =dm_block_data (b);struct node_header *h = &n->header;size_t value_size;__le32 csum_disk;
@@ -164,7 +164,7 @@ int ro_step(struct ro_spine *s, dm_blockreturn r; } -struct node *ro_node (struct ro_spine *s) +struct btree_node *ro_node (struct ro_spine *s) {struct dm_block *block;
drivers/md/persistent-data/dm-btree.c +11 -11
@@ -38,7 +38,7 @@ static void array_insert(void *base, siz/*----------------------------------------------------------------*/ /* makes the assumption that no two keys are the same. */ -static int bsearch (struct node *n,uint64_t key,int want_hi) +static int bsearch (struct btree_node *n,uint64_t key,int want_hi) {int lo =-1 , hi =le32_to_cpu (n->header.nr_entries);
@@ -58,12 +58,12 @@ static int bsearch(struct node *n, uint6return want_hi ? hi : lo; } -int lower_bound (struct node *n,uint64_t key) +int lower_bound (struct btree_node *n,uint64_t key) {return bsearch (n, key,0 ); } -void inc_children (struct dm_transaction_manager *tm,struct node *n, +void inc_children (struct dm_transaction_manager *tm,struct btree_node *n,struct dm_btree_value_type *vt) {unsigned i;
@@ -77,7 +77,7 @@ void inc_children(struct dm_transaction_ vt->inc (vt->context,value_ptr (n, i)); } -static int insert_at (size_t value_size,struct node *node,unsigned index, +static int insert_at (size_t value_size,struct btree_node *node,unsigned index,uint64_t key,void *value)__dm_written_to_disk (value) {
@@ -122,7 +122,7 @@ int dm_btree_empty(struct dm_btree_info {int r;struct dm_block *b; -struct node *n; +struct btree_node *n;size_t block_size;uint32_t max_entries;
@@ -154,7 +154,7 @@ EXPORT_SYMBOL_GPL(dm_btree_empty);#define MAX_SPINE_DEPTH 64struct frame {struct dm_block *b; -struct node *n; +struct btree_node *n;unsigned level;unsigned nr_children;unsigned current_child;
@@ -295,7 +295,7 @@ EXPORT_SYMBOL_GPL(dm_btree_del);/*----------------------------------------------------------------*/ static int btree_lookup_raw (struct ro_spine *s,dm_block_t block,uint64_t key, -int (*search_fn)(struct node *,uint64_t ), +int (*search_fn)(struct btree_node *,uint64_t ),uint64_t *result_key,void *v,size_t value_size) {int i, r;
@@ -406,7 +406,7 @@ static int btree_split_sibling(struct shsize_t size;unsigned nr_left, nr_right;struct dm_block *left, *right, *parent; -struct node *ln, *rn, *pn; +struct btree_node *ln, *rn, *pn;__le64 location; left =shadow_current (s);
@@ -491,7 +491,7 @@ static int btree_split_beneath(struct shsize_t size;unsigned nr_left, nr_right;struct dm_block *left, *right, *new_parent; -struct node *pn, *ln, *rn; +struct btree_node *pn, *ln, *rn;__le64 val; new_parent =shadow_current (s);
@@ -576,7 +576,7 @@ static int btree_insert_raw(struct shado uint64_t key, unsigned *index) { int r, i = *index, top = 1; -struct node *node; +struct btree_node *node;for (;;) { r =shadow_step (s, root, vt);
@@ -643,7 +643,7 @@ static int insert(struct dm_btree_info *unsigned level, index =-1 , last_level = info->levels -1 ;dm_block_t block = root;struct shadow_spine spine; -struct node *n; +struct btree_node *n;struct dm_btree_value_type le64_type; le64_type.context =NULL ;
Greg Kroah-Hartman
maintainerPATCH 47/171 dm ioctl: prevent unsafe change to dm_ioctl data_size
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alasdair G Kergon <[email protected]>
commit e910d7ebecd1aac43125944a8641b6cb1a0dfabe upstream.
Abort dm ioctl processing if userspace changes the data_size parameter after we validated it but before we finished copying the data buffer from userspace.
The dm ioctl parameters are processed in the following sequence:
1. ctl_ioctl() calls copy_params();
2. copy_params() makes a first copy of the fixed-sized portion of the
userspace parameters into the local variable "tmp";
3. copy_params() then validates tmp.data_size and allocates a new
structure big enough to hold the complete data and copies the whole
userspace buffer there;
4. ctl_ioctl() reads userspace data the second time and copies the whole
buffer into the pointer "param";
5. ctl_ioctl() reads param->data_size without any validation and stores it
in the variable "input_param_size"; 6. "input_param_size" is further used as the authoritative size of the kernel buffer.
The problem is that userspace code could change the contents of user memory between steps 2 and 4. In particular, the data_size parameter can be changed to an invalid value after the kernel has validated it. This lets userspace force the kernel to access invalid kernel memory.
The fix is to ensure that the size has not changed at step 4.
This patch shouldn't have a security impact because CAP_SYS_ADMIN is required to run this code, but it should be fixed anyway.
--- drivers/md/dm-ioctl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/md/dm-ioctl.c +8 -0
@@ -1563,6 +1563,14 @@ static int copy_params(struct dm_ioctl _if (copy_from_user (dmi, user, tmp.data_size)) goto bad; +/* +* Abort if something changed the ioctl data while it was being copied. +*/ +if (dmi->data_size != tmp.data_size) { +DMERR ("rejecting ioctl: data size modified while processing parameters" ); + goto bad; + } +/* Wipe the user buffer so we do not return it to userspace */ if (secure_data &&clear_user (user, tmp.data_size)) goto bad;
Greg Kroah-Hartman
maintainerPATCH 48/171 staging: vt6656: [BUG] out of bound array reference in RFbSetPower.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit ab1dd9963137a1e122004d5378a581bf16ae9bc8 upstream.
Calling RFbSetPower with uCH zero value will cause out of bound array reference.
This causes 64 bit kernels to oops on boot.
Note: Driver does not function on 64 bit kernels and should be blacklisted on them.
--- drivers/staging/vt6656/rf.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/vt6656/rf.c +3 -0
@@ -769,6 +769,9 @@ BYTE byPwr = pDevice->byCCKPwr;return TRUE; } +if (uCH ==0 ) +return -EINVAL ; +switch (uRATE) {case RATE_1M :case RATE_2M :
Greg Kroah-Hartman
maintainerPATCH 49/171 staging: vt6656: 64 bit fixes: use u32 for QWORD definition.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit a552397d5e4ef0cc0bd3e9595d6acc9a3b381171 upstream.
Size of long issues replace with u32.
--- drivers/staging/vt6656/ttype.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/vt6656/ttype.h +4 -2
@@ -29,6 +29,8 @@#ifndef __TTYPE_H__#define __TTYPE_H__ +#include <linux/types.h> +/******* Common definitions and typedefs ***********************************/ typedef int BOOL ;
@@ -51,8 +53,8 @@ typedef unsigned long DWORD;// which is NOT really a floating point number. typedef union tagUQuadWord {struct { -DWORD dwLowDword; -DWORD dwHighDword; +u32 dwLowDword; +u32 dwHighDword; } u;double DoNotUseThisField; }UQuadWord ;
Greg Kroah-Hartman
maintainerPATCH 50/171 staging: vt6656: 64 bit fixes : correct all type sizes
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 7730492855a2f9c828599bcd8d62760f96d319e4 upstream.
After this patch all BYTE/WORD/DWORD types can be replaced with the appropriate u sizes.
--- drivers/staging/vt6656/ttype.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/vt6656/ttype.h +5 -5
@@ -44,9 +44,9 @@ typedef int BOOL;/****** Simple typedefs ***************************************************/ -typedef unsigned char BYTE ;// 8-bit -typedef unsigned short WORD ;// 16-bit -typedef unsigned long DWORD ;// 32-bit +typedef u8 BYTE ; +typedef u16 WORD ; +typedef u32 DWORD ;// QWORD is for those situation that we want // an 8-byte-aligned 8 byte long structure
@@ -62,8 +62,8 @@ typedef UQuadWord QWORD;/****** Common pointer types ***********************************************/ -typedef unsigned long ULONG_PTR ;// 32-bit -typedef unsigned long DWORD_PTR ;// 32-bit +typedef u32 ULONG_PTR ; +typedef u32 DWORD_PTR ;// boolean pointer
Greg Kroah-Hartman
maintainerPATCH 51/171 staging: vt6656: 64 bit fixes: fix long warning messages.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit b4dc03af5513774277c9c36b12a25cd3f25f4404 upstream.
Fixes long warning messages from patch
[PATCH 08/14] staging: vt6656: 64 bit fixes : correct all type sizes
--- drivers/staging/vt6656/dpc.c | 4 +-- drivers/staging/vt6656/key.c | 47 +++++++++++++++++++++++++++++------------- drivers/staging/vt6656/mac.c | 6 +++-- drivers/staging/vt6656/rxtx.c | 18 ++++++++++------ 4 files changed, 51 insertions(+), 24 deletions(-)
drivers/staging/vt6656/dpc.c +2 -2
@@ -1238,7 +1238,7 @@ static BOOL s_bHandleRxEncryption ( PayloadLen -= (WLAN_HDR_ADDR3_LEN +8 +4 );// 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 =cpu_to_le32 (*(PDWORD )(pbyIV +4 )); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "ExtIV: %lx\n" ,*pdwRxTSC47_16); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "ExtIV: %x\n" , *pdwRxTSC47_16);if (byDecMode ==KEY_CTL_TKIP ) { *pwRxTSC15_0 =cpu_to_le16 (MAKEWORD (*(pbyIV+2 ), *pbyIV)); }else {
@@ -1349,7 +1349,7 @@ static BOOL s_bHostWepRxEncryption ( PayloadLen -= (WLAN_HDR_ADDR3_LEN +8 +4 );// 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 =cpu_to_le32 (*(PDWORD )(pbyIV +4 )); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "ExtIV: %lx\n" ,*pdwRxTSC47_16); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "ExtIV: %x\n" , *pdwRxTSC47_16);if (byDecMode ==KEY_CTL_TKIP ) { *pwRxTSC15_0 =cpu_to_le16 (MAKEWORD (*(pbyIV+2 ), *pbyIV));
drivers/staging/vt6656/key.c +33 -14
109 lines not on this page · raw message
drivers/staging/vt6656/mac.c +4 -2
@@ -260,7 +260,8 @@ BYTE pbyData[24]; dwData1 <<=16 ; dwData1 |=MAKEWORD (*(pbyAddr+4 ), *(pbyAddr+5 )); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "1. wOffset: %d, Data: %lX, KeyCtl:%X\n" , wOffset, dwData1, wKeyCtl); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "1. wOffset: %d, Data: %X," \ +" KeyCtl:%X\n" , wOffset, dwData1, wKeyCtl);//VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
@@ -277,7 +278,8 @@ BYTE pbyData[24]; dwData2 <<=8 ; dwData2 |= *(pbyAddr+0 ); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "2. wOffset: %d, Data: %lX\n" , wOffset, dwData2); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "2. wOffset: %d, Data: %X\n" , + wOffset, dwData2);//VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
drivers/staging/vt6656/rxtx.c +12 -6
@@ -377,7 +377,8 @@ s_vFillTxKey ( *(pbyIVHead+3 ) = (BYTE )(((pDevice->byKeyIndex <<6 ) &0xc0 ) |0x20 );// 0x20 is ExtIV // Append IV&ExtIV after Mac Header *pdwExtIV =cpu_to_le32 (pTransmitKey->dwTSC47_16); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "vFillTxKey()---- pdwExtIV: %lx\n" , *pdwExtIV); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "vFillTxKey()---- pdwExtIV: %x\n" , + *pdwExtIV); }else if (pTransmitKey->byCipherSuite ==KEY_CTL_CCMP ) { pTransmitKey->wTSC15_0++;
@@ -1753,7 +1754,8 @@ s_bPacketToWirelessUsb(MIC_vAppend ((PBYTE )&(psEthHeader->abyDstAddr[0 ]),12 ); dwMIC_Priority =0 ;MIC_vAppend ((PBYTE )&dwMIC_Priority,4 ); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "MIC KEY: %lX, %lX\n" , dwMICKey0, dwMICKey1); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "MIC KEY: %X, %X\n" , + dwMICKey0, dwMICKey1);///////////////////////////////////////////////////////////////////
@@ -2635,7 +2637,8 @@ vDMA0_tx_80211(PSDevice pDevice, structMIC_vAppend ((PBYTE )&(sEthHeader.abyDstAddr[0 ]),12 ); dwMIC_Priority =0 ;MIC_vAppend ((PBYTE )&dwMIC_Priority,4 ); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "DMA0_tx_8021:MIC KEY: %lX, %lX\n" , dwMICKey0, dwMICKey1); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "DMA0_tx_8021:MIC KEY:" \ +" %X, %X\n" , dwMICKey0, dwMICKey1); uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen;
@@ -2655,7 +2658,8 @@ vDMA0_tx_80211(PSDevice pDevice, structDBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "uLength: %d, %d\n" , uLength, cbFrameBodySize);DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "cbReqCount:%d, %d, %d, %d\n" , cbReqCount, cbHeaderSize, uPadding, cbIVlen); -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "MIC:%lx, %lx\n" , *pdwMIC_L, *pdwMIC_R); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "MIC:%x, %x\n" , + *pdwMIC_L, *pdwMIC_R); }
@@ -3029,7 +3033,8 @@ int nsDMA_tx_packet(PSDevice pDevice, unDBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "error: KEY is GTK!!~~\n" ); }else { -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "Find PTK [%lX]\n" , pTransmitKey->dwKeyIndex); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "Find PTK [%X]\n" , + pTransmitKey->dwKeyIndex); bNeedEncryption = TRUE; } }
@@ -3043,7 +3048,8 @@ int nsDMA_tx_packet(PSDevice pDevice, unif (pDevice->bEnableHostWEP) {if ((uNodeIndex !=0 ) && (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex &PAIRWISE_KEY )) { -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "Find PTK [%lX]\n" , pTransmitKey->dwKeyIndex); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "Find PTK [%X]\n" , + pTransmitKey->dwKeyIndex); bNeedEncryption = TRUE; } }
Greg Kroah-Hartman
maintainerPATCH 52/171 staging: vt6656: 64bit fixes: key.c/h change unsigned long to u32
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit c0d05b305b00c698b0a8c1b3d46c9380bce9db45 upstream.
Fixes long issues.
--- drivers/staging/vt6656/key.c | 6 +++--- drivers/staging/vt6656/key.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/vt6656/key.c +3 -3
@@ -223,7 +223,7 @@ BOOL KeybSetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - unsigned long uKeyLength, + u32 uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode
@@ -675,7 +675,7 @@ BOOL KeybSetDefaultKey(void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - unsigned long uKeyLength, + u32 uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode
@@ -791,7 +791,7 @@ BOOL KeybSetAllGroupKey(void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - unsigned long uKeyLength, + u32 uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode
drivers/staging/vt6656/key.h +4 -4
@@ -58,7 +58,7 @@ typedef struct tagSKeyItem { BOOL bKeyValid; - unsigned long uKeyLength; + u32 uKeyLength; BYTE abyKey[MAX_KEY_LEN]; QWORD KeyRSC; DWORD dwTSC47_16;
@@ -107,7 +107,7 @@ BOOL KeybSetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex, - unsigned long uKeyLength, + u32 uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode
@@ -146,7 +146,7 @@ BOOL KeybSetDefaultKey(void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - unsigned long uKeyLength, + u32 uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode
@@ -156,7 +156,7 @@ BOOL KeybSetAllGroupKey(void *pDeviceHandler, PSKeyManagement pTable, DWORD dwKeyIndex, - unsigned long uKeyLength, + u32 uKeyLength, PQWORD pKeyRSC, PBYTE pbyKey, BYTE byKeyDecMode
Greg Kroah-Hartman
maintainerPATCH 53/171 staging: vt6656: 64bit fixes: vCommandTimerWait change calculation of timer.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 70e227790d4ee4590023d8041a3485f8053593fc upstream.
The timer appears to run too fast/race on 64 bit systems.
Using msecs_to_jiffies seems to cause a deadlock on 64 bit.
A calculation of (MSecond * HZ) / 1000 appears to run satisfactory.
Change BSSIDInfoCount to u32.
After this patch the driver can be successfully connect on little endian 64/32 bit systems.
--- drivers/staging/vt6656/wcmd.c | 20 +++++++++++--------- drivers/staging/vt6656/wpa2.h | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-)
drivers/staging/vt6656/wcmd.c +11 -9
@@ -316,17 +316,19 @@ s_MgrMakeProbeRequest(return pTxPacket; } -void vCommandTimerWait (void *hDeviceContext,unsigned int MSecond) +void vCommandTimerWait (void *hDeviceContext,unsigned long MSecond) { -PSDevice pDevice = (PSDevice )hDeviceContext; +PSDevice pDevice = (PSDevice )hDeviceContext; -init_timer (&pDevice->sTimerCommand); - pDevice->sTimerCommand.data = (unsigned long )pDevice; - pDevice->sTimerCommand.function = (TimerFunction )vRunCommand; -// RUN_AT :1 msec ~= (HZ/1024) - pDevice->sTimerCommand.expires = (unsigned int )RUN_AT ((MSecond *HZ ) >>10 ); -add_timer (&pDevice->sTimerCommand); -return ; +init_timer (&pDevice->sTimerCommand); + + pDevice->sTimerCommand.data = (unsigned long )pDevice; + pDevice->sTimerCommand.function = (TimerFunction )vRunCommand; + pDevice->sTimerCommand.expires =RUN_AT ((MSecond *HZ ) /1000 ); + +add_timer (&pDevice->sTimerCommand); + +return ; }void vRunCommand (void *hDeviceContext)
drivers/staging/vt6656/wpa2.h +2 -2
@@ -45,8 +45,8 @@ typedef struct tagsPMKIDInfo { } PMKIDInfo, *PPMKIDInfo;typedef struct tagSPMKIDCache { -unsigned long BSSIDInfoCount; -PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE ]; +u32 BSSIDInfoCount; +PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE ]; }SPMKIDCache , *PSPMKIDCache ;
Greg Kroah-Hartman
maintainerPATCH 54/171 hwmon: (lm73} Detect and report i2c bus errors
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Verges <[email protected]>
commit 0602934f302e016e2ea5dc6951681bfac77455ef upstream.
If an LM73 device does not exist on an I2C bus, attempts to communicate with the device result in an error code returned from the i2c read/write functions. The current lm73 driver casts that return value from a s32 type to a s16 type, then converts it to a temperature in celsius. Because negative temperatures are valid, it is difficult to distinguish between an error code printed to the response buffer and a negative temperature recorded by the sensor.
The solution is to evaluate the return value from the i2c functions before performing any temperature calculations. If the i2c function did not succeed, the error code should be passed back through the virtual file system layer instead of being printed into the response buffer.
Before:
$ cat /sys/class/hwmon/hwmon0/device/temp1_input -46
After:
$ cat /sys/class/hwmon/hwmon0/device/temp1_input cat: read error: No such device or address
--- drivers/hwmon/lm73.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/hwmon/lm73.c +11 -5
@@ -49,6 +49,7 @@ static ssize_t set_temp(struct device *dstruct i2c_client *client =to_i2c_client (dev);long temp;short value; +s32 err;int status =kstrtol (buf,10 , &temp);if (status <0 )
@@ -57,8 +58,8 @@ static ssize_t set_temp(struct device *d/* Write value */ value = (short )SENSORS_LIMIT (temp/250 , (LM73_TEMP_MIN *4 ), (LM73_TEMP_MAX *4 )) <<5 ; -i2c_smbus_write_word_swapped (client, attr->index, value); -return count; + err =i2c_smbus_write_word_swapped (client, attr->index, value); +return (err <0 ) ? err : count; } static ssize_t show_temp(struct device *dev, struct device_attribute *da,
@@ -66,11 +67,16 @@ static ssize_t show_temp(struct device * {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);struct i2c_client *client =to_i2c_client (dev); +int temp; + +s32 err =i2c_smbus_read_word_swapped (client, attr->index); +if (err <0 ) +return err; +/* use integer division instead of equivalent right shift to guarantee arithmetic shift and preserve the sign */ -int temp = ((s16) (i2c_smbus_read_word_swapped (client, - attr->index))*250 ) /32 ; -return sprintf (buf,"%d\n" , temp); + temp = (((s16 ) err) *250 ) /32 ; +return scnprintf (buf,PAGE_SIZE ,"%d\n" , temp); }
Greg Kroah-Hartman
maintainerPATCH 55/171 video: mxsfb: fix crash when unblanking the display
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lothar Waßmann <[email protected]>
commit 6c1ecba8d84841277d68140ef485335d5be28485 upstream.
The VDCTRL4 register does not provide the MXS SET/CLR/TOGGLE feature. The write in mxsfb_disable_controller() sets the data_cnt for the LCD DMA to 0 which obviously means the max. count for the LCD DMA and leads to overwriting arbitrary memory when the display is unblanked.
--- drivers/video/mxsfb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/mxsfb.c +2 -1
@@ -366,7 +366,8 @@ static void mxsfb_disable_controller(str loop--; } -writel (VDCTRL4_SYNC_SIGNALS_ON , host->base +LCDC_VDCTRL4 +REG_CLR ); + reg =readl (host->base +LCDC_VDCTRL4 ); +writel (reg & ~VDCTRL4_SYNC_SIGNALS_ON , host->base +LCDC_VDCTRL4 );clk_disable_unprepare (host->clk);
Greg Kroah-Hartman
maintainerPATCH 56/171 samsung-laptop: Add quirk for broken acpi_video backlight on N250P
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit e04c200f1f2de8eaa2f5af6d97e7e213a1abb424 upstream.
--- drivers/platform/x86/samsung-laptop.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/platform/x86/samsung-laptop.c +10 -0
@@ -1506,6 +1506,16 @@ static struct dmi_system_id __initdata s }, .driver_data = &samsung_broken_acpi_video, }, + { + .callback = samsung_dmi_matched, + .ident = "N250P", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "N250P"), + DMI_MATCH(DMI_BOARD_NAME, "N250P"), + }, + .driver_data = &samsung_broken_acpi_video, + }, { }, }; MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
Greg Kroah-Hartman
maintainerPATCH 57/171 ext4: fix extent tree corruption caused by hole punch
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Forrest Liu <[email protected]>
commit c36575e663e302dbaa4d16b9c72d2c9a913a9aef upstream.
When depth of extent tree is greater than 1, logical start value of interior node is not correctly updated in ext4_ext_rm_idx.
--- fs/ext4/extents.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
fs/ext4/extents.c +18 -4
@@ -2110,13 +2110,14 @@ ext4_ext_in_cache(struct inode *inode, e* removes index from the index block. */ static int ext4_ext_rm_idx (handle_t *handle,struct inode *inode, -struct ext4_ext_path *path) +struct ext4_ext_path *path,int depth) {int err;ext4_fsblk_t leaf;/* free index block */ - path--; + depth--; + path = path + depth; leaf =ext4_idx_pblock (path->p_idx);if (unlikely (path->p_hdr->eh_entries ==0 )) {EXT4_ERROR_INODE (inode,"path->p_hdr->eh_entries == 0" );
@@ -2141,6 +2142,19 @@ static int ext4_ext_rm_idx(handle_t *hanext4_free_blocks (handle, inode,NULL , leaf,1 ,EXT4_FREE_BLOCKS_METADATA |EXT4_FREE_BLOCKS_FORGET ); + +while (--depth >=0 ) { +if (path->p_idx !=EXT_FIRST_INDEX (path->p_hdr)) +break ; + path--; + err =ext4_ext_get_access (handle, inode, path); +if (err) +break ; + path->p_idx->ei_block = (path+1 )->p_idx->ei_block; + err =ext4_ext_dirty (handle, inode, path); +if (err) +break ; + }return err; }
@@ -2474,7 +2488,7 @@ ext4_ext_rm_leaf(handle_t *handle, struc/* if this leaf is free, then we should * remove it from index block above */ if (err ==0 && eh->eh_entries ==0 && path[depth].p_bh !=NULL ) - err =ext4_ext_rm_idx (handle, inode, path + depth); + err =ext4_ext_rm_idx (handle, inode, path, depth); out:return err;
@@ -2675,7 +2689,7 @@ cont:/* index is empty, remove it; * handle must be already prepared by the * truncatei_leaf() */ - err =ext4_ext_rm_idx (handle, inode, path + i); + err =ext4_ext_rm_idx (handle, inode, path, i); }/* root level has p_bh == NULL, brelse() eats this */ brelse (path[i].p_bh);
Greg Kroah-Hartman
maintainerPATCH 58/171 ext4: check dioread_nolock on remount
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 261cb20cb2f0737a247aaf08dff7eb065e3e5b66 upstream.
Currently we allow enabling dioread_nolock mount option on remount for filesystems where blocksize < PAGE_CACHE_SIZE. This isn't really supported so fix the bug by moving the check for blocksize != PAGE_CACHE_SIZE into parse_options(). Change the original PAGE_SIZE to PAGE_CACHE_SIZE along the way because that's what we are really interested in.
--- fs/ext4/super.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
fs/ext4/super.c +11 -11
@@ -1599,9 +1599,7 @@ static int parse_options(char *options, unsigned int *journal_ioprio, int is_remount) { -#ifdef CONFIG_QUOTA struct ext4_sb_info *sbi =EXT4_SB (sb); -#endif char *p;substring_t args[MAX_OPT_ARGS ];int token;
@@ -1650,6 +1648,16 @@ static int parse_options(char *options, } }#endif +if (test_opt (sb,DIOREAD_NOLOCK )) { +int blocksize = +BLOCK_SIZE <<le32_to_cpu (sbi->s_es->s_log_block_size); + +if (blocksize <PAGE_CACHE_SIZE ) { +ext4_msg (sb,KERN_ERR ,"can't mount with " +"dioread_nolock if block size != PAGE_SIZE" ); +return 0 ; + } + }return 1 ; }
@@ -3226,15 +3234,6 @@ static int ext4_fill_super(struct super_clear_opt (sb,DELALLOC ); } - blocksize =BLOCK_SIZE <<le32_to_cpu (es->s_log_block_size); -if (test_opt (sb,DIOREAD_NOLOCK )) { -if (blocksize <PAGE_SIZE ) { -ext4_msg (sb,KERN_ERR ,"can't mount with " -"dioread_nolock if block size != PAGE_SIZE" ); - goto failed_mount; - } - } - sb->s_flags = (sb->s_flags & ~MS_POSIXACL ) | (test_opt (sb,POSIX_ACL ) ?MS_POSIXACL :0 );
@@ -3276,6 +3275,7 @@ static int ext4_fill_super(struct super_if (!ext4_feature_set_ok (sb, (sb->s_flags &MS_RDONLY ))) goto failed_mount; + blocksize =BLOCK_SIZE <<le32_to_cpu (es->s_log_block_size);if (blocksize <EXT4_MIN_BLOCK_SIZE || blocksize >EXT4_MAX_BLOCK_SIZE ) { ext4_msg(sb, KERN_ERR,
Greg Kroah-Hartman
maintainerPATCH 59/171 jbd2: fix assertion failure in jbd2_journal_flush()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit d7961c7fa4d2e3c3f12be67e21ba8799b5a7238a upstream.
The following race is possible between start_this_handle() and someone calling jbd2_journal_flush().
Process A Process Bstart_this_handle().
if (journal->j_barrier_count) # false
if (!journal->j_running_transaction) { #true
read_unlock(&journal->j_state_lock);
jbd2_journal_lock_updates()
jbd2_journal_flush()
write_lock(&journal->j_state_lock);
if (journal->j_running_transaction) {
# false
... wait for committing trans ...
write_unlock(&journal->j_state_lock);
...
write_lock(&journal->j_state_lock);
if (!journal->j_running_transaction) { # true
jbd2_get_transaction(journal, new_transaction);
write_unlock(&journal->j_state_lock);
goto repeat; # eventually blocks on j_barrier_count > 0
...
J_ASSERT(!journal->j_running_transaction);
# failsWe fix the race by rechecking j_barrier_count after reacquiring j_state_lock in exclusive mode.
--- fs/jbd2/transaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jbd2/transaction.c +2 -1
@@ -209,7 +209,8 @@ repeat:if (!new_transaction) goto alloc_transaction;write_lock (&journal->j_state_lock); -if (!journal->j_running_transaction) { +if (!journal->j_running_transaction && + !journal->j_barrier_count) {jbd2_get_transaction (journal, new_transaction); new_transaction =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 60/171 ext4: do not try to write superblock on ro remount w/o journal
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Tokarev <[email protected]>
commit d096ad0f79a782935d2e06ae8fb235e8c5397775 upstream.
When a journal-less ext4 filesystem is mounted on a read-only block device (blockdev --setro will do), each remount (for other, unrelated, flags, like suid=>nosuid etc) results in a series of scary messages from kernel telling about I/O errors on the device.
This is becauese of the following code ext4_remount():
if (sbi->s_journal == NULL)
ext4_commit_super(sb, 1);at the end of remount procedure, which forces writing (flushing) of a superblock regardless whenever it is dirty or not, if the filesystem is readonly or not, and whenever the device itself is readonly or not.
We only need call ext4_commit_super when the file system had been previously mounted read/write.
Thanks to Eric Sandeen for help in diagnosing this issue.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -4506,7 +4506,7 @@ static int ext4_remount(struct super_blo }ext4_setup_system_zone (sb); -if (sbi->s_journal ==NULL ) +if (sbi->s_journal ==NULL && !(old_sb_flags &MS_RDONLY ))ext4_commit_super (sb,1 );#ifdef CONFIG_QUOTA
Greg Kroah-Hartman
maintainerPATCH 61/171 ext4: lock i_mutex when truncating orphan inodes
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 721e3eba21e43532e438652dd8f1fcdfce3187e7 upstream.
Commit c278531d39 added a warning when ext4_flush_unwritten_io() is called without i_mutex being taken. It had previously not been taken during orphan cleanup since races weren't possible at that point in the mount process, but as a result of this c278531d39, we will now see a kernel WARN_ON in this case. Take the i_mutex in ext4_orphan_cleanup() to suppress this warning.
--- fs/ext4/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/super.c +2 -0
@@ -2120,7 +2120,9 @@ static void ext4_orphan_cleanup(struct s __func__, inode->i_ino, inode->i_size);jbd_debug (2 ,"truncating inode %lu to %lld bytes\n" , inode->i_ino, inode->i_size); +mutex_lock (&inode->i_mutex);ext4_truncate (inode); +mutex_unlock (&inode->i_mutex); nr_truncates++; }else { ext4_msg(sb, KERN_DEBUG,
Greg Kroah-Hartman
maintainerPATCH 62/171 aoe: do not call bdi_init after blk_alloc_queue
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ed Cashin <[email protected]>
commit 0a41409c518083133e79015092585d68915865be upstream, but doesn't apply, so this version is different for older kernels than 3.7.x
blk_alloc_queue has already done a bdi_init, so do not bdi_init again in aoeblk_gdalloc. The extra call causes list corruption in the per-CPU backing dev info stats lists.
Affected users see console WARNINGs about list_del corruption on percpu_counter_destroy when doing "rmmod aoe" or "aoeflush -a" when AoE targets have been detected and initialized by the system.
The patch below applies to v3.6.11, with its v47 aoe driver. It is expected to apply to all currently maintained stable kernels except 3.7.y. A related but different fix has been posted for 3.7.y.
References:
RedHat bugzilla ticket with original report
https://bugzilla.redhat.com/show_bug.cgi?id=853064
LKML discussion of bug and fix
http://thread.gmane.org/gmane.linux.kernel/1416336/focus=1416497
--- drivers/block/aoe/aoe.h | 2 +- drivers/block/aoe/aoeblk.c | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/block/aoe/aoe.h +1 -1
@@ -1,5 +1,5 @@/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ -#define VERSION "47" +#define VERSION "47q"#define AOE_MAJOR 152#define DEVICE_NAME "aoe"
drivers/block/aoe/aoeblk.c +0 -5
@@ -276,8 +276,6 @@ aoeblk_gdalloc(void *vp) goto err_mempool;blk_queue_make_request (d->blkq, aoeblk_make_request); d->blkq->backing_dev_info.name ="aoe" ; -if (bdi_init (&d->blkq->backing_dev_info)) - goto err_blkq;spin_lock_irqsave (&d->lock, flags); gd->major =AOE_MAJOR ; gd->first_minor = d->sysminor *AOE_PARTITIONS ;
@@ -298,9 +296,6 @@ aoeblk_gdalloc(void *vp)aoedisk_add_sysfs (d);return ; -err_blkq: -blk_cleanup_queue (d->blkq); - d->blkq =NULL ; err_mempool:mempool_destroy (d->bufpool); err_disk:
Greg Kroah-Hartman
maintainerPATCH 63/171 udf: fix memory leak while allocating blocks during write
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit 2fb7d99d0de3fd8ae869f35ab682581d8455887a upstream.
Need to brelse the buffer_head stored in cur_epos and next_epos.
--- fs/udf/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/udf/inode.c +4 -0
@@ -738,6 +738,8 @@ static sector_t inode_getblk(struct inod goal, err);if (!newblocknum) {brelse (prev_epos.bh); +brelse (cur_epos.bh); +brelse (next_epos.bh); *err = -ENOSPC ;return 0 ; }
@@ -768,6 +770,8 @@ static sector_t inode_getblk(struct inodudf_update_extents (inode, laarr, startnum, endnum, &prev_epos);brelse (prev_epos.bh); +brelse (cur_epos.bh); +brelse (next_epos.bh); newblock =udf_get_pblock (inode->i_sb, newblocknum, iinfo->i_location.partitionReferenceNum,0 );
Greg Kroah-Hartman
maintainerPATCH 64/171 udf: dont increment lenExtents while writing to a hole
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit fb719c59bdb4fca86ee1fd1f42ab3735ca12b6b2 upstream.
Incrementing lenExtents even while writing to a hole is bad for performance as calls to udf_discard_prealloc and udf_truncate_tail_extent would not return from start if isize != lenExtents
--- fs/udf/inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/udf/inode.c +5 -2
@@ -574,6 +574,7 @@ static sector_t inode_getblk(struct inodstruct udf_inode_info *iinfo =UDF_I (inode);int goal =0 , pgoal = iinfo->i_location.logicalBlockNum;int lastblock =0 ; +bool isBeyondEOF; *err =0 ; *new =0 ;
@@ -653,7 +654,7 @@ static sector_t inode_getblk(struct inod/* Are we beyond EOF? */ if (etype ==-1 ) {int ret; - + isBeyondEOF =1 ;if (count) {if (c) laarr[0 ] = laarr[1 ];
@@ -696,6 +697,7 @@ static sector_t inode_getblk(struct inod endnum = c +1 ; lastblock =1 ; }else { + isBeyondEOF =0 ; endnum = startnum = ((count >2 ) ?2 : count);/* if the current extent is in position 0,
@@ -743,7 +745,8 @@ static sector_t inode_getblk(struct inod *err = -ENOSPC ;return 0 ; } - iinfo->i_lenExtents += inode->i_sb->s_blocksize; +if (isBeyondEOF) + iinfo->i_lenExtents += inode->i_sb->s_blocksize; }/* if the extent the requsted block is located in contains multiple
Greg Kroah-Hartman
maintainerPATCH 65/171 thp, memcg: split hugepage for memcg oom on cow
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
commit 1f1d06c34f7675026326cd9f39ff91e4555cf355 upstream.
On COW, a new hugepage is allocated and charged to the memcg. If the system is oom or the charge to the memcg fails, however, the fault handler will return VM_FAULT_OOM which results in an oom kill.
Instead, it's possible to fallback to splitting the hugepage so that the COW results only in an order-0 page being allocated and charged to the memcg which has a higher liklihood to succeed. This is expensive because the hugepage must be split in the page fault handler, but it is much better than unnecessarily oom killing a process.
--- mm/huge_memory.c | 3 +++ mm/memory.c | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-)
mm/huge_memory.c +3 -0
@@ -950,6 +950,8 @@ int do_huge_pmd_wp_page(struct mm_structcount_vm_event (THP_FAULT_FALLBACK ); ret =do_huge_pmd_wp_page_fallback (mm, vma, address, pmd, orig_pmd, page, haddr); +if (ret &VM_FAULT_OOM ) +split_huge_page (page);put_page (page); goto out; }
@@ -957,6 +959,7 @@ int do_huge_pmd_wp_page(struct mm_structif (unlikely (mem_cgroup_newpage_charge (new_page, mm,GFP_KERNEL ))) {put_page (new_page); +split_huge_page (page);put_page (page); ret |=VM_FAULT_OOM ; goto out;
mm/memory.c +15 -3
@@ -3494,6 +3494,7 @@ int handle_mm_fault(struct mm_struct *mmif (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)
@@ -3507,13 +3508,24 @@ int handle_mm_fault(struct mm_struct *mm pmd, flags); }else {pmd_t orig_pmd = *pmd; +int ret; +barrier ();if (pmd_trans_huge (orig_pmd)) {if (flags &FAULT_FLAG_WRITE && !pmd_write (orig_pmd) && - !pmd_trans_splitting (orig_pmd)) -return do_huge_pmd_wp_page (mm, vma, address, - pmd, orig_pmd); + !pmd_trans_splitting (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; + }return 0 ; } }
Greg Kroah-Hartman
maintainerPATCH 66/171 x86, amd: Disable way access filter on Piledriver CPUs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Przywara <[email protected]>
commit 2bbf0a1427c377350f001fbc6260995334739ad7 upstream.
The Way Access Filter in recent AMD CPUs may hurt the performance of some workloads, caused by aliasing issues in the L1 cache. This patch disables it on the affected CPUs.
The issue is similar to that one of last year:
http://lkml.indiana.edu/hypermail/linux/kernel/1107.3/00041.html
This new patch does not replace the old one, we just need another quirk for newer CPUs.
The performance penalty without the patch depends on the circumstances, but is a bit less than the last year's 3%.
The workloads affected would be those that access code from the same physical page under different virtual addresses, so different processes using the same libraries with ASLR or multiple instances of PIE-binaries. The code needs to be accessed simultaneously from both cores of the same compute unit.
More details can be found here:
http://developer.amd.com/Assets/SharedL1InstructionCacheonAMD15hCPU.pdf
CPUs affected are anything with the core known as Piledriver. That includes the new parts of the AMD A-Series (aka Trinity) and the just released new CPUs of the FX-Series (aka Vishera).
The model numbering is a bit odd here: FX CPUs have model 2, A-Series has model 10h, with possible extensions to 1Fh. Hence the range of model ids.
--- arch/x86/kernel/cpu/amd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/x86/kernel/cpu/amd.c +14 -0
@@ -612,6 +612,20 @@ static void __cpuinit init_amd(struct cp } } +/* +* The way access filter has a performance penalty on some workloads. +* Disable it on the affected CPUs. +*/ +if ((c->x86 ==0x15 ) && + (c->x86_model >=0x02 ) && (c->x86_model <0x20 )) { +u64 val; + +if (!rdmsrl_safe (0xc0011021 , &val) && !(val &0x1E )) { + val |=0x1E ; +checking_wrmsrl (0xc0011021 , val); + } + } +cpu_detect_cache_sizes (c);/* Multi core CPU? */
Greg Kroah-Hartman
maintainerPATCH 67/171 ACPI : do not use Lid and Sleep button for S5 wakeup
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit b7e383046c2c7c13ad928cd7407eafff758ddd4b upstream.
When system enters power off, the _PSW of Lid device is enabled. But this may cause the system to reboot instead of power off.
A proper way to fix this is to always disable lid wakeup capability for S5.
References: https://bugzilla.kernel.org/show_bug.cgi?id=35262
--- drivers/acpi/scan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/acpi/scan.c +6 -1
@@ -789,8 +789,8 @@ acpi_bus_extract_wakeup_device_power_pacstatic void acpi_bus_set_run_wake_flags (struct acpi_device *device) {struct acpi_device_id button_device_ids[] = { - {"PNP0C0D" ,0 }, {"PNP0C0C" ,0 }, + {"PNP0C0D" ,0 }, {"PNP0C0E" ,0 }, {"" ,0 }, };
@@ -802,6 +802,11 @@ static void acpi_bus_set_run_wake_flags(/* Power button, Lid switch always enable wakeup */ if (!acpi_match_device_ids (device, button_device_ids)) { device->wakeup.flags.run_wake =1 ; +if (!acpi_match_device_ids (device, &button_device_ids[1 ])) { +/* Do not use Lid/sleep button for S5 wakeup */ +if (device->wakeup.sleep_state ==ACPI_STATE_S5 ) + device->wakeup.sleep_state =ACPI_STATE_S4 ; + }device_set_wakeup_capable (&device->dev, true);return ; }
Greg Kroah-Hartman
maintainerPATCH 68/171 regmap: debugfs: Avoid overflows for very small reads
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit db04328c167ff8e7c57f4a3532214aeada3a82fd upstream.
If count is less than the size of a register then we may hit integer wraparound when trying to move backwards to check if we're still in the buffer. Instead move the position forwards to check if it's still in the buffer, we are unlikely to be able to allocate a buffer sufficiently big to overflow here.
--- drivers/base/regmap/regmap-debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap-debugfs.c +1 -1
@@ -90,7 +90,7 @@ static ssize_t regmap_map_read_file(stru/* If we're in the region the user is trying to read */ if (p >= *ppos) {/* ...but not beyond it */ -if (buf_pos >= count -1 - tot_len) +if (buf_pos +1 + tot_len >= count)break ;/* Format the register */
Greg Kroah-Hartman
maintainerPATCH 69/171 epoll: prevent missed events on EPOLL_CTL_MOD
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Wong <[email protected]>
commit 128dd1759d96ad36c379240f8b9463e8acfd37a1 upstream.
EPOLL_CTL_MOD sets the interest mask before calling f_op->poll() to ensure events are not missed. Since the modifications to the interest mask are not protected by the same lock as ep_poll_callback, we need to ensure the change is visible to other CPUs calling ep_poll_callback.
We also need to ensure f_op->poll() has an up-to-date view of past events which occured before we modified the interest mask. So this barrier also pairs with the barrier in wq_has_sleeper().
This should guarantee either ep_poll_callback or f_op->poll() (or both) will notice the readiness of a recently-ready/modified item.
This issue was encountered by Andreas Voellmy and Junchang(Jason) Wang in:
http://thread.gmane.org/gmane.linux.kernel/1408782/
--- fs/eventpoll.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
fs/eventpoll.c +21 -1
@@ -1226,11 +1226,31 @@ static int ep_modify(struct eventpoll *e* otherwise we might miss an event that happens between the * f_op->poll() call and the new event set registering. */ - epi->event.events = event->events; + epi->event.events = event->events;/* need barrier below */ pt._key = event->events; epi->event.data = event->data;/* protected by mtx */ /* +* The following barrier has two effects: +* +* 1) Flush epi changes above to other CPUs. This ensures +* we do not miss events from ep_poll_callback if an +* event occurs immediately after we call f_op->poll(). +* We need this because we did not take ep->lock while +* changing epi above (but ep_poll_callback does take +* ep->lock). +* +* 2) We also need to ensure we do not miss _past_ events +* when calling f_op->poll(). This barrier also +* pairs with the barrier in wq_has_sleeper (see +* comments for wq_has_sleeper). +* +* This barrier will now guarantee ep_poll_callback or f_op->poll +* (or both) will notice the readiness of an item. +*/ +smp_mb (); + +/* * Get current event bits. We can safely use the file* here because * its usage count has been increased by the caller of this function. */
Greg Kroah-Hartman
maintainerPATCH 70/171 HID: add quirk for Freescale i.MX23 ROM recovery
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 436136cec650d661eb662fcb508a99878606d050 upstream.
The USB recovery mode present in i.MX23 ROM emulates USB HID. It needs this quirk to behave properly.
Even if the official branding of the chip is Freescale i.MX23, I named it Sigmatel STMP3780 since that's what the chip really is and it even reports itself as STMP3780.
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/usbhid/hid-quirks.c | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -664,6 +664,9 @@#define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f#define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 +#define USB_VENDOR_ID_SIGMATEL 0x066F +#define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 +#define USB_VENDOR_ID_SKYCABLE 0x1223#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -78,6 +78,7 @@ static const struct hid_blacklist { { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
Greg Kroah-Hartman
maintainerPATCH 71/171 ASoC: wm2000: Fix sense of speech clarity enable
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 267f8fa2e1eef0612b2007e1f1846bcbc35cc1fa upstream.
--- sound/soc/codecs/wm2000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm2000.c +2 -2
@@ -190,9 +190,9 @@ static int wm2000_power_up(struct i2c_cl ret =wm2000_read (i2c,WM2000_REG_SPEECH_CLARITY );if (wm2000->speech_clarity) - ret &= ~WM2000_SPEECH_CLARITY ; -else ret |=WM2000_SPEECH_CLARITY ; +else + ret &= ~WM2000_SPEECH_CLARITY ;wm2000_write (i2c,WM2000_REG_SPEECH_CLARITY , ret);wm2000_write (i2c,WM2000_REG_SYS_START0 ,0x33 );
Greg Kroah-Hartman
maintainerPATCH 72/171 ASoC: wm2200: Fix setting dai format in wm2200_set_fmt
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit 2a5f431592343b78896013b055582f94c12a5049 upstream.
According to the defines in wm2200.h:
/*
* R1284 (0x504) - Audio IF 1_5
*/
We should not left shift 1 bit for fmt_val when setting dai format.
--- sound/soc/codecs/wm2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm2200.c +1 -1
@@ -1440,7 +1440,7 @@ static int wm2200_set_fmt(struct snd_socWM2200_AIF1TX_LRCLK_MSTR |WM2200_AIF1TX_LRCLK_INV , lrclk);snd_soc_update_bits (codec,WM2200_AUDIO_IF_1_5 , -WM2200_AIF1_FMT_MASK <<1 , fmt_val <<1 ); +WM2200_AIF1_FMT_MASK , fmt_val);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 73/171 ASoC: wm2200: Remove DSP B and left justified AIF modes
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 0cc411b934c4317b363d1af993549f391852b980 upstream.
These are not supported.
--- sound/soc/codecs/wm2200.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/codecs/wm2200.c +0 -6
@@ -1380,15 +1380,9 @@ static int wm2200_set_fmt(struct snd_soccase SND_SOC_DAIFMT_DSP_A : fmt_val =0 ;break ; -case SND_SOC_DAIFMT_DSP_B : - fmt_val =1 ; -break ;case SND_SOC_DAIFMT_I2S : fmt_val =2 ;break ; -case SND_SOC_DAIFMT_LEFT_J : - fmt_val =3 ; -break ;default :dev_err (codec->dev,"Unsupported DAI format %d\n" , fmt &SND_SOC_DAIFMT_FORMAT_MASK );
Greg Kroah-Hartman
maintainerPATCH 74/171 ASoC: wm5100: Remove DSP B and left justified formats
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 5f960294e2031d12f10c8488c3446fecbf59628d upstream.
These are not supported
--- sound/soc/codecs/wm5100.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/codecs/wm5100.c +0 -6
@@ -1296,15 +1296,9 @@ static int wm5100_set_fmt(struct snd_soccase SND_SOC_DAIFMT_DSP_A : mask =0 ;break ; -case SND_SOC_DAIFMT_DSP_B : - mask =1 ; -break ;case SND_SOC_DAIFMT_I2S : mask =2 ;break ; -case SND_SOC_DAIFMT_LEFT_J : - mask =3 ; -break ;default :dev_err (codec->dev,"Unsupported DAI format %d\n" , fmt &SND_SOC_DAIFMT_FORMAT_MASK );
Greg Kroah-Hartman
maintainerPATCH 75/171 udldrmfb: Fix EDID not working with monitors with EDID extension blocks
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit c930812fe5ebe725760422c9c351d1f6fde1502d upstream.
udldrmfb only reads the main EDID block, and if that advertises extensions the drm_edid code expects them to be present, and starts reading beyond the buffer udldrmfb passes it.
Although it may be possible to read more EDID info with the udl we simpy don't know how, and even if trial and error gets it working on one device, that is no guarantee it will work on other revisions. So this patch does a simple fix in the form of patching the EDID info to report 0 extension blocks, this fixes udldrmfb only doing 1024x768 on monitors with EDID extension blocks.
--- drivers/gpu/drm/udl/udl_connector.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/udl/udl_connector.c +8 -0
@@ -59,6 +59,14 @@ static int udl_get_modes(struct drm_conn connector->display_info.raw_edid = (char *)edid; +/* +* We only read the main block, but if the monitor reports extension +* blocks then the drm edid code expects them to be present, so patch +* the extension count to 0. +*/ + edid->checksum += edid->extensions; + edid->extensions =0 ; +drm_mode_connector_update_edid_property (connector, edid); ret =drm_add_edid_modes (connector, edid); connector->display_info.raw_edid =NULL ;
Greg Kroah-Hartman
maintainerPATCH 76/171 udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 242187b362555849e8c971dfbbfd55f8bd9fa717 upstream.
The buffer passed to usb_control_msg may end up in scatter-gather list, and may thus not be on the stack. Having it on the stack usually works on x86, but not on other archs.
--- drivers/gpu/drm/udl/udl_connector.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_connector.c +7 -1
@@ -22,13 +22,17 @@static u8 *udl_get_edid (struct udl_device *udl) {u8 *block; -char rbuf[3 ]; +char *rbuf;int ret, i; block =kmalloc (EDID_LENGTH ,GFP_KERNEL );if (block ==NULL )return NULL ; + rbuf =kmalloc (2 ,GFP_KERNEL ); +if (rbuf ==NULL ) + goto error; +for (i =0 ; i <EDID_LENGTH ; i++) { ret = usb_control_msg(udl->ddev->usbdev, usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02),
@@ -42,10 +46,12 @@ static u8 *udl_get_edid(struct udl_devic block[i] = rbuf[1 ]; } +kfree (rbuf);return block; error:kfree (block); +kfree (rbuf);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 77/171 udldrmfb: udl_get_edid: drop unneeded i--
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 7b4cf994e4c6ba48872bb25253cc393b7fb74c82 upstream.
This is a left-over from when udl_get_edid returned the amount of bytes successfully read, which it no longer does.
--- drivers/gpu/drm/udl/udl_connector.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/udl/udl_connector.c +0 -1
@@ -40,7 +40,6 @@ static u8 *udl_get_edid(struct udl_devic HZ);if (ret <1 ) {DRM_ERROR ("Read EDID byte %d failed err %x\n" , i, ret); - i--; goto error; } block[i] = rbuf[1 ];
Greg Kroah-Hartman
maintainerPATCH 78/171 ALSA: pxa27x: fix ac97 cold reset
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Dunn <[email protected]>
commit 41b645c8624df6ace020a8863ad1449d69140f7d upstream.
Cold reset on the pxa27x currently fails and
pxa2xx_ac97_try_cold_reset: cold reset timeout (GSR=0x44)
appears in the kernel log. Through trial-and-error (the pxa270 developer's manual is mostly incoherent on the topic of ac97 reset), I got cold reset to complete by setting the WARM_RST bit in the GCR register (and later noticed that pxa3xx does this for cold reset as well). Also, a timeout loop is needed to wait for the reset to complete.
Tested on a palm treo 680 machine.
--- sound/arm/pxa2xx-ac97-lib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/arm/pxa2xx-ac97-lib.c +6 -2
@@ -148,6 +148,8 @@ static inline void pxa_ac97_warm_pxa27x(static inline void pxa_ac97_cold_pxa27x (void ) { +unsigned int timeout; +GCR &=GCR_COLD_RST ;/* clear everything but nCRST */ GCR &= ~GCR_COLD_RST ;/* then assert nCRST */
@@ -157,8 +159,10 @@ static inline void pxa_ac97_cold_pxa27x(clk_enable (ac97conf_clk);udelay (5 );clk_disable (ac97conf_clk); -GCR =GCR_COLD_RST ; - udelay(50); +GCR =GCR_COLD_RST |GCR_WARM_RST ; + timeout =100 ;/* wait for the codec-ready bit to be set */ +while (!((GSR | gsr_bits) & (GSR_PCR |GSR_SCR )) && timeout--) + mdelay(1); }#endif
Greg Kroah-Hartman
maintainerPATCH 79/171 ALSA: pxa27x: fix ac97 warm reset
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Dunn <[email protected]>
commit 3b4bc7bccc7857274705b05cf81a0c72cfd0b0dd upstream.
This patch fixes some code that implements a work-around to a hardware bug in the ac97 controller on the pxa27x. A bug in the controller's warm reset functionality requires that the mfp used by the controller as the AC97_nRESET line be temporarily reconfigured as a generic output gpio (AF0) and manually held high for the duration of the warm reset cycle. This is what was done in the original code, but it was broken long ago by commit fb1bf8cd
([ARM] pxa: introduce processor specific pxa27x_assert_ac97reset())
which changed the mfp to a GPIO input instead of a high output.
The fix requires the ac97 controller to obtain the gpio via gpio_request_one(), with arguments that configure the gpio as an output initially driven high.
Tested on a palm treo 680 machine. Reportedly, this broken code only prevents a warm reset on hardware that lacks a pull-up on the line, which appears to be the case for me.
--- arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | 3 +++ arch/arm/mach-pxa/pxa27x.c | 4 ++-- sound/arm/pxa2xx-ac97-lib.c | 18 +++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-)
arch/arm/mach-pxa/include/mach/mfp-pxa27x.h +3 -0
@@ -462,6 +462,9 @@GPIO76_LCD_PCLK , \GPIO77_LCD_BIAS +/* these enable a work-around for a hw bug in pxa27x during ac97 warm reset */ +#define GPIO113_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO113, AF0, DEFAULT) +#define GPIO95_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO95, AF0, DEFAULT)extern int keypad_set_wake (unsigned int on);#endif /* __ASM_ARCH_MFP_PXA27X_H */
arch/arm/mach-pxa/pxa27x.c +2 -2
@@ -47,9 +47,9 @@ void pxa27x_clear_otgph(void)EXPORT_SYMBOL (pxa27x_clear_otgph);static unsigned long ac97_reset_config[] = { -GPIO113_GPIO , + GPIO113_AC97_nRESET_GPIO_HIGH, GPIO113_AC97_nRESET, -GPIO95_GPIO , + GPIO95_AC97_nRESET_GPIO_HIGH, GPIO95_AC97_nRESET, };
sound/arm/pxa2xx-ac97-lib.c +17 -1
@@ -18,6 +18,7 @@#include <linux/delay.h> #include <linux/module.h> #include <linux/io.h> +#include <linux/gpio.h> #include <sound/ac97_codec.h> #include <sound/pxa2xx-lib.h>
@@ -344,8 +345,21 @@ int __devinit pxa2xx_ac97_hw_probe(struc }if (cpu_is_pxa27x ()) { -/* Use GPIO 113 as AC97 Reset on Bulverde */ +/* +* This gpio is needed for a work-around to a bug in the ac97 +* controller during warm reset. The direction and level is set +* here so that it is an output driven high when switching from +* AC97_nRESET alt function to generic gpio. +*/ + ret =gpio_request_one (reset_gpio,GPIOF_OUT_INIT_HIGH , +"pxa27x ac97 reset" ); +if (ret <0 ) { +pr_err ("%s: gpio_request_one() failed: %d\n" , + __func__, ret); + goto err_conf; + }pxa27x_assert_ac97reset (reset_gpio,0 ); + ac97conf_clk =clk_get (&dev->dev,"AC97CONFCLK" );if (IS_ERR (ac97conf_clk)) { ret =PTR_ERR (ac97conf_clk);
@@ -388,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);void pxa2xx_ac97_hw_remove (struct platform_device *dev) { +if (cpu_is_pxa27x ()) +gpio_free (reset_gpio);GCR |=GCR_ACLINK_OFF ;free_irq (IRQ_AC97 ,NULL );if (ac97conf_clk) {
Greg Kroah-Hartman
maintainerPATCH 80/171 staging: comedi: prevent auto-unconfig of manually configured devices
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 7d3135af399e92cf4c9bbc5f86b6c140aab3b88c upstream.
When a low-level comedi driver auto-configures a device, a struct comedi_dev_file_info is allocated (as well as a struct comedi_device) by comedi_alloc_board_minor(). A pointer to the hardware struct device is stored as a cookie in the struct comedi_dev_file_info. When the low-level comedi driver auto-unconfigures the device, comedi_auto_unconfig() uses the cookie to find the struct comedi_dev_file_info so it can detach the comedi device from the driver, clean it up and free it.
A problem arises if the user manually unconfigures and reconfigures the comedi device using the COMEDI_DEVCONFIG ioctl so that is no longer associated with the original hardware device. The problem is that the cookie is not cleared, so that a call to comedi_auto_unconfig() from the low-level driver will still find it, detach it, clean it up and free it.
Stop this problem occurring by always clearing the hardware_device cookie in the struct comedi_dev_file_info whenever the COMEDI_DEVCONFIG ioctl call is successful.
--- drivers/staging/comedi/comedi_fops.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/comedi/comedi_fops.c +3 -0
@@ -138,6 +138,9 @@ static long comedi_unlocked_ioctl(structif (cmd ==COMEDI_DEVCONFIG ) { rc =do_devconfig_ioctl (dev, (struct comedi_devconfig __user *)arg); +if (rc ==0 ) +/* Evade comedi_auto_unconfig(). */ + dev_file_info->hardware_device =NULL ; goto done; }
Greg Kroah-Hartman
maintainerPATCH 81/171 staging: comedi: fix minimum AO period for NI 625x and NI 628x
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Éric Piel <[email protected]>
commit 34b55d8c48f4f76044d8f4d6ec3dc786cf210312 upstream.
The minimum period was set to 357 ns, while the divider for these boards is 50 ns. This prevented to output at maximum speed as ni_ao_cmdtest() would return 357 but would not accept it.
Not sure why it was set to 357 ns (this was done before the git history, which starts 5 years ago). My guess is that it comes from reading the specification stating a 2.8 MHz rate (~ 357 ns). The latest specification states a 2.86 MHz rate (~ 350 ns), which makes a lot more sense.
Tested on a pci-6251.
--- drivers/staging/comedi/drivers/ni_pcimio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/comedi/drivers/ni_pcimio.c +8 -8
@@ -1023,7 +1023,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0,
@@ -1042,7 +1042,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0,
@@ -1061,7 +1061,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0,
@@ -1097,7 +1097,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 32, .caldac = {caldac_none}, .has_8255 = 0,
@@ -1116,7 +1116,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 32, .caldac = {caldac_none}, .has_8255 = 0,
@@ -1152,7 +1152,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_628x_ao, .reg_type = ni_reg_628x, .ao_unipolar = 1, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0,
@@ -1171,7 +1171,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_628x_ao, .reg_type = ni_reg_628x, .ao_unipolar = 1, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0,
@@ -1207,7 +1207,7 @@ static const struct ni_board_struct ni_b .ao_range_table = &range_ni_M_628x_ao, .reg_type = ni_reg_628x, .ao_unipolar = 1, - .ao_speed = 357, + .ao_speed = 350, .num_p0_dio_channels = 32, .caldac = {caldac_none}, .has_8255 = 0,
Greg Kroah-Hartman
maintainerPATCH 82/171 staging: comedi: comedi_test: fix race when cancelling command
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit c0729eeefdcd76db338f635162bf0739fd2c5f6f upstream.
Éric Piel reported a kernel oops in the "comedi_test" module. It was a NULL pointer dereference within waveform_ai_interrupt() (actually a timer function) that sometimes occurred when a running asynchronous command is cancelled (either by the COMEDI_CANCEL ioctl or by closing the device file).
This seems to be a race between the caller of waveform_ai_cancel() which on return from that function goes and tears down the running command, and the timer function which uses the command. In particular, async->cmd.chanlist gets freed (and the pointer set to NULL) by do_become_nonbusy() in "comedi_fops.c" but a previously scheduled waveform_ai_interrupt() timer function will dereference that pointer regardless, leading to the oops.
Fix it by replacing the del_timer() call in waveform_ai_cancel() with del_timer_sync().
--- drivers/staging/comedi/drivers/comedi_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/comedi_test.c +1 -1
@@ -461,7 +461,7 @@ static int waveform_ai_cancel(struct com struct comedi_subdevice *s) { devpriv->timer_running =0 ; -del_timer (&devpriv->timer); +del_timer_sync (&devpriv->timer);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 83/171 staging: r8712u: Add new device ID
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit da849a92d3bafaf24d770e971c2c9e5c3f60b5d1 upstream.
The ISY IWL 1000 USB WLAN stick with USB ID 050d:11f1 is a clone of the Belkin F7D1101 V1 device.
--- drivers/staging/rtl8712/usb_intf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/rtl8712/usb_intf.c +2 -0
@@ -66,6 +66,8 @@ static struct usb_device_id rtl871x_usb_ {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable *//* Belkin */ {USB_DEVICE(0x050D, 0x945A)}, +/* ISY IWL - Belkin clone */ + {USB_DEVICE(0x050D, 0x11F1)},/* Corega */ {USB_DEVICE(0x07AA, 0x0047)},/* D-Link */
Greg Kroah-Hartman
maintainerPATCH 84/171 staging: speakup: avoid out-of-range access in synth_init()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nickolai Zeldovich <[email protected]>
commit ae428655b826f2755a8101b27beda42a275ef8ad upstream.
Check that array index is in-bounds before accessing the synths[] array.
--- drivers/staging/speakup/synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/synth.c +1 -1
@@ -342,7 +342,7 @@ int synth_init(char *synth_name)mutex_lock (&spk_mutex);/* First, check if we already have it loaded. */ -for (i =0 ; synths[i] !=NULL && i <MAXSYNTHS ; i++) +for (i =0 ; i <MAXSYNTHS && synths[i] !=NULL ; i++)if (strcmp (synths[i]->name, synth_name) ==0 ) synth = synths[i];
Greg Kroah-Hartman
maintainerPATCH 85/171 staging: speakup: avoid out-of-range access in synth_add()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Thibault <[email protected]>
commit 6102c48bd421074a33e102f2ebda3724e8d275f9 upstream.
Check that array index is in-bounds before accessing the synths[] array.
--- drivers/staging/speakup/synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/synth.c +1 -1
@@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synthint i;int status =0 ;mutex_lock (&spk_mutex); -for (i =0 ; synths[i] !=NULL && i <MAXSYNTHS ; i++) +for (i =0 ; i <MAXSYNTHS && synths[i] !=NULL ; i++)/* synth_remove() is responsible for rotating the array down */ if (in_synth == synths[i]) {mutex_unlock (&spk_mutex);
Greg Kroah-Hartman
maintainerPATCH 86/171 radeon/kms: force rn50 chip to always report connected on analog output
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 51861d4eebc2ddc25c77084343d060fa79f6e291 upstream.
Those rn50 chip are often connected to console remoting hw and load detection often fails with those. Just don't try to load detect and report connect.
--- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +8 -0
@@ -617,6 +617,14 @@ static enum drm_connector_status radeon_enum drm_connector_status found = connector_status_disconnected;bool color = true; +/* just don't bother on RN50 those chip are often connected to remoting +* console hw and often we get failure to load detect those. So to make +* everyone happy report the encoder as always connected. +*/ +if (ASIC_IS_RN50 (rdev)) { +return connector_status_connected; + } +/* save the regs we need */ vclk_ecp_cntl =RREG32_PLL (RADEON_VCLK_ECP_CNTL ); crtc_ext_cntl =RREG32 (RADEON_CRTC_EXT_CNTL );
Greg Kroah-Hartman
maintainerPATCH 87/171 mac80211: fix ibss scanning
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 34bcf71502413f8903ade93746f2d0f04b937a78 upstream.
Do not scan on no-IBSS and disabled channels in IBSS mode. Doing this can trigger Microcode errors on iwlwifi and iwlegacy drivers.
Also rename ieee80211_request_internal_scan() function since it is only used in IBSS mode and simplify calling it from ieee80211_sta_find_ibss().
This patch should address:
https://bugzilla.redhat.com/show_bug.cgi?id=883414
https://bugzilla.kernel.org/show_bug.cgi?id=49411
--- net/mac80211/ibss.c | 9 ++++----- net/mac80211/ieee80211_i.h | 6 +++--- net/mac80211/scan.c | 34 ++++++++++++++++++++++++---------- 3 files changed, 31 insertions(+), 18 deletions(-)
net/mac80211/ibss.c +4 -5
@@ -664,8 +664,8 @@ static void ieee80211_sta_merge_ibss(strprintk (KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " "IBSS networks with same SSID (merge)\n" , sdata->name); -ieee80211_request_internal_scan (sdata, - ifibss->ssid, ifibss->ssid_len,NULL ); +ieee80211_request_ibss_scan (sdata, ifibss->ssid, ifibss->ssid_len, +NULL ); }static void ieee80211_sta_create_ibss (struct ieee80211_sub_if_data *sdata)
@@ -772,9 +772,8 @@ static void ieee80211_sta_find_ibss(struprintk (KERN_DEBUG "%s: Trigger new scan to find an IBSS to " "join\n" , sdata->name); -ieee80211_request_internal_scan (sdata, - ifibss->ssid, ifibss->ssid_len, - ifibss->fixed_channel ? ifibss->channel :NULL ); +ieee80211_request_ibss_scan (sdata, ifibss->ssid, + ifibss->ssid_len, chan); }else {int interval =IEEE80211_SCAN_INTERVAL ;
net/mac80211/ieee80211_i.h +3 -3
@@ -1233,9 +1233,9 @@ void ieee80211_mesh_rx_queued_mgmt(struc/* scan/BSS handling */ void ieee80211_scan_work (struct work_struct *work); -int ieee80211_request_internal_scan (struct ieee80211_sub_if_data *sdata, -const u8 *ssid,u8 ssid_len, -struct ieee80211_channel *chan); +int ieee80211_request_ibss_scan (struct ieee80211_sub_if_data *sdata, +const u8 *ssid,u8 ssid_len, +struct ieee80211_channel *chan);int ieee80211_request_scan (struct ieee80211_sub_if_data *sdata,struct cfg80211_scan_request *req);void ieee80211_scan_cancel (struct ieee80211_local *local);
net/mac80211/scan.c +24 -10
@@ -761,9 +761,9 @@ int ieee80211_request_scan(struct ieee80return res; } -int ieee80211_request_internal_scan (struct ieee80211_sub_if_data *sdata, -const u8 *ssid,u8 ssid_len, -struct ieee80211_channel *chan) +int ieee80211_request_ibss_scan (struct ieee80211_sub_if_data *sdata, +const u8 *ssid,u8 ssid_len, +struct ieee80211_channel *chan) {struct ieee80211_local *local = sdata->local;int ret = -EBUSY ;
@@ -777,22 +777,36 @@ int ieee80211_request_internal_scan(stru/* fill internal scan request */ if (!chan) { -int i, nchan =0 ; +int i, max_n; +int n_ch =0 ;for (band =0 ; band <IEEE80211_NUM_BANDS ; band++) {if (!local->hw.wiphy->bands[band])continue ; -for (i =0 ; - i < local->hw.wiphy->bands[band]->n_channels; - i++) { - local->int_scan_req->channels[nchan] = + + max_n = local->hw.wiphy->bands[band]->n_channels; +for (i =0 ; i < max_n; i++) { +struct ieee80211_channel *tmp_ch = &local->hw.wiphy->bands[band]->channels[i]; - nchan++; + +if (tmp_ch->flags & (IEEE80211_CHAN_NO_IBSS | +IEEE80211_CHAN_DISABLED )) +continue ; + + local->int_scan_req->channels[n_ch] = tmp_ch; + n_ch++; } } - local->int_scan_req->n_channels = nchan; +if (WARN_ON_ONCE (n_ch ==0 )) + goto unlock; + + local->int_scan_req->n_channels = n_ch; }else { +if (WARN_ON_ONCE (chan->flags & (IEEE80211_CHAN_NO_IBSS | +IEEE80211_CHAN_DISABLED ))) + goto unlock; + local->int_scan_req->channels[0 ] = chan; local->int_scan_req->n_channels =1 ; }
Greg Kroah-Hartman
maintainerPATCH 88/171 mac80211: use del_timer_sync for final sta cleanup timer deletion
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit a56f992cdabc63f56b4b142885deebebf936ff76 upstream.
This is a very old bug, but there's nothing that prevents the timer from running while the module is being removed when we only do del_timer() instead of del_timer_sync().
The timer should normally not be running at this point, but it's not clearly impossible (or we could just remove this.)
--- net/mac80211/sta_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/sta_info.c +1 -1
@@ -844,7 +844,7 @@ void sta_info_init(struct ieee80211_locavoid sta_info_stop (struct ieee80211_local *local) { -del_timer (&local->sta_cleanup); +del_timer_sync (&local->sta_cleanup);sta_info_flush (local,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 89/171 mwifiex: check wait_event_interruptible return value
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bing Zhao <[email protected]>
commit 9c969d8ccb1e17bd20742f4ac9f00c1a64487234 upstream.
wait_event_interruptible function returns -ERESTARTSYS if it's interrupted by a signal. Driver should check the return value and handle this case properly.
In mwifiex_wait_queue_complete() routine, as we are now checking wait_event_interruptible return value, the condition check is not required. Also, we have removed mwifiex_cancel_pending_ioctl() call to avoid a chance of sending second command to FW by other path as soon as we clear current command node. FW can not handle two commands simultaneously.
--- drivers/net/wireless/mwifiex/sta_ioctl.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/net/wireless/mwifiex/sta_ioctl.c +10 -11
@@ -53,7 +53,6 @@ int mwifiex_copy_mcast_addr(struct mwifi*/ int mwifiex_wait_queue_complete (struct mwifiex_adapter *adapter) { -bool cancel_flag = false;int status;struct cmd_ctrl_node *cmd_queued;
@@ -70,14 +69,11 @@ int mwifiex_wait_queue_complete(struct mqueue_work (adapter->workqueue, &adapter->main_work);/* Wait for completion */ -wait_event_interruptible (adapter->cmd_wait_q.wait, - *(cmd_queued->condition)); -if (!*(cmd_queued->condition)) - cancel_flag = true; - -if (cancel_flag) { -mwifiex_cancel_pending_ioctl (adapter); -dev_dbg (adapter->dev,"cmd cancel\n" ); + status =wait_event_interruptible (adapter->cmd_wait_q.wait, + *(cmd_queued->condition)); +if (status) { +dev_err (adapter->dev,"cmd_wait_q terminated: %d\n" , status); +return status; } status = adapter->cmd_wait_q.status;
@@ -436,8 +432,11 @@ int mwifiex_enable_hs(struct mwifiex_adareturn false; } -wait_event_interruptible (adapter->hs_activate_wait_q, - adapter->hs_activate_wait_q_woken); +if (wait_event_interruptible (adapter->hs_activate_wait_q, + adapter->hs_activate_wait_q_woken)) { +dev_err (adapter->dev,"hs_activate_wait_q terminated\n" ); +return false; + }return true; }
Greg Kroah-Hartman
maintainerPATCH 90/171 b43: Fix firmware loading when driver is built into the kernel
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 5e20a4b53094651d80f856ff55a916b999dbb57a upstream.
Recent versions of udev cause synchronous firmware loading from the probe routine to fail because the request to user space would time out. The original fix for b43 (commit 6b6fa58) moved the firmware load from the probe routine to a work queue, but it still used synchronous firmware loading. This method is OK when b43 is built as a module; however, it fails when the driver is compiled into the kernel.
This version changes the code to load the initial firmware file using request_firmware_nowait(). A completion event is used to hold the work queue until that file is available. This driver reads several firmware files - the remainder can be read synchronously. On some test systems, the async read fails; however, a following synch read works, thus the async failure falls through to the sync try.
Reported-and-Tested by: Felix Janda <[email protected]>
--- drivers/net/wireless/b43/b43.h | 5 +++ drivers/net/wireless/b43/main.c | 54 ++++++++++++++++++++++++++++++---------- drivers/net/wireless/b43/main.h | 5 +-- 3 files changed, 48 insertions(+), 16 deletions(-)
drivers/net/wireless/b43/b43.h +5 -0
@@ -7,6 +7,7 @@#include <linux/hw_random.h> #include <linux/bcma/bcma.h> #include <linux/ssb/ssb.h> +#include <linux/completion.h> #include <net/mac80211.h> #include "debugfs.h"
@@ -718,6 +719,10 @@ enum b43_firmware_file_type {struct b43_request_fw_context {/* The device we are requesting the fw for. */ struct b43_wldev *dev; +/* a completion event structure needed if this call is asynchronous */ +struct completion fw_load_complete; +/* a pointer to the firmware object */ +const struct firmware *blob;/* The type of firmware to request. */ enum b43_firmware_file_type req_type;/* Error messages for each firmware type. */
drivers/net/wireless/b43/main.c +41 -13
119 lines not on this page · raw message
drivers/net/wireless/b43/main.h +2 -3
@@ -137,9 +137,8 @@ void b43_mac_phy_clock_set(struct b43_wlstruct b43_request_fw_context ; -int b43_do_request_fw (struct b43_request_fw_context *ctx, -const char *name, -struct b43_firmware_file *fw); +int b43_do_request_fw (struct b43_request_fw_context *ctx,const char *name, +struct b43_firmware_file *fw,bool async);void b43_do_release_fw (struct b43_firmware_file *fw);#endif /* B43_MAIN_H_ */
Greg Kroah-Hartman
maintainerPATCH 91/171 USB: option: add Nexpring NP10T terminal id
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dzianis Kahanovich <[email protected]>
commit ad86e58661b38b279b7519d4e49c7a19dc1654bb upstream.
Hyundai Petatel Inc. Nexpring NP10T terminal (EV-DO rev.A USB modem) ID
--- drivers/usb/serial/option.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/serial/option.c +5 -0
@@ -441,6 +441,10 @@ static void option_instat_callback(struc#define CELLIENT_VENDOR_ID 0x2692#define CELLIENT_PRODUCT_MEN200 0x9005 +/* Hyundai Petatel Inc. products */ +#define PETATEL_VENDOR_ID 0x1ff4 +#define PETATEL_PRODUCT_NP10T 0x600e +/* some devices interfaces need special handling due to a number of reasons */ enum option_blacklist_reason {OPTION_BLACKLIST_NONE =0 ,
@@ -1295,6 +1299,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, + { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
Greg Kroah-Hartman
maintainerPATCH 92/171 USB: option: blacklist network interface on ZTE MF880
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit fab38246f318edcd0dcb8fd3852a47cf8938878a upstream.
The driver description files gives these names to the vendor specific functions on this modem:
diag: VID_19D2&PID_0284&MI_00
nmea: VID_19D2&PID_0284&MI_01
at: VID_19D2&PID_0284&MI_02 mdm: VID_19D2&PID_0284&MI_03 net: VID_19D2&PID_0284&MI_04
--- drivers/usb/serial/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +2 -1
@@ -927,7 +927,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */ .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
Greg Kroah-Hartman
maintainerPATCH 93/171 USB: option: Add new MEDIATEK PID support
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Quentin.Li" <[email protected]>
commit 94a85b633829b946eef53fc1825d526312fb856f upstream.
In option.c, add some new MEDIATEK PIDs support for MEDIATEK new products. This is a MEDIATEK inc. release patch.
--- drivers/usb/serial/option.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/serial/option.c +7 -0
@@ -429,9 +429,12 @@ static void option_instat_callback(struc#define MEDIATEK_VENDOR_ID 0x0e8d#define MEDIATEK_PRODUCT_DC_1COM 0x00a0#define MEDIATEK_PRODUCT_DC_4COM 0x00a5 +#define MEDIATEK_PRODUCT_DC_4COM2 0x00a7#define MEDIATEK_PRODUCT_DC_5COM 0x00a4#define MEDIATEK_PRODUCT_7208_1COM 0x7101#define MEDIATEK_PRODUCT_7208_2COM 0x7102 +#define MEDIATEK_PRODUCT_7103_2COM 0x7103 +#define MEDIATEK_PRODUCT_7106_2COM 0x7106#define MEDIATEK_PRODUCT_FP_1COM 0x0003#define MEDIATEK_PRODUCT_FP_2COM 0x0023#define MEDIATEK_PRODUCT_FPDC_1COM 0x0043
@@ -1299,6 +1302,10 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7103_2COM, 0xff, 0x00, 0x00) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7106_2COM, 0x02, 0x02, 0x01) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) }, { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, { } /* Terminating entry */
Greg Kroah-Hartman
maintainerPATCH 94/171 USB: option: add Telekom Speedstick LTE II
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 5ec0085440ef8c2cf50002b34d5a504ee12aa2bf upstream.
also known as Alcatel One Touch L100V LTE
The driver description files gives these names to the vendor specific functions on this modem:
Application1: VID_1BBB&PID_011E&MI_00
Application2: VID_1BBB&PID_011E&MI_01
Modem: VID_1BBB&PID_011E&MI_03
Ethernet: VID_1BBB&PID_011E&MI_04
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -288,6 +288,7 @@ static void option_instat_callback(struc#define ALCATEL_VENDOR_ID 0x1bbb#define ALCATEL_PRODUCT_X060S_X200 0x0000#define ALCATEL_PRODUCT_X220_X500D 0x0017 +#define ALCATEL_PRODUCT_L100V 0x011e#define PIRELLI_VENDOR_ID 0x1266#define PIRELLI_PRODUCT_C100_1 0x1002
@@ -1198,6 +1199,8 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) }, + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
Greg Kroah-Hartman
maintainerPATCH 95/171 usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Mloduchowski <[email protected]>
commit 8cf65dc386f3634a43312f436cc7a935476a40c4 upstream.
Simple fix to add support for Crucible Technologies COMET Caller ID USB decoder - a device containing FTDI USB/Serial converter chip, handling 1200bps CallerID messages decoded from the phone line - adding correct USB PID is sufficient.
Tested to apply cleanly and work flawlessly against 3.6.9, 3.7.0-rc8 and 3.8.0-rc3 on both amd64 and x86 arches.
--- 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
@@ -881,6 +881,8 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, +/* Crucible Devices */ + { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -1259,3 +1259,9 @@* ATI command output: Cinterion MC55i */ #define FTDI_CINTERION_MC55I_PID 0xA951 + +/* +* Product: Comet Caller ID decoder +* Manufacturer: Crucible Technologies +*/ +#define FTDI_CT_COMET_PID 0x8e08
Greg Kroah-Hartman
maintainerPATCH 96/171 USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i"
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis N Ladin <[email protected]>
commit 036915a7a402753c05b8d0529f5fd08805ab46d0 upstream.
Adding support "PSC Scanning, Magellan 800i" in cdc-acm
Very simple, but very necessary.
Suitable for all versions of the kernel > 2.6
--- drivers/usb/class/cdc-acm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/class/cdc-acm.c +3 -0
@@ -1602,6 +1602,9 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ .driver_info =NO_UNION_NORMAL , }, + { USB_DEVICE(0x05f9, 0x4002), /* PSC Scanning, Magellan 800i */ + .driver_info = NO_UNION_NORMAL, + }, { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ },
Greg Kroah-Hartman
maintainerPATCH 97/171 usb: gadget: dummy: fix enumeration with g_multi
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit 1d16638e3b9cc195bac18a8fcbca748f33c1bc24 upstream.
If we do have endpoints named like "ep-a" then bEndpointAddress is counted internally by the gadget framework.
If we do have endpoints named like "ep-1" then bEndpointAddress is assigned from the digit after "ep-".
If we do have both, then it is likely that after we used up the "generic" endpoints we will use the digits and thus assign one bEndpointAddress to multiple endpoints.
This theory can be proofed by using the completely enabled g_multi. Without this patch, the mass storage won't enumerate and times out because it shares endpoints with RNDIS.
This patch also adds fills up the endpoints list so we have in total endpoints 1 to 15 in + out available while some of them are restricted to certain types like BULK or ISO. Without this change the nokia gadget won't load because the system does not provide enough (BULK) endpoints but it did before ep-a - ep-f were removed.
--- drivers/usb/gadget/dummy_hcd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/gadget/dummy_hcd.c +5 -4
@@ -126,10 +126,7 @@ static const char ep0name[] = "ep0";static const char *const ep_name[] = { ep0name,/* everyone has ep0 */ -/* act like a net2280: high speed, six configurable endpoints */ -"ep-a" ,"ep-b" ,"ep-c" ,"ep-d" ,"ep-e" ,"ep-f" , - -/* or like pxa250: fifteen fixed function endpoints */ +/* act like a pxa250: fifteen fixed function endpoints */ "ep1in-bulk" ,"ep2out-bulk" ,"ep3in-iso" ,"ep4out-iso" ,"ep5in-int" ,"ep6in-bulk" ,"ep7out-bulk" ,"ep8in-iso" ,"ep9out-iso" ,"ep10in-int" ,"ep11in-bulk" ,"ep12out-bulk" ,"ep13in-iso" ,"ep14out-iso" ,
@@ -137,6 +134,10 @@ static const char *const ep_name[] = {/* or like sa1100: two fixed function endpoints */ "ep1out-bulk" ,"ep2in-bulk" , + +/* and now some generic EPs so we have enough in multi config */ +"ep3out" ,"ep4in" ,"ep5out" ,"ep6out" ,"ep7in" ,"ep8out" ,"ep9in" , + "ep10out", "ep11out", "ep12in", "ep13out", "ep14in", "ep15out", };#define DUMMY_ENDPOINTS ARRAY_SIZE(ep_name)
Greg Kroah-Hartman
maintainerPATCH 98/171 usb: musb: core: print new line in the driver banner again
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Shtylyov <[email protected]>
commit 2ac788f705e5118dd45204e7a5bc8d5bb6873835 upstream.
Commit 5c8a86e10a7c164f44537fabdc169fd8b4e7a440 (usb: musb: drop unneeded musb_debug trickery) erroneously removed '\n' from the driver's banner. Concatenate all the banner substrings while adding it back...
--- drivers/usb/musb/musb_core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/usb/musb/musb_core.c +1 -4
@@ -2400,10 +2400,7 @@ static int __init musb_init(void)if (usb_disabled ())return 0 ; -pr_info ("%s: version " MUSB_VERSION ", " -"?dma?" -", " -"otg (peripheral+host)" , +pr_info ("%s: version " MUSB_VERSION ", ?dma?, otg (peripheral+host)\n" , musb_driver_name);return platform_driver_register (&musb_driver); }
Greg Kroah-Hartman
maintainerPATCH 99/171 drm/nouveau: fix blank LVDS screen regression on pre-nv50 cards
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcin Slusarz <[email protected]>
commit 92441b2263866c27ef48137be5aa6c8c692652fc upstream.
Commit 2a44e499 ("drm/nouveau/disp: introduce proper init/fini, separate from create/destroy") started to call display init routines on pre-nv50 hardware on module load. But LVDS init code sets driver state in a way which prevents modesetting code from operating properly.
nv04_display_init calls nv04_dfp_restore, which sets encoder->last_dpms to NV_DPMS_CLEARED.
drm_crtc_helper_set_mode
nv04_dfp_prepare
nv04_lvds_dpms(DRM_MODE_DPMS_OFF)
nv04_lvds_dpms checks last_dpms mode (which is NV_DPMS_CLEARED) and wrongly assumes it's a "powersaving mode", the new one (DRM_MODE_DPMS_OFF) is too, so it skips calling some crucial lvds scripts.
--- drivers/gpu/drm/nouveau/nv04_dfp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nv04_dfp.c +1 -1
@@ -504,7 +504,7 @@ static void nv04_dfp_update_backlight(ststatic inline bool is_powersaving_dpms (int mode) { -return (mode !=DRM_MODE_DPMS_ON ); +return mode !=DRM_MODE_DPMS_ON && mode !=NV_DPMS_CLEARED ; }static void nv04_lvds_dpms (struct drm_encoder *encoder,int mode)
Greg Kroah-Hartman
maintainerPATCH 100/171 USB: Handle auto-transition from hot to warm reset.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 1c7439c61fa6516419c32a9824976334ea969d47 upstream.
USB 3.0 hubs and roothubs will automatically transition a failed hot reset to a warm (BH) reset. In that case, the warm reset change bit will be set, and the link state change bit may also be set. Change hub_port_finish_reset to unconditionally clear those change bits for USB 3.0 hubs. If these bits are not cleared, we may lose port change events from the roothub.
This commit should be backported to kernels as old as 3.2, that contain the commit 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine warm reset logic".
--- drivers/usb/core/hub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/core/hub.c +3 -3
@@ -2249,16 +2249,16 @@ static void hub_port_finish_reset(structclear_port_feature (hub->hdev, port1,USB_PORT_FEAT_C_RESET );/* FIXME need disconnect() for NOTATTACHED device */ -if (warm) { +if (hub_is_superspeed (hub->hdev)) {clear_port_feature (hub->hdev, port1,USB_PORT_FEAT_C_BH_PORT_RESET );clear_port_feature (hub->hdev, port1,USB_PORT_FEAT_C_PORT_LINK_STATE ); - }else { + } +if (!warm)usb_set_device_state (udev, *status ?USB_STATE_NOTATTACHED :USB_STATE_DEFAULT ); - }break ; } }
Greg Kroah-Hartman
maintainerPATCH 101/171 USB: Ignore xHCI Reset Device status.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 8b8132bc3d1cc3d4c0687e4d638a482fa920d98a upstream.
When the USB core finishes reseting a USB device, the xHCI driver sends a Reset Device command to the host. The xHC then updates its internal representation of the USB device to the 'Default' device state. If the device was already in the Default state, the xHC will complete the command with an error status.
If a device needs to be reset several times during enumeration, the second reset will always fail because of the xHCI Reset Device command. This can cause issues during enumeration.
For example, usb_reset_and_verify_device calls into hub_port_init in a loop. Say that on the first call into hub_port_init, the device is successfully reset, but doesn't respond to several set address control transfers. Then the port will be disabled, but the udev will remain in tact. usb_reset_and_verify_device will call into hub_port_init again.
On the second call into hub_port_init, the device will be reset, and the xHCI driver will issue a Reset Device command. This command will fail (because the device is already in the Default state), and usb_reset_and_verify_device will fail. The port will be disabled, and the device won't be able to enumerate.
Fix this by ignoring the return value of the HCD reset_device callback.
This commit should be backported to kernels as old as 3.2, that contain the commit 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine warm reset logic".
--- drivers/usb/core/hub.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/usb/core/hub.c +5 -8
@@ -2234,14 +2234,11 @@ static void hub_port_finish_reset(structmsleep (10 +40 );update_devnum (udev,0 ); hcd =bus_to_hcd (udev->bus); -if (hcd->driver->reset_device) { - *status = hcd->driver->reset_device (hcd, udev); -if (*status <0 ) { -dev_err (&udev->dev,"Cannot reset " -"HCD device state\n" ); -break ; - } - } +/* The xHC may think the device is already reset, +* so ignore the status. +*/ +if (hcd->driver->reset_device) + hcd->driver->reset_device (hcd, udev); }/* FALL THROUGH */ case -ENOTCONN :
Greg Kroah-Hartman
maintainerPATCH 102/171 USB: Allow USB 3.0 ports to be disabled.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 41e7e056cdc662f704fa9262e5c6e213b4ab45dd upstream.
If hot and warm reset fails, or a port remains in the Compliance Mode, the USB core needs to be able to disable a USB 3.0 port. Unlike USB 2.0 ports, once the port is placed into the Disabled link state, it will not report any new device connects. To get device connect notifications, we need to put the link into the Disabled state, and then the RxDetect state.
The xHCI driver needs to atomically clear all change bits on USB 3.0 port disable, so that we get Port Status Change Events for future port changes. We could technically do this in the USB core instead of in the xHCI roothub code, since the port state machine can't advance out of the disabled state until we set the link state to RxDetect. However, external USB 3.0 hubs don't need this code. They are level-triggered, not edge-triggered like xHCI, so they will continue to send interrupt events when any change bit is set. Therefore it doesn't make sense to put this code in the USB core.
This patch is part of a series to fix several reports of infinite loops on device enumeration failure. This includes John, when he boots with a USB 3.0 device (Roseweil eusb3 enclosure) attached to his NEC 0.96 host controller. The fix requires warm reset support, so it does not make sense to backport this patch to stable kernels without warm reset support.
This patch should be backported to kernels as old as 3.2, contain the commit ID 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine warm reset logic"
--- drivers/usb/core/hub.c | 63 ++++++++++++++++++++++++++++++++++++++++++-- drivers/usb/host/xhci-hub.c | 31 ++++++++++++++++++++- 2 files changed, 90 insertions(+), 4 deletions(-)
drivers/usb/core/hub.c +61 -2
@@ -644,6 +644,60 @@ static int hub_hub_status(struct usb_hubreturn ret; } +static int hub_set_port_link_state (struct usb_hub *hub,int port1, +unsigned int link_status) +{ +return set_port_feature (hub->hdev, + port1 | (link_status <<3 ), +USB_PORT_FEAT_LINK_STATE ); +} + +/* +* If USB 3.0 ports are placed into the Disabled state, they will no longer +* detect any device connects or disconnects. This is generally not what the +* USB core wants, since it expects a disabled port to produce a port status +* change event when a new device connects. +* +* Instead, set the link state to Disabled, wait for the link to settle into +* that state, clear any change bits, and then put the port into the RxDetect +* state. +*/ +static int hub_usb3_port_disable (struct usb_hub *hub,int port1) +{ +int ret; +int total_time; +u16 portchange, portstatus; + +if (!hub_is_superspeed (hub->hdev)) +return -EINVAL ; + + ret =hub_set_port_link_state (hub, port1,USB_SS_PORT_LS_SS_DISABLED ); +if (ret) { +dev_err (hub->intfdev,"cannot disable port %d (err = %d)\n" , + port1, ret); +return ret; + } + +/* Wait for the link to enter the disabled state. */ +for (total_time =0 ; ; total_time +=HUB_DEBOUNCE_STEP ) { + ret =hub_port_status (hub, port1, &portstatus, &portchange); +if (ret <0 ) +return ret; + +if ((portstatus &USB_PORT_STAT_LINK_STATE ) == +USB_SS_PORT_LS_SS_DISABLED ) +break ; +if (total_time >=HUB_DEBOUNCE_TIMEOUT ) +break ; +msleep (HUB_DEBOUNCE_STEP ); + } +if (total_time >=HUB_DEBOUNCE_TIMEOUT ) +dev_warn (hub->intfdev,"Could not disable port %d after %d ms\n" , + port1, total_time); + +return hub_set_port_link_state (hub, port1,USB_SS_PORT_LS_RX_DETECT ); +} +static int hub_port_disable (struct usb_hub *hub,int port1,int set_state) {struct usb_device *hdev = hub->hdev;
@@ -652,8 +706,13 @@ static int hub_port_disable(struct usb_hif (hdev->children[port1-1 ] && set_state)usb_set_device_state (hdev->children[port1-1 ],USB_STATE_NOTATTACHED ); -if (!hub->error && !hub_is_superspeed (hub->hdev)) - ret =clear_port_feature (hdev, port1,USB_PORT_FEAT_ENABLE ); +if (!hub->error) { +if (hub_is_superspeed (hub->hdev)) + ret =hub_usb3_port_disable (hub, port1); +else + ret =clear_port_feature (hdev, port1, +USB_PORT_FEAT_ENABLE ); + }if (ret)dev_err (hub->intfdev,"cannot disable port %d (err = %d)\n" , port1, ret);
drivers/usb/host/xhci-hub.c +29 -2
@@ -753,12 +753,39 @@ int xhci_hub_control(struct usb_hcd *hcdbreak ;case USB_PORT_FEAT_LINK_STATE : temp =xhci_readl (xhci, port_array[wIndex]); + +/* Disable port */ +if (link_state ==USB_SS_PORT_LS_SS_DISABLED ) { +xhci_dbg (xhci,"Disable port %d\n" , wIndex); + temp =xhci_port_state_to_neutral (temp); +/* +* Clear all change bits, so that we get a new +* connection event. +*/ + temp |=PORT_CSC |PORT_PEC |PORT_WRC | +PORT_OCC |PORT_RC |PORT_PLC | +PORT_CEC ; +xhci_writel (xhci, temp |PORT_PE , + port_array[wIndex]); + temp =xhci_readl (xhci, port_array[wIndex]); +break ; + } + +/* Put link in RxDetect (enable port) */ +if (link_state ==USB_SS_PORT_LS_RX_DETECT ) { +xhci_dbg (xhci,"Enable port %d\n" , wIndex); +xhci_set_link_state (xhci, port_array, wIndex, + link_state); + temp =xhci_readl (xhci, port_array[wIndex]); +break ; + } +/* Software should not attempt to set -* port link state above '5' (Rx.Detect) and the port +* port link state above '3' (U3) and the port * must be enabled. */ if ((temp &PORT_PE ) ==0 || - (link_state >USB_SS_PORT_LS_RX_DETECT )) { + (link_state >USB_SS_PORT_LS_U3 )) {xhci_warn (xhci,"Cannot set link state.\n" ); goto error; }
Greg Kroah-Hartman
maintainerPATCH 103/171 USB: Increase reset timeout.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 77c7f072c87fa951e9a74805febf26466f31170c upstream.
John's NEC 0.96 xHCI host controller needs a longer timeout for a warm reset to complete. The logs show it takes 650ms to complete the warm reset, so extend the hub reset timeout to 800ms to be on the safe side.
This commit should be backported to kernels as old as 3.2, that contain the commit 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine warm reset logic".
--- drivers/usb/core/hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/hub.c +1 -1
@@ -2168,7 +2168,7 @@ static unsigned hub_is_wusb(struct usb_h#define HUB_SHORT_RESET_TIME 10#define HUB_BH_RESET_TIME 50#define HUB_LONG_RESET_TIME 200 -#define HUB_RESET_TIMEOUT 500 +#define HUB_RESET_TIMEOUT 800static int hub_port_reset (struct usb_hub *hub,int port1,struct usb_device *udev,unsigned int delay,bool warm);
Greg Kroah-Hartman
maintainerPATCH 104/171 USB: Ignore port state until reset completes.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 4f43447e62b37ee19c82a13f72f35b1ca60a74d3 upstream.
The port reset code bails out early if the current connect status is cleared (device disconnected). If we're issuing a hot reset, it may also look at the link state before the reset is finished.
Section 10.14.2.6 of the USB 3.0 spec says that when a port enters the Error state or Resetting state, the port connection bit retains the value from the previous state. Therefore we can't trust it until the reset finishes. Also, the xHCI spec section 4.19.1.2.5 says software shall ignore the link state while the port is resetting, as it can be in an unknown state.
The port state during reset is also unknown for USB 2.0 hubs. The hub sends a reset signal by driving the bus into an SE0 state. This overwhelms the "connect" signal from the device, so the port can't tell whether anything is connected or not.
Fix the port reset code to ignore the port link state and current connect bit until the reset finishes, and USB_PORT_STAT_RESET is cleared.
Remove the check for USB_PORT_STAT_C_BH_RESET in the warm reset case, because it's redundant. When the warm reset finishes, the port reset bit will be cleared at the same time USB_PORT_STAT_C_BH_RESET is set. Remove the now-redundant check for a cleared USB_PORT_STAT_RESET bit in the code to deal with the finished reset.
This patch should be backported to all stable kernels.
--- drivers/usb/core/hub.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/usb/core/hub.c +7 -7
@@ -2203,6 +2203,10 @@ static int hub_port_wait_reset(struct usif (ret <0 )return ret; +/* The port state is unknown until the reset completes. */ +if ((portstatus &USB_PORT_STAT_RESET )) + goto delay; +/* * Some buggy devices require a warm reset to be issued even * when the port appears not to be connected.
@@ -2248,11 +2252,7 @@ static int hub_port_wait_reset(struct usif ((portchange &USB_PORT_STAT_C_CONNECTION ))return -ENOTCONN ; -/* if we`ve finished resetting, then break out of -* the loop -*/ -if (!(portstatus &USB_PORT_STAT_RESET ) && - (portstatus &USB_PORT_STAT_ENABLE )) { +if ((portstatus &USB_PORT_STAT_ENABLE )) {if (hub_is_wusb (hub)) udev->speed =USB_SPEED_WIRELESS ;else if (hub_is_superspeed (hub->hdev))
@@ -2266,10 +2266,10 @@ static int hub_port_wait_reset(struct usreturn 0 ; } }else { -if (portchange &USB_PORT_STAT_C_BH_RESET ) -return 0 ; +return 0 ; } +delay:/* switch to the long delay after two short delay failures */ if (delay_time >=2 *HUB_SHORT_RESET_TIME ) delay =HUB_LONG_RESET_TIME ;
Greg Kroah-Hartman
maintainerPATCH 105/171 USB: Handle warm reset failure on empty port.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a upstream.
An empty port can transition to either Inactive or Compliance Mode if a newly connected USB 3.0 device fails to link train. In that case, we issue a warm reset. Some devices, such as John's Roseweil eusb3 enclosure, slip back into Compliance Mode after the warm reset.
The current warm reset code does not check for device connect status on warm reset completion, and it incorrectly reports the warm reset succeeded. This causes the USB core to attempt to send a Set Address control transfer to a port in Compliance Mode, which will always fail.
Make hub_port_wait_reset check the current connect status and link state after the warm reset completes. Return a failure status if the device is disconnected or the link state is Compliance Mode or SS.Inactive.
Make hub_events disable the port if warm reset fails. This will disable the port, and then bring it back into the RxDetect state. Make the USB core ignore the connect change until the device reconnects.
Note that this patch does NOT handle connected devices slipping into the Inactive state very well. This is a concern, because devices can go into the Inactive state on U1/U2 exit failure. However, the fix for that case is too large for stable, so it will be submitted in a separate patch.
This patch should be backported to kernels as old as 3.2, contain the commit ID 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine warm reset logic"
--- drivers/usb/core/hub.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +11 -1
@@ -2266,6 +2266,11 @@ static int hub_port_wait_reset(struct usreturn 0 ; } }else { +if (!(portstatus &USB_PORT_STAT_CONNECTION ) || +hub_port_warm_reset_required (hub, + portstatus)) +return -ENOTCONN ; +return 0 ; }
@@ -3830,9 +3835,14 @@ static void hub_events(void)* SS.Inactive state. */ if (hub_port_warm_reset_required (hub, portstatus)) { +int status; +dev_dbg (hub_dev,"warm reset port %d\n" , i); -hub_port_reset (hub, i,NULL , + status =hub_port_reset (hub, i,NULL ,HUB_BH_RESET_TIME , true); +if (status <0 ) +hub_port_disable (hub, i,1 ); + connect_change =0 ; }if (connect_change)
Greg Kroah-Hartman
maintainerPATCH 106/171 xhci: Avoid "dead ports", add roothub port polling.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit c52804a472649b2e5005342308739434cbd51119 upstream.
The USB core hub thread (khubd) is designed with external USB hubs in mind. It expects that if a port status change bit is set, the hub will continue to send a notification through the hub status data transfer. Basically, it expects hub notifications to be level-triggered.
The xHCI host controller is designed to be edge-triggered on the logical 'OR' of all the port status change bits. When all port status change bits are clear, and a new change bit is set, the xHC will generate a Port Status Change Event. If another change bit is set in the same port status register before the first bit is cleared, it will not send another event.
This means that the hub code may lose port status changes because of race conditions between clearing change bits. The user sees this as a "dead port" that doesn't react to device connects.
The fix is to turn on port polling whenever a new change bit is set. Once the USB core issues a hub status request that shows that no change bits are set in any USB ports, turn off port polling.
We can't allow the USB core to poll the roothub for port events during host suspend because if the PCI host is in D3cold, the port registers will be all f's. Instead, stop the port polling timer, and unconditionally restart it when the host resumes. If there are no port change bits set after the resume, the first call to hub_status_data will disable polling.
This patch should be backported to stable kernels with the first xHCI support, 2.6.31 and newer, that include the commit 0f2a79300a1471cf92ab43af165ea13555c8b0a5 "USB: xhci: Root hub support." There will be merge conflicts because the check for HC_STATE_SUSPENDED was moved into xhci_suspend in 3.8.
--- drivers/usb/host/xhci-hub.c | 7 +++++++ drivers/usb/host/xhci-ring.c | 9 +++++++++ drivers/usb/host/xhci.c | 10 ++++++++++ 3 files changed, 26 insertions(+)
drivers/usb/host/xhci-hub.c +7 -0
@@ -940,6 +940,7 @@ int xhci_hub_status_data(struct usb_hcdint max_ports;__le32 __iomem **port_array;struct xhci_bus_state *bus_state; +bool reset_change = false; max_ports =xhci_get_ports (hcd, &port_array); bus_state = &xhci->bus_state[hcd_index (hcd)];
@@ -971,6 +972,12 @@ int xhci_hub_status_data(struct usb_hcd buf[(i +1 ) /8 ] |=1 << (i +1 ) %8 ; status =1 ; } +if ((temp &PORT_RC )) + reset_change = true; + } +if (!status && !reset_change) { +xhci_dbg (xhci,"%s: stopping port polling.\n" , __func__); +clear_bit (HCD_FLAG_POLL_RH , &hcd->flags); }spin_unlock_irqrestore (&xhci->lock, flags);return status ? retval :0 ;
drivers/usb/host/xhci-ring.c +9 -0
@@ -1725,6 +1725,15 @@ cleanup:if (bogus_port_status)return ; +/* +* xHCI port-status-change events occur when the "or" of all the +* status-change bits in the portsc register changes from 0 to 1. +* New status changes won't cause an event if any other change +* bits are still set. When an event occurs, switch over to +* polling to avoid losing status changes. +*/ +xhci_dbg (xhci,"%s: starting port polling.\n" , __func__); +set_bit (HCD_FLAG_POLL_RH , &hcd->flags);spin_unlock (&xhci->lock);/* Pass this up to the core */ usb_hcd_poll_rh_status (hcd);
drivers/usb/host/xhci.c +10 -0
@@ -880,6 +880,11 @@ int xhci_suspend(struct xhci_hcd *xhci)struct usb_hcd *hcd =xhci_to_hcd (xhci);u32 command; +/* Don't poll the roothubs on bus suspend. */ +xhci_dbg (xhci,"%s: stopping port polling.\n" , __func__); +clear_bit (HCD_FLAG_POLL_RH , &hcd->flags); +del_timer_sync (&hcd->rh_timer); +spin_lock_irq (&xhci->lock);clear_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags);clear_bit (HCD_FLAG_HW_ACCESSIBLE , &xhci->shared_hcd->flags);
@@ -1064,6 +1069,11 @@ int xhci_resume(struct xhci_hcd *xhci, bif (xhci->quirks &XHCI_COMP_MODE_QUIRK )compliance_mode_recovery_timer_init (xhci); +/* Re-enable port polling. */ +xhci_dbg (xhci,"%s: starting port polling.\n" , __func__); +set_bit (HCD_FLAG_POLL_RH , &hcd->flags); +usb_hcd_poll_rh_status (hcd); + return retval; }#endif /* CONFIG_PM */
Greg Kroah-Hartman
maintainerPATCH 107/171 USB: hub: handle claim of enabled remote wakeup after reset
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 07e72b95f5038cc82304b9a4a2eb7f9fc391ea68 upstream.
Some touchscreens have buggy firmware which claims remote wakeup to be enabled after a reset. They nevertheless crash if the feature is cleared by the host.
Add a check for reset resume before checking for an enabled remote wakeup feature. On compliant devices the feature must be cleared after a reset anyway.
--- drivers/usb/core/hub.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +8 -2
@@ -2609,7 +2609,7 @@ int usb_port_suspend(struct usb_device *static int finish_port_resume (struct usb_device *udev) {int status =0 ; -u16 devstatus; +u16 devstatus =0 ;/* caller owns the udev device lock */ dev_dbg(&udev->dev, "%s\n",
@@ -2654,7 +2654,13 @@ static int finish_port_resume(struct usbif (status) {dev_dbg (&udev->dev,"gone after usb resume? status %d\n" , status); - }else if (udev->actconfig) { +/* +* There are a few quirky devices which violate the standard +* by claiming to have remote wakeup enabled after a reset, +* which crash if the feature is cleared, hence check for +* udev->reset_resume +*/ + }else if (udev->actconfig && !udev->reset_resume) {le16_to_cpus (&devstatus);if (devstatus & (1 <<USB_DEVICE_REMOTE_WAKEUP )) { status = usb_control_msg(udev,
Greg Kroah-Hartman
maintainerPATCH 108/171 xhci: Handle HS bulk/ctrl endpoints that dont NAK.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 55c1945edaac94c5338a3647bc2e85ff75d9cf36 upstream.
A high speed control or bulk endpoint may have bInterval set to zero, which means it does not NAK. If bInterval is non-zero, it means the endpoint NAKs at a rate of 2^(bInterval - 1).
The xHCI code to compute the NAK interval does not handle the special case of zero properly. The current code unconditionally subtracts one from bInterval and uses it as an exponent. This causes a very large bInterval to be used, and warning messages like these will be printed:
usb 1-1: ep 0x1 - rounding interval to 32768 microframes, ep desc says 0 microframes
This may cause the xHCI host hardware to reject the Configure Endpoint command, which means the HS device will be unusable under xHCI ports.
This patch should be backported to kernels as old as 2.6.31, that contain commit dfa49c4ad120a784ef1ff0717168aa79f55a483a "USB: xhci - fix math in xhci_get_endpoint_interval()".
--- drivers/usb/host/xhci-mem.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-mem.c +2 -0
@@ -1250,6 +1250,8 @@ static unsigned int xhci_microframes_to_static unsigned int xhci_parse_microframe_interval (struct usb_device *udev,struct usb_host_endpoint *ep) { +if (ep->desc.bInterval ==0 ) +return 0 ;return xhci_microframes_to_exponent (udev, ep, ep->desc.bInterval,0 ,15 ); }
Greg Kroah-Hartman
maintainerPATCH 109/171 GFS2: Test bufdata with buffer locked and gfs2_log_lock held
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
commit 96e5d1d3adf56f1c7eeb07258f6a1a0a7ae9c489 upstream.
In gfs2_trans_add_bh(), gfs2 was testing if a there was a bd attached to the buffer without having the gfs2_log_lock held. It was then assuming it would stay attached for the rest of the function. However, without either the log lock being held of the buffer locked, __gfs2_ail_flush() could detach bd at any time. This patch moves the locking before the test. If there isn't a bd already attached, gfs2 can safely allocate one and attach it before locking. There is no way that the newly allocated bd could be on the ail list, and thus no way for __gfs2_ail_flush() to detach it.
--- fs/gfs2/lops.c | 18 ++++-------------- fs/gfs2/trans.c | 8 ++++++++ 2 files changed, 12 insertions(+), 14 deletions(-)
fs/gfs2/lops.c +4 -14
@@ -258,16 +258,14 @@ static void buf_lo_add(struct gfs2_sbd *struct gfs2_meta_header *mh;struct gfs2_trans *tr; -lock_buffer (bd->bd_bh); -gfs2_log_lock (sdp);if (!list_empty (&bd->bd_list_tr)) - goto out; +return ; tr = current->journal_info; tr->tr_touched =1 ; tr->tr_num_buf++;list_add (&bd->bd_list_tr, &tr->tr_list_buf);if (!list_empty (&le->le_list)) - goto out; +return ;set_bit (GLF_LFLUSH , &bd->bd_gl->gl_flags);set_bit (GLF_DIRTY , &bd->bd_gl->gl_flags);gfs2_meta_check (sdp, bd->bd_bh);
@@ -278,9 +276,6 @@ static void buf_lo_add(struct gfs2_sbd * sdp->sd_log_num_buf++;list_add (&le->le_list, &sdp->sd_log_le_buf); tr->tr_num_buf_new++; -out: -gfs2_log_unlock (sdp); -unlock_buffer (bd->bd_bh); }static void buf_lo_before_commit (struct gfs2_sbd *sdp)
@@ -611,11 +606,9 @@ static void databuf_lo_add(struct gfs2_sstruct address_space *mapping = bd->bd_bh->b_page->mapping;struct gfs2_inode *ip =GFS2_I (mapping->host); -lock_buffer (bd->bd_bh); -gfs2_log_lock (sdp);if (tr) {if (!list_empty (&bd->bd_list_tr)) - goto out; +return ; tr->tr_touched =1 ;if (gfs2_is_jdata (ip)) { tr->tr_num_buf++;
@@ -623,7 +616,7 @@ static void databuf_lo_add(struct gfs2_s } }if (!list_empty (&le->le_list)) - goto out; +return ;set_bit (GLF_LFLUSH , &bd->bd_gl->gl_flags);set_bit (GLF_DIRTY , &bd->bd_gl->gl_flags);
@@ -635,9 +628,6 @@ static void databuf_lo_add(struct gfs2_s }else {list_add_tail (&le->le_list, &sdp->sd_log_le_ordered); } -out: -gfs2_log_unlock (sdp); -unlock_buffer (bd->bd_bh); }static void gfs2_check_magic (struct buffer_head *bh)
fs/gfs2/trans.c +8 -0
@@ -145,14 +145,22 @@ void gfs2_trans_add_bh(struct gfs2_glockstruct gfs2_sbd *sdp = gl->gl_sbd;struct gfs2_bufdata *bd; +lock_buffer (bh); +gfs2_log_lock (sdp); bd = bh->b_private;if (bd)gfs2_assert (sdp, bd->bd_gl == gl);else { +gfs2_log_unlock (sdp); +unlock_buffer (bh);gfs2_attach_bufdata (gl, bh, meta); bd = bh->b_private; +lock_buffer (bh); +gfs2_log_lock (sdp); }lops_add (sdp, &bd->bd_le); +gfs2_log_unlock (sdp); +unlock_buffer (bh); }void gfs2_trans_add_revoke (struct gfs2_sbd *sdp,struct gfs2_bufdata *bd)
Greg Kroah-Hartman
maintainerPATCH 110/171 drm/i915: disable cpt phase pointer fdi rx workaround
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 539526b4137bc0e7a8806c38c8522f226814a0e6 upstream.
We've originally added this in
commit 291427f5fdadec6e4be2924172e83588880e1539
Author: Jesse Barnes <[email protected]> Date: Fri Jul 29 12:42:37 2011 -0700
drm/i915: apply phase pointer override on SNB+ too
and then copy-pasted it over to ivb/ppt. The w/a was originally added for ilk/ibx in
commit 5b2adf897146edeac6a1e438fb67b5a53dbbdf34
Author: Jesse Barnes <[email protected]> Date: Thu Oct 7 16:01:15 2010 -0700
drm/i915: add Ironlake clock gating workaround for FDI link training
and fixed up a bit in
commit 6f06ce184c765fd8d50669a8d12fdd566c920859
Author: Jesse Barnes <[email protected]> Date: Tue Jan 4 15:09:38 2011 -0800
drm/i915: set phase sync pointer override enable before setting phase sync pointer
It turns out that this w/a isn't actually required on cpt/ppt and positively harmful on ivb/ppt when using fdi B/C links - it results in a black screen occasionally, with seemingfully everything working as it should. The only failure indication I've found in the hw is that eventually (but not right after the modeset completes) a pipe underrun is signalled.
Big thanks to Arthur Runyan for all the ideas for registers to check and changes to test, otherwise I couldn't ever have tracked this down!
--- drivers/gpu/drm/i915/intel_display.c | 31 ------------------------------- 1 file changed, 31 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -31
@@ -2424,18 +2424,6 @@ static void intel_fdi_normal_train(struc FDI_FE_ERRC_ENABLE); } -static void cpt_phase_pointer_enable (struct drm_device *dev,int pipe) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -u32 flags =I915_READ (SOUTH_CHICKEN1 ); - - flags |=FDI_PHASE_SYNC_OVR (pipe); -I915_WRITE (SOUTH_CHICKEN1 , flags);/* once to unlock... */ - flags |=FDI_PHASE_SYNC_EN (pipe); -I915_WRITE (SOUTH_CHICKEN1 , flags);/* then again to enable */ -POSTING_READ (SOUTH_CHICKEN1 ); -} -/* The FDI link training functions for ILK/Ibexpeak. */ static void ironlake_fdi_link_train (struct drm_crtc *crtc) {
@@ -2586,9 +2574,6 @@ static void gen6_fdi_link_train(struct dPOSTING_READ (reg);udelay (150 ); -if (HAS_PCH_CPT (dev)) -cpt_phase_pointer_enable (dev, pipe); -for (i =0 ; i <4 ; i++) { reg =FDI_TX_CTL (pipe); temp =I915_READ (reg);
@@ -2707,9 +2692,6 @@ static void ivb_manual_fdi_link_train(stPOSTING_READ (reg);udelay (150 ); -if (HAS_PCH_CPT (dev)) -cpt_phase_pointer_enable (dev, pipe); -for (i =0 ; i <4 ; i++) { reg =FDI_TX_CTL (pipe); temp =I915_READ (reg);
@@ -2819,17 +2801,6 @@ static void ironlake_fdi_pll_enable(stru } } -static void cpt_phase_pointer_disable (struct drm_device *dev,int pipe) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -u32 flags =I915_READ (SOUTH_CHICKEN1 ); - - flags &= ~(FDI_PHASE_SYNC_EN (pipe)); -I915_WRITE (SOUTH_CHICKEN1 , flags);/* once to disable... */ - flags &= ~(FDI_PHASE_SYNC_OVR (pipe)); -I915_WRITE (SOUTH_CHICKEN1 , flags);/* then again to lock */ -POSTING_READ (SOUTH_CHICKEN1 ); -}static void ironlake_fdi_disable (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;
@@ -2859,8 +2830,6 @@ static void ironlake_fdi_disable(structI915_WRITE (FDI_RX_CHICKEN (pipe),I915_READ (FDI_RX_CHICKEN (pipe) & ~FDI_RX_PHASE_SYNC_POINTER_EN )); - }else if (HAS_PCH_CPT (dev)) { -cpt_phase_pointer_disable (dev, pipe); }/* still set train pattern 1 */
Greg Kroah-Hartman
maintainerPATCH 111/171 KVM: PPC: 44x: fix DCR read/write
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Graf <[email protected]>
commit e43a028752fed049e4bd94ef895542f96d79fa74 upstream.
When remembering the direction of a DCR transaction, we should write to the same variable that we interpret on later when doing vcpu_run again.
--- arch/powerpc/kvm/44x_emulate.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kvm/44x_emulate.c +2 -0
@@ -79,6 +79,7 @@ int kvmppc_core_emulate_op(struct kvm_ru run->dcr.dcrn = dcrn; run->dcr.data =0 ; run->dcr.is_write =0 ; + vcpu->arch.dcr_is_write =0 ; vcpu->arch.io_gpr = rt; vcpu->arch.dcr_needed =1 ;kvmppc_account_exit (vcpu,DCR_EXITS );
@@ -100,6 +101,7 @@ int kvmppc_core_emulate_op(struct kvm_ru run->dcr.dcrn = dcrn; run->dcr.data =kvmppc_get_gpr (vcpu, rs); run->dcr.is_write =1 ; + vcpu->arch.dcr_is_write =1 ; vcpu->arch.dcr_needed =1 ;kvmppc_account_exit (vcpu,DCR_EXITS ); emulated =EMULATE_DO_DCR ;
Greg Kroah-Hartman
maintainerPATCH 112/171 drm/edid/quirks: ViewSonic VA2026w
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Jackson <[email protected]>
commit bc42aabc6a01b92b0f961d65671564e0e1cd7592 upstream.
Entirely new class of fail for this one. The detailed timings are for normal CVT but the monitor really wanted CVT-R.
Bugzilla: http://bugzilla.redhat/com/516471
--- drivers/gpu/drm/drm_edid.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +18 -4
@@ -66,6 +66,8 @@#define EDID_QUIRK_FIRST_DETAILED_PREFERRED (1 << 5)/* use +hsync +vsync for detailed mode */ #define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6) +/* Force reduced-blanking timings for detailed modes */ +#define EDID_QUIRK_FORCE_REDUCED_BLANKING (1 << 7)struct detailed_mode_closure {struct drm_connector *connector;
@@ -120,6 +122,9 @@ static struct edid_quirk {/* Samsung SyncMaster 22[5-6]BW */ { "SAM", 596, EDID_QUIRK_PREFER_LARGE_60 }, { "SAM", 638, EDID_QUIRK_PREFER_LARGE_60 }, + +/* ViewSonic VA2026w */ + { "VSC", 5020, EDID_QUIRK_FORCE_REDUCED_BLANKING }, };/*** DDC fetch and block validation ***/
@@ -852,12 +857,19 @@ static struct drm_display_mode *drm_mode "Wrong Hsync/Vsync pulse width\n");return NULL ; } + +if (quirks &EDID_QUIRK_FORCE_REDUCED_BLANKING ) { + mode =drm_cvt_mode (dev, hactive, vactive,60 , true, false, false); +if (!mode) +return NULL ; + + goto set_size; + } + mode =drm_mode_create (dev);if (!mode)return NULL ; - mode->type =DRM_MODE_TYPE_DRIVER ; -if (quirks &EDID_QUIRK_135_CLOCK_TOO_HIGH ) timing->pixel_clock =cpu_to_le16 (1088 );
@@ -881,8 +893,6 @@ static struct drm_display_mode *drm_modedrm_mode_do_interlace_quirk (mode, pt); -drm_mode_set_name (mode); -if (quirks &EDID_QUIRK_DETAILED_SYNC_PP ) { pt->misc |=DRM_EDID_PT_HSYNC_POSITIVE |DRM_EDID_PT_VSYNC_POSITIVE ; }
@@ -892,6 +902,7 @@ static struct drm_display_mode *drm_mode mode->flags |= (pt->misc &DRM_EDID_PT_VSYNC_POSITIVE ) ?DRM_MODE_FLAG_PVSYNC :DRM_MODE_FLAG_NVSYNC ; +set_size: mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi &0xf0 ) <<4 ; mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi &0xf ) <<8 ;
@@ -905,6 +916,9 @@ static struct drm_display_mode *drm_mode mode->height_mm = edid->height_cm *10 ; } + mode->type =DRM_MODE_TYPE_DRIVER ; +drm_mode_set_name (mode); +return mode; }
Greg Kroah-Hartman
maintainerPATCH 113/171 drm/i915: Unpin the flip target if we fail to queue the flip
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 83d4092b0381e5dd6f312b2ec57121dcf0fcbade upstream.
--- drivers/gpu/drm/i915/intel_display.c | 50 ++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +35 -15
@@ -7313,14 +7313,14 @@ static int intel_gen2_queue_flip(struct ret =intel_pin_and_fence_fb_obj (dev, obj,LP_RING (dev_priv));if (ret) - goto out; + goto err;/* Offset into the new buffer for cases of shared fbs between CRTCs */ offset = crtc->y * fb->pitches[0 ] + crtc->x * fb->bits_per_pixel/8 ; ret =BEGIN_LP_RING (6 );if (ret) - goto out; + goto err_unpin;/* Can't queue multiple flips, so wait for the previous * one to finish before executing the next.
@@ -7337,7 +7337,11 @@ static int intel_gen2_queue_flip(structOUT_RING (obj->gtt_offset + offset);OUT_RING (0 );/* aux display base address, unused */ ADVANCE_LP_RING (); -out: +return 0 ; + +err_unpin: +intel_unpin_fb_obj (obj); +err:return ret; }
@@ -7354,14 +7358,14 @@ static int intel_gen3_queue_flip(struct ret =intel_pin_and_fence_fb_obj (dev, obj,LP_RING (dev_priv));if (ret) - goto out; + goto err;/* Offset into the new buffer for cases of shared fbs between CRTCs */ offset = crtc->y * fb->pitches[0 ] + crtc->x * fb->bits_per_pixel/8 ; ret =BEGIN_LP_RING (6 );if (ret) - goto out; + goto err_unpin;if (intel_crtc->plane) flip_mask =MI_WAIT_FOR_PLANE_B_FLIP ;
@@ -7376,7 +7380,11 @@ static int intel_gen3_queue_flip(structOUT_RING (MI_NOOP );ADVANCE_LP_RING (); -out: +return 0 ; + +err_unpin: +intel_unpin_fb_obj (obj); +err:return ret; }
@@ -7392,11 +7400,11 @@ static int intel_gen4_queue_flip(struct ret =intel_pin_and_fence_fb_obj (dev, obj,LP_RING (dev_priv));if (ret) - goto out; + goto err; ret =BEGIN_LP_RING (4 );if (ret) - goto out; + goto err_unpin;/* i965+ uses the linear or tiled offsets from the * Display Registers (which do not change across a page-flip)
@@ -7415,7 +7423,11 @@ static int intel_gen4_queue_flip(struct pipesrc =I915_READ (PIPESRC (intel_crtc->pipe)) &0x0fff0fff ;OUT_RING (pf | pipesrc);ADVANCE_LP_RING (); -out: +return 0 ; + +err_unpin: +intel_unpin_fb_obj (obj); +err:return ret; }
@@ -7431,11 +7443,11 @@ static int intel_gen6_queue_flip(struct ret =intel_pin_and_fence_fb_obj (dev, obj,LP_RING (dev_priv));if (ret) - goto out; + goto err; ret =BEGIN_LP_RING (4 );if (ret) - goto out; + goto err_unpin;OUT_RING (MI_DISPLAY_FLIP |MI_DISPLAY_FLIP_PLANE (intel_crtc->plane));
@@ -7452,7 +7464,11 @@ static int intel_gen6_queue_flip(struct pipesrc =I915_READ (PIPESRC (intel_crtc->pipe)) &0x0fff0fff ;OUT_RING (pf | pipesrc);ADVANCE_LP_RING (); -out: +return 0 ; + +err_unpin: +intel_unpin_fb_obj (obj); +err:return ret; }
@@ -7474,18 +7490,22 @@ static int intel_gen7_queue_flip(struct ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret) - goto out; + goto err; ret =intel_ring_begin (ring,4 );if (ret) - goto out; + goto err_unpin;intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | (intel_crtc->plane <<19 ));intel_ring_emit (ring, (fb->pitches[0 ] | obj->tiling_mode));intel_ring_emit (ring, (obj->gtt_offset));intel_ring_emit (ring, (MI_NOOP ));intel_ring_advance (ring); -out: +return 0 ; + +err_unpin: +intel_unpin_fb_obj (obj); +err:return ret; }
Greg Kroah-Hartman
maintainerPATCH 114/171 drm/i915: fix up ivb plane 3 pageflips
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit cb05d8dedefa3066bf5d74ef88c6ca6cf4bd1c87 upstream.
Or at least plug another gapping hole. Apparrently hw desingers only moved the bit field, but did not bother ot re-enumerate the planes when adding support for a 3rd pipe.
Discovered by i-g-t/flip_test.
This may or may not fix the reference bugzilla, because that one smells like we have still larger fish to fry.
v2: Fixup the impossible case to catch programming errors, noticed by Chris Wilson.
References: https://bugs.freedesktop.org/show_bug.cgi?id=50069
Eugeni Dodonov <[email protected]>
--- drivers/gpu/drm/i915/i915_reg.h | 8 ++++++++ drivers/gpu/drm/i915/intel_display.c | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +8 -0
@@ -197,6 +197,14 @@#define MI_DISPLAY_FLIP MI_INSTR(0x14, 2)#define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1)#define MI_DISPLAY_FLIP_PLANE (n) ((n) << 20) +/* IVB has funny definitions for which plane to flip. */ +#define MI_DISPLAY_FLIP_IVB_PLANE_A (0 << 19) +#define MI_DISPLAY_FLIP_IVB_PLANE_B (1 << 19) +#define MI_DISPLAY_FLIP_IVB_SPRITE_A (2 << 19) +#define MI_DISPLAY_FLIP_IVB_SPRITE_B (3 << 19) +#define MI_DISPLAY_FLIP_IVB_PLANE_C (4 << 19) +#define MI_DISPLAY_FLIP_IVB_SPRITE_C (5 << 19) +#define MI_SET_CONTEXT MI_INSTR(0x18, 0)#define MI_MM_SPACE_GTT (1<<8)#define MI_MM_SPACE_PHYSICAL (0<<8)
drivers/gpu/drm/i915/intel_display.c +18 -1
@@ -7486,17 +7486,34 @@ static int intel_gen7_queue_flip(structstruct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_ring_buffer *ring = &dev_priv->ring[BCS ]; +uint32_t plane_bit =0 ;int ret; ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret) goto err; +switch (intel_crtc->plane) { +case PLANE_A : + plane_bit =MI_DISPLAY_FLIP_IVB_PLANE_A ; +break ; +case PLANE_B : + plane_bit =MI_DISPLAY_FLIP_IVB_PLANE_B ; +break ; +case PLANE_C : + plane_bit =MI_DISPLAY_FLIP_IVB_PLANE_C ; +break ; +default : +WARN_ONCE (1 ,"unknown plane in flip command\n" ); + ret = -ENODEV ; + goto err; + } + ret =intel_ring_begin (ring,4 );if (ret) goto err_unpin; -intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | (intel_crtc->plane <<19 )); +intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | plane_bit);intel_ring_emit (ring, (fb->pitches[0 ] | obj->tiling_mode));intel_ring_emit (ring, (obj->gtt_offset));intel_ring_emit (ring, (MI_NOOP ));
Greg Kroah-Hartman
maintainerPATCH 115/171 drm/i915: move NEEDS_FORCE_WAKE to i915_drv.c
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Barnes <[email protected]>
commit b7d84096d3c45f4e397e913da4ce24ec9a32022e upstream.
It's only used by the main read/write functions, so we can keep it with them.
--- drivers/gpu/drm/i915/i915_drv.c | 6 ++++++ drivers/gpu/drm/i915/i915_drv.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +6 -0
@@ -993,6 +993,12 @@ MODULE_AUTHOR(DRIVER_AUTHOR);MODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL and additional rights" ); +/* We give fast paths for the really cool registers */ +#define NEEDS_FORCE_WAKE (dev_priv, reg) \ + (((dev_priv)->info->gen >= 6) && \ + ((reg) < 0x40000) && \ + ((reg) != FORCEWAKE)) +#define __i915_read (x, y) \ u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ u##x val = 0; \
drivers/gpu/drm/i915/i915_drv.h +0 -6
@@ -1450,12 +1450,6 @@ void gen6_gt_force_wake_get(struct drm_ivoid gen6_gt_force_wake_put (struct drm_i915_private *dev_priv);int __gen6_gt_wait_for_fifo (struct drm_i915_private *dev_priv); -/* We give fast paths for the really cool registers */ -#define NEEDS_FORCE_WAKE (dev_priv, reg) \ - (((dev_priv)->info->gen >= 6) && \ - ((reg) < 0x40000) && \ - ((reg) != FORCEWAKE)) -#define __i915_read (x, y) \ u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg);
Greg Kroah-Hartman
maintainerPATCH 116/171 drm/i915: hold forcewake around ring hw init
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit b7884eb45ec98c0d34c7f49005ae9d4b4b4e38f6 upstream.
Empirical evidence suggests that we need to: On at least one ivb machine when running the hangman i-g-t test, the rings don't properly initialize properly - the RING_START registers seems to be stuck at all zeros.
Holding forcewake around this register init sequences makes chip reset reliable again. Note that this is not the first such issue:
commit f01db988ef6f6c70a6cc36ee71e4a98a68901229
Author: Sean Paul <[email protected]> Date: Fri Mar 16 12:43:22 2012 -0400
drm/i915: Add wait_for in init_ring_common
added delay loops to make RING_START and RING_CTL initialization reliable on the blt ring at boot-up. So I guess it won't hurt if we do this unconditionally for all force_wake needing gpus.
To avoid copy&pasting of the HAS_FORCE_WAKE check I've added a new intel_info bit for that.
v2: Fixup missing commas in static struct and properly handling the error case in init_ring_common, both noticed by Jani Nikula.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50522
[bwh: Backported to 3.2:
- drop changes to Haswell device information
- NEEDS_FORCE_WAKE didn't refer to Valley View anyway]
--- drivers/gpu/drm/i915/i915_drv.c | 6 +++++- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_ringbuffer.c | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -1
@@ -224,6 +224,7 @@ static const struct intel_device_info in .has_bsd_ring = 1, .has_blt_ring = 1, .has_llc = 1, + .has_force_wake = 1, };static const struct intel_device_info intel_sandybridge_m_info = {
@@ -233,6 +234,7 @@ static const struct intel_device_info in .has_bsd_ring = 1, .has_blt_ring = 1, .has_llc = 1, + .has_force_wake = 1, };static const struct intel_device_info intel_ivybridge_d_info = {
@@ -241,6 +243,7 @@ static const struct intel_device_info in .has_bsd_ring = 1, .has_blt_ring = 1, .has_llc = 1, + .has_force_wake = 1, };static const struct intel_device_info intel_ivybridge_m_info = {
@@ -250,6 +253,7 @@ static const struct intel_device_info in .has_bsd_ring = 1, .has_blt_ring = 1, .has_llc = 1, + .has_force_wake = 1, };static const struct pci_device_id pciidlist[] = {/* aka */
@@ -995,7 +999,7 @@ MODULE_LICENSE("GPL and additional right/* We give fast paths for the really cool registers */ #define NEEDS_FORCE_WAKE (dev_priv, reg) \ - (((dev_priv)->info->gen >= 6) && \ + ((HAS_FORCE_WAKE((dev_priv)->dev)) && \ ((reg) < 0x40000) && \ ((reg) != FORCEWAKE))
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -255,6 +255,7 @@ struct intel_device_info { u8 is_broadwater:1; u8 is_crestline:1; u8 is_ivybridge:1; + u8 has_force_wake:1; u8 has_fbc:1; u8 has_pipe_cxsr:1; u8 has_hotplug:1;
@@ -1051,6 +1052,8 @@ struct drm_i915_file_private {#define HAS_PCH_CPT (dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)#define HAS_PCH_IBX (dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) +#define HAS_FORCE_WAKE (dev) (INTEL_INFO(dev)->has_force_wake) +#include "i915_trace.h" /**
drivers/gpu/drm/i915/intel_ringbuffer.c +13 -3
@@ -249,10 +249,15 @@ u32 intel_ring_get_active_head(struct instatic int init_ring_common (struct intel_ring_buffer *ring) { -drm_i915_private_t *dev_priv = ring->dev->dev_private; +struct drm_device *dev = ring->dev; +drm_i915_private_t *dev_priv = dev->dev_private;struct drm_i915_gem_object *obj = ring->obj; +int ret =0 ;u32 head; +if (HAS_FORCE_WAKE (dev)) +gen6_gt_force_wake_get (dev_priv); +/* Stop the ring if it's running. */ I915_WRITE_CTL (ring,0 );I915_WRITE_HEAD (ring,0 );
@@ -300,7 +305,8 @@ static int init_ring_common(struct intelI915_READ_HEAD (ring),I915_READ_TAIL (ring), I915_READ_START(ring)); -return -EIO ; + ret = -EIO ; + goto out; }if (!drm_core_check_feature (ring->dev,DRIVER_MODESET ))
@@ -312,7 +318,11 @@ static int init_ring_common(struct intel ring->last_retired_head =-1 ; } -return 0 ; +out: +if (HAS_FORCE_WAKE (dev)) +gen6_gt_force_wake_put (dev_priv); + +return ret; } static int
Greg Kroah-Hartman
maintainerPATCH 117/171 drm/i915: Check VBIOS value for determining LVDS dual channel mode, too
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit b03543857fd75876b96e10d4320b775e95041bb7 upstream.
Currently i915 driver checks [PCH_]LVDS register bits to decide whether to set up the dual-link or the single-link mode. This relies implicitly on that BIOS initializes the register properly at boot. However, BIOS doesn't initialize it always. When the machine is booted with the closed lid, BIOS skips the LVDS reg initialization. This ends up in blank output on a machine with a dual-link LVDS when you open the lid after the boot.
This patch adds a workaround for that problem by checking the initial LVDS register value in VBT.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37742
--- drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/intel_bios.c | 36 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 30 +++++++++++++++++++++++------ 3 files changed, 62 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -406,6 +406,8 @@ typedef struct drm_i915_private { unsigned int lvds_use_ssc:1; unsigned int display_clock_mode:1;int lvds_ssc_freq; +unsigned int bios_lvds_val;/* initial [PCH_]LVDS reg val in VBIOS */ +unsigned int lvds_val;/* used for checking LVDS channel mode */ struct {int rate;int lanes;
drivers/gpu/drm/i915/intel_bios.c +36 -0
@@ -174,6 +174,28 @@ get_lvds_dvo_timing(const struct bdb_lvdreturn (struct lvds_dvo_timing *)(entry + dvo_timing_offset); } +/* get lvds_fp_timing entry +* this function may return NULL if the corresponding entry is invalid +*/ +static const struct lvds_fp_timing * +get_lvds_fp_timing (const struct bdb_header *bdb, +const struct bdb_lvds_lfp_data *data, +const struct bdb_lvds_lfp_data_ptrs *ptrs, +int index) +{ +size_t data_ofs = (const u8 *)data - (const u8 *)bdb; +u16 data_size = ((const u16 *)data)[-1 ];/* stored in header */ +size_t ofs; + +if (index >=ARRAY_SIZE (ptrs->ptr)) +return NULL ; + ofs = ptrs->ptr[index].fp_timing_offset; +if (ofs < data_ofs || + ofs +sizeof (struct lvds_fp_timing ) > data_ofs + data_size) +return NULL ; +return (const struct lvds_fp_timing *)((const u8 *)bdb + ofs); +} +/* Try to find integrated panel data */ static void parse_lfp_panel_data(struct drm_i915_private *dev_priv,
@@ -183,6 +205,7 @@ parse_lfp_panel_data(struct drm_i915_priconst struct bdb_lvds_lfp_data *lvds_lfp_data;const struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs;const struct lvds_dvo_timing *panel_dvo_timing; +const struct lvds_fp_timing *fp_timing;struct drm_display_mode *panel_fixed_mode;int i, downclock;
@@ -244,6 +267,19 @@ parse_lfp_panel_data(struct drm_i915_pri"Normal Clock %dKHz, downclock %dKHz\n" , panel_fixed_mode->clock, 10*downclock); } + + fp_timing =get_lvds_fp_timing (bdb, lvds_lfp_data, + lvds_lfp_data_ptrs, + lvds_options->panel_type); +if (fp_timing) { +/* check the resolution, just to be sure */ +if (fp_timing->x_res == panel_fixed_mode->hdisplay && + fp_timing->y_res == panel_fixed_mode->vdisplay) { + dev_priv->bios_lvds_val = fp_timing->lvds_reg_val; +DRM_DEBUG_KMS ("VBT initial LVDS value %x\n" , + dev_priv->bios_lvds_val); + } + } }/* Try to find sdvo panel data */
drivers/gpu/drm/i915/intel_display.c +24 -6
@@ -360,6 +360,27 @@ static const intel_limit_t intel_limits_ .find_pll = intel_find_pll_ironlake_dp, }; +static bool is_dual_link_lvds (struct drm_i915_private *dev_priv, +unsigned int reg) +{ +unsigned int val; + +if (dev_priv->lvds_val) + val = dev_priv->lvds_val; +else { +/* BIOS should set the proper LVDS register value at boot, but +* in reality, it doesn't set the value when the lid is closed; +* we need to check "the value to be set" in VBT when LVDS +* register is uninitialized. +*/ + val =I915_READ (reg); +if (!(val & ~LVDS_DETECTED )) + val = dev_priv->bios_lvds_val; + dev_priv->lvds_val = val; + } +return (val &LVDS_CLKB_POWER_MASK ) ==LVDS_CLKB_POWER_UP ; +} +static const intel_limit_t *intel_ironlake_limit (struct drm_crtc *crtc,int refclk) {
@@ -368,8 +389,7 @@ static const intel_limit_t *intel_ironlaconst intel_limit_t *limit;if (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS )) { -if ((I915_READ (PCH_LVDS ) &LVDS_CLKB_POWER_MASK ) == -LVDS_CLKB_POWER_UP ) { +if (is_dual_link_lvds (dev_priv,PCH_LVDS )) {/* LVDS dual channel */ if (refclk ==100000 ) limit = &intel_limits_ironlake_dual_lvds_100m;
@@ -397,8 +417,7 @@ static const intel_limit_t *intel_g4x_liconst intel_limit_t *limit;if (intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS )) { -if ((I915_READ (LVDS ) &LVDS_CLKB_POWER_MASK ) == -LVDS_CLKB_POWER_UP ) +if (is_dual_link_lvds (dev_priv,LVDS ))/* LVDS with dual channel */ limit = &intel_limits_g4x_dual_channel_lvds;else
@@ -536,8 +555,7 @@ intel_find_best_PLL(const intel_limit_t* reliably set up different single/dual channel state, if we * even can. */ -if ((I915_READ (LVDS ) &LVDS_CLKB_POWER_MASK ) == -LVDS_CLKB_POWER_UP ) +if (is_dual_link_lvds (dev_priv,LVDS )) clock.p2 = limit->p2.p2_fast;else clock.p2 = limit->p2.p2_slow;
Greg Kroah-Hartman
maintainerPATCH 118/171 drm/i915: Add wait_for in init_ring_common
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Paul <[email protected]>
commit f01db988ef6f6c70a6cc36ee71e4a98a68901229 upstream.
I have seen a number of "blt ring initialization failed" messages where the ctl or start registers are not the correct value. Upon further inspection, if the code just waited a little bit, it would read the correct value. Adding the wait_for to these reads should eliminate the issue.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +3 -3
@@ -295,9 +295,9 @@ static int init_ring_common(struct intel | RING_VALID);/* If the head is still not zero, the ring is dead */ -if ((I915_READ_CTL (ring) &RING_VALID ) ==0 || -I915_READ_START (ring) != obj->gtt_offset || - (I915_READ_HEAD (ring) &HEAD_ADDR ) !=0 ) { +if (wait_for ((I915_READ_CTL (ring) &RING_VALID ) !=0 && +I915_READ_START (ring) == obj->gtt_offset && + (I915_READ_HEAD (ring) &HEAD_ADDR ) ==0 ,50 )) { DRM_ERROR("%s initialization failed " "ctl %08x head %08x tail %08x start %08x\n", ring->name,
Greg Kroah-Hartman
maintainerPATCH 119/171 drm/i915: Wait for all pending operations to the fb before disabling the pipe
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 0f91128d88bbb8b0a8e7bb93df2c40680871d45a upstream.
During modeset we have to disable the pipe to reconfigure its timings and maybe its size. Userspace may have queued up command buffers that depend upon the pipe running in a certain configuration and so the commands may become confused across the modeset. At the moment, we use a less than satisfactory kick-scanline-waits should the GPU hang during the modeset. It should be more reliable to wait for the pending operations to complete first, even though we still have a window for userspace to submit a broken command buffer during the modeset.
--- drivers/gpu/drm/i915/intel_display.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -23
@@ -2897,16 +2897,14 @@ static void intel_clear_scanline_wait(ststatic void intel_crtc_wait_for_pending_flips (struct drm_crtc *crtc) { -struct drm_i915_gem_object *obj; -struct drm_i915_private *dev_priv; +struct drm_device *dev = crtc->dev;if (crtc->fb ==NULL )return ; - obj =to_intel_framebuffer (crtc->fb)->obj; - dev_priv = crtc->dev->dev_private; -wait_event (dev_priv->pending_flip_queue, -atomic_read (&obj->pending_flip) ==0 ); +mutex_lock (&dev->struct_mutex); +intel_finish_fb (crtc->fb); +mutex_unlock (&dev->struct_mutex); }static bool intel_crtc_driving_pch (struct drm_crtc *crtc)
@@ -3372,23 +3370,6 @@ static void intel_crtc_disable(struct drstruct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;struct drm_device *dev = crtc->dev; -/* Flush any pending WAITs before we disable the pipe. Note that -* we need to drop the struct_mutex in order to acquire it again -* during the lowlevel dpms routines around a couple of the -* operations. It does not look trivial nor desirable to move -* that locking higher. So instead we leave a window for the -* submission of further commands on the fb before we can actually -* disable it. This race with userspace exists anyway, and we can -* only rely on the pipe being disabled by userspace after it -* receives the hotplug notification and has flushed any pending -* batches. -*/ -if (crtc->fb) { -mutex_lock (&dev->struct_mutex); -intel_finish_fb (crtc->fb); -mutex_unlock (&dev->struct_mutex); - } - crtc_funcs->dpms (crtc,DRM_MODE_DPMS_OFF );assert_plane_disabled (dev->dev_private,to_intel_crtc (crtc)->plane);assert_pipe_disabled (dev->dev_private,to_intel_crtc (crtc)->pipe);
Greg Kroah-Hartman
maintainerPATCH 120/171 drm/i915: dont pwrite tiled objects through the gtt
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit c07496fa61f4c5cb2addd1c57f6b22fcaeea2eeb upstream.
... we will botch up the bit17 swizzling. Furthermore tiled pwrite is a (now) unused slowpath, so no one really cares.
This fixes the last swizzling issues I have with i-g-t on my bit17 swizzling i915G. No regression, it's been broken since the dawn of gem, but it's nice for regression tracking when really _all_ i-g-t tests work.
Actually this is not true, Chris Wilson noticed while reviewing this patch that the commit
commit d9e86c0ee60f323e890484628f351bf50fa9a15d
Author: Chris Wilson <[email protected]> Date: Wed Nov 10 16:40:20 2010 +0000
drm/i915: Pipelined fencing [infrastructure]
contained a functional change that broke things.
--- drivers/gpu/drm/i915/i915_gem.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gem.c +1 -0
@@ -928,6 +928,7 @@ i915_gem_pwrite_ioctl(struct drm_device }if (obj->gtt_space && + obj->tiling_mode ==I915_TILING_NONE && obj->base.write_domain !=I915_GEM_DOMAIN_CPU ) { ret =i915_gem_object_pin (obj,0 , true);if (ret)
Greg Kroah-Hartman
maintainerPATCH 121/171 drm/radeon: fix up pll selection on DCE5/6
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 26fe45a0a76f165425f332a5aaa298f149f9db22 upstream.
Selecting ATOM_PPLL_INVALID should be equivalent as the DCPLL or PPLL0 are already programmed for the DISPCLK, but the preferred method is to always specify the PLL selected. SetPixelClock will check the parameters and skip the programming if the PLL is already set up.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/atombios_crtc.c +5 -1
@@ -1533,7 +1533,11 @@ static int radeon_atom_pick_pll(struct d* crtc virtual pixel clock. */ if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (test_encoder))) { -if (ASIC_IS_DCE5 (rdev) || rdev->clock.dp_extclk) +if (ASIC_IS_DCE5 (rdev)) +return ATOM_DCPLL ; +else if (ASIC_IS_DCE6 (rdev)) +return ATOM_PPLL0 ; +else if (rdev->clock.dp_extclk)return ATOM_PPLL_INVALID ; } }
Greg Kroah-Hartman
maintainerPATCH 122/171 drm/i915: add some barriers when changing DIPs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Zanoni <[email protected]>
commit 9d9740f099f2eaf309c4c9cbc0d732507140db28 upstream.
On IVB and older, we basically have two registers: the control and the data register. We write a few consecutitve times to the control register, and we need these writes to arrive exactly in the specified order.
Also, when we're changing the data register, we need to guarantee that anything written to the control register already arrived (since changing the control register can change where the data register points to). Also, we need to make sure all the writes to the data register happen exactly in the specified order, and we also *can't* read the data register during this process, since reading and/or writing it will change the place it points to.
So invoke the "better safe than sorry" rule and just be careful and put barriers everywhere :)
On HSW we still have a control register that we write many times, but we have many data registers.
[bwh: Backported to 3.2:
- There are only two write_infoframe functions to be modified
- The other VIDEO_DIP_CTL writes are in entirely different functions]
--- drivers/gpu/drm/i915/intel_hdmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +10 -1
@@ -138,14 +138,17 @@ static void i9xx_write_infoframe(structI915_WRITE (VIDEO_DIP_CTL ,VIDEO_DIP_ENABLE | val | port | flags); +mmiowb ();for (i =0 ; i < len; i +=4 ) {I915_WRITE (VIDEO_DIP_DATA , *data); data++; } +mmiowb (); flags |=intel_infoframe_flags (frame);I915_WRITE (VIDEO_DIP_CTL ,VIDEO_DIP_ENABLE | val | port | flags); +POSTING_READ (VIDEO_DIP_CTL ); } static void ironlake_write_infoframe(struct drm_encoder *encoder,
@@ -168,14 +171,17 @@ static void ironlake_write_infoframe(strI915_WRITE (reg,VIDEO_DIP_ENABLE | val | flags); +mmiowb ();for (i =0 ; i < len; i +=4 ) {I915_WRITE (TVIDEO_DIP_DATA (intel_crtc->pipe), *data); data++; } +mmiowb (); flags |=intel_infoframe_flags (frame);I915_WRITE (reg,VIDEO_DIP_ENABLE | val | flags); +POSTING_READ (reg); }static void intel_set_infoframe (struct drm_encoder *encoder,struct dip_infoframe *frame)
@@ -549,10 +555,13 @@ void intel_hdmi_init(struct drm_device *if (!HAS_PCH_SPLIT (dev)) { intel_hdmi->write_infoframe = i9xx_write_infoframe;I915_WRITE (VIDEO_DIP_CTL ,0 ); +POSTING_READ (VIDEO_DIP_CTL ); }else { intel_hdmi->write_infoframe = ironlake_write_infoframe; -for_each_pipe (i) +for_each_pipe (i) {I915_WRITE (TVIDEO_DIP_CTL (i),0 ); +POSTING_READ (TVIDEO_DIP_CTL (i)); + } }drm_encoder_helper_add (&intel_encoder->base, &intel_hdmi_helper_funcs);
Greg Kroah-Hartman
maintainerPATCH 123/171 drm/i915: SDVO hotplug have different interrupt status bits for i915/i965/g4x
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 084b612ecf8e59973576b2f644e6949609c79375 upstream.
Note that gen3 is the only platform where we've got the bit definitions right, hence the workaround of disabling sdvo hotplug support on i945g/gm is not due to misdiagnosis of broken hotplug irq handling ...
[danvet: add some blurb about sdvo hotplug fail on i945g/gm I've wondered about while reviewing.]
[bwh: Backported to 3.2:
- Adjust context
- Handle all three cases in i915_driver_irq_postinstall() as there are not separate functions for gen3 and gen4+
- Carry on using IS_SDVOB() in intel_sdvo_init()]
--- drivers/gpu/drm/i915/i915_irq.c | 20 ++++++++++++++++---- drivers/gpu/drm/i915/i915_reg.h | 10 ++++++++-- drivers/gpu/drm/i915/intel_sdvo.c | 17 +++++++++++++---- 3 files changed, 37 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +16 -4
@@ -2051,10 +2051,22 @@ static int i915_driver_irq_postinstall(s hotplug_en |=HDMIC_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &HDMID_HOTPLUG_INT_STATUS ) hotplug_en |=HDMID_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS ) - hotplug_en |=SDVOC_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS ) - hotplug_en |=SDVOB_HOTPLUG_INT_EN ; +if (IS_G4X (dev)) { +if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_G4X ) + hotplug_en |=SDVOC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS_G4X ) + hotplug_en |=SDVOB_HOTPLUG_INT_EN ; + }else if (IS_GEN4 (dev)) { +if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_I965 ) + hotplug_en |=SDVOC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS_I965 ) + hotplug_en |=SDVOB_HOTPLUG_INT_EN ; + }else { +if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_I915 ) + hotplug_en |=SDVOC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS_I915 ) + hotplug_en |=SDVOB_HOTPLUG_INT_EN ; + }if (dev_priv->hotplug_supported_mask &CRT_HOTPLUG_INT_STATUS ) { hotplug_en |=CRT_HOTPLUG_INT_EN ;
drivers/gpu/drm/i915/i915_reg.h +8 -2
@@ -1491,14 +1491,20 @@#define DPC_HOTPLUG_INT_STATUS (1 << 28)#define HDMID_HOTPLUG_INT_STATUS (1 << 27)#define DPD_HOTPLUG_INT_STATUS (1 << 27) +/* CRT/TV common between gen3+ */ #define CRT_HOTPLUG_INT_STATUS (1 << 11)#define TV_HOTPLUG_INT_STATUS (1 << 10)#define CRT_HOTPLUG_MONITOR_MASK (3 << 8)#define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)#define CRT_HOTPLUG_MONITOR_MONO (2 << 8)#define CRT_HOTPLUG_MONITOR_NONE (0 << 8) -#define SDVOC_HOTPLUG_INT_STATUS (1 << 7) -#define SDVOB_HOTPLUG_INT_STATUS (1 << 6) +/* SDVO is different across gen3/4 */ +#define SDVOC_HOTPLUG_INT_STATUS_G4X (1 << 3) +#define SDVOB_HOTPLUG_INT_STATUS_G4X (1 << 2) +#define SDVOC_HOTPLUG_INT_STATUS_I965 (3 << 4) +#define SDVOB_HOTPLUG_INT_STATUS_I965 (3 << 2) +#define SDVOC_HOTPLUG_INT_STATUS_I915 (1 << 7) +#define SDVOB_HOTPLUG_INT_STATUS_I915 (1 << 6)/* SDVO port control */ #define SDVOB 0x61140
drivers/gpu/drm/i915/intel_sdvo.c +13 -4
@@ -2528,6 +2528,7 @@ bool intel_sdvo_init(struct drm_device *struct drm_i915_private *dev_priv = dev->dev_private;struct intel_encoder *intel_encoder;struct intel_sdvo *intel_sdvo; +u32 hotplug_mask;int i; intel_sdvo =kzalloc (sizeof (struct intel_sdvo ),GFP_KERNEL );
@@ -2558,10 +2559,18 @@ bool intel_sdvo_init(struct drm_device * } } -if (IS_SDVOB (sdvo_reg)) - dev_priv->hotplug_supported_mask |=SDVOB_HOTPLUG_INT_STATUS ; -else - dev_priv->hotplug_supported_mask |=SDVOC_HOTPLUG_INT_STATUS ; + hotplug_mask =0 ; +if (IS_G4X (dev)) { + hotplug_mask =IS_SDVOB (sdvo_reg) ? +SDVOB_HOTPLUG_INT_STATUS_G4X :SDVOC_HOTPLUG_INT_STATUS_G4X ; + }else if (IS_GEN4 (dev)) { + hotplug_mask =IS_SDVOB (sdvo_reg) ? +SDVOB_HOTPLUG_INT_STATUS_I965 :SDVOC_HOTPLUG_INT_STATUS_I965 ; + }else { + hotplug_mask =IS_SDVOB (sdvo_reg) ? +SDVOB_HOTPLUG_INT_STATUS_I915 :SDVOC_HOTPLUG_INT_STATUS_I915 ; + } + dev_priv->hotplug_supported_mask |= hotplug_mask;drm_encoder_helper_add (&intel_encoder->base, &intel_sdvo_helper_funcs);
Greg Kroah-Hartman
maintainerPATCH 124/171 drm/radeon: fix ordering in pll picking on dce4+
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit ecd67955fd4c8e66e4df312098989d5fa7da624c upstream.
No functional change, but re-order the cases so they evaluate properly due to the way the DCE macros work.
Noticed by kallisti5 on IRC.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +4 -4
@@ -1533,12 +1533,12 @@ static int radeon_atom_pick_pll(struct d* crtc virtual pixel clock. */ if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (test_encoder))) { -if (ASIC_IS_DCE5 (rdev)) -return ATOM_DCPLL ; +if (rdev->clock.dp_extclk) +return ATOM_PPLL_INVALID ;else if (ASIC_IS_DCE6 (rdev))return ATOM_PPLL0 ; -else if (rdev->clock.dp_extclk) -return ATOM_PPLL_INVALID ; +else if (ASIC_IS_DCE5 (rdev)) +return ATOM_DCPLL ; } } }
Greg Kroah-Hartman
maintainerPATCH 125/171 drm/i915: only enable sdvo hotplug irq if needed
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit fcbc50da7753b210b4442ca9abc4efbd4e481f6e upstream.
Avoid constant wakeups caused by noisy irq lines when we don't even care about the irq. This should be particularly useful for i945g/gm where the hotplug has been disabled:
commit 768b107e4b3be0acf6f58e914afe4f337c00932b
Author: Daniel Vetter <[email protected]> Date: Fri May 4 11:29:56 2012 +0200
drm/i915: disable sdvo hotplug on i945g/gm
v2: While at it, remove the bogus hotplug_active read, and do not mask hotplug_active[0] before checking whether the irq is needed, per discussion with Daniel on IRC.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=38442
--- drivers/gpu/drm/i915/intel_sdvo.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +6 -9
@@ -2570,7 +2570,6 @@ bool intel_sdvo_init(struct drm_device * hotplug_mask =IS_SDVOB (sdvo_reg) ?SDVOB_HOTPLUG_INT_STATUS_I915 :SDVOC_HOTPLUG_INT_STATUS_I915 ; } - dev_priv->hotplug_supported_mask |= hotplug_mask;drm_encoder_helper_add (&intel_encoder->base, &intel_sdvo_helper_funcs);
@@ -2578,14 +2577,6 @@ bool intel_sdvo_init(struct drm_device *if (!intel_sdvo_get_capabilities (intel_sdvo, &intel_sdvo->caps)) goto err; -/* Set up hotplug command - note paranoia about contents of reply. -* We assume that the hardware is in a sane state, and only touch -* the bits we think we understand. -*/ -intel_sdvo_get_value (intel_sdvo,SDVO_CMD_GET_ACTIVE_HOT_PLUG , - &intel_sdvo->hotplug_active,2 ); - intel_sdvo->hotplug_active[0 ] &= ~0x3 ; -if (intel_sdvo_output_setup (intel_sdvo, intel_sdvo->caps.output_flags) != true) { DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n",
@@ -2593,6 +2584,12 @@ bool intel_sdvo_init(struct drm_device * goto err; } +/* Only enable the hotplug irq if we need it, to work around noisy +* hotplug lines. +*/ +if (intel_sdvo->hotplug_active[0 ]) + dev_priv->hotplug_supported_mask |= hotplug_mask; +intel_sdvo_select_ddc_bus (dev_priv, intel_sdvo, sdvo_reg);/* Set the input timing to the screen. Assume always input 0. */
Greg Kroah-Hartman
maintainerPATCH 126/171 drm/i915: Reduce a pin-leak BUG into a WARN
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 7e81a42e341a4f15d76624b7c02ffb21b085b56f upstream.
Pin-leaks persist and we get the perennial bug reports of machine lockups to the BUG_ON(pin_count==MAX). If we instead loudly report that the object cannot be pinned at that time it should prevent the driver from locking up, and hopefully restore a semblance of working whilst still leaving us a OOPS to debug.
--- drivers/gpu/drm/i915/i915_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +2 -1
@@ -3318,7 +3318,8 @@ i915_gem_object_pin(struct drm_i915_gem_struct drm_i915_private *dev_priv = dev->dev_private;int ret; -BUG_ON (obj->pin_count ==DRM_I915_GEM_OBJECT_MAX_PIN_COUNT ); +if (WARN_ON (obj->pin_count ==DRM_I915_GEM_OBJECT_MAX_PIN_COUNT )) +return -EBUSY ;WARN_ON (i915_verify_lists (dev));if (obj->gtt_space !=NULL ) {
Greg Kroah-Hartman
maintainerPATCH 127/171 drm/i915: prevent possible pin leak on error path
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugeni Dodonov <[email protected]>
commit ab3951eb74e7c33a2f5b7b64d72e82f1eea61571 upstream.
We should not hit this under any sane conditions, but still, this does not looks right.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -7505,7 +7505,7 @@ static int intel_gen7_queue_flip(structdefault :WARN_ONCE (1 ,"unknown plane in flip command\n" ); ret = -ENODEV ; - goto err; + goto err_unpin; } ret =intel_ring_begin (ring,4 );
Greg Kroah-Hartman
maintainerPATCH 128/171 drm/i915: Fix GT_MODE default value
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Widawsky <[email protected]>
commit f8f2ac9a76b0f80a6763ca316116a7bab8486997 upstream.
I can't even find how I figured this might be needed anymore. But sure enough, the value I'm reading back on platforms doesn't match what the docs recommends.
It seemed to fix Chris' GT1 in limited testing as well.
--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_display.c | 5 +++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -445,6 +445,9 @@# define VS_TIMER_DISPATCH (1 << 6)# define MI_FLUSH_ENABLE (1 << 12) +#define GEN6_GT_MODE 0x20d0 +#define GEN6_GT_MODE_HI (1 << 9) +#define GFX_MODE 0x02520#define GFX_MODE_GEN7 0x0229c#define RING_MODE_GEN7 (ring) ((ring)->mmio_base+0x29c)
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -8620,6 +8620,11 @@ static void gen6_init_clock_gating(struc DISPPLANE_TRICKLE_FEED_DISABLE);intel_flush_display_plane (dev_priv, pipe); } + +/* The default value should be 0x200 according to docs, but the two +* platforms I checked have a 0 for this. (Maybe BIOS overrides?) */ +I915_WRITE (GEN6_GT_MODE ,0xffff <<16 ); +I915_WRITE (GEN6_GT_MODE ,GEN6_GT_MODE_HI <<16 |GEN6_GT_MODE_HI ); }static void gen7_setup_fixed_func_scheduler (struct drm_i915_private *dev_priv)
Greg Kroah-Hartman
maintainerPATCH 129/171 drm/i915: call drm_handle_vblank before finish_page_flip
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 74d44445afb9f50126eba052adeb89827cee88f3 upstream.
... since finish_page_flip needs the vblank timestamp generated in drm_handle_vblank. Somehow all the gmch platforms get it right, but all the pch platform irq handlers get is wrong. Hooray for copy& pasting!
Currently this gets papered over by a gross hack in finish_page_flip. A second patch will remove that.
Note that without this, the new timestamp sanity checks in flip_test occasionally get tripped up, hence the cc: stable tag.
[bwh: Backported to 3.2: no loop over pipes in ivybridge_irq_handler(),
so make a similar change to that in ironlake_irq_handler()]
--- drivers/gpu/drm/i915/i915_irq.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +12 -12
@@ -530,6 +530,12 @@ static irqreturn_t ivybridge_irq_handlerif (de_iir &DE_GSE_IVB )intel_opregion_gse_intr (dev); +if (de_iir &DE_PIPEA_VBLANK_IVB ) +drm_handle_vblank (dev,0 ); + +if (de_iir &DE_PIPEB_VBLANK_IVB ) +drm_handle_vblank (dev,1 ); +if (de_iir &DE_PLANEA_FLIP_DONE_IVB ) {intel_prepare_page_flip (dev,0 );intel_finish_page_flip_plane (dev,0 );
@@ -540,12 +546,6 @@ static irqreturn_t ivybridge_irq_handlerintel_finish_page_flip_plane (dev,1 ); } -if (de_iir &DE_PIPEA_VBLANK_IVB ) -drm_handle_vblank (dev,0 ); - -if (de_iir &DE_PIPEB_VBLANK_IVB ) -drm_handle_vblank (dev,1 ); -/* check event from PCH */ if (de_iir &DE_PCH_EVENT_IVB ) {if (pch_iir &SDE_HOTPLUG_MASK_CPT )
@@ -622,6 +622,12 @@ static irqreturn_t ironlake_irq_handler(if (de_iir &DE_GSE )intel_opregion_gse_intr (dev); +if (de_iir &DE_PIPEA_VBLANK ) +drm_handle_vblank (dev,0 ); + +if (de_iir &DE_PIPEB_VBLANK ) +drm_handle_vblank (dev,1 ); +if (de_iir &DE_PLANEA_FLIP_DONE ) {intel_prepare_page_flip (dev,0 );intel_finish_page_flip_plane (dev,0 );
@@ -632,12 +638,6 @@ static irqreturn_t ironlake_irq_handler(intel_finish_page_flip_plane (dev,1 ); } -if (de_iir &DE_PIPEA_VBLANK ) -drm_handle_vblank (dev,0 ); - -if (de_iir &DE_PIPEB_VBLANK ) -drm_handle_vblank (dev,1 ); -/* check event from PCH */ if (de_iir &DE_PCH_EVENT ) {if (pch_iir & hotplug_mask)
Greg Kroah-Hartman
maintainerPATCH 130/171 drm/i915: Flush the pending flips on the CRTC before modification
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 5bb61643f6a70d48de9cfe91ad0fee0d618b6816 upstream.
This was meant to be the purpose of the intel_crtc_wait_for_pending_flips() function which is called whilst preparing the CRTC for a modeset or before disabling. However, as Ville Syrjala pointed out, we set the pending flip notification on the old framebuffer that is no longer attached to the CRTC by the time we come to flush the pending operations. Instead, we can simply wait on the pending unpin work to be finished on this CRTC, knowning that the hardware has therefore finished modifying the registers, before proceeding with our direct access.
Fixes i-g-t/flip_test on non-pch platforms. pch platforms simply schedule the flip immediately when the pipe is disabled, leading to other funny issues.
--- drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +22 -2
@@ -2895,13 +2895,34 @@ static void intel_clear_scanline_wait(stI915_WRITE_CTL (ring, tmp); } +static bool intel_crtc_has_pending_flip (struct drm_crtc *crtc) +{ +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +unsigned long flags; +bool pending; + +if (atomic_read (&dev_priv->mm.wedged)) +return false; + +spin_lock_irqsave (&dev->event_lock, flags); + pending =to_intel_crtc (crtc)->unpin_work !=NULL ; +spin_unlock_irqrestore (&dev->event_lock, flags); + +return pending; +} +static void intel_crtc_wait_for_pending_flips (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private;if (crtc->fb ==NULL )return ; +wait_event (dev_priv->pending_flip_queue, + !intel_crtc_has_pending_flip (crtc)); +mutex_lock (&dev->struct_mutex);intel_finish_fb (crtc->fb);mutex_unlock (&dev->struct_mutex);
@@ -7258,9 +7279,8 @@ static void do_intel_finish_page_flip(statomic_clear_mask (1 << intel_crtc->plane, &obj->pending_flip.counter); -if (atomic_read (&obj->pending_flip) ==0 ) -wake_up (&dev_priv->pending_flip_queue); +wake_up (&dev_priv->pending_flip_queue);schedule_work (&work->work);trace_i915_flip_complete (intel_crtc->plane, work->pending_flip_obj);
Greg Kroah-Hartman
maintainerPATCH 131/171 Revert "drm/i915: no lvds quirk for Zotac ZDBOX SD ID12/ID13"
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 48e858340dae43189a4e55647f6eac736766f828 upstream.
This reverts commit 9756fe38d10b2bf90c81dc4d2f17d5632e135364.
The bogus lvds output is actually a lvds->hdmi bridge, which we don't really support. But unconditionally disabling it breaks some existing setups.
References: http://permalink.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/17237
--- drivers/gpu/drm/i915/intel_lvds.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/i915/intel_lvds.c +0 -8
@@ -779,14 +779,6 @@ static const struct dmi_system_id intel_ }, { .callback = intel_no_lvds_dmi_callback, - .ident = "ZOTAC ZBOXSD-ID12/ID13", - .matches = { -DMI_MATCH (DMI_BOARD_VENDOR ,"ZOTAC" ), - DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"), - }, - }, - { - .callback = intel_no_lvds_dmi_callback, .ident = "Gigabyte GA-D525TUD", .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."),
Greg Kroah-Hartman
maintainerPATCH 132/171 ceph: close old con before reopening on mds reconnect
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sage Weil <[email protected]>
When we detect a mds session reset, close the old ceph_connection before reopening it. This ensures we clean up the old socket properly and keep the ceph_connection state correct.
--- fs/ceph/mds_client.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/mds_client.c +1 -0
@@ -2528,6 +2528,7 @@ static void send_mds_reconnect(struct ce session->s_state =CEPH_MDS_SESSION_RECONNECTING ; session->s_seq =0 ; +ceph_con_close (&session->s_con);ceph_con_open (&session->s_con,CEPH_ENTITY_TYPE_MDS , mds,ceph_mdsmap_get_addr (mdsc->mdsmap, mds));
Greg Kroah-Hartman
maintainerPATCH 133/171 rbd: return errors for mapped but deleted snapshot
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Durgin <[email protected]>
When a snapshot is deleted, the OSD will return ENOENT when reading from it. This is normally interpreted as a hole by rbd, which will return zeroes. To minimize the time in which this can happen, stop requests early when we are notified that our snapshot no longer exists.
[[email protected]: updated __rbd_init_snaps_header() logic]
Conflicts:
drivers/block/rbd.c
--- drivers/block/rbd.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
drivers/block/rbd.c +30 -2
@@ -174,9 +174,13 @@ struct rbd_device {/* protects updating the header */ struct rw_semaphore header_rwsem; +/* name of the snapshot this device reads from */ char snap_name[RBD_MAX_SNAP_NAME_LEN ]; +/* id of the snapshot this device reads from */ u64 snap_id;/* current snapshot id */ -int read_only; +/* whether the snap_id this device reads from still exists */ +bool snap_exists; +int read_only;struct list_head node;
@@ -590,6 +594,7 @@ static int rbd_header_set_snap(struct rbelse snapc->seq =0 ; dev->snap_id =CEPH_NOSNAP ; + dev->snap_exists = false; dev->read_only =0 ;if (size) *size = header->image_size;
@@ -598,6 +603,7 @@ static int rbd_header_set_snap(struct rbif (ret <0 ) goto done; dev->snap_id = snapc->seq; + dev->snap_exists = true; dev->read_only =1 ; }
@@ -1466,6 +1472,21 @@ static void rbd_rq_fn(struct request_quespin_unlock_irq (q->queue_lock); +if (rbd_dev->snap_id !=CEPH_NOSNAP ) { +bool snap_exists; + +down_read (&rbd_dev->header_rwsem); + snap_exists = rbd_dev->snap_exists; +up_read (&rbd_dev->header_rwsem); + +if (!snap_exists) { +dout ("request for non-existent snapshot" ); +spin_lock_irq (q->queue_lock); +__blk_end_request_all (rq, -ENXIO ); +continue ; + } + } +dout ("%s 0x%x bytes at 0x%llx\n" , do_write ?"write" :"read" , size,blk_rq_pos (rq) *SECTOR_SIZE );
@@ -2069,7 +2090,14 @@ static int __rbd_init_snaps_header(struc cur_id = rbd_dev->header.snapc->snaps[i -1 ];if (!i || old_snap->id < cur_id) { -/* old_snap->id was skipped, thus was removed */ +/* +* old_snap->id was skipped, thus was +* removed. If this rbd_dev is mapped to +* the removed snapshot, record that it no +* longer exists, to prevent further I/O. +*/ +if (rbd_dev->snap_id == old_snap->id) + rbd_dev->snap_exists = false;__rbd_remove_snap_dev (rbd_dev, old_snap);continue ; }
Greg Kroah-Hartman
maintainerPATCH 134/171 rbd: only reset capacity when pointing to head
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Durgin <[email protected]>
Snapshots cannot be resized, and the new capacity of head should not be reflected by the snapshot.
--- drivers/block/rbd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/block/rbd.c +6 -1
@@ -1721,7 +1721,12 @@ static int __rbd_update_snaps(struct rbdreturn ret;/* resized? */ -set_capacity (rbd_dev->disk, h.image_size /SECTOR_SIZE ); +if (rbd_dev->snap_id ==CEPH_NOSNAP ) { +sector_t size = (sector_t ) h.image_size /SECTOR_SIZE ; + +dout ("setting size to %llu sectors" , (unsigned long long ) size); +set_capacity (rbd_dev->disk, size); + }down_write (&rbd_dev->header_rwsem);
Greg Kroah-Hartman
maintainerPATCH 135/171 rbd: expose the correct size of the device in sysfs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Durgin <[email protected]>
If an image was mapped to a snapshot, the size of the head version would be shown. Protect capacity with header_rwsem, since it may change.
--- drivers/block/rbd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/block/rbd.c +8 -3
@@ -1720,6 +1720,8 @@ static int __rbd_update_snaps(struct rbdif (ret <0 )return ret; +down_write (&rbd_dev->header_rwsem); +/* resized? */ if (rbd_dev->snap_id ==CEPH_NOSNAP ) {sector_t size = (sector_t ) h.image_size /SECTOR_SIZE ;
@@ -1728,8 +1730,6 @@ static int __rbd_update_snaps(struct rbdset_capacity (rbd_dev->disk, size); } -down_write (&rbd_dev->header_rwsem); - snap_seq = rbd_dev->header.snapc->seq;if (rbd_dev->header.total_snaps && rbd_dev->header.snapc->snaps[0 ] == snap_seq)
@@ -1844,8 +1844,13 @@ static ssize_t rbd_size_show(struct devi struct device_attribute *attr, char *buf) { struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); +sector_t size; + +down_read (&rbd_dev->header_rwsem); + size =get_capacity (rbd_dev->disk); +up_read (&rbd_dev->header_rwsem); -return sprintf (buf,"%llu\n" , (unsigned long long )rbd_dev->header.image_size); +return sprintf (buf,"%llu\n" , (unsigned long long ) size *SECTOR_SIZE ); } static ssize_t rbd_major_show(struct device *dev,
Greg Kroah-Hartman
maintainerPATCH 136/171 rbd: set image size when header is updated
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Durgin <[email protected]>
The image may have been resized.
--- drivers/block/rbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/rbd.c +1 -0
@@ -1741,6 +1741,7 @@ static int __rbd_update_snaps(struct rbdkfree (rbd_dev->header.snap_names);kfree (rbd_dev->header.snap_sizes); + rbd_dev->header.image_size = h.image_size; rbd_dev->header.total_snaps = h.total_snaps; rbd_dev->header.snapc = h.snapc; rbd_dev->header.snap_names = h.snap_names;
Greg Kroah-Hartman
maintainerPATCH 137/171 rbd: use reference counting for the snap context
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Durgin <[email protected]>
This prevents a race between requests with a given snap context and header updates that free it. The osd client was already expecting the snap context to be reference counted, since it get()s it in ceph_osdc_build_request and put()s it when the request completes.
Also remove the second down_read()/up_read() on header_rwsem in rbd_do_request, which wasn't actually preventing this race or protecting any other data.
--- drivers/block/rbd.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
drivers/block/rbd.c +17 -18
@@ -615,7 +615,7 @@ done:static void rbd_header_free (struct rbd_image_header *header) { -kfree (header->snapc); +ceph_put_snap_context (header->snapc);kfree (header->snap_names);kfree (header->snap_sizes); }
@@ -893,13 +893,10 @@ static int rbd_do_request(struct requestdout ("rbd_do_request obj=%s ofs=%lld len=%lld\n" , obj, len, ofs); -down_read (&dev->header_rwsem); - osdc = &dev->rbd_client->client->osdc; req =ceph_osdc_alloc_request (osdc, flags, snapc, ops, false,GFP_NOIO , pages, bio);if (!req) { -up_read (&dev->header_rwsem); ret = -ENOMEM ; goto done_pages; }
@@ -934,7 +931,6 @@ static int rbd_do_request(struct request snapc, &mtime, req->r_oid, req->r_oid_len); -up_read (&dev->header_rwsem);if (linger_req) {ceph_osdc_set_request_linger (osdc, req);
@@ -1446,6 +1442,7 @@ static void rbd_rq_fn(struct request_queu64 ofs;int num_segs, cur_seg =0 ;struct rbd_req_coll *coll; +struct ceph_snap_context *snapc;/* peek at request from block layer */ if (!rq)
@@ -1472,21 +1469,20 @@ static void rbd_rq_fn(struct request_quespin_unlock_irq (q->queue_lock); -if (rbd_dev->snap_id !=CEPH_NOSNAP ) { -bool snap_exists; +down_read (&rbd_dev->header_rwsem); -down_read (&rbd_dev->header_rwsem); - snap_exists = rbd_dev->snap_exists; +if (rbd_dev->snap_id !=CEPH_NOSNAP && !rbd_dev->snap_exists) {up_read (&rbd_dev->header_rwsem); - -if (!snap_exists) { -dout ("request for non-existent snapshot" ); -spin_lock_irq (q->queue_lock); -__blk_end_request_all (rq, -ENXIO ); -continue ; - } +dout ("request for non-existent snapshot" ); +spin_lock_irq (q->queue_lock); +__blk_end_request_all (rq, -ENXIO ); +continue ; } + snapc =ceph_get_snap_context (rbd_dev->header.snapc); + +up_read (&rbd_dev->header_rwsem); +dout ("%s 0x%x bytes at 0x%llx\n" , do_write ?"write" :"read" , size,blk_rq_pos (rq) *SECTOR_SIZE );
@@ -1496,6 +1492,7 @@ static void rbd_rq_fn(struct request_queif (!coll) {spin_lock_irq (q->queue_lock);__blk_end_request_all (rq, -ENOMEM ); +ceph_put_snap_context (snapc);continue ; }
@@ -1519,7 +1516,7 @@ static void rbd_rq_fn(struct request_que/* init OSD command: write or read */ if (do_write)rbd_req_write (rq, rbd_dev, - rbd_dev->header.snapc, + snapc, ofs, op_size, bio, coll, cur_seg);
@@ -1542,6 +1539,8 @@ next_seg:if (bp)bio_pair_release (bp);spin_lock_irq (q->queue_lock); + +ceph_put_snap_context (snapc); } }
@@ -1737,7 +1736,7 @@ static int __rbd_update_snaps(struct rbdif head moves */ follow_seq =1 ; -kfree (rbd_dev->header.snapc); +ceph_put_snap_context (rbd_dev->header.snapc);kfree (rbd_dev->header.snap_names);kfree (rbd_dev->header.snap_sizes);
Greg Kroah-Hartman
maintainerPATCH 138/171 rbd: send header version when notifying
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Durgin <[email protected]>
Previously the original header version was sent. Now, we update it when the header changes.
--- drivers/block/rbd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/block/rbd.c +5 -2
@@ -1195,7 +1195,7 @@ static int rbd_req_sync_notify_ack(strucif (ret <0 )return ret; - ops[0 ].watch.ver =cpu_to_le64 (dev->header.obj_version); + ops[0 ].watch.ver =cpu_to_le64 (ver); ops[0 ].watch.cookie = notify_id; ops[0 ].watch.flag =0 ;
@@ -1215,6 +1215,7 @@ static int rbd_req_sync_notify_ack(strucstatic void rbd_watch_cb (u64 ver,u64 notify_id,u8 opcode,void *data) {struct rbd_device *dev = (struct rbd_device *)data; +u64 hver;int rc;if (!dev)
@@ -1224,12 +1225,13 @@ static void rbd_watch_cb(u64 ver, u64 no notify_id, (int)opcode);mutex_lock_nested (&ctl_mutex,SINGLE_DEPTH_NESTING ); rc =__rbd_update_snaps (dev); + hver = dev->header.obj_version;mutex_unlock (&ctl_mutex);if (rc)pr_warning (RBD_DRV_NAME "%d got notification but failed to " " update snaps: %d\n" , dev->major, rc); -rbd_req_sync_notify_ack (dev, ver, notify_id, dev->obj_md_name); +rbd_req_sync_notify_ack (dev, hver, notify_id, dev->obj_md_name); }/*
@@ -1740,6 +1742,7 @@ static int __rbd_update_snaps(struct rbdkfree (rbd_dev->header.snap_names);kfree (rbd_dev->header.snap_sizes); + rbd_dev->header.obj_version = h.obj_version; rbd_dev->header.image_size = h.image_size; rbd_dev->header.total_snaps = h.total_snaps; rbd_dev->header.snapc = h.snapc;
Greg Kroah-Hartman
maintainerPATCH 139/171 ceph: tolerate (and warn on) extraneous dentry from mds
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sage Weil <[email protected]>
If the MDS gives us a dentry and we weren't prepared to handle it, WARN_ON_ONCE instead of crashing.
--- fs/ceph/inode.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/ceph/inode.c +10 -5
@@ -992,11 +992,15 @@ int ceph_fill_trace(struct super_block *if (rinfo->head->is_dentry) {struct inode *dir = req->r_locked_dir; - err =fill_inode (dir, &rinfo->diri, rinfo->dirfrag, - session, req->r_request_started,-1 , - &req->r_caps_reservation); -if (err <0 ) -return err; +if (dir) { + err =fill_inode (dir, &rinfo->diri, rinfo->dirfrag, + session, req->r_request_started,-1 , + &req->r_caps_reservation); +if (err <0 ) +return err; + }else { +WARN_ON_ONCE (1 ); + } }/*
@@ -1004,6 +1008,7 @@ int ceph_fill_trace(struct super_block ** will have trouble splicing in the virtual snapdir later */ if (rinfo->head->is_dentry && !req->r_aborted && + req->r_locked_dir && (rinfo->head->is_target ||strncmp (req->r_dentry->d_name.name, fsc->mount_options->snapdir_name, req->r_dentry->d_name.len))) {
Greg Kroah-Hartman
maintainerPATCH 140/171 rbd: drop dev reference on error in rbd_open()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
If a read-only rbd device is opened for writing in rbd_open(), it returns without dropping the just-acquired device reference.
Fix this by moving the read-only check before getting the reference.
--- drivers/block/rbd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/block/rbd.c +3 -4
@@ -250,13 +250,12 @@ static int rbd_open(struct block_device {struct rbd_device *rbd_dev = bdev->bd_disk->private_data; -rbd_get_dev (rbd_dev); - -set_device_ro (bdev, rbd_dev->read_only); -if ((mode &FMODE_WRITE ) && rbd_dev->read_only)return -EROFS ; +rbd_get_dev (rbd_dev); +set_device_ro (bdev, rbd_dev->read_only); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 141/171 ceph: propagate layout error on osd request creation
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sage Weil <[email protected]>
If we are creating an osd request and get an invalid layout, return an EINVAL to the caller. We switch up the return to have an error code instead of NULL implying -ENOMEM.
--- fs/ceph/addr.c | 8 ++++---- fs/ceph/file.c | 4 ++-- net/ceph/osd_client.c | 15 +++++++++------ 3 files changed, 15 insertions(+), 12 deletions(-)
fs/ceph/addr.c +4 -4
@@ -308,8 +308,8 @@ static int start_read(struct inode *inodNULL ,0 , ci->i_truncate_seq, ci->i_truncate_size, NULL, false, 1, 0); -if (!req) -return -ENOMEM ; +if (IS_ERR (req)) +return PTR_ERR (req);/* build page vector */ nr_pages = len >>PAGE_CACHE_SHIFT ;
@@ -831,8 +831,8 @@ get_more_pages: ci->i_truncate_size, &inode->i_mtime, true, 1, 0); -if (!req) { - rc = -ENOMEM ; +if (IS_ERR (req)) { + rc =PTR_ERR (req);unlock_page (page);break ; }
fs/ceph/file.c +2 -2
@@ -529,8 +529,8 @@ more: do_sync, ci->i_truncate_seq, ci->i_truncate_size, &mtime, false, 2, page_align); -if (!req) -return -ENOMEM ; +if (IS_ERR (req)) +return PTR_ERR (req);if (file->f_flags &O_DIRECT ) { pages =ceph_get_direct_page_vector (data, num_pages, false);
net/ceph/osd_client.c +9 -6
@@ -461,6 +461,7 @@ struct ceph_osd_request *ceph_osdc_new_r {struct ceph_osd_req_op ops[3 ];struct ceph_osd_request *req; +int r; ops[0 ].op = opcode; ops[0 ].extent.truncate_seq = truncate_seq;
@@ -479,10 +480,12 @@ struct ceph_osd_request *ceph_osdc_new_r use_mempool, GFP_NOFS, NULL, NULL);if (!req) -return NULL ; +return ERR_PTR (-ENOMEM );/* calculate max write size */ -calc_layout (osdc, vino, layout, off, plen, req, ops); + r =calc_layout (osdc, vino, layout, off, plen, req, ops); +if (r <0 ) +return ERR_PTR (r); req->r_file_layout = *layout;/* keep a copy */ /* in case it differs from natural (file) alignment that
@@ -1925,8 +1928,8 @@ int ceph_osdc_readpages(struct ceph_osd_CEPH_OSD_OP_READ ,CEPH_OSD_FLAG_READ ,NULL ,0 , truncate_seq, truncate_size,NULL , false, 1, page_align); -if (!req) -return -ENOMEM ; +if (IS_ERR (req)) +return PTR_ERR (req);/* it may be a short read due to an object boundary */ req->r_pages = pages;
@@ -1968,8 +1971,8 @@ int ceph_osdc_writepages(struct ceph_osd snapc, do_sync, truncate_seq, truncate_size, mtime, nofail, 1, page_align); -if (!req) -return -ENOMEM ; +if (IS_ERR (req)) +return PTR_ERR (req);/* it may be a short write due to an object boundary */ req->r_pages = pages;
Greg Kroah-Hartman
maintainerPATCH 142/171 libceph: socket can close in any connection state
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
A connection's socket can close for any reason, independent of the state of the connection (and without irrespective of the connection mutex). As a result, the connectino can be in pretty much any state at the time its socket is closed.
Handle those other cases at the top of con_work(). Pull this whole block of code into a separate function to reduce the clutter.
--- net/ceph/messenger.c | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-)
net/ceph/messenger.c +30 -17
@@ -2258,6 +2258,35 @@ static void queue_con(struct ceph_connec } } +static bool con_sock_closed (struct ceph_connection *con) +{ +if (!test_and_clear_bit (CON_FLAG_SOCK_CLOSED , &con->flags)) +return false; + +#define CASE (x) \ + case CON_STATE_ ## x: \ + con->error_msg = "socket closed (con state " #x ")"; \ + break; + +switch (con->state) { +CASE (CLOSED ); +CASE (PREOPEN ); +CASE (CONNECTING ); +CASE (NEGOTIATING ); +CASE (OPEN ); +CASE (STANDBY ); +default : +pr_warning ("%s con %p unrecognized state %lu\n" , + __func__, con, con->state); + con->error_msg ="unrecognized con state" ; +BUG (); +break ; + } +#undef CASE + +return true; +} +/* * Do some work on a connection. Drop a connection ref when we're done. */
@@ -2269,24 +2298,8 @@ static void con_work(struct work_structmutex_lock (&con->mutex); restart: -if (test_and_clear_bit (CON_FLAG_SOCK_CLOSED , &con->flags)) { -switch (con->state) { -case CON_STATE_CONNECTING : - con->error_msg ="connection failed" ; -break ; -case CON_STATE_NEGOTIATING : - con->error_msg ="negotiation failed" ; -break ; -case CON_STATE_OPEN : - con->error_msg ="socket closed" ; -break ; -default : -dout ("unrecognized con state %d\n" , (int )con->state); - con->error_msg ="unrecognized con state" ; -BUG (); - } +if (con_sock_closed (con)) goto fault; - }if (test_and_clear_bit (CON_FLAG_BACKOFF , &con->flags)) {dout ("con_work %p backing off\n" , con);
Greg Kroah-Hartman
maintainerPATCH 143/171 libceph: report connection fault with warning
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
When a connection's socket disconnects, or if there's a protocol error of some kind on the connection, a fault is signaled and the connection is reset (closed and reopened, basically). We currently get an error message on the log whenever this occurs.
A ceph connection will attempt to reestablish a socket connection repeatedly if a fault occurs. This means that these error messages will get repeatedly added to the log, which is undesirable.
Change the error message to be a warning, so they don't get logged by default.
--- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/messenger.c +1 -1
@@ -2365,7 +2365,7 @@ fault:static void ceph_fault (struct ceph_connection *con) __releases(con->mutex) { -pr_err ("%s%lld %s %s\n" ,ENTITY_NAME (con->peer_name), +pr_warning ("%s%lld %s %s\n" ,ENTITY_NAME (con->peer_name),ceph_pr_addr (&con->peer_addr.in_addr), con->error_msg);dout ("fault %p state %lu to peer %s\n" , con, con->state,ceph_pr_addr (&con->peer_addr.in_addr));
Greg Kroah-Hartman
maintainerPATCH 144/171 libceph: init osd->o_node in create_osd()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
The red-black node node in the ceph osd structure is not initialized in create_osd(). Because this node can be the subject of a RB_EMPTY_NODE() call later on, we should ensure the node is initialized properly for that. Add a call to RB_CLEAR_NODE() initialize it.
--- net/ceph/osd_client.c | 1 + 1 file changed, 1 insertion(+)
net/ceph/osd_client.c +1 -0
@@ -645,6 +645,7 @@ static struct ceph_osd *create_osd(strucatomic_set (&osd->o_ref,1 ); osd->o_osdc = osdc; osd->o_osd = onum; +RB_CLEAR_NODE (&osd->o_node);INIT_LIST_HEAD (&osd->o_requests);INIT_LIST_HEAD (&osd->o_linger_requests);INIT_LIST_HEAD (&osd->o_osd_lru);
Greg Kroah-Hartman
maintainerPATCH 145/171 libceph: init event->node in ceph_osdc_create_event()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
The red-black node node in the ceph osd event structure is not initialized in create_osdc_create_event(). Because this node can be the subject of a RB_EMPTY_NODE() call later on, we should ensure the node is initialized properly for that.
--- net/ceph/osd_client.c | 1 + 1 file changed, 1 insertion(+)
net/ceph/osd_client.c +1 -0
@@ -1598,6 +1598,7 @@ int ceph_osdc_create_event(struct ceph_o event->data = data; event->osdc = osdc;INIT_LIST_HEAD (&event->osd_node); +RB_CLEAR_NODE (&event->node);kref_init (&event->kref);/* one ref for us */ kref_get (&event->kref);/* one ref for the caller */ init_completion (&event->completion);
Greg Kroah-Hartman
maintainerPATCH 146/171 libceph: dont use rb_init_node() in ceph_osdc_alloc_request()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
The red-black node in the ceph osd request structure is initialized in ceph_osdc_alloc_request() using rbd_init_node(). We do need to initialize this, because in __unregister_request() we call RB_EMPTY_NODE(), which expects the node it's checking to have been initialized. But rb_init_node() is apparently overkill, and may in fact be on its way out. So use RB_CLEAR_NODE() instead.
For a little more background, see this commit:
4c199a93 rbtree: empty nodes have no color"
--- net/ceph/osd_client.c | 1 + 1 file changed, 1 insertion(+)
net/ceph/osd_client.c +1 -0
@@ -221,6 +221,7 @@ struct ceph_osd_request *ceph_osdc_allockref_init (&req->r_kref);init_completion (&req->r_completion);init_completion (&req->r_safe_completion); +RB_CLEAR_NODE (&req->r_node);INIT_LIST_HEAD (&req->r_unsafe_item);INIT_LIST_HEAD (&req->r_linger_item);INIT_LIST_HEAD (&req->r_linger_osd);
Greg Kroah-Hartman
maintainerPATCH 147/171 libceph: register request before unregister linger
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
In kick_requests(), we need to register the request before we unregister the linger request. Otherwise the unregister will reset the request's osd pointer to NULL.
--- net/ceph/osd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/osd_client.c +1 -1
@@ -1364,8 +1364,8 @@ static void kick_requests(struct ceph_osdout ("kicking lingering %p tid %llu osd%d\n" , req, req->r_tid, req->r_osd ? req->r_osd->o_osd :-1 ); -__unregister_linger_request (osdc, req);__register_request (osdc, req); +__unregister_linger_request (osdc, req); }mutex_unlock (&osdc->request_mutex);
Greg Kroah-Hartman
maintainerPATCH 148/171 libceph: move linger requests sooner in kick_requests()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
The kick_requests() function is called by ceph_osdc_handle_map() when an osd map change has been indicated. Its purpose is to re-queue any request whose target osd is different from what it was when it was originally sent.
It is structured as two loops, one for incomplete but registered requests, and a second for handling completed linger requests. As a special case, in the first loop if a request marked to linger has not yet completed, it is moved from the request list to the linger list. This is as a quick and dirty way to have the second loop handle sending the request along with all the other linger requests.
Because of the way it's done now, however, this quick and dirty solution can result in these incomplete linger requests never getting re-sent as desired. The problem lies in the fact that the second loop only arranges for a linger request to be sent if it appears its target osd has changed. This is the proper handling for *completed* linger requests (it avoids issuing the same linger request twice to the same osd).
But although the linger requests added to the list in the first loop may have been sent, they have not yet completed, so they need to be re-sent regardless of whether their target osd has changed.
The first required fix is we need to avoid calling __map_request() on any incomplete linger request. Otherwise the subsequent __map_request() call in the second loop will find the target osd has not changed and will therefore not re-send the request.
Second, we need to be sure that a sent but incomplete linger request gets re-sent. If the target osd is the same with the new osd map as it was when the request was originally sent, this won't happen. This can be fixed through careful handling when we move these requests from the request list to the linger list, by unregistering the request *before* it is registered as a linger request. This works because a side-effect of unregistering the request is to make the request's r_osd pointer be NULL, and *that* will ensure the second loop actually re-sends the linger request.
Processing of such a request is done at that point, so continue with the next one once it's been moved.
--- net/ceph/osd_client.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
net/ceph/osd_client.c +19 -11
@@ -1320,6 +1320,24 @@ static void kick_requests(struct ceph_osfor (p =rb_first (&osdc->requests); p; ) { req = rb_entry(p, struct ceph_osd_request, r_node); p =rb_next (p); + +/* +* For linger requests that have not yet been +* registered, move them to the linger list; they'll +* be sent to the osd in the loop below. Unregister +* the request before re-registering it as a linger +* request to ensure the __map_request() below +* will decide it needs to be sent. +*/ +if (req->r_linger &&list_empty (&req->r_linger_item)) { +dout ("%p tid %llu restart on osd%d\n" , + req, req->r_tid, + req->r_osd ? req->r_osd->o_osd :-1 ); +__unregister_request (osdc, req); +__register_linger_request (osdc, req); +continue ; + } + err =__map_request (osdc, req, force_resend);if (err <0 )continue ;/* error */
@@ -1334,17 +1352,6 @@ static void kick_requests(struct ceph_os req->r_flags |=CEPH_OSD_FLAG_RETRY ; } } -if (req->r_linger &&list_empty (&req->r_linger_item)) { -/* -* register as a linger so that we will -* re-submit below and get a new tid -*/ -dout ("%p tid %llu restart on osd%d\n" , - req, req->r_tid, - req->r_osd ? req->r_osd->o_osd :-1 ); -__register_linger_request (osdc, req); -__unregister_request (osdc, req); - } } list_for_each_entry_safe(req, nreq, &osdc->req_linger,
@@ -1352,6 +1359,7 @@ static void kick_requests(struct ceph_osdout ("linger req=%p req->r_osd=%p\n" , req, req->r_osd); err =__map_request (osdc, req, force_resend); +dout ("__map_request returned %d\n" , err);if (err ==0 )continue ;/* no change and no osd was specified */ if (err <0 )
Greg Kroah-Hartman
maintainerPATCH 149/171 libceph: always reset osds when kicking
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
When ceph_osdc_handle_map() is called to process a new osd map, kick_requests() is called to ensure all affected requests are updated if necessary to reflect changes in the osd map. This happens in two cases: whenever an incremental map update is processed; and when a full map update (or the last one if there is more than one) gets processed.
In the former case, the kick_requests() call is followed immediately by a call to reset_changed_osds() to ensure any connections to osds affected by the map change are reset. But for full map updates this isn't done.
Both cases should be doing this osd reset.
Rather than duplicating the reset_changed_osds() call, move it into the end of kick_requests().
--- net/ceph/osd_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +2 -2
@@ -1306,7 +1306,7 @@ static void reset_changed_osds(struct ce* Requeue requests whose mapping to an OSD has changed. If requests map to * no osd, request a new map. * -* Caller should hold map_sem for read and request_mutex. +* Caller should hold map_sem for read. */ static void kick_requests (struct ceph_osd_client *osdc,int force_resend) {
@@ -1381,6 +1381,7 @@ static void kick_requests(struct ceph_osdout ("%d requests for down osds, need new map\n" , needmap);ceph_monc_request_next_osdmap (&osdc->client->monc); } +reset_changed_osds (osdc); }
@@ -1437,7 +1438,6 @@ void ceph_osdc_handle_map(struct ceph_os osdc->osdmap = newmap; }kick_requests (osdc,0 ); -reset_changed_osds (osdc); }else {dout ("ignoring incremental map %u len %d\n" , epoch, maplen);
Greg Kroah-Hartman
maintainerPATCH 150/171 libceph: WARN, dont BUG on unexpected connection states
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
A number of assertions in the ceph messenger are implemented with BUG_ON(), killing the system if connection's state doesn't match what's expected. At this point our state model is (evidently) not well understood enough for these assertions to trigger a BUG(). Convert all BUG_ON(con->state...) calls to be WARN_ON(con->state...) so we learn about these issues without killing the machine.
We now recognize that a connection fault can occur due to a socket closure at any time, regardless of the state of the connection. So there is really nothing we can assert about the state of the connection at that point so eliminate that assertion.
--- net/ceph/messenger.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/ceph/messenger.c +5 -6
@@ -561,7 +561,7 @@ void ceph_con_open(struct ceph_connectiomutex_lock (&con->mutex);dout ("con_open %p %s\n" , con,ceph_pr_addr (&addr->in_addr)); -BUG_ON (con->state !=CON_STATE_CLOSED ); +WARN_ON (con->state !=CON_STATE_CLOSED ); con->state =CON_STATE_PREOPEN ; con->peer_name.type = (__u8 ) entity_type;
@@ -1505,7 +1505,7 @@ static int process_banner(struct ceph_costatic void fail_protocol (struct ceph_connection *con) {reset_connection (con); -BUG_ON (con->state !=CON_STATE_NEGOTIATING ); +WARN_ON (con->state !=CON_STATE_NEGOTIATING ); con->state =CON_STATE_CLOSED ; }
@@ -1631,7 +1631,7 @@ static int process_connect(struct ceph_creturn -1 ; } -BUG_ON (con->state !=CON_STATE_NEGOTIATING ); +WARN_ON (con->state !=CON_STATE_NEGOTIATING ); con->state =CON_STATE_OPEN ; con->peer_global_seq =le32_to_cpu (con->in_reply.global_seq);
@@ -2128,7 +2128,6 @@ more:if (ret <0 ) goto out; -BUG_ON (con->state !=CON_STATE_CONNECTING ); con->state =CON_STATE_NEGOTIATING ;/*
@@ -2156,7 +2155,7 @@ more: goto more; } -BUG_ON (con->state !=CON_STATE_OPEN ); +WARN_ON (con->state !=CON_STATE_OPEN );if (con->in_base_pos <0 ) {/*
@@ -2370,7 +2369,7 @@ static void ceph_fault(struct ceph_connedout ("fault %p state %lu to peer %s\n" , con, con->state,ceph_pr_addr (&con->peer_addr.in_addr)); -BUG_ON (con->state !=CON_STATE_CONNECTING && +WARN_ON (con->state !=CON_STATE_CONNECTING && con->state !=CON_STATE_NEGOTIATING && con->state !=CON_STATE_OPEN );
Greg Kroah-Hartman
maintainerPATCH 151/171 libceph: fix protocol feature mismatch failure path
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sage Weil <[email protected]>
We should not set con->state to CLOSED here; that happens in ceph_fault() in the caller, where it first asserts that the state is not yet CLOSED. Avoids a BUG when the features don't match.
Since the fail_protocol() has become a trivial wrapper, replace calls to it with direct calls to reset_connection().
--- net/ceph/messenger.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
net/ceph/messenger.c +4 -10
@@ -506,6 +506,7 @@ static void reset_connection(struct ceph {/* reset connection, out_queue, msg_ and connect_seq */ /* discard existing out_queue and msg_seq */ +dout ("reset_connection %p\n" , con);ceph_msg_remove_list (&con->out_queue);ceph_msg_remove_list (&con->out_sent);
@@ -1502,13 +1503,6 @@ static int process_banner(struct ceph_coreturn 0 ; } -static void fail_protocol (struct ceph_connection *con) -{ -reset_connection (con); -WARN_ON (con->state !=CON_STATE_NEGOTIATING ); - con->state =CON_STATE_CLOSED ; -} -static int process_connect (struct ceph_connection *con) {u64 sup_feat = con->msgr->supported_features;
@@ -1526,7 +1520,7 @@ static int process_connect(struct ceph_cceph_pr_addr (&con->peer_addr.in_addr), sup_feat, server_feat, server_feat & ~sup_feat); con->error_msg ="missing required protocol features" ; -fail_protocol (con); +reset_connection (con);return -1 ;case CEPH_MSGR_TAG_BADPROTOVER :
@@ -1537,7 +1531,7 @@ static int process_connect(struct ceph_cle32_to_cpu (con->out_connect.protocol_version), le32_to_cpu(con->in_reply.protocol_version)); con->error_msg ="protocol version mismatch" ; -fail_protocol (con); +reset_connection (con);return -1 ;case CEPH_MSGR_TAG_BADAUTHORIZER :
@@ -1627,7 +1621,7 @@ static int process_connect(struct ceph_cceph_pr_addr (&con->peer_addr.in_addr), req_feat, server_feat, req_feat & ~server_feat); con->error_msg ="missing required protocol features" ; -fail_protocol (con); +reset_connection (con);return -1 ; }
Greg Kroah-Hartman
maintainerPATCH 152/171 libceph: fix osdmap decode error paths
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sage Weil <[email protected]>
Ensure that we set the err value correctly so that we do not pass a 0 value to ERR_PTR and confuse the calling code. (In particular, osd_client.c handle_map() will BUG(!newmap)).
--- net/ceph/osdmap.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
net/ceph/osdmap.c +20 -11
@@ -613,10 +613,12 @@ struct ceph_osdmap *osdmap_decode(void *ceph_decode_32_safe (p, end, max, bad);while (max--) {ceph_decode_need (p, end,4 +1 +sizeof (pi->v), bad); + err = -ENOMEM ; pi =kzalloc (sizeof (*pi),GFP_NOFS );if (!pi) goto bad; pi->id =ceph_decode_32 (p); + err = -EINVAL ; ev =ceph_decode_8 (p);/* encoding version */ if (ev >CEPH_PG_POOL_VERSION ) { pr_warning("got unknown v %d > %d of ceph_pg_pool\n",
@@ -632,8 +634,13 @@ struct ceph_osdmap *osdmap_decode(void *__insert_pg_pool (&map->pg_pools, pi); } -if (version >=5 &&__decode_pool_names (p, end, map) <0 ) - goto bad; +if (version >=5 ) { + err =__decode_pool_names (p, end, map); +if (err <0 ) { +dout ("fail to decode pool names" ); + goto bad; + } + }ceph_decode_32_safe (p, end, map->pool_max, bad);
@@ -713,7 +720,7 @@ struct ceph_osdmap *osdmap_decode(void *return map; bad: -dout ("osdmap_decode fail\n" ); +dout ("osdmap_decode fail err %d\n" , err);ceph_osdmap_destroy (map);return ERR_PTR (err); }
@@ -807,6 +814,7 @@ struct ceph_osdmap *osdmap_apply_incremeif (ev >CEPH_PG_POOL_VERSION ) {pr_warning ("got unknown v %d > %d of ceph_pg_pool\n" , ev,CEPH_PG_POOL_VERSION ); + err = -EINVAL ; goto bad; } pi =__lookup_pg_pool (&map->pg_pools, pool);
@@ -823,8 +831,11 @@ struct ceph_osdmap *osdmap_apply_incremeif (err <0 ) goto bad; } -if (version >=5 &&__decode_pool_names (p, end, map) <0 ) - goto bad; +if (version >=5 ) { + err =__decode_pool_names (p, end, map); +if (err <0 ) + goto bad; + }/* old_pool */ ceph_decode_32_safe (p, end, len, bad);
@@ -900,15 +911,13 @@ struct ceph_osdmap *osdmap_apply_increme (void )__remove_pg_mapping (&map->pg_temp, pgid);/* insert */ -if (pglen > (UINT_MAX -sizeof (*pg)) /sizeof (u32)) { - err = -EINVAL ; + err = -EINVAL ; +if (pglen > (UINT_MAX -sizeof (*pg)) /sizeof (u32)) goto bad; - } + err = -ENOMEM ; pg =kmalloc (sizeof (*pg) +sizeof (u32)*pglen,GFP_NOFS ); -if (!pg) { - err = -ENOMEM ; +if (!pg) goto bad; - } pg->pgid = pgid; pg->len = pglen;for (j =0 ; j < pglen; j++)
Greg Kroah-Hartman
maintainerPATCH 153/171 libceph: avoid using freed osd in __kick_osd_requests()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
If an osd has no requests and no linger requests, __reset_osd() will just remove it with a call to __remove_osd(). That drops a reference to the osd, and therefore the osd may have been free by the time __reset_osd() returns. That function offers no indication this may have occurred, and as a result the osd will continue to be used even when it's no longer valid.
Change__reset_osd() so it returns an error (ENODEV) when it deletes the osd being reset. And change __kick_osd_requests() so it returns immediately (before referencing osd again) if __reset_osd() returns *any* error.
--- net/ceph/osd_client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ceph/osd_client.c +2 -1
@@ -579,7 +579,7 @@ static void __kick_osd_requests(struct cdout ("__kick_osd_requests osd%d\n" , osd->o_osd); err =__reset_osd (osdc, osd); -if (err == -EAGAIN ) +if (err)return ;list_for_each_entry (req, &osd->o_requests, r_osd_item) {
@@ -750,6 +750,7 @@ static int __reset_osd(struct ceph_osd_cif (list_empty (&osd->o_requests) &&list_empty (&osd->o_linger_requests)) {__remove_osd (osdc, osd); + ret = -ENODEV ; } else if (memcmp(&osdc->osdmap->osd_addr[osd->o_osd], &osd->o_con.peer_addr, sizeof(osd->o_con.peer_addr)) == 0 &&
Greg Kroah-Hartman
maintainerPATCH 154/171 rbd: kill create_snap sysfs entry
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
Josh proposed the following change, and I don't think I could explain it any better than he did:
From: Josh Durgin <[email protected]>
Date: Tue, 24 Jul 2012 14:22:11 -0700
To: ceph-devel <[email protected]>
Message-ID: <[email protected]>
From: Josh Durgin <[email protected]>
Right now the kernel still has one piece of rbd management duplicated from the rbd command line tool: snapshot creation. There's nothing special about snapshot creation that makes it advantageous to do from the kernel, so I'd like to remove the create_snap sysfs interface. That is,
/sys/bus/rbd/devices/<id>/create_snap
would be removed.
Does anyone rely on the sysfs interface for creating rbd snapshots? If so, how hard would it be to replace with:
rbd snap create pool/image@snap
Is there any benefit to the sysfs interface that I'm missing?
Josh
This patch implements this proposal, removing the code that implements the "snap_create" sysfs interface for rbd images. As a result, quite a lot of other supporting code goes away.
[[email protected]: commented out rbd_req_sync_exec() to avoid warning]
(based on commit 02cdb02ceab1f3dd9ac2bc899fc51f0e0e744782)
--- Documentation/ABI/testing/sysfs-bus-rbd | 6 - drivers/block/rbd.c | 165 -------------------------------- 2 files changed, 2 insertions(+), 169 deletions(-)
Documentation/ABI/testing/sysfs-bus-rbd +0 -6
@@ -51,12 +51,6 @@ current_snap The current snapshot for which the device is mapped. -create_snap - - Create a snapshot: - - $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_create - snap_* A directory per each snapshot
drivers/block/rbd.c +2 -163
207 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 155/171 rbd: add read_only rbd map option
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
Add the ability to map an rbd image read-only, by specifying either "read_only" or "ro" as an option on the rbd "command line." Also allow the inverse to be explicitly specified using "read_write" or "rw".
(based on commit cc0538b62c839c2df7b9f8378bb37e3b35faa608)
--- drivers/block/rbd.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
drivers/block/rbd.c +24 -4
@@ -71,7 +71,8 @@#define DEV_NAME_LEN 32#define MAX_INT_FORMAT_WIDTH ((5 * sizeof (int)) / 2 + 1) -#define RBD_NOTIFY_TIMEOUT_DEFAULT 10 +#define RBD_NOTIFY_TIMEOUT_DEFAULT 10 +#define RBD_READ_ONLY_DEFAULT false/* * block device image metadata (in-memory version)
@@ -95,6 +96,7 @@ struct rbd_image_header {struct rbd_options {int notify_timeout; +bool read_only; };/*
@@ -180,7 +182,7 @@ struct rbd_device {u64 snap_id;/* current snapshot id */ /* whether the snap_id this device reads from still exists */ bool snap_exists; -int read_only; +bool read_only;struct list_head node;
@@ -346,12 +348,21 @@ enum {/* int args above */ Opt_last_string,/* string args above */ + Opt_read_only, + Opt_read_write, +/* Boolean args above */ + Opt_last_bool, };static match_table_t rbdopt_tokens = { {Opt_notify_timeout,"notify_timeout=%d" },/* int args above */ /* string args above */ + {Opt_read_only,"read_only" }, + {Opt_read_only,"ro" },/* Alternate spelling */ + {Opt_read_write,"read_write" }, + {Opt_read_write,"rw" },/* Alternate spelling */ +/* Boolean args above */ {-1 ,NULL } };
@@ -376,6 +387,8 @@ static int parse_rbd_opts_token(char *c, }else if (token > Opt_last_int && token < Opt_last_string) {dout ("got string token %d val %s\n" , token, argstr[0 ].from); + }else if (token > Opt_last_string && token < Opt_last_bool) { +dout ("got Boolean token %d\n" , token); }else {dout ("got token %d\n" , token); }
@@ -384,6 +397,12 @@ static int parse_rbd_opts_token(char *c,case Opt_notify_timeout: rbdopt->notify_timeout = intval;break ; +case Opt_read_only: + rbdopt->read_only = true; +break ; +case Opt_read_write: + rbdopt->read_only = false; +break ;default :BUG_ON (token); }
@@ -407,6 +426,7 @@ static struct rbd_client *rbd_get_clientreturn ERR_PTR (-ENOMEM ); rbd_opts->notify_timeout =RBD_NOTIFY_TIMEOUT_DEFAULT ; + rbd_opts->read_only =RBD_READ_ONLY_DEFAULT ; opt = ceph_parse_options(options, mon_addr, mon_addr + mon_addr_len,
@@ -590,7 +610,7 @@ static int rbd_header_set_snap(struct rb snapc->seq =0 ; dev->snap_id =CEPH_NOSNAP ; dev->snap_exists = false; - dev->read_only =0 ; + dev->read_only = dev->rbd_client->rbd_opts->read_only;if (size) *size = header->image_size; }else {
@@ -599,7 +619,7 @@ static int rbd_header_set_snap(struct rb goto done; dev->snap_id = snapc->seq; dev->snap_exists = true; - dev->read_only =1 ; + dev->read_only = true;/* No choice for snapshots */ } ret =0 ;
Greg Kroah-Hartman
maintainerPATCH 156/171 rbd: kill notify_timeout option
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
The "notify_timeout" rbd device option is never used, so get rid of it.
--- drivers/block/rbd.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/block/rbd.c +0 -8
@@ -71,7 +71,6 @@#define DEV_NAME_LEN 32#define MAX_INT_FORMAT_WIDTH ((5 * sizeof (int)) / 2 + 1) -#define RBD_NOTIFY_TIMEOUT_DEFAULT 10#define RBD_READ_ONLY_DEFAULT false/*
@@ -95,7 +94,6 @@ struct rbd_image_header { };struct rbd_options { -int notify_timeout;bool read_only; };
@@ -343,7 +341,6 @@ static struct rbd_client *__rbd_client_f* mount options */ enum { - Opt_notify_timeout, Opt_last_int,/* int args above */ Opt_last_string,
@@ -355,7 +352,6 @@ enum { };static match_table_t rbdopt_tokens = { - {Opt_notify_timeout,"notify_timeout=%d" },/* int args above */ /* string args above */ {Opt_read_only,"read_only" },
@@ -394,9 +390,6 @@ static int parse_rbd_opts_token(char *c, }switch (token) { -case Opt_notify_timeout: - rbdopt->notify_timeout = intval; -break ;case Opt_read_only: rbdopt->read_only = true;break ;
@@ -425,7 +418,6 @@ static struct rbd_client *rbd_get_clientif (!rbd_opts)return ERR_PTR (-ENOMEM ); - rbd_opts->notify_timeout =RBD_NOTIFY_TIMEOUT_DEFAULT ; rbd_opts->read_only =RBD_READ_ONLY_DEFAULT ; opt = ceph_parse_options(options, mon_addr,
Greg Kroah-Hartman
maintainerPATCH 157/171 libceph: remove osdtimeout option
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sage Weil <[email protected]>
This would reset a connection with any OSD that had an outstanding request that was taking more than N seconds. The idea was that if the OSD was buggy, the client could compensate by resending the request.
In reality, this only served to hide server bugs, and we haven't actually seen such a bug in quite a while. Moreover, the userspace client code never did this.
More importantly, often the request is taking a long time because the OSD is trying to recover, or overloaded, and killing the connection and retrying would only make the situation worse by giving the OSD more work to do.
--- fs/ceph/super.c | 2 - include/linux/ceph/libceph.h | 2 - net/ceph/ceph_common.c | 3 -- net/ceph/osd_client.c | 47 +++---------------------------------------- 4 files changed, 5 insertions(+), 49 deletions(-)
fs/ceph/super.c +0 -2
@@ -387,8 +387,6 @@ static int ceph_show_options(struct seq_seq_printf (m,",mount_timeout=%d" , opt->mount_timeout);if (opt->osd_idle_ttl !=CEPH_OSD_IDLE_TTL_DEFAULT )seq_printf (m,",osd_idle_ttl=%d" , opt->osd_idle_ttl); -if (opt->osd_timeout !=CEPH_OSD_TIMEOUT_DEFAULT ) -seq_printf (m,",osdtimeout=%d" , opt->osd_timeout);if (opt->osd_keepalive_timeout !=CEPH_OSD_KEEPALIVE_DEFAULT )seq_printf (m,",osdkeepalivetimeout=%d" , opt->osd_keepalive_timeout);
include/linux/ceph/libceph.h +0 -2
@@ -49,7 +49,6 @@ struct ceph_options {struct ceph_entity_addr my_addr;int mount_timeout;int osd_idle_ttl; -int osd_timeout;int osd_keepalive_timeout;/*
@@ -69,7 +68,6 @@ struct ceph_options {* defaults */ #define CEPH_MOUNT_TIMEOUT_DEFAULT 60 -#define CEPH_OSD_TIMEOUT_DEFAULT 60/* seconds */ #define CEPH_OSD_KEEPALIVE_DEFAULT 5#define CEPH_OSD_IDLE_TTL_DEFAULT 60
net/ceph/ceph_common.c +1 -2
@@ -304,7 +304,6 @@ ceph_parse_options(char *options, const/* start with defaults */ opt->flags =CEPH_OPT_DEFAULT ; - opt->osd_timeout =CEPH_OSD_TIMEOUT_DEFAULT ; opt->osd_keepalive_timeout =CEPH_OSD_KEEPALIVE_DEFAULT ; opt->mount_timeout =CEPH_MOUNT_TIMEOUT_DEFAULT ;/* seconds */ opt->osd_idle_ttl =CEPH_OSD_IDLE_TTL_DEFAULT ;/* seconds */
@@ -390,7 +389,7 @@ ceph_parse_options(char *options, const/* misc */ case Opt_osdtimeout: - opt->osd_timeout = intval; +pr_warning ("ignoring deprecated osdtimeout option\n" );break ;case Opt_osdkeepalivetimeout: opt->osd_keepalive_timeout = intval;
net/ceph/osd_client.c +4 -43
74 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 158/171 ceph: dont reference req after put
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
In __unregister_request(), there is a call to list_del_init() referencing a request that was the subject of a call to ceph_osdc_put_request() on the previous line. This is not safe, because the request structure could have been freed by the time we reach the list_del_init().
Fix this by reversing the order of these lines.
--- net/ceph/osd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/osd_client.c +1 -1
@@ -871,9 +871,9 @@ static void __unregister_request(struct req->r_osd =NULL ; } +list_del_init (&req->r_req_lru_item);ceph_osdc_put_request (req); -list_del_init (&req->r_req_lru_item);if (osdc->num_requests ==0 ) {dout (" no requests, canceling timeout\n" );__cancel_osd_timeout (osdc);
Greg Kroah-Hartman
maintainerPATCH 159/171 rbd: remove linger unconditionally
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
In __unregister_linger_request(), the request is being removed from the osd client's req_linger list only when the request has a non-null osd pointer. It should be done whether or not the request currently has an osd.
This is most likely a non-issue because I believe the request will always have an osd when this function is called.
--- net/ceph/osd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/osd_client.c +1 -1
@@ -905,8 +905,8 @@ static void __unregister_linger_request( struct ceph_osd_request *req) {dout ("__unregister_linger_request %p\n" , req); +list_del_init (&req->r_linger_item);if (req->r_osd) { -list_del_init (&req->r_linger_item);list_del_init (&req->r_linger_osd); if (list_empty(&req->r_osd->o_requests) &&
Greg Kroah-Hartman
maintainerPATCH 160/171 rbd: BUG on invalid layout
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sage Weil <[email protected]>
This shouldn't actually be possible because the layout struct is constructed from the RBD header and validated then.
[[email protected]: converted BUG() call to equivalent rbd_assert()]
(based on commit 6cae3717cddaf8e5e96e304733dca66e40d56f89)
--- drivers/block/rbd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/rbd.c +3 -2
@@ -930,8 +930,9 @@ static int rbd_do_request(struct request layout->fl_object_size =cpu_to_le32 (1 <<RBD_MAX_OBJ_ORDER ); layout->fl_pg_preferred =cpu_to_le32 (-1 ); layout->fl_pg_pool =cpu_to_le32 (dev->poolid); -ceph_calc_raw_layout (osdc, layout, snapid, ofs, &len, &bno, - req, ops); + ret =ceph_calc_raw_layout (osdc, layout, snapid, ofs, &len, &bno, + req, ops); +BUG_ON (ret !=0 ); ceph_osdc_build_request(req, ofs, &len, ops,
Greg Kroah-Hartman
maintainerPATCH 161/171 rbd: fix bug in rbd_dev_id_put()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
In rbd_dev_id_put(), there's a loop that's intended to determine the maximum device id in use. But it isn't doing that at all, the effect of how it's written is to simply use the just-put id number, which ignores whole purpose of this function.
Fix the bug.
--- drivers/block/rbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/rbd.c +2 -2
@@ -2150,8 +2150,8 @@ static void rbd_id_put(struct rbd_devicestruct rbd_device *rbd_dev; rbd_dev = list_entry(tmp, struct rbd_device, node); -if (rbd_id > max_id) - max_id = rbd_id; +if (rbd_dev->id > max_id) + max_id = rbd_dev->id; }spin_unlock (&rbd_dev_list_lock);
Greg Kroah-Hartman
maintainerPATCH 162/171 rbd: do not allow remove of mounted-on image
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
There is no check in rbd_remove() to see if anybody holds open the image being removed. That's not cool.
Add a simple open count that goes up and down with opens and closes (releases) of the device, and don't allow an rbd image to be removed if the count is non-zero.
Protect the updates of the open count value with ctl_mutex to ensure the underlying rbd device doesn't get removed while concurrently being opened.
(based on commit 42382b709bd1d143b9f0fa93e0a3a1f2f4210707)
--- drivers/block/rbd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/block/rbd.c +13 -0
@@ -189,6 +189,7 @@ struct rbd_device {/* sysfs related */ struct device dev; +unsigned long open_count; };static DEFINE_MUTEX (ctl_mutex);/* Serialize open/close/setup/teardown */
@@ -249,8 +250,11 @@ static int rbd_open(struct block_deviceif ((mode &FMODE_WRITE ) && rbd_dev->read_only)return -EROFS ; +mutex_lock_nested (&ctl_mutex,SINGLE_DEPTH_NESTING );rbd_get_dev (rbd_dev);set_device_ro (bdev, rbd_dev->read_only); + rbd_dev->open_count++; +mutex_unlock (&ctl_mutex);return 0 ; }
@@ -259,7 +263,11 @@ static int rbd_release(struct gendisk *d {struct rbd_device *rbd_dev = disk->private_data; +mutex_lock_nested (&ctl_mutex,SINGLE_DEPTH_NESTING ); +BUG_ON (!rbd_dev->open_count); + rbd_dev->open_count--;rbd_put_dev (rbd_dev); +mutex_unlock (&ctl_mutex);return 0 ; }
@@ -2448,6 +2456,11 @@ static ssize_t rbd_remove(struct bus_typ goto done; } +if (rbd_dev->open_count) { + ret = -EBUSY ; + goto done; + } +__rbd_remove_all_snaps (rbd_dev);rbd_bus_del_dev (rbd_dev);
Greg Kroah-Hartman
maintainerPATCH 163/171 ceph: Dont update i_max_size when handling non-auth cap
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Yan, Zheng" <[email protected]>
The cap from non-auth mds doesn't have a meaningful max_size value.
--- fs/ceph/caps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/caps.c +1 -1
@@ -2388,7 +2388,7 @@ static void handle_cap_grant(struct inod &atime);/* max size increase? */ -if (max_size != ci->i_max_size) { +if (ci->i_auth_cap == cap && max_size != ci->i_max_size) {dout ("max_size %lld -> %llu\n" , ci->i_max_size, max_size); ci->i_max_size = max_size;if (max_size >= ci->i_wanted_max_size) {
Greg Kroah-Hartman
maintainerPATCH 164/171 ceph: Fix infinite loop in __wake_requests
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Yan, Zheng" <[email protected]>
__wake_requests() will enter infinite loop if we use it to wake requests in the session->s_waiting list. __wake_requests() deletes requests from the list and __do_request() adds requests back to the list.
--- fs/ceph/mds_client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/ceph/mds_client.c +7 -2
@@ -1886,9 +1886,14 @@ finish:static void __wake_requests (struct ceph_mds_client *mdsc,struct list_head *head) { -struct ceph_mds_request *req, *nreq; +struct ceph_mds_request *req; +LIST_HEAD (tmp_list); -list_for_each_entry_safe (req, nreq, head, r_wait) { +list_splice_init (head, &tmp_list); + +while (!list_empty (&tmp_list)) { + req =list_entry (tmp_list.next, + struct ceph_mds_request, r_wait);list_del_init (&req->r_wait);__do_request (mdsc, req); }
Greg Kroah-Hartman
maintainerPATCH 165/171 ceph: Dont add dirty inode to dirty list if caps is in migration
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Yan, Zheng" <[email protected]>
Add dirty inode to cap_dirty_migrating list instead, this can avoid ceph_flush_dirty_caps() entering infinite loop.
--- fs/ceph/caps.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/ceph/caps.c +7 -3
@@ -1349,11 +1349,15 @@ int __ceph_mark_dirty_caps(struct ceph_iif (!ci->i_head_snapc) ci->i_head_snapc =ceph_get_snap_context ( ci->i_snap_realm->cached_context); -dout (" inode %p now dirty snapc %p\n" , &ci->vfs_inode, - ci->i_head_snapc); +dout (" inode %p now dirty snapc %p auth cap %p\n" , + &ci->vfs_inode, ci->i_head_snapc, ci->i_auth_cap);BUG_ON (!list_empty (&ci->i_dirty_item));spin_lock (&mdsc->cap_dirty_lock); -list_add (&ci->i_dirty_item, &mdsc->cap_dirty); +if (ci->i_auth_cap) +list_add (&ci->i_dirty_item, &mdsc->cap_dirty); +else +list_add (&ci->i_dirty_item, + &mdsc->cap_dirty_migrating);spin_unlock (&mdsc->cap_dirty_lock);if (ci->i_flushing_caps ==0 ) {ihold (inode);
Greg Kroah-Hartman
maintainerPATCH 166/171 ceph: Fix __ceph_do_pending_vmtruncate
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Yan, Zheng" <[email protected]>
we should set i_truncate_pending to 0 after page cache is truncated to i_truncate_size
--- fs/ceph/inode.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
fs/ceph/inode.c +9 -6
@@ -1466,7 +1466,7 @@ void __ceph_do_pending_vmtruncate(struct {struct ceph_inode_info *ci =ceph_inode (inode);u64 to; -int wrbuffer_refs, wake =0 ; +int wrbuffer_refs, finish =0 ; retry:spin_lock (&ci->i_ceph_lock);
@@ -1498,15 +1498,18 @@ retry:truncate_inode_pages (inode->i_mapping, to);spin_lock (&ci->i_ceph_lock); - ci->i_truncate_pending--; -if (ci->i_truncate_pending ==0 ) - wake =1 ; +if (to == ci->i_truncate_size) { + ci->i_truncate_pending =0 ; + finish =1 ; + }spin_unlock (&ci->i_ceph_lock); +if (!finish) + goto retry;if (wrbuffer_refs ==0 )ceph_check_caps (ci,CHECK_CAPS_AUTHONLY ,NULL ); -if (wake) -wake_up_all (&ci->i_cap_wq); + +wake_up_all (&ci->i_cap_wq); }
Greg Kroah-Hartman
maintainerPATCH 167/171 ceph: call handle_cap_grant() for cap import message
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Yan, Zheng" <[email protected]>
If client sends cap message that requests new max size during exporting caps, the exporting MDS will drop the message quietly. So the client may wait for the reply that updates the max size forever. call handle_cap_grant() for cap import message can avoid this issue.
--- fs/ceph/caps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ceph/caps.c +2 -2
@@ -2749,6 +2749,7 @@ static void handle_cap_import(struct cep/* make sure we re-request max_size, if necessary */ spin_lock (&ci->i_ceph_lock); + ci->i_wanted_max_size =0 ;/* reset */ ci->i_requested_max_size =0 ;spin_unlock (&ci->i_ceph_lock); }
@@ -2844,8 +2845,6 @@ void ceph_handle_caps(struct ceph_mds_secase CEPH_CAP_OP_IMPORT :handle_cap_import (mdsc, inode, h, session, snaptrace, snaptrace_len); -ceph_check_caps (ceph_inode (inode),0 , session); - goto done_unlocked; }/* the rest require a cap */
@@ -2862,6 +2861,7 @@ void ceph_handle_caps(struct ceph_mds_seswitch (op) {case CEPH_CAP_OP_REVOKE :case CEPH_CAP_OP_GRANT : +case CEPH_CAP_OP_IMPORT :handle_cap_grant (inode, h, session, cap, msg->middle); goto done_unlocked;
Greg Kroah-Hartman
maintainerPATCH 168/171 libceph: Unlock unprocessed pages in start_read() error path
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Zafman <[email protected]>
Function start_read() can get an error before processing all pages. It must not only release the remaining pages, but unlock them too.
This fixes http://tracker.newdream.net/issues/3370
--- fs/ceph/addr.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/ceph/addr.c +9 -0
@@ -267,6 +267,14 @@ static void finish_read(struct ceph_osd_kfree (req->r_pages); } +static void ceph_unlock_page_vector (struct page **pages,int num_pages) +{ +int i; + +for (i =0 ; i < num_pages; i++) +unlock_page (pages[i]); +} +/* * start an async read(ahead) operation. return nr_pages we submitted * a read for on success, or negative error code.
@@ -347,6 +355,7 @@ static int start_read(struct inode *inodreturn nr_pages; out_pages: +ceph_unlock_page_vector (pages, nr_pages);ceph_release_page_vector (pages, nr_pages); out:ceph_osdc_put_request (req);
Greg Kroah-Hartman
maintainerPATCH 169/171 staging: comedi: dont hijack hardware device private data
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit c43435d7722134ed1fda58ce1025f41029bd58ad upstream.
comedi_auto_config() associates a Comedi minor device number with an auto-configured hardware device and comedi_auto_unconfig() disassociates it. Currently, these use the hardware device's private data pointer to point to some allocated storage holding the minor device number. This is a bit of a waste of the hardware device's private data pointer, preventing it from being used for something more useful by the low-level comedi device drivers. For example, it would make more sense if comedi_usb_auto_config() was passed a pointer to the struct usb_interface instead of the struct usb_device, but this cannot be done currently because the low-level comedi drivers already use the private data pointer in the struct usb_interface for something more useful.
This patch stops the comedi core hijacking the hardware device's private data pointer. Instead, comedi_auto_config() stores a pointer to the hardware device's struct device in the struct comedi_device_file_info associated with the minor device number, and comedi_auto_unconfig() calls new function comedi_find_board_minor() to recover the minor device number associated with the hardware device.
--- drivers/staging/comedi/comedi_fops.c | 18 ++++++++++++++++++ drivers/staging/comedi/comedidev.h | 1 + drivers/staging/comedi/drivers.c | 34 ++++++++++------------------------ drivers/staging/comedi/internal.h | 1 + 4 files changed, 30 insertions(+), 24 deletions(-)
drivers/staging/comedi/comedi_fops.c +18 -0
@@ -2210,6 +2210,7 @@ int comedi_alloc_board_minor(struct devikfree (info);return -ENOMEM ; } + info->hardware_device = hardware_device;comedi_device_init (info->device);spin_lock_irqsave (&comedi_file_info_table_lock, flags);for (i =0 ; i <COMEDI_NUM_BOARD_MINORS ; ++i) {
@@ -2298,6 +2299,23 @@ void comedi_free_board_minor(unsigned mi } } +int comedi_find_board_minor (struct device *hardware_device) +{ +int minor; +struct comedi_device_file_info *info; + +for (minor =0 ; minor <COMEDI_NUM_BOARD_MINORS ; minor++) { +spin_lock (&comedi_file_info_table_lock); + info = comedi_file_info_table[minor]; +if (info && info->hardware_device == hardware_device) { +spin_unlock (&comedi_file_info_table_lock); +return minor; + } +spin_unlock (&comedi_file_info_table_lock); + } +return -ENODEV ; +} +int comedi_alloc_subdevice_minor (struct comedi_device *dev,struct comedi_subdevice *s) {
drivers/staging/comedi/comedidev.h +1 -0
@@ -234,6 +234,7 @@ struct comedi_device_file_info {struct comedi_device *device;struct comedi_subdevice *read_subdevice;struct comedi_subdevice *write_subdevice; +struct device *hardware_device; };#ifdef CONFIG_COMEDI_DEBUG
drivers/staging/comedi/drivers.c +10 -24
@@ -822,25 +822,14 @@ static int comedi_auto_config(struct devint minor;struct comedi_device_file_info *dev_file_info;int retval; -unsigned *private_data =NULL ; -if (!comedi_autoconfig) { -dev_set_drvdata (hardware_device,NULL ); +if (!comedi_autoconfig)return 0 ; - } minor =comedi_alloc_board_minor (hardware_device);if (minor <0 )return minor; - private_data =kmalloc (sizeof (unsigned ),GFP_KERNEL ); -if (private_data ==NULL ) { - retval = -ENOMEM ; - goto cleanup; - } - *private_data = minor; -dev_set_drvdata (hardware_device, private_data); - dev_file_info =comedi_get_device_file_info (minor);memset (&it,0 ,sizeof (it));
@@ -853,25 +842,22 @@ static int comedi_auto_config(struct dev retval =comedi_device_attach (dev_file_info->device, &it);mutex_unlock (&dev_file_info->device->mutex); -cleanup: -if (retval <0 ) { -kfree (private_data); +if (retval <0 )comedi_free_board_minor (minor); - }return retval; }static void comedi_auto_unconfig (struct device *hardware_device) { -unsigned *minor = (unsigned *)dev_get_drvdata (hardware_device); -if (minor ==NULL ) -return ; - -BUG_ON (*minor >=COMEDI_NUM_BOARD_MINORS ); +int minor; -comedi_free_board_minor (*minor); -dev_set_drvdata (hardware_device,NULL ); -kfree (minor); +if (hardware_device ==NULL ) +return ; + minor =comedi_find_board_minor (hardware_device); +if (minor <0 ) +return ; +BUG_ON (minor >=COMEDI_NUM_BOARD_MINORS ); +comedi_free_board_minor (minor); }int comedi_pci_auto_config (struct pci_dev *pcidev,const char *board_name)
drivers/staging/comedi/internal.h +1 -0
@@ -7,6 +7,7 @@ int insn_inval(struct comedi_device *dev struct comedi_insn *insn, unsigned int *data);int comedi_alloc_board_minor (struct device *hardware_device);void comedi_free_board_minor (unsigned minor); +int comedi_find_board_minor (struct device *hardware_device);void comedi_reset_async_buf (struct comedi_async *async);int comedi_buf_alloc (struct comedi_device *dev,struct comedi_subdevice *s,unsigned long new_size);
Greg Kroah-Hartman
maintainerPATCH 170/171 staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 34ffb33e09132401872fe79e95c30824ce194d23 upstream.
The 'ni_at_a2150' module links to cfc_write_to_buffer in the 'comedi_fc' module, so selecting 'COMEDI_NI_AT_A2150' in the kernel config needs to also select 'COMEDI_FC'.
--- drivers/staging/comedi/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/comedi/Kconfig +1 -0
@@ -424,6 +424,7 @@ config COMEDI_ADQ12B config COMEDI_NI_AT_A2150 tristate "NI AT-A2150 ISA card support" + select COMEDI_FC depends on COMEDI_NI_COMMON depends on VIRT_TO_BUS default N
Greg Kroah-Hartman
maintainerPATCH 171/171 USB: fix endpoint-disabling for failed config changes
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
commit 36caff5d795429c572443894e8789c2150dd796b upstream.
This patch (as1631) fixes a bug that shows up when a config change fails for a device under an xHCI controller. The controller needs to be told to disable the endpoints that have been enabled for the new config. The existing code does this, but before storing the information about which endpoints were enabled! As a result, any second attempt to install the new config is doomed to fail because xhci-hcd will refuse to enable an endpoint that is already enabled.
The patch optimistically initializes the new endpoints' device structures before asking the device to switch to the new config. If the request fails then the endpoint information is already stored, so we can use usb_hcd_alloc_bandwidth() to disable the endpoints with no trouble. The rest of the error path is slightly more complex now; we have to disable the new interfaces and call put_device() rather than simply deallocating them.
--- drivers/usb/core/message.c | 53 ++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 22 deletions(-)
drivers/usb/core/message.c +31 -22
@@ -1770,28 +1770,8 @@ free_interfaces: goto free_interfaces; } - ret =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ), -USB_REQ_SET_CONFIGURATION ,0 , configuration,0 , -NULL ,0 ,USB_CTRL_SET_TIMEOUT ); -if (ret <0 ) { -/* All the old state is gone, so what else can we do? -* The device is probably useless now anyway. -*/ - cp =NULL ; - } - - dev->actconfig = cp; -if (!cp) { -usb_set_device_state (dev,USB_STATE_ADDRESS ); -usb_hcd_alloc_bandwidth (dev,NULL ,NULL ,NULL ); -mutex_unlock (hcd->bandwidth_mutex); -usb_autosuspend_device (dev); - goto free_interfaces; - } -mutex_unlock (hcd->bandwidth_mutex); -usb_set_device_state (dev,USB_STATE_CONFIGURED ); - -/* Initialize the new interface structures and the +/* +* Initialize the new interface structures and the * hc/hcd/usbcore interface/endpoint state. */ for (i =0 ; i < nintf; ++i) {
@@ -1835,6 +1815,35 @@ free_interfaces: }kfree (new_interfaces); + ret =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ), +USB_REQ_SET_CONFIGURATION ,0 , configuration,0 , +NULL ,0 ,USB_CTRL_SET_TIMEOUT ); +if (ret <0 && cp) { +/* +* All the old state is gone, so what else can we do? +* The device is probably useless now anyway. +*/ +usb_hcd_alloc_bandwidth (dev,NULL ,NULL ,NULL ); +for (i =0 ; i < nintf; ++i) { +usb_disable_interface (dev, cp->interface[i], true); +put_device (&cp->interface[i]->dev); + cp->interface[i] =NULL ; + } + cp =NULL ; + } + + dev->actconfig = cp; +mutex_unlock (hcd->bandwidth_mutex); + +if (!cp) { +usb_set_device_state (dev,USB_STATE_ADDRESS ); + +/* Leave LPM disabled while the device is unconfigured. */ +usb_autosuspend_device (dev); +return ret; + } +usb_set_device_state (dev,USB_STATE_CONFIGURED ); +if (cp->string ==NULL && !(dev->quirks &USB_QUIRK_CONFIG_INTF_STRINGS )) cp->string =usb_cache_string (dev, cp->desc.iConfiguration);
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.4.26 release. There are 171 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 Jan 17 22:42:47 UTC 2013. Anything received after that time might be too late.
Quoted 7 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.26-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Patches applied cleanly to 3.0.y, 3.4.y, and 3.7.y. Compiled and booted on the following systems:
HP EliteBook 6930p Intel(R) Core(TM)2 Duo CPU T9400 @ 2.53GHz HP ProBook 6475b AMD A10-4600M APU with Radeon(tm) HD Graphics
Cross-compile tests:
alpha: defconfig passed on all
arm: defconfig passed on all
arm64: not applicable to 3.0.y, 3.4.y. defconfig passed on 3.7.y
c6x: not applicable to 3.0.y, defconfig passed on 3.4.y, and 3.7.y.
mips: defconfig passed on all
mipsel: defconfig passed on all
powerpc: wii_defconfig passed on all
sh: defconfig passed on all
sparc: defconfig passed on all
tile: tilegx_defconfig passed on all
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 14 lines · Shuah Khan
Quoted 12 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.4.26 release. There are 171 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 Jan 17 22:42:47 UTC 2013. 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.4.26-rc1.gzand the diffstat can be found below.
Quoted 8 lines
Quoted 3 lines
thanks,
greg k-h
Patches applied cleanly to 3.0.y, 3.4.y, and 3.7.y. Compiled and booted on the following systems:
HP EliteBook 6930p Intel(R) Core(TM)2 Duo CPU T9400 @ 2.53GHz HP ProBook 6475b AMD A10-4600M APU with Radeon(tm) HD Graphics
Thanks for testing.
greg k-h