From 6021be2ff19b9ead906f0a24b2f432189be3f595 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 18 Jan 2013 14:01:25 -0800 Subject: [PATCH] 3.4-stable patches added patches: alsa-usb-fix-race-in-creation-of-m-audio-fast-track-pro-driver.patch drbd-add-missing-part_round_stats-to-_drbd_start_io_acct.patch ext4-init-pagevec-in-ext4_da_block_invalidatepages.patch igb-release-already-assigned-msi-x-interrupts-if-setup-fails.patch intel-iommu-prevent-devices-with-rmrrs-from-being-placed.patch r8169-avoid-napi-scheduling-delay.patch s390-time-fix-sched_clock-overflow.patch target-add-link_magic-for-fabric-allow_link-destination.patch x86-sandy-bridge-reserve-pages-when-integrated-graphics-is-present.patch --- ...ion-of-m-audio-fast-track-pro-driver.patch | 51 +++++++ ...t_round_stats-to-_drbd_start_io_acct.patch | 30 ++++ ...vec-in-ext4_da_block_invalidatepages.patch | 38 +++++ ...gned-msi-x-interrupts-if-setup-fails.patch | 95 +++++++++++++ ...devices-with-rmrrs-from-being-placed.patch | 68 +++++++++ .../r8169-avoid-napi-scheduling-delay.patch | 52 +++++++ .../s390-time-fix-sched_clock-overflow.patch | 89 ++++++++++++ queue-3.4/series | 9 ++ ...ic-for-fabric-allow_link-destination.patch | 108 ++++++++++++++ ...-when-integrated-graphics-is-present.patch | 132 ++++++++++++++++++ 10 files changed, 672 insertions(+) create mode 100644 queue-3.4/alsa-usb-fix-race-in-creation-of-m-audio-fast-track-pro-driver.patch create mode 100644 queue-3.4/drbd-add-missing-part_round_stats-to-_drbd_start_io_acct.patch create mode 100644 queue-3.4/ext4-init-pagevec-in-ext4_da_block_invalidatepages.patch create mode 100644 queue-3.4/igb-release-already-assigned-msi-x-interrupts-if-setup-fails.patch create mode 100644 queue-3.4/intel-iommu-prevent-devices-with-rmrrs-from-being-placed.patch create mode 100644 queue-3.4/r8169-avoid-napi-scheduling-delay.patch create mode 100644 queue-3.4/s390-time-fix-sched_clock-overflow.patch create mode 100644 queue-3.4/target-add-link_magic-for-fabric-allow_link-destination.patch create mode 100644 queue-3.4/x86-sandy-bridge-reserve-pages-when-integrated-graphics-is-present.patch diff --git a/queue-3.4/alsa-usb-fix-race-in-creation-of-m-audio-fast-track-pro-driver.patch b/queue-3.4/alsa-usb-fix-race-in-creation-of-m-audio-fast-track-pro-driver.patch new file mode 100644 index 00000000000..a50e99e670b --- /dev/null +++ b/queue-3.4/alsa-usb-fix-race-in-creation-of-m-audio-fast-track-pro-driver.patch @@ -0,0 +1,51 @@ +From b98ae2729dea161edc96c9d177459b6c28bcbba5 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Fri, 4 Jan 2013 17:02:18 +0100 +Subject: ALSA: usb - fix race in creation of M-Audio Fast track pro driver + +From: David Henningsson + +commit b98ae2729dea161edc96c9d177459b6c28bcbba5 upstream. + +A patch in the 3.2 kernel caused regression with hotplugging the +M-Audio Fast track pro, or sound after suspend. I don't have the +device so I haven't done a full analysis, but it seems userspace +(both udev and pulseaudio) got confused when a card was created, +immediately destroyed, and then created again. + +However, at least one person in the bug report (martin djfun) +reports that this patch resolves the issue for him. It also leaves +a message in the log: +"snd-usb-audio: probe of 1-1.1:1.1 failed with error -5" which is +a bit misleading. It is better than non-working audio, but maybe +there's a more elegant solution? + +BugLink: https://bugs.launchpad.net/bugs/1095315 +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +Cc: CAI Qian +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/quirks.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_qui + * rules + */ + err = usb_driver_set_configuration(dev, 2); +- if (err < 0) { ++ if (err < 0) + snd_printdd("error usb_driver_set_configuration: %d\n", + err); +- return -ENODEV; +- } ++ /* Always return an error, so that we stop creating a device ++ that will just be destroyed and recreated with a new ++ configuration */ ++ return -ENODEV; + } else + snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); + diff --git a/queue-3.4/drbd-add-missing-part_round_stats-to-_drbd_start_io_acct.patch b/queue-3.4/drbd-add-missing-part_round_stats-to-_drbd_start_io_acct.patch new file mode 100644 index 00000000000..dce9bd68a86 --- /dev/null +++ b/queue-3.4/drbd-add-missing-part_round_stats-to-_drbd_start_io_acct.patch @@ -0,0 +1,30 @@ +From 72585d2428fa3a0daab02ebad1f41e5ef517dbaa Mon Sep 17 00:00:00 2001 +From: Philipp Reisner +Date: Thu, 23 Feb 2012 12:56:26 +0100 +Subject: drbd: add missing part_round_stats to _drbd_start_io_acct + +From: Philipp Reisner + +commit 72585d2428fa3a0daab02ebad1f41e5ef517dbaa upstream. + +Without this, iostat frequently sees bogus svctime and >= 100% "utilization". + +Signed-off-by: Philipp Reisner +Signed-off-by: Lars Ellenberg +Cc: Raoul Bhatia +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/block/drbd/drbd_req.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/block/drbd/drbd_req.c ++++ b/drivers/block/drbd/drbd_req.c +@@ -37,6 +37,7 @@ static void _drbd_start_io_acct(struct d + const int rw = bio_data_dir(bio); + int cpu; + cpu = part_stat_lock(); ++ part_round_stats(cpu, &mdev->vdisk->part0); + part_stat_inc(cpu, &mdev->vdisk->part0, ios[rw]); + part_stat_add(cpu, &mdev->vdisk->part0, sectors[rw], bio_sectors(bio)); + part_inc_in_flight(&mdev->vdisk->part0, rw); diff --git a/queue-3.4/ext4-init-pagevec-in-ext4_da_block_invalidatepages.patch b/queue-3.4/ext4-init-pagevec-in-ext4_da_block_invalidatepages.patch new file mode 100644 index 00000000000..9ba4e7ffa5a --- /dev/null +++ b/queue-3.4/ext4-init-pagevec-in-ext4_da_block_invalidatepages.patch @@ -0,0 +1,38 @@ +From 66bea92c69477a75a5d37b9bfed5773c92a3c4b4 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Wed, 14 Nov 2012 22:22:05 -0500 +Subject: ext4: init pagevec in ext4_da_block_invalidatepages + +From: Eric Sandeen + +commit 66bea92c69477a75a5d37b9bfed5773c92a3c4b4 upstream. + +ext4_da_block_invalidatepages is missing a pagevec_init(), +which means that pvec->cold contains random garbage. + +This affects whether the page goes to the front or +back of the LRU when ->cold makes it to +free_hot_cold_page() + +Reviewed-by: Lukas Czerner +Reviewed-by: Carlos Maiolino +Signed-off-by: Eric Sandeen +Signed-off-by: "Theodore Ts'o" +Signed-off-by: CAI Qian +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/inode.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -1424,6 +1424,8 @@ static void ext4_da_block_invalidatepage + + index = mpd->first_page; + end = mpd->next_page - 1; ++ ++ pagevec_init(&pvec, 0); + while (index <= end) { + nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE); + if (nr_pages == 0) diff --git a/queue-3.4/igb-release-already-assigned-msi-x-interrupts-if-setup-fails.patch b/queue-3.4/igb-release-already-assigned-msi-x-interrupts-if-setup-fails.patch new file mode 100644 index 00000000000..d3ef00c9db6 --- /dev/null +++ b/queue-3.4/igb-release-already-assigned-msi-x-interrupts-if-setup-fails.patch @@ -0,0 +1,95 @@ +From 52285b762b3681669215bf1d17ca6143448ab7d3 Mon Sep 17 00:00:00 2001 +From: Stefan Assmann +Date: Tue, 4 Dec 2012 06:00:17 +0000 +Subject: igb: release already assigned MSI-X interrupts if setup fails + +From: Stefan Assmann + +commit 52285b762b3681669215bf1d17ca6143448ab7d3 upstream. + +During MSI-X setup the system might run out of vectors. If this happens the +already assigned vectors for this NIC should be freed before trying the +disable MSI-X. Failing to do so results in the following oops. + +kernel BUG at drivers/pci/msi.c:341! +[...] +Call Trace: + [] pci_disable_msix+0x3d/0x60 + [] igb_reset_interrupt_capability+0x27/0x5c [igb] + [] igb_clear_interrupt_scheme+0x26/0x2d [igb] + [] igb_request_irq+0x73/0x297 [igb] + [] __igb_open+0xc8/0x223 [igb] + [] igb_open+0x13/0x15 [igb] + [] __dev_open+0xbf/0x120 + [] __dev_change_flags+0xa1/0x180 + [] dev_change_flags+0x28/0x70 + [] devinet_ioctl+0x5b7/0x620 + [] inet_ioctl+0x88/0xa0 + [] sock_do_ioctl+0x30/0x70 + [] sock_ioctl+0x72/0x270 + [] do_vfs_ioctl+0x8c/0x340 + [] sys_ioctl+0xa1/0xb0 + [] system_call_fastpath+0x16/0x1b +Code: 48 89 df e8 1f 40 ed ff 4d 39 e6 49 8b 45 10 75 b6 48 83 c4 18 5b 41 5c 41 5d 41 5e 41 5f c9 c3 48 8b 7b 20 e8 3e 91 db ff eb ae <0f> 0b eb fe 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00 +RIP [] free_msi_irqs+0x124/0x130 + RSP + +Signed-off-by: Stefan Assmann +Tested-by: Aaron Brown +Signed-off-by: Jeff Kirsher +Signed-off-by: Abdallah Chatila + +--- + drivers/net/ethernet/intel/igb/igb_main.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/intel/igb/igb_main.c ++++ b/drivers/net/ethernet/intel/igb/igb_main.c +@@ -951,17 +951,18 @@ static int igb_request_msix(struct igb_a + { + struct net_device *netdev = adapter->netdev; + struct e1000_hw *hw = &adapter->hw; +- int i, err = 0, vector = 0; ++ int i, err = 0, vector = 0, free_vector = 0; + + err = request_irq(adapter->msix_entries[vector].vector, + igb_msix_other, 0, netdev->name, adapter); + if (err) +- goto out; +- vector++; ++ goto err_out; + + for (i = 0; i < adapter->num_q_vectors; i++) { + struct igb_q_vector *q_vector = adapter->q_vector[i]; + ++ vector++; ++ + q_vector->itr_register = hw->hw_addr + E1000_EITR(vector); + + if (q_vector->rx.ring && q_vector->tx.ring) +@@ -980,13 +981,22 @@ static int igb_request_msix(struct igb_a + igb_msix_ring, 0, q_vector->name, + q_vector); + if (err) +- goto out; +- vector++; ++ goto err_free; + } + + igb_configure_msix(adapter); + return 0; +-out: ++ ++err_free: ++ /* free already assigned IRQs */ ++ free_irq(adapter->msix_entries[free_vector++].vector, adapter); ++ ++ vector--; ++ for (i = 0; i < vector; i++) { ++ free_irq(adapter->msix_entries[free_vector++].vector, ++ adapter->q_vector[i]); ++ } ++err_out: + return err; + } + diff --git a/queue-3.4/intel-iommu-prevent-devices-with-rmrrs-from-being-placed.patch b/queue-3.4/intel-iommu-prevent-devices-with-rmrrs-from-being-placed.patch new file mode 100644 index 00000000000..6bb2f9a2932 --- /dev/null +++ b/queue-3.4/intel-iommu-prevent-devices-with-rmrrs-from-being-placed.patch @@ -0,0 +1,68 @@ +From ea2447f700cab264019b52e2b417d689e052dcfd Mon Sep 17 00:00:00 2001 +From: Tom Mingarelli +Date: Tue, 20 Nov 2012 19:43:17 +0000 +Subject: intel-iommu: Prevent devices with RMRRs from being placed + into SI Domain + +From: Tom Mingarelli + +commit ea2447f700cab264019b52e2b417d689e052dcfd upstream. + +This patch is to prevent non-USB devices that have RMRRs associated with them from +being placed into the SI Domain during init. This fixes the issue where the RMRR info +for devices being placed in and out of the SI Domain gets lost. + +Signed-off-by: Thomas Mingarelli +Tested-by: Shuah Khan +Reviewed-by: Donald Dutile +Reviewed-by: Alex Williamson +Signed-off-by: Joerg Roedel +Cc: CAI Qian +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iommu/intel-iommu.c | 31 +++++++++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -2321,8 +2321,39 @@ static int domain_add_dev_info(struct dm + return 0; + } + ++static bool device_has_rmrr(struct pci_dev *dev) ++{ ++ struct dmar_rmrr_unit *rmrr; ++ int i; ++ ++ for_each_rmrr_units(rmrr) { ++ for (i = 0; i < rmrr->devices_cnt; i++) { ++ /* ++ * Return TRUE if this RMRR contains the device that ++ * is passed in. ++ */ ++ if (rmrr->devices[i] == dev) ++ return true; ++ } ++ } ++ return false; ++} ++ + static int iommu_should_identity_map(struct pci_dev *pdev, int startup) + { ++ ++ /* ++ * We want to prevent any device associated with an RMRR from ++ * getting placed into the SI Domain. This is done because ++ * problems exist when devices are moved in and out of domains ++ * and their respective RMRR info is lost. We exempt USB devices ++ * from this process due to their usage of RMRRs that are known ++ * to not be needed after BIOS hand-off to OS. ++ */ ++ if (device_has_rmrr(pdev) && ++ (pdev->class >> 8) != PCI_CLASS_SERIAL_USB) ++ return 0; ++ + if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev)) + return 1; + diff --git a/queue-3.4/r8169-avoid-napi-scheduling-delay.patch b/queue-3.4/r8169-avoid-napi-scheduling-delay.patch new file mode 100644 index 00000000000..76db1937586 --- /dev/null +++ b/queue-3.4/r8169-avoid-napi-scheduling-delay.patch @@ -0,0 +1,52 @@ +From 7dbb491878a2c51d372a8890fa45a8ff80358af1 Mon Sep 17 00:00:00 2001 +From: Francois Romieu +Date: Sat, 9 Jun 2012 10:53:16 +0000 +Subject: r8169: avoid NAPI scheduling delay. + +From: Francois Romieu + +commit 7dbb491878a2c51d372a8890fa45a8ff80358af1 upstream. + +While reworking the r8169 driver a few months ago to perform the +smallest amount of work in the irq handler, I took care of avoiding +any irq mask register operation in the slow work dedicated user +context thread. The slow work thread scheduled an extra round of NAPI +work which would ultimately set the irq mask register as required, +thus keeping such irq mask operations in the NAPI handler. +It would eventually race with the irq handler and delay NAPI execution +for - assuming no further irq - a whole ksoftirqd period. Mildly a +problem for rare link changes or corner case PCI events. + +The race was always lost after the last bh disabling lock had been +removed from the work thread and people started wondering where those +pesky "NOHZ: local_softirq_pending 08" messages came from. + +Actually the irq mask register _can_ be set up directly in the slow +work thread. + +Signed-off-by: Francois Romieu +Reported-by: Dave Jones +Tested-by: Marc Dionne +Cc: Thomas Gleixner +Cc: Hayes Wang +Signed-off-by: David S. Miller + +--- + drivers/net/ethernet/realtek/r8169.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.c ++++ b/drivers/net/ethernet/realtek/r8169.c +@@ -5516,11 +5516,7 @@ static void rtl_slow_event_work(struct r + if (status & LinkChg) + __rtl8169_check_link_status(dev, tp, tp->mmio_addr, true); + +- napi_disable(&tp->napi); +- rtl_irq_disable(tp); +- +- napi_enable(&tp->napi); +- napi_schedule(&tp->napi); ++ rtl_irq_enable_all(tp); + } + + static void rtl_task(struct work_struct *work) diff --git a/queue-3.4/s390-time-fix-sched_clock-overflow.patch b/queue-3.4/s390-time-fix-sched_clock-overflow.patch new file mode 100644 index 00000000000..d738e322efd --- /dev/null +++ b/queue-3.4/s390-time-fix-sched_clock-overflow.patch @@ -0,0 +1,89 @@ +From ed4f20943cd4c7b55105c04daedf8d63ab6d499c Mon Sep 17 00:00:00 2001 +From: Heiko Carstens +Date: Mon, 14 Jan 2013 16:55:55 +0100 +Subject: s390/time: fix sched_clock() overflow + +From: Heiko Carstens + +commit ed4f20943cd4c7b55105c04daedf8d63ab6d499c upstream. + +Converting a 64 Bit TOD format value to nanoseconds means that the value +must be divided by 4.096. In order to achieve that we multiply with 125 +and divide by 512. +When used within sched_clock() this triggers an overflow after appr. +417 days. Resulting in a sched_clock() return value that is much smaller +than previously and therefore may cause all sort of weird things in +subsystems that rely on a monotonic sched_clock() behaviour. + +To fix this implement a tod_to_ns() helper function which converts TOD +values without overflow and call this function from both places that +open coded the conversion: sched_clock() and kvm_s390_handle_wait(). + +Reviewed-by: Martin Schwidefsky +Signed-off-by: Heiko Carstens +Signed-off-by: Martin Schwidefsky +Signed-off-by: Greg Kroah-Hartman + +--- + arch/s390/include/asm/timex.h | 28 ++++++++++++++++++++++++++++ + arch/s390/kernel/time.c | 2 +- + arch/s390/kvm/interrupt.c | 2 +- + 3 files changed, 30 insertions(+), 2 deletions(-) + +--- a/arch/s390/include/asm/timex.h ++++ b/arch/s390/include/asm/timex.h +@@ -137,4 +137,32 @@ static inline unsigned long long get_clo + return get_clock_xt() - sched_clock_base_cc; + } + ++/** ++ * tod_to_ns - convert a TOD format value to nanoseconds ++ * @todval: to be converted TOD format value ++ * Returns: number of nanoseconds that correspond to the TOD format value ++ * ++ * Converting a 64 Bit TOD format value to nanoseconds means that the value ++ * must be divided by 4.096. In order to achieve that we multiply with 125 ++ * and divide by 512: ++ * ++ * ns = (todval * 125) >> 9; ++ * ++ * In order to avoid an overflow with the multiplication we can rewrite this. ++ * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits) ++ * we end up with ++ * ++ * ns = ((2^32 * th + tl) * 125 ) >> 9; ++ * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9); ++ * ++ */ ++static inline unsigned long long tod_to_ns(unsigned long long todval) ++{ ++ unsigned long long ns; ++ ++ ns = ((todval >> 32) << 23) * 125; ++ ns += ((todval & 0xffffffff) * 125) >> 9; ++ return ns; ++} ++ + #endif +--- a/arch/s390/kernel/time.c ++++ b/arch/s390/kernel/time.c +@@ -64,7 +64,7 @@ static DEFINE_PER_CPU(struct clock_event + */ + unsigned long long notrace __kprobes sched_clock(void) + { +- return (get_clock_monotonic() * 125) >> 9; ++ return tod_to_ns(get_clock_monotonic()); + } + + /* +--- a/arch/s390/kvm/interrupt.c ++++ b/arch/s390/kvm/interrupt.c +@@ -390,7 +390,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu + return 0; + } + +- sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9; ++ sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now); + + hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL); + VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime); diff --git a/queue-3.4/series b/queue-3.4/series index 98f5701ada1..7f334ab407d 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -2,3 +2,12 @@ sh-fix-fdpic-binary-loader.patch tcm_fc-do-not-indicate-retry-capability-to-initiators.patch tcm_fc-do-not-report-target-role-when-target-is-not-defined.patch target-release-se_cmd-when-lun-lookup-fails-for-tmr.patch +s390-time-fix-sched_clock-overflow.patch +x86-sandy-bridge-reserve-pages-when-integrated-graphics-is-present.patch +alsa-usb-fix-race-in-creation-of-m-audio-fast-track-pro-driver.patch +ext4-init-pagevec-in-ext4_da_block_invalidatepages.patch +r8169-avoid-napi-scheduling-delay.patch +target-add-link_magic-for-fabric-allow_link-destination.patch +intel-iommu-prevent-devices-with-rmrrs-from-being-placed.patch +igb-release-already-assigned-msi-x-interrupts-if-setup-fails.patch +drbd-add-missing-part_round_stats-to-_drbd_start_io_acct.patch diff --git a/queue-3.4/target-add-link_magic-for-fabric-allow_link-destination.patch b/queue-3.4/target-add-link_magic-for-fabric-allow_link-destination.patch new file mode 100644 index 00000000000..7be845e2c47 --- /dev/null +++ b/queue-3.4/target-add-link_magic-for-fabric-allow_link-destination.patch @@ -0,0 +1,108 @@ +From 0ff8754981261a80f4b77db2536dfea92c2d4539 Mon Sep 17 00:00:00 2001 +From: Nicholas Bellinger +Date: Tue, 4 Dec 2012 23:43:57 -0800 +Subject: target: Add link_magic for fabric allow_link destination + target_items + +From: Nicholas Bellinger + +commit 0ff8754981261a80f4b77db2536dfea92c2d4539 upstream. + +This patch adds [dev,lun]_link_magic value assignment + checks within generic +target_fabric_port_link() and target_fabric_mappedlun_link() code to ensure +destination config_item *target_item sent from configfs_symlink() -> +config_item_operations->allow_link() is the underlying se_device->dev_group +and se_lun->lun_group that we expect to symlink. + +Reported-by: Sebastian Andrzej Siewior +Cc: Sebastian Andrzej Siewior +Signed-off-by: Nicholas Bellinger +Signed-off-by: CAI Qian +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/target/target_core_device.c | 1 + + drivers/target/target_core_fabric_configfs.c | 12 ++++++++++++ + drivers/target/target_core_tpg.c | 1 + + drivers/target/target_core_transport.c | 1 + + include/target/target_core_base.h | 4 ++++ + 5 files changed, 19 insertions(+) + +--- a/drivers/target/target_core_device.c ++++ b/drivers/target/target_core_device.c +@@ -1665,6 +1665,7 @@ int core_dev_setup_virtual_lun0(void) + ret = PTR_ERR(dev); + goto out; + } ++ dev->dev_link_magic = SE_DEV_LINK_MAGIC; + se_dev->se_dev_ptr = dev; + g_lun0_dev = dev; + +--- a/drivers/target/target_core_fabric_configfs.c ++++ b/drivers/target/target_core_fabric_configfs.c +@@ -72,6 +72,12 @@ static int target_fabric_mappedlun_link( + struct se_portal_group *se_tpg; + struct config_item *nacl_ci, *tpg_ci, *tpg_ci_s, *wwn_ci, *wwn_ci_s; + int ret = 0, lun_access; ++ ++ if (lun->lun_link_magic != SE_LUN_LINK_MAGIC) { ++ pr_err("Bad lun->lun_link_magic, not a valid lun_ci pointer:" ++ " %p to struct lun: %p\n", lun_ci, lun); ++ return -EFAULT; ++ } + /* + * Ensure that the source port exists + */ +@@ -746,6 +752,12 @@ static int target_fabric_port_link( + struct target_fabric_configfs *tf; + int ret; + ++ if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) { ++ pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:" ++ " %p to struct se_device: %p\n", se_dev_ci, dev); ++ return -EFAULT; ++ } ++ + tpg_ci = &lun_ci->ci_parent->ci_group->cg_item; + se_tpg = container_of(to_config_group(tpg_ci), + struct se_portal_group, tpg_group); +--- a/drivers/target/target_core_tpg.c ++++ b/drivers/target/target_core_tpg.c +@@ -677,6 +677,7 @@ int core_tpg_register( + for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { + lun = se_tpg->tpg_lun_list[i]; + lun->unpacked_lun = i; ++ lun->lun_link_magic = SE_LUN_LINK_MAGIC; + lun->lun_status = TRANSPORT_LUN_STATUS_FREE; + atomic_set(&lun->lun_acl_count, 0); + init_completion(&lun->lun_shutdown_comp); +--- a/drivers/target/target_core_transport.c ++++ b/drivers/target/target_core_transport.c +@@ -1341,6 +1341,7 @@ struct se_device *transport_add_device_t + dev->se_hba = hba; + dev->se_sub_dev = se_dev; + dev->transport = transport; ++ dev->dev_link_magic = SE_DEV_LINK_MAGIC; + INIT_LIST_HEAD(&dev->dev_list); + INIT_LIST_HEAD(&dev->dev_sep_list); + INIT_LIST_HEAD(&dev->dev_tmr_list); +--- a/include/target/target_core_base.h ++++ b/include/target/target_core_base.h +@@ -779,6 +779,8 @@ struct se_subsystem_dev { + }; + + struct se_device { ++#define SE_DEV_LINK_MAGIC 0xfeeddeef ++ u32 dev_link_magic; + /* RELATIVE TARGET PORT IDENTIFER Counter */ + u16 dev_rpti_counter; + /* Used for SAM Task Attribute ordering */ +@@ -869,6 +871,8 @@ struct se_port_stat_grps { + }; + + struct se_lun { ++#define SE_LUN_LINK_MAGIC 0xffff7771 ++ u32 lun_link_magic; + /* See transport_lun_status_table */ + enum transport_lun_status_table lun_status; + u32 lun_access; diff --git a/queue-3.4/x86-sandy-bridge-reserve-pages-when-integrated-graphics-is-present.patch b/queue-3.4/x86-sandy-bridge-reserve-pages-when-integrated-graphics-is-present.patch new file mode 100644 index 00000000000..523eefc37eb --- /dev/null +++ b/queue-3.4/x86-sandy-bridge-reserve-pages-when-integrated-graphics-is-present.patch @@ -0,0 +1,132 @@ +From a9acc5365dbda29f7be2884efb63771dc24bd815 Mon Sep 17 00:00:00 2001 +From: Jesse Barnes +Date: Wed, 14 Nov 2012 20:43:31 +0000 +Subject: x86/Sandy Bridge: reserve pages when integrated graphics is present + +From: Jesse Barnes + +commit a9acc5365dbda29f7be2884efb63771dc24bd815 upstream. + +SNB graphics devices have a bug that prevent them from accessing certain +memory ranges, namely anything below 1M and in the pages listed in the +table. So reserve those at boot if set detect a SNB gfx device on the +CPU to avoid GPU hangs. + +Stephane Marchesin had a similar patch to the page allocator awhile +back, but rather than reserving pages up front, it leaked them at +allocation time. + +[ hpa: made a number of stylistic changes, marked arrays as static + const, and made less verbose; use "memblock=debug" for full + verbosity. ] + +Signed-off-by: Jesse Barnes +Signed-off-by: H. Peter Anvin +Cc: CAI Qian +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/setup.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 78 insertions(+) + +--- a/arch/x86/kernel/setup.c ++++ b/arch/x86/kernel/setup.c +@@ -620,6 +620,81 @@ static __init void reserve_ibft_region(v + + static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10; + ++static bool __init snb_gfx_workaround_needed(void) ++{ ++ int i; ++ u16 vendor, devid; ++ static const u16 snb_ids[] = { ++ 0x0102, ++ 0x0112, ++ 0x0122, ++ 0x0106, ++ 0x0116, ++ 0x0126, ++ 0x010a, ++ }; ++ ++ /* Assume no if something weird is going on with PCI */ ++ if (!early_pci_allowed()) ++ return false; ++ ++ vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID); ++ if (vendor != 0x8086) ++ return false; ++ ++ devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID); ++ for (i = 0; i < ARRAY_SIZE(snb_ids); i++) ++ if (devid == snb_ids[i]) ++ return true; ++ ++ return false; ++} ++ ++/* ++ * Sandy Bridge graphics has trouble with certain ranges, exclude ++ * them from allocation. ++ */ ++static void __init trim_snb_memory(void) ++{ ++ static const unsigned long bad_pages[] = { ++ 0x20050000, ++ 0x20110000, ++ 0x20130000, ++ 0x20138000, ++ 0x40004000, ++ }; ++ int i; ++ ++ if (!snb_gfx_workaround_needed()) ++ return; ++ ++ printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n"); ++ ++ /* ++ * Reserve all memory below the 1 MB mark that has not ++ * already been reserved. ++ */ ++ memblock_reserve(0, 1<<20); ++ ++ for (i = 0; i < ARRAY_SIZE(bad_pages); i++) { ++ if (memblock_reserve(bad_pages[i], PAGE_SIZE)) ++ printk(KERN_WARNING "failed to reserve 0x%08lx\n", ++ bad_pages[i]); ++ } ++} ++ ++/* ++ * Here we put platform-specific memory range workarounds, i.e. ++ * memory known to be corrupt or otherwise in need to be reserved on ++ * specific platforms. ++ * ++ * If this gets used more widely it could use a real dispatch mechanism. ++ */ ++static void __init trim_platform_memory_ranges(void) ++{ ++ trim_snb_memory(); ++} ++ + static void __init trim_bios_range(void) + { + /* +@@ -640,6 +715,7 @@ static void __init trim_bios_range(void) + * take them out. + */ + e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); ++ + sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); + } + +@@ -919,6 +995,8 @@ void __init setup_arch(char **cmdline_p) + + setup_trampolines(); + ++ trim_platform_memory_ranges(); ++ + init_gbpages(); + + /* max_pfn_mapped is updated here */ -- 2.47.3