--- /dev/null
+From f2e4c5e004691dfe37d0e4b363296f28abdb9bc7 Mon Sep 17 00:00:00 2001
+From: Antti Palosaari <crope@iki.fi>
+Date: Thu, 16 Jan 2014 08:59:30 -0300
+Subject: [media] af9035: add ID [2040:f900] Hauppauge WinTV-MiniStick 2
+
+From: Antti Palosaari <crope@iki.fi>
+
+commit f2e4c5e004691dfe37d0e4b363296f28abdb9bc7 upstream.
+
+Add USB ID [2040:f900] for Hauppauge WinTV-MiniStick 2.
+Device is build upon IT9135 chipset.
+
+Tested-by: Stefan Becker <schtefan@gmx.net>
+Signed-off-by: Antti Palosaari <crope@iki.fi>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/dvb-usb-v2/af9035.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/media/usb/dvb-usb-v2/af9035.c
++++ b/drivers/media/usb/dvb-usb-v2/af9035.c
+@@ -1539,6 +1539,8 @@ static const struct usb_device_id af9035
+ &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) },
+ { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a05,
+ &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) },
++ { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900,
++ &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) },
+ { }
+ };
+ MODULE_DEVICE_TABLE(usb, af9035_id_table);
--- /dev/null
+From c7579fed1f1b2567529aea64ef19871337403ab3 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 5 Feb 2014 07:28:10 +0100
+Subject: ALSA: hda - Add missing mixer widget for AD1983
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit c7579fed1f1b2567529aea64ef19871337403ab3 upstream.
+
+The mixer widget on AD1983 at NID 0x0e was missing in the commit
+[f2f8be43c5c9: ALSA: hda - Add aamix NID to AD codecs].
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70011
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_analog.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_analog.c
++++ b/sound/pci/hda/patch_analog.c
+@@ -481,6 +481,7 @@ static int patch_ad1983(struct hda_codec
+ return err;
+ spec = codec->spec;
+
++ spec->gen.mixer_nid = 0x0e;
+ spec->gen.beep_nid = 0x10;
+ set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
+ err = ad198x_parse_auto_config(codec, false);
--- /dev/null
+From c20f31ec421ea4fabea5e95a6afd46c5f41e5599 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 3 Feb 2014 11:02:10 +0100
+Subject: ALSA: hda - Fix missing VREF setup for Mac Pro 1,1
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit c20f31ec421ea4fabea5e95a6afd46c5f41e5599 upstream.
+
+Mac Pro 1,1 with ALC889A codec needs the VREF setup on NID 0x18 to
+VREF50, in order to make the speaker working. The same fixup was
+already needed for MacBook Air 1,1, so we can reuse it.
+
+Reported-by: Nicolai Beuermann <mail@nico-beuermann.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -1771,6 +1771,7 @@ enum {
+ ALC889_FIXUP_IMAC91_VREF,
+ ALC889_FIXUP_MBA11_VREF,
+ ALC889_FIXUP_MBA21_VREF,
++ ALC889_FIXUP_MP11_VREF,
+ ALC882_FIXUP_INV_DMIC,
+ ALC882_FIXUP_NO_PRIMARY_HP,
+ ALC887_FIXUP_ASUS_BASS,
+@@ -2127,6 +2128,12 @@ static const struct hda_fixup alc882_fix
+ .chained = true,
+ .chain_id = ALC889_FIXUP_MBP_VREF,
+ },
++ [ALC889_FIXUP_MP11_VREF] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc889_fixup_mba11_vref,
++ .chained = true,
++ .chain_id = ALC885_FIXUP_MACPRO_GPIO,
++ },
+ [ALC882_FIXUP_INV_DMIC] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc_fixup_inv_dmic_0x12,
+@@ -2184,7 +2191,7 @@ static const struct snd_pci_quirk alc882
+ SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
+ SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
+ SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
+- SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO),
++ SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
+ SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
+ SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
+ SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
--- /dev/null
+From 4528eb19b00d9ccd65ded6f8201eec704267edd8 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 4 Feb 2014 07:39:06 +0100
+Subject: ALSA: hda - Fix silent output on Toshiba Satellite L40
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 4528eb19b00d9ccd65ded6f8201eec704267edd8 upstream.
+
+Toshiba Satellite L40 with AD1986A codec requires the EAPD of NID 0x1b
+to be constantly on, otherwise the output doesn't work.
+Unlike most of other AD1986A machines, EAPD is correctly implemented
+in HD-audio manner (that is, bit set = amp on), so we need to clear
+the inv_eapd flag in the fixup, too.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=67481
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_analog.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+--- a/sound/pci/hda/patch_analog.c
++++ b/sound/pci/hda/patch_analog.c
+@@ -227,6 +227,19 @@ static void ad_fixup_inv_jack_detect(str
+ }
+ }
+
++/* Toshiba Satellite L40 implements EAPD in a standard way unlike others */
++static void ad1986a_fixup_eapd(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ struct ad198x_spec *spec = codec->spec;
++
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
++ codec->inv_eapd = 0;
++ spec->gen.keep_eapd_on = 1;
++ spec->eapd_nid = 0x1b;
++ }
++}
++
+ enum {
+ AD1986A_FIXUP_INV_JACK_DETECT,
+ AD1986A_FIXUP_ULTRA,
+@@ -234,6 +247,7 @@ enum {
+ AD1986A_FIXUP_3STACK,
+ AD1986A_FIXUP_LAPTOP,
+ AD1986A_FIXUP_LAPTOP_IMIC,
++ AD1986A_FIXUP_EAPD,
+ };
+
+ static const struct hda_fixup ad1986a_fixups[] = {
+@@ -294,6 +308,10 @@ static const struct hda_fixup ad1986a_fi
+ .chained_before = 1,
+ .chain_id = AD1986A_FIXUP_LAPTOP,
+ },
++ [AD1986A_FIXUP_EAPD] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = ad1986a_fixup_eapd,
++ },
+ };
+
+ static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
+@@ -301,6 +319,7 @@ static const struct snd_pci_quirk ad1986
+ SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
+ SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
+ SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
++ SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40", AD1986A_FIXUP_EAPD),
+ SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
+ SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
+ SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
--- /dev/null
+From 276ab336b4c6e483d12fd46cbf24f97f71867710 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 5 Feb 2014 08:49:41 +0100
+Subject: ALSA: hda - Improve loopback path lookups for AD1983
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 276ab336b4c6e483d12fd46cbf24f97f71867710 upstream.
+
+AD1983 has flexible loopback routes and the generic parser would take
+wrong path confusingly instead of taking individual paths via NID 0x0c
+and 0x0d. For avoiding it, limit the connections at these widgets so
+that the parser can think more straightforwardly. This fixes the
+regression of the missing line-in loopback on Dell machine.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70011
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_analog.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/sound/pci/hda/patch_analog.c
++++ b/sound/pci/hda/patch_analog.c
+@@ -474,6 +474,8 @@ static int ad1983_add_spdif_mux_ctl(stru
+ static int patch_ad1983(struct hda_codec *codec)
+ {
+ struct ad198x_spec *spec;
++ static hda_nid_t conn_0c[] = { 0x08 };
++ static hda_nid_t conn_0d[] = { 0x09 };
+ int err;
+
+ err = alloc_ad_spec(codec);
+@@ -484,6 +486,11 @@ static int patch_ad1983(struct hda_codec
+ spec->gen.mixer_nid = 0x0e;
+ spec->gen.beep_nid = 0x10;
+ set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
++
++ /* limit the loopback routes not to confuse the parser */
++ snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c);
++ snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d);
++
+ err = ad198x_parse_auto_config(codec, false);
+ if (err < 0)
+ goto error;
--- /dev/null
+From d3c56568f43807135f2c2a09582a69f809f0d8b7 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 3 Feb 2014 09:56:13 +0100
+Subject: ALSA: hda/realtek - Avoid invalid COEFs for ALC271X
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit d3c56568f43807135f2c2a09582a69f809f0d8b7 upstream.
+
+We've seen often problems after suspend/resume on Acer Aspire One
+AO725 with ALC271X codec as reported in kernel bugzilla, and it turned
+out that some COEFs doesn't work and triggers the codec communication
+stall.
+
+Since these magic COEF setups are specific to ALC269VB for some PLL
+configurations, the machine works even without these manual
+adjustment. So, let's simply avoid applying them for ALC271X.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=52181
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -4152,6 +4152,9 @@ static void alc269_fill_coef(struct hda_
+
+ if (spec->codec_variant != ALC269_TYPE_ALC269VB)
+ return;
++ /* ALC271X doesn't seem to support these COEFs (bko#52181) */
++ if (!strcmp(codec->chip_name, "ALC271X"))
++ return;
+
+ if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
+ alc_write_coef_idx(codec, 0xf, 0x960b);
--- /dev/null
+From 4fa71c1550a857ff1dbfe9e99acc1f4cfec5f0d0 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 3 Feb 2014 09:37:59 +0100
+Subject: ALSA: usb-audio: Add missing kconfig dependecy
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 4fa71c1550a857ff1dbfe9e99acc1f4cfec5f0d0 upstream.
+
+The commit 44dcbbb1cd61 introduced the usage of bitreverse helpers but
+forgot to add the dependency. This patch adds the selection for
+CONFIG_BITREVERSE.
+
+Fixes: 44dcbbb1cd61 ('ALSA: snd-usb: add support for bit-reversed byte formats')
+Reported-by: Fengguang Wu <fengguang.wu@intel.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/usb/Kconfig
++++ b/sound/usb/Kconfig
+@@ -14,6 +14,7 @@ config SND_USB_AUDIO
+ select SND_HWDEP
+ select SND_RAWMIDI
+ select SND_PCM
++ select BITREVERSE
+ help
+ Say Y here to include support for USB audio and USB MIDI
+ devices.
--- /dev/null
+From 923fa4ea382f592dee2ba3b205befb90cbddf3af Mon Sep 17 00:00:00 2001
+From: Nitin A Kamble <nitin.a.kamble@intel.com>
+Date: Thu, 30 Jan 2014 16:50:10 -0800
+Subject: genirq: Generic irq chip requires IRQ_DOMAIN
+
+From: Nitin A Kamble <nitin.a.kamble@intel.com>
+
+commit 923fa4ea382f592dee2ba3b205befb90cbddf3af upstream.
+
+The generic_chip.c uses interfaces from irq_domain.c which is
+controlled by the IRQ_DOMAIN config option, but there is no Kconfig
+dependency so the build can fail:
+
+linux/kernel/irq/generic-chip.c:400:11: error:
+'irq_domain_xlate_onetwocell' undeclared here (not in a function)
+
+Select IRQ_DOMAIN when GENERIC_IRQ_CHIP is selected.
+
+Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
+Link: http://lkml.kernel.org/r/1391129410-54548-2-git-send-email-nitin.a.kamble@intel.com
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/irq/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/kernel/irq/Kconfig
++++ b/kernel/irq/Kconfig
+@@ -40,6 +40,7 @@ config IRQ_EDGE_EOI_HANDLER
+ # Generic configurable interrupt chip implementation
+ config GENERIC_IRQ_CHIP
+ bool
++ select IRQ_DOMAIN
+
+ # Generic irq_domain hw <--> linux irq number translation
+ config IRQ_DOMAIN
--- /dev/null
+From 227d53b397a32a7614667b3ecaf1d89902fb6c12 Mon Sep 17 00:00:00 2001
+From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Date: Thu, 6 Feb 2014 12:04:28 -0800
+Subject: mm: __set_page_dirty uses spin_lock_irqsave instead of spin_lock_irq
+
+From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+
+commit 227d53b397a32a7614667b3ecaf1d89902fb6c12 upstream.
+
+To use spin_{un}lock_irq is dangerous if caller disabled interrupt.
+During aio buffer migration, we have a possibility to see the following
+call stack.
+
+aio_migratepage [disable interrupt]
+ migrate_page_copy
+ clear_page_dirty_for_io
+ set_page_dirty
+ __set_page_dirty_buffers
+ __set_page_dirty
+ spin_lock_irq
+
+This mean, current aio migration is a deadlockable. spin_lock_irqsave
+is a safer alternative and we should use it.
+
+Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Reported-by: David Rientjes rientjes@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/buffer.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/fs/buffer.c
++++ b/fs/buffer.c
+@@ -654,14 +654,16 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode);
+ static void __set_page_dirty(struct page *page,
+ struct address_space *mapping, int warn)
+ {
+- spin_lock_irq(&mapping->tree_lock);
++ unsigned long flags;
++
++ spin_lock_irqsave(&mapping->tree_lock, flags);
+ if (page->mapping) { /* Race with truncate? */
+ WARN_ON_ONCE(warn && !PageUptodate(page));
+ account_page_dirtied(page, mapping);
+ radix_tree_tag_set(&mapping->page_tree,
+ page_index(page), PAGECACHE_TAG_DIRTY);
+ }
+- spin_unlock_irq(&mapping->tree_lock);
++ spin_unlock_irqrestore(&mapping->tree_lock, flags);
+ __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
+ }
+
--- /dev/null
+From a85d9df1ea1d23682a0ed1e100e6965006595d06 Mon Sep 17 00:00:00 2001
+From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Date: Thu, 6 Feb 2014 12:04:24 -0800
+Subject: mm: __set_page_dirty_nobuffers() uses spin_lock_irqsave() instead of spin_lock_irq()
+
+From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+
+commit a85d9df1ea1d23682a0ed1e100e6965006595d06 upstream.
+
+During aio stress test, we observed the following lockdep warning. This
+mean AIO+numa_balancing is currently deadlockable.
+
+The problem is, aio_migratepage disable interrupt, but
+__set_page_dirty_nobuffers unintentionally enable it again.
+
+Generally, all helper function should use spin_lock_irqsave() instead of
+spin_lock_irq() because they don't know caller at all.
+
+ other info that might help us debug this:
+ Possible unsafe locking scenario:
+
+ CPU0
+ ----
+ lock(&(&ctx->completion_lock)->rlock);
+ <Interrupt>
+ lock(&(&ctx->completion_lock)->rlock);
+
+ *** DEADLOCK ***
+
+ dump_stack+0x19/0x1b
+ print_usage_bug+0x1f7/0x208
+ mark_lock+0x21d/0x2a0
+ mark_held_locks+0xb9/0x140
+ trace_hardirqs_on_caller+0x105/0x1d0
+ trace_hardirqs_on+0xd/0x10
+ _raw_spin_unlock_irq+0x2c/0x50
+ __set_page_dirty_nobuffers+0x8c/0xf0
+ migrate_page_copy+0x434/0x540
+ aio_migratepage+0xb1/0x140
+ move_to_new_page+0x7d/0x230
+ migrate_pages+0x5e5/0x700
+ migrate_misplaced_page+0xbc/0xf0
+ do_numa_page+0x102/0x190
+ handle_pte_fault+0x241/0x970
+ handle_mm_fault+0x265/0x370
+ __do_page_fault+0x172/0x5a0
+ do_page_fault+0x1a/0x70
+ page_fault+0x28/0x30
+
+Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Cc: Larry Woodman <lwoodman@redhat.com>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Johannes Weiner <jweiner@redhat.com>
+Acked-by: David Rientjes <rientjes@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/page-writeback.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/mm/page-writeback.c
++++ b/mm/page-writeback.c
+@@ -2173,11 +2173,12 @@ int __set_page_dirty_nobuffers(struct pa
+ if (!TestSetPageDirty(page)) {
+ struct address_space *mapping = page_mapping(page);
+ struct address_space *mapping2;
++ unsigned long flags;
+
+ if (!mapping)
+ return 1;
+
+- spin_lock_irq(&mapping->tree_lock);
++ spin_lock_irqsave(&mapping->tree_lock, flags);
+ mapping2 = page_mapping(page);
+ if (mapping2) { /* Race with truncate? */
+ BUG_ON(mapping2 != mapping);
+@@ -2186,7 +2187,7 @@ int __set_page_dirty_nobuffers(struct pa
+ radix_tree_tag_set(&mapping->page_tree,
+ page_index(page), PAGECACHE_TAG_DIRTY);
+ }
+- spin_unlock_irq(&mapping->tree_lock);
++ spin_unlock_irqrestore(&mapping->tree_lock, flags);
+ if (mapping->host) {
+ /* !PageAnon && !swapper_space */
+ __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
--- /dev/null
+From f893ab41e4dae2fe8991faf5d86d029068d1ef3a Mon Sep 17 00:00:00 2001
+From: Weijie Yang <weijie.yang@samsung.com>
+Date: Thu, 6 Feb 2014 12:04:23 -0800
+Subject: mm/swap: fix race on swap_info reuse between swapoff and swapon
+
+From: Weijie Yang <weijie.yang@samsung.com>
+
+commit f893ab41e4dae2fe8991faf5d86d029068d1ef3a upstream.
+
+swapoff clear swap_info's SWP_USED flag prematurely and free its
+resources after that. A concurrent swapon will reuse this swap_info
+while its previous resources are not cleared completely.
+
+These late freed resources are:
+ - p->percpu_cluster
+ - swap_cgroup_ctrl[type]
+ - block_device setting
+ - inode->i_flags &= ~S_SWAPFILE
+
+This patch clears the SWP_USED flag after all its resources are freed,
+so that swapon can reuse this swap_info by alloc_swap_info() safely.
+
+[akpm@linux-foundation.org: tidy up code comment]
+Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
+Acked-by: Hugh Dickins <hughd@google.com>
+Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/swapfile.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+--- a/mm/swapfile.c
++++ b/mm/swapfile.c
+@@ -1922,7 +1922,6 @@ SYSCALL_DEFINE1(swapoff, const char __us
+ p->swap_map = NULL;
+ cluster_info = p->cluster_info;
+ p->cluster_info = NULL;
+- p->flags = 0;
+ frontswap_map = frontswap_map_get(p);
+ frontswap_map_set(p, NULL);
+ spin_unlock(&p->lock);
+@@ -1948,6 +1947,16 @@ SYSCALL_DEFINE1(swapoff, const char __us
+ mutex_unlock(&inode->i_mutex);
+ }
+ filp_close(swap_file, NULL);
++
++ /*
++ * Clear the SWP_USED flag after all resources are freed so that swapon
++ * can reuse this swap_info in alloc_swap_info() safely. It is ok to
++ * not hold p->lock after we cleared its SWP_WRITEOK.
++ */
++ spin_lock(&swap_lock);
++ p->flags = 0;
++ spin_unlock(&swap_lock);
++
+ err = 0;
+ atomic_inc(&proc_poll_event);
+ wake_up_interruptible(&proc_poll_wait);
--- /dev/null
+From 13e1b87c986100169b0695aeb26970943665eda9 Mon Sep 17 00:00:00 2001
+From: Dave Jones <davej@fedoraproject.org>
+Date: Thu, 30 Jan 2014 00:17:09 -0300
+Subject: [media] mxl111sf: Fix compile when CONFIG_DVB_USB_MXL111SF is unset
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Dave Jones <davej@fedoraproject.org>
+
+commit 13e1b87c986100169b0695aeb26970943665eda9 upstream.
+
+Fix the following build error:
+
+drivers/media/usb/dvb-usb-v2/
+mxl111sf-tuner.h:72:9: error: expected ‘;’, ‘,’ or ‘)’ before ‘struct’
+ struct mxl111sf_tuner_config *cfg)
+
+Signed-off-by: Dave Jones <davej@fedoraproject.org>
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h
++++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h
+@@ -68,7 +68,7 @@ struct dvb_frontend *mxl111sf_tuner_atta
+ #else
+ static inline
+ struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe,
+- struct mxl111sf_state *mxl_state
++ struct mxl111sf_state *mxl_state,
+ struct mxl111sf_tuner_config *cfg)
+ {
+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
--- /dev/null
+From 866e8d8a9dc1ebb4f9e67197e264ac2df81f7d4b Mon Sep 17 00:00:00 2001
+From: Dave Jones <davej@fedoraproject.org>
+Date: Thu, 30 Jan 2014 00:11:33 -0300
+Subject: [media] mxl111sf: Fix unintentional garbage stack read
+
+From: Dave Jones <davej@fedoraproject.org>
+
+commit 866e8d8a9dc1ebb4f9e67197e264ac2df81f7d4b upstream.
+
+mxl111sf_read_reg takes an address of a variable to write to as an argument.
+drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.c:mxl111sf_config_pin_mux_modes
+passes several uninitialized stack variables to this routine, expecting
+them to be filled in. In the event that something unexpected happens when
+reading from the chip, we end up doing a pr_debug of the value passed in,
+revealing whatever garbage happened to be on the stack.
+
+Change the pr_debug to match what happens in the 'success' case, where we
+assign buf[1] to *data.
+
+Spotted with Coverity (Bugs 731910 through 731917)
+
+Signed-off-by: Dave Jones <davej@fedoraproject.org>
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/dvb-usb-v2/mxl111sf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c
++++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
+@@ -105,7 +105,7 @@ int mxl111sf_read_reg(struct mxl111sf_st
+ ret = -EINVAL;
+ }
+
+- pr_debug("R: (0x%02x, 0x%02x)\n", addr, *data);
++ pr_debug("R: (0x%02x, 0x%02x)\n", addr, buf[1]);
+ fail:
+ return ret;
+ }
--- /dev/null
+From b0dcfd87323ea86501e93d0fa2a98d2fd3579bcf Mon Sep 17 00:00:00 2001
+From: Nicolas Ferre <nicolas.ferre@atmel.com>
+Date: Tue, 21 Jan 2014 16:55:18 +0100
+Subject: pinctrl: at91: use locked variant of irq_set_handler
+
+From: Nicolas Ferre <nicolas.ferre@atmel.com>
+
+commit b0dcfd87323ea86501e93d0fa2a98d2fd3579bcf upstream.
+
+When setting the gpio irq type, use the __irq_set_handler_locked()
+variant instead of the irq_set_handler() to prevent false
+spinlock recursion warning.
+
+Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pinctrl/pinctrl-at91.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/pinctrl/pinctrl-at91.c
++++ b/drivers/pinctrl/pinctrl-at91.c
+@@ -1251,22 +1251,22 @@ static int alt_gpio_irq_type(struct irq_
+
+ switch (type) {
+ case IRQ_TYPE_EDGE_RISING:
+- irq_set_handler(d->irq, handle_simple_irq);
++ __irq_set_handler_locked(d->irq, handle_simple_irq);
+ writel_relaxed(mask, pio + PIO_ESR);
+ writel_relaxed(mask, pio + PIO_REHLSR);
+ break;
+ case IRQ_TYPE_EDGE_FALLING:
+- irq_set_handler(d->irq, handle_simple_irq);
++ __irq_set_handler_locked(d->irq, handle_simple_irq);
+ writel_relaxed(mask, pio + PIO_ESR);
+ writel_relaxed(mask, pio + PIO_FELLSR);
+ break;
+ case IRQ_TYPE_LEVEL_LOW:
+- irq_set_handler(d->irq, handle_level_irq);
++ __irq_set_handler_locked(d->irq, handle_level_irq);
+ writel_relaxed(mask, pio + PIO_LSR);
+ writel_relaxed(mask, pio + PIO_FELLSR);
+ break;
+ case IRQ_TYPE_LEVEL_HIGH:
+- irq_set_handler(d->irq, handle_level_irq);
++ __irq_set_handler_locked(d->irq, handle_level_irq);
+ writel_relaxed(mask, pio + PIO_LSR);
+ writel_relaxed(mask, pio + PIO_REHLSR);
+ break;
+@@ -1275,7 +1275,7 @@ static int alt_gpio_irq_type(struct irq_
+ * disable additional interrupt modes:
+ * fall back to default behavior
+ */
+- irq_set_handler(d->irq, handle_simple_irq);
++ __irq_set_handler_locked(d->irq, handle_simple_irq);
+ writel_relaxed(mask, pio + PIO_AIMDR);
+ return 0;
+ case IRQ_TYPE_NONE:
--- /dev/null
+From 7b320cb1ed2dbd2c5f2a778197baf76fd6bf545a Mon Sep 17 00:00:00 2001
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+Date: Tue, 4 Feb 2014 09:07:09 +0100
+Subject: pinctrl: protect pinctrl_list add
+
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+
+commit 7b320cb1ed2dbd2c5f2a778197baf76fd6bf545a upstream.
+
+We have few fedora bug reports about list corruption on pinctrl,
+for example:
+https://bugzilla.redhat.com/show_bug.cgi?id=1051918
+
+Most likely corruption happen due lack of protection of pinctrl_list
+when adding new nodes to it. Patch corrects that.
+
+Fixes: 42fed7ba44e ("pinctrl: move subsystem mutex to pinctrl_dev struct")
+Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
+Acked-by: Stephen Warren <swarren@nvidia.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pinctrl/core.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/pinctrl/core.c
++++ b/drivers/pinctrl/core.c
+@@ -837,7 +837,9 @@ static struct pinctrl *create_pinctrl(st
+ kref_init(&p->users);
+
+ /* Add the pinctrl handle to the global list */
++ mutex_lock(&pinctrl_list_mutex);
+ list_add_tail(&p->node, &pinctrl_list);
++ mutex_unlock(&pinctrl_list_mutex);
+
+ return p;
+ }
--- /dev/null
+From f17248ed868767567298e1cdf06faf8159a81f7c Mon Sep 17 00:00:00 2001
+From: Tony Prisk <linux@prisktech.co.nz>
+Date: Thu, 23 Jan 2014 21:57:33 +1300
+Subject: pinctrl: vt8500: Change devicetree data parsing
+
+From: Tony Prisk <linux@prisktech.co.nz>
+
+commit f17248ed868767567298e1cdf06faf8159a81f7c upstream.
+
+Due to an assumption in the VT8500 pinctrl driver, the value passed
+from devicetree for 'wm,pull' was not explicitly translated before
+being passed to pinconf.
+
+Since v3.10, changes to 'enum pin_config_param', PIN_CONFIG_BIAS_PULL_(UP/DOWN)
+no longer map 1-to-1 with the expected values in devicetree.
+
+This patch adds a small translation between the devicetree values (0..2)
+and the enum pin_config_param equivalent values.
+
+Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pinctrl/vt8500/pinctrl-wmt.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
++++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
+@@ -276,7 +276,20 @@ static int wmt_pctl_dt_node_to_map_pull(
+ if (!configs)
+ return -ENOMEM;
+
+- configs[0] = pull;
++ switch (pull) {
++ case 0:
++ configs[0] = PIN_CONFIG_BIAS_DISABLE;
++ break;
++ case 1:
++ configs[0] = PIN_CONFIG_BIAS_PULL_DOWN;
++ break;
++ case 2:
++ configs[0] = PIN_CONFIG_BIAS_PULL_UP;
++ break;
++ default:
++ configs[0] = PIN_CONFIG_BIAS_DISABLE;
++ dev_err(data->dev, "invalid pull state %d - disabling\n", pull);
++ }
+
+ map->type = PIN_MAP_TYPE_CONFIGS_PIN;
+ map->data.configs.group_or_pin = data->groups[group];
--- /dev/null
+From cca36e2eecec2b8fc869a50ffd3bd0adeed92b8b Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hverkuil@xs4all.nl>
+Date: Fri, 3 Jan 2014 08:10:49 -0300
+Subject: [media] Revert "[media] videobuf_vm_{open,close} race fixes"
+
+From: Hans Verkuil <hverkuil@xs4all.nl>
+
+commit cca36e2eecec2b8fc869a50ffd3bd0adeed92b8b upstream.
+
+This reverts commit a242f426108c284049a69710f871cc9f11b13e61.
+
+That commit actually caused deadlocks, rather then fixing them.
+
+If ext_lock is set to NULL (otherwise videobuf_queue_lock doesn't do
+anything), then you get this deadlock:
+
+The driver's mmap function calls videobuf_mmap_mapper which calls
+videobuf_queue_lock on q. videobuf_mmap_mapper calls __videobuf_mmap_mapper,
+__videobuf_mmap_mapper calls videobuf_vm_open and videobuf_vm_open
+calls videobuf_queue_lock on q (introduced by above patch): deadlocked.
+
+This affects drivers using dma-contig and dma-vmalloc. Only dma-sg is
+not affected since it doesn't call videobuf_vm_open from __videobuf_mmap_mapper.
+
+Most drivers these days have a non-NULL ext_lock. Those that still use
+NULL there are all fairly obscure drivers, which is why this hasn't been
+seen earlier.
+
+Since everything worked perfectly fine for many years I prefer to just
+revert this patch rather than trying to fix it. videobuf is quite fragile
+and I rather not touch it too much. Work is (slowly) progressing to move
+everything over to vb2 or at the very least use non-NULL ext_lock in
+videobuf.
+
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Cc: Al Viro <viro@ZenIV.linux.org.uk>
+Reported-by: Pete Eberlein <pete@sensoray.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/v4l2-core/videobuf-dma-contig.c | 12 +++++-------
+ drivers/media/v4l2-core/videobuf-dma-sg.c | 10 ++++------
+ drivers/media/v4l2-core/videobuf-vmalloc.c | 10 ++++------
+ 3 files changed, 13 insertions(+), 19 deletions(-)
+
+--- a/drivers/media/v4l2-core/videobuf-dma-contig.c
++++ b/drivers/media/v4l2-core/videobuf-dma-contig.c
+@@ -66,14 +66,11 @@ static void __videobuf_dc_free(struct de
+ static void videobuf_vm_open(struct vm_area_struct *vma)
+ {
+ struct videobuf_mapping *map = vma->vm_private_data;
+- struct videobuf_queue *q = map->q;
+
+- dev_dbg(q->dev, "vm_open %p [count=%u,vma=%08lx-%08lx]\n",
++ dev_dbg(map->q->dev, "vm_open %p [count=%u,vma=%08lx-%08lx]\n",
+ map, map->count, vma->vm_start, vma->vm_end);
+
+- videobuf_queue_lock(q);
+ map->count++;
+- videobuf_queue_unlock(q);
+ }
+
+ static void videobuf_vm_close(struct vm_area_struct *vma)
+@@ -85,11 +82,12 @@ static void videobuf_vm_close(struct vm_
+ dev_dbg(q->dev, "vm_close %p [count=%u,vma=%08lx-%08lx]\n",
+ map, map->count, vma->vm_start, vma->vm_end);
+
+- videobuf_queue_lock(q);
+- if (!--map->count) {
++ map->count--;
++ if (0 == map->count) {
+ struct videobuf_dma_contig_memory *mem;
+
+ dev_dbg(q->dev, "munmap %p q=%p\n", map, q);
++ videobuf_queue_lock(q);
+
+ /* We need first to cancel streams, before unmapping */
+ if (q->streaming)
+@@ -128,8 +126,8 @@ static void videobuf_vm_close(struct vm_
+
+ kfree(map);
+
++ videobuf_queue_unlock(q);
+ }
+- videobuf_queue_unlock(q);
+ }
+
+ static const struct vm_operations_struct videobuf_vm_ops = {
+--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
++++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
+@@ -338,14 +338,11 @@ EXPORT_SYMBOL_GPL(videobuf_dma_free);
+ static void videobuf_vm_open(struct vm_area_struct *vma)
+ {
+ struct videobuf_mapping *map = vma->vm_private_data;
+- struct videobuf_queue *q = map->q;
+
+ dprintk(2, "vm_open %p [count=%d,vma=%08lx-%08lx]\n", map,
+ map->count, vma->vm_start, vma->vm_end);
+
+- videobuf_queue_lock(q);
+ map->count++;
+- videobuf_queue_unlock(q);
+ }
+
+ static void videobuf_vm_close(struct vm_area_struct *vma)
+@@ -358,9 +355,10 @@ static void videobuf_vm_close(struct vm_
+ dprintk(2, "vm_close %p [count=%d,vma=%08lx-%08lx]\n", map,
+ map->count, vma->vm_start, vma->vm_end);
+
+- videobuf_queue_lock(q);
+- if (!--map->count) {
++ map->count--;
++ if (0 == map->count) {
+ dprintk(1, "munmap %p q=%p\n", map, q);
++ videobuf_queue_lock(q);
+ for (i = 0; i < VIDEO_MAX_FRAME; i++) {
+ if (NULL == q->bufs[i])
+ continue;
+@@ -376,9 +374,9 @@ static void videobuf_vm_close(struct vm_
+ q->bufs[i]->baddr = 0;
+ q->ops->buf_release(q, q->bufs[i]);
+ }
++ videobuf_queue_unlock(q);
+ kfree(map);
+ }
+- videobuf_queue_unlock(q);
+ return;
+ }
+
+--- a/drivers/media/v4l2-core/videobuf-vmalloc.c
++++ b/drivers/media/v4l2-core/videobuf-vmalloc.c
+@@ -54,14 +54,11 @@ MODULE_LICENSE("GPL");
+ static void videobuf_vm_open(struct vm_area_struct *vma)
+ {
+ struct videobuf_mapping *map = vma->vm_private_data;
+- struct videobuf_queue *q = map->q;
+
+ dprintk(2, "vm_open %p [count=%u,vma=%08lx-%08lx]\n", map,
+ map->count, vma->vm_start, vma->vm_end);
+
+- videobuf_queue_lock(q);
+ map->count++;
+- videobuf_queue_unlock(q);
+ }
+
+ static void videobuf_vm_close(struct vm_area_struct *vma)
+@@ -73,11 +70,12 @@ static void videobuf_vm_close(struct vm_
+ dprintk(2, "vm_close %p [count=%u,vma=%08lx-%08lx]\n", map,
+ map->count, vma->vm_start, vma->vm_end);
+
+- videobuf_queue_lock(q);
+- if (!--map->count) {
++ map->count--;
++ if (0 == map->count) {
+ struct videobuf_vmalloc_memory *mem;
+
+ dprintk(1, "munmap %p q=%p\n", map, q);
++ videobuf_queue_lock(q);
+
+ /* We need first to cancel streams, before unmapping */
+ if (q->streaming)
+@@ -116,8 +114,8 @@ static void videobuf_vm_close(struct vm_
+
+ kfree(map);
+
++ videobuf_queue_unlock(q);
+ }
+- videobuf_queue_unlock(q);
+
+ return;
+ }
arm64-invalidate-the-tlb-when-replacing-pmd-entries-during-boot.patch
arm64-vdso-fix-coarse-clock-handling.patch
arm64-add-dsb-after-icache-flush-in-__flush_icache_all.patch
+alsa-usb-audio-add-missing-kconfig-dependecy.patch
+alsa-hda-realtek-avoid-invalid-coefs-for-alc271x.patch
+alsa-hda-fix-missing-vref-setup-for-mac-pro-1-1.patch
+alsa-hda-fix-silent-output-on-toshiba-satellite-l40.patch
+alsa-hda-add-missing-mixer-widget-for-ad1983.patch
+alsa-hda-improve-loopback-path-lookups-for-ad1983.patch
+mm-swap-fix-race-on-swap_info-reuse-between-swapoff-and-swapon.patch
+mm-__set_page_dirty_nobuffers-uses-spin_lock_irqsave-instead-of-spin_lock_irq.patch
+mm-__set_page_dirty-uses-spin_lock_irqsave-instead-of-spin_lock_irq.patch
+x86-mm-change-tlb_flushall_shift-for-ivybridge.patch
+af9035-add-id-hauppauge-wintv-ministick-2.patch
+mxl111sf-fix-unintentional-garbage-stack-read.patch
+mxl111sf-fix-compile-when-config_dvb_usb_mxl111sf-is-unset.patch
+revert-videobuf_vm_-open-close-race-fixes.patch
+x86-hweight-fix-bug-when-booting-with-config_gcov_profile_all-y.patch
+genirq-generic-irq-chip-requires-irq_domain.patch
+pinctrl-at91-use-locked-variant-of-irq_set_handler.patch
+pinctrl-vt8500-change-devicetree-data-parsing.patch
+pinctrl-protect-pinctrl_list-add.patch
--- /dev/null
+From 6583327c4dd55acbbf2a6f25e775b28b3abf9a42 Mon Sep 17 00:00:00 2001
+From: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
+Date: Thu, 6 Feb 2014 15:58:20 +0100
+Subject: x86, hweight: Fix BUG when booting with CONFIG_GCOV_PROFILE_ALL=y
+
+From: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
+
+commit 6583327c4dd55acbbf2a6f25e775b28b3abf9a42 upstream.
+
+Commit d61931d89b, "x86: Add optimized popcnt variants" introduced
+compile flag -fcall-saved-rdi for lib/hweight.c. When combined with
+options -fprofile-arcs and -O2, this flag causes gcc to generate
+broken constructor code. As a result, a 64 bit x86 kernel compiled
+with CONFIG_GCOV_PROFILE_ALL=y prints message "gcov: could not create
+file" and runs into sproadic BUGs during boot.
+
+The gcc people indicate that these kinds of problems are endemic when
+using ad hoc calling conventions. It is therefore best to treat any
+file compiled with ad hoc calling conventions as an isolated
+environment and avoid things like profiling or coverage analysis,
+since those subsystems assume a "normal" calling conventions.
+
+This patch avoids the bug by excluding lib/hweight.o from coverage
+profiling.
+
+Reported-by: Meelis Roos <mroos@linux.ee>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
+Link: http://lkml.kernel.org/r/52F3A30C.7050205@linux.vnet.ibm.com
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ lib/Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -47,6 +47,7 @@ lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) +=
+ lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
+ lib-$(CONFIG_PERCPU_RWSEM) += percpu-rwsem.o
+
++GCOV_PROFILE_hweight.o := n
+ CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
+ obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
+
--- /dev/null
+From f98b7a772ab51b52ca4d2a14362fc0e0c8a2e0f3 Mon Sep 17 00:00:00 2001
+From: Mel Gorman <mgorman@suse.de>
+Date: Tue, 21 Jan 2014 14:33:21 -0800
+Subject: x86: mm: change tlb_flushall_shift for IvyBridge
+
+From: Mel Gorman <mgorman@suse.de>
+
+commit f98b7a772ab51b52ca4d2a14362fc0e0c8a2e0f3 upstream.
+
+There was a large performance regression that was bisected to
+commit 611ae8e3 ("x86/tlb: enable tlb flush range support for
+x86"). This patch simply changes the default balance point
+between a local and global flush for IvyBridge.
+
+In the interest of allowing the tests to be reproduced, this
+patch was tested using mmtests 0.15 with the following
+configurations
+
+ configs/config-global-dhp__tlbflush-performance
+ configs/config-global-dhp__scheduler-performance
+ configs/config-global-dhp__network-performance
+
+Results are from two machines
+
+Ivybridge 4 threads: Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz
+Ivybridge 8 threads: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
+
+Page fault microbenchmark showed nothing interesting.
+
+Ebizzy was configured to run multiple iterations and threads.
+Thread counts ranged from 1 to NR_CPUS*2. For each thread count,
+it ran 100 iterations and each iteration lasted 10 seconds.
+
+Ivybridge 4 threads
+ 3.13.0-rc7 3.13.0-rc7
+ vanilla altshift-v3
+Mean 1 6395.44 ( 0.00%) 6789.09 ( 6.16%)
+Mean 2 7012.85 ( 0.00%) 8052.16 ( 14.82%)
+Mean 3 6403.04 ( 0.00%) 6973.74 ( 8.91%)
+Mean 4 6135.32 ( 0.00%) 6582.33 ( 7.29%)
+Mean 5 6095.69 ( 0.00%) 6526.68 ( 7.07%)
+Mean 6 6114.33 ( 0.00%) 6416.64 ( 4.94%)
+Mean 7 6085.10 ( 0.00%) 6448.51 ( 5.97%)
+Mean 8 6120.62 ( 0.00%) 6462.97 ( 5.59%)
+
+Ivybridge 8 threads
+ 3.13.0-rc7 3.13.0-rc7
+ vanilla altshift-v3
+Mean 1 7336.65 ( 0.00%) 7787.02 ( 6.14%)
+Mean 2 8218.41 ( 0.00%) 9484.13 ( 15.40%)
+Mean 3 7973.62 ( 0.00%) 8922.01 ( 11.89%)
+Mean 4 7798.33 ( 0.00%) 8567.03 ( 9.86%)
+Mean 5 7158.72 ( 0.00%) 8214.23 ( 14.74%)
+Mean 6 6852.27 ( 0.00%) 7952.45 ( 16.06%)
+Mean 7 6774.65 ( 0.00%) 7536.35 ( 11.24%)
+Mean 8 6510.50 ( 0.00%) 6894.05 ( 5.89%)
+Mean 12 6182.90 ( 0.00%) 6661.29 ( 7.74%)
+Mean 16 6100.09 ( 0.00%) 6608.69 ( 8.34%)
+
+Ebizzy hits the worst case scenario for TLB range flushing every
+time and it shows for these Ivybridge CPUs at least that the
+default choice is a poor on. The patch addresses the problem.
+
+Next was a tlbflush microbenchmark written by Alex Shi at
+http://marc.info/?l=linux-kernel&m=133727348217113 . It
+measures access costs while the TLB is being flushed. The
+expectation is that if there are always full TLB flushes that
+the benchmark would suffer and it benefits from range flushing
+
+There are 320 iterations of the test per thread count. The
+number of entries is randomly selected with a min of 1 and max
+of 512. To ensure a reasonably even spread of entries, the full
+range is broken up into 8 sections and a random number selected
+within that section.
+
+iteration 1, random number between 0-64
+iteration 2, random number between 64-128 etc
+
+This is still a very weak methodology. When you do not know
+what are typical ranges, random is a reasonable choice but it
+can be easily argued that the opimisation was for smaller ranges
+and an even spread is not representative of any workload that
+matters. To improve this, we'd need to know the probability
+distribution of TLB flush range sizes for a set of workloads
+that are considered "common", build a synthetic trace and feed
+that into this benchmark. Even that is not perfect because it
+would not account for the time between flushes but there are
+limits of what can be reasonably done and still be doing
+something useful. If a representative synthetic trace is
+provided then this benchmark could be revisited and the shift values retuned.
+
+Ivybridge 4 threads
+ 3.13.0-rc7 3.13.0-rc7
+ vanilla altshift-v3
+Mean 1 10.50 ( 0.00%) 10.50 ( 0.03%)
+Mean 2 17.59 ( 0.00%) 17.18 ( 2.34%)
+Mean 3 22.98 ( 0.00%) 21.74 ( 5.41%)
+Mean 5 47.13 ( 0.00%) 46.23 ( 1.92%)
+Mean 8 43.30 ( 0.00%) 42.56 ( 1.72%)
+
+Ivybridge 8 threads
+ 3.13.0-rc7 3.13.0-rc7
+ vanilla altshift-v3
+Mean 1 9.45 ( 0.00%) 9.36 ( 0.93%)
+Mean 2 9.37 ( 0.00%) 9.70 ( -3.54%)
+Mean 3 9.36 ( 0.00%) 9.29 ( 0.70%)
+Mean 5 14.49 ( 0.00%) 15.04 ( -3.75%)
+Mean 8 41.08 ( 0.00%) 38.73 ( 5.71%)
+Mean 13 32.04 ( 0.00%) 31.24 ( 2.49%)
+Mean 16 40.05 ( 0.00%) 39.04 ( 2.51%)
+
+For both CPUs, average access time is reduced which is good as
+this is the benchmark that was used to tune the shift values in
+the first place albeit it is now known *how* the benchmark was
+used.
+
+The scheduler benchmarks were somewhat inconclusive. They
+showed gains and losses and makes me reconsider how stable those
+benchmarks really are or if something else might be interfering
+with the test results recently.
+
+Network benchmarks were inconclusive. Almost all results were
+flat except for netperf-udp tests on the 4 thread machine.
+These results were unstable and showed large variations between
+reboots. It is unknown if this is a recent problems but I've
+noticed before that netperf-udp results tend to vary.
+
+Based on these results, changing the default for Ivybridge seems
+like a logical choice.
+
+Signed-off-by: Mel Gorman <mgorman@suse.de>
+Tested-by: Davidlohr Bueso <davidlohr@hp.com>
+Reviewed-by: Alex Shi <alex.shi@linaro.org>
+Reviewed-by: Rik van Riel <riel@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/n/tip-cqnadffh1tiqrshthRj3Esge@git.kernel.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/cpu/intel.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/intel.c
++++ b/arch/x86/kernel/cpu/intel.c
+@@ -628,7 +628,7 @@ static void intel_tlb_flushall_shift_set
+ tlb_flushall_shift = 5;
+ break;
+ case 0x63a: /* Ivybridge */
+- tlb_flushall_shift = 1;
++ tlb_flushall_shift = 2;
+ break;
+ default:
+ tlb_flushall_shift = 6;