From: Greg Kroah-Hartman Date: Tue, 9 Oct 2012 23:49:56 +0000 (+0900) Subject: 3.4-stable patches X-Git-Tag: v3.0.46~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=039f38df240922661053d8ee55ae2d4fc8b38731;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: alsa-aloop-add-locking-to-timer-access.patch alsa-hda-limit-internal-mic-boost-for-asus-x202e.patch alsa-hda-realtek-fix-detection-of-alc271x-codec.patch alsa-usb-disable-broken-hw-volume-for-tenx-tp6911.patch alsa-usb-support-for-original-xbox-communicator.patch asoc-wm9712-fix-name-of-capture-switch.patch hugetlb-do-not-use-vma_hugecache_offset-for-vma_prio_tree_foreach.patch kpageflags-fix-wrong-kpf_thp-on-non-huge-compound-pages.patch mm-fix-invalidate_complete_page2-lock-ordering.patch mm-thp-fix-pmd_present-for-split_huge_page-and-prot_none-with-thp.patch --- diff --git a/queue-3.4/alsa-aloop-add-locking-to-timer-access.patch b/queue-3.4/alsa-aloop-add-locking-to-timer-access.patch new file mode 100644 index 00000000000..f878eb26a6a --- /dev/null +++ b/queue-3.4/alsa-aloop-add-locking-to-timer-access.patch @@ -0,0 +1,69 @@ +From d4f1e48bd11e3df6a26811f7a1f06c4225d92f7d Mon Sep 17 00:00:00 2001 +From: Omair Mohammed Abdullah +Date: Sat, 29 Sep 2012 12:24:05 +0530 +Subject: ALSA: aloop - add locking to timer access + +From: Omair Mohammed Abdullah + +commit d4f1e48bd11e3df6a26811f7a1f06c4225d92f7d upstream. + +When the loopback timer handler is running, calling del_timer() (for STOP +trigger) will not wait for the handler to complete before deactivating the +timer. The timer gets rescheduled in the handler as usual. Then a subsequent +START trigger will try to start the timer using add_timer() with a timer pending +leading to a kernel panic. + +Serialize the calls to add_timer() and del_timer() using a spin lock to avoid +this. + +Signed-off-by: Omair Mohammed Abdullah +Signed-off-by: Vinod Koul +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/drivers/aloop.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sound/drivers/aloop.c ++++ b/sound/drivers/aloop.c +@@ -119,6 +119,7 @@ struct loopback_pcm { + unsigned int period_size_frac; + unsigned long last_jiffies; + struct timer_list timer; ++ spinlock_t timer_lock; + }; + + static struct platform_device *devices[SNDRV_CARDS]; +@@ -169,6 +170,7 @@ static void loopback_timer_start(struct + unsigned long tick; + unsigned int rate_shift = get_rate_shift(dpcm); + ++ spin_lock(&dpcm->timer_lock); + if (rate_shift != dpcm->pcm_rate_shift) { + dpcm->pcm_rate_shift = rate_shift; + dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size); +@@ -181,12 +183,15 @@ static void loopback_timer_start(struct + tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps; + dpcm->timer.expires = jiffies + tick; + add_timer(&dpcm->timer); ++ spin_unlock(&dpcm->timer_lock); + } + + static inline void loopback_timer_stop(struct loopback_pcm *dpcm) + { ++ spin_lock(&dpcm->timer_lock); + del_timer(&dpcm->timer); + dpcm->timer.expires = 0; ++ spin_unlock(&dpcm->timer_lock); + } + + #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK) +@@ -659,6 +664,7 @@ static int loopback_open(struct snd_pcm_ + dpcm->substream = substream; + setup_timer(&dpcm->timer, loopback_timer_function, + (unsigned long)dpcm); ++ spin_lock_init(&dpcm->timer_lock); + + cable = loopback->cables[substream->number][dev]; + if (!cable) { diff --git a/queue-3.4/alsa-hda-limit-internal-mic-boost-for-asus-x202e.patch b/queue-3.4/alsa-hda-limit-internal-mic-boost-for-asus-x202e.patch new file mode 100644 index 00000000000..1bcbb272470 --- /dev/null +++ b/queue-3.4/alsa-hda-limit-internal-mic-boost-for-asus-x202e.patch @@ -0,0 +1,67 @@ +From 4b527b6516ab1f0af8aaedd02dbf71ee2c1180f4 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Tue, 18 Sep 2012 14:26:59 +0200 +Subject: ALSA: hda - limit internal mic boost for Asus X202E + +From: David Henningsson + +commit 4b527b6516ab1f0af8aaedd02dbf71ee2c1180f4 upstream. + +When the input gain for the internal mic is set to its maximum level, +the background noise becomes so high - and any relevant signal clipped - +that the setting becomes unusable. It is better to limit the amplification. + +BugLink: https://bugs.launchpad.net/bugs/1052460 +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_via.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +--- a/sound/pci/hda/patch_via.c ++++ b/sound/pci/hda/patch_via.c +@@ -3668,6 +3668,32 @@ static void set_widgets_power_state_vt20 + update_power_state(codec, 0x21, AC_PWRST_D3); + } + ++/* ++ * pin fix-up ++ */ ++enum { ++ VIA_FIXUP_INTMIC_BOOST, ++}; ++ ++static void via_fixup_intmic_boost(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ if (action == HDA_FIXUP_ACT_PRE_PROBE) ++ override_mic_boost(codec, 0x30, 0, 2, 40); ++} ++ ++static const struct hda_fixup via_fixups[] = { ++ [VIA_FIXUP_INTMIC_BOOST] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = via_fixup_intmic_boost, ++ }, ++}; ++ ++static const struct snd_pci_quirk vt2002p_fixups[] = { ++ SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST), ++ {} ++}; ++ + /* patch for vt2002P */ + static int patch_vt2002P(struct hda_codec *codec) + { +@@ -3684,6 +3710,9 @@ static int patch_vt2002P(struct hda_code + override_mic_boost(codec, 0x29, 0, 3, 40); + add_secret_dac_path(codec); + ++ snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups); ++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); ++ + /* automatic parse from the BIOS config */ + err = via_parse_auto_config(codec); + if (err < 0) { diff --git a/queue-3.4/alsa-hda-realtek-fix-detection-of-alc271x-codec.patch b/queue-3.4/alsa-hda-realtek-fix-detection-of-alc271x-codec.patch new file mode 100644 index 00000000000..220ca6ce6b7 --- /dev/null +++ b/queue-3.4/alsa-hda-realtek-fix-detection-of-alc271x-codec.patch @@ -0,0 +1,57 @@ +From 9f720bb9409ea5923361fbd3fdbc505ca36cf012 Mon Sep 17 00:00:00 2001 +From: Herton Ronaldo Krzesinski +Date: Thu, 27 Sep 2012 10:38:14 -0300 +Subject: ALSA: hda/realtek - Fix detection of ALC271X codec + +From: Herton Ronaldo Krzesinski + +commit 9f720bb9409ea5923361fbd3fdbc505ca36cf012 upstream. + +In commit af741c1 ("ALSA: hda/realtek - Call alc_auto_parse_customize_define() +always after fixup"), alc_auto_parse_customize_define was moved after +detection of ALC271X. + +The problem is that detection of ALC271X relies on spec->cdefine.platform_type, +and it's set on alc_auto_parse_customize_define. + +Move the alc_auto_parse_customize_define and its required fixup setup +before the block doing the ALC271X and other codec setup. + +BugLink: https://bugs.launchpad.net/bugs/1006690 +Signed-off-by: Herton Ronaldo Krzesinski +Reviewed-by: David Henningsson +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6307,6 +6307,12 @@ static int patch_alc269(struct hda_codec + if (err < 0) + goto error; + ++ alc_pick_fixup(codec, alc269_fixup_models, ++ alc269_fixup_tbl, alc269_fixups); ++ alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); ++ ++ alc_auto_parse_customize_define(codec); ++ + if (codec->vendor_id == 0x10ec0269) { + spec->codec_variant = ALC269_TYPE_ALC269VA; + switch (alc_get_coef0(codec) & 0x00f0) { +@@ -6331,12 +6337,6 @@ static int patch_alc269(struct hda_codec + alc269_fill_coef(codec); + } + +- alc_pick_fixup(codec, alc269_fixup_models, +- alc269_fixup_tbl, alc269_fixups); +- alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); +- +- alc_auto_parse_customize_define(codec); +- + /* automatic parse from the BIOS config */ + err = alc269_parse_auto_config(codec); + if (err < 0) diff --git a/queue-3.4/alsa-usb-disable-broken-hw-volume-for-tenx-tp6911.patch b/queue-3.4/alsa-usb-disable-broken-hw-volume-for-tenx-tp6911.patch new file mode 100644 index 00000000000..7ee3db9c93a --- /dev/null +++ b/queue-3.4/alsa-usb-disable-broken-hw-volume-for-tenx-tp6911.patch @@ -0,0 +1,42 @@ +From c10514394ef9e8de93a4ad8c8904d71dcd82c122 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Thu, 20 Sep 2012 10:20:41 +0200 +Subject: ALSA: usb - disable broken hw volume for Tenx TP6911 + +From: David Henningsson + +commit c10514394ef9e8de93a4ad8c8904d71dcd82c122 upstream. + +While going through Ubuntu bugs, I discovered this patch being +posted and a confirmation that the patch works as expected. + +Finding out how the hw volume really works would be preferrable +to just disabling the broken one, but this would be better than +nothing. + +Credit: sndfnsdfin (qawsnews) +BugLink: https://bugs.launchpad.net/bugs/559939 +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/mixer.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/sound/usb/mixer.c ++++ b/sound/usb/mixer.c +@@ -1247,6 +1247,13 @@ static int parse_audio_feature_unit(stru + /* disable non-functional volume control */ + master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME); + break; ++ case USB_ID(0x1130, 0xf211): ++ snd_printk(KERN_INFO ++ "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n"); ++ /* disable non-functional volume control */ ++ channels = 0; ++ break; ++ + } + if (channels > 0) + first_ch_bits = snd_usb_combine_bytes(bmaControls + csize, csize); diff --git a/queue-3.4/alsa-usb-support-for-original-xbox-communicator.patch b/queue-3.4/alsa-usb-support-for-original-xbox-communicator.patch new file mode 100644 index 00000000000..ff7eb91330f --- /dev/null +++ b/queue-3.4/alsa-usb-support-for-original-xbox-communicator.patch @@ -0,0 +1,81 @@ +From c05fce586d4da2dfe0309bef3795a8586e967bc3 Mon Sep 17 00:00:00 2001 +From: Marko Friedemann +Date: Mon, 3 Sep 2012 10:12:40 +0200 +Subject: ALSA: USB: Support for (original) Xbox Communicator + +From: Marko Friedemann + +commit c05fce586d4da2dfe0309bef3795a8586e967bc3 upstream. + +Added support for Xbox Communicator to USB quirks. + +Signed-off-by: Marko Friedemann +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/quirks-table.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 53 insertions(+) + +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -2751,6 +2751,59 @@ YAMAHA_DEVICE(0x7010, "UB99"), + } + }, + ++/* Microsoft XboxLive Headset/Xbox Communicator */ ++{ ++ USB_DEVICE(0x045e, 0x0283), ++ .bInterfaceClass = USB_CLASS_PER_INTERFACE, ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .vendor_name = "Microsoft", ++ .product_name = "XboxLive Headset/Xbox Communicator", ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ /* playback */ ++ .ifnum = 0, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 1, ++ .iface = 0, ++ .altsetting = 0, ++ .altset_idx = 0, ++ .attributes = 0, ++ .endpoint = 0x04, ++ .ep_attr = 0x05, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .rate_min = 22050, ++ .rate_max = 22050 ++ } ++ }, ++ { ++ /* capture */ ++ .ifnum = 1, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 1, ++ .iface = 1, ++ .altsetting = 0, ++ .altset_idx = 0, ++ .attributes = 0, ++ .endpoint = 0x85, ++ .ep_attr = 0x05, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .rate_min = 16000, ++ .rate_max = 16000 ++ } ++ }, ++ { ++ .ifnum = -1 ++ } ++ } ++ } ++}, ++ + { + /* + * Some USB MIDI devices don't have an audio control interface, diff --git a/queue-3.4/asoc-wm9712-fix-name-of-capture-switch.patch b/queue-3.4/asoc-wm9712-fix-name-of-capture-switch.patch new file mode 100644 index 00000000000..489c47b5106 --- /dev/null +++ b/queue-3.4/asoc-wm9712-fix-name-of-capture-switch.patch @@ -0,0 +1,29 @@ +From 689185b78ba6fbe0042f662a468b5565909dff7a Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Tue, 31 Jul 2012 18:37:29 +0100 +Subject: ASoC: wm9712: Fix name of Capture Switch + +From: Mark Brown + +commit 689185b78ba6fbe0042f662a468b5565909dff7a upstream. + +Help UIs associate it with the matching gain control. + +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/wm9712.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/codecs/wm9712.c ++++ b/sound/soc/codecs/wm9712.c +@@ -146,7 +146,7 @@ SOC_SINGLE("Playback Attenuate (-6dB) Sw + SOC_SINGLE("Bass Volume", AC97_MASTER_TONE, 8, 15, 1), + SOC_SINGLE("Treble Volume", AC97_MASTER_TONE, 0, 15, 1), + +-SOC_SINGLE("Capture ADC Switch", AC97_REC_GAIN, 15, 1, 1), ++SOC_SINGLE("Capture Switch", AC97_REC_GAIN, 15, 1, 1), + SOC_ENUM("Capture Volume Steps", wm9712_enum[6]), + SOC_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 63, 1), + SOC_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0), diff --git a/queue-3.4/hugetlb-do-not-use-vma_hugecache_offset-for-vma_prio_tree_foreach.patch b/queue-3.4/hugetlb-do-not-use-vma_hugecache_offset-for-vma_prio_tree_foreach.patch new file mode 100644 index 00000000000..aaf13aebbb3 --- /dev/null +++ b/queue-3.4/hugetlb-do-not-use-vma_hugecache_offset-for-vma_prio_tree_foreach.patch @@ -0,0 +1,52 @@ +From 36e4f20af833d1ce196e6a4ade05dc26c44652d1 Mon Sep 17 00:00:00 2001 +From: Michal Hocko +Date: Mon, 8 Oct 2012 16:33:31 -0700 +Subject: hugetlb: do not use vma_hugecache_offset() for vma_prio_tree_foreach + +From: Michal Hocko + +commit 36e4f20af833d1ce196e6a4ade05dc26c44652d1 upstream. + +Commit 0c176d52b0b2 ("mm: hugetlb: fix pgoff computation when unmapping +page from vma") fixed pgoff calculation but it has replaced it by +vma_hugecache_offset() which is not approapriate for offsets used for +vma_prio_tree_foreach() because that one expects index in page units +rather than in huge_page_shift. + +Johannes said: + +: The resulting index may not be too big, but it can be too small: assume +: hpage size of 2M and the address to unmap to be 0x200000. This is regular +: page index 512 and hpage index 1. If you have a VMA that maps the file +: only starting at the second huge page, that VMAs vm_pgoff will be 512 but +: you ask for offset 1 and miss it even though it does map the page of +: interest. hugetlb_cow() will try to unmap, miss the vma, and retry the +: cow until the allocation succeeds or the skipped vma(s) go away. + +Signed-off-by: Michal Hocko +Acked-by: Hillf Danton +Cc: Mel Gorman +Cc: KAMEZAWA Hiroyuki +Cc: Andrea Arcangeli +Cc: David Rientjes +Acked-by: Johannes Weiner +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/hugetlb.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -2431,7 +2431,8 @@ static int unmap_ref_private(struct mm_s + * from page cache lookup which is in HPAGE_SIZE units. + */ + address = address & huge_page_mask(h); +- pgoff = vma_hugecache_offset(h, vma, address); ++ pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + ++ vma->vm_pgoff; + mapping = vma->vm_file->f_dentry->d_inode->i_mapping; + + /* diff --git a/queue-3.4/kpageflags-fix-wrong-kpf_thp-on-non-huge-compound-pages.patch b/queue-3.4/kpageflags-fix-wrong-kpf_thp-on-non-huge-compound-pages.patch new file mode 100644 index 00000000000..4ea56df9ed2 --- /dev/null +++ b/queue-3.4/kpageflags-fix-wrong-kpf_thp-on-non-huge-compound-pages.patch @@ -0,0 +1,46 @@ +From 7a71932d5676b7410ab64d149bad8bde6b0d8632 Mon Sep 17 00:00:00 2001 +From: Naoya Horiguchi +Date: Mon, 8 Oct 2012 16:33:47 -0700 +Subject: kpageflags: fix wrong KPF_THP on non-huge compound pages + +From: Naoya Horiguchi + +commit 7a71932d5676b7410ab64d149bad8bde6b0d8632 upstream. + +KPF_THP can be set on non-huge compound pages (like slab pages or pages +allocated by drivers with __GFP_COMP) because PageTransCompound only +checks PG_head and PG_tail. Obviously this is a bug and breaks user space +applications which look for thp via /proc/kpageflags. + +This patch rules out setting KPF_THP wrongly by additionally checking +PageLRU on the head pages. + +Signed-off-by: Naoya Horiguchi +Acked-by: KOSAKI Motohiro +Acked-by: David Rientjes +Reviewed-by: Fengguang Wu +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/proc/page.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/fs/proc/page.c ++++ b/fs/proc/page.c +@@ -115,7 +115,13 @@ u64 stable_page_flags(struct page *page) + u |= 1 << KPF_COMPOUND_TAIL; + if (PageHuge(page)) + u |= 1 << KPF_HUGE; +- else if (PageTransCompound(page)) ++ /* ++ * PageTransCompound can be true for non-huge compound pages (slab ++ * pages or pages allocated by drivers with __GFP_COMP) because it ++ * just checks PG_head/PG_tail, so we need to check PageLRU to make ++ * sure a given page is a thp, not a non-huge compound page. ++ */ ++ else if (PageTransCompound(page) && PageLRU(compound_trans_head(page))) + u |= 1 << KPF_THP; + + /* diff --git a/queue-3.4/mm-fix-invalidate_complete_page2-lock-ordering.patch b/queue-3.4/mm-fix-invalidate_complete_page2-lock-ordering.patch new file mode 100644 index 00000000000..630cc2df242 --- /dev/null +++ b/queue-3.4/mm-fix-invalidate_complete_page2-lock-ordering.patch @@ -0,0 +1,63 @@ +From ec4d9f626d5908b6052c2973f37992f1db52e967 Mon Sep 17 00:00:00 2001 +From: Hugh Dickins +Date: Mon, 8 Oct 2012 16:33:14 -0700 +Subject: mm: fix invalidate_complete_page2() lock ordering + +From: Hugh Dickins + +commit ec4d9f626d5908b6052c2973f37992f1db52e967 upstream. + +In fuzzing with trinity, lockdep protested "possible irq lock inversion +dependency detected" when isolate_lru_page() reenabled interrupts while +still holding the supposedly irq-safe tree_lock: + +invalidate_inode_pages2 + invalidate_complete_page2 + spin_lock_irq(&mapping->tree_lock) + clear_page_mlock + isolate_lru_page + spin_unlock_irq(&zone->lru_lock) + +isolate_lru_page() is correct to enable interrupts unconditionally: +invalidate_complete_page2() is incorrect to call clear_page_mlock() while +holding tree_lock, which is supposed to nest inside lru_lock. + +Both truncate_complete_page() and invalidate_complete_page() call +clear_page_mlock() before taking tree_lock to remove page from radix_tree. + I guess invalidate_complete_page2() preferred to test PageDirty (again) +under tree_lock before committing to the munlock; but since the page has +already been unmapped, its state is already somewhat inconsistent, and no +worse if clear_page_mlock() moved up. + +Reported-by: Sasha Levin +Deciphered-by: Andrew Morton +Signed-off-by: Hugh Dickins +Acked-by: Mel Gorman +Cc: Rik van Riel +Cc: Johannes Weiner +Cc: Michel Lespinasse +Cc: Ying Han +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/truncate.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/mm/truncate.c ++++ b/mm/truncate.c +@@ -394,11 +394,12 @@ invalidate_complete_page2(struct address + if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL)) + return 0; + ++ clear_page_mlock(page); ++ + spin_lock_irq(&mapping->tree_lock); + if (PageDirty(page)) + goto failed; + +- clear_page_mlock(page); + BUG_ON(page_has_private(page)); + __delete_from_page_cache(page); + spin_unlock_irq(&mapping->tree_lock); diff --git a/queue-3.4/mm-thp-fix-pmd_present-for-split_huge_page-and-prot_none-with-thp.patch b/queue-3.4/mm-thp-fix-pmd_present-for-split_huge_page-and-prot_none-with-thp.patch new file mode 100644 index 00000000000..b78dae6d444 --- /dev/null +++ b/queue-3.4/mm-thp-fix-pmd_present-for-split_huge_page-and-prot_none-with-thp.patch @@ -0,0 +1,72 @@ +From 027ef6c87853b0a9df53175063028edb4950d476 Mon Sep 17 00:00:00 2001 +From: Andrea Arcangeli +Date: Mon, 8 Oct 2012 16:33:27 -0700 +Subject: mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP + +From: Andrea Arcangeli + +commit 027ef6c87853b0a9df53175063028edb4950d476 upstream. + +In many places !pmd_present has been converted to pmd_none. For pmds +that's equivalent and pmd_none is quicker so using pmd_none is better. + +However (unless we delete pmd_present) we should provide an accurate +pmd_present too. This will avoid the risk of code thinking the pmd is non +present because it's under __split_huge_page_map, see the pmd_mknotpresent +there and the comment above it. + +If the page has been mprotected as PROT_NONE, it would also lead to a +pmd_present false negative in the same way as the race with +split_huge_page. + +Because the PSE bit stays on at all times (both during split_huge_page and +when the _PAGE_PROTNONE bit get set), we could only check for the PSE bit, +but checking the PROTNONE bit too is still good to remember pmd_present +must always keep PROT_NONE into account. + +This explains a not reproducible BUG_ON that was seldom reported on the +lists. + +The same issue is in pmd_large, it would go wrong with both PROT_NONE and +if it races with split_huge_page. + +Signed-off-by: Andrea Arcangeli +Acked-by: Rik van Riel +Cc: Johannes Weiner +Cc: Hugh Dickins +Cc: Mel Gorman +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/include/asm/pgtable.h | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/arch/x86/include/asm/pgtable.h ++++ b/arch/x86/include/asm/pgtable.h +@@ -146,8 +146,7 @@ static inline unsigned long pmd_pfn(pmd_ + + static inline int pmd_large(pmd_t pte) + { +- return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == +- (_PAGE_PSE | _PAGE_PRESENT); ++ return pmd_flags(pte) & _PAGE_PSE; + } + + #ifdef CONFIG_TRANSPARENT_HUGEPAGE +@@ -415,7 +414,13 @@ static inline int pte_hidden(pte_t pte) + + static inline int pmd_present(pmd_t pmd) + { +- return pmd_flags(pmd) & _PAGE_PRESENT; ++ /* ++ * Checking for _PAGE_PSE is needed too because ++ * split_huge_page will temporarily clear the present bit (but ++ * the _PAGE_PSE flag will remain set at all times while the ++ * _PAGE_PRESENT bit is clear). ++ */ ++ return pmd_flags(pmd) & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE); + } + + static inline int pmd_none(pmd_t pmd) diff --git a/queue-3.4/series b/queue-3.4/series index 170ebe907a1..4242c15a73f 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -70,3 +70,13 @@ ext4-move_extent-code-cleanup.patch ext4-online-defrag-is-not-supported-for-journaled-files.patch ext4-always-set-i_op-in-ext4_mknod.patch ext4-fix-fdatasync-for-files-with-only-i_size-changes.patch +asoc-wm9712-fix-name-of-capture-switch.patch +kpageflags-fix-wrong-kpf_thp-on-non-huge-compound-pages.patch +hugetlb-do-not-use-vma_hugecache_offset-for-vma_prio_tree_foreach.patch +mm-fix-invalidate_complete_page2-lock-ordering.patch +mm-thp-fix-pmd_present-for-split_huge_page-and-prot_none-with-thp.patch +alsa-aloop-add-locking-to-timer-access.patch +alsa-hda-realtek-fix-detection-of-alc271x-codec.patch +alsa-hda-limit-internal-mic-boost-for-asus-x202e.patch +alsa-usb-disable-broken-hw-volume-for-tenx-tp6911.patch +alsa-usb-support-for-original-xbox-communicator.patch