3.10.30-stable review
Greg Kroah-Hartman
maintainercover 3.10.30-stable review
This is the start of the stable review cycle for the 3.10.30 release. There are 79 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 Feb 13 18:46:56 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.30-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.30-rc1
Dirk Brandewie <[email protected]>
intel_pstate: Correct calculation of min pstate value
Brennan Shacklett <[email protected]>
intel_pstate: Improve accuracy by not truncating until final result
Srinivas Pandruvada <[email protected]>
intel_pstate: fix no_turbo
Nell Hardcastle <[email protected]>
intel_pstate: Add Haswell CPU models
John Stultz <[email protected]>
timekeeping: Avoid possible deadlock from clock_was_set_delayed
Borislav Petkov <[email protected]>
rtc-cmos: Add an alarm disable quirk
John Stultz <[email protected]>
timekeeping: Fix missing timekeeping_update in suspend path
John Stultz <[email protected]>
timekeeping: Fix CLOCK_TAI timer/nanosleep delays
John Stultz <[email protected]>
timekeeping: Fix lost updates to tai adjustment
Steven Rostedt <[email protected]>
ftrace: Have function graph only trace based on global_ops filters
Steven Rostedt <[email protected]>
ftrace: Fix synchronization location disabling and freeing ftrace_ops
Steven Rostedt <[email protected]>
ftrace: Synchronize setting function_trace_op with ftrace_trace_function
Seth Heasley <[email protected]>
i2c: i801: SMBus patch for Intel Coleto Creek DeviceIDs
Seth Heasley <[email protected]>
mfd: lpc_ich: iTCO_wdt patch for Intel Coleto Creek DeviceIDs
James Ralston <[email protected]>
mfd: lpc_ich: Add support for Intel Avoton SoC
Dave Airlie <[email protected]>
drm/mgag200: fix typo causing bw limits to be ignored on some chips
Takashi Iwai <[email protected]>
drm/cirrus: correct register values for 16bpp
Stanislaw Gruszka <[email protected]>
i915: remove pm_qos request on error
Todd Previte <[email protected]>
drm/i915: VLV2 - Fix hotplug detect bits
Akash Goel <[email protected]>
drm/i915: Fix the offset issue for the stolen GEM objects
Chris Wilson <[email protected]>
drm/i915: Flush outstanding requests before allocating new seqno
Maarten Lankhorst <[email protected]>
drm/nouveau: fix m2mf copy to tiled gart
Mikulas Patocka <[email protected]>
dm sysfs: fix a module unload race
Alex Deucher <[email protected]>
drm/radeon/DCE4+: clear bios scratch dpms bit (v2)
Alex Deucher <[email protected]>
drm/radeon: fix DAC interrupt handling on DCE5+
Alex Deucher <[email protected]>
drm/radeon: set the full cache bit for fences on r7xx+
Alex Deucher <[email protected]>
drm/radeon: fix surface sync in fence on cayman (v2)
Alex Deucher <[email protected]>
drm/radeon: disable ss on DP for DCE3.x
Marek Olšák <[email protected]>
drm/radeon: skip colorbuffer checking if COLOR_INFO.FORMAT is set to INVALID
Malcolm Priestley <[email protected]>
m88rs2000: set symbol rate accurately
Malcolm Priestley <[email protected]>
m88rs2000: add m88rs2000_set_carrieroffset
Olivier Grenie <[email protected]>
dib8000: fix regression with dib807x
Mauro Carvalho Chehab <[email protected]>
nxt200x: increase write buffer size
Marek Szyprowski <[email protected]>
media: s5p_mfc: remove s5p_mfc_get_node_type() function
Mauro Carvalho Chehab <[email protected]>
dib8000: make 32 bits read atomic
Antti Palosaari <[email protected]>
media: anysee: fix non-working E30 Combo Plus DVB-T
David Rientjes <[email protected]>
mm, oom: base root bonus on current usage
Michel Dänzer <[email protected]>
radeon/pm: Guard access to rdev->pm.power_state array
Alex Deucher <[email protected]>
drm/radeon: warn users when hw_i2c is enabled (v2)
Joe Thornber <[email protected]>
dm space map metadata: fix bug in resizing of thin metadata
Joe Thornber <[email protected]>
dm space map metadata: fix extending the space map
Joe Thornber <[email protected]>
dm space map common: make sure new space is used during extend
Mikulas Patocka <[email protected]>
dm: wait until embedded kobject is released before destroying a device
Mike Snitzer <[email protected]>
dm thin: initialize dm_thin_new_mapping returned by get_next_mapping
Joe Thornber <[email protected]>
dm thin: fix discard support to a previously shared block
Weston Andros Adamson <[email protected]>
sunrpc: Fix infinite loop in RPC state machine
Boaz Harrosh <[email protected]>
pnfs: Proper delay for NFS4ERR_RECALLCONFLICT in layout_get_done
Weston Andros Adamson <[email protected]>
nfs4: fix discover_server_trunking use after free
Trond Myklebust <[email protected]>
NFSv4.1: Handle errors correctly in nfs41_walk_client_list
Weston Andros Adamson <[email protected]>
nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME
Trond Myklebust <[email protected]>
NFSv4: OPEN must handle the NFS4ERR_IO return code correctly
Daniel Santos <[email protected]>
spidev: fix hang when transfer_one_message fails
Jonas Gorski <[email protected]>
spi/bcm63xx: don't substract prepend length from total length
Ira Weiny <[email protected]>
IB/qib: Fix QP check when looping back to/from QP1
Max Filippov <[email protected]>
xtensa: xtfpga: fix definitions of platform devices
Boaz Harrosh <[email protected]>
ore: Fix wrong math in allocation of per device BIO
Michael Grzeschik <[email protected]>
mtd: mxc_nand: remove duplicated ecc_stats counting
Heiko Carstens <[email protected]>
tile: remove compat_sys_lookup_dcookie declaration to fix compile error
Heiko Carstens <[email protected]>
fs/compat: fix lookup_dcookie() parameter handling
Heiko Carstens <[email protected]>
fs/compat: fix parameter handling for compat readv/writev syscalls
Heiko Carstens <[email protected]>
compat: fix sys_fanotify_mark
Mark Brown <[email protected]>
ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API
Josh Triplett <[email protected]>
turbostat: Use GCC's CPUID functions to support PIC
Josh Triplett <[email protected]>
turbostat: Don't put unprocessed uapi headers in the include path
Li Zefan <[email protected]>
slub: Fix calculation of cpu slabs
Ludovic Desroches <[email protected]>
mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
Ray Jui <[email protected]>
mmc: fix host release issue after discard operation
Johannes Weiner <[email protected]>
mm/page-writeback.c: do not count anon pages as dirtyable memory
Johannes Weiner <[email protected]>
mm/page-writeback.c: fix dirty_balance_reserve subtraction from dirtyable memory
Naoya Horiguchi <[email protected]>
mm/memory-failure.c: shift page lock from head page to tail page after thp split
AKASHI Takahiro <[email protected]>
audit: correct a type mismatch in audit_syscall_exit()
Richard Guy Briggs <[email protected]>
audit: reset audit backlog wait time after error recovery
Miklos Szeredi <[email protected]>
fuse: fix pipe_buf_operations
Bjorn Helgaas <[email protected]>
Revert "EISA: Initialize device before its resources"
Alex Williamson <[email protected]>
intel-iommu: fix off-by-one in pagetable freeing
Wanlong Gao <[email protected]>
arch/sh/kernel/kgdb.c: add missing #include <linux/sched.h>
Steven Rostedt (Red Hat) <[email protected]>
tracing: Check if tracing is enabled in trace_puts()
Steven Rostedt (Red Hat) <[email protected]>
tracing: Have trace buffer point back to trace_array
Tetsuo Handa <[email protected]>
SELinux: Fix memory leak upon loading policy
-------------
Diffstat:
Documentation/filesystems/proc.txt | 4 +- Documentation/i2c/busses/i2c-i801 | 1 + Makefile | 4 +- arch/sh/kernel/kgdb.c | 1 + arch/tile/include/asm/compat.h | 1 - arch/xtensa/platforms/xtfpga/setup.c | 12 +- drivers/acpi/bus.c | 9 ++ drivers/cpufreq/intel_pstate.c | 48 +++--- drivers/eisa/eisa-bus.c | 26 ++-- drivers/gpu/drm/cirrus/cirrus_mode.c | 4 +- drivers/gpu/drm/i915/i915_dma.c | 1 + drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +- drivers/gpu/drm/i915/i915_reg.h | 10 +- drivers/gpu/drm/i915/intel_dp.c | 40 +++-- drivers/gpu/drm/i915/intel_ringbuffer.c | 12 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 4 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 33 +--- drivers/gpu/drm/radeon/atombios_crtc.c | 5 +- drivers/gpu/drm/radeon/evergreen.c | 4 +- drivers/gpu/drm/radeon/evergreen_cs.c | 5 +- drivers/gpu/drm/radeon/ni.c | 16 +- drivers/gpu/drm/radeon/nid.h | 1 + drivers/gpu/drm/radeon/r600.c | 13 +- drivers/gpu/drm/radeon/r600_cs.c | 5 +- drivers/gpu/drm/radeon/r600d.h | 1 + drivers/gpu/drm/radeon/radeon_atombios.c | 4 + drivers/gpu/drm/radeon/radeon_i2c.c | 3 + drivers/gpu/drm/radeon/radeon_pm.c | 6 +- drivers/gpu/drm/radeon/si.c | 2 +- drivers/gpu/drm/radeon/sid.h | 2 +- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-i801.c | 3 + drivers/infiniband/hw/qib/qib_ud.c | 9 +- drivers/iommu/intel-iommu.c | 2 +- drivers/md/Kconfig | 4 + drivers/md/Makefile | 1 + drivers/md/dm-builtin.c | 48 ++++++ drivers/md/dm-sysfs.c | 5 +- drivers/md/dm-thin-metadata.c | 20 +++ drivers/md/dm-thin-metadata.h | 2 + drivers/md/dm-thin.c | 31 ++-- drivers/md/dm.c | 15 +- drivers/md/dm.h | 17 ++ drivers/md/persistent-data/dm-space-map-common.c | 6 +- drivers/md/persistent-data/dm-space-map-metadata.c | 28 +++- drivers/media/dvb-frontends/dib8000.c | 42 +++-- drivers/media/dvb-frontends/m88rs2000.c | 117 ++++++++++---- drivers/media/dvb-frontends/m88rs2000.h | 2 + drivers/media/dvb-frontends/nxt200x.c | 2 +- drivers/media/platform/s5p-mfc/s5p_mfc.c | 28 +--- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 9 -- drivers/media/usb/dvb-usb-v2/anysee.c | 3 +- drivers/mfd/lpc_ich.c | 17 ++ drivers/mmc/card/block.c | 7 +- drivers/mmc/host/atmel-mci.c | 13 +- drivers/mtd/nand/mxc_nand.c | 1 - drivers/rtc/rtc-cmos.c | 52 ++++++- drivers/spi/spi-bcm63xx.c | 2 - drivers/spi/spi.c | 4 +- fs/dcookies.c | 2 +- fs/exofs/ore.c | 37 +++-- fs/fuse/dev.c | 22 +-- fs/nfs/nfs4client.c | 18 +-- fs/nfs/nfs4proc.c | 38 ++++- fs/nfs/nfs4xdr.c | 47 ++++-- fs/notify/fanotify/fanotify_user.c | 4 +- fs/read_write.c | 16 +- fs/splice.c | 18 +++ include/linux/audit.h | 2 +- include/linux/compat.h | 18 +-- include/linux/pipe_fs_i.h | 2 + include/linux/vmstat.h | 3 - include/scsi/osd_ore.h | 1 + kernel/audit.c | 5 +- kernel/time/timekeeping.c | 33 ++-- kernel/trace/ftrace.c | 171 ++++++++++++++++++--- kernel/trace/trace.c | 8 + mm/memory-failure.c | 21 +-- mm/oom_kill.c | 2 +- mm/page-writeback.c | 57 ++++--- mm/slub.c | 8 +- mm/vmscan.c | 49 ++---- net/core/skbuff.c | 32 +--- net/sunrpc/clnt.c | 8 +- security/selinux/ss/policydb.c | 14 +- tools/power/x86/turbostat/Makefile | 2 +- tools/power/x86/turbostat/turbostat.c | 13 +- 87 files changed, 955 insertions(+), 466 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/79 SELinux: Fix memory leak upon loading policy
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 8ed814602876bec9bad2649ca17f34b499357a1c upstream.
Hello.
I got below leak with linux-3.10.0-54.0.1.el7.x86_64 .
[ 681.903890] kmemleak: 5538 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
Below is a patch, but I don't know whether we need special handing for undoing ebitmap_set_bit() call.
----------
Quoted 1 line
Quoted 1 line
Quoted 1 line
From
fe97527a90fe95e2239dfbaa7558f0ed559c0992Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Mon, 6 Jan 2014 16:30:21 +0900
Subject: [PATCH 3.10 01/79] SELinux: Fix memory leak upon loading policy
Commit 2463c26d "SELinux: put name based create rules in a hashtable" did not check return value from hashtab_insert() in filename_trans_read(). It leaks memory if hashtab_insert() returns error.
unreferenced object 0xffff88005c9160d0 (size 8):
comm "systemd", pid 1, jiffies 4294688674 (age 235.265s)
hex dump (first 8 bytes):
57 0b 00 00 6b 6b 6b a5 W...kkk.
backtrace:
[<ffffffff816604ae>] kmemleak_alloc+0x4e/0xb0
[<ffffffff811cba5e>] kmem_cache_alloc_trace+0x12e/0x360
[<ffffffff812aec5d>] policydb_read+0xd1d/0xf70
[<ffffffff812b345c>] security_load_policy+0x6c/0x500
[<ffffffff812a623c>] sel_write_load+0xac/0x750
[<ffffffff811eb680>] vfs_write+0xc0/0x1f0
[<ffffffff811ec08c>] SyS_write+0x4c/0xa0
[<ffffffff81690419>] system_call_fastpath+0x16/0x1b
[<ffffffffffffffff>] 0xffffffffffffffffHowever, we should not return EEXIST error to the caller, or the systemd will show below message and the boot sequence freezes.
systemd[1]: Failed to load SELinux policy. Freezing.
--- security/selinux/ss/policydb.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
security/selinux/ss/policydb.c +13 -1
@@ -1941,7 +1941,19 @@ static int filename_trans_read(struct poif (rc) goto out; -hashtab_insert (p->filename_trans, ft, otype); + rc =hashtab_insert (p->filename_trans, ft, otype); +if (rc) { +/* +* Do not return -EEXIST to the caller, or the system +* will not boot. +*/ +if (rc != -EEXIST ) + goto out; +/* But free memory to avoid memory leak. */ +kfree (ft); +kfree (name); +kfree (otype); + } }hash_eval (p->filename_trans,"filenametr" );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 2/79 tracing: Have trace buffer point back to trace_array
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit dced341b2d4f06668efaab33f88de5d287c0f45b upstream.
The trace buffer has a descriptor pointer that goes back to the trace array. But it was never assigned. Luckily, nothing uses it (yet), but it will in the future.
Although nothing currently uses this, if any of the new features get backported to older kernels, and because this is such a simple change, I'm marking it for stable too.
--- kernel/trace/trace.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/trace.c +2 -0
@@ -5878,6 +5878,8 @@ allocate_trace_buffer(struct trace_array rb_flags = trace_flags &TRACE_ITER_OVERWRITE ?RB_FL_OVERWRITE :0 ; + buf->tr = tr; + buf->buffer =ring_buffer_alloc (size, rb_flags);if (!buf->buffer)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 3/79 tracing: Check if tracing is enabled in trace_puts()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 3132e107d608f8753240d82d61303c500fd515b4 upstream.
If trace_puts() is used very early in boot up, it can crash the machine if it is called before the ring buffer is allocated. If a trace_printk() is used with no arguments, then it will be converted into a trace_puts() and suffer the same fate.
--- kernel/trace/trace.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/trace/trace.c +6 -0
@@ -424,6 +424,9 @@ int __trace_puts(unsigned long ip, constunsigned long irq_flags;int alloc; +if (unlikely (tracing_selftest_running || tracing_disabled)) +return 0 ; + alloc =sizeof (*entry) + size +2 ;/* possible \n added */ local_save_flags (irq_flags);
@@ -464,6 +467,9 @@ int __trace_bputs(unsigned long ip, consunsigned long irq_flags;int size =sizeof (struct bputs_entry ); +if (unlikely (tracing_selftest_running || tracing_disabled)) +return 0 ; +local_save_flags (irq_flags); buffer = global_trace.trace_buffer.buffer; event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
Greg Kroah-Hartman
maintainerPATCH 4/79 arch/sh/kernel/kgdb.c: add missing #include <linux/sched.h>
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wanlong Gao <[email protected]>
commit 53a52f17d96c8d47c79a7dafa81426317e89c7c1 upstream.
arch/sh/kernel/kgdb.c: In function 'sleeping_thread_to_gdb_regs':
arch/sh/kernel/kgdb.c:225:32: error: implicit declaration of function 'task_stack_page' [-Werror=implicit-function-declaration] arch/sh/kernel/kgdb.c:242:23: error: dereferencing pointer to incomplete type arch/sh/kernel/kgdb.c:243:22: error: dereferencing pointer to incomplete type
arch/sh/kernel/kgdb.c: In function 'singlestep_trap_handler':
arch/sh/kernel/kgdb.c:310:27: error: 'SIGTRAP' undeclared (first use in this function) arch/sh/kernel/kgdb.c:310:27: note: each undeclared identifier is reported only once for each function it appears in
This was introduced by commit 16559ae48c76 ("kgdb: remove #include <linux/serial_8250.h> from kgdb.h").
--- arch/sh/kernel/kgdb.c | 1 + 1 file changed, 1 insertion(+)
arch/sh/kernel/kgdb.c +1 -0
@@ -13,6 +13,7 @@#include <linux/kdebug.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/sched.h> #include <asm/cacheflush.h> #include <asm/traps.h>
Greg Kroah-Hartman
maintainerPATCH 5/79 intel-iommu: fix off-by-one in pagetable freeing
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit 08336fd218e087cc4fcc458e6b6dcafe8702b098 upstream.
dma_pte_free_level() has an off-by-one error when checking whether a pte is completely covered by a range. Take for example the case of attempting to free pfn 0x0 - 0x1ff, ie. 512 entries covering the first 2M superpage.
The level_size() is 0x200 and we test:
static void dma_pte_free_level(...
...
if (!(0 > 0 || 0x1ff < 0 + 0x200)) {
...
}Clearly the 2nd test is true, which means we fail to take the branch to clear and free the pagetable entry. As a result, we're leaking pagetables and failing to install new pages over the range.
This was found with a PCI device assigned to a QEMU guest using vfio-pci without a VGA device present. The first 1M of guest address space is mapped with various combinations of 4K pages, but eventually the range is entirely freed and replaced with a 2M contiguous mapping. intel-iommu errors out with something like:
ERROR: DMA PTE for vPFN 0x0 already set (to 5c2b8003 not 849c00083)
In this case 5c2b8003 is the pointer to the previous leaf page that was neither freed nor cleared and 849c00083 is the superpage entry that we're trying to replace it with.
--- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +1 -1
@@ -917,7 +917,7 @@ static void dma_pte_free_level(struct dm/* If range covers entire pagetable, free it */ if (!(start_pfn > level_pfn || - last_pfn < level_pfn +level_size (level))) { + last_pfn < level_pfn +level_size (level) -1 )) {dma_clear_pte (pte);domain_flush_cache (domain, pte,sizeof (*pte));free_pgtable_page (level_pte);
Greg Kroah-Hartman
maintainerPATCH 6/79 Revert "EISA: Initialize device before its resources"
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 765ee51f9a3f652959b4c7297d198a28e37952b4 upstream.
This reverts commit 26abfeed4341872364386c6a52b9acef8c81a81a.
In the eisa_probe() force_probe path, if we were unable to request slot resources (e.g., [io 0x800-0x8ff]), we skipped the slot with "Cannot allocate resource for EISA slot %d" before reading the EISA signature in eisa_init_device().
Commit 26abfeed4341 moved eisa_init_device() earlier, so we tried to read the EISA signature before requesting the slot resources, and this caused hangs during boot.
--- drivers/eisa/eisa-bus.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/eisa/eisa-bus.c +15 -11
@@ -275,11 +275,13 @@ static int __init eisa_request_resources }if (slot) { + edev->res[i].name =NULL ; edev->res[i].start =SLOT_ADDRESS (root, slot) + (i *0x400 ); edev->res[i].end = edev->res[i].start +0xff ; edev->res[i].flags =IORESOURCE_IO ; }else { + edev->res[i].name =NULL ; edev->res[i].start =SLOT_ADDRESS (root, slot) +EISA_VENDOR_ID_OFFSET ; edev->res[i].end = edev->res[i].start +3 ;
@@ -326,19 +328,20 @@ static int __init eisa_probe(struct eisareturn -ENOMEM ; } -if (eisa_init_device (root, edev,0 )) { +if (eisa_request_resources (root, edev,0 )) { +dev_warn (root->dev, +"EISA: Cannot allocate resource for mainboard\n" );kfree (edev);if (!root->force_probe) -return -ENODEV ; +return -EBUSY ; goto force_probe; } -if (eisa_request_resources (root, edev,0 )) { -dev_warn (root->dev, -"EISA: Cannot allocate resource for mainboard\n" ); +if (eisa_init_device (root, edev,0 )) { +eisa_release_resources (edev);kfree (edev);if (!root->force_probe) -return -EBUSY ; +return -ENODEV ; goto force_probe; }
@@ -361,11 +364,6 @@ static int __init eisa_probe(struct eisacontinue ; } -if (eisa_init_device (root, edev, i)) { -kfree (edev); -continue ; - } -if (eisa_request_resources (root, edev, i)) { dev_warn(root->dev, "Cannot allocate resource for EISA slot %d\n",
@@ -373,6 +371,12 @@ static int __init eisa_probe(struct eisakfree (edev);continue ; } + +if (eisa_init_device (root, edev, i)) { +eisa_release_resources (edev); +kfree (edev); +continue ; + }if (edev->state == (EISA_CONFIG_ENABLED |EISA_CONFIG_FORCED )) enabled_str =" (forced enabled)" ;
Greg Kroah-Hartman
maintainerPATCH 7/79 fuse: fix pipe_buf_operations
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 28a625cbc2a14f17b83e47ef907b2658576a32aa upstream.
Having this struct in module memory could Oops when if the module is unloaded while the buffer still persists in a pipe.
Since sock_pipe_buf_ops is essentially the same as fuse_dev_pipe_buf_steal merge them into nosteal_pipe_buf_ops (this is the same as default_pipe_buf_ops except stealing the page from the buffer is not allowed).
--- fs/fuse/dev.c | 22 +++++----------------- fs/splice.c | 18 ++++++++++++++++++ include/linux/pipe_fs_i.h | 2 ++ net/core/skbuff.c | 32 +------------------------------- 4 files changed, 26 insertions(+), 48 deletions(-)
fs/fuse/dev.c +5 -17
@@ -1296,22 +1296,6 @@ static ssize_t fuse_dev_read(struct kiocreturn fuse_dev_do_read (fc, file, &cs,iov_length (iov, nr_segs)); } -static int fuse_dev_pipe_buf_steal (struct pipe_inode_info *pipe, -struct pipe_buffer *buf) -{ -return 1 ; -} - -static const struct pipe_buf_operations fuse_dev_pipe_buf_ops = { - .can_merge =0 , - .map = generic_pipe_buf_map, - .unmap = generic_pipe_buf_unmap, - .confirm = generic_pipe_buf_confirm, - .release = generic_pipe_buf_release, - .steal = fuse_dev_pipe_buf_steal, - .get = generic_pipe_buf_get, -}; -static ssize_t fuse_dev_splice_read (struct file *in,loff_t *ppos,struct pipe_inode_info *pipe,size_t len,unsigned int flags)
@@ -1358,7 +1342,11 @@ static ssize_t fuse_dev_splice_read(stru buf->page = bufs[page_nr].page; buf->offset = bufs[page_nr].offset; buf->len = bufs[page_nr].len; - buf->ops = &fuse_dev_pipe_buf_ops; +/* +* Need to be careful about this. Having buf->ops in module +* code can Oops if the buffer persists after module unload. +*/ + buf->ops = &nosteal_pipe_buf_ops; pipe->nrbufs++; page_nr++;
fs/splice.c +18 -0
@@ -555,6 +555,24 @@ static const struct pipe_buf_operations .get = generic_pipe_buf_get, }; +static int generic_pipe_buf_nosteal (struct pipe_inode_info *pipe, +struct pipe_buffer *buf) +{ +return 1 ; +} + +/* Pipe buffer operations for a socket and similar. */ +const struct pipe_buf_operations nosteal_pipe_buf_ops = { + .can_merge =0 , + .map = generic_pipe_buf_map, + .unmap = generic_pipe_buf_unmap, + .confirm = generic_pipe_buf_confirm, + .release = generic_pipe_buf_release, + .steal = generic_pipe_buf_nosteal, + .get = generic_pipe_buf_get, +}; +EXPORT_SYMBOL (nosteal_pipe_buf_ops); +static ssize_t kernel_readv (struct file *file,const struct iovec *vec,unsigned long vlen,loff_t offset) {
include/linux/pipe_fs_i.h +2 -0
@@ -157,6 +157,8 @@ int generic_pipe_buf_confirm(struct pipeint generic_pipe_buf_steal (struct pipe_inode_info *,struct pipe_buffer *);void generic_pipe_buf_release (struct pipe_inode_info *,struct pipe_buffer *); +extern const struct pipe_buf_operations nosteal_pipe_buf_ops; +/* for F_SETPIPE_SZ and F_GETPIPE_SZ */ long pipe_fcntl (struct file *,unsigned int ,unsigned long arg);struct pipe_inode_info *get_pipe_info (struct file *file);
net/core/skbuff.c +1 -31
@@ -74,36 +74,6 @@struct kmem_cache *skbuff_head_cache__read_mostly ;static struct kmem_cache *skbuff_fclone_cache__read_mostly ; -static void sock_pipe_buf_release (struct pipe_inode_info *pipe, -struct pipe_buffer *buf) -{ -put_page (buf->page); -} - -static void sock_pipe_buf_get (struct pipe_inode_info *pipe, -struct pipe_buffer *buf) -{ -get_page (buf->page); -} - -static int sock_pipe_buf_steal (struct pipe_inode_info *pipe, -struct pipe_buffer *buf) -{ -return 1 ; -} - - -/* Pipe buffer operations for a socket. */ -static const struct pipe_buf_operations sock_pipe_buf_ops = { - .can_merge =0 , - .map = generic_pipe_buf_map, - .unmap = generic_pipe_buf_unmap, - .confirm = generic_pipe_buf_confirm, - .release = sock_pipe_buf_release, - .steal = sock_pipe_buf_steal, - .get = sock_pipe_buf_get, -}; -/** * skb_panic - private function for out-of-line support * @skb: buffer
@@ -1811,7 +1781,7 @@ int skb_splice_bits(struct sk_buff *skb, .partial = partial, .nr_pages_max = MAX_SKB_FRAGS, .flags = flags, - .ops = &sock_pipe_buf_ops, + .ops = &nosteal_pipe_buf_ops, .spd_release = sock_spd_release, };struct sk_buff *frag_iter;
Greg Kroah-Hartman
maintainerPATCH 8/79 audit: reset audit backlog wait time after error recovery
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Guy Briggs <[email protected]>
commit e789e561a50de0aaa8c695662d97aaa5eac9d55f upstream.
When the audit queue overflows and times out (audit_backlog_wait_time), the audit queue overflow timeout is set to zero. Once the audit queue overflow timeout condition recovers, the timeout should be reset to the original value.
See also:
https://lkml.org/lkml/2013/9/2/473
--- kernel/audit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/audit.c +4 -1
@@ -103,7 +103,8 @@ static int audit_rate_limit;/* Number of outstanding audit_buffers allowed. */ static int audit_backlog_limit =64 ; -static int audit_backlog_wait_time =60 *HZ ; +#define AUDIT_BACKLOG_WAIT_TIME (60 * HZ) +static int audit_backlog_wait_time =AUDIT_BACKLOG_WAIT_TIME ;static int audit_backlog_wait_overflow =0 ;/* The identity of the user shutting down the audit system. */
@@ -1135,6 +1136,8 @@ struct audit_buffer *audit_log_start(strreturn NULL ; } + audit_backlog_wait_time =AUDIT_BACKLOG_WAIT_TIME ; + ab =audit_buffer_alloc (ctx, gfp_mask, type);if (!ab) {audit_log_lost ("out of memory in audit_log_start" );
Greg Kroah-Hartman
maintainerPATCH 9/79 audit: correct a type mismatch in audit_syscall_exit()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: AKASHI Takahiro <[email protected]>
commit 06bdadd7634551cfe8ce071fe44d0311b3033d9e upstream.
audit_syscall_exit() saves a result of regs_return_value() in intermediate "int" variable and passes it to __audit_syscall_exit(), which expects its second argument as a "long" value. This will result in truncating the value returned by a system call and making a wrong audit record.
I don't know why gcc compiler doesn't complain about this, but anyway it causes a problem at runtime on arm64 (and probably most 64-bit archs).
--- include/linux/audit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/audit.h +1 -1
@@ -135,7 +135,7 @@ static inline void audit_syscall_exit(vo {if (unlikely (current->audit_context)) {int success =is_syscall_success (pt_regs); -int return_code =regs_return_value (pt_regs); +long return_code =regs_return_value (pt_regs);__audit_syscall_exit (success, return_code); }
Greg Kroah-Hartman
maintainerPATCH 10/79 mm/memory-failure.c: shift page lock from head page to tail page after thp split
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naoya Horiguchi <[email protected]>
commit 54b9dd14d09f24927285359a227aa363ce46089e upstream.
After thp split in hwpoison_user_mappings(), we hold page lock on the raw error page only between try_to_unmap, hence we are in danger of race condition.
I found in the RHEL7 MCE-relay testing that we have "bad page" error when a memory error happens on a thp tail page used by qemu-kvm:
Triggering MCE exception on CPU 10
mce: [Hardware Error]: Machine check events logged
MCE exception done on CPU 10
MCE 0x38c535: Killing qemu-kvm:8418 due to hardware memory corruption
MCE 0x38c535: dirty LRU page recovery: Recovered
qemu-kvm[8418]: segfault at 20 ip 00007ffb0f0f229a sp 00007fffd6bc5240 error 4 in qemu-kvm[7ffb0ef14000+420000]
BUG: Bad page state in process qemu-kvm pfn:38c400
page:ffffea000e310000 count:0 mapcount:0 mapping: (null) index:0x7ffae3c00
page flags: 0x2fffff0008001d(locked|referenced|uptodate|dirty|swapbacked)
Modules linked in: hwpoison_inject mce_inject vhost_net macvtap macvlan ...
CPU: 0 PID: 8418 Comm: qemu-kvm Tainted: G M -------------- 3.10.0-54.0.1.el7.mce_test_fixed.x86_64 #1
Hardware name: NEC NEC Express5800/R120b-1 [N8100-1719F]/MS-91E7-001, BIOS 4.6.3C19 02/10/2011
Call Trace:
dump_stack+0x19/0x1b
bad_page.part.59+0xcf/0xe8
free_pages_prepare+0x148/0x160
free_hot_cold_page+0x31/0x140
free_hot_cold_page_list+0x46/0xa0
release_pages+0x1c1/0x200
free_pages_and_swap_cache+0xad/0xd0
tlb_flush_mmu.part.46+0x4c/0x90
tlb_finish_mmu+0x55/0x60
exit_mmap+0xcb/0x170
mmput+0x67/0xf0
vhost_dev_cleanup+0x231/0x260 [vhost_net]
vhost_net_release+0x3f/0x90 [vhost_net]
__fput+0xe9/0x270
____fput+0xe/0x10
task_work_run+0xc4/0xe0
do_exit+0x2bb/0xa40
do_group_exit+0x3f/0xa0
get_signal_to_deliver+0x1d0/0x6e0
do_signal+0x48/0x5e0
do_notify_resume+0x71/0xc0
retint_signal+0x48/0x8cThe reason of this bug is that a page fault happens before unlocking the head page at the end of memory_failure(). This strange page fault is trying to access to address 0x20 and I'm not sure why qemu-kvm does this, but anyway as a result the SIGSEGV makes qemu-kvm exit and on the way we catch the bad page bug/warning because we try to free a locked page (which was the former head page.)
To fix this, this patch suggests to shift page lock from head page to tail page just after thp split. SIGSEGV still happens, but it affects only error affected VMs, not a whole system.
--- mm/memory-failure.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
mm/memory-failure.c +11 -10
@@ -854,14 +854,14 @@ static int page_action(struct page_state* the pages and send SIGBUS to the processes if the data was dirty. */ static int hwpoison_user_mappings (struct page *p,unsigned long pfn, -int trapno,int flags) +int trapno,int flags,struct page **hpagep) {enum ttu_flags ttu =TTU_UNMAP |TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS ;struct address_space *mapping;LIST_HEAD (tokill);int ret;int kill =1 , forcekill; -struct page *hpage =compound_head (p); +struct page *hpage = *hpagep;struct page *ppage;if (PageReserved (p) ||PageSlab (p))
@@ -940,11 +940,14 @@ static int hwpoison_user_mappings(struct* We pinned the head page for hwpoison handling, * now we split the thp and we are interested in * the hwpoisoned raw page, so move the refcount -* to it. +* to it. Similarly, page lock is shifted. */ if (hpage != p) {put_page (hpage);get_page (p); +lock_page (p); +unlock_page (hpage); + *hpagep = p; }/* THP is split, so ppage should be the real poisoned page. */ ppage = p;
@@ -962,17 +965,11 @@ static int hwpoison_user_mappings(structif (kill)collect_procs (ppage, &tokill); -if (hpage != ppage) -lock_page (ppage); - ret =try_to_unmap (ppage, ttu);if (ret !=SWAP_SUCCESS )printk (KERN_ERR "MCE %#lx: failed to unmap page (mapcount=%d)\n" , pfn,page_mapcount (ppage)); -if (hpage != ppage) -unlock_page (ppage); -/* * Now that the dirty bit has been propagated to the * struct page and all unmaps done we can decide if
@@ -1189,8 +1186,12 @@ int memory_failure(unsigned long pfn, in/* * Now take care of user space mappings. * Abort on fail: __delete_from_page_cache() assumes unmapped page. +* +* When the raw error page is thp tail page, hpage points to the raw +* page after thp split. */ -if (hwpoison_user_mappings (p, pfn, trapno, flags) !=SWAP_SUCCESS ) { +if (hwpoison_user_mappings (p, pfn, trapno, flags, &hpage) + !=SWAP_SUCCESS ) {printk (KERN_ERR "MCE %#lx: cannot unmap page, give up\n" , pfn); res = -EBUSY ; goto out;
Greg Kroah-Hartman
maintainerPATCH 11/79 mm/page-writeback.c: fix dirty_balance_reserve subtraction from dirtyable memory
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit a804552b9a15c931cfc2a92a2e0aed1add8b580a upstream.
Tejun reported stuttering and latency spikes on a system where random tasks would enter direct reclaim and get stuck on dirty pages. Around 50% of memory was occupied by tmpfs backed by an SSD, and another disk (rotating) was reading and writing at max speed to shrink a partition.
: The problem was pretty ridiculous. It's a 8gig machine w/ one ssd and 10k : rpm harddrive and I could reliably reproduce constant stuttering every : several seconds for as long as buffered IO was going on on the hard drive : either with tmpfs occupying somewhere above 4gig or a test program which : allocates about the same amount of anon memory. Although swap usage was : zero, turning off swap also made the problem go away too.
:
: The trigger conditions seem quite plausible - high anon memory usage w/ : heavy buffered IO and swap configured - and it's highly likely that this : is happening in the wild too. (this can happen with copying large files : to usb sticks too, right?)
This patch (of 2):
The dirty_balance_reserve is an approximation of the fraction of free pages that the page allocator does not make available for page cache allocations. As a result, it has to be taken into account when calculating the amount of "dirtyable memory", the baseline to which dirty_background_ratio and dirty_ratio are applied.
However, currently the reserve is subtracted from the sum of free and reclaimable pages, which is non-sensical and leads to erroneous results when the system is dominated by unreclaimable pages and the dirty_balance_reserve is bigger than free+reclaimable. In that case, at least the already allocated cache should be considered dirtyable.
Fix the calculation by subtracting the reserve from the amount of free pages, then adding the reclaimable pages on top.
--- mm/page-writeback.c | 55 ++++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 31 deletions(-)
mm/page-writeback.c +24 -31
@@ -188,6 +188,25 @@ static unsigned long writeout_period_tim* global dirtyable memory first. */ +/** +* zone_dirtyable_memory - number of dirtyable pages in a zone +* @zone: the zone +* +* Returns the zone's number of pages potentially available for dirty +* page cache. This is the base value for the per-zone dirty limits. +*/ +static unsigned long zone_dirtyable_memory (struct zone *zone) +{ +unsigned long nr_pages; + + nr_pages =zone_page_state (zone,NR_FREE_PAGES ); + nr_pages -=min (nr_pages, zone->dirty_balance_reserve); + + nr_pages +=zone_reclaimable_pages (zone); + +return nr_pages; +} +static unsigned long highmem_dirtyable_memory (unsigned long total) {#ifdef CONFIG_HIGHMEM
@@ -195,11 +214,9 @@ static unsigned long highmem_dirtyable_munsigned long x =0 ;for_each_node_state (node,N_HIGH_MEMORY ) { -struct zone *z = - &NODE_DATA (node)->node_zones[ZONE_HIGHMEM ]; +struct zone *z = &NODE_DATA (node)->node_zones[ZONE_HIGHMEM ]; - x +=zone_page_state (z,NR_FREE_PAGES ) + -zone_reclaimable_pages (z) - z->dirty_balance_reserve; + x +=zone_dirtyable_memory (z); }/* * Unreclaimable memory (kernel memory or anonymous memory
@@ -235,9 +252,11 @@ static unsigned long global_dirtyable_me {unsigned long x; - x =global_page_state (NR_FREE_PAGES ) +global_reclaimable_pages (); + x =global_page_state (NR_FREE_PAGES ); x -=min (x, dirty_balance_reserve); + x +=global_reclaimable_pages (); +if (!vm_highmem_is_dirtyable) x -=highmem_dirtyable_memory (x);
@@ -289,32 +308,6 @@ void global_dirty_limits(unsigned long * }/** -* zone_dirtyable_memory - number of dirtyable pages in a zone -* @zone: the zone -* -* Returns the zone's number of pages potentially available for dirty -* page cache. This is the base value for the per-zone dirty limits. -*/ -static unsigned long zone_dirtyable_memory (struct zone *zone) -{ -/* -* The effective global number of dirtyable pages may exclude -* highmem as a big-picture measure to keep the ratio between -* dirty memory and lowmem reasonable. -* -* But this function is purely about the individual zone and a -* highmem zone can hold its share of dirty pages, so we don't -* care about vm_highmem_is_dirtyable here. -*/ -unsigned long nr_pages =zone_page_state (zone,NR_FREE_PAGES ) + -zone_reclaimable_pages (zone); - -/* don't allow this to underflow */ - nr_pages -=min (nr_pages, zone->dirty_balance_reserve); -return nr_pages; -} - -/** * zone_dirty_limit - maximum number of dirty pages allowed in a zone * @zone: the zone *
Greg Kroah-Hartman
maintainerPATCH 12/79 mm/page-writeback.c: do not count anon pages as dirtyable memory
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit a1c3bfb2f67ef766de03f1f56bdfff9c8595ab14 upstream.
The VM is currently heavily tuned to avoid swapping. Whether that is good or bad is a separate discussion, but as long as the VM won't swap to make room for dirty cache, we can not consider anonymous pages when calculating the amount of dirtyable memory, the baseline to which dirty_background_ratio and dirty_ratio are applied.
A simple workload that occupies a significant size (40+%, depending on memory layout, storage speeds etc.) of memory with anon/tmpfs pages and uses the remainder for a streaming writer demonstrates this problem. In that case, the actual cache pages are a small fraction of what is considered dirtyable overall, which results in an relatively large portion of the cache pages to be dirtied. As kswapd starts rotating these, random tasks enter direct reclaim and stall on IO.
Only consider free pages and file pages dirtyable.
--- include/linux/vmstat.h | 3 --- mm/page-writeback.c | 6 ++++-- mm/vmscan.c | 49 ++++++++++++++----------------------------------- 3 files changed, 18 insertions(+), 40 deletions(-)
include/linux/vmstat.h +0 -3
@@ -142,9 +142,6 @@ static inline unsigned long zone_page_streturn x; } -extern unsigned long global_reclaimable_pages (void ); -extern unsigned long zone_reclaimable_pages (struct zone *zone); -#ifdef CONFIG_NUMA /* * Determine the per node value of a stat item. This function
mm/page-writeback.c +4 -2
@@ -202,7 +202,8 @@ static unsigned long zone_dirtyable_memo nr_pages =zone_page_state (zone,NR_FREE_PAGES ); nr_pages -=min (nr_pages, zone->dirty_balance_reserve); - nr_pages +=zone_reclaimable_pages (zone); + nr_pages +=zone_page_state (zone,NR_INACTIVE_FILE ); + nr_pages +=zone_page_state (zone,NR_ACTIVE_FILE );return nr_pages; }
@@ -255,7 +256,8 @@ static unsigned long global_dirtyable_me x =global_page_state (NR_FREE_PAGES ); x -=min (x, dirty_balance_reserve); - x +=global_reclaimable_pages (); + x +=global_page_state (NR_INACTIVE_FILE ); + x +=global_page_state (NR_ACTIVE_FILE );if (!vm_highmem_is_dirtyable) x -=highmem_dirtyable_memory (x);
mm/vmscan.c +14 -35
61 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 13/79 mmc: fix host release issue after discard operation
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ray Jui <[email protected]>
commit f662ae48ae67dfd42739e65750274fe8de46240a upstream.
Under function mmc_blk_issue_rq, after an MMC discard operation, the MMC request data structure may be freed in memory. Later in the same function, the check of req->cmd_flags & MMC_REQ_SPECIAL_MASK is dangerous and invalid. It causes the MMC host not to be released when it should.
This patch fixes the issue by marking the special request down before the discard/flush operation.
Reported by: Harold (SoonYeal) Yang <[email protected]>
--- drivers/mmc/card/block.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mmc/card/block.c +4 -3
@@ -1931,6 +1931,7 @@ static int mmc_blk_issue_rq(struct mmc_qstruct mmc_card *card = md->queue.card;struct mmc_host *host = card->host;unsigned long flags; +unsigned int cmd_flags = req ? req->cmd_flags :0 ;if (req && !mq->mqrq_prev->req)/* claim host only for the first request */
@@ -1946,7 +1947,7 @@ static int mmc_blk_issue_rq(struct mmc_q } mq->flags &= ~MMC_QUEUE_NEW_REQUEST ; -if (req && req->cmd_flags &REQ_DISCARD ) { +if (cmd_flags &REQ_DISCARD ) {/* complete ongoing async transfer before issuing discard */ if (card->host->areq)mmc_blk_issue_rw_rq (mq,NULL );
@@ -1955,7 +1956,7 @@ static int mmc_blk_issue_rq(struct mmc_q ret =mmc_blk_issue_secdiscard_rq (mq, req); else ret =mmc_blk_issue_discard_rq (mq, req); - }else if (req && req->cmd_flags &REQ_FLUSH ) { + }else if (cmd_flags &REQ_FLUSH ) {/* complete ongoing async transfer before issuing flush */ if (card->host->areq)mmc_blk_issue_rw_rq (mq,NULL );
@@ -1971,7 +1972,7 @@ static int mmc_blk_issue_rq(struct mmc_q out:if ((!req && !(mq->flags &MMC_QUEUE_NEW_REQUEST )) || - (req && (req->cmd_flags &MMC_REQ_SPECIAL_MASK ))) + (cmd_flags &MMC_REQ_SPECIAL_MASK ))/* * Release host when there are no more requests * and after special request(discard, flush) is done.
Greg Kroah-Hartman
maintainerPATCH 14/79 mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ludovic Desroches <[email protected]>
commit 66b512eda74d59b17eac04c4da1b38d82059e6c9 upstream.
With some SDIO devices, timeout errors can happen when reading data. To solve this issue, the DMA transfer has to be activated before sending the command to the device. This order is incorrect in PDC mode. So we have to take care if we are using DMA or PDC to know when to send the MMC command.
--- drivers/mmc/host/atmel-mci.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/mmc/host/atmel-mci.c +12 -1
@@ -1188,11 +1188,22 @@ static void atmci_start_request(struct a iflags |=ATMCI_CMDRDY ; cmd = mrq->cmd; cmdflags =atmci_prepare_command (slot->mmc, cmd); -atmci_send_command (host, cmd, cmdflags); + +/* +* DMA transfer should be started before sending the command to avoid +* unexpected errors especially for read operations in SDIO mode. +* Unfortunately, in PDC mode, command has to be sent before starting +* the transfer. +*/ +if (host->submit_data != &atmci_submit_data_dma) +atmci_send_command (host, cmd, cmdflags);if (data) host->submit_data (host, data); +if (host->submit_data == &atmci_submit_data_dma) +atmci_send_command (host, cmd, cmdflags); +if (mrq->stop) { host->stop_cmdr =atmci_prepare_command (slot->mmc, mrq->stop); host->stop_cmdr |=ATMCI_CMDR_STOP_XFER ;
Greg Kroah-Hartman
maintainerPATCH 15/79 slub: Fix calculation of cpu slabs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zefan <[email protected]>
commit 8afb1474db4701d1ab80cd8251137a3260e6913e upstream.
/sys/kernel/slab/:t-0000048 # cat cpu_slabs
231 N0=16 N1=215
/sys/kernel/slab/:t-0000048 # cat slabs
145 N0=36 N1=109
See, the number of slabs is smaller than that of cpu slabs.
The bug was introduced by commit 49e2258586b423684f03c278149ab46d8f8b6700 ("slub: per cpu cache for partial pages").
We should use page->pages instead of page->pobjects when calculating the number of cpu partial slabs. This also fixes the mapping of slabs and nodes.
As there's no variable storing the number of total/active objects in cpu partial slabs, and we don't have user interfaces requiring those statistics, I just add WARN_ON for those cases.
--- mm/slub.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
mm/slub.c +7 -1
@@ -4285,7 +4285,13 @@ static ssize_t show_slab_objects(struct page =ACCESS_ONCE (c->partial);if (page) { - x = page->pobjects; + node =page_to_nid (page); +if (flags &SO_TOTAL ) +WARN_ON_ONCE (1 ); +else if (flags &SO_OBJECTS ) +WARN_ON_ONCE (1 ); +else + x = page->pages; total += x; nodes[node] += x; }
Greg Kroah-Hartman
maintainerPATCH 16/79 turbostat: Dont put unprocessed uapi headers in the include path
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Triplett <[email protected]>
commit b731f3119de57144e16c19fd593b8daeb637843e upstream.
turbostat's Makefile puts arch/x86/include/uapi/ in the include path, so that it can include <asm/msr.h> from it. It isn't in general safe to include even uapi headers directly from the kernel tree without processing them through scripts/headers_install.sh, but asm/msr.h happens to work.
However, that include path can break with some versions of system headers, by overriding some system headers with the unprocessed versions directly from the kernel source. For instance:
In file included from /build/x86-generic/usr/include/bits/sigcontext.h:28:0,
from /build/x86-generic/usr/include/signal.h:339,
from /build/x86-generic/usr/include/sys/wait.h:31,
from turbostat.c:27:../../../../arch/x86/include/uapi/asm/sigcontext.h:4:28: fatal error: linux/compiler.h: No such file or directory
This occurs because the system bits/sigcontext.h on that build system includes <asm/sigcontext.h>, and asm/sigcontext.h in the kernel source includes <linux/compiler.h>, which scripts/headers_install.sh would have filtered out.
Since turbostat really only wants a single header, just include that one header rather than putting an entire directory of kernel headers on the include path.
In the process, switch from msr.h to msr-index.h, since turbostat just wants the MSR numbers.
--- tools/power/x86/turbostat/Makefile | 2 +- tools/power/x86/turbostat/turbostat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/power/x86/turbostat/Makefile +1 -1
@@ -5,7 +5,7 @@ DESTDIR := turbostat : turbostat.c CFLAGS += -Wall -CFLAGS += -I../../../../arch/x86/include/uapi/ +CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"' %: %.c @mkdir -p $(BUILD_OUTPUT)
tools/power/x86/turbostat/turbostat.c +1 -1
@@ -20,7 +20,7 @@*/ #define _GNU_SOURCE -#include <asm/msr.h> +#include MSRHEADER #include <stdio.h> #include <unistd.h> #include <sys/types.h>
Greg Kroah-Hartman
maintainerPATCH 18/79 ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 49a12877d2777cadcb838981c3c4f5a424aef310 upstream.
There is currently no facility in ACPI to express the hookup of voltage regulators, the expectation is that the regulators that exist in the system will be handled transparently by firmware if they need software control at all. This means that if for some reason the regulator API is enabled on such a system it should assume that any supplies that devices need are provided by the system at all relevant times without any software intervention.
Tell the regulator core to make this assumption by calling regulator_has_full_constraints(). Do this as soon as we know we are using ACPI so that the information is available to the regulator core as early as possible. This will cause the regulator core to pretend that there is an always on regulator supplying any supply that is requested but that has not otherwise been mapped which is the behaviour expected on a system with ACPI.
Should the ability to specify regulators be added in future revisions of ACPI then once we have support for ACPI mappings in the kernel the same assumptions will apply. It is also likely that systems will default to a mode of operation which does not require any interpretation of these mappings in order to be compatible with existing operating system releases so it should remain safe to make these assumptions even if the mappings exist but are not supported by the kernel.
--- drivers/acpi/bus.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/bus.c +9 -0
@@ -33,6 +33,7 @@#include <linux/proc_fs.h> #include <linux/acpi.h> #include <linux/slab.h> +#include <linux/regulator/machine.h> #ifdef CONFIG_X86 #include <asm/mpspec.h> #endif
@@ -705,6 +706,14 @@ void __init acpi_early_init(void) goto error0; } +/* +* If the system is using ACPI then we can be reasonably +* confident that any regulators are managed by the firmware +* so tell the regulator core it has everything it needs to +* know. +*/ +regulator_has_full_constraints (); +return ; error0:
Greg Kroah-Hartman
maintainerPATCH 19/79 compat: fix sys_fanotify_mark
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 592f6b842f64e416c7598a1b97c649b34241e22d upstream.
Commit 91c2e0bcae72 ("unify compat fanotify_mark(2), switch to COMPAT_SYSCALL_DEFINE") added a new unified compat fanotify_mark syscall to be used by all architectures.
Unfortunately the unified version merges the split mask parameter in a wrong way: the lower and higher word got swapped.
This was discovered with glibc's tst-fanotify test case.
--- fs/notify/fanotify/fanotify_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/notify/fanotify/fanotify_user.c +2 -2
@@ -867,9 +867,9 @@ COMPAT_SYSCALL_DEFINE6(fanotify_mark, {return sys_fanotify_mark (fanotify_fd, flags, #ifdef __BIG_ENDIAN - ((__u64 )mask1 <<32 ) | mask0, -#else ((__u64 )mask0 <<32 ) | mask1, +#else + ((__u64 )mask1 <<32 ) | mask0, #endif dfd, pathname); }
Greg Kroah-Hartman
maintainerPATCH 20/79 fs/compat: fix parameter handling for compat readv/writev syscalls
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit dfd948e32af2e7b28bcd7a490c0a30d4b8df2a36 upstream.
We got a report that the pwritev syscall does not work correctly in compat mode on s390.
It turned out that with commit 72ec35163f9f ("switch compat readv/writev variants to COMPAT_SYSCALL_DEFINE") we lost the zero extension of a couple of syscall parameters because the some parameter types haven't been converted from unsigned long to compat_ulong_t.
This is needed for architectures where the ABI requires that the caller of a function performed zero and/or sign extension to 64 bit of all parameters.
--- fs/read_write.c | 16 ++++++++-------- include/linux/compat.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-)
fs/read_write.c +8 -8
@@ -947,9 +947,9 @@ out:return ret; } -COMPAT_SYSCALL_DEFINE3(readv, unsigned long, fd, +COMPAT_SYSCALL_DEFINE3 (readv, compat_ulong_t, fd, const struct compat_iovec __user *,vec, - unsigned long, vlen) + compat_ulong_t, vlen) {struct fd f =fdget (fd);ssize_t ret;
@@ -983,9 +983,9 @@ COMPAT_SYSCALL_DEFINE4(preadv64, unsignereturn ret; } -COMPAT_SYSCALL_DEFINE5(preadv, unsigned long, fd, +COMPAT_SYSCALL_DEFINE5 (preadv, compat_ulong_t, fd, const struct compat_iovec __user *,vec, - unsigned long, vlen, u32, pos_low, u32, pos_high) + compat_ulong_t, vlen, u32, pos_low, u32, pos_high) {loff_t pos = ((loff_t )pos_high <<32 ) | pos_low;return compat_sys_preadv64 (fd, vec, vlen, pos);
@@ -1013,9 +1013,9 @@ out:return ret; } -COMPAT_SYSCALL_DEFINE3(writev, unsigned long, fd, +COMPAT_SYSCALL_DEFINE3 (writev, compat_ulong_t, fd, const struct compat_iovec __user *, vec, - unsigned long, vlen) + compat_ulong_t, vlen) {struct fd f =fdget (fd);ssize_t ret;
@@ -1049,9 +1049,9 @@ COMPAT_SYSCALL_DEFINE4(pwritev64, unsignreturn ret; } -COMPAT_SYSCALL_DEFINE5(pwritev, unsigned long, fd, +COMPAT_SYSCALL_DEFINE5 (pwritev, compat_ulong_t, fd, const struct compat_iovec __user *,vec, - unsigned long, vlen, u32, pos_low, u32, pos_high) + compat_ulong_t, vlen, u32, pos_low, u32, pos_high) {loff_t pos = ((loff_t )pos_high <<32 ) | pos_low;return compat_sys_pwritev64 (fd, vec, vlen, pos);
include/linux/compat.h +8 -8
@@ -326,16 +326,16 @@ asmlinkage long compat_sys_keyctl(u32 op u32 arg2, u32 arg3, u32 arg4, u32 arg5);asmlinkage long compat_sys_ustat (unsigned dev,struct compat_ustat __user *u32); -asmlinkage ssize_t compat_sys_readv(unsigned long fd, -const struct compat_iovec __user *vec,unsigned long vlen); -asmlinkage ssize_t compat_sys_writev(unsigned long fd, -const struct compat_iovec __user *vec,unsigned long vlen); -asmlinkage ssize_t compat_sys_preadv(unsigned long fd, +asmlinkage ssize_t compat_sys_readv(compat_ulong_t fd, +const struct compat_iovec __user *vec,compat_ulong_t vlen); +asmlinkage ssize_t compat_sys_writev(compat_ulong_t fd, +const struct compat_iovec __user *vec,compat_ulong_t vlen); +asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd,const struct compat_iovec __user *vec, -unsigned long vlen,u32 pos_low,u32 pos_high); -asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, +compat_ulong_t vlen,u32 pos_low,u32 pos_high); +asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,const struct compat_iovec __user *vec, -unsigned long vlen,u32 pos_low,u32 pos_high); +compat_ulong_t vlen,u32 pos_low,u32 pos_high);asmlinkage long comat_sys_lseek (unsigned int ,compat_off_t ,unsigned int ); asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
Greg Kroah-Hartman
maintainerPATCH 21/79 fs/compat: fix lookup_dcookie() parameter handling
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit d8d14bd09cddbaf0168d61af638455a26bd027ff upstream.
Commit d5dc77bfeeab ("consolidate compat lookup_dcookie()") coverted all architectures to the new compat_sys_lookup_dcookie() syscall.
The "len" paramater of the new compat syscall must have the type compat_size_t in order to enforce zero extension for architectures where the ABI requires that the caller of a function performed zero and/or sign extension to 64 bit of all parameters.
--- fs/dcookies.c | 2 +- include/linux/compat.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/dcookies.c +1 -1
@@ -204,7 +204,7 @@ out: }#ifdef CONFIG_COMPAT -COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, size_t, len) +COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, compat_size_t, len) {#ifdef __BIG_ENDIANreturn sys_lookup_dcookie (((u64 )w0 <<32 ) | w1, buf, len);
include/linux/compat.h +1 -1
@@ -421,7 +421,7 @@ extern long compat_arch_ptrace(struct taasmlinkage long compat_sys_ptrace (compat_long_t request,compat_long_t pid,compat_long_t addr,compat_long_t data); -asmlinkage long compat_sys_lookup_dcookie (u32 ,u32 ,char __user *,size_t ); +asmlinkage long compat_sys_lookup_dcookie (u32 ,u32 ,char __user *,compat_size_t );/* * epoll (fs/eventpoll.c) compat bits follow ... */
Greg Kroah-Hartman
maintainerPATCH 22/79 tile: remove compat_sys_lookup_dcookie declaration to fix compile error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 5a5e75f4714a592f31e57f248b8f5c866f278b8d upstream.
With commit d8d14bd09cdd ("fs/compat: fix lookup_dcookie() parameter handling") I changed the type of the len parameter of the lookup_dcookie() syscall.
However I missed that there was still a stale declaration in arch/tile/.. which now causes a compile error on tile:
In file included from fs/dcookies.c:28:0:
include/linux/compat.h:425:17: error: conflicting types for 'compat_sys_lookup_dcookie' fs/dcookies.c:207:1: error: conflicting types for 'compat_sys_lookup_dcookie'
Simply remove the declaration in the tile architecture, which is only a leftover from before the different compat lookup_dcookie() versions have been merged. The correct declaration is now in include/linux/compat.h
The build error was reported by Fenguang's build bot.
--- arch/tile/include/asm/compat.h | 1 - 1 file changed, 1 deletion(-)
arch/tile/include/asm/compat.h +0 -1
@@ -281,7 +281,6 @@ long compat_sys_pread64(unsigned int fd, u32 dummy, u32 low, u32 high);long compat_sys_pwrite64 (unsigned int fd,char __user *ubuf,size_t count,u32 dummy,u32 low,u32 high); -long compat_sys_lookup_dcookie (u32 low,u32 high,char __user *buf,size_t len);long compat_sys_sync_file_range2 (int fd,unsigned int flags,u32 offset_lo,u32 offset_hi,u32 nbytes_lo,u32 nbytes_hi);
Greg Kroah-Hartman
maintainerPATCH 23/79 mtd: mxc_nand: remove duplicated ecc_stats counting
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
commit 0566477762f9e174e97af347ee9c865f908a5647 upstream.
The ecc_stats.corrected count variable will already be incremented in the above framework-layer just after this callback.
--- drivers/mtd/nand/mxc_nand.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/nand/mxc_nand.c +0 -1
@@ -676,7 +676,6 @@ static int mxc_nand_correct_data_v2_v3(s ecc_stat >>=4 ; }while (--no_subpages); - mtd->ecc_stats.corrected += ret;pr_debug ("%d Symbol Correctable RS-ECC Error\n" , ret);return ret;
Greg Kroah-Hartman
maintainerPATCH 24/79 ore: Fix wrong math in allocation of per device BIO
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boaz Harrosh <[email protected]>
commit aad560b7f63b495f48a7232fd086c5913a676e6f upstream.
At IO preparation we calculate the max pages at each device and allocate a BIO per device of that size. The calculation was wrong on some unaligned corner cases offset/length combination and would make prepare return with -ENOMEM. This would be bad for pnfs-objects that would in that case IO through MDS. And fatal for exofs were it would fail writes with EIO.
Fix it by doing the proper math, that will work in all cases. (I ran a test with all possible offset/length combinations this time round).
Also when reading we do not need to allocate for the parity units since we jump over them.
Also lower the max_io_length to take into account the parity pages so not to allocate BIOs bigger than PAGE_SIZE
--- fs/exofs/ore.c | 37 +++++++++++++++++++++++++------------ include/scsi/osd_ore.h | 1 + 2 files changed, 26 insertions(+), 12 deletions(-)
fs/exofs/ore.c +25 -12
@@ -103,7 +103,7 @@ int ore_verify_layout(unsigned total_com layout->max_io_length = (BIO_MAX_PAGES_KMALLOC *PAGE_SIZE - layout->stripe_unit) * - layout->group_width; + (layout->group_width - layout->parity);if (layout->parity) {unsigned stripe_length = (layout->group_width - layout->parity) *
@@ -286,7 +286,8 @@ int ore_get_rw_state(struct ore_layoutif (length) {ore_calc_stripe_info (layout, offset, length, &ios->si); ios->length = ios->si.length; - ios->nr_pages = (ios->length +PAGE_SIZE -1 ) /PAGE_SIZE ; + ios->nr_pages = ((ios->offset & (PAGE_SIZE -1 )) + + ios->length +PAGE_SIZE -1 ) /PAGE_SIZE ;if (layout->parity)_ore_post_alloc_raid_stuff (ios); }
@@ -536,6 +537,7 @@ void ore_calc_stripe_info(struct ore_layu64 H = LmodS -G *T ;u32 N =div_u64 (H ,U ); +u32 Nlast;/* "H - (N * U)" is just "H % U" so it's bound to u32 */ u32 C = (u32)(H - (N *U )) / stripe_unit +G * group_width;
@@ -568,6 +570,10 @@ void ore_calc_stripe_info(struct ore_lay si->length =T -H ;if (si->length > length) si->length = length; + + Nlast =div_u64 (H + si->length +U -1 ,U ); + si->maxdevUnits = Nlast -N ; + si->M =M ; }EXPORT_SYMBOL (ore_calc_stripe_info);
@@ -583,13 +589,16 @@ int _ore_add_stripe_unit(struct ore_io_sint ret;if (per_dev->bio ==NULL ) { -unsigned pages_in_stripe = ios->layout->group_width * - (ios->layout->stripe_unit /PAGE_SIZE ); -unsigned nr_pages = ios->nr_pages * ios->layout->group_width / - (ios->layout->group_width - - ios->layout->parity); -unsigned bio_size = (nr_pages + pages_in_stripe) / - ios->layout->group_width; +unsigned bio_size; + +if (!ios->reading) { + bio_size = ios->si.maxdevUnits; + }else { + bio_size = (ios->si.maxdevUnits +1 ) * + (ios->layout->group_width - ios->layout->parity) / + ios->layout->group_width; + } + bio_size *= (ios->layout->stripe_unit /PAGE_SIZE ); per_dev->bio =bio_kmalloc (GFP_KERNEL , bio_size);if (unlikely (!per_dev->bio)) {
@@ -609,8 +618,12 @@ int _ore_add_stripe_unit(struct ore_io_s added_len =bio_add_pc_page (q, per_dev->bio, pages[pg], pglen, pgbase);if (unlikely (pglen != added_len)) { -ORE_DBGMSG ("Failed bio_add_pc_page bi_vcnt=%u\n" , - per_dev->bio->bi_vcnt); +/* If bi_vcnt == bi_max then this is a SW BUG */ +ORE_DBGMSG ("Failed bio_add_pc_page bi_vcnt=0x%x " +"bi_max=0x%x BIO_MAX=0x%x cur_len=0x%x\n" , + per_dev->bio->bi_vcnt, + per_dev->bio->bi_max_vecs, +BIO_MAX_PAGES_KMALLOC , cur_len); ret = -ENOMEM ; goto out; }
@@ -1098,7 +1111,7 @@ int ore_truncate(struct ore_layout *layo size_attr->attr = g_attr_logical_length; size_attr->attr.val_ptr = &size_attr->newsize; -ORE_DBGMSG ("trunc(0x%llx) obj_offset=0x%llx dev=%d\n" , +ORE_DBGMSG2 ("trunc(0x%llx) obj_offset=0x%llx dev=%d\n" ,_LLU (oc->comps->obj.id),_LLU (obj_size), i); ret =_truncate_mirrors (ios, i * ios->layout->mirrors_p1, &size_attr->attr);
include/scsi/osd_ore.h +1 -0
@@ -102,6 +102,7 @@ struct ore_striping_info {unsigned unit_off;unsigned cur_pg;unsigned cur_comp; +unsigned maxdevUnits; };struct ore_io_state ;
Greg Kroah-Hartman
maintainerPATCH 25/79 xtensa: xtfpga: fix definitions of platform devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit a558d99263936b8a67d4eff8918745a77bfd8c31 upstream.
Remove __initdata attribute, as the devices may be used after init sections are freed.
--- arch/xtensa/platforms/xtfpga/setup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/xtensa/platforms/xtfpga/setup.c +6 -6
@@ -195,7 +195,7 @@ void platform_calibrate_ccount(void)* Ethernet -- OpenCores Ethernet MAC (ethoc driver) */ -static struct resource ethoc_res[]__initdata = { +static struct resource ethoc_res[] = { [0 ] = {/* register space */ .start =OETH_REGS_PADDR , .end =OETH_REGS_PADDR +OETH_REGS_SIZE -1 ,
@@ -213,7 +213,7 @@ static struct resource ethoc_res[] __ini }, }; -static struct ethoc_platform_data ethoc_pdata__initdata = { +static struct ethoc_platform_data ethoc_pdata = {/* * The MAC address for these boards is 00:50:c2:13:6f:xx. * The last byte (here as zero) is read from the DIP switches on the
@@ -223,7 +223,7 @@ static struct ethoc_platform_data ethoc_ .phy_id = -1, }; -static struct platform_device ethoc_device__initdata = { +static struct platform_device ethoc_device = { .name ="ethoc" , .id =-1 , .num_resources =ARRAY_SIZE (ethoc_res),
@@ -237,13 +237,13 @@ static struct platform_device ethoc_devi* UART */ -static struct resource serial_resource__initdata = { +static struct resource serial_resource = { .start =DUART16552_PADDR , .end =DUART16552_PADDR +0x1f , .flags =IORESOURCE_MEM , }; -static struct plat_serial8250_port serial_platform_data[]__initdata = { +static struct plat_serial8250_port serial_platform_data[] = { [0 ] = { .mapbase =DUART16552_PADDR , .irq =DUART16552_INTNUM ,
@@ -256,7 +256,7 @@ static struct plat_serial8250_port seria { }, }; -static struct platform_device xtavnet_uart__initdata = { +static struct platform_device xtavnet_uart = { .name ="serial8250" , .id =PLAT8250_DEV_PLATFORM , .dev = {
Greg Kroah-Hartman
maintainerPATCH 26/79 IB/qib: Fix QP check when looping back to/from QP1
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ira Weiny <[email protected]>
commit 6e0ea9e6cbcead7fa8c76e3e3b9de4a50c5131c5 upstream.
The GSI QP type is compatible with and should be allowed to send data to/from any UD QP. This was found when testing ibacm on the same node as an SA.
--- drivers/infiniband/hw/qib/qib_ud.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qib/qib_ud.c +8 -1
@@ -57,13 +57,20 @@ static void qib_ud_loopback(struct qib_qstruct qib_sge *sge;struct ib_wc wc;u32 length; +enum ib_qp_type sqptype, dqptype; qp =qib_lookup_qpn (ibp, swqe->wr.wr.ud.remote_qpn);if (!qp) { ibp->n_pkt_drops++;return ; } -if (qp->ibqp.qp_type != sqp->ibqp.qp_type || + + sqptype = sqp->ibqp.qp_type ==IB_QPT_GSI ? +IB_QPT_UD : sqp->ibqp.qp_type; + dqptype = qp->ibqp.qp_type ==IB_QPT_GSI ? +IB_QPT_UD : qp->ibqp.qp_type; + +if (dqptype != sqptype || !(ib_qib_state_ops[qp->state] &QIB_PROCESS_RECV_OK )) { ibp->n_pkt_drops++; goto drop;
Greg Kroah-Hartman
maintainerPATCH 27/79 spi/bcm63xx: dont substract prepend length from total length
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
commit 86b3bde003e6bf60ccb9c09b4115b8a2f533974c upstream.
The spi command must include the full message length including any prepended writes, else transfers larger than 256 bytes will be incomplete.
--- drivers/spi/spi-bcm63xx.c | 2 -- 1 file changed, 2 deletions(-)
drivers/spi/spi-bcm63xx.c +0 -2
@@ -180,8 +180,6 @@ static int bcm63xx_txrx_bufs(struct spi_ transfer_list); } - len -= prepend_len; -init_completion (&bs->done);/* Fill in the Message control register */
Greg Kroah-Hartman
maintainerPATCH 28/79 spidev: fix hang when transfer_one_message fails
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Santos <[email protected]>
commit e120cc0dcf2880a4c5c0a6cb27b655600a1cfa1d upstream.
This corrects a problem in spi_pump_messages() that leads to an spi message hanging forever when a call to transfer_one_message() fails. This failure occurs in my MCP2210 driver when the cs_change bit is set on the last transfer in a message, an operation which the hardware does not support.
Rationale
Since the transfer_one_message() returns an int, we must presume that it may fail. If transfer_one_message() should never fail, it should return void. Thus, calls to transfer_one_message() should properly manage a failure.
--- drivers/spi/spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi.c +3 -1
@@ -584,7 +584,9 @@ static void spi_pump_messages(struct kth ret = master->transfer_one_message (master, master->cur_msg);if (ret) {dev_err (&master->dev, -"failed to transfer one message from queue\n" ); +"failed to transfer one message from queue: %d\n" , ret); + master->cur_msg->status = ret; +spi_finalize_current_message (master);return ; } }
Greg Kroah-Hartman
maintainerPATCH 29/79 NFSv4: OPEN must handle the NFS4ERR_IO return code correctly
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit c7848f69ec4a8c03732cde5c949bd2aa711a9f4b upstream.
decode_op_hdr() cannot distinguish between an XDR decoding error and the perfectly valid errorcode NFS4ERR_IO. This is normally not a problem, but for the particular case of OPEN, we need to be able to increment the NFSv4 open sequence id when the server returns a valid response.
--- fs/nfs/nfs4xdr.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-)
fs/nfs/nfs4xdr.c +31 -16
@@ -3002,7 +3002,8 @@ out_overflow:return -EIO ; } -static int decode_op_hdr (struct xdr_stream *xdr,enum nfs_opnum4 expected) +static bool __decode_op_hdr (struct xdr_stream *xdr,enum nfs_opnum4 expected, +int *nfs_retval) {__be32 *p;uint32_t opnum;
@@ -3012,19 +3013,32 @@ static int decode_op_hdr(struct xdr_streif (unlikely (!p)) goto out_overflow; opnum =be32_to_cpup (p++); -if (opnum != expected) { -dprintk ("nfs: Server returned operation" -" %d but we issued a request for %d\n" , - opnum, expected); -return -EIO ; - } +if (unlikely (opnum != expected)) + goto out_bad_operation; nfserr =be32_to_cpup (p); -if (nfserr !=NFS_OK ) -return nfs4_stat_to_errno (nfserr); -return 0 ; +if (nfserr ==NFS_OK ) + *nfs_retval =0 ; +else + *nfs_retval =nfs4_stat_to_errno (nfserr); +return true; +out_bad_operation: +dprintk ("nfs: Server returned operation" +" %d but we issued a request for %d\n" , + opnum, expected); + *nfs_retval = -EREMOTEIO ; +return false; out_overflow:print_overflow_msg (__func__, xdr); -return -EIO ; + *nfs_retval = -EIO ; +return false; +} + +static int decode_op_hdr (struct xdr_stream *xdr,enum nfs_opnum4 expected) +{ +int retval; + +__decode_op_hdr (xdr, expected, &retval); +return retval; }/* Dummy routine */
@@ -4842,11 +4856,12 @@ static int decode_open(struct xdr_streamuint32_t savewords, bmlen, i;int status; - status =decode_op_hdr (xdr,OP_OPEN ); -if (status != -EIO ) -nfs_increment_open_seqid (status, res->seqid); -if (!status) - status =decode_stateid (xdr, &res->stateid); +if (!__decode_op_hdr (xdr,OP_OPEN , &status)) +return status; +nfs_increment_open_seqid (status, res->seqid); +if (status) +return status; + status =decode_stateid (xdr, &res->stateid);if (unlikely (status))return status;
Greg Kroah-Hartman
maintainerPATCH 30/79 nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weston Andros Adamson <[email protected]>
commit 78b19bae0813bd6f921ca58490196abd101297bd upstream.
Don't check for -NFS4ERR_NOTSUPP, it's already been mapped to -ENOTSUPP by nfs4_stat_to_errno.
This allows the client to mount v4.1 servers that don't support SECINFO_NO_NAME by falling back to the "guess and check" method of nfs4_find_root_sec.
--- fs/nfs/nfs4proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +2 -2
@@ -6683,7 +6683,7 @@ nfs41_proc_secinfo_no_name(struct nfs_seswitch (err) {case 0 :case -NFS4ERR_WRONGSEC : -case -NFS4ERR_NOTSUPP : +case -ENOTSUPP : goto out;default : err =nfs4_handle_exception (server, err, &exception);
@@ -6715,7 +6715,7 @@ nfs41_find_root_sec(struct nfs_server *s* Fall back on "guess and check" method if * the server doesn't support SECINFO_NO_NAME */ -if (err == -NFS4ERR_WRONGSEC || err == -NFS4ERR_NOTSUPP ) { +if (err == -NFS4ERR_WRONGSEC || err == -ENOTSUPP ) { err =nfs4_find_root_sec (server, fhandle, info); goto out_freepage; }
Greg Kroah-Hartman
maintainerPATCH 31/79 NFSv4.1: Handle errors correctly in nfs41_walk_client_list
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 64590daa9e0dfb3aad89e3ab9230683b76211d5b upstream.
Both nfs41_walk_client_list and nfs40_walk_client_list expect the 'status' variable to be set to the value -NFS4ERR_STALE_CLIENTID if the loop fails to find a match.
The problem is that the 'pos->cl_cons_state > NFS_CS_READY' changes the value of 'status', and sets it either to the value '0' (which indicates success), or to the value EINTR.
--- fs/nfs/nfs4client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/nfs/nfs4client.c +5 -3
@@ -324,9 +324,10 @@ int nfs40_walk_client_list(struct nfs_cl prev = pos; status =nfs_wait_client_init_complete (pos); -spin_lock (&nn->nfs_client_lock);if (status <0 ) -continue ; + goto out; + status = -NFS4ERR_STALE_CLIENTID ; +spin_lock (&nn->nfs_client_lock); }if (pos->cl_cons_state !=NFS_CS_READY )continue ;
@@ -464,7 +465,8 @@ int nfs41_walk_client_list(struct nfs_cl }spin_lock (&nn->nfs_client_lock);if (status <0 ) -continue ; +break ; + status = -NFS4ERR_STALE_CLIENTID ; }if (pos->cl_cons_state !=NFS_CS_READY )continue ;
Greg Kroah-Hartman
maintainerPATCH 32/79 nfs4: fix discover_server_trunking use after free
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weston Andros Adamson <[email protected]>
commit abad2fa5ba67725a3f9c376c8cfe76fbe94a3041 upstream.
If clp is new (cl_count = 1) and it matches another client in nfs4_discover_server_trunking, the nfs_put_client will free clp before ->cl_preserve_clid is set.
--- fs/nfs/nfs4client.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/nfs/nfs4client.c +4 -6
@@ -240,13 +240,11 @@ struct nfs_client *nfs4_init_client(stru error =nfs4_discover_server_trunking (clp, &old);if (error <0 ) goto error; -nfs_put_client (clp); -if (clp != old) { - clp->cl_preserve_clid = true; - clp = old; - } -return clp; +if (clp != old) + clp->cl_preserve_clid = true; +nfs_put_client (clp); +return old; error:nfs_mark_client_ready (clp, error);
Greg Kroah-Hartman
maintainerPATCH 33/79 pnfs: Proper delay for NFS4ERR_RECALLCONFLICT in layout_get_done
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boaz Harrosh <[email protected]>
commit ed7e5423014ad89720fcf315c0b73f2c5d0c7bd2 upstream.
An NFS4ERR_RECALLCONFLICT is returned by server from a GET_LAYOUT only when a Server Sent a RECALL do to that GET_LAYOUT, or the RECALL and GET_LAYOUT crossed on the wire.
In any way this means we want to wait at most until in-flight IO is finished and the RECALL can be satisfied.
So a proper wait here is more like 1/10 of a second, not 15 seconds like we have now. In case of a server bug we delay exponentially longer on each retry.
Current code totally craps out performance of very large files on most pnfs-objects layouts, because of how the map changes when the file has grown into the next raid group.
[Stable: This will patch back to 3.9. If there are earlier still
maintained trees, please tell me I'll send a patch]
--- fs/nfs/nfs4proc.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
fs/nfs/nfs4proc.c +30 -4
@@ -6232,9 +6232,9 @@ static void nfs4_layoutget_done(struct rstruct nfs_server *server =NFS_SERVER (inode);struct pnfs_layout_hdr *lo;struct nfs4_state *state =NULL ; -unsigned long timeo, giveup; +unsigned long timeo, now, giveup; -dprintk ("--> %s\n" , __func__); +dprintk ("--> %s tk_status => %d\n" , __func__, -task->tk_status);if (!nfs41_sequence_done (task, &lgp->res.seq_res)) goto out;
@@ -6242,12 +6242,38 @@ static void nfs4_layoutget_done(struct rswitch (task->tk_status) {case 0 : goto out; +/* +* NFS4ERR_LAYOUTTRYLATER is a conflict with another client +* (or clients) writing to the same RAID stripe +*/ case -NFS4ERR_LAYOUTTRYLATER : +/* +* NFS4ERR_RECALLCONFLICT is when conflict with self (must recall +* existing layout before getting a new one). +*/ case -NFS4ERR_RECALLCONFLICT : timeo =rpc_get_timeout (task->tk_client); giveup = lgp->args.timestamp + timeo; -if (time_after (giveup, jiffies)) - task->tk_status = -NFS4ERR_DELAY ; + now = jiffies; +if (time_after (giveup, now)) { +unsigned long delay; + +/* Delay for: +* - Not less then NFS4_POLL_RETRY_MIN. +* - One last time a jiffie before we give up +* - exponential backoff (time_now minus start_attempt) +*/ + delay = max_t(unsigned long, NFS4_POLL_RETRY_MIN, +min ((giveup - now -1 ), + now - lgp->args.timestamp)); + +dprintk ("%s: NFS4ERR_RECALLCONFLICT waiting %lu\n" , + __func__, delay); +rpc_delay (task, delay); + task->tk_status =0 ; +rpc_restart_call_prepare (task); + goto out;/* Do not call nfs4_async_handle_error() */ + }break ;case -NFS4ERR_EXPIRED :case -NFS4ERR_BAD_STATEID :
Greg Kroah-Hartman
maintainerPATCH 34/79 sunrpc: Fix infinite loop in RPC state machine
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weston Andros Adamson <[email protected]>
commit 6ff33b7dd0228b7d7ed44791bbbc98b03fd15d9d upstream.
When a task enters call_refreshresult with status 0 from call_refresh and !rpcauth_uptodatecred(task) it enters call_refresh again with no rate-limiting or max number of retries.
Instead of trying forever, make use of the retry path that other errors use.
This only seems to be possible when the crrefresh callback is gss_refresh_null, which only happens when destroying the context.
To reproduce:
1) mount with sec=krb5 (or sec=sys with krb5 negotiated for non FSID specific operations).
2) reboot - the client will be stuck and will need to be hard rebooted
BUG: soft lockup - CPU#0 stuck for 22s! [kworker/0:2:46] Modules linked in: rpcsec_gss_krb5 nfsv4 nfs fscache ppdev crc32c_intel aesni_intel aes_x86_64 glue_helper lrw gf128mul ablk_helper cryptd serio_raw i2c_piix4 i2c_core e1000 parport_pc parport shpchp nfsd auth_rpcgss oid_registry exportfs nfs_acl lockd sunrpc autofs4 mptspi scsi_transport_spi mptscsih mptbase ata_generic floppy irq event stamp: 195724 hardirqs last enabled at (195723): [<ffffffff814a925c>] restore_args+0x0/0x30 hardirqs last disabled at (195724): [<ffffffff814b0a6a>] apic_timer_interrupt+0x6a/0x80 softirqs last enabled at (195722): [<ffffffff8103f583>] __do_softirq+0x1df/0x276 softirqs last disabled at (195717): [<ffffffff8103f852>] irq_exit+0x53/0x9a CPU: 0 PID: 46 Comm: kworker/0:2 Not tainted 3.13.0-rc3-branch-dros_testing+ #4 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013 Workqueue: rpciod rpc_async_schedule [sunrpc] task: ffff8800799c4260 ti: ffff880079002000 task.ti: ffff880079002000 RIP: 0010:[<ffffffffa0064fd4>] [<ffffffffa0064fd4>] __rpc_execute+0x8a/0x362 [sunrpc] RSP: 0018:ffff880079003d18 EFLAGS: 00000246 RAX: 0000000000000005 RBX: 0000000000000007 RCX: 0000000000000007 RDX: 0000000000000007 RSI: ffff88007aecbae8 RDI: ffff8800783d8900 RBP: ffff880079003d78 R08: ffff88006e30e9f8 R09: ffffffffa005a3d7 R10: ffff88006e30e7b0 R11: ffff8800783d8900 R12: ffffffffa006675e R13: ffff880079003ce8 R14: ffff88006e30e7b0 R15: ffff8800783d8900 FS: 0000000000000000(0000) GS:ffff88007f200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f3072333000 CR3: 0000000001a0b000 CR4: 00000000001407f0 Stack: ffff880079003d98 0000000000000246 0000000000000000 ffff88007a9a4830 ffff880000000000 ffffffff81073f47 ffff88007f212b00 ffff8800799c4260 ffff8800783d8988 ffff88007f212b00 ffffe8ffff604800 0000000000000000 Call Trace: [<ffffffff81073f47>] ? trace_hardirqs_on_caller+0x145/0x1a1 [<ffffffffa00652d3>] rpc_async_schedule+0x27/0x32 [sunrpc] [<ffffffff81052974>] process_one_work+0x211/0x3a5 [<ffffffff810528d5>] ? process_one_work+0x172/0x3a5 [<ffffffff81052eeb>] worker_thread+0x134/0x202 [<ffffffff81052db7>] ? rescuer_thread+0x280/0x280 [<ffffffff81052db7>] ? rescuer_thread+0x280/0x280 [<ffffffff810584a0>] kthread+0xc9/0xd1 [<ffffffff810583d7>] ? __kthread_parkme+0x61/0x61 [<ffffffff814afd6c>] ret_from_fork+0x7c/0xb0 [<ffffffff810583d7>] ? __kthread_parkme+0x61/0x61 Code: e8 87 63 fd e0 c6 05 10 dd 01 00 01 48 8b 43 70 4c 8d 6b 70 45 31 e4 a8 02 0f 85 d5 02 00 00 4c 8b 7b 48 48 c7 43 48 00 00 00 00 <4c> 8b 4b 50 4d 85 ff 75 0c 4d 85 c9 4d 89 cf 0f 84 32 01 00 00
And the output of "rpcdebug -m rpc -s all":
RPC: 61 call_refresh (status 0) RPC: 61 call_refresh (status 0) RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 call_refreshresult (status 0) RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 call_refreshresult (status 0) RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 call_refresh (status 0) RPC: 61 call_refreshresult (status 0) RPC: 61 call_refresh (status 0) RPC: 61 call_refresh (status 0) RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 call_refreshresult (status 0) RPC: 61 call_refresh (status 0) RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 call_refresh (status 0) RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0 RPC: 61 call_refreshresult (status 0) RPC: 61 call_refresh (status 0) RPC: 61 call_refresh (status 0) RPC: 61 call_refresh (status 0) RPC: 61 call_refresh (status 0) RPC: 61 call_refreshresult (status 0) RPC: 61 refreshing RPCSEC_GSS cred ffff88007a413cf0
--- net/sunrpc/clnt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sunrpc/clnt.c +6 -2
@@ -1402,9 +1402,13 @@ call_refreshresult(struct rpc_task *task task->tk_action = call_refresh;switch (status) {case 0 : -if (rpcauth_uptodatecred (task)) +if (rpcauth_uptodatecred (task)) { task->tk_action = call_allocate; -return ; +return ; + } +/* Use rate-limiting and a max number of retries if refresh +* had status 0 but failed to update the cred. +*/ case -ETIMEDOUT :rpc_delay (task,3 *HZ );case -EAGAIN :
Greg Kroah-Hartman
maintainerPATCH 35/79 dm thin: fix discard support to a previously shared block
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 19fa1a6756ed9e92daa9537c03b47d6b55cc2316 upstream.
If a snapshot is created and later deleted the origin dm_thin_device's snapshotted_time will have been updated to reflect the snapshot's creation time. The 'shared' flag in the dm_thin_lookup_result struct returned from dm_thin_find_block() is an approximation based on snapshotted_time -- this is done to avoid 0(n), or worse, time complexity. In this case, the shared flag would be true.
But because the 'shared' flag reflects an approximation a block can be incorrectly assumed to be shared (e.g. false positive for 'shared' because the snapshot no longer exists). This could result in discards issued to a thin device not being passed down to the pool's underlying data device.
To fix this we double check that a thin block is really still in-use after a mapping is removed using dm_pool_block_is_used(). If the reference count for a block is now zero the discard is allowed to be passed down.
Also add a 'definitely_not_shared' member to the dm_thin_new_mapping structure -- reflects that the 'shared' flag in the response from dm_thin_find_block() can only be held as definitive if false is returned.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1043527
--- drivers/md/dm-thin-metadata.c | 20 ++++++++++++++++++++ drivers/md/dm-thin-metadata.h | 2 ++ drivers/md/dm-thin.c | 14 ++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-)
drivers/md/dm-thin-metadata.c +20 -0
@@ -1349,6 +1349,12 @@ dm_thin_id dm_thin_dev_id(struct dm_thinreturn td->id; } +/* +* Check whether @time (of block creation) is older than @td's last snapshot. +* If so then the associated block is shared with the last snapshot device. +* Any block on a device created *after* the device last got snapshotted is +* necessarily not shared. +*/ static bool __snapshotted_since (struct dm_thin_device *td,uint32_t time) {return td->snapshotted_time > time;
@@ -1457,6 +1463,20 @@ int dm_thin_remove_block(struct dm_thin_return r; } + +int dm_pool_block_is_used (struct dm_pool_metadata *pmd,dm_block_t b,bool *result) +{ +int r; +uint32_t ref_count; + +down_read (&pmd->root_lock); + r =dm_sm_get_count (pmd->data_sm, b, &ref_count); +if (!r) + *result = (ref_count !=0 ); +up_read (&pmd->root_lock); + +return r; +}bool dm_thin_changed_this_transaction (struct dm_thin_device *td) {
drivers/md/dm-thin-metadata.h +2 -0
@@ -181,6 +181,8 @@ int dm_pool_get_data_block_size(struct dint dm_pool_get_data_dev_size (struct dm_pool_metadata *pmd,dm_block_t *result); +int dm_pool_block_is_used (struct dm_pool_metadata *pmd,dm_block_t b,bool *result); +/* * Returns -ENOSPC if the new size is too small and already allocated * blocks would be lost.
drivers/md/dm-thin.c +12 -2
@@ -512,6 +512,7 @@ struct dm_thin_new_mapping { unsigned quiesced:1; unsigned prepared:1; unsigned pass_discard:1; + unsigned definitely_not_shared:1;struct thin_c *tc;dm_block_t virt_block;
@@ -683,7 +684,15 @@ static void process_prepared_discard_pascell_defer_no_holder (tc, m->cell2);if (m->pass_discard) -remap_and_issue (tc, m->bio, m->data_block); +if (m->definitely_not_shared) +remap_and_issue (tc, m->bio, m->data_block); +else { +bool used = false; +if (dm_pool_block_is_used (tc->pool->pmd, m->data_block, &used) || used) +bio_endio (m->bio,0 ); +else +remap_and_issue (tc, m->bio, m->data_block); + }else bio_endio (m->bio,0 );
@@ -1032,7 +1041,8 @@ static void process_discard(struct thin_*/ m =get_next_mapping (pool); m->tc = tc; - m->pass_discard = (!lookup_result.shared) && pool->pf.discard_passdown; + m->pass_discard = pool->pf.discard_passdown; + m->definitely_not_shared = !lookup_result.shared; m->virt_block = block; m->data_block = lookup_result.block; m->cell = cell;
Greg Kroah-Hartman
maintainerPATCH 36/79 dm thin: initialize dm_thin_new_mapping returned by get_next_mapping
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 16961b042db8cc5cf75d782b4255193ad56e1d4f upstream.
As additional members are added to the dm_thin_new_mapping structure care should be taken to make sure they get initialized before use.
--- drivers/md/dm-thin.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/md/dm-thin.c +6 -11
@@ -760,13 +760,17 @@ static int ensure_next_mapping(struct postatic struct dm_thin_new_mapping *get_next_mapping (struct pool *pool) { -struct dm_thin_new_mapping *r = pool->next_mapping; +struct dm_thin_new_mapping *m = pool->next_mapping;BUG_ON (!pool->next_mapping); +memset (m,0 ,sizeof (struct dm_thin_new_mapping )); +INIT_LIST_HEAD (&m->list); + m->bio =NULL ; + pool->next_mapping =NULL ; -return r; +return m; } static void schedule_copy(struct thin_c *tc, dm_block_t virt_block,
@@ -778,15 +782,10 @@ static void schedule_copy(struct thin_cstruct pool *pool = tc->pool;struct dm_thin_new_mapping *m =get_next_mapping (pool); -INIT_LIST_HEAD (&m->list); - m->quiesced =0 ; - m->prepared =0 ; m->tc = tc; m->virt_block = virt_block; m->data_block = data_dest; m->cell = cell; - m->err =0 ; - m->bio =NULL ;if (!dm_deferred_set_add_work (pool->shared_read_ds, &m->list)) m->quiesced =1 ;
@@ -849,15 +848,12 @@ static void schedule_zero(struct thin_cstruct pool *pool = tc->pool;struct dm_thin_new_mapping *m =get_next_mapping (pool); -INIT_LIST_HEAD (&m->list); m->quiesced =1 ; m->prepared =0 ; m->tc = tc; m->virt_block = virt_block; m->data_block = data_block; m->cell = cell; - m->err =0 ; - m->bio =NULL ;/* * If the whole block of data is being overwritten or we are not
@@ -1047,7 +1043,6 @@ static void process_discard(struct thin_ m->data_block = lookup_result.block; m->cell = cell; m->cell2 = cell2; - m->err =0 ; m->bio = bio;if (!dm_deferred_set_add_work (pool->all_io_ds, &m->list)) {
Greg Kroah-Hartman
maintainerPATCH 37/79 dm: wait until embedded kobject is released before destroying a device
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit be35f486108227e10fe5d96fd42fb2b344c59983 upstream.
There may be other parts of the kernel holding a reference on the dm kobject. We must wait until all references are dropped before deallocating the mapped_device structure.
The dm_kobject_release method signals that all references are dropped via completion. But dm_kobject_release doesn't free the kobject (which is embedded in the mapped_device structure).
This is the sequence of operations:
* when destroying a DM device, call kobject_put from dm_sysfs_exit
* wait until all users stop using the kobject, when it happens the release method is called
* the release method signals the completion and should return without delay
* the dm device removal code that waits on the completion continues
* the dm device removal code drops the dm_mod reference the device had
* the dm device removal code frees the mapped_device structure that contains the kobject
Using kobject this way should avoid the module unload race that was mentioned at the beginning of this thread:
https://lkml.org/lkml/2014/1/4/83
--- drivers/md/dm-sysfs.c | 10 +++++++++- drivers/md/dm.c | 11 +++++++++++ drivers/md/dm.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-)
drivers/md/dm-sysfs.c +9 -1
@@ -79,6 +79,11 @@ static const struct sysfs_ops dm_sysfs_o .show = dm_attr_show, }; +static void dm_kobject_release (struct kobject *kobj) +{ +complete (dm_get_completion_from_kobject (kobj)); +} +/* * dm kobject is embedded in mapped_device structure * no need to define release function here
@@ -86,6 +91,7 @@ static const struct sysfs_ops dm_sysfs_ostatic struct kobj_type dm_ktype = { .sysfs_ops = &dm_sysfs_ops, .default_attrs = dm_attrs, + .release = dm_kobject_release, };/*
@@ -104,5 +110,7 @@ int dm_sysfs_init(struct mapped_device **/ void dm_sysfs_exit (struct mapped_device *md) { -kobject_put (dm_kobject (md)); +struct kobject *kobj =dm_kobject (md); +kobject_put (kobj); +wait_for_completion (dm_get_completion_from_kobject (kobj)); }
drivers/md/dm.c +11 -0
@@ -187,6 +187,9 @@ struct mapped_device {/* sysfs handle */ struct kobject kobj; +/* wait until the kobject is released */ +struct completion kobj_completion; +/* zero-length flush that will be cloned and submitted to targets */ struct bio flush_bio; };
@@ -1904,6 +1907,7 @@ static struct mapped_device *alloc_dev(iinit_waitqueue_head (&md->wait);INIT_WORK (&md->work, dm_wq_work);init_waitqueue_head (&md->eventq); +init_completion (&md->kobj_completion); md->disk->major = _major; md->disk->first_minor = minor;
@@ -2758,6 +2762,13 @@ struct mapped_device *dm_get_from_kobjecreturn md; } +struct completion *dm_get_completion_from_kobject (struct kobject *kobj) +{ + struct mapped_device *md = container_of(kobj, struct mapped_device, kobj); + +return &md->kobj_completion; +} +int dm_suspended_md (struct mapped_device *md) {return test_bit (DMF_SUSPENDED , &md->flags);
drivers/md/dm.h +2 -0
@@ -15,6 +15,7 @@#include <linux/list.h> #include <linux/blkdev.h> #include <linux/hdreg.h> +#include <linux/completion.h> /* * Suspend feature flags
@@ -129,6 +130,7 @@ int dm_sysfs_init(struct mapped_device *void dm_sysfs_exit (struct mapped_device *md);struct kobject *dm_kobject (struct mapped_device *md);struct mapped_device *dm_get_from_kobject (struct kobject *kobj); +struct completion *dm_get_completion_from_kobject (struct kobject *kobj);/* * Targets for linear and striped mappings
Greg Kroah-Hartman
maintainerPATCH 38/79 dm space map common: make sure new space is used during extend
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 12c91a5c2d2a8e8cc40a9552313e1e7b0a2d9ee3 upstream.
When extending a low level space map we should update nr_blocks at the start so the new space is used for the index entries.
Otherwise extend can fail, e.g.: sm_metadata_extend call sequence that fails:
-> sm_ll_extend
-> dm_tm_new_block -> dm_sm_new_block -> sm_bootstrap_new_block
=> returns -ENOSPC because smm->begin == smm->ll.nr_blocks--- drivers/md/persistent-data/dm-space-map-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/md/persistent-data/dm-space-map-common.c +5 -1
@@ -245,6 +245,10 @@ int sm_ll_extend(struct ll_disk *ll, dm_return -EINVAL ; } +/* +* We need to set this before the dm_tm_new_block() call below. +*/ + ll->nr_blocks = nr_blocks;for (i = old_blocks; i < blocks; i++) {struct dm_block *b;struct disk_index_entry idx;
@@ -252,6 +256,7 @@ int sm_ll_extend(struct ll_disk *ll, dm_ r =dm_tm_new_block (ll->tm, &dm_sm_bitmap_validator, &b);if (r <0 )return r; + idx.blocknr =cpu_to_le64 (dm_block_location (b)); r =dm_tm_unlock (ll->tm, b);
@@ -266,7 +271,6 @@ int sm_ll_extend(struct ll_disk *ll, dm_return r; } - ll->nr_blocks = nr_blocks;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 39/79 dm space map metadata: fix extending the space map
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 7e664b3dec431eebf0c5df5ff704d6197634cf35 upstream.
When extending a metadata space map we should do the first commit whilst still in bootstrap mode -- a mode where all blocks get allocated in the new area.
That way the commit overhead is allocated from the newly added space. Otherwise we risk running out of space.
With this fix, and the previous commit "dm space map common: make sure new space is used during extend", the following device mapper testsuite test passes:
dmtest run --suite thin-provisioning -n /resize_metadata_no_io/
--- drivers/md/persistent-data/dm-space-map-metadata.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +13 -5
@@ -608,20 +608,28 @@ static int sm_metadata_extend(struct dm_* Flick into a mode where all blocks get allocated in the new area. */ smm->begin = old_len; -memcpy (&smm->sm, &bootstrap_ops,sizeof (smm->sm)); +memcpy (sm, &bootstrap_ops,sizeof (*sm));/* * Extend. */ r =sm_ll_extend (&smm->ll, extra_blocks); +if (r) + goto out; +for (i = old_len; !r && i < smm->begin; i++) { + r =sm_ll_inc (&smm->ll, i, &ev); +if (r) + goto out; + } + + r =sm_metadata_commit (sm); + +out:/* * Switch back to normal behaviour. */ -memcpy (&smm->sm, &ops,sizeof (smm->sm)); -for (i = old_len; !r && i < smm->begin; i++) - r =sm_ll_inc (&smm->ll, i, &ev); - +memcpy (sm, &ops,sizeof (*sm));return r; }
Greg Kroah-Hartman
maintainerPATCH 40/79 dm space map metadata: fix bug in resizing of thin metadata
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit fca028438fb903852beaf7c3fe1cd326651af57d upstream.
This bug was introduced in commit 7e664b3dec431e ("dm space map metadata:
fix extending the space map").
When extending a dm-thin metadata volume we:
- Switch the space map into a simple bootstrap mode, which allocates all space linearly from the newly added space.
- Add new bitmap entries for the new space
- Increment the reference counts for those newly allocated bitmap entries
- Commit changes to disk
- Switch back out of bootstrap mode.
But, the disk commit may allocate space itself, if so this fact will be lost when switching out of bootstrap mode.
The bug exhibited itself as an error when the bitmap_root, with an erroneous ref count of 0, was subsequently decremented as part of a later disk commit. This would cause the disk commit to fail, and thinp to enter read_only mode. The metadata was not damaged (thin_check passed).
The fix is to put the increments + commit into a loop, running until the commit has not allocated extra space. In practise this loop only runs twice.
With this fix the following device mapper testsuite test passes:
dmtest run --suite thin-provisioning -n thin_remove_works_after_resize
--- drivers/md/persistent-data/dm-space-map-metadata.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +14 -4
@@ -617,13 +617,23 @@ static int sm_metadata_extend(struct dm_if (r) goto out; -for (i = old_len; !r && i < smm->begin; i++) { - r =sm_ll_inc (&smm->ll, i, &ev); +/* +* We repeatedly increment then commit until the commit doesn't +* allocate any new blocks. +*/ +do { +for (i = old_len; !r && i < smm->begin; i++) { + r =sm_ll_inc (&smm->ll, i, &ev); +if (r) + goto out; + } + old_len = smm->begin; + + r =sm_ll_commit (&smm->ll);if (r) goto out; - } - r =sm_metadata_commit (sm); + }while (old_len != smm->begin); out:/*
Greg Kroah-Hartman
maintainerPATCH 43/79 mm, oom: base root bonus on current usage
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
commit 778c14affaf94a9e4953179d3e13a544ccce7707 upstream.
A 3% of system memory bonus is sometimes too excessive in comparison to other processes.
With commit a63d83f427fb ("oom: badness heuristic rewrite"), the OOM killer tries to avoid killing privileged tasks by subtracting 3% of overall memory (system or cgroup) from their per-task consumption. But as a result, all root tasks that consume less than 3% of overall memory are considered equal, and so it only takes 33+ privileged tasks pushing the system out of memory for the OOM killer to do something stupid and kill dhclient or other root-owned processes. For example, on a 32G machine it can't tell the difference between the 1M agetty and the 10G fork bomb member.
The changelog describes this 3% boost as the equivalent to the global overcommit limit being 3% higher for privileged tasks, but this is not the same as discounting 3% of overall memory from _every privileged task individually_ during OOM selection.
Replace the 3% of system memory bonus with a 3% of current memory usage bonus.
By giving root tasks a bonus that is proportional to their actual size, they remain comparable even when relatively small. In the example above, the OOM killer will discount the 1M agetty's 256 badness points down to 179, and the 10G fork bomb's 262144 points down to 183500 points and make the right choice, instead of discounting both to 0 and killing agetty because it's first in the task list.
--- Documentation/filesystems/proc.txt | 4 ++-- mm/oom_kill.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Documentation/filesystems/proc.txt +2 -2
@@ -1372,8 +1372,8 @@ may allocate from based on an estimation For example, if a task is using all allowed memory, its badness score will be 1000. If it is using half of its allowed memory, its score will be 500. -There is an additional factor included in the badness score: root -processes are given 3% extra memory over other tasks. +There is an additional factor included in the badness score: the current memory +and swap usage is discounted by 3% for root processes. The amount of "allowed" memory depends on the context in which the oom killer was called. If it is due to the memory assigned to the allocating task's cpuset
mm/oom_kill.c +1 -1
@@ -170,7 +170,7 @@ unsigned long oom_badness(struct task_st* implementation used by LSMs. */ if (has_capability_noaudit (p,CAP_SYS_ADMIN )) - adj -=30 ; + points -= (points *3 ) /100 ;/* Normalize to oom_score_adj units */ adj *= totalpages /1000 ;
Greg Kroah-Hartman
maintainerPATCH 44/79 media: anysee: fix non-working E30 Combo Plus DVB-T
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antti Palosaari <[email protected]>
commit c57f87e62368c33ebda11a4993380c8e5a19a5c5 upstream.
PLL was attached twice to frontend0 leaving frontend1 without a tuner. frontend0 is DVB-C and frontend1 is DVB-T.
--- drivers/media/usb/dvb-usb-v2/anysee.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/anysee.c +2 -1
@@ -442,6 +442,7 @@ static struct cxd2820r_config anysee_cxd* IOD[0] ZL10353 1=enabled * IOE[0] tuner 0=enabled * tuner is behind ZL10353 I2C-gate +* tuner is behind TDA10023 I2C-gate * * E7 TC VID=1c73 PID=861f HW=18 FW=0.7 AMTCI=0.5 "anysee-E7TC(LP)" * PCB: 508TC (rev0.6)
@@ -956,7 +957,7 @@ static int anysee_tuner_attach(struct dvif (fe && adap->fe[1 ]) {/* attach tuner for 2nd FE */ - fe =dvb_attach (dvb_pll_attach, adap->fe[0 ], + fe =dvb_attach (dvb_pll_attach, adap->fe[1 ], (0xc0 >>1 ), &d->i2c_adap,DVB_PLL_SAMSUNG_DTOS403IH102A ); }
Greg Kroah-Hartman
maintainerPATCH 45/79 dib8000: make 32 bits read atomic
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 5ac64ba12aca3bef18e61c866583155a3bbf81c4 upstream.
As the dvb-frontend kthread can be called anytime, it can race with some get status ioctl. So, it seems better to avoid one to race with the other while reading a 32 bits register.
I can't see any other reason for having a mutex there at I2C, except to provide such kind of protection, as the I2C core already has a mutex to protect I2C transfers.
Note: instead of this approach, it could eventually remove the dib8000 specific mutex for it, and either group the 4 ops into one xfer or to manually control the I2C mutex. The main advantage of the current approach is that the changes are smaller and more puntual.
--- drivers/media/dvb-frontends/dib8000.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-)
drivers/media/dvb-frontends/dib8000.c +25 -8
@@ -157,15 +157,10 @@ static u16 dib8000_i2c_read16(struct i2creturn ret; } -static u16 dib8000_read_word (struct dib8000_state *state,u16 reg) +static u16 __dib8000_read_word (struct dib8000_state *state,u16 reg) {u16 ret; -if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { -dprintk ("could not acquire lock" ); -return 0 ; - } - state->i2c_write_buffer[0 ] = reg >>8 ; state->i2c_write_buffer[1 ] = reg &0xff ;
@@ -183,6 +178,21 @@ static u16 dib8000_read_word(struct dib8dprintk ("i2c read error on %d" , reg); ret = (state->i2c_read_buffer[0 ] <<8 ) | state->i2c_read_buffer[1 ]; + +return ret; +} + +static u16 dib8000_read_word (struct dib8000_state *state,u16 reg) +{ +u16 ret; + +if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +dprintk ("could not acquire lock" ); +return 0 ; + } + + ret =__dib8000_read_word (state, reg); +mutex_unlock (&state->i2c_buffer_lock);return ret;
@@ -192,8 +202,15 @@ static u32 dib8000_read32(struct dib8000 {u16 rw[2 ]; - rw[0 ] =dib8000_read_word (state, reg +0 ); - rw[1 ] =dib8000_read_word (state, reg +1 ); +if (mutex_lock_interruptible (&state->i2c_buffer_lock) <0 ) { +dprintk ("could not acquire lock" ); +return 0 ; + } + + rw[0 ] =__dib8000_read_word (state, reg +0 ); + rw[1 ] =__dib8000_read_word (state, reg +1 ); + +mutex_unlock (&state->i2c_buffer_lock);return ((rw[0 ] <<16 ) | (rw[1 ])); }
Greg Kroah-Hartman
maintainerPATCH 46/79 media: s5p_mfc: remove s5p_mfc_get_node_type() function
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit b80cb8dc4162bc954cc71efec192ed89f2061573 upstream.
s5p_mfc_get_node_type() relies on get_index() helper function, which in turn relies on video_device index numbers assigned on driver registration. All this code is not really needed, because there is already access to respective video_device structures via common s5p_mfc_dev structure. This fixes the issues introduced by patch 1056e4388b0454917a512618c8416a98628fc9ce ("v4l2-dev: Fix race condition on __video_register_device"), which has been merged in v3.12-rc1.
--- drivers/media/platform/s5p-mfc/s5p_mfc.c | 28 ++++++------------------ drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 9 ------- 2 files changed, 7 insertions(+), 30 deletions(-)
drivers/media/platform/s5p-mfc/s5p_mfc.c +7 -21
@@ -177,21 +177,6 @@ unlock:mutex_unlock (&dev->mfc_mutex); } -static enum s5p_mfc_node_type s5p_mfc_get_node_type (struct file *file) -{ -struct video_device *vdev =video_devdata (file); - -if (!vdev) { -mfc_err ("failed to get video_device" ); -return MFCNODE_INVALID ; - } -if (vdev->index ==0 ) -return MFCNODE_DECODER ; -else if (vdev->index ==1 ) -return MFCNODE_ENCODER ; -return MFCNODE_INVALID ; -} -static void s5p_mfc_clear_int_flags (struct s5p_mfc_dev *dev) {mfc_write (dev,0 ,S5P_FIMV_RISC_HOST_INT );
@@ -701,6 +686,7 @@ irq_cleanup_hw:/* Open an MFC node */ static int s5p_mfc_open (struct file *file) { +struct video_device *vdev =video_devdata (file);struct s5p_mfc_dev *dev =video_drvdata (file);struct s5p_mfc_ctx *ctx =NULL ;struct vb2_queue *q;
@@ -738,7 +724,7 @@ static int s5p_mfc_open(struct file *fil/* Mark context as idle */ clear_work_bit_irqsave (ctx); dev->ctx[ctx->num] = ctx; -if (s5p_mfc_get_node_type (file) ==MFCNODE_DECODER ) { +if (vdev == dev->vfd_dec) { ctx->type =MFCINST_DECODER ; ctx->c_ops =get_dec_codec_ops ();s5p_mfc_dec_init (ctx);
@@ -748,7 +734,7 @@ static int s5p_mfc_open(struct file *filmfc_err ("Failed to setup mfc controls\n" ); goto err_ctrls_setup; } - }else if (s5p_mfc_get_node_type (file) ==MFCNODE_ENCODER ) { + }else if (vdev == dev->vfd_enc) { ctx->type =MFCINST_ENCODER ; ctx->c_ops =get_enc_codec_ops ();/* only for encoder */
@@ -793,10 +779,10 @@ static int s5p_mfc_open(struct file *fil q = &ctx->vq_dst; q->type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ; q->drv_priv = &ctx->fh; -if (s5p_mfc_get_node_type (file) ==MFCNODE_DECODER ) { +if (vdev == dev->vfd_dec) { q->io_modes =VB2_MMAP ; q->ops =get_dec_queue_ops (); - }else if (s5p_mfc_get_node_type (file) ==MFCNODE_ENCODER ) { + }else if (vdev == dev->vfd_enc) { q->io_modes =VB2_MMAP |VB2_USERPTR ; q->ops =get_enc_queue_ops (); }else {
@@ -815,10 +801,10 @@ static int s5p_mfc_open(struct file *fil q->type =V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ; q->io_modes =VB2_MMAP ; q->drv_priv = &ctx->fh; -if (s5p_mfc_get_node_type (file) ==MFCNODE_DECODER ) { +if (vdev == dev->vfd_dec) { q->io_modes =VB2_MMAP ; q->ops =get_dec_queue_ops (); - }else if (s5p_mfc_get_node_type (file) ==MFCNODE_ENCODER ) { + }else if (vdev == dev->vfd_enc) { q->io_modes =VB2_MMAP |VB2_USERPTR ; q->ops =get_enc_queue_ops (); }else {
drivers/media/platform/s5p-mfc/s5p_mfc_common.h +0 -9
@@ -113,15 +113,6 @@ enum s5p_mfc_fmt_type { };/** -* enum s5p_mfc_node_type - The type of an MFC device node. -*/ -enum s5p_mfc_node_type { -MFCNODE_INVALID =-1 , -MFCNODE_DECODER =0 , -MFCNODE_ENCODER =1 , -}; - -/** * enum s5p_mfc_inst_type - The type of an MFC instance. */ enum s5p_mfc_inst_type {
Greg Kroah-Hartman
maintainerPATCH 47/79 nxt200x: increase write buffer size
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit fa1e1de6bb679f2c86da3311bbafee7eaf78f125 upstream.
The buffer size on nxt200x is not enough:
... > Dec 20 10:52:04 rich kernel: [ 31.747949] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=255 is too big! ...
Increase it to 256 bytes.
--- drivers/media/dvb-frontends/nxt200x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/nxt200x.c +1 -1
@@ -40,7 +40,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt/* Max transfer size done by I2C transfer functions */ -#define MAX_XFER_SIZE 64 +#define MAX_XFER_SIZE 256#define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw"#define NXT2004_DEFAULT_FIRMWARE "dvb-fe-nxt2004.fw"
Greg Kroah-Hartman
maintainerPATCH 48/79 dib8000: fix regression with dib807x
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Grenie <[email protected]>
commit d67350f8c4e67f5eba627e1fd111f16257ca9c95 upstream.
Commit 173a64cb3fcf broke support for some dib807x versions.
Fix it by providing backward compatibility with the older versions.
[[email protected]: conflict handling and CodingStyle fixes]
--- drivers/media/dvb-frontends/dib8000.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/dib8000.c +6 -3
@@ -2462,7 +2462,8 @@ static int dib8000_autosearch_start(struif (state->revision ==0x8090 ) internal =dib8000_read32 (state,23 ) /1000 ; -if (state->autosearch_state ==AS_SEARCHING_FFT ) { +if ((state->revision >=0x8002 ) && + (state->autosearch_state ==AS_SEARCHING_FFT )) {dib8000_write_word (state,37 ,0x0065 );/* P_ctrl_pha_off_max default values */ dib8000_write_word (state,116 ,0x0000 );/* P_ana_gain to 0 */
@@ -2498,7 +2499,8 @@ static int dib8000_autosearch_start(strudib8000_write_word (state,770 , (dib8000_read_word (state,770 ) &0xdfff ) | (1 <<13 ));/* P_restart_ccg = 1 */ dib8000_write_word (state,770 , (dib8000_read_word (state,770 ) &0xdfff ) | (0 <<13 ));/* P_restart_ccg = 0 */ dib8000_write_word (state,0 , (dib8000_read_word (state,0 ) &0x7ff ) | (0 <<15 ) | (1 <<13 ));/* P_restart_search = 0; */ - }else if (state->autosearch_state ==AS_SEARCHING_GUARD ) { + }else if ((state->revision >=0x8002 ) && + (state->autosearch_state ==AS_SEARCHING_GUARD )) { c->transmission_mode =TRANSMISSION_MODE_8K ; c->guard_interval =GUARD_INTERVAL_1_8 ; c->inversion =0 ;
@@ -2600,7 +2602,8 @@ static int dib8000_autosearch_irq(structstruct dib8000_state *state = fe->demodulator_priv;u16 irq_pending =dib8000_read_word (state,1284 ); -if (state->autosearch_state ==AS_SEARCHING_FFT ) { +if ((state->revision >=0x8002 ) && + (state->autosearch_state ==AS_SEARCHING_FFT )) {if (irq_pending &0x1 ) {dprintk ("dib8000_autosearch_irq: max correlation result available" );return 3 ;
Greg Kroah-Hartman
maintainerPATCH 49/79 m88rs2000: add m88rs2000_set_carrieroffset
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 06af15d1b6f45c60358feab88004472e5428f01c upstream.
Set the carrier offset correctly using the default mclk values.
Add function m88rs2000_get_mclk to calculate the mclk value against crystal frequency which will later be used for other functions.
Add function m88rs2000_set_carrieroffset to calculate and set the offset value.
variable offset becomes a signed value.
Register 0x86 is set the appropriate value according to remainder value of frequency % 192857 calculation as shown.
--- drivers/media/dvb-frontends/m88rs2000.c | 77 +++++++++++++++++++++++--------- drivers/media/dvb-frontends/m88rs2000.h | 2 2 files changed, 59 insertions(+), 20 deletions(-)
drivers/media/dvb-frontends/m88rs2000.c +57 -20
@@ -110,6 +110,52 @@ static u8 m88rs2000_readreg(struct m88rsreturn b1[0 ]; } +static u32 m88rs2000_get_mclk (struct dvb_frontend *fe) +{ +struct m88rs2000_state *state = fe->demodulator_priv; +u32 mclk; +u8 reg; +/* Must not be 0x00 or 0xff */ + reg =m88rs2000_readreg (state,0x86 ); +if (!reg || reg ==0xff ) +return 0 ; + + reg /=2 ; + reg +=1 ; + + mclk = (u32)(reg *RS2000_FE_CRYSTAL_KHZ +28 /2 ) /28 ; + +return mclk; +} + +static int m88rs2000_set_carrieroffset (struct dvb_frontend *fe,s16 offset) +{ +struct m88rs2000_state *state = fe->demodulator_priv; +u32 mclk; +s32 tmp; +u8 reg; +int ret; + + mclk =m88rs2000_get_mclk (fe); +if (!mclk) +return -EINVAL ; + + tmp = (offset *4096 + (s32 )mclk /2 ) / (s32 )mclk; +if (tmp <0 ) + tmp +=4096 ; + +/* Carrier Offset */ + ret =m88rs2000_writereg (state,0x9c , (u8)(tmp >>4 )); + + reg =m88rs2000_readreg (state,0x9d ); + reg &=0xf ; + reg |= (u8)(tmp &0xf ) <<4 ; + + ret |=m88rs2000_writereg (state,0x9d , reg); + +return ret; +} +static int m88rs2000_set_symbolrate (struct dvb_frontend *fe,u32 srate) {struct m88rs2000_state *state = fe->demodulator_priv;
@@ -540,9 +586,8 @@ static int m88rs2000_set_frontend(structstruct dtv_frontend_properties *c = &fe->dtv_property_cache;fe_status_t status;int i, ret =0 ; -s32 tmp;u32 tuner_freq; -u16 offset =0 ; +s16 offset =0 ;u8 reg; state->no_lock_count =0 ;
@@ -567,26 +612,18 @@ static int m88rs2000_set_frontend(structif (ret <0 )return -ENODEV ; - offset = tuner_freq - c->frequency; + offset = (s16)((s32 )tuner_freq - c->frequency); -/* calculate offset assuming 96000kHz*/ - tmp = offset; - tmp *=65536 ; - - tmp = (2 * tmp +96000 ) / (2 *96000 ); -if (tmp <0 ) - tmp +=65536 ; - - offset = tmp &0xffff ; - - ret =m88rs2000_writereg (state,0x9a ,0x30 ); -/* Unknown usually 0xc6 sometimes 0xc1 */ - reg =m88rs2000_readreg (state,0x86 ); - ret |=m88rs2000_writereg (state,0x86 , reg); -/* Offset lower nibble always 0 */ - ret |=m88rs2000_writereg (state,0x9c , (offset >>8 )); - ret |=m88rs2000_writereg (state,0x9d , offset &0xf0 ); +/* default mclk value 96.4285 * 2 * 1000 = 192857 */ +if (((c->frequency %192857 ) >= (192857 -3000 )) || + (c->frequency %192857 ) <=3000 ) + ret =m88rs2000_writereg (state,0x86 ,0xc2 ); +else + ret =m88rs2000_writereg (state,0x86 ,0xc6 ); + ret |=m88rs2000_set_carrieroffset (fe, offset); +if (ret <0 ) +return -ENODEV ;/* Reset Demod */ ret =m88rs2000_tab_set (state, fe_reset);
drivers/media/dvb-frontends/m88rs2000.h +2 -0
@@ -53,6 +53,8 @@ static inline struct dvb_frontend *m88rs }#endif /* CONFIG_DVB_M88RS2000 */ +#define RS2000_FE_CRYSTAL_KHZ 27000 +enum {DEMOD_WRITE =0x1 ,WRITE_DELAY =0x10 ,
Greg Kroah-Hartman
maintainerPATCH 50/79 m88rs2000: set symbol rate accurately
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit dd4491dfb9eb4fa3bfa7dc73ba989e69fbce2e10 upstream.
Current setting of symbol rate is not very actuate causing loss of lock.
Covert temp to u64 and use mclk to calculate from big number.
Calculate symbol rate by dividing symbol rate by 1000 times 1 << 24 and dividing sum by mclk.
Add other symbol rate settings to function registers 0xa0-0xa3.
In set_frontend add changes to register 0xf1 this must be done prior call to fe_reset. Register 0x00 doesn't need a second write of 0x1
Applied after patch
m88rs2000: add m88rs2000_set_carrieroffset
--- drivers/media/dvb-frontends/m88rs2000.c | 42 +++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 11 deletions(-)
drivers/media/dvb-frontends/m88rs2000.c +31 -11
@@ -160,24 +160,44 @@ static int m88rs2000_set_symbolrate(stru {struct m88rs2000_state *state = fe->demodulator_priv;int ret; -u32 temp; +u64 temp; +u32 mclk;u8 b[3 ];if ((srate <1000000 ) || (srate >45000000 ))return -EINVAL ; + mclk =m88rs2000_get_mclk (fe); +if (!mclk) +return -EINVAL ; + temp = srate /1000 ; - temp *=11831 ; - temp /=68 ; - temp -=3 ; + temp *=1 <<24 ; + +do_div (temp, mclk); b[0 ] = (u8) (temp >>16 ) &0xff ; b[1 ] = (u8) (temp >>8 ) &0xff ; b[2 ] = (u8 ) temp &0xff ; + ret =m88rs2000_writereg (state,0x93 , b[2 ]); ret |=m88rs2000_writereg (state,0x94 , b[1 ]); ret |=m88rs2000_writereg (state,0x95 , b[0 ]); +if (srate >10000000 ) + ret |=m88rs2000_writereg (state,0xa0 ,0x20 ); +else + ret |=m88rs2000_writereg (state,0xa0 ,0x60 ); + + ret |=m88rs2000_writereg (state,0xa1 ,0xe0 ); + +if (srate >12000000 ) + ret |=m88rs2000_writereg (state,0xa3 ,0x20 ); +else if (srate >2800000 ) + ret |=m88rs2000_writereg (state,0xa3 ,0x98 ); +else + ret |=m88rs2000_writereg (state,0xa3 ,0x90 ); +deb_info ("m88rs2000: m88rs2000_set_symbolrate\n" );return ret; }
@@ -307,8 +327,6 @@ struct inittab m88rs2000_shutdown[] = {struct inittab fe_reset[] = { {DEMOD_WRITE ,0x00 ,0x01 }, - {DEMOD_WRITE ,0xf1 ,0xbf }, - {DEMOD_WRITE ,0x00 ,0x01 }, {DEMOD_WRITE ,0x20 ,0x81 }, {DEMOD_WRITE ,0x21 ,0x80 }, {DEMOD_WRITE ,0x10 ,0x33 },
@@ -351,9 +369,6 @@ struct inittab fe_trigger[] = { {DEMOD_WRITE, 0x9b, 0x64}, {DEMOD_WRITE, 0x9e, 0x00}, {DEMOD_WRITE, 0x9f, 0xf8}, - {DEMOD_WRITE, 0xa0, 0x20}, - {DEMOD_WRITE, 0xa1, 0xe0}, - {DEMOD_WRITE, 0xa3, 0x38}, {DEMOD_WRITE, 0x98, 0xff}, {DEMOD_WRITE, 0xc0, 0x0f}, {DEMOD_WRITE, 0x89, 0x01},
@@ -625,8 +640,13 @@ static int m88rs2000_set_frontend(structif (ret <0 )return -ENODEV ; -/* Reset Demod */ - ret =m88rs2000_tab_set (state, fe_reset); +/* Reset demod by symbol rate */ +if (c->symbol_rate >27500000 ) + ret =m88rs2000_writereg (state,0xf1 ,0xa4 ); +else + ret =m88rs2000_writereg (state,0xf1 ,0xbf ); + + ret |=m88rs2000_tab_set (state, fe_reset);if (ret <0 )return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 52/79 drm/radeon: disable ss on DP for DCE3.x
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit d8e24525094200601236fa64a54cf73e3d682f2e upstream.
Seems to cause problems with certain DP monitors.
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=40699
--- drivers/gpu/drm/radeon/atombios_crtc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/atombios_crtc.c +4 -1
@@ -938,11 +938,14 @@ static bool atombios_crtc_prepare_pll(stradeon_atombios_get_ppll_ss_info (rdev, &radeon_crtc->ss,ATOM_DP_SS_ID1 ); - }else + }else { radeon_crtc->ss_enabled =radeon_atombios_get_ppll_ss_info (rdev, &radeon_crtc->ss,ATOM_DP_SS_ID1 ); + } +/* disable spread spectrum on DCE3 DP */ + radeon_crtc->ss_enabled = false; }break ;case ATOM_ENCODER_MODE_LVDS :
Greg Kroah-Hartman
maintainerPATCH 53/79 drm/radeon: fix surface sync in fence on cayman (v2)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 10e9ffae463396c5a25fdfe8a48d7c98a87f6b85 upstream.
We need to set the engine bit to select the ME and also set the full cache bit. Should help stability on TN and cayman.
V2: fix up surface sync in ib execute as well
--- drivers/gpu/drm/radeon/ni.c | 16 +++++++--------- drivers/gpu/drm/radeon/nid.h | 1 + 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/radeon/ni.c +7 -9
@@ -1178,13 +1178,12 @@ void cayman_fence_ring_emit(struct radeo {struct radeon_ring *ring = &rdev->ring[fence->ring];u64 addr = rdev->fence_drv[fence->ring].gpu_addr; +u32 cp_coher_cntl =PACKET3_FULL_CACHE_ENA |PACKET3_TC_ACTION_ENA | +PACKET3_SH_ACTION_ENA ;/* flush read cache over gart for this vmid */ -radeon_ring_write (ring,PACKET3 (PACKET3_SET_CONFIG_REG ,1 )); -radeon_ring_write (ring, (CP_COHER_CNTL2 -PACKET3_SET_CONFIG_REG_START ) >>2 ); -radeon_ring_write (ring,0 );radeon_ring_write (ring,PACKET3 (PACKET3_SURFACE_SYNC ,3 )); -radeon_ring_write (ring,PACKET3_TC_ACTION_ENA |PACKET3_SH_ACTION_ENA ); +radeon_ring_write (ring,PACKET3_ENGINE_ME | cp_coher_cntl);radeon_ring_write (ring,0xFFFFFFFF );radeon_ring_write (ring,0 );radeon_ring_write (ring,10 );/* poll interval */
@@ -1200,6 +1199,8 @@ void cayman_fence_ring_emit(struct radeovoid cayman_ring_ib_execute (struct radeon_device *rdev,struct radeon_ib *ib) {struct radeon_ring *ring = &rdev->ring[ib->ring]; +u32 cp_coher_cntl =PACKET3_FULL_CACHE_ENA |PACKET3_TC_ACTION_ENA | +PACKET3_SH_ACTION_ENA ;/* set to DX10/11 mode */ radeon_ring_write (ring,PACKET3 (PACKET3_MODE_CONTROL ,0 ));
@@ -1224,14 +1225,11 @@ void cayman_ring_ib_execute(struct radeo (ib->vm ? (ib->vm->id << 24) : 0));/* flush read cache over gart for this vmid */ -radeon_ring_write (ring,PACKET3 (PACKET3_SET_CONFIG_REG ,1 )); -radeon_ring_write (ring, (CP_COHER_CNTL2 -PACKET3_SET_CONFIG_REG_START ) >>2 ); -radeon_ring_write (ring, ib->vm ? ib->vm->id :0 );radeon_ring_write (ring,PACKET3 (PACKET3_SURFACE_SYNC ,3 )); -radeon_ring_write (ring,PACKET3_TC_ACTION_ENA |PACKET3_SH_ACTION_ENA ); +radeon_ring_write (ring,PACKET3_ENGINE_ME | cp_coher_cntl);radeon_ring_write (ring,0xFFFFFFFF );radeon_ring_write (ring,0 ); -radeon_ring_write (ring,10 );/* poll interval */ +radeon_ring_write (ring, ((ib->vm ? ib->vm->id :0 ) <<24 ) |10 );/* poll interval */ } void cayman_uvd_semaphore_emit(struct radeon_device *rdev,
drivers/gpu/drm/radeon/nid.h +1 -0
@@ -573,6 +573,7 @@# define PACKET3_DB_ACTION_ENA (1 << 26)# define PACKET3_SH_ACTION_ENA (1 << 27)# define PACKET3_SX_ACTION_ENA (1 << 28) +# define PACKET3_ENGINE_ME (1 << 31)#define PACKET3_ME_INITIALIZE 0x44#define PACKET3_ME_INITIALIZE_DEVICE_ID (x) ((x) << 16)#define PACKET3_COND_WRITE 0x45
Greg Kroah-Hartman
maintainerPATCH 54/79 drm/radeon: set the full cache bit for fences on r7xx+
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit d45b964a22cad962d3ede1eba8d24f5cee7b2a92 upstream.
Needed to properly flush the read caches for fences.
--- drivers/gpu/drm/radeon/r600.c | 13 +++++++------ drivers/gpu/drm/radeon/r600d.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/r600.c +7 -6
@@ -2957,14 +2957,17 @@ void r600_fence_ring_emit(struct radeon_ struct radeon_fence *fence) {struct radeon_ring *ring = &rdev->ring[fence->ring]; +u32 cp_coher_cntl =PACKET3_TC_ACTION_ENA |PACKET3_VC_ACTION_ENA | +PACKET3_SH_ACTION_ENA ; + +if (rdev->family >=CHIP_RV770 ) + cp_coher_cntl |=PACKET3_FULL_CACHE_ENA ;if (rdev->wb.use_event) {u64 addr = rdev->fence_drv[fence->ring].gpu_addr;/* flush read cache over gart */ radeon_ring_write (ring,PACKET3 (PACKET3_SURFACE_SYNC ,3 )); -radeon_ring_write (ring,PACKET3_TC_ACTION_ENA | -PACKET3_VC_ACTION_ENA | -PACKET3_SH_ACTION_ENA ); +radeon_ring_write (ring, cp_coher_cntl);radeon_ring_write (ring,0xFFFFFFFF );radeon_ring_write (ring,0 );radeon_ring_write (ring,10 );/* poll interval */
@@ -2978,9 +2981,7 @@ void r600_fence_ring_emit(struct radeon_ }else {/* flush read cache over gart */ radeon_ring_write (ring,PACKET3 (PACKET3_SURFACE_SYNC ,3 )); -radeon_ring_write (ring,PACKET3_TC_ACTION_ENA | -PACKET3_VC_ACTION_ENA | -PACKET3_SH_ACTION_ENA ); +radeon_ring_write (ring, cp_coher_cntl);radeon_ring_write (ring,0xFFFFFFFF );radeon_ring_write (ring,0 );radeon_ring_write (ring,10 );/* poll interval */
drivers/gpu/drm/radeon/r600d.h +1 -0
@@ -1283,6 +1283,7 @@# define PACKET3_CP_DMA_CMD_DAIC (1 << 29)#define PACKET3_SURFACE_SYNC 0x43# define PACKET3_CB0_DEST_BASE_ENA (1 << 6) +# define PACKET3_FULL_CACHE_ENA (1 << 20)/* r7xx+ only */ # define PACKET3_TC_ACTION_ENA (1 << 23)# define PACKET3_VC_ACTION_ENA (1 << 24)# define PACKET3_CB_ACTION_ENA (1 << 25)
Greg Kroah-Hartman
maintainerPATCH 55/79 drm/radeon: fix DAC interrupt handling on DCE5+
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit e9a321c6b2ac954a7dbf235f419c255a424a1273 upstream.
DCE5 and newer hardware only has 1 DAC. Use the correct offset. This may fix display problems on certain board configurations.
--- drivers/gpu/drm/radeon/evergreen.c | 4 ++-- drivers/gpu/drm/radeon/si.c | 2 +- drivers/gpu/drm/radeon/sid.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +2 -2
@@ -3792,8 +3792,8 @@ void evergreen_disable_interrupt_state(sWREG32 (GRPH_INT_CONTROL +EVERGREEN_CRTC5_REGISTER_OFFSET ,0 ); } -/* only one DAC on DCE6 */ -if (!ASIC_IS_DCE6 (rdev)) +/* only one DAC on DCE5 */ +if (!ASIC_IS_DCE5 (rdev))WREG32 (DACA_AUTODETECT_INT_CONTROL ,0 );WREG32 (DACB_AUTODETECT_INT_CONTROL ,0 );
drivers/gpu/drm/radeon/si.c +1 -1
@@ -4519,7 +4519,7 @@ static void si_disable_interrupt_state(s }if (!ASIC_IS_NODCE (rdev)) { -WREG32 (DACA_AUTODETECT_INT_CONTROL ,0 ); +WREG32 (DAC_AUTODETECT_INT_CONTROL ,0 ); tmp =RREG32 (DC_HPD1_INT_CONTROL ) & DC_HPDx_INT_POLARITY;WREG32 (DC_HPD1_INT_CONTROL , tmp);
drivers/gpu/drm/radeon/sid.h +1 -1
@@ -394,7 +394,7 @@# define GRPH_PFLIP_INT_MASK (1 << 0)# define GRPH_PFLIP_INT_TYPE (1 << 8) -#define DACA_AUTODETECT_INT_CONTROL 0x66c8 +#define DAC_AUTODETECT_INT_CONTROL 0x67c8#define DC_HPD1_INT_STATUS 0x601c#define DC_HPD2_INT_STATUS 0x6028
Greg Kroah-Hartman
maintainerPATCH 56/79 drm/radeon/DCE4+: clear bios scratch dpms bit (v2)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 6802d4bad83f50081b2788698570218aaff8d10e upstream.
The BlankCrtc table in some DCE8 boards has some logic shortcuts for the vbios when this bit is set. Clear it for driver use.
v2: fix typo
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=73420
--- drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_atombios.c +4 -0
@@ -2926,6 +2926,10 @@ void radeon_atom_initialize_bios_scratch/* tell the bios not to handle mode switching */ bios_6_scratch |=ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH ; +/* clear the vbios dpms state */ +if (ASIC_IS_DCE4 (rdev)) + bios_2_scratch &= ~ATOM_S2_DEVICE_DPMS_STATE ; +if (rdev->family >=CHIP_R600 ) {WREG32 (R600_BIOS_2_SCRATCH , bios_2_scratch);WREG32 (R600_BIOS_6_SCRATCH , bios_6_scratch);
Greg Kroah-Hartman
maintainerPATCH 57/79 dm sysfs: fix a module unload race
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 2995fa78e423d7193f3b57835f6c1c75006a0315 upstream.
This reverts commit be35f48610 ("dm: wait until embedded kobject is released before destroying a device") and provides an improved fix.
The kobject release code that calls the completion must be placed in a non-module file, otherwise there is a module unload race (if the process calling dm_kobject_release is preempted and the DM module unloaded after the completion is triggered, but before dm_kobject_release returns).
To fix this race, this patch moves the completion code to dm-builtin.c which is always compiled directly into the kernel if BLK_DEV_DM is selected.
The patch introduces a new dm_kobject_holder structure, its purpose is to keep the completion and kobject in one place, so that it can be accessed from non-module code without the need to export the layout of struct mapped_device to that code.
--- drivers/md/Kconfig | 4 ++++ drivers/md/Makefile | 1 + drivers/md/dm-builtin.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ drivers/md/dm-sysfs.c | 5 ----- drivers/md/dm.c | 26 +++++--------------------- drivers/md/dm.h | 17 ++++++++++++++++- 6 files changed, 74 insertions(+), 27 deletions(-)
drivers/md/Kconfig +4 -0
@@ -176,8 +176,12 @@ config MD_FAULTY source "drivers/md/bcache/Kconfig" +config BLK_DEV_DM_BUILTIN + boolean + config BLK_DEV_DM tristate "Device mapper support" + select BLK_DEV_DM_BUILTIN ---help--- Device-mapper is a low level volume manager. It works by allowing people to specify mappings for ranges of logical sectors. Various
drivers/md/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_MD_FAULTY) += faulty.o obj-$(CONFIG_BCACHE) += bcache/ obj-$(CONFIG_BLK_DEV_MD) += md-mod.o obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o +obj-$(CONFIG_BLK_DEV_DM_BUILTIN) += dm-builtin.o obj-$(CONFIG_DM_BUFIO) += dm-bufio.o obj-$(CONFIG_DM_BIO_PRISON) += dm-bio-prison.o obj-$(CONFIG_DM_CRYPT) += dm-crypt.o
drivers/md/dm-builtin.c new file +48 -0
48 lines not on this page · raw message
drivers/md/dm-sysfs.c +0 -5
@@ -79,11 +79,6 @@ static const struct sysfs_ops dm_sysfs_o .show = dm_attr_show, }; -static void dm_kobject_release (struct kobject *kobj) -{ -complete (dm_get_completion_from_kobject (kobj)); -} -/* * dm kobject is embedded in mapped_device structure * no need to define release function here
drivers/md/dm.c +5 -21
@@ -184,11 +184,8 @@ struct mapped_device {/* forced geometry settings */ struct hd_geometry geometry; -/* sysfs handle */ -struct kobject kobj; - -/* wait until the kobject is released */ -struct completion kobj_completion; +/* kobject and completion */ +struct dm_kobject_holder kobj_holder;/* zero-length flush that will be cloned and submitted to targets */ struct bio flush_bio;
@@ -1907,7 +1904,7 @@ static struct mapped_device *alloc_dev(iinit_waitqueue_head (&md->wait);INIT_WORK (&md->work, dm_wq_work);init_waitqueue_head (&md->eventq); -init_completion (&md->kobj_completion); +init_completion (&md->kobj_holder.completion); md->disk->major = _major; md->disk->first_minor = minor;
@@ -2739,20 +2736,14 @@ struct gendisk *dm_disk(struct mapped_destruct kobject *dm_kobject (struct mapped_device *md) { -return &md->kobj; +return &md->kobj_holder.kobj; } -/* -* struct mapped_device should not be exported outside of dm.c -* so use this check to verify that kobj is part of md structure -*/ struct mapped_device *dm_get_from_kobject (struct kobject *kobj) {struct mapped_device *md; - md = container_of(kobj, struct mapped_device, kobj); -if (&md->kobj != kobj) -return NULL ; + md = container_of(kobj, struct mapped_device, kobj_holder.kobj);if (test_bit (DMF_FREEING , &md->flags) ||dm_deleting_md (md))
@@ -2762,13 +2753,6 @@ struct mapped_device *dm_get_from_kobjecreturn md; } -struct completion *dm_get_completion_from_kobject (struct kobject *kobj) -{ - struct mapped_device *md = container_of(kobj, struct mapped_device, kobj); - -return &md->kobj_completion; -} -int dm_suspended_md (struct mapped_device *md) {return test_bit (DMF_SUSPENDED , &md->flags);
drivers/md/dm.h +16 -1
@@ -16,6 +16,7 @@#include <linux/blkdev.h> #include <linux/hdreg.h> #include <linux/completion.h> +#include <linux/kobject.h> /* * Suspend feature flags
@@ -126,11 +127,25 @@ void dm_interface_exit(void);/* * sysfs interface */ +struct dm_kobject_holder { +struct kobject kobj; +struct completion completion; +}; + +static inline struct completion *dm_get_completion_from_kobject (struct kobject *kobj) +{ + return &container_of(kobj, struct dm_kobject_holder, kobj)->completion; +} +int dm_sysfs_init (struct mapped_device *md);void dm_sysfs_exit (struct mapped_device *md);struct kobject *dm_kobject (struct mapped_device *md);struct mapped_device *dm_get_from_kobject (struct kobject *kobj); -struct completion *dm_get_completion_from_kobject (struct kobject *kobj); + +/* +* The kobject helper +*/ +void dm_kobject_release (struct kobject *kobj);/* * Targets for linear and striped mappings
Greg Kroah-Hartman
maintainerPATCH 58/79 drm/nouveau: fix m2mf copy to tiled gart
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
commit ce8f7699f2b6ffe4aa8368b8d9d370875accaa5f upstream.
Commit de7b7d59d54852c introduced tiled GART, but a linear copy is still performed. This may result in errors on eviction, fix it by checking tiling from memtype.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +8 -25
@@ -788,25 +788,25 @@ nv50_bo_move_m2mf(struct nouveau_channel struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) { struct nouveau_mem *node = old_mem->mm_node; -struct nouveau_bo *nvbo =nouveau_bo (bo);u64 length = (new_mem->num_pages <<PAGE_SHIFT );u64 src_offset = node->vma[0 ].offset;u64 dst_offset = node->vma[1 ].offset; +int src_tiled = !!node->memtype; +int dst_tiled = !!((struct nouveau_mem *)new_mem->mm_node)->memtype;int ret;while (length) {u32 amount, stride, height; + ret =RING_SPACE (chan,18 +6 * (src_tiled + dst_tiled)); +if (ret) +return ret; + amount =min (length, (u64)(4 *1024 *1024 )); stride =16 *4 ; height = amount / stride; -if (old_mem->mem_type ==TTM_PL_VRAM && -nouveau_bo_tile_layout (nvbo)) { - ret =RING_SPACE (chan,8 ); -if (ret) -return ret; - +if (src_tiled) {BEGIN_NV04 (chan, NvSubCopy,0x0200 ,7 );OUT_RING (chan,0 );OUT_RING (chan,0 );
@@ -816,19 +816,10 @@ nv50_bo_move_m2mf(struct nouveau_channelOUT_RING (chan,0 );OUT_RING (chan,0 ); }else { - ret =RING_SPACE (chan,2 ); -if (ret) -return ret; -BEGIN_NV04 (chan, NvSubCopy,0x0200 ,1 );OUT_RING (chan,1 ); } -if (new_mem->mem_type ==TTM_PL_VRAM && -nouveau_bo_tile_layout (nvbo)) { - ret =RING_SPACE (chan,8 ); -if (ret) -return ret; - +if (dst_tiled) {BEGIN_NV04 (chan, NvSubCopy,0x021c ,7 );OUT_RING (chan,0 );OUT_RING (chan,0 );
@@ -838,18 +829,10 @@ nv50_bo_move_m2mf(struct nouveau_channelOUT_RING (chan,0 );OUT_RING (chan,0 ); }else { - ret =RING_SPACE (chan,2 ); -if (ret) -return ret; -BEGIN_NV04 (chan, NvSubCopy,0x021c ,1 );OUT_RING (chan,1 ); } - ret =RING_SPACE (chan,14 ); -if (ret) -return ret; -BEGIN_NV04 (chan, NvSubCopy,0x0238 ,2 );OUT_RING (chan,upper_32_bits (src_offset));OUT_RING (chan,upper_32_bits (dst_offset));
Greg Kroah-Hartman
maintainerPATCH 59/79 drm/i915: Flush outstanding requests before allocating new seqno
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 304d695c3dc8eb65206b9eaf16f8d1a41510d1cf upstream.
In very rare cases (such as a memory failure stress test) it is possible to fill the entire ring without emitting a request. Under this circumstance, the outstanding request is flushed and waited upon. After space on the ring is cleared, we return to emitting the new command - except that we just cleared the seqno allocated for this operation and trigger the sanity check that a request is only ever emitted with a valid seqno. The fix is to rearrange the code to make sure the allocation of the seqno for this operation is after any required flushes of outstanding operations.
The bug exists since the preallocation was introduced in commit 9d7730914f4cd496e356acfab95b41075aa8eae8
Author: Chris Wilson <[email protected]> Date: Tue Nov 27 16:22:52 2012 +0000
drm/i915: Preallocate next seqno before touching the ring
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +8 -4
@@ -1459,8 +1459,8 @@ intel_ring_alloc_seqno(struct intel_ringreturn i915_gem_get_seqno (ring->dev, &ring->outstanding_lazy_request); } -static int __intel_ring_begin (struct intel_ring_buffer *ring, -int bytes) +static int __intel_ring_prepare (struct intel_ring_buffer *ring, +int bytes) {int ret;
@@ -1476,7 +1476,6 @@ static int __intel_ring_begin(struct intreturn ret; } - ring->space -= bytes;return 0 ; }
@@ -1491,12 +1490,17 @@ int intel_ring_begin(struct intel_ring_bif (ret)return ret; + ret =__intel_ring_prepare (ring, num_dwords *sizeof (uint32_t )); +if (ret) +return ret; +/* Preallocate the olr before touching the ring */ ret =intel_ring_alloc_seqno (ring);if (ret)return ret; -return __intel_ring_begin (ring, num_dwords *sizeof (uint32_t )); + ring->space -= num_dwords *sizeof (uint32_t ); +return 0 ; }void intel_ring_init_seqno (struct intel_ring_buffer *ring,u32 seqno)
Greg Kroah-Hartman
maintainerPATCH 60/79 drm/i915: Fix the offset issue for the stolen GEM objects
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akash Goel <[email protected]>
commit ec14ba47791965d2c08e0a681ff44eacbf3c4553 upstream.
The 'offset' field of the 'scatterlist' structure was wrongly programmed with the offset value from the base of stolen area, whereas this field indicates the offset from where the interested data starts within the first PAGE pointed to by 'scattterlist' structure. As a result when a new GEM object allocated from stolen area is mapped to GTT, it could lead to an overwrite of GTT entries as the page count calculation will go wrong, refer the function 'sg_page_count'.
v2: Modified the commit message. (Chris)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71908
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69104
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
@@ -222,7 +222,7 @@ i915_pages_create_for_stolen(struct drm_ } sg = st->sgl; - sg->offset = offset; + sg->offset =0 ; sg->length = size;sg_dma_address (sg) = (dma_addr_t )dev_priv->mm.stolen_base + offset;
Greg Kroah-Hartman
maintainerPATCH 61/79 drm/i915: VLV2 - Fix hotplug detect bits
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Todd Previte <[email protected]>
commit 232a6ee9af8adb185640f67fcaaa9014a9aa0573 upstream.
Add new definitions for hotplug live status bits for VLV2 since they're in reverse order from the gen4x ones.
Changelog:
- Restored gen4 bit definitions
- Added new definitions for VLV2
- Added platform check for IS_VALLEYVIEW() in dp_detect to use the correct bit defintions
- Replaced a lost trailing brace for the added switch()
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73951
[danvet: Switch to _VLV postfix instead of prefix and regroupg comments again so that the g4x warning is right next to those defines. Also add a _G4X suffix for those special ones. Also cc stable.]
--- drivers/gpu/drm/i915/i915_reg.h | 10 +++++++--- drivers/gpu/drm/i915/intel_dp.c | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +7 -3
@@ -1682,9 +1682,13 @@* Please check the detailed lore in the commit message for for experimental * evidence. */ -#define PORTD_HOTPLUG_LIVE_STATUS (1 << 29) -#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) -#define PORTB_HOTPLUG_LIVE_STATUS (1 << 27) +#define PORTD_HOTPLUG_LIVE_STATUS_G4X (1 << 29) +#define PORTC_HOTPLUG_LIVE_STATUS_G4X (1 << 28) +#define PORTB_HOTPLUG_LIVE_STATUS_G4X (1 << 27) +/* VLV DP/HDMI bits again match Bspec */ +#define PORTD_HOTPLUG_LIVE_STATUS_VLV (1 << 27) +#define PORTC_HOTPLUG_LIVE_STATUS_VLV (1 << 28) +#define PORTB_HOTPLUG_LIVE_STATUS_VLV (1 << 29)#define PORTD_HOTPLUG_INT_STATUS (3 << 21)#define PORTC_HOTPLUG_INT_STATUS (3 << 19)#define PORTB_HOTPLUG_INT_STATUS (3 << 17)
drivers/gpu/drm/i915/intel_dp.c +28 -12
@@ -2277,18 +2277,34 @@ g4x_dp_detect(struct intel_dp *intel_dp)return status; } -switch (intel_dig_port->port) { -case PORT_B : - bit =PORTB_HOTPLUG_LIVE_STATUS ; -break ; -case PORT_C : - bit =PORTC_HOTPLUG_LIVE_STATUS ; -break ; -case PORT_D : - bit =PORTD_HOTPLUG_LIVE_STATUS ; -break ; -default : -return connector_status_unknown; +if (IS_VALLEYVIEW (dev)) { +switch (intel_dig_port->port) { +case PORT_B : + bit =PORTB_HOTPLUG_LIVE_STATUS_VLV ; +break ; +case PORT_C : + bit =PORTC_HOTPLUG_LIVE_STATUS_VLV ; +break ; +case PORT_D : + bit =PORTD_HOTPLUG_LIVE_STATUS_VLV ; +break ; +default : +return connector_status_unknown; + } + }else { +switch (intel_dig_port->port) { +case PORT_B : + bit =PORTB_HOTPLUG_LIVE_STATUS_G4X ; +break ; +case PORT_C : + bit =PORTC_HOTPLUG_LIVE_STATUS_G4X ; +break ; +case PORT_D : + bit =PORTD_HOTPLUG_LIVE_STATUS_G4X ; +break ; +default : +return connector_status_unknown; + } }if ((I915_READ (PORT_HOTPLUG_STAT ) & bit) ==0 )
Greg Kroah-Hartman
maintainerPATCH 62/79 i915: remove pm_qos request on error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 22accca01713b13dac386ca90b787aadf88f6551 upstream.
Not removing pm qos request and free memory for it can cause crash, when some other driver use pm qos. For example, this oops:
BUG: unable to handle kernel paging request at fffffffffffffff8 IP: [<ffffffff81307a6b>] plist_add+0x5b/0xd0 Call Trace: [<ffffffff810acf25>] pm_qos_update_target+0x125/0x1e0 [<ffffffff810ad071>] pm_qos_add_request+0x91/0x100 [<ffffffffa053ec14>] e1000_open+0xe4/0x5b0 [e1000e]
was caused by earlier i915 probe failure:
[drm:i915_report_and_clear_eir] *ERROR* EIR stuck: 0x00000010, masking
[drm:init_ring_common] *ERROR* render ring initialization failed ctl 0001f001 head 00003004 tail 00000000 start 00003000 [drm:i915_driver_load] *ERROR* failed to init modeset
i915: probe of 0000:00:02.0 failed with error -5
Bug report:
http://bugzilla.redhat.com/show_bug.cgi?id=1057533
--- drivers/gpu/drm/i915/i915_dma.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_dma.c +1 -0
@@ -1687,6 +1687,7 @@ out_gem_unload:intel_teardown_gmbus (dev);intel_teardown_mchbar (dev); +pm_qos_remove_request (&dev_priv->pm_qos);destroy_workqueue (dev_priv->wq); out_mtrrfree:if (dev_priv->mm.gtt_mtrr >=0 ) {
Greg Kroah-Hartman
maintainerPATCH 63/79 drm/cirrus: correct register values for 16bpp
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 2510538fa000dd13a3e57b79bf073ffb1748976c upstream.
When the mode is set with 16bpp on QEMU, the output gets totally broken. The culprit is the bogus register values set for 16bpp, which was likely copied from from a wrong place.
Addresses https://bugzilla.novell.com/show_bug.cgi?id=799216
--- drivers/gpu/drm/cirrus/cirrus_mode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/cirrus/cirrus_mode.c +2 -2
@@ -273,8 +273,8 @@ static int cirrus_crtc_mode_set(struct d sr07 |=0x11 ;break ;case 16 : - sr07 |=0xc1 ; - hdr =0xc0 ; + sr07 |=0x17 ; + hdr =0xc1 ;break ;case 24 : sr07 |=0x15 ;
Greg Kroah-Hartman
maintainerPATCH 64/79 drm/mgag200: fix typo causing bw limits to be ignored on some chips
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit ec22b4aa993abbd18f5bbbcb20a1c56be3b1d38b upstream.
mode->mdev otherwise the bw limits never kick in.
Reported in RHEL testing.
--- drivers/gpu/drm/mgag200/mgag200_mode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mgag200/mgag200_mode.c +2 -2
@@ -1477,11 +1477,11 @@ static int mga_vga_mode_valid(struct drm (mga_vga_calculate_mode_bandwidth(mode, bpp) > (32700 * 1024))) {return MODE_BANDWIDTH ; - } else if (mode->type == G200_EH && + } else if (mdev->type == G200_EH && (mga_vga_calculate_mode_bandwidth (mode ,bpp ) > (37500 * 1024))) {return MODE_BANDWIDTH ; - } else if (mode->type == G200_ER && + } else if (mdev->type == G200_ER && (mga_vga_calculate_mode_bandwidth (mode , bpp) > (55000 * 1024))) {return MODE_BANDWIDTH ;
Greg Kroah-Hartman
maintainerPATCH 65/79 mfd: lpc_ich: Add support for Intel Avoton SoC
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Ralston <[email protected]>
commit 8477128fe0c3c455e9dfb1ba7ad7e6d09489d33c upstream.
This patch adds the LPC Controller Device IDs for Watchdog and GPIO for Intel Avoton SoC, to the lpc_ich driver.
--- drivers/mfd/lpc_ich.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mfd/lpc_ich.c +10 -0
@@ -51,6 +51,7 @@* document number TBD : Lynx Point * document number TBD : Lynx Point-LP * document number TBD : Wellsburg +* document number TBD : Avoton SoC */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
@@ -207,6 +208,7 @@ enum lpc_chipsets {LPC_LPT ,/* Lynx Point */ LPC_LPT_LP ,/* Lynx Point-LP */ LPC_WBG ,/* Wellsburg */ + LPC_AVN, /* Avoton SoC */ }; struct lpc_ich_info lpc_chipset_info[] = {
@@ -491,6 +493,10 @@ struct lpc_ich_info lpc_chipset_info[] = .name = "Wellsburg", .iTCO_version = 2, }, + [LPC_AVN] = { + .name = "Avoton SoC", + .iTCO_version = 1, + }, };/*
@@ -704,6 +710,10 @@ static DEFINE_PCI_DEVICE_TABLE(lpc_ich_i { PCI_VDEVICE(INTEL, 0x8d5d), LPC_WBG}, { PCI_VDEVICE(INTEL, 0x8d5e), LPC_WBG}, { PCI_VDEVICE(INTEL, 0x8d5f), LPC_WBG}, + { PCI_VDEVICE(INTEL, 0x1f38), LPC_AVN}, + { PCI_VDEVICE(INTEL, 0x1f39), LPC_AVN}, + { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN}, + { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN}, { 0, }, /* End of list */ };MODULE_DEVICE_TABLE (pci, lpc_ich_ids);
Greg Kroah-Hartman
maintainerPATCH 66/79 mfd: lpc_ich: iTCO_wdt patch for Intel Coleto Creek DeviceIDs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Heasley <[email protected]>
commit 283aae8ab88e695a660c610d6535ca44bc5b8835 upstream.
This patch adds the LPC Controller DeviceIDs for iTCO Watchdog for the Intel Coleto Creek PCH.
--- drivers/mfd/lpc_ich.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mfd/lpc_ich.c +7 -0
@@ -52,6 +52,7 @@* document number TBD : Lynx Point-LP * document number TBD : Wellsburg * document number TBD : Avoton SoC +* document number TBD : Coleto Creek */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
@@ -209,6 +210,7 @@ enum lpc_chipsets {LPC_LPT_LP ,/* Lynx Point-LP */ LPC_WBG ,/* Wellsburg */ LPC_AVN ,/* Avoton SoC */ + LPC_COLETO, /* Coleto Creek */ }; struct lpc_ich_info lpc_chipset_info[] = {
@@ -497,6 +499,10 @@ struct lpc_ich_info lpc_chipset_info[] = .name = "Avoton SoC", .iTCO_version = 1, }, + [LPC_COLETO] = { + .name = "Coleto Creek", + .iTCO_version = 2, + }, };/*
@@ -714,6 +720,7 @@ static DEFINE_PCI_DEVICE_TABLE(lpc_ich_i { PCI_VDEVICE(INTEL, 0x1f39), LPC_AVN}, { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN}, { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN}, + { PCI_VDEVICE(INTEL, 0x2390), LPC_COLETO}, { 0, }, /* End of list */ };MODULE_DEVICE_TABLE (pci, lpc_ich_ids);
Greg Kroah-Hartman
maintainerPATCH 67/79 i2c: i801: SMBus patch for Intel Coleto Creek DeviceIDs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Heasley <[email protected]>
commit f39901c1befa556bc91902516a3e2e460000b4a8 upstream.
This patch adds the i801 SMBus Controller DeviceIDs for the Intel Coleto Creek PCH.
--- Documentation/i2c/busses/i2c-i801 | 1 + drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-i801.c | 3 +++ 3 files changed, 5 insertions(+)
Documentation/i2c/busses/i2c-i801 +1 -0
@@ -24,6 +24,7 @@ Supported adapters: * Intel Lynx Point-LP (PCH) * Intel Avoton (SOC) * Intel Wellsburg (PCH) + * Intel Coleto Creek (PCH) Datasheets: Publicly available at the Intel website On Intel Patsburg and later chipsets, both the normal host SMBus controller
drivers/i2c/busses/Kconfig +1 -0
@@ -108,6 +108,7 @@ config I2C_I801 Lynx Point-LP (PCH) Avoton (SOC) Wellsburg (PCH) + Coleto Creek (PCH) This driver can also be built as a module. If so, the module will be called i2c-i801.
drivers/i2c/busses/i2c-i801.c +3 -0
@@ -58,6 +58,7 @@ Wellsburg (PCH) MS 0x8d7d 32 hard yes yes yes Wellsburg (PCH) MS 0x8d7e 32 hard yes yes yes Wellsburg (PCH) MS 0x8d7f 32 hard yes yes yes + Coleto Creek (PCH) 0x23b0 32 hard yes yes yes Features supported by this driver: Software PEC no
@@ -169,6 +170,7 @@#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS 0x1e22#define PCI_DEVICE_ID_INTEL_AVOTON_SMBUS 0x1f3c#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330 +#define PCI_DEVICE_ID_INTEL_COLETOCREEK_SMBUS 0x23b0#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30#define PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS 0x8c22#define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS 0x8d22
@@ -817,6 +819,7 @@ static DEFINE_PCI_DEVICE_TABLE(i801_ids) { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS0) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS1) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COLETOCREEK_SMBUS) }, { 0, } };
Greg Kroah-Hartman
maintainerPATCH 68/79 ftrace: Synchronize setting function_trace_op with ftrace_trace_function
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 405e1d834807e51b2ebd3dea81cb51e53fb61504 upstream.
ftrace_trace_function is a variable that holds what function will be called directly by the assembly code (mcount). If just a single function is registered and it handles recursion itself, then the assembly will call that function directly without any helper function. It also passes in the ftrace_op that was registered with the callback. The ftrace_op to send is stored in the function_trace_op variable.
The ftrace_trace_function and function_trace_op needs to be coordinated such that the called callback wont be called with the wrong ftrace_op, otherwise bad things can happen if it expected a different op. Luckily, there's no callback that doesn't use the helper functions that requires this. But there soon will be and this needs to be fixed.
Use a set_function_trace_op to store the ftrace_op to set the function_trace_op to when it is safe to do so (during the update function within the breakpoint or stop machine calls). Or if dynamic ftrace is not being used (static tracing) then we have to do a bit more synchronization when the ftrace_trace_function is set as that takes affect immediately (as oppose to dynamic ftrace doing it with the modification of the trampoline).
--- kernel/trace/ftrace.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +72 -4
@@ -85,6 +85,8 @@ int function_trace_stop __read_mostly;/* Current function tracing op */ struct ftrace_ops *function_trace_op__read_mostly = &ftrace_list_end; +/* What to set function_trace_op to */ +static struct ftrace_ops *set_function_trace_op;/* List for set_ftrace_pid's pids. */ LIST_HEAD (ftrace_pids);
@@ -278,6 +280,23 @@ static void update_global_ops(void) global_ops.func = func; } +static void ftrace_sync (struct work_struct *work) +{ +/* +* This function is just a stub to implement a hard force +* of synchronize_sched(). This requires synchronizing +* tasks even in userspace and idle. +* +* Yes, function tracing is rude. +*/ +} + +static void ftrace_sync_ipi (void *data) +{ +/* Probably not needed, but do it anyway */ +smp_rmb (); +} +static void update_ftrace_function (void ) {ftrace_func_t func;
@@ -296,16 +315,59 @@ static void update_ftrace_function(void) !FTRACE_FORCE_LIST_FUNC)) {/* Set the ftrace_ops that the arch callback uses */ if (ftrace_ops_list == &global_ops) - function_trace_op = ftrace_global_list; + set_function_trace_op = ftrace_global_list;else - function_trace_op = ftrace_ops_list; + set_function_trace_op = ftrace_ops_list; func = ftrace_ops_list->func; } else {/* Just use the default ftrace_ops */ - function_trace_op = &ftrace_list_end; + set_function_trace_op = &ftrace_list_end; func = ftrace_ops_list_func; } +/* If there's no change, then do nothing more here */ +if (ftrace_trace_function == func) +return ; + +/* +* If we are using the list function, it doesn't care +* about the function_trace_ops. +*/ +if (func == ftrace_ops_list_func) { + ftrace_trace_function = func; +/* +* Don't even bother setting function_trace_ops, +* it would be racy to do so anyway. +*/ +return ; + } + +#ifndef CONFIG_DYNAMIC_FTRACE +/* +* For static tracing, we need to be a bit more careful. +* The function change takes affect immediately. Thus, +* we need to coorditate the setting of the function_trace_ops +* with the setting of the ftrace_trace_function. +* +* Set the function to the list ops, which will call the +* function we want, albeit indirectly, but it handles the +* ftrace_ops and doesn't depend on function_trace_op. +*/ + ftrace_trace_function = ftrace_ops_list_func; +/* +* Make sure all CPUs see this. Yes this is slow, but static +* tracing is slow and nasty to have enabled. +*/ +schedule_on_each_cpu (ftrace_sync); +/* Now all cpus are using the list ops. */ + function_trace_op = set_function_trace_op; +/* Make sure the function_trace_op is visible on all CPUs */ +smp_wmb (); +/* Nasty way to force a rmb on all cpus */ +smp_call_function (ftrace_sync_ipi,NULL ,1 ); +/* OK, we are all set to update the ftrace_trace_function now! */ +#endif /* !CONFIG_DYNAMIC_FTRACE */ + ftrace_trace_function = func; }
@@ -1952,8 +2014,14 @@ void ftrace_modify_all_code(int command)else if (command &FTRACE_DISABLE_CALLS )ftrace_replace_code (0 ); -if (command &FTRACE_UPDATE_TRACE_FUNC ) +if (command &FTRACE_UPDATE_TRACE_FUNC ) { + function_trace_op = set_function_trace_op; +smp_wmb (); +/* If irqs are disabled, we are in stop machine */ +if (!irqs_disabled ()) +smp_call_function (ftrace_sync_ipi,NULL ,1 );ftrace_update_ftrace_func (ftrace_trace_function); + }if (command &FTRACE_START_FUNC_RET )ftrace_enable_ftrace_graph_caller ();
Greg Kroah-Hartman
maintainerPATCH 69/79 ftrace: Fix synchronization location disabling and freeing ftrace_ops
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit a4c35ed241129dd142be4cadb1e5a474a56d5464 upstream.
The synchronization needed after ftrace_ops are unregistered must happen after the callback is disabled from becing called by functions.
The current location happens after the function is being removed from the internal lists, but not after the function callbacks were disabled, leaving the functions susceptible of being called after their callbacks are freed.
This affects perf and any externel users of function tracing (LTTng and SystemTap).
--- kernel/trace/ftrace.c | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-)
kernel/trace/ftrace.c +32 -18
@@ -490,16 +490,6 @@ static int __unregister_ftrace_function( }else if (ops->flags &FTRACE_OPS_FL_CONTROL ) { ret =remove_ftrace_list_ops (&ftrace_control_list, &control_ops, ops); -if (!ret) { -/* -* The ftrace_ops is now removed from the list, -* so there'll be no new users. We must ensure -* all current users are done before we free -* the control data. -*/ -synchronize_sched (); -control_ops_free (ops); - } }else ret =remove_ftrace_ops (&ftrace_ops_list, ops);
@@ -509,13 +499,6 @@ static int __unregister_ftrace_function(if (ftrace_enabled)update_ftrace_function (); -/* -* Dynamic ops may be freed, we must make sure that all -* callers are done before leaving this function. -*/ -if (ops->flags &FTRACE_OPS_FL_DYNAMIC ) -synchronize_sched (); -return 0 ; }
@@ -2184,10 +2167,41 @@ static int ftrace_shutdown(struct ftrace command |=FTRACE_UPDATE_TRACE_FUNC ; } -if (!command || !ftrace_enabled) +if (!command || !ftrace_enabled) { +/* +* If these are control ops, they still need their +* per_cpu field freed. Since, function tracing is +* not currently active, we can just free them +* without synchronizing all CPUs. +*/ +if (ops->flags &FTRACE_OPS_FL_CONTROL ) +control_ops_free (ops);return 0 ; + }ftrace_run_update_code (command); + +/* +* Dynamic ops may be freed, we must make sure that all +* callers are done before leaving this function. +* The same goes for freeing the per_cpu data of the control +* ops. +* +* Again, normal synchronize_sched() is not good enough. +* We need to do a hard force of sched synchronization. +* This is because we use preempt_disable() to do RCU, but +* the function tracers can be called where RCU is not watching +* (like before user_exit()). We can not rely on the RCU +* infrastructure to do the synchronization, thus we must do it +* ourselves. +*/ +if (ops->flags & (FTRACE_OPS_FL_DYNAMIC |FTRACE_OPS_FL_CONTROL )) { +schedule_on_each_cpu (ftrace_sync); + +if (ops->flags &FTRACE_OPS_FL_CONTROL ) +control_ops_free (ops); + } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 70/79 ftrace: Have function graph only trace based on global_ops filters
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 23a8e8441a0a74dd612edf81dc89d1600bc0a3d1 upstream.
Doing some different tests, I discovered that function graph tracing, when filtered via the set_ftrace_filter and set_ftrace_notrace files, does not always keep with them if another function ftrace_ops is registered to trace functions.
The reason is that function graph just happens to trace all functions that the function tracer enables. When there was only one user of function tracing, the function graph tracer did not need to worry about being called by functions that it did not want to trace. But now that there are other users, this becomes a problem.
For example, one just needs to do the following:
# cd /sys/kernel/debug/tracing
# echo schedule > set_ftrace_filter
# echo function_graph > current_tracer
# cat trace
[..]
0) | schedule() {
------------------------------------------
0) <idle>-0 => rcu_pre-7
------------------------------------------ 0) ! 2980.314 us | }
0) | schedule() { ------------------------------------------
0) rcu_pre-7 => <idle>-0
------------------------------------------
0) + 20.701 us | }
# echo 1 > /proc/sys/kernel/stack_tracer_enabled
# cat trace
[..]
1) + 20.825 us | }
1) + 21.651 us | }
1) + 30.924 us | } /* SyS_ioctl */
1) | do_page_fault() {
1) | __do_page_fault() {
1) 0.274 us | down_read_trylock();
1) 0.098 us | find_vma();
1) | handle_mm_fault() {
1) | _raw_spin_lock() {
1) 0.102 us | preempt_count_add();
1) 0.097 us | do_raw_spin_lock();
1) 2.173 us | }
1) | do_wp_page() {
1) 0.079 us | vm_normal_page();
1) 0.086 us | reuse_swap_page();
1) 0.076 us | page_move_anon_rmap();
1) | unlock_page() {
1) 0.082 us | page_waitqueue();
1) 0.086 us | __wake_up_bit();
1) 1.801 us | }
1) 0.075 us | ptep_set_access_flags();
1) | _raw_spin_unlock() {
1) 0.098 us | do_raw_spin_unlock();
1) 0.105 us | preempt_count_sub();
1) 1.884 us | }
1) 9.149 us | }
1) + 13.083 us | }
1) 0.146 us | up_read();When the stack tracer was enabled, it enabled all functions to be traced, which now the function graph tracer also traces. This is a side effect that should not occur.
To fix this a test is added when the function tracing is changed, as well as when the graph tracer is enabled, to see if anything other than the ftrace global_ops function tracer is enabled. If so, then the graph tracer calls a test trampoline that will look at the function that is being traced and compare it with the filters defined by the global_ops.
As an optimization, if there's no other function tracers registered, or if the only registered function tracers also use the global ops, the function graph infrastructure will call the registered function graph callback directly and not go through the test trampoline.
--- kernel/trace/ftrace.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
kernel/trace/ftrace.c +44 -1
@@ -297,6 +297,12 @@ static void ftrace_sync_ipi(void *data)smp_rmb (); } +#ifdef CONFIG_FUNCTION_GRAPH_TRACER +static void update_function_graph_func (void ); +#else +static inline void update_function_graph_func (void ) { } +#endif +static void update_ftrace_function (void ) {ftrace_func_t func;
@@ -329,6 +335,8 @@ static void update_ftrace_function(void)if (ftrace_trace_function == func)return ; +update_function_graph_func (); +/* * If we are using the list function, it doesn't care * about the function_trace_ops.
@@ -4810,6 +4818,7 @@ int ftrace_graph_entry_stub(struct ftractrace_func_graph_ret_t ftrace_graph_return = (trace_func_graph_ret_t )ftrace_stub;trace_func_graph_ent_t ftrace_graph_entry = ftrace_graph_entry_stub; +static trace_func_graph_ent_t __ftrace_graph_entry = ftrace_graph_entry_stub;/* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */ static int alloc_retstack_tasklist (struct ftrace_ret_stack **ret_stack_list)
@@ -4951,6 +4960,30 @@ static struct ftrace_ops fgraph_ops __re FTRACE_OPS_FL_RECURSION_SAFE, }; +static int ftrace_graph_entry_test (struct ftrace_graph_ent *trace) +{ +if (!ftrace_ops_test (&global_ops, trace->func,NULL )) +return 0 ; +return __ftrace_graph_entry (trace); +} + +/* +* The function graph tracer should only trace the functions defined +* by set_ftrace_filter and set_ftrace_notrace. If another function +* tracer ops is registered, the graph tracer requires testing the +* function against the global ops, and not just trace any function +* that any ftrace_ops registered. +*/ +static void update_function_graph_func (void ) +{ +if (ftrace_ops_list == &ftrace_list_end || + (ftrace_ops_list == &global_ops && + global_ops.next == &ftrace_list_end)) + ftrace_graph_entry = __ftrace_graph_entry; +else + ftrace_graph_entry = ftrace_graph_entry_test; +} +int register_ftrace_graph (trace_func_graph_ret_t retfunc,trace_func_graph_ent_t entryfunc) {
@@ -4975,7 +5008,16 @@ int register_ftrace_graph(trace_func_gra } ftrace_graph_return = retfunc; - ftrace_graph_entry = entryfunc; + +/* +* Update the indirect function to the entryfunc, and the +* function that gets called to the entry_test first. Then +* call the update fgraph entry function to determine if +* the entryfunc should be called directly or not. +*/ + __ftrace_graph_entry = entryfunc; + ftrace_graph_entry = ftrace_graph_entry_test; +update_function_graph_func (); ret =ftrace_startup (&fgraph_ops,FTRACE_START_FUNC_RET );
@@ -4994,6 +5036,7 @@ void unregister_ftrace_graph(void) ftrace_graph_active--; ftrace_graph_return = (trace_func_graph_ret_t )ftrace_stub; ftrace_graph_entry = ftrace_graph_entry_stub; + __ftrace_graph_entry = ftrace_graph_entry_stub;ftrace_shutdown (&fgraph_ops,FTRACE_STOP_FUNC_RET );unregister_pm_notifier (&ftrace_suspend_notifier);unregister_trace_sched_switch (ftrace_graph_probe_sched_switch,NULL );
Greg Kroah-Hartman
maintainerPATCH 71/79 timekeeping: Fix lost updates to tai adjustment
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit f55c07607a38f84b5c7e6066ee1cfe433fa5643c upstream.
Since 48cdc135d4840 (Implement a shadow timekeeper), we have to call timekeeping_update() after any adjustment to the timekeeping structure in order to make sure that any adjustments to the structure persist.
Unfortunately, the updates to the tai offset via adjtimex do not trigger this update, causing adjustments to the tai offset to be made and then over-written by the previous value at the next update_wall_time() call.
This patch resovles the issue by calling timekeeping_update() right after setting the tai offset.
--- kernel/time/timekeeping.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/time/timekeeping.c +2 -0
@@ -605,6 +605,7 @@ void timekeeping_set_tai_offset(s32 tai_raw_spin_lock_irqsave (&timekeeper_lock, flags);write_seqcount_begin (&timekeeper_seq);__timekeeping_set_tai_offset (tk, tai_offset); +timekeeping_update (tk, false, true);write_seqcount_end (&timekeeper_seq);raw_spin_unlock_irqrestore (&timekeeper_lock, flags);clock_was_set ();
@@ -1677,6 +1678,7 @@ int do_adjtimex(struct timex *txc)if (tai != orig_tai) {__timekeeping_set_tai_offset (tk, tai); +timekeeping_update (tk, false, true);clock_was_set_delayed (); }write_seqcount_end (&timekeeper_seq);
Greg Kroah-Hartman
maintainerPATCH 72/79 timekeeping: Fix CLOCK_TAI timer/nanosleep delays
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit 04005f6011e3b504cd4d791d9769f7cb9a3b2eae upstream.
A think-o in the calculation of the monotonic -> tai time offset results in CLOCK_TAI timers and nanosleeps to expire late (the latency is ~2x the tai offset).
Fix this by adding the tai offset from the realtime offset instead of subtracting.
--- kernel/time/timekeeping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/timekeeping.c +2 -2
@@ -72,7 +72,7 @@ static void tk_set_wall_to_mono(struct t tk->wall_to_monotonic = wtm;set_normalized_timespec (&tmp, -wtm.tv_sec, -wtm.tv_nsec); tk->offs_real =timespec_to_ktime (tmp); - tk->offs_tai =ktime_sub (tk->offs_real,ktime_set (tk->tai_offset,0 )); + tk->offs_tai =ktime_add (tk->offs_real,ktime_set (tk->tai_offset,0 )); }static void tk_set_sleep_time (struct timekeeper *tk,struct timespec t)
@@ -590,7 +590,7 @@ s32 timekeeping_get_tai_offset(void)static void __timekeeping_set_tai_offset (struct timekeeper *tk,s32 tai_offset) { tk->tai_offset = tai_offset; - tk->offs_tai =ktime_sub (tk->offs_real,ktime_set (tai_offset,0 )); + tk->offs_tai =ktime_add (tk->offs_real,ktime_set (tai_offset,0 )); }/**
Greg Kroah-Hartman
maintainerPATCH 73/79 timekeeping: Fix missing timekeeping_update in suspend path
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit 330a1617b0a6268d427aa5922c94d082b1d3e96d upstream.
Since 48cdc135d4840 (Implement a shadow timekeeper), we have to call timekeeping_update() after any adjustment to the timekeeping structure in order to make sure that any adjustments to the structure persist.
In the timekeeping suspend path, we udpate the timekeeper structure, so we should be sure to update the shadow-timekeeper before releasing the timekeeping locks. Currently this isn't done.
In most cases, the next time related code to run would be timekeeping_resume, which does update the shadow-timekeeper, but in an abundence of caution, this patch adds the call to timekeeping_update() in the suspend path.
--- kernel/time/timekeeping.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/time/timekeeping.c +2 -0
@@ -1008,6 +1008,8 @@ static int timekeeping_suspend(void) timekeeping_suspend_time =timespec_add (timekeeping_suspend_time, delta_delta); } + +timekeeping_update (tk, false, true);write_seqcount_end (&timekeeper_seq);raw_spin_unlock_irqrestore (&timekeeper_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 74/79 rtc-cmos: Add an alarm disable quirk
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit d5a1c7e3fc38d9c7d629e1e47f32f863acbdec3d upstream.
41c7f7424259f ("rtc: Disable the alarm in the hardware (v2)") added the functionality to disable the RTC wake alarm when shutting down the box.
However, there are at least two b0rked BIOSes we know about:
https://bugzilla.novell.com/show_bug.cgi?id=812592
https://bugzilla.novell.com/show_bug.cgi?id=805740
where, when wakeup alarm is enabled in the BIOS, the machine reboots automatically right after shutdown, regardless of what wakeup time is programmed.
Bisecting the issue lead to this patch so disable its functionality with a DMI quirk only for those boxes.
--- drivers/rtc/rtc-cmos.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-)
drivers/rtc/rtc-cmos.c +51 -1
@@ -34,11 +34,11 @@#include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/platform_device.h> -#include <linux/mod_devicetable.h> #include <linux/log2.h> #include <linux/pm.h> #include <linux/of.h> #include <linux/of_platform.h> +#include <linux/dmi.h> /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ #include <asm-generic/rtc.h>
@@ -377,6 +377,51 @@ static int cmos_set_alarm(struct devicereturn 0 ; } +/* +* Do not disable RTC alarm on shutdown - workaround for b0rked BIOSes. +*/ +static bool alarm_disable_quirk; + +static int __init set_alarm_disable_quirk (const struct dmi_system_id *id) +{ + alarm_disable_quirk = true; +pr_info ("rtc-cmos: BIOS has alarm-disable quirk. " ); +pr_info ("RTC alarms disabled\n" ); +return 0 ; +} + +static const struct dmi_system_id rtc_quirks[]__initconst = { +/* https://bugzilla.novell.com/show_bug.cgi?id=805740 */ + { + .callback = set_alarm_disable_quirk, + .ident ="IBM Truman" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"4852570" ), + }, + }, +/* https://bugzilla.novell.com/show_bug.cgi?id=812592 */ + { + .callback = set_alarm_disable_quirk, + .ident ="Gigabyte GA-990XA-UD3" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR , +"Gigabyte Technology Co., Ltd." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"GA-990XA-UD3" ), + }, + }, +/* http://permalink.gmane.org/gmane.linux.kernel/1604474 */ + { + .callback = set_alarm_disable_quirk, + .ident ="Toshiba Satellite L300" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Satellite L300" ), + }, + }, + {} +}; +static int cmos_alarm_irq_enable (struct device *dev,unsigned int enabled) {struct cmos_rtc *cmos =dev_get_drvdata (dev);
@@ -385,6 +430,9 @@ static int cmos_alarm_irq_enable(structif (!is_valid_irq (cmos->irq))return -EINVAL ; +if (alarm_disable_quirk) +return 0 ; +spin_lock_irqsave (&rtc_lock, flags);if (enabled)
@@ -1163,6 +1211,8 @@ static int __init cmos_init(void) platform_driver_registered = true; } +dmi_check_system (rtc_quirks); +if (retval ==0 )return 0 ;
Greg Kroah-Hartman
maintainerPATCH 75/79 timekeeping: Avoid possible deadlock from clock_was_set_delayed
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit 6fdda9a9c5db367130cf32df5d6618d08b89f46a upstream.
As part of normal operaions, the hrtimer subsystem frequently calls into the timekeeping code, creating a locking order of
hrtimer locks -> timekeeping locks
clock_was_set_delayed() was suppoed to allow us to avoid deadlocks between the timekeeping the hrtimer subsystem, so that we could notify the hrtimer subsytem the time had changed while holding the timekeeping locks. This was done by scheduling delayed work that would run later once we were out of the timekeeing code.
But unfortunately the lock chains are complex enoguh that in scheduling delayed work, we end up eventually trying to grab an hrtimer lock.
Sasha Levin noticed this in testing when the new seqlock lockdep enablement triggered the following (somewhat abrieviated) message:
[ 251.100221] ======================================================
[ 251.100221] [ INFO: possible circular locking dependency detected ]
[ 251.100221] 3.13.0-rc2-next-20131206-sasha-00005-g8be2375-dirty #4053 Not tainted
[ 251.101967] -------------------------------------------------------
[ 251.101967] kworker/10:1/4506 is trying to acquire lock:
[ 251.101967] (timekeeper_seq){----..}, at: [<ffffffff81160e96>] retrigger_next_event+0x56/0x70
[ 251.101967]
[ 251.101967] but task is already holding lock:
[ 251.101967] (hrtimer_bases.lock#11){-.-...}, at: [<ffffffff81160e7c>] retrigger_next_event+0x3c/0x70
[ 251.101967]
[ 251.101967] which lock already depends on the new lock.
[ 251.101967]
[ 251.101967]
[ 251.101967] the existing dependency chain (in reverse order) is:
[ 251.101967]-> #5 (hrtimer_bases.lock#11){-.-...}:
[snipped]
-> #4 (&rt_b->rt_runtime_lock){-.-...}:
[snipped]
-> #3 (&rq->lock){-.-.-.}:
[snipped]
-> #2 (&p->pi_lock){-.-.-.}:
[snipped]
-> #1 (&(&pool->lock)->rlock){-.-...}:
[ 251.101967] [<ffffffff81194803>] validate_chain+0x6c3/0x7b0
[ 251.101967] [<ffffffff81194d9d>] __lock_acquire+0x4ad/0x580
[ 251.101967] [<ffffffff81194ff2>] lock_acquire+0x182/0x1d0
[ 251.101967] [<ffffffff84398500>] _raw_spin_lock+0x40/0x80
[ 251.101967] [<ffffffff81153e69>] __queue_work+0x1a9/0x3f0
[ 251.101967] [<ffffffff81154168>] queue_work_on+0x98/0x120
[ 251.101967] [<ffffffff81161351>] clock_was_set_delayed+0x21/0x30
[ 251.101967] [<ffffffff811c4bd1>] do_adjtimex+0x111/0x160
[ 251.101967] [<ffffffff811e2711>] compat_sys_adjtimex+0x41/0x70
[ 251.101967] [<ffffffff843a4b49>] ia32_sysret+0x0/0x5
[ 251.101967]
-> #0 (timekeeper_seq){----..}:
[snipped]
[ 251.101967] other info that might help us debug this:
[ 251.101967]
[ 251.101967] Chain exists of:
timekeeper_seq --> &rt_b->rt_runtime_lock --> hrtimer_bases.lock#11[ 251.101967] Possible unsafe locking scenario:
[ 251.101967]
[ 251.101967] CPU0 CPU1
[ 251.101967] ---- ----
[ 251.101967] lock(hrtimer_bases.lock#11);
[ 251.101967] lock(&rt_b->rt_runtime_lock);
[ 251.101967] lock(hrtimer_bases.lock#11);
[ 251.101967] lock(timekeeper_seq);
[ 251.101967]
[ 251.101967] *** DEADLOCK ***
[ 251.101967]
[ 251.101967] 3 locks held by kworker/10:1/4506:
[ 251.101967] #0: (events){.+.+.+}, at: [<ffffffff81154960>] process_one_work+0x200/0x530
[ 251.101967] #1: (hrtimer_work){+.+...}, at: [<ffffffff81154960>] process_one_work+0x200/0x530
[ 251.101967] #2: (hrtimer_bases.lock#11){-.-...}, at: [<ffffffff81160e7c>] retrigger_next_event+0x3c/0x70
[ 251.101967]
[ 251.101967] stack backtrace:
[ 251.101967] CPU: 10 PID: 4506 Comm: kworker/10:1 Not tainted 3.13.0-rc2-next-20131206-sasha-00005-g8be2375-dirty #4053
[ 251.101967] Workqueue: events clock_was_set_workSo the best solution is to avoid calling clock_was_set_delayed() while holding the timekeeping lock, and instead using a flag variable to decide if we should call clock_was_set() once we've released the locks.
This works for the case here, where the do_adjtimex() was the deadlock trigger point. Unfortuantely, in update_wall_time() we still hold the jiffies lock, which would deadlock with the ipi triggered by clock_was_set(), preventing us from calling it even after we drop the timekeeping lock. So instead call clock_was_set_delayed() at that point.
--- kernel/time/timekeeping.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
kernel/time/timekeeping.c +18 -7
@@ -1239,9 +1239,10 @@ out_adjust:* It also calls into the NTP code to handle leapsecond processing. * */ -static inline void accumulate_nsecs_to_secs (struct timekeeper *tk) +static inline unsigned int accumulate_nsecs_to_secs (struct timekeeper *tk) {u64 nsecps = (u64 )NSEC_PER_SEC << tk->shift; +unsigned int clock_set =0 ;while (tk->xtime_nsec >= nsecps) {int leap;
@@ -1263,9 +1264,10 @@ static inline void accumulate_nsecs_to_s__timekeeping_set_tai_offset (tk, tk->tai_offset - leap); -clock_was_set_delayed (); + clock_set =1 ; } } +return clock_set; }/**
@@ -1278,7 +1280,8 @@ static inline void accumulate_nsecs_to_s* Returns the unconsumed cycles. */ static cycle_t logarithmic_accumulation (struct timekeeper *tk,cycle_t offset, -u32 shift) +u32 shift, +unsigned int *clock_set) {cycle_t interval = tk->cycle_interval << shift;u64 raw_nsecs;
@@ -1292,7 +1295,7 @@ static cycle_t logarithmic_accumulation( tk->cycle_last += interval; tk->xtime_nsec += tk->xtime_interval << shift; -accumulate_nsecs_to_secs (tk); + *clock_set |=accumulate_nsecs_to_secs (tk);/* Accumulate raw time */ raw_nsecs = (u64 )tk->raw_interval << shift;
@@ -1350,6 +1353,7 @@ static void update_wall_time(void)struct timekeeper *tk = &shadow_timekeeper;cycle_t offset;int shift =0 , maxshift; +unsigned int clock_set =0 ;unsigned long flags;raw_spin_lock_irqsave (&timekeeper_lock, flags);
@@ -1384,7 +1388,8 @@ static void update_wall_time(void) maxshift = (64 - (ilog2 (ntp_tick_length ())+1 )) -1 ; shift =min (shift, maxshift);while (offset >= tk->cycle_interval) { - offset =logarithmic_accumulation (tk, offset, shift); + offset =logarithmic_accumulation (tk, offset, shift, + &clock_set);if (offset < tk->cycle_interval<<shift) shift--; }
@@ -1402,7 +1407,7 @@ static void update_wall_time(void)* Finally, make sure that after the rounding * xtime_nsec isn't larger than NSEC_PER_SEC */ -accumulate_nsecs_to_secs (tk); + clock_set |=accumulate_nsecs_to_secs (tk);write_seqcount_begin (&timekeeper_seq);/* Update clock->cycle_last with the new value */
@@ -1422,6 +1427,10 @@ static void update_wall_time(void)write_seqcount_end (&timekeeper_seq); out:raw_spin_unlock_irqrestore (&timekeeper_lock, flags); +if (clock_set) +/* have to call outside the timekeeper_seq */ +clock_was_set_delayed (); + }/**
@@ -1681,11 +1690,13 @@ int do_adjtimex(struct timex *txc)if (tai != orig_tai) {__timekeeping_set_tai_offset (tk, tai);timekeeping_update (tk, false, true); -clock_was_set_delayed (); }write_seqcount_end (&timekeeper_seq);raw_spin_unlock_irqrestore (&timekeeper_lock, flags); +if (tai != orig_tai) +clock_was_set (); +ntp_notify_cmos_timer ();return ret;
Greg Kroah-Hartman
maintainerPATCH 76/79 intel_pstate: Add Haswell CPU models
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nell Hardcastle <[email protected]>
commit 6cdcdb793791f776ea9408581b1242b636d43b37 upstream.
Enable the intel_pstate driver for Haswell CPUs. One missing Ivy Bridge model (0x3E) is also included. Models referenced from tools/power/x86/turbostat/turbostat.c:has_nehalem_turbo_ratio_limit
--- drivers/cpufreq/intel_pstate.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/cpufreq/intel_pstate.c +5 -0
@@ -523,6 +523,11 @@ static const struct x86_cpu_id intel_pstICPU (0x2a , default_policy),ICPU (0x2d , default_policy),ICPU (0x3a , default_policy), +ICPU (0x3c , default_policy), +ICPU (0x3e , default_policy), +ICPU (0x3f , default_policy), +ICPU (0x45 , default_policy), + ICPU(0x46, default_policy), {} };MODULE_DEVICE_TABLE (x86cpu, intel_pstate_cpu_ids);
Greg Kroah-Hartman
maintainerPATCH 77/79 intel_pstate: fix no_turbo
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <[email protected]>
commit 1ccf7a1cdafadd02e33e8f3d74370685a0600ec6 upstream.
When sysfs for no_turbo is set, then also some p states in turbo regions are observed. This patch will set IDA Engage bit when no_turbo is set to explicitly disengage turbo.
--- drivers/cpufreq/intel_pstate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +4 -1
@@ -394,7 +394,10 @@ static void intel_pstate_set_pstate(strutrace_cpu_frequency (pstate *100000 , cpu->cpu); cpu->pstate.current_pstate = pstate; -wrmsrl (MSR_IA32_PERF_CTL , pstate <<8 ); +if (limits.no_turbo) +wrmsrl (MSR_IA32_PERF_CTL ,BIT (32 ) | (pstate <<8 )); +else +wrmsrl (MSR_IA32_PERF_CTL , pstate <<8 ); }
Greg Kroah-Hartman
maintainerPATCH 78/79 intel_pstate: Improve accuracy by not truncating until final result
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brennan Shacklett <[email protected]>
commit d253d2a52676cfa3d89b8f0737a08ce7db665207 upstream.
This patch addresses Bug 60727
(https://bugzilla.kernel.org/show_bug.cgi?id=60727)
which was due to the truncation of intermediate values in the calculations, which causes the code to consistently underestimate the current cpu frequency, specifically 100% cpu utilization was truncated down to the setpoint of 97%. This patch fixes the problem by keeping the results of all intermediate calculations as fixed point numbers rather scaling them back and forth between integers and fixed point.
References: https://bugzilla.kernel.org/show_bug.cgi?id=60727
--- drivers/cpufreq/intel_pstate.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)
drivers/cpufreq/intel_pstate.c +15 -18
@@ -48,7 +48,7 @@ static inline int32_t div_fp(int32_t x, }struct sample { -int core_pct_busy; +int32_t core_pct_busy;u64 aperf;u64 mperf;int freq;
@@ -68,7 +68,7 @@ struct _pid {int32_t i_gain;int32_t d_gain;int deadband; -int last_err; +int32_t last_err; };struct cpudata {
@@ -153,16 +153,15 @@ static inline void pid_d_gain_set(struct pid->d_gain =div_fp (int_tofp (percent),int_tofp (100 )); } -static signed int pid_calc (struct _pid *pid,int busy) +static signed int pid_calc (struct _pid *pid,int32_t busy) { -signed int err, result; +signed int result;int32_t pterm, dterm, fp_error;int32_t integral_limit; - err = pid->setpoint - busy; - fp_error =int_tofp (err); + fp_error =int_tofp (pid->setpoint) - busy; -if (abs (err) <= pid->deadband) +if (abs (fp_error) <=int_tofp (pid->deadband))return 0 ; pterm =mul_fp (pid->p_gain, fp_error);
@@ -176,8 +175,8 @@ static signed int pid_calc(struct _pid *if (pid->integral < -integral_limit) pid->integral = -integral_limit; - dterm =mul_fp (pid->d_gain, (err - pid->last_err)); - pid->last_err = err; + dterm =mul_fp (pid->d_gain, fp_error - pid->last_err); + pid->last_err = fp_error; result = pterm +mul_fp (pid->integral, pid->i_gain) + dterm;
@@ -435,8 +434,9 @@ static inline void intel_pstate_calc_bus struct sample *sample) {u64 core_pct; - core_pct =div64_u64 (sample->aperf *100 , sample->mperf); - sample->freq = cpu->pstate.max_pstate * core_pct *1000 ; + core_pct =div64_u64 (int_tofp (sample->aperf *100 ), + sample->mperf); + sample->freq =fp_toint (cpu->pstate.max_pstate * core_pct *1000 ); sample->core_pct_busy = core_pct; }
@@ -468,22 +468,19 @@ static inline void intel_pstate_set_sampmod_timer_pinned (&cpu->timer, jiffies + delay); } -static inline int intel_pstate_get_scaled_busy (struct cpudata *cpu) +static inline int32_t intel_pstate_get_scaled_busy (struct cpudata *cpu) { -int32_t busy_scaled;int32_t core_busy, max_pstate, current_pstate; - core_busy =int_tofp (cpu->samples[cpu->sample_ptr].core_pct_busy); + core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; max_pstate =int_tofp (cpu->pstate.max_pstate); current_pstate =int_tofp (cpu->pstate.current_pstate); - busy_scaled =mul_fp (core_busy,div_fp (max_pstate, current_pstate)); - -return fp_toint (busy_scaled); +return mul_fp (core_busy,div_fp (max_pstate, current_pstate)); }static inline void intel_pstate_adjust_busy_pstate (struct cpudata *cpu) { -int busy_scaled; +int32_t busy_scaled;struct _pid *pid;signed int ctl =0 ;int steps;
Greg Kroah-Hartman
maintainerPATCH 79/79 intel_pstate: Correct calculation of min pstate value
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit 7244cb62d96e735847dc9d08f870550df896898c upstream.
The minimum pstate is supposed to be a percentage of the maximum P state available. Calculate min using max pstate and not the current max which may have been limited by the user
--- drivers/cpufreq/intel_pstate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/cpufreq/intel_pstate.c +3 -2
@@ -366,12 +366,13 @@ static int intel_pstate_turbo_pstate(voistatic void intel_pstate_get_min_max (struct cpudata *cpu,int *min,int *max) {int max_perf = cpu->pstate.turbo_pstate; +int max_perf_adj;int min_perf;if (limits.no_turbo) max_perf = cpu->pstate.max_pstate; - max_perf =fp_toint (mul_fp (int_tofp (max_perf), limits.max_perf)); - *max =clamp_t (int, max_perf, + max_perf_adj =fp_toint (mul_fp (int_tofp (max_perf), limits.max_perf)); + *max =clamp_t (int, max_perf_adj, cpu->pstate.min_pstate, cpu->pstate.turbo_pstate); min_perf =fp_toint (mul_fp (int_tofp (max_perf), limits.min_perf));
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.30 release. There are 79 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 Feb 13 18:46:56 UTC 2014. Anything received after that time might be too late.
Build results:
total: 126 pass: 121 skipped: 4 fail: 1
qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 16 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.30 release. There are 79 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 Feb 13 18:46:56 UTC 2014. Anything received after that time might be too late.
Build results:
total: 126 pass: 121 skipped: 4 fail: 1qemu tests all passed.
Results are as expected.
Quoted 10 lines
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Worked fine on all my test systems. Compile tests and boot tests passed. No dmesg regressions: emerg, crit, alert, err are clean. No regressions in warn.
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658