diff options
-rw-r--r-- | 0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch | 54 | ||||
-rw-r--r-- | 0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch | 81 | ||||
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | config-arm-generic | 1 | ||||
-rw-r--r-- | config-arm-omap-generic | 2 | ||||
-rw-r--r-- | config-generic | 20 | ||||
-rw-r--r-- | config-x86_64-generic | 3 | ||||
-rw-r--r-- | crypto-register-cryptd-first.patch | 26 | ||||
-rw-r--r-- | epoll-fix-spurious-lockdep-warnings.patch | 119 | ||||
-rw-r--r-- | kernel.spec | 35 | ||||
-rw-r--r-- | linux-2.6-debug-taint-vm.patch | 66 | ||||
-rw-r--r-- | media-DiBcom-protect-the-I2C-bufer-access.patch | 1150 | ||||
-rw-r--r-- | media-dib0700-correct-error-message.patch | 103 | ||||
-rw-r--r-- | media-dib0700-protect-the-dib0700-buffer-access.patch | 248 | ||||
-rw-r--r-- | sources | 1 | ||||
-rw-r--r-- | x86-efi-Calling-__pa-with-an-ioremap-address-is-invalid.patch | 211 |
16 files changed, 28 insertions, 2098 deletions
diff --git a/0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch b/0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch deleted file mode 100644 index 77777f012..000000000 --- a/0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 6b7025ea927d290a59d2772828435c1893f0267f Mon Sep 17 00:00:00 2001 -From: Rik van Riel <riel@redhat.com> -Date: Fri, 7 Oct 2011 16:17:22 +0100 -Subject: [PATCH 1/2] mm: vmscan: Limit direct reclaim for higher order - allocations - -When suffering from memory fragmentation due to unfreeable pages, -THP page faults will repeatedly try to compact memory. Due to the -unfreeable pages, compaction fails. - -Needless to say, at that point page reclaim also fails to create -free contiguous 2MB areas. However, that doesn't stop the current -code from trying, over and over again, and freeing a minimum of 4MB -(2UL << sc->order pages) at every single invocation. - -This resulted in my 12GB system having 2-3GB free memory, a -corresponding amount of used swap and very sluggish response times. - -This can be avoided by having the direct reclaim code not reclaim from -zones that already have plenty of free memory available for compaction. - -If compaction still fails due to unmovable memory, doing additional -reclaim will only hurt the system, not help. - -Signed-off-by: Rik van Riel <riel@redhat.com> -Signed-off-by: Mel Gorman <mgorman@suse.de> ---- - mm/vmscan.c | 10 ++++++++++ - 1 files changed, 10 insertions(+), 0 deletions(-) - -diff --git a/mm/vmscan.c b/mm/vmscan.c -index 6072d74..8c03534 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -2022,6 +2022,16 @@ static void shrink_zones(int priority, struct zonelist *zonelist, - continue; - if (zone->all_unreclaimable && priority != DEF_PRIORITY) - continue; /* Let kswapd poll it */ -+ if (COMPACTION_BUILD) { -+ /* -+ * If we already have plenty of memory free -+ * for compaction, don't free any more. -+ */ -+ if (sc->order > PAGE_ALLOC_COSTLY_ORDER && -+ (compaction_suitable(zone, sc->order) || -+ compaction_deferred(zone))) -+ continue; -+ } - /* - * This steals pages from memory cgroups over softlimit - * and returns the number of reclaimed pages and --- -1.7.6.4 - diff --git a/0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch b/0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch deleted file mode 100644 index e74b64d91..000000000 --- a/0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch +++ /dev/null @@ -1,81 +0,0 @@ -From c01043c9aa51a63bd01c60e53494ca4a7e994542 Mon Sep 17 00:00:00 2001 -From: Mel Gorman <mgorman@suse.de> -Date: Fri, 7 Oct 2011 16:17:23 +0100 -Subject: [PATCH 2/2] mm: Abort reclaim/compaction if compaction can proceed - -If compaction can proceed, shrink_zones() stops doing any work but -the callers still shrink_slab(), raises the priority and potentially -sleeps. This patch aborts direct reclaim/compaction entirely if -compaction can proceed. - -Signed-off-by: Mel Gorman <mgorman@suse.de> ---- - mm/vmscan.c | 20 ++++++++++++++++---- - 1 files changed, 16 insertions(+), 4 deletions(-) - -diff --git a/mm/vmscan.c b/mm/vmscan.c -index 8c03534..b295a38 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -2000,14 +2000,19 @@ restart: - * - * If a zone is deemed to be full of pinned pages then just give it a light - * scan then give up on it. -+ * -+ * This function returns true if a zone is being reclaimed for a costly -+ * high-order allocation and compaction is either ready to begin or deferred. -+ * This indicates to the caller that it should retry the allocation or fail. - */ --static void shrink_zones(int priority, struct zonelist *zonelist, -+static bool shrink_zones(int priority, struct zonelist *zonelist, - struct scan_control *sc) - { - struct zoneref *z; - struct zone *zone; - unsigned long nr_soft_reclaimed; - unsigned long nr_soft_scanned; -+ bool should_abort_reclaim = false; - - for_each_zone_zonelist_nodemask(zone, z, zonelist, - gfp_zone(sc->gfp_mask), sc->nodemask) { -@@ -2025,12 +2030,15 @@ static void shrink_zones(int priority, struct zonelist *zonelist, - if (COMPACTION_BUILD) { - /* - * If we already have plenty of memory free -- * for compaction, don't free any more. -+ * for compaction in this zone , don't free any -+ * more. - */ - if (sc->order > PAGE_ALLOC_COSTLY_ORDER && - (compaction_suitable(zone, sc->order) || -- compaction_deferred(zone))) -+ compaction_deferred(zone))) { -+ should_abort_reclaim = true; - continue; -+ } - } - /* - * This steals pages from memory cgroups over softlimit -@@ -2049,6 +2057,8 @@ static void shrink_zones(int priority, struct zonelist *zonelist, - - shrink_zone(priority, zone, sc); - } -+ -+ return should_abort_reclaim; - } - - static bool zone_reclaimable(struct zone *zone) -@@ -2113,7 +2123,9 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, - sc->nr_scanned = 0; - if (!priority) - disable_swap_token(sc->mem_cgroup); -- shrink_zones(priority, zonelist, sc); -+ if (shrink_zones(priority, zonelist, sc)) -+ break; -+ - /* - * Don't shrink slabs when reclaiming memory from - * over limit cgroups --- -1.7.6.4 - @@ -1,18 +1,12 @@ **** Queued for 3.2 *********************************************************************************** -* linux-2.6-debug-taint-vm.patch -* epoll-fix-spurious-lockdep-warnings.patch * hvcs_pi_buf_alloc.patch * acpi-ensure-thermal-limits-match-cpu-freq.patch * revert-efi-rtclock.patch * block-stray-block-put-after-teardown.patch -* crypto-register-cryptd-first.patch * efi-dont-map-boot-services-on-32bit.patch * powerpc-Fix-deadlock-in-icswx-code.patch * usb-add-quirk-for-logitech-webcams.patch (reworked, sent upstream) -* 000[12]-mm-* -* x86-efi-Calling-__pa-with-an-ioremap-address-is-invalid.patch (also CC'd to - stable) * epoll-limit-paths.patch (in linux-next via -mm tree) **** Other stuff that should go upstream (in decreasing likelyhood) ************************************ diff --git a/config-arm-generic b/config-arm-generic index 19e9af451..332ada620 100644 --- a/config-arm-generic +++ b/config-arm-generic @@ -55,6 +55,7 @@ CONFIG_HIGH_RES_TIMERS=y CONFIG_LEDS=y CONFIG_LEDS_CPU=y +# CONFIG_LEDS_RENESAS_TPU is not set CONFIG_MTD_AFS_PARTS=y CONFIG_MTD_ARM_INTEGRATOR=y diff --git a/config-arm-omap-generic b/config-arm-omap-generic index e8b6b6af5..d836a9082 100644 --- a/config-arm-omap-generic +++ b/config-arm-omap-generic @@ -688,6 +688,8 @@ CONFIG_VIDEO_OMAP2_VOUT=m # CONFIG_VIDEO_AU0828 is not set # CONFIG_VIDEO_SR030PC30 is not set # CONFIG_VIDEO_OMAP3 is not set +# CONFIG_VIDEO_MT9P031 is not set +# CONFIG_VIDEO_MT9T001 is not set # CONFIG_SOC_CAMERA is not set CONFIG_USB_ET61X251=m CONFIG_USB_SN9C102=m diff --git a/config-generic b/config-generic index 6ec1960f7..e56124b05 100644 --- a/config-generic +++ b/config-generic @@ -2094,7 +2094,6 @@ CONFIG_INPUT_UINPUT=m CONFIG_INPUT_WISTRON_BTNS=m CONFIG_INPUT_ATLAS_BTNS=m -CONFIG_INPUT_ATI_REMOTE=m CONFIG_INPUT_ATI_REMOTE2=m CONFIG_INPUT_KEYSPAN_REMOTE=m @@ -2628,6 +2627,9 @@ CONFIG_VIDEO_ZORAN_LML33R10=m CONFIG_VIDEO_ZORAN_ZR36060=m CONFIG_VIDEO_FB_IVTV=m CONFIG_VIDEO_SAA7164=m +CONFIG_VIDEO_TM6000=m +CONFIG_VIDEO_TM6000_ALSA=m +CONFIG_VIDEO_TM6000_DVB=m CONFIG_VIDEO_TLG2300=m # CONFIG_VIDEO_TIMBERDALE is not set # CONFIG_VIDEO_M5MOLS is not set @@ -2755,6 +2757,13 @@ CONFIG_DVB_USB_ANYSEE=m CONFIG_DVB_USB_DW2102=m CONFIG_DVB_USB_FRIIO=m CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_IT913X=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_TDA10071=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_A8293=m +CONFIG_DVB_IT913X_FE=m CONFIG_DVB_DM1105=m CONFIG_DVB_S921=m CONFIG_DVB_ISL6405=m @@ -2834,6 +2843,7 @@ CONFIG_VIDEO_PVRUSB2_SYSFS=y CONFIG_RC_CORE=m CONFIG_RC_LOOPBACK=m CONFIG_RC_MAP=m +CONFIG_RC_ATI_REMOTE=m CONFIG_IR_NEC_DECODER=m CONFIG_IR_RC5_DECODER=m CONFIG_IR_RC6_DECODER=m @@ -2849,6 +2859,7 @@ CONFIG_IR_NUVOTON=m CONFIG_IR_FINTEK=m CONFIG_IR_REDRAT3=m + CONFIG_V4L_MEM2MEM_DRIVERS=y # CONFIG_VIDEO_MEM2MEM_TESTDEV is not set @@ -3308,6 +3319,7 @@ CONFIG_USB_GSPCA_SPCA561=m CONFIG_USB_GSPCA_STK014=m CONFIG_USB_GSPCA_SUNPLUS=m CONFIG_USB_GSPCA_T613=m +CONFIG_USB_GSPCA_TOPRO=m CONFIG_USB_GSPCA_TV8532=m CONFIG_USB_GSPCA_VC032X=m CONFIG_USB_GSPCA_ZC3XX=m @@ -3954,6 +3966,9 @@ CONFIG_CRYPTO_ANSI_CPRNG=m CONFIG_CRYPTO_DEV_HIFN_795X=m CONFIG_CRYPTO_DEV_HIFN_795X_RNG=y CONFIG_CRYPTO_PCRYPT=m +CONFIG_CRYPTO_USER=m + + # Random number generation @@ -4413,7 +4428,6 @@ CONFIG_UWB_I1480U=m CONFIG_STAGING=y # CONFIG_ET131X is not set # CONFIG_SLICOSS is not set -# CONFIG_VIDEO_TM6000 is not set # CONFIG_WLAGS49_H2 is not set # CONFIG_WLAGS49_H25 is not set # CONFIG_VIDEO_DT3155 is not set @@ -4461,7 +4475,7 @@ CONFIG_USB_ATMEL=m # CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set # CONFIG_RTS_PSTOR is not set # CONFIG_DRM_PSB is not set -# CONFIG_ALTERA_STAPL is not set +CONFIG_ALTERA_STAPL=m # CONFIG_DVB_CXD2099 is not set # CONFIG_USBIP_CORE is not set # CONFIG_BRCMSMAC is not set diff --git a/config-x86_64-generic b/config-x86_64-generic index 49448bd36..f6645fe71 100644 --- a/config-x86_64-generic +++ b/config-x86_64-generic @@ -44,6 +44,9 @@ CONFIG_CRYPTO_AES_X86_64=y CONFIG_CRYPTO_TWOFISH_X86_64=m CONFIG_CRYPTO_SALSA20_X86_64=m CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL=m +CONFIG_CRYPTO_SHA1_SSSE3=m +CONFIG_CRYPTO_BLOWFISH_X86_64=m +CONFIG_CRYPTO_TWOFISH_X86_64_3WAY=m # CONFIG_I2C_ALI1535 is not set # CONFIG_I2C_ALI1563 is not set diff --git a/crypto-register-cryptd-first.patch b/crypto-register-cryptd-first.patch deleted file mode 100644 index 0cd55d6fc..000000000 --- a/crypto-register-cryptd-first.patch +++ /dev/null @@ -1,26 +0,0 @@ -commit 9d4c522a113f6caa8b792ae829a25490fa87b1a2 -Author: Herbert Xu <herbert@gondor.apana.org.au> -Date: Fri Aug 19 16:11:23 2011 +0800 - - crypto: cryptd - Use subsys_initcall to prevent races with aesni - - As cryptd is depeneded on by other algorithms such as aesni-intel, - it needs to be registered before them. When everything is built - as modules, this occurs naturally. However, for this to work when - they are built-in, we need to use subsys_initcall in cryptd. - - Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> - -diff --git a/crypto/cryptd.c b/crypto/cryptd.c -index e46d21a..671d4d6 100644 ---- a/crypto/cryptd.c -+++ b/crypto/cryptd.c -@@ -945,7 +945,7 @@ static void __exit cryptd_exit(void) - crypto_unregister_template(&cryptd_tmpl); - } - --module_init(cryptd_init); -+subsys_initcall(cryptd_init); - module_exit(cryptd_exit); - - MODULE_LICENSE("GPL"); diff --git a/epoll-fix-spurious-lockdep-warnings.patch b/epoll-fix-spurious-lockdep-warnings.patch deleted file mode 100644 index 7ca77033e..000000000 --- a/epoll-fix-spurious-lockdep-warnings.patch +++ /dev/null @@ -1,119 +0,0 @@ -From: Nelson Elhage <nelhage@nelhage.com> -Subject: epoll: fix suprious lockdep warnings - -epoll can acquire multiple ep->mutex on multiple "struct eventpoll"s -at once in the case where one epoll fd is monitoring another epoll -fd. This is perfectly OK, since we're careful about the lock ordering, -but causes spurious lockdep warnings. Annotate the recursion using -mutex_lock_nested, and add a comment explaining the nesting rules for -good measure. - -Reported-by: Paul Bolle <pebolle@tiscali.nl> -Signed-off-by: Nelson Elhage <nelhage@nelhage.com> ---- - I've tested this on a synthetic epoll test case, that just adds e1 to - e2 and then does an epoll_wait(). I verified that it caused lockdep - problems on 3.0 and that this patch fixed it, but I haven't done more - extensive testing. Paul, are you able to test systemd against this? - - fs/eventpoll.c | 25 ++++++++++++++++++------- - 1 files changed, 18 insertions(+), 7 deletions(-) - -diff --git a/fs/eventpoll.c b/fs/eventpoll.c -index f9cfd16..0cb7bc6 100644 ---- a/fs/eventpoll.c -+++ b/fs/eventpoll.c -@@ -76,6 +76,15 @@ - * Events that require holding "epmutex" are very rare, while for - * normal operations the epoll private "ep->mtx" will guarantee - * a better scalability. -+ * It is possible to acquire multiple "ep->mtx"es at once in the case -+ * when one epoll fd is added to another. In this case, we always -+ * acquire the locks in the order of nesting (i.e. after epoll_ctl(e1, -+ * EPOLL_CTL_ADD, e2), e1->mtx will always be acquired before -+ * e2->mtx). Since we disallow cycles of epoll file descriptors, this -+ * ensures that the mutexes are well-ordered. In order to communicate -+ * this nesting to lockdep, when walking a tree of epoll file -+ * descriptors, we use the current recursion depth as the lockdep -+ * subkey. - */ - - /* Epoll private bits inside the event mask */ -@@ -464,13 +473,15 @@ static void ep_unregister_pollwait(struct eventpoll *ep, struct epitem *epi) - * @ep: Pointer to the epoll private data structure. - * @sproc: Pointer to the scan callback. - * @priv: Private opaque data passed to the @sproc callback. -+ * @depth: The current depth of recursive f_op->poll calls. - * - * Returns: The same integer error code returned by the @sproc callback. - */ - static int ep_scan_ready_list(struct eventpoll *ep, - int (*sproc)(struct eventpoll *, - struct list_head *, void *), -- void *priv) -+ void *priv, -+ int depth) - { - int error, pwake = 0; - unsigned long flags; -@@ -481,7 +492,7 @@ static int ep_scan_ready_list(struct eventpoll *ep, - * We need to lock this because we could be hit by - * eventpoll_release_file() and epoll_ctl(). - */ -- mutex_lock(&ep->mtx); -+ mutex_lock_nested(&ep->mtx, depth); - - /* - * Steal the ready list, and re-init the original one to the -@@ -670,7 +681,7 @@ static int ep_read_events_proc(struct eventpoll *ep, struct list_head *head, - - static int ep_poll_readyevents_proc(void *priv, void *cookie, int call_nests) - { -- return ep_scan_ready_list(priv, ep_read_events_proc, NULL); -+ return ep_scan_ready_list(priv, ep_read_events_proc, NULL, call_nests + 1); - } - - static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait) -@@ -737,7 +748,7 @@ void eventpoll_release_file(struct file *file) - - ep = epi->ep; - list_del_init(&epi->fllink); -- mutex_lock(&ep->mtx); -+ mutex_lock_nested(&ep->mtx, 0); - ep_remove(ep, epi); - mutex_unlock(&ep->mtx); - } -@@ -1134,7 +1145,7 @@ static int ep_send_events(struct eventpoll *ep, - esed.maxevents = maxevents; - esed.events = events; - -- return ep_scan_ready_list(ep, ep_send_events_proc, &esed); -+ return ep_scan_ready_list(ep, ep_send_events_proc, &esed, 0); - } - - static inline struct timespec ep_set_mstimeout(long ms) -@@ -1267,7 +1278,7 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) - struct rb_node *rbp; - struct epitem *epi; - -- mutex_lock(&ep->mtx); -+ mutex_lock_nested(&ep->mtx, call_nests + 1); - for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) { - epi = rb_entry(rbp, struct epitem, rbn); - if (unlikely(is_file_epoll(epi->ffd.file))) { -@@ -1409,7 +1420,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, - } - - -- mutex_lock(&ep->mtx); -+ mutex_lock_nested(&ep->mtx, 0); - - /* - * Try to lookup the file inside our RB tree, Since we grabbed "mtx" --- -1.7.4.1 - --- -To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel.spec b/kernel.spec index 0d4b61c4d..ff5734e83 100644 --- a/kernel.spec +++ b/kernel.spec @@ -84,7 +84,7 @@ Summary: The Linux kernel # The rc snapshot level %define rcrev 0 # The git snapshot level -%define gitrev 3 +%define gitrev 4 # Set rpm version accordingly %define rpmversion 3.%{upstream_sublevel}.0 %endif @@ -623,8 +623,6 @@ Patch100: taint-vbox.patch Patch160: linux-2.6-32bit-mmap-exec-randomization.patch Patch161: linux-2.6-i386-nx-emulation.patch -Patch202: linux-2.6-debug-taint-vm.patch - Patch383: linux-2.6-defaults-aspm.patch Patch390: linux-2.6-defaults-acpi-video.patch @@ -674,10 +672,6 @@ Patch2899: linux-2.6-v4l-dvb-fixes.patch Patch2900: linux-2.6-v4l-dvb-update.patch Patch2901: linux-2.6-v4l-dvb-experimental.patch -Patch2903: media-DiBcom-protect-the-I2C-bufer-access.patch -Patch2904: media-dib0700-protect-the-dib0700-buffer-access.patch -Patch2905: media-dib0700-correct-error-message.patch - # fs fixes # NFSv4 @@ -685,12 +679,8 @@ Patch2905: media-dib0700-correct-error-message.patch # patches headed upstream Patch12016: disable-i8042-check-on-apple-mac.patch -Patch12022: x86-efi-Calling-__pa-with-an-ioremap-address-is-invalid.patch - -Patch12024: epoll-fix-spurious-lockdep-warnings.patch Patch12026: block-stray-block-put-after-teardown.patch Patch12027: usb-add-quirk-for-logitech-webcams.patch -Patch12029: crypto-register-cryptd-first.patch Patch12030: epoll-limit-paths.patch Patch12303: dmar-disable-when-ricoh-multifunction.patch @@ -709,10 +699,6 @@ Patch20000: utrace.patch Patch21000: arm-omap-dt-compat.patch Patch21001: arm-smsc-support-reading-mac-address-from-device-tree.patch -#rhbz #735946 -Patch21020: 0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch -Patch21021: 0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch - #rhbz 749166 Patch21050: xfs-Fix-possible-memory-corruption-in-xfs_readlink.patch @@ -1245,9 +1231,6 @@ ApplyPatch linux-2.6-acpi-debug-infinite-loop.patch ApplyPatch acpi-ensure-thermal-limits-match-cpu-freq.patch ApplyPatch acpi-sony-nonvs-blacklist.patch -# Various low-impact patches to aid debugging. -ApplyPatch linux-2.6-debug-taint-vm.patch - # # PCI # @@ -1320,15 +1303,10 @@ ApplyOptionalPatch linux-2.6-v4l-dvb-experimental.patch # Patches headed upstream ApplyPatch disable-i8042-check-on-apple-mac.patch -ApplyPatch epoll-fix-spurious-lockdep-warnings.patch ApplyPatch epoll-limit-paths.patch ApplyPatch block-stray-block-put-after-teardown.patch ApplyPatch usb-add-quirk-for-logitech-webcams.patch -ApplyPatch crypto-register-cryptd-first.patch - -ApplyPatch x86-efi-Calling-__pa-with-an-ioremap-address-is-invalid.patch - # rhbz#605888 ApplyPatch dmar-disable-when-ricoh-multifunction.patch @@ -1340,17 +1318,9 @@ ApplyPatch hvcs_pi_buf_alloc.patch ApplyPatch powerpc-Fix-deadlock-in-icswx-code.patch -ApplyPatch media-DiBcom-protect-the-I2C-bufer-access.patch -ApplyPatch media-dib0700-protect-the-dib0700-buffer-access.patch -ApplyPatch media-dib0700-correct-error-message.patch - # utrace. ApplyPatch utrace.patch -#rhbz #735946 -ApplyPatch 0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch -ApplyPatch 0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch - ApplyPatch select-regmap-from-wm8400.patch #rhbz 750402 @@ -2059,6 +2029,9 @@ fi # ||----w | # || || %changelog +* Tue Nov 01 2011 Josh Boyer <jwboyer@redhat.com> +- Linux 3.1-git4 + * Tue Nov 01 2011 Dave Jones <davej@redhat.com> - allow building the perf rpm for ARM (rhbz 741325) diff --git a/linux-2.6-debug-taint-vm.patch b/linux-2.6-debug-taint-vm.patch deleted file mode 100644 index ab7031759..000000000 --- a/linux-2.6-debug-taint-vm.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 77c78bac236c7b07d390be65f357c85a79cce890 Mon Sep 17 00:00:00 2001 -From: Dave Jones <davej@redhat.com> -Date: Wed, 26 Oct 2011 18:44:26 -0400 -Subject: [PATCH] Add more debugging information to the VM subsystem - -Dump modules in bad_page, and print taint information in other areas ---- - mm/page_alloc.c | 1 + - mm/slab.c | 8 ++++---- - mm/slub.c | 2 +- - 3 files changed, 6 insertions(+), 5 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 6e8ecb6..83a0205 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -318,6 +318,7 @@ static void bad_page(struct page *page) - current->comm, page_to_pfn(page)); - dump_page(page); - -+ print_modules(); - dump_stack(); - out: - /* Leave bad fields for debug, except PageBuddy could make trouble */ -diff --git a/mm/slab.c b/mm/slab.c -index 708efe8..114a66d 100644 ---- a/mm/slab.c -+++ b/mm/slab.c -@@ -1927,8 +1927,8 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp) - /* Print header */ - if (lines == 0) { - printk(KERN_ERR -- "Slab corruption: %s start=%p, len=%d\n", -- cachep->name, realobj, size); -+ "Slab corruption (%s): %s start=%p, len=%d\n", -+ print_tainted(), cachep->name, realobj, size); - print_objinfo(cachep, objp, 0); - } - /* Hexdump the affected line */ -@@ -3037,8 +3037,8 @@ static void check_slabp(struct kmem_cache *cachep, struct slab *slabp) - if (entries != cachep->num - slabp->inuse) { - bad: - printk(KERN_ERR "slab: Internal list corruption detected in " -- "cache '%s'(%d), slabp %p(%d). Hexdump:\n", -- cachep->name, cachep->num, slabp, slabp->inuse); -+ "cache '%s'(%d), slabp %p(%d). Tainted(%s) Hexdump:\n", -+ cachep->name, cachep->num, slabp, slabp->inuse, print_tainted()); - print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, slabp, - sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t), - 1); -diff --git a/mm/slub.c b/mm/slub.c -index 95215aa..bbec29e 100644 ---- a/mm/slub.c -+++ b/mm/slub.c -@@ -570,7 +570,7 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...) - va_end(args); - printk(KERN_ERR "========================================" - "=====================================\n"); -- printk(KERN_ERR "BUG %s: %s\n", s->name, buf); -+ printk(KERN_ERR "BUG %s (%s): %s\n", s->name, print_tainted(), buf); - printk(KERN_ERR "----------------------------------------" - "-------------------------------------\n\n"); - } --- -1.7.6.4 - diff --git a/media-DiBcom-protect-the-I2C-bufer-access.patch b/media-DiBcom-protect-the-I2C-bufer-access.patch deleted file mode 100644 index 1b2a54b86..000000000 --- a/media-DiBcom-protect-the-I2C-bufer-access.patch +++ /dev/null @@ -1,1150 +0,0 @@ -From: Patrick Boettcher <Patrick.Boettcher@dibcom.fr> -Date: Wed, 3 Aug 2011 15:08:21 +0000 (-0300) -Subject: [media] DiBcom: protect the I2C bufer access -X-Git-Tag: next-20110927~67^2~4^2~225 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fnext%2Flinux-next.git;a=commitdiff_plain;h=79fcce3230b140f7675f8529ee53fe2f9644f902 - -[media] DiBcom: protect the I2C bufer access - -This patch protects the I2C buffer access in order to manage concurrent -access. This protection is done using mutex. -Furthermore, for the dib9000, if a pid filtering command is -received during the tuning, this pid filtering command is delayed to -avoid any concurrent access issue. - -Cc: Mauro Carvalho Chehab <mchehab@redhat.com> -Cc: Florian Mickler <florian@mickler.org> -Cc: stable@kernel.org -Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr> -Signed-off-by: Patrick Boettcher <Patrick.Boettcher@dibcom.fr> -Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> ---- - -diff --git a/drivers/media/dvb/frontends/dib0070.c b/drivers/media/dvb/frontends/dib0070.c -index 1d47d4d..dc1cb17 100644 ---- a/drivers/media/dvb/frontends/dib0070.c -+++ b/drivers/media/dvb/frontends/dib0070.c -@@ -27,6 +27,7 @@ - #include <linux/kernel.h> - #include <linux/slab.h> - #include <linux/i2c.h> -+#include <linux/mutex.h> - - #include "dvb_frontend.h" - -@@ -78,10 +79,18 @@ struct dib0070_state { - struct i2c_msg msg[2]; - u8 i2c_write_buffer[3]; - u8 i2c_read_buffer[2]; -+ struct mutex i2c_buffer_lock; - }; - --static uint16_t dib0070_read_reg(struct dib0070_state *state, u8 reg) -+static u16 dib0070_read_reg(struct dib0070_state *state, u8 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; - - memset(state->msg, 0, 2 * sizeof(struct i2c_msg)); -@@ -96,13 +105,23 @@ static uint16_t dib0070_read_reg(struct dib0070_state *state, u8 reg) - - if (i2c_transfer(state->i2c, state->msg, 2) != 2) { - printk(KERN_WARNING "DiB0070 I2C read failed\n"); -- return 0; -- } -- return (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ ret = 0; -+ } else -+ ret = (state->i2c_read_buffer[0] << 8) -+ | state->i2c_read_buffer[1]; -+ -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val) - { -+ int ret; -+ -+ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } - state->i2c_write_buffer[0] = reg; - state->i2c_write_buffer[1] = val >> 8; - state->i2c_write_buffer[2] = val & 0xff; -@@ -115,9 +134,12 @@ static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val) - - if (i2c_transfer(state->i2c, state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0070 I2C write failed\n"); -- return -EREMOTEIO; -- } -- return 0; -+ ret = -EREMOTEIO; -+ } else -+ ret = 0; -+ -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - #define HARD_RESET(state) do { \ -@@ -734,6 +756,7 @@ struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter - state->cfg = cfg; - state->i2c = i2c; - state->fe = fe; -+ mutex_init(&state->i2c_buffer_lock); - fe->tuner_priv = state; - - if (dib0070_reset(fe) != 0) -diff --git a/drivers/media/dvb/frontends/dib0090.c b/drivers/media/dvb/frontends/dib0090.c -index c9c935a..b174d1c 100644 ---- a/drivers/media/dvb/frontends/dib0090.c -+++ b/drivers/media/dvb/frontends/dib0090.c -@@ -27,6 +27,7 @@ - #include <linux/kernel.h> - #include <linux/slab.h> - #include <linux/i2c.h> -+#include <linux/mutex.h> - - #include "dvb_frontend.h" - -@@ -196,6 +197,7 @@ struct dib0090_state { - struct i2c_msg msg[2]; - u8 i2c_write_buffer[3]; - u8 i2c_read_buffer[2]; -+ struct mutex i2c_buffer_lock; - }; - - struct dib0090_fw_state { -@@ -208,10 +210,18 @@ struct dib0090_fw_state { - struct i2c_msg msg; - u8 i2c_write_buffer[2]; - u8 i2c_read_buffer[2]; -+ struct mutex i2c_buffer_lock; - }; - - static u16 dib0090_read_reg(struct dib0090_state *state, u8 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; - - memset(state->msg, 0, 2 * sizeof(struct i2c_msg)); -@@ -226,14 +236,24 @@ static u16 dib0090_read_reg(struct dib0090_state *state, u8 reg) - - if (i2c_transfer(state->i2c, state->msg, 2) != 2) { - printk(KERN_WARNING "DiB0090 I2C read failed\n"); -- return 0; -- } -+ ret = 0; -+ } else -+ ret = (state->i2c_read_buffer[0] << 8) -+ | state->i2c_read_buffer[1]; - -- return (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - static int dib0090_write_reg(struct dib0090_state *state, u32 reg, u16 val) - { -+ int ret; -+ -+ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ - state->i2c_write_buffer[0] = reg & 0xff; - state->i2c_write_buffer[1] = val >> 8; - state->i2c_write_buffer[2] = val & 0xff; -@@ -246,13 +266,23 @@ static int dib0090_write_reg(struct dib0090_state *state, u32 reg, u16 val) - - if (i2c_transfer(state->i2c, state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0090 I2C write failed\n"); -- return -EREMOTEIO; -- } -- return 0; -+ ret = -EREMOTEIO; -+ } else -+ ret = 0; -+ -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - static u16 dib0090_fw_read_reg(struct dib0090_fw_state *state, u8 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; - - memset(&state->msg, 0, sizeof(struct i2c_msg)); -@@ -262,13 +292,24 @@ static u16 dib0090_fw_read_reg(struct dib0090_fw_state *state, u8 reg) - state->msg.len = 2; - if (i2c_transfer(state->i2c, &state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0090 I2C read failed\n"); -- return 0; -- } -- return (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ ret = 0; -+ } else -+ ret = (state->i2c_read_buffer[0] << 8) -+ | state->i2c_read_buffer[1]; -+ -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - static int dib0090_fw_write_reg(struct dib0090_fw_state *state, u8 reg, u16 val) - { -+ int ret; -+ -+ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ - state->i2c_write_buffer[0] = val >> 8; - state->i2c_write_buffer[1] = val & 0xff; - -@@ -279,9 +320,12 @@ static int dib0090_fw_write_reg(struct dib0090_fw_state *state, u8 reg, u16 val) - state->msg.len = 2; - if (i2c_transfer(state->i2c, &state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0090 I2C write failed\n"); -- return -EREMOTEIO; -- } -- return 0; -+ ret = -EREMOTEIO; -+ } else -+ ret = 0; -+ -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - #define HARD_RESET(state) do { if (cfg->reset) { if (cfg->sleep) cfg->sleep(fe, 0); msleep(10); cfg->reset(fe, 1); msleep(10); cfg->reset(fe, 0); msleep(10); } } while (0) -@@ -2440,6 +2484,7 @@ struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapte - st->config = config; - st->i2c = i2c; - st->fe = fe; -+ mutex_init(&st->i2c_buffer_lock); - fe->tuner_priv = st; - - if (config->wbd == NULL) -@@ -2471,6 +2516,7 @@ struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_ada - st->config = config; - st->i2c = i2c; - st->fe = fe; -+ mutex_init(&st->i2c_buffer_lock); - fe->tuner_priv = st; - - if (dib0090_fw_reset_digital(fe, st->config) != 0) -diff --git a/drivers/media/dvb/frontends/dib7000m.c b/drivers/media/dvb/frontends/dib7000m.c -index 79cb1c2..dbb76d7 100644 ---- a/drivers/media/dvb/frontends/dib7000m.c -+++ b/drivers/media/dvb/frontends/dib7000m.c -@@ -11,6 +11,7 @@ - #include <linux/kernel.h> - #include <linux/slab.h> - #include <linux/i2c.h> -+#include <linux/mutex.h> - - #include "dvb_frontend.h" - -@@ -55,6 +56,7 @@ struct dib7000m_state { - struct i2c_msg msg[2]; - u8 i2c_write_buffer[4]; - u8 i2c_read_buffer[2]; -+ struct mutex i2c_buffer_lock; - }; - - enum dib7000m_power_mode { -@@ -69,6 +71,13 @@ enum dib7000m_power_mode { - - static u16 dib7000m_read_word(struct dib7000m_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) | 0x80; - state->i2c_write_buffer[1] = reg & 0xff; - -@@ -85,11 +94,21 @@ static u16 dib7000m_read_word(struct dib7000m_state *state, u16 reg) - if (i2c_transfer(state->i2c_adap, state->msg, 2) != 2) - dprintk("i2c read error on %d",reg); - -- return (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ mutex_unlock(&state->i2c_buffer_lock); -+ -+ return ret; - } - - static int dib7000m_write_word(struct dib7000m_state *state, u16 reg, u16 val) - { -+ int ret; -+ -+ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ - state->i2c_write_buffer[0] = (reg >> 8) & 0xff; - state->i2c_write_buffer[1] = reg & 0xff; - state->i2c_write_buffer[2] = (val >> 8) & 0xff; -@@ -101,7 +120,10 @@ static int dib7000m_write_word(struct dib7000m_state *state, u16 reg, u16 val) - state->msg[0].buf = state->i2c_write_buffer; - state->msg[0].len = 4; - -- return i2c_transfer(state->i2c_adap, state->msg, 1) != 1 ? -EREMOTEIO : 0; -+ ret = (i2c_transfer(state->i2c_adap, state->msg, 1) != 1 ? -+ -EREMOTEIO : 0); -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - static void dib7000m_write_tab(struct dib7000m_state *state, u16 *buf) - { -@@ -1385,6 +1407,7 @@ struct dvb_frontend * dib7000m_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, - demod = &st->demod; - demod->demodulator_priv = st; - memcpy(&st->demod.ops, &dib7000m_ops, sizeof(struct dvb_frontend_ops)); -+ mutex_init(&st->i2c_buffer_lock); - - st->timf_default = cfg->bw->timf; - -diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c -index a64a538..4eb9c2b 100644 ---- a/drivers/media/dvb/frontends/dib7000p.c -+++ b/drivers/media/dvb/frontends/dib7000p.c -@@ -10,6 +10,7 @@ - #include <linux/kernel.h> - #include <linux/slab.h> - #include <linux/i2c.h> -+#include <linux/mutex.h> - - #include "dvb_math.h" - #include "dvb_frontend.h" -@@ -68,6 +69,7 @@ struct dib7000p_state { - struct i2c_msg msg[2]; - u8 i2c_write_buffer[4]; - u8 i2c_read_buffer[2]; -+ struct mutex i2c_buffer_lock; - }; - - enum dib7000p_power_mode { -@@ -81,6 +83,13 @@ static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff); - - static u16 dib7000p_read_word(struct dib7000p_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; - -@@ -97,11 +106,20 @@ static u16 dib7000p_read_word(struct dib7000p_state *state, u16 reg) - if (i2c_transfer(state->i2c_adap, state->msg, 2) != 2) - dprintk("i2c read error on %d", reg); - -- return (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - static int dib7000p_write_word(struct dib7000p_state *state, u16 reg, u16 val) - { -+ int ret; -+ -+ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ - state->i2c_write_buffer[0] = (reg >> 8) & 0xff; - state->i2c_write_buffer[1] = reg & 0xff; - state->i2c_write_buffer[2] = (val >> 8) & 0xff; -@@ -113,7 +131,10 @@ static int dib7000p_write_word(struct dib7000p_state *state, u16 reg, u16 val) - state->msg[0].buf = state->i2c_write_buffer; - state->msg[0].len = 4; - -- return i2c_transfer(state->i2c_adap, state->msg, 1) != 1 ? -EREMOTEIO : 0; -+ ret = (i2c_transfer(state->i2c_adap, state->msg, 1) != 1 ? -+ -EREMOTEIO : 0); -+ mutex_unlock(&state->i2c_buffer_lock); -+ return ret; - } - - static void dib7000p_write_tab(struct dib7000p_state *state, u16 * buf) -@@ -1646,6 +1667,7 @@ int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defau - return -ENOMEM; - - dpst->i2c_adap = i2c; -+ mutex_init(&dpst->i2c_buffer_lock); - - for (k = no_of_demods - 1; k >= 0; k--) { - dpst->cfg = cfg[k]; -@@ -2324,6 +2346,7 @@ struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, - demod = &st->demod; - demod->demodulator_priv = st; - memcpy(&st->demod.ops, &dib7000p_ops, sizeof(struct dvb_frontend_ops)); -+ mutex_init(&st->i2c_buffer_lock); - - dib7000p_write_word(st, 1287, 0x0003); /* sram lead in, rdy */ - -@@ -2333,8 +2356,9 @@ struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, - st->version = dib7000p_read_word(st, 897); - - /* FIXME: make sure the dev.parent field is initialized, or else -- request_firmware() will hit an OOPS (this should be moved somewhere -- more common) */ -+ request_firmware() will hit an OOPS (this should be moved somewhere -+ more common) */ -+ st->i2c_master.gated_tuner_i2c_adap.dev.parent = i2c_adap->dev.parent; - - /* FIXME: make sure the dev.parent field is initialized, or else - request_firmware() will hit an OOPS (this should be moved somewhere -diff --git a/drivers/media/dvb/frontends/dib8000.c b/drivers/media/dvb/frontends/dib8000.c -index 7d2ea11..fe284d5 100644 ---- a/drivers/media/dvb/frontends/dib8000.c -+++ b/drivers/media/dvb/frontends/dib8000.c -@@ -10,6 +10,8 @@ - #include <linux/kernel.h> - #include <linux/slab.h> - #include <linux/i2c.h> -+#include <linux/mutex.h> -+ - #include "dvb_math.h" - - #include "dvb_frontend.h" -@@ -37,6 +39,7 @@ struct i2c_device { - u8 addr; - u8 *i2c_write_buffer; - u8 *i2c_read_buffer; -+ struct mutex *i2c_buffer_lock; - }; - - struct dib8000_state { -@@ -77,6 +80,7 @@ struct dib8000_state { - struct i2c_msg msg[2]; - u8 i2c_write_buffer[4]; - u8 i2c_read_buffer[2]; -+ struct mutex i2c_buffer_lock; - }; - - enum dib8000_power_mode { -@@ -86,24 +90,39 @@ enum dib8000_power_mode { - - static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg) - { -+ u16 ret; - struct i2c_msg msg[2] = { -- {.addr = i2c->addr >> 1, .flags = 0, -- .buf = i2c->i2c_write_buffer, .len = 2}, -- {.addr = i2c->addr >> 1, .flags = I2C_M_RD, -- .buf = i2c->i2c_read_buffer, .len = 2}, -+ {.addr = i2c->addr >> 1, .flags = 0, .len = 2}, -+ {.addr = i2c->addr >> 1, .flags = I2C_M_RD, .len = 2}, - }; - -+ if (mutex_lock_interruptible(i2c->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return 0; -+ } -+ -+ msg[0].buf = i2c->i2c_write_buffer; - msg[0].buf[0] = reg >> 8; - msg[0].buf[1] = reg & 0xff; -+ msg[1].buf = i2c->i2c_read_buffer; - - if (i2c_transfer(i2c->adap, msg, 2) != 2) - dprintk("i2c read error on %d", reg); - -- return (msg[1].buf[0] << 8) | msg[1].buf[1]; -+ ret = (msg[1].buf[0] << 8) | msg[1].buf[1]; -+ mutex_unlock(i2c->i2c_buffer_lock); -+ 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; -+ } -+ - state->i2c_write_buffer[0] = reg >> 8; - state->i2c_write_buffer[1] = reg & 0xff; - -@@ -120,7 +139,10 @@ static u16 dib8000_read_word(struct dib8000_state *state, u16 reg) - if (i2c_transfer(state->i2c.adap, state->msg, 2) != 2) - dprintk("i2c read error on %d", reg); - -- return (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; -+ mutex_unlock(&state->i2c_buffer_lock); -+ -+ return ret; - } - - static u32 dib8000_read32(struct dib8000_state *state, u16 reg) -@@ -135,22 +157,35 @@ static u32 dib8000_read32(struct dib8000_state *state, u16 reg) - - static int dib8000_i2c_write16(struct i2c_device *i2c, u16 reg, u16 val) - { -- struct i2c_msg msg = {.addr = i2c->addr >> 1, .flags = 0, -- .buf = i2c->i2c_write_buffer, .len = 4}; -+ struct i2c_msg msg = {.addr = i2c->addr >> 1, .flags = 0, .len = 4}; - int ret = 0; - -+ if (mutex_lock_interruptible(i2c->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ -+ msg.buf = i2c->i2c_write_buffer; - msg.buf[0] = (reg >> 8) & 0xff; - msg.buf[1] = reg & 0xff; - msg.buf[2] = (val >> 8) & 0xff; - msg.buf[3] = val & 0xff; - - ret = i2c_transfer(i2c->adap, &msg, 1) != 1 ? -EREMOTEIO : 0; -+ mutex_unlock(i2c->i2c_buffer_lock); - - return ret; - } - - static int dib8000_write_word(struct dib8000_state *state, u16 reg, u16 val) - { -+ int ret; -+ -+ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ - state->i2c_write_buffer[0] = (reg >> 8) & 0xff; - state->i2c_write_buffer[1] = reg & 0xff; - state->i2c_write_buffer[2] = (val >> 8) & 0xff; -@@ -162,7 +197,11 @@ static int dib8000_write_word(struct dib8000_state *state, u16 reg, u16 val) - state->msg[0].buf = state->i2c_write_buffer; - state->msg[0].len = 4; - -- return i2c_transfer(state->i2c.adap, state->msg, 1) != 1 ? -EREMOTEIO : 0; -+ ret = (i2c_transfer(state->i2c.adap, state->msg, 1) != 1 ? -+ -EREMOTEIO : 0); -+ mutex_unlock(&state->i2c_buffer_lock); -+ -+ return ret; - } - - static const s16 coeff_2k_sb_1seg_dqpsk[8] = { -@@ -2434,8 +2473,15 @@ int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 defau - if (!client.i2c_read_buffer) { - dprintk("%s: not enough memory", __func__); - ret = -ENOMEM; -- goto error_memory; -+ goto error_memory_read; -+ } -+ client.i2c_buffer_lock = kzalloc(sizeof(struct mutex), GFP_KERNEL); -+ if (!client.i2c_buffer_lock) { -+ dprintk("%s: not enough memory", __func__); -+ ret = -ENOMEM; -+ goto error_memory_lock; - } -+ mutex_init(client.i2c_buffer_lock); - - for (k = no_of_demods - 1; k >= 0; k--) { - /* designated i2c address */ -@@ -2476,8 +2522,10 @@ int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 defau - } - - error: -+ kfree(client.i2c_buffer_lock); -+error_memory_lock: - kfree(client.i2c_read_buffer); --error_memory: -+error_memory_read: - kfree(client.i2c_write_buffer); - - return ret; -@@ -2581,6 +2629,8 @@ struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, s - state->i2c.addr = i2c_addr; - state->i2c.i2c_write_buffer = state->i2c_write_buffer; - state->i2c.i2c_read_buffer = state->i2c_read_buffer; -+ mutex_init(&state->i2c_buffer_lock); -+ state->i2c.i2c_buffer_lock = &state->i2c_buffer_lock; - state->gpio_val = cfg->gpio_val; - state->gpio_dir = cfg->gpio_dir; - -diff --git a/drivers/media/dvb/frontends/dib9000.c b/drivers/media/dvb/frontends/dib9000.c -index a085588..b931074 100644 ---- a/drivers/media/dvb/frontends/dib9000.c -+++ b/drivers/media/dvb/frontends/dib9000.c -@@ -38,6 +38,15 @@ struct i2c_device { - #define DibInitLock(lock) mutex_init(lock) - #define DibFreeLock(lock) - -+struct dib9000_pid_ctrl { -+#define DIB9000_PID_FILTER_CTRL 0 -+#define DIB9000_PID_FILTER 1 -+ u8 cmd; -+ u8 id; -+ u16 pid; -+ u8 onoff; -+}; -+ - struct dib9000_state { - struct i2c_device i2c; - -@@ -99,6 +108,10 @@ struct dib9000_state { - struct i2c_msg msg[2]; - u8 i2c_write_buffer[255]; - u8 i2c_read_buffer[255]; -+ DIB_LOCK demod_lock; -+ u8 get_frontend_internal; -+ struct dib9000_pid_ctrl pid_ctrl[10]; -+ s8 pid_ctrl_index; /* -1: empty list; -2: do not use the list */ - }; - - static const u32 fe_info[44] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -@@ -1743,19 +1756,56 @@ EXPORT_SYMBOL(dib9000_set_gpio); - int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) - { - struct dib9000_state *state = fe->demodulator_priv; -- u16 val = dib9000_read_word(state, 294 + 1) & 0xffef; -+ u16 val; -+ int ret; -+ -+ if ((state->pid_ctrl_index != -2) && (state->pid_ctrl_index < 9)) { -+ /* postpone the pid filtering cmd */ -+ dprintk("pid filter cmd postpone"); -+ state->pid_ctrl_index++; -+ state->pid_ctrl[state->pid_ctrl_index].cmd = DIB9000_PID_FILTER_CTRL; -+ state->pid_ctrl[state->pid_ctrl_index].onoff = onoff; -+ return 0; -+ } -+ -+ DibAcquireLock(&state->demod_lock); -+ -+ val = dib9000_read_word(state, 294 + 1) & 0xffef; - val |= (onoff & 0x1) << 4; - - dprintk("PID filter enabled %d", onoff); -- return dib9000_write_word(state, 294 + 1, val); -+ ret = dib9000_write_word(state, 294 + 1, val); -+ DibReleaseLock(&state->demod_lock); -+ return ret; -+ - } - EXPORT_SYMBOL(dib9000_fw_pid_filter_ctrl); - - int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) - { - struct dib9000_state *state = fe->demodulator_priv; -+ int ret; -+ -+ if (state->pid_ctrl_index != -2) { -+ /* postpone the pid filtering cmd */ -+ dprintk("pid filter postpone"); -+ if (state->pid_ctrl_index < 9) { -+ state->pid_ctrl_index++; -+ state->pid_ctrl[state->pid_ctrl_index].cmd = DIB9000_PID_FILTER; -+ state->pid_ctrl[state->pid_ctrl_index].id = id; -+ state->pid_ctrl[state->pid_ctrl_index].pid = pid; -+ state->pid_ctrl[state->pid_ctrl_index].onoff = onoff; -+ } else -+ dprintk("can not add any more pid ctrl cmd"); -+ return 0; -+ } -+ -+ DibAcquireLock(&state->demod_lock); - dprintk("Index %x, PID %d, OnOff %d", id, pid, onoff); -- return dib9000_write_word(state, 300 + 1 + id, onoff ? (1 << 13) | pid : 0); -+ ret = dib9000_write_word(state, 300 + 1 + id, -+ onoff ? (1 << 13) | pid : 0); -+ DibReleaseLock(&state->demod_lock); -+ return ret; - } - EXPORT_SYMBOL(dib9000_fw_pid_filter); - -@@ -1778,6 +1828,7 @@ static void dib9000_release(struct dvb_frontend *demod) - DibFreeLock(&state->platform.risc.mbx_lock); - DibFreeLock(&state->platform.risc.mem_lock); - DibFreeLock(&state->platform.risc.mem_mbx_lock); -+ DibFreeLock(&state->demod_lock); - dibx000_exit_i2c_master(&st->i2c_master); - - i2c_del_adapter(&st->tuner_adap); -@@ -1795,14 +1846,19 @@ static int dib9000_sleep(struct dvb_frontend *fe) - { - struct dib9000_state *state = fe->demodulator_priv; - u8 index_frontend; -- int ret; -+ int ret = 0; - -+ DibAcquireLock(&state->demod_lock); - for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { - ret = state->fe[index_frontend]->ops.sleep(state->fe[index_frontend]); - if (ret < 0) -- return ret; -+ goto error; - } -- return dib9000_mbx_send(state, OUT_MSG_FE_SLEEP, NULL, 0); -+ ret = dib9000_mbx_send(state, OUT_MSG_FE_SLEEP, NULL, 0); -+ -+error: -+ DibReleaseLock(&state->demod_lock); -+ return ret; - } - - static int dib9000_fe_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) -@@ -1816,7 +1872,10 @@ static int dib9000_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_par - struct dib9000_state *state = fe->demodulator_priv; - u8 index_frontend, sub_index_frontend; - fe_status_t stat; -- int ret; -+ int ret = 0; -+ -+ if (state->get_frontend_internal == 0) -+ DibAcquireLock(&state->demod_lock); - - for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { - state->fe[index_frontend]->ops.read_status(state->fe[index_frontend], &stat); -@@ -1846,14 +1905,15 @@ static int dib9000_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_par - state->fe[index_frontend]->dtv_property_cache.rolloff; - } - } -- return 0; -+ ret = 0; -+ goto return_value; - } - } - - /* get the channel from master chip */ - ret = dib9000_fw_get_channel(fe, fep); - if (ret != 0) -- return ret; -+ goto return_value; - - /* synchronize the cache with the other frontends */ - for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { -@@ -1866,8 +1926,12 @@ static int dib9000_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_par - state->fe[index_frontend]->dtv_property_cache.code_rate_LP = fe->dtv_property_cache.code_rate_LP; - state->fe[index_frontend]->dtv_property_cache.rolloff = fe->dtv_property_cache.rolloff; - } -+ ret = 0; - -- return 0; -+return_value: -+ if (state->get_frontend_internal == 0) -+ DibReleaseLock(&state->demod_lock); -+ return ret; - } - - static int dib9000_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state) -@@ -1912,6 +1976,10 @@ static int dib9000_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par - dprintk("dib9000: must specify bandwidth "); - return 0; - } -+ -+ state->pid_ctrl_index = -1; /* postpone the pid filtering cmd */ -+ DibAcquireLock(&state->demod_lock); -+ - fe->dtv_property_cache.delivery_system = SYS_DVBT; - - /* set the master status */ -@@ -1974,13 +2042,18 @@ static int dib9000_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par - /* check the tune result */ - if (exit_condition == 1) { /* tune failed */ - dprintk("tune failed"); -+ DibReleaseLock(&state->demod_lock); -+ /* tune failed; put all the pid filtering cmd to junk */ -+ state->pid_ctrl_index = -1; - return 0; - } - - dprintk("tune success on frontend%i", index_frontend_success); - - /* synchronize all the channel cache */ -+ state->get_frontend_internal = 1; - dib9000_get_frontend(state->fe[0], fep); -+ state->get_frontend_internal = 0; - - /* retune the other frontends with the found channel */ - channel_status.status = CHANNEL_STATUS_PARAMETERS_SET; -@@ -2025,6 +2098,28 @@ static int dib9000_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par - /* turn off the diversity for the last frontend */ - dib9000_fw_set_diversity_in(state->fe[index_frontend - 1], 0); - -+ DibReleaseLock(&state->demod_lock); -+ if (state->pid_ctrl_index >= 0) { -+ u8 index_pid_filter_cmd; -+ u8 pid_ctrl_index = state->pid_ctrl_index; -+ -+ state->pid_ctrl_index = -2; -+ for (index_pid_filter_cmd = 0; -+ index_pid_filter_cmd <= pid_ctrl_index; -+ index_pid_filter_cmd++) { -+ if (state->pid_ctrl[index_pid_filter_cmd].cmd == DIB9000_PID_FILTER_CTRL) -+ dib9000_fw_pid_filter_ctrl(state->fe[0], -+ state->pid_ctrl[index_pid_filter_cmd].onoff); -+ else if (state->pid_ctrl[index_pid_filter_cmd].cmd == DIB9000_PID_FILTER) -+ dib9000_fw_pid_filter(state->fe[0], -+ state->pid_ctrl[index_pid_filter_cmd].id, -+ state->pid_ctrl[index_pid_filter_cmd].pid, -+ state->pid_ctrl[index_pid_filter_cmd].onoff); -+ } -+ } -+ /* do not postpone any more the pid filtering */ -+ state->pid_ctrl_index = -2; -+ - return 0; - } - -@@ -2041,6 +2136,7 @@ static int dib9000_read_status(struct dvb_frontend *fe, fe_status_t * stat) - u8 index_frontend; - u16 lock = 0, lock_slave = 0; - -+ DibAcquireLock(&state->demod_lock); - for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) - lock_slave |= dib9000_read_lock(state->fe[index_frontend]); - -@@ -2059,6 +2155,8 @@ static int dib9000_read_status(struct dvb_frontend *fe, fe_status_t * stat) - if ((lock & 0x0008) || (lock_slave & 0x0008)) - *stat |= FE_HAS_LOCK; - -+ DibReleaseLock(&state->demod_lock); -+ - return 0; - } - -@@ -2066,10 +2164,14 @@ static int dib9000_read_ber(struct dvb_frontend *fe, u32 * ber) - { - struct dib9000_state *state = fe->demodulator_priv; - u16 *c; -+ int ret = 0; - -+ DibAcquireLock(&state->demod_lock); - DibAcquireLock(&state->platform.risc.mem_mbx_lock); -- if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) -- return -EIO; -+ if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) { -+ ret = -EIO; -+ goto error; -+ } - dib9000_risc_mem_read(state, FE_MM_R_FE_MONITOR, - state->i2c_read_buffer, 16 * 2); - DibReleaseLock(&state->platform.risc.mem_mbx_lock); -@@ -2077,7 +2179,10 @@ static int dib9000_read_ber(struct dvb_frontend *fe, u32 * ber) - c = (u16 *)state->i2c_read_buffer; - - *ber = c[10] << 16 | c[11]; -- return 0; -+ -+error: -+ DibReleaseLock(&state->demod_lock); -+ return ret; - } - - static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength) -@@ -2086,7 +2191,9 @@ static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength) - u8 index_frontend; - u16 *c = (u16 *)state->i2c_read_buffer; - u16 val; -+ int ret = 0; - -+ DibAcquireLock(&state->demod_lock); - *strength = 0; - for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { - state->fe[index_frontend]->ops.read_signal_strength(state->fe[index_frontend], &val); -@@ -2097,8 +2204,10 @@ static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength) - } - - DibAcquireLock(&state->platform.risc.mem_mbx_lock); -- if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) -- return -EIO; -+ if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) { -+ ret = -EIO; -+ goto error; -+ } - dib9000_risc_mem_read(state, FE_MM_R_FE_MONITOR, (u8 *) c, 16 * 2); - DibReleaseLock(&state->platform.risc.mem_mbx_lock); - -@@ -2107,7 +2216,10 @@ static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength) - *strength = 65535; - else - *strength += val; -- return 0; -+ -+error: -+ DibReleaseLock(&state->demod_lock); -+ return ret; - } - - static u32 dib9000_get_snr(struct dvb_frontend *fe) -@@ -2151,6 +2263,7 @@ static int dib9000_read_snr(struct dvb_frontend *fe, u16 * snr) - u8 index_frontend; - u32 snr_master; - -+ DibAcquireLock(&state->demod_lock); - snr_master = dib9000_get_snr(fe); - for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) - snr_master += dib9000_get_snr(state->fe[index_frontend]); -@@ -2161,6 +2274,8 @@ static int dib9000_read_snr(struct dvb_frontend *fe, u16 * snr) - } else - *snr = 0; - -+ DibReleaseLock(&state->demod_lock); -+ - return 0; - } - -@@ -2168,15 +2283,22 @@ static int dib9000_read_unc_blocks(struct dvb_frontend *fe, u32 * unc) - { - struct dib9000_state *state = fe->demodulator_priv; - u16 *c = (u16 *)state->i2c_read_buffer; -+ int ret = 0; - -+ DibAcquireLock(&state->demod_lock); - DibAcquireLock(&state->platform.risc.mem_mbx_lock); -- if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) -- return -EIO; -+ if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) { -+ ret = -EIO; -+ goto error; -+ } - dib9000_risc_mem_read(state, FE_MM_R_FE_MONITOR, (u8 *) c, 16 * 2); - DibReleaseLock(&state->platform.risc.mem_mbx_lock); - - *unc = c[12]; -- return 0; -+ -+error: -+ DibReleaseLock(&state->demod_lock); -+ return ret; - } - - int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, u8 first_addr) -@@ -2322,6 +2444,10 @@ struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, c - DibInitLock(&st->platform.risc.mbx_lock); - DibInitLock(&st->platform.risc.mem_lock); - DibInitLock(&st->platform.risc.mem_mbx_lock); -+ DibInitLock(&st->demod_lock); -+ st->get_frontend_internal = 0; -+ -+ st->pid_ctrl_index = -2; - - st->fe[0] = fe; - fe->demodulator_priv = st; -diff --git a/drivers/media/dvb/frontends/dibx000_common.c b/drivers/media/dvb/frontends/dibx000_common.c -index dc5d17a..774d507 100644 ---- a/drivers/media/dvb/frontends/dibx000_common.c -+++ b/drivers/media/dvb/frontends/dibx000_common.c -@@ -1,4 +1,5 @@ - #include <linux/i2c.h> -+#include <linux/mutex.h> - - #include "dibx000_common.h" - -@@ -10,6 +11,13 @@ MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); - - static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val) - { -+ int ret; -+ -+ if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ - mst->i2c_write_buffer[0] = (reg >> 8) & 0xff; - mst->i2c_write_buffer[1] = reg & 0xff; - mst->i2c_write_buffer[2] = (val >> 8) & 0xff; -@@ -21,11 +29,21 @@ static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val) - mst->msg[0].buf = mst->i2c_write_buffer; - mst->msg[0].len = 4; - -- return i2c_transfer(mst->i2c_adap, mst->msg, 1) != 1 ? -EREMOTEIO : 0; -+ ret = i2c_transfer(mst->i2c_adap, mst->msg, 1) != 1 ? -EREMOTEIO : 0; -+ mutex_unlock(&mst->i2c_buffer_lock); -+ -+ return ret; - } - - static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg) - { -+ u16 ret; -+ -+ if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return 0; -+ } -+ - mst->i2c_write_buffer[0] = reg >> 8; - mst->i2c_write_buffer[1] = reg & 0xff; - -@@ -42,7 +60,10 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg) - if (i2c_transfer(mst->i2c_adap, mst->msg, 2) != 2) - dprintk("i2c read error on %d", reg); - -- return (mst->i2c_read_buffer[0] << 8) | mst->i2c_read_buffer[1]; -+ ret = (mst->i2c_read_buffer[0] << 8) | mst->i2c_read_buffer[1]; -+ mutex_unlock(&mst->i2c_buffer_lock); -+ -+ return ret; - } - - static int dibx000_is_i2c_done(struct dibx000_i2c_master *mst) -@@ -257,6 +278,7 @@ static int dibx000_i2c_gated_gpio67_xfer(struct i2c_adapter *i2c_adap, - struct i2c_msg msg[], int num) - { - struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap); -+ int ret; - - if (num > 32) { - dprintk("%s: too much I2C message to be transmitted (%i).\ -@@ -264,10 +286,15 @@ static int dibx000_i2c_gated_gpio67_xfer(struct i2c_adapter *i2c_adap, - return -ENOMEM; - } - -- memset(mst->msg, 0, sizeof(struct i2c_msg) * (2 + num)); -- - dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_6_7); - -+ if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ -+ memset(mst->msg, 0, sizeof(struct i2c_msg) * (2 + num)); -+ - /* open the gate */ - dibx000_i2c_gate_ctrl(mst, &mst->i2c_write_buffer[0], msg[0].addr, 1); - mst->msg[0].addr = mst->i2c_addr; -@@ -282,7 +309,11 @@ static int dibx000_i2c_gated_gpio67_xfer(struct i2c_adapter *i2c_adap, - mst->msg[num + 1].buf = &mst->i2c_write_buffer[4]; - mst->msg[num + 1].len = 4; - -- return i2c_transfer(mst->i2c_adap, mst->msg, 2 + num) == 2 + num ? num : -EIO; -+ ret = (i2c_transfer(mst->i2c_adap, mst->msg, 2 + num) == 2 + num ? -+ num : -EIO); -+ -+ mutex_unlock(&mst->i2c_buffer_lock); -+ return ret; - } - - static struct i2c_algorithm dibx000_i2c_gated_gpio67_algo = { -@@ -294,6 +325,7 @@ static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap, - struct i2c_msg msg[], int num) - { - struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap); -+ int ret; - - if (num > 32) { - dprintk("%s: too much I2C message to be transmitted (%i).\ -@@ -301,10 +333,14 @@ static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap, - return -ENOMEM; - } - -- memset(mst->msg, 0, sizeof(struct i2c_msg) * (2 + num)); -- - dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_TUNER); - -+ if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ memset(mst->msg, 0, sizeof(struct i2c_msg) * (2 + num)); -+ - /* open the gate */ - dibx000_i2c_gate_ctrl(mst, &mst->i2c_write_buffer[0], msg[0].addr, 1); - mst->msg[0].addr = mst->i2c_addr; -@@ -319,7 +355,10 @@ static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap, - mst->msg[num + 1].buf = &mst->i2c_write_buffer[4]; - mst->msg[num + 1].len = 4; - -- return i2c_transfer(mst->i2c_adap, mst->msg, 2 + num) == 2 + num ? num : -EIO; -+ ret = (i2c_transfer(mst->i2c_adap, mst->msg, 2 + num) == 2 + num ? -+ num : -EIO); -+ mutex_unlock(&mst->i2c_buffer_lock); -+ return ret; - } - - static struct i2c_algorithm dibx000_i2c_gated_tuner_algo = { -@@ -390,8 +429,18 @@ static int i2c_adapter_init(struct i2c_adapter *i2c_adap, - int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, - struct i2c_adapter *i2c_adap, u8 i2c_addr) - { -- u8 tx[4]; -- struct i2c_msg m = {.addr = i2c_addr >> 1,.buf = tx,.len = 4 }; -+ int ret; -+ -+ mutex_init(&mst->i2c_buffer_lock); -+ if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { -+ dprintk("could not acquire lock"); -+ return -EINVAL; -+ } -+ memset(mst->msg, 0, sizeof(struct i2c_msg)); -+ mst->msg[0].addr = i2c_addr >> 1; -+ mst->msg[0].flags = 0; -+ mst->msg[0].buf = mst->i2c_write_buffer; -+ mst->msg[0].len = 4; - - mst->device_rev = device_rev; - mst->i2c_adap = i2c_adap; -@@ -431,9 +480,12 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, - "DiBX000: could not initialize the master i2c_adapter\n"); - - /* initialize the i2c-master by closing the gate */ -- dibx000_i2c_gate_ctrl(mst, tx, 0, 0); -+ dibx000_i2c_gate_ctrl(mst, mst->i2c_write_buffer, 0, 0); -+ -+ ret = (i2c_transfer(i2c_adap, mst->msg, 1) == 1); -+ mutex_unlock(&mst->i2c_buffer_lock); - -- return i2c_transfer(i2c_adap, &m, 1) == 1; -+ return ret; - } - - EXPORT_SYMBOL(dibx000_init_i2c_master); -diff --git a/drivers/media/dvb/frontends/dibx000_common.h b/drivers/media/dvb/frontends/dibx000_common.h -index f031165..5e01147 100644 ---- a/drivers/media/dvb/frontends/dibx000_common.h -+++ b/drivers/media/dvb/frontends/dibx000_common.h -@@ -33,6 +33,7 @@ struct dibx000_i2c_master { - struct i2c_msg msg[34]; - u8 i2c_write_buffer[8]; - u8 i2c_read_buffer[2]; -+ struct mutex i2c_buffer_lock; - }; - - extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, diff --git a/media-dib0700-correct-error-message.patch b/media-dib0700-correct-error-message.patch deleted file mode 100644 index 5e5d3bfa2..000000000 --- a/media-dib0700-correct-error-message.patch +++ /dev/null @@ -1,103 +0,0 @@ -From: Olivier Grenie <olivier.grenie@dibcom.fr> -Date: Thu, 4 Aug 2011 16:10:03 +0000 (-0300) -Subject: [media] dib0700: correct error message -X-Git-Tag: next-20110927~67^2~4^2~223 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fnext%2Flinux-next.git;a=commitdiff_plain;h=680417bb318adc5f1f8f392730776176fbcdedd8 - -[media] dib0700: correct error message - -The goal of this patch is to correct a previous patch. In case of error, -the err() function should be used instead of dprintk() function. - -[mchehab@redhat.com: as I've replaced dprintk by deb_info, on the the - previous patch, to avoid breaking bisect, I had to fix a merge conflict - on this one] -Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr> -Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> ---- - -diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c -index a224e94..b693ed1 100644 ---- a/drivers/media/dvb/dvb-usb/dib0700_core.c -+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c -@@ -31,7 +31,7 @@ int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, - int ret; - - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - -@@ -117,7 +117,7 @@ int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_ - int ret; - - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - -@@ -138,7 +138,7 @@ static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) - - if (st->fw_version >= 0x10201) { - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - -@@ -227,7 +227,7 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, - } else { - /* Write request */ - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - st->buf[0] = REQUEST_NEW_I2C_WRITE; -@@ -273,7 +273,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, - if (mutex_lock_interruptible(&d->i2c_mutex) < 0) - return -EAGAIN; - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - -@@ -368,7 +368,7 @@ static int dib0700_set_clock(struct dvb_usb_device *d, u8 en_pll, - int ret; - - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - -@@ -400,7 +400,7 @@ int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz) - return -EINVAL; - - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - -@@ -560,7 +560,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) - } - - if (mutex_lock_interruptible(&adap->dev->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - -@@ -610,7 +610,7 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) - int new_proto, ret; - - if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -- deb_info("could not acquire lock"); -+ err("could not acquire lock"); - return 0; - } - diff --git a/media-dib0700-protect-the-dib0700-buffer-access.patch b/media-dib0700-protect-the-dib0700-buffer-access.patch deleted file mode 100644 index 109cab8ec..000000000 --- a/media-dib0700-protect-the-dib0700-buffer-access.patch +++ /dev/null @@ -1,248 +0,0 @@ -From: Olivier Grenie <olivier.grenie@dibcom.fr> -Date: Mon, 1 Aug 2011 15:45:58 +0000 (-0300) -Subject: [media] dib0700: protect the dib0700 buffer access -X-Git-Tag: next-20110927~67^2~4^2~224 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fnext%2Flinux-next.git;a=commitdiff_plain;h=bff469f4167fdabfe15294f375577d7eadbaa1bb - -[media] dib0700: protect the dib0700 buffer access - -This patch protects the common buffer access inside the dib0700 in order -to manage concurrent access. This protection is done using mutex. - -Cc: Mauro Carvalho Chehab <mchehab@redhat.com> -Cc: Florian Mickler <florian@mickler.org> -Cc: stable@kernel.org -Signed-off-by: Javier Marcet <javier@marcet.info> -Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr> -Signed-off-by: Patrick Boettcher <patrick.boettcher@dibcom.fr> -[mchehab@redhat.com: dprint requires 3 arguments. Replaced by dib_info] -Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> ---- - -diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c -index 5eb91b4..a224e94 100644 ---- a/drivers/media/dvb/dvb-usb/dib0700_core.c -+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c -@@ -30,6 +30,11 @@ int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, - struct dib0700_state *st = d->priv; - int ret; - -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } -+ - ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), - REQUEST_GET_VERSION, - USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, -@@ -46,6 +51,7 @@ int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, - if (fwtype != NULL) - *fwtype = (st->buf[12] << 24) | (st->buf[13] << 16) | - (st->buf[14] << 8) | st->buf[15]; -+ mutex_unlock(&d->usb_mutex); - return ret; - } - -@@ -108,7 +114,12 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen - int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val) - { - struct dib0700_state *st = d->priv; -- s16 ret; -+ int ret; -+ -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } - - st->buf[0] = REQUEST_SET_GPIO; - st->buf[1] = gpio; -@@ -116,6 +127,7 @@ int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_ - - ret = dib0700_ctrl_wr(d, st->buf, 3); - -+ mutex_unlock(&d->usb_mutex); - return ret; - } - -@@ -125,6 +137,11 @@ static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) - int ret; - - if (st->fw_version >= 0x10201) { -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } -+ - st->buf[0] = REQUEST_SET_USB_XFER_LEN; - st->buf[1] = (nb_ts_packets >> 8) & 0xff; - st->buf[2] = nb_ts_packets & 0xff; -@@ -132,6 +149,7 @@ static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) - deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets); - - ret = dib0700_ctrl_wr(d, st->buf, 3); -+ mutex_unlock(&d->usb_mutex); - } else { - deb_info("this firmware does not allow to change the USB xfer len\n"); - ret = -EIO; -@@ -208,6 +226,10 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, - - } else { - /* Write request */ -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } - st->buf[0] = REQUEST_NEW_I2C_WRITE; - st->buf[1] = msg[i].addr << 1; - st->buf[2] = (en_start << 7) | (en_stop << 6) | -@@ -227,6 +249,7 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, - USB_TYPE_VENDOR | USB_DIR_OUT, - 0, 0, st->buf, msg[i].len + 4, - USB_CTRL_GET_TIMEOUT); -+ mutex_unlock(&d->usb_mutex); - if (result < 0) { - deb_info("i2c write error (status = %d)\n", result); - break; -@@ -249,6 +272,10 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, - - if (mutex_lock_interruptible(&d->i2c_mutex) < 0) - return -EAGAIN; -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } - - for (i = 0; i < num; i++) { - /* fill in the address */ -@@ -279,6 +306,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, - break; - } - } -+ mutex_unlock(&d->usb_mutex); - mutex_unlock(&d->i2c_mutex); - - return i; -@@ -337,7 +365,12 @@ static int dib0700_set_clock(struct dvb_usb_device *d, u8 en_pll, - u16 pll_loopdiv, u16 free_div, u16 dsuScaler) - { - struct dib0700_state *st = d->priv; -- s16 ret; -+ int ret; -+ -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } - - st->buf[0] = REQUEST_SET_CLOCK; - st->buf[1] = (en_pll << 7) | (pll_src << 6) | -@@ -352,6 +385,7 @@ static int dib0700_set_clock(struct dvb_usb_device *d, u8 en_pll, - st->buf[9] = dsuScaler & 0xff; /* LSB */ - - ret = dib0700_ctrl_wr(d, st->buf, 10); -+ mutex_unlock(&d->usb_mutex); - - return ret; - } -@@ -360,10 +394,16 @@ int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz) - { - struct dib0700_state *st = d->priv; - u16 divider; -+ int ret; - - if (scl_kHz == 0) - return -EINVAL; - -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } -+ - st->buf[0] = REQUEST_SET_I2C_PARAM; - divider = (u16) (30000 / scl_kHz); - st->buf[1] = 0; -@@ -379,7 +419,11 @@ int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz) - deb_info("setting I2C speed: %04x %04x %04x (%d kHz).", - (st->buf[2] << 8) | (st->buf[3]), (st->buf[4] << 8) | - st->buf[5], (st->buf[6] << 8) | st->buf[7], scl_kHz); -- return dib0700_ctrl_wr(d, st->buf, 8); -+ -+ ret = dib0700_ctrl_wr(d, st->buf, 8); -+ mutex_unlock(&d->usb_mutex); -+ -+ return ret; - } - - -@@ -515,6 +559,11 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) - } - } - -+ if (mutex_lock_interruptible(&adap->dev->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } -+ - st->buf[0] = REQUEST_ENABLE_VIDEO; - /* this bit gives a kind of command, - * rather than enabling something or not */ -@@ -548,7 +597,10 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) - - deb_info("data for streaming: %x %x\n", st->buf[1], st->buf[2]); - -- return dib0700_ctrl_wr(adap->dev, st->buf, 4); -+ ret = dib0700_ctrl_wr(adap->dev, st->buf, 4); -+ mutex_unlock(&adap->dev->usb_mutex); -+ -+ return ret; - } - - int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) -@@ -557,6 +609,11 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) - struct dib0700_state *st = d->priv; - int new_proto, ret; - -+ if (mutex_lock_interruptible(&d->usb_mutex) < 0) { -+ deb_info("could not acquire lock"); -+ return 0; -+ } -+ - st->buf[0] = REQUEST_SET_RC; - st->buf[1] = 0; - st->buf[2] = 0; -@@ -567,23 +624,29 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) - else if (rc_type == RC_TYPE_NEC) - new_proto = 0; - else if (rc_type == RC_TYPE_RC6) { -- if (st->fw_version < 0x10200) -- return -EINVAL; -+ if (st->fw_version < 0x10200) { -+ ret = -EINVAL; -+ goto out; -+ } - - new_proto = 2; -- } else -- return -EINVAL; -+ } else { -+ ret = -EINVAL; -+ goto out; -+ } - - st->buf[1] = new_proto; - - ret = dib0700_ctrl_wr(d, st->buf, 3); - if (ret < 0) { - err("ir protocol setup failed"); -- return ret; -+ goto out; - } - - d->props.rc.core.protocol = rc_type; - -+out: -+ mutex_unlock(&d->usb_mutex); - return ret; - } - @@ -1,2 +1,3 @@ 8d43453f8159b2332ad410b19d86a931 linux-3.1.tar.bz2 f6754489c6fb6de511c3fcd2b2fa4474 patch-3.1-git3.bz2 +349569748e059f2b64adab5eb7cf42e6 patch-3.1-git4.bz2 diff --git a/x86-efi-Calling-__pa-with-an-ioremap-address-is-invalid.patch b/x86-efi-Calling-__pa-with-an-ioremap-address-is-invalid.patch deleted file mode 100644 index f05567fe3..000000000 --- a/x86-efi-Calling-__pa-with-an-ioremap-address-is-invalid.patch +++ /dev/null @@ -1,211 +0,0 @@ -Path: news.gmane.org!not-for-mail -From: Matt Fleming <matt@console-pimps.org> -Newsgroups: gmane.linux.kernel -Subject: [PATCH v2] x86, efi: Calling __pa() with an ioremap'd address is invalid -Date: Fri, 14 Oct 2011 12:36:45 +0100 -Lines: 160 -Approved: news@gmane.org -Message-ID: <1318592205-11193-1-git-send-email-matt@console-pimps.org> -NNTP-Posting-Host: lo.gmane.org -X-Trace: dough.gmane.org 1318592224 30879 80.91.229.12 (14 Oct 2011 11:37:04 GMT) -X-Complaints-To: usenet@dough.gmane.org -NNTP-Posting-Date: Fri, 14 Oct 2011 11:37:04 +0000 (UTC) -Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>, - "H. Peter Anvin" <hpa@zytor.com>, Zhang Rui <rui.zhang@intel.com>, - Huang Ying <huang.ying.caritas@gmail.com>, - linux-kernel@vger.kernel.org -To: Matthew Garrett <mjg@redhat.com> -Original-X-From: linux-kernel-owner@vger.kernel.org Fri Oct 14 13:36:59 2011 -Return-path: <linux-kernel-owner@vger.kernel.org> -Envelope-to: glk-linux-kernel-3@lo.gmane.org -Original-Received: from vger.kernel.org ([209.132.180.67]) - by lo.gmane.org with esmtp (Exim 4.69) - (envelope-from <linux-kernel-owner@vger.kernel.org>) - id 1REg4Q-0001UQ-SA - for glk-linux-kernel-3@lo.gmane.org; Fri, 14 Oct 2011 13:36:59 +0200 -Original-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1755420Ab1JNLgv (ORCPT <rfc822;glk-linux-kernel-3@m.gmane.org>); - Fri, 14 Oct 2011 07:36:51 -0400 -Original-Received: from arkanian.console-pimps.org ([212.110.184.194]:46859 "EHLO - arkanian.console-pimps.org" rhost-flags-OK-OK-OK-OK) - by vger.kernel.org with ESMTP id S1751315Ab1JNLgu (ORCPT - <rfc822;linux-kernel@vger.kernel.org>); - Fri, 14 Oct 2011 07:36:50 -0400 -Original-Received: by arkanian.console-pimps.org (Postfix, from userid 1002) - id 443C1C0009; Fri, 14 Oct 2011 12:36:49 +0100 (BST) -X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on - arkanian.vm.bytemark.co.uk -X-Spam-Level: -X-Spam-Status: No, score=-5.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 - autolearn=ham version=3.2.5 -Original-Received: from localhost (02ddb86b.bb.sky.com [2.221.184.107]) - by arkanian.console-pimps.org (Postfix) with ESMTPSA id F0D40C0008; - Fri, 14 Oct 2011 12:36:47 +0100 (BST) -X-Mailer: git-send-email 1.7.4.4 -Original-Sender: linux-kernel-owner@vger.kernel.org -Precedence: bulk -List-ID: <linux-kernel.vger.kernel.org> -X-Mailing-List: linux-kernel@vger.kernel.org -Xref: news.gmane.org gmane.linux.kernel:1203294 -Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/1203294> - -From: Matt Fleming <matt.fleming@intel.com> - -If we encounter an efi_memory_desc_t without EFI_MEMORY_WB set in -->attribute we currently call set_memory_uc(), which in turn calls -__pa() on a potentially ioremap'd address. On CONFIG_X86_32 this is -invalid, resulting in the following oops, - - BUG: unable to handle kernel paging request at f7f22280 - IP: [<c10257b9>] reserve_ram_pages_type+0x89/0x210 - *pdpt = 0000000001978001 *pde = 0000000001ffb067 *pte = 0000000000000000 - Oops: 0000 [#1] PREEMPT SMP - Modules linked in: - - Pid: 0, comm: swapper Not tainted 3.0.0-acpi-efi-0805 #3 - EIP: 0060:[<c10257b9>] EFLAGS: 00010202 CPU: 0 - EIP is at reserve_ram_pages_type+0x89/0x210 - EAX: 0070e280 EBX: 38714000 ECX: f7814000 EDX: 00000000 - ESI: 00000000 EDI: 38715000 EBP: c189fef0 ESP: c189fea8 - DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 - Process swapper (pid: 0, ti=c189e000 task=c18bbe60 task.ti=c189e000) - Stack: - 80000200 ff108000 00000000 c189ff00 00038714 00000000 00000000 c189fed0 - c104f8ca 00038714 00000000 00038715 00000000 00000000 00038715 00000000 - 00000010 38715000 c189ff48 c1025aff 38715000 00000000 00000010 00000000 - Call Trace: - [<c104f8ca>] ? page_is_ram+0x1a/0x40 - [<c1025aff>] reserve_memtype+0xdf/0x2f0 - [<c1024dc9>] set_memory_uc+0x49/0xa0 - [<c19334d0>] efi_enter_virtual_mode+0x1c2/0x3aa - [<c19216d4>] start_kernel+0x291/0x2f2 - [<c19211c7>] ? loglevel+0x1b/0x1b - [<c19210bf>] i386_start_kernel+0xbf/0xc8 - -So, if we're ioremap'ing an address range let's setup the mapping with -the correct caching attribute instead of modifying it after the fact. - -Also, take this opportunity to unify the 32/64-bit efi_ioremap() -implementations because they can both be implemented with -ioremap_{cache,nocache}. When asked about the original reason behind -using init_memory_mapping() for the 64-bit version Huang Ying said, - - "The intention of init_memory_mapping() usage is to make EFI virtual - address unchanged after kexec. But in fact, init_memory_mapping() - can not handle some memory range, so ioremap_xxx() is introduced as - a fix. Now we decide to use ioremap_xxx() anyway and use some other - scheme for kexec support, so init_memory_mapping() here is - unnecessary. IMHO, init_memory_mapping() is not as good as - ioremap_xxx() here." - -And because efi_ioremap() now consists of 4 lines, let's just inline -it directly into the one callsite in efi_enter_virtual_mode(). - -Cc: Thomas Gleixner <tglx@linutronix.de> -Cc: Ingo Molnar <mingo@elte.hu> -Cc: H. Peter Anvin <hpa@zytor.com> -Cc: Matthew Garrett <mjg@redhat.com> -Cc: Zhang Rui <rui.zhang@intel.com> -Cc: Huang Ying <huang.ying.caritas@gmail.com> -Cc: stable@kernel.org -Signed-off-by: Matt Fleming <matt.fleming@intel.com> ---- - arch/x86/include/asm/efi.h | 5 ----- - arch/x86/platform/efi/efi.c | 24 ++++++++++++++---------- - arch/x86/platform/efi/efi_64.c | 17 ----------------- - 3 files changed, 14 insertions(+), 32 deletions(-) - -diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h -index 7093e4a..b8d8bfc 100644 ---- a/arch/x86/include/asm/efi.h -+++ b/arch/x86/include/asm/efi.h -@@ -33,8 +33,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...); - #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ - efi_call_virt(f, a1, a2, a3, a4, a5, a6) - --#define efi_ioremap(addr, size, type) ioremap_cache(addr, size) -- - #else /* !CONFIG_X86_32 */ - - extern u64 efi_call0(void *fp); -@@ -84,9 +82,6 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, - efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ - (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) - --extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, -- u32 type); -- - #endif /* CONFIG_X86_32 */ - - extern int add_efi_memmap; -diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c -index 3ae4128..6ea011c 100644 ---- a/arch/x86/platform/efi/efi.c -+++ b/arch/x86/platform/efi/efi.c -@@ -670,10 +670,21 @@ void __init efi_enter_virtual_mode(void) - end_pfn = PFN_UP(end); - if (end_pfn <= max_low_pfn_mapped - || (end_pfn > (1UL << (32 - PAGE_SHIFT)) -- && end_pfn <= max_pfn_mapped)) -+ && end_pfn <= max_pfn_mapped)) { - va = __va(md->phys_addr); -- else -- va = efi_ioremap(md->phys_addr, size, md->type); -+ -+ if (!(md->attribute & EFI_MEMORY_WB)) { -+ addr = (u64) (unsigned long)va; -+ npages = md->num_pages; -+ memrange_efi_to_native(&addr, &npages); -+ set_memory_uc(addr, npages); -+ } -+ } else { -+ if (!(md->attribute & EFI_MEMORY_WB)) -+ va = ioremap_nocache(md->phys_addr, size); -+ else -+ va = ioremap_cache(md->phys_addr, size); -+ } - - md->virt_addr = (u64) (unsigned long) va; - -@@ -683,13 +694,6 @@ void __init efi_enter_virtual_mode(void) - continue; - } - -- if (!(md->attribute & EFI_MEMORY_WB)) { -- addr = md->virt_addr; -- npages = md->num_pages; -- memrange_efi_to_native(&addr, &npages); -- set_memory_uc(addr, npages); -- } -- - systab = (u64) (unsigned long) efi_phys.systab; - if (md->phys_addr <= systab && systab < end) { - systab += md->virt_addr - md->phys_addr; -diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c -index ac3aa54..312250c 100644 ---- a/arch/x86/platform/efi/efi_64.c -+++ b/arch/x86/platform/efi/efi_64.c -@@ -80,20 +80,3 @@ void __init efi_call_phys_epilog(void) - local_irq_restore(efi_flags); - early_code_mapping_set_exec(0); - } -- --void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, -- u32 type) --{ -- unsigned long last_map_pfn; -- -- if (type == EFI_MEMORY_MAPPED_IO) -- return ioremap(phys_addr, size); -- -- last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); -- if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) { -- unsigned long top = last_map_pfn << PAGE_SHIFT; -- efi_ioremap(top, size - (top - phys_addr), type); -- } -- -- return (void __iomem *)__va(phys_addr); --} --- -1.7.4.4 - |