summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0001-mm-reduce-the-amount-of-work-done-when-updating-min_.patch88
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0002-mm-compaction-allow-compaction-to-isolate-dirty-page.patch436
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0003-mm-compaction-determine-if-dirty-pages-can-be-migrat.patch376
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch143
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0005-mm-compaction-make-isolate_lru_page-filter-aware-aga.patch117
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0006-mm-compaction-introduce-sync-light-migration-for-use.patch547
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch120
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0008-mm-vmscan-do-not-OOM-if-aborting-reclaim-to-start-co.patch71
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0009-mm-vmscan-check-if-reclaim-should-really-abort-even-.patch119
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0010-vmscan-promote-shared-file-mapped-pages.patch82
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0011-vmscan-activate-executable-pages-after-first-usage.patch56
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0012-mm-vmscan.c-consider-swap-space-when-deciding-whethe.patch50
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0013-mm-test-PageSwapBacked-in-lumpy-reclaim.patch42
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0014-mm-vmscan-convert-global-reclaim-to-per-memcg-LRU-li.patch58
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0015-cpuset-mm-reduce-large-amounts-of-memory-barrier-rel.patch655
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0016-mm-hugetlb-fix-warning-in-alloc_huge_page-dequeue_hu.patch50
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0017-Fix-NULL-dereferences-in-scsi_cmd_to_driver.patch71
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch137
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0019-sched-nohz-Fix-rq-cpu_load-calculations-some-more.patch147
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0020-powerpc-ftrace-Fix-assembly-trampoline-register-usag.patch50
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0021-cx25821-Remove-bad-strcpy-to-read-only-char.patch53
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0022-x86-Fix-boot-on-Twinhead-H12Y.patch54
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0023-r8169-RxConfig-hack-for-the-8168evl.patch47
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0024-cifs-when-CONFIG_HIGHMEM-is-set-serialize-the-read-w.patch124
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0025-wireless-rt2x00-rt2800usb-add-more-devices-ids.patch89
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0026-wireless-rt2x00-rt2800usb-more-devices-were-identifi.patch79
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0027-rt2800usb-2001-3c17-is-an-RT3370-device.patch41
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0028-usb-gadget-Fix-g_ether-interface-link-status.patch61
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0029-ext4-pass-a-char-to-ext4_count_free-instead-of-a-buf.patch88
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0030-ftrace-Disable-function-tracing-during-suspend-resum.patch113
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0031-x86-microcode-microcode_core.c-simple_strtoul-cleanu.patch44
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0032-x86-microcode-Sanitize-per-cpu-microcode-reloading-i.patch92
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0033-usbdevfs-Correct-amount-of-data-copied-to-user-in-pr.patch45
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0034-ext4-fix-overhead-calculation-used-by-ext4_statfs.patch294
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0035-udf-Improve-table-length-check-to-avoid-possible-ove.patch36
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0036-powerpc-Add-memory-attribute-for-mfmsr.patch34
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0037-mwifiex-correction-in-mcs-index-check.patch41
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0038-USB-option-Ignore-ZTE-Vodafone-K3570-71-net-interfac.patch37
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0039-USB-option-add-ZTE-MF821D.patch36
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0040-target-Add-generation-of-LOGICAL-BLOCK-ADDRESS-OUT-O.patch64
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0041-target-Add-range-checking-to-UNMAP-emulation.patch46
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0042-target-Fix-reading-of-data-length-fields-for-UNMAP-c.patch51
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0043-target-Fix-possible-integer-underflow-in-UNMAP-emula.patch75
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0044-target-Check-number-of-unmap-descriptors-against-our.patch38
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0045-s390-idle-fix-sequence-handling-vs-cpu-hotplug.patch80
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0046-rtlwifi-rtl8192de-Fix-phy-based-version-calculation.patch61
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0047-workqueue-perform-cpu-down-operations-from-low-prior.patch120
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0048-ALSA-hda-Add-support-for-Realtek-ALC282.patch34
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0049-iommu-amd-Fix-hotplug-with-iommu-pt.patch48
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0050-drm-radeon-Try-harder-to-avoid-HW-cursor-ending-on-a.patch50
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0051-ALSA-hda-Turn-on-PIN_OUT-from-hdmi-playback-prepare.patch66
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0052-block-add-blk_queue_dead.patch140
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0053-Fix-device-removal-NULL-pointer-dereference.patch163
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0054-Avoid-dangling-pointer-in-scsi_requeue_command.patch57
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0055-fix-hot-unplug-vs-async-scan-race.patch122
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0056-fix-eh-wakeup-scsi_schedule_eh-vs-scsi_restart_opera.patch62
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0057-libsas-continue-revalidation.patch49
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0058-libsas-fix-sas_discover_devices-return-code-handling.patch128
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0059-iscsi-target-Drop-bogus-struct-file-usage-for-iSCSI-.patch230
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0060-mmc-sdhci-pci-CaFe-has-broken-card-detection.patch42
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch55
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0062-ext4-undo-ext4_calc_metadata_amount-if-we-fail-to-cl.patch93
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0063-ASoC-dapm-Fix-_PRE-and-_POST-events-for-DAPM-perform.patch46
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0064-locks-fix-checking-of-fcntl_setlease-argument.patch57
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0065-ACPI-AC-prevent-OOPS-on-some-boxes-due-to-missing-ch.patch45
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0066-drm-radeon-fix-bo-creation-retry-path.patch47
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0067-drm-radeon-fix-non-revealent-error-message.patch70
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0068-drm-radeon-fix-hotplug-of-DP-to-DVI-HDMI-passive-ada.patch69
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0069-drm-radeon-on-hotplug-force-link-training-to-happen-.patch51
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0070-Btrfs-call-the-ordered-free-operation-without-any-lo.patch48
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0071-nouveau-Fix-alignment-requirements-on-src-and-dst-ad.patch748
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0072-mm-fix-wrong-argument-of-migrate_huge_pages-in-soft_.patch58
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0073-Linux-3.2.25.patch24
73 files changed, 7960 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0001-mm-reduce-the-amount-of-work-done-when-updating-min_.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0001-mm-reduce-the-amount-of-work-done-when-updating-min_.patch
new file mode 100644
index 00000000..d7cf5811
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0001-mm-reduce-the-amount-of-work-done-when-updating-min_.patch
@@ -0,0 +1,88 @@
1From ce43a5bb3c28d87f36ff91fcc2fc210db2b6fd4b Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Tue, 10 Jan 2012 15:07:14 -0800
4Subject: [PATCH 01/73] mm: reduce the amount of work done when updating
5 min_free_kbytes
6
7commit 938929f14cb595f43cd1a4e63e22d36cab1e4a1f upstream.
8
9Stable note: Fixes https://bugzilla.novell.com/show_bug.cgi?id=726210 .
10 Large machines with 1TB or more of RAM take a long time to boot
11 without this patch and may spew out soft lockup warnings.
12
13When min_free_kbytes is updated, some pageblocks are marked
14MIGRATE_RESERVE. Ordinarily, this work is unnoticable as it happens early
15in boot but on large machines with 1TB of memory, this has been reported
16to delay boot times, probably due to the NUMA distances involved.
17
18The bulk of the work is due to calling calling pageblock_is_reserved() an
19unnecessary amount of times and accessing far more struct page metadata
20than is necessary. This patch significantly reduces the amount of work
21done by setup_zone_migrate_reserve() improving boot times on 1TB machines.
22
23[akpm@linux-foundation.org: coding-style fixes]
24Signed-off-by: Mel Gorman <mgorman@suse.de>
25Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
26Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
28---
29 mm/page_alloc.c | 40 ++++++++++++++++++++++++----------------
30 1 files changed, 24 insertions(+), 16 deletions(-)
31
32diff --git a/mm/page_alloc.c b/mm/page_alloc.c
33index 485be89..cb3460e 100644
34--- a/mm/page_alloc.c
35+++ b/mm/page_alloc.c
36@@ -3407,25 +3407,33 @@ static void setup_zone_migrate_reserve(struct zone *zone)
37 if (page_to_nid(page) != zone_to_nid(zone))
38 continue;
39
40- /* Blocks with reserved pages will never free, skip them. */
41- block_end_pfn = min(pfn + pageblock_nr_pages, end_pfn);
42- if (pageblock_is_reserved(pfn, block_end_pfn))
43- continue;
44-
45 block_migratetype = get_pageblock_migratetype(page);
46
47- /* If this block is reserved, account for it */
48- if (reserve > 0 && block_migratetype == MIGRATE_RESERVE) {
49- reserve--;
50- continue;
51- }
52+ /* Only test what is necessary when the reserves are not met */
53+ if (reserve > 0) {
54+ /*
55+ * Blocks with reserved pages will never free, skip
56+ * them.
57+ */
58+ block_end_pfn = min(pfn + pageblock_nr_pages, end_pfn);
59+ if (pageblock_is_reserved(pfn, block_end_pfn))
60+ continue;
61
62- /* Suitable for reserving if this block is movable */
63- if (reserve > 0 && block_migratetype == MIGRATE_MOVABLE) {
64- set_pageblock_migratetype(page, MIGRATE_RESERVE);
65- move_freepages_block(zone, page, MIGRATE_RESERVE);
66- reserve--;
67- continue;
68+ /* If this block is reserved, account for it */
69+ if (block_migratetype == MIGRATE_RESERVE) {
70+ reserve--;
71+ continue;
72+ }
73+
74+ /* Suitable for reserving if this block is movable */
75+ if (block_migratetype == MIGRATE_MOVABLE) {
76+ set_pageblock_migratetype(page,
77+ MIGRATE_RESERVE);
78+ move_freepages_block(zone, page,
79+ MIGRATE_RESERVE);
80+ reserve--;
81+ continue;
82+ }
83 }
84
85 /*
86--
871.7.7.6
88
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0002-mm-compaction-allow-compaction-to-isolate-dirty-page.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0002-mm-compaction-allow-compaction-to-isolate-dirty-page.patch
new file mode 100644
index 00000000..cbcecd14
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0002-mm-compaction-allow-compaction-to-isolate-dirty-page.patch
@@ -0,0 +1,436 @@
1From 50bec8b86d1ffdec691586e017499cb3f5e0b6a0 Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:22 -0800
4Subject: [PATCH 02/73] mm: compaction: allow compaction to isolate dirty
5 pages
6
7commit a77ebd333cd810d7b680d544be88c875131c2bd3 upstream.
8
9Stable note: Not tracked in Bugzilla. A fix aimed at preserving page aging
10 information by reducing LRU list churning had the side-effect of
11 reducing THP allocation success rates. This was part of a series
12 to restore the success rates while preserving the reclaim fix.
13
14Short summary: There are severe stalls when a USB stick using VFAT is
15used with THP enabled that are reduced by this series. If you are
16experiencing this problem, please test and report back and considering I
17have seen complaints from openSUSE and Fedora users on this as well as a
18few private mails, I'm guessing it's a widespread issue. This is a new
19type of USB-related stall because it is due to synchronous compaction
20writing where as in the past the big problem was dirty pages reaching
21the end of the LRU and being written by reclaim.
22
23Am cc'ing Andrew this time and this series would replace
24mm-do-not-stall-in-synchronous-compaction-for-thp-allocations.patch.
25I'm also cc'ing Dave Jones as he might have merged that patch to Fedora
26for wider testing and ideally it would be reverted and replaced by this
27series.
28
29That said, the later patches could really do with some review. If this
30series is not the answer then a new direction needs to be discussed
31because as it is, the stalls are unacceptable as the results in this
32leader show.
33
34For testers that try backporting this to 3.1, it won't work because
35there is a non-obvious dependency on not writing back pages in direct
36reclaim so you need those patches too.
37
38Changelog since V5
39o Rebase to 3.2-rc5
40o Tidy up the changelogs a bit
41
42Changelog since V4
43o Added reviewed-bys, credited Andrea properly for sync-light
44o Allow dirty pages without mappings to be considered for migration
45o Bound the number of pages freed for compaction
46o Isolate PageReclaim pages on their own LRU list
47
48This is against 3.2-rc5 and follows on from discussions on "mm: Do
49not stall in synchronous compaction for THP allocations" and "[RFC
50PATCH 0/5] Reduce compaction-related stalls". Initially, the proposed
51patch eliminated stalls due to compaction which sometimes resulted in
52user-visible interactivity problems on browsers by simply never using
53sync compaction. The downside was that THP success allocation rates
54were lower because dirty pages were not being migrated as reported by
55Andrea. His approach at fixing this was nacked on the grounds that
56it reverted fixes from Rik merged that reduced the amount of pages
57reclaimed as it severely impacted his workloads performance.
58
59This series attempts to reconcile the requirements of maximising THP
60usage, without stalling in a user-visible fashion due to compaction
61or cheating by reclaiming an excessive number of pages.
62
63Patch 1 partially reverts commit 39deaf85 to allow migration to isolate
64 dirty pages. This is because migration can move some dirty
65 pages without blocking.
66
67Patch 2 notes that the /proc/sys/vm/compact_memory handler is not using
68 synchronous compaction when it should be. This is unrelated
69 to the reported stalls but is worth fixing.
70
71Patch 3 checks if we isolated a compound page during lumpy scan and
72 account for it properly. For the most part, this affects
73 tracing so it's unrelated to the stalls but worth fixing.
74
75Patch 4 notes that it is possible to abort reclaim early for compaction
76 and return 0 to the page allocator potentially entering the
77 "may oom" path. This has not been observed in practice but
78 the rest of the series potentially makes it easier to happen.
79
80Patch 5 adds a sync parameter to the migratepage callback and gives
81 the callback responsibility for migrating the page without
82 blocking if sync==false. For example, fallback_migrate_page
83 will not call writepage if sync==false. This increases the
84 number of pages that can be handled by asynchronous compaction
85 thereby reducing stalls.
86
87Patch 6 restores filter-awareness to isolate_lru_page for migration.
88 In practice, it means that pages under writeback and pages
89 without a ->migratepage callback will not be isolated
90 for migration.
91
92Patch 7 avoids calling direct reclaim if compaction is deferred but
93 makes sure that compaction is only deferred if sync
94 compaction was used.
95
96Patch 8 introduces a sync-light migration mechanism that sync compaction
97 uses. The objective is to allow some stalls but to not call
98 ->writepage which can lead to significant user-visible stalls.
99
100Patch 9 notes that while we want to abort reclaim ASAP to allow
101 compation to go ahead that we leave a very small window of
102 opportunity for compaction to run. This patch allows more pages
103 to be freed by reclaim but bounds the number to a reasonable
104 level based on the high watermark on each zone.
105
106Patch 10 allows slabs to be shrunk even after compaction_ready() is
107 true for one zone. This is to avoid a problem whereby a single
108 small zone can abort reclaim even though no pages have been
109 reclaimed and no suitably large zone is in a usable state.
110
111Patch 11 fixes a problem with the rate of page scanning. As reclaim is
112 rarely stalling on pages under writeback it means that scan
113 rates are very high. This is particularly true for direct
114 reclaim which is not calling writepage. The vmstat figures
115 implied that much of this was busy work with PageReclaim pages
116 marked for immediate reclaim. This patch is a prototype that
117 moves these pages to their own LRU list.
118
119This has been tested and other than 2 USB keys getting trashed,
120nothing horrible fell out. That said, I am a bit unhappy with the
121rescue logic in patch 11 but did not find a better way around it. It
122does significantly reduce scan rates and System CPU time indicating
123it is the right direction to take.
124
125What is of critical importance is that stalls due to compaction
126are massively reduced even though sync compaction was still
127allowed. Testing from people complaining about stalls copying to USBs
128with THP enabled are particularly welcome.
129
130The following tests all involve THP usage and USB keys in some
131way. Each test follows this type of pattern
132
1331. Read from some fast fast storage, be it raw device or file. Each time
134 the copy finishes, start again until the test ends
1352. Write a large file to a filesystem on a USB stick. Each time the copy
136 finishes, start again until the test ends
1373. When memory is low, start an alloc process that creates a mapping
138 the size of physical memory to stress THP allocation. This is the
139 "real" part of the test and the part that is meant to trigger
140 stalls when THP is enabled. Copying continues in the background.
1414. Record the CPU usage and time to execute of the alloc process
1425. Record the number of THP allocs and fallbacks as well as the number of THP
143 pages in use a the end of the test just before alloc exited
1446. Run the test 5 times to get an idea of variability
1457. Between each run, sync is run and caches dropped and the test
146 waits until nr_dirty is a small number to avoid interference
147 or caching between iterations that would skew the figures.
148
149The individual tests were then
150
151writebackCPDeviceBasevfat
152 Disable THP, read from a raw device (sda), vfat on USB stick
153writebackCPDeviceBaseext4
154 Disable THP, read from a raw device (sda), ext4 on USB stick
155writebackCPDevicevfat
156 THP enabled, read from a raw device (sda), vfat on USB stick
157writebackCPDeviceext4
158 THP enabled, read from a raw device (sda), ext4 on USB stick
159writebackCPFilevfat
160 THP enabled, read from a file on fast storage and USB, both vfat
161writebackCPFileext4
162 THP enabled, read from a file on fast storage and USB, both ext4
163
164The kernels tested were
165
1663.1 3.1
167vanilla 3.2-rc5
168freemore Patches 1-10
169immediate Patches 1-11
170andrea The 8 patches Andrea posted as a basis of comparison
171
172The results are very long unfortunately. I'll start with the case
173where we are not using THP at all
174
175writebackCPDeviceBasevfat
176 3.1.0-vanilla rc5-vanilla freemore-v6r1 isolate-v6r1 andrea-v2r1
177System Time 1.28 ( 0.00%) 54.49 (-4143.46%) 48.63 (-3687.69%) 4.69 ( -265.11%) 51.88 (-3940.81%)
178+/- 0.06 ( 0.00%) 2.45 (-4305.55%) 4.75 (-8430.57%) 7.46 (-13282.76%) 4.76 (-8440.70%)
179User Time 0.09 ( 0.00%) 0.05 ( 40.91%) 0.06 ( 29.55%) 0.07 ( 15.91%) 0.06 ( 27.27%)
180+/- 0.02 ( 0.00%) 0.01 ( 45.39%) 0.02 ( 25.07%) 0.00 ( 77.06%) 0.01 ( 52.24%)
181Elapsed Time 110.27 ( 0.00%) 56.38 ( 48.87%) 49.95 ( 54.70%) 11.77 ( 89.33%) 53.43 ( 51.54%)
182+/- 7.33 ( 0.00%) 3.77 ( 48.61%) 4.94 ( 32.63%) 6.71 ( 8.50%) 4.76 ( 35.03%)
183THP Active 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
184+/- 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
185Fault Alloc 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
186+/- 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
187Fault Fallback 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
188+/- 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%) 0.00 ( 0.00%)
189
190The THP figures are obviously all 0 because THP was enabled. The
191main thing to watch is the elapsed times and how they compare to
192times when THP is enabled later. It's also important to note that
193elapsed time is improved by this series as System CPu time is much
194reduced.
195
196writebackCPDevicevfat
197
198 3.1.0-vanilla rc5-vanilla freemore-v6r1 isolate-v6r1 andrea-v2r1
199System Time 1.22 ( 0.00%) 13.89 (-1040.72%) 46.40 (-3709.20%) 4.44 ( -264.37%) 47.37 (-3789.33%)
200+/- 0.06 ( 0.00%) 22.82 (-37635.56%) 3.84 (-6249.44%) 6.48 (-10618.92%) 6.60
201(-10818.53%)
202User Time 0.06 ( 0.00%) 0.06 ( -6.90%) 0.05 ( 17.24%) 0.05 ( 13.79%) 0.04 ( 31.03%)
203+/- 0.01 ( 0.00%) 0.01 ( 33.33%) 0.01 ( 33.33%) 0.01 ( 39.14%) 0.01 ( 25.46%)
204Elapsed Time 10445.54 ( 0.00%) 2249.92 ( 78.46%) 70.06 ( 99.33%) 16.59 ( 99.84%) 472.43 (
20595.48%)
206+/- 643.98 ( 0.00%) 811.62 ( -26.03%) 10.02 ( 98.44%) 7.03 ( 98.91%) 59.99 ( 90.68%)
207THP Active 15.60 ( 0.00%) 35.20 ( 225.64%) 65.00 ( 416.67%) 70.80 ( 453.85%) 62.20 ( 398.72%)
208+/- 18.48 ( 0.00%) 51.29 ( 277.59%) 15.99 ( 86.52%) 37.91 ( 205.18%) 22.02 ( 119.18%)
209Fault Alloc 121.80 ( 0.00%) 76.60 ( 62.89%) 155.40 ( 127.59%) 181.20 ( 148.77%) 286.60 ( 235.30%)
210+/- 73.51 ( 0.00%) 61.11 ( 83.12%) 34.89 ( 47.46%) 31.88 ( 43.36%) 68.13 ( 92.68%)
211Fault Fallback 881.20 ( 0.00%) 926.60 ( -5.15%) 847.60 ( 3.81%) 822.00 ( 6.72%) 716.60 ( 18.68%)
212+/- 73.51 ( 0.00%) 61.26 ( 16.67%) 34.89 ( 52.54%) 31.65 ( 56.94%) 67.75 ( 7.84%)
213MMTests Statistics: duration
214User/Sys Time Running Test (seconds) 3540.88 1945.37 716.04 64.97 1937.03
215Total Elapsed Time (seconds) 52417.33 11425.90 501.02 230.95 2520.28
216
217The first thing to note is the "Elapsed Time" for the vanilla kernels
218of 2249 seconds versus 56 with THP disabled which might explain the
219reports of USB stalls with THP enabled. Applying the patches brings
220performance in line with THP-disabled performance while isolating
221pages for immediate reclaim from the LRU cuts down System CPU time.
222
223The "Fault Alloc" success rate figures are also improved. The vanilla
224kernel only managed to allocate 76.6 pages on average over the course
225of 5 iterations where as applying the series allocated 181.20 on
226average albeit it is well within variance. It's worth noting that
227applies the series at least descreases the amount of variance which
228implies an improvement.
229
230Andrea's series had a higher success rate for THP allocations but
231at a severe cost to elapsed time which is still better than vanilla
232but still much worse than disabling THP altogether. One can bring my
233series close to Andrea's by removing this check
234
235 /*
236 * If compaction is deferred for high-order allocations, it is because
237 * sync compaction recently failed. In this is the case and the caller
238 * has requested the system not be heavily disrupted, fail the
239 * allocation now instead of entering direct reclaim
240 */
241 if (deferred_compaction && (gfp_mask & __GFP_NO_KSWAPD))
242 goto nopage;
243
244I didn't include a patch that removed the above check because hurting
245overall performance to improve the THP figure is not what the average
246user wants. It's something to consider though if someone really wants
247to maximise THP usage no matter what it does to the workload initially.
248
249This is summary of vmstat figures from the same test.
250
251 3.1.0-vanilla rc5-vanilla freemore-v6r1 isolate-v6r1 andrea-v2r1
252Page Ins 3257266139 1111844061 17263623 10901575 161423219
253Page Outs 81054922 30364312 3626530 3657687 8753730
254Swap Ins 3294 2851 6560 4964 4592
255Swap Outs 390073 528094 620197 790912 698285
256Direct pages scanned 1077581700 3024951463 1764930052 115140570 5901188831
257Kswapd pages scanned 34826043 7112868 2131265 1686942 1893966
258Kswapd pages reclaimed 28950067 4911036 1246044 966475 1497726
259Direct pages reclaimed 805148398 280167837 3623473 2215044 40809360
260Kswapd efficiency 83% 69% 58% 57% 79%
261Kswapd velocity 664.399 622.521 4253.852 7304.360 751.490
262Direct efficiency 74% 9% 0% 1% 0%
263Direct velocity 20557.737 264745.137 3522673.849 498551.938 2341481.435
264Percentage direct scans 96% 99% 99% 98% 99%
265Page writes by reclaim 722646 529174 620319 791018 699198
266Page writes file 332573 1080 122 106 913
267Page writes anon 390073 528094 620197 790912 698285
268Page reclaim immediate 0 2552514720 1635858848 111281140 5478375032
269Page rescued immediate 0 0 0 87848 0
270Slabs scanned 23552 23552 9216 8192 9216
271Direct inode steals 231 0 0 0 0
272Kswapd inode steals 0 0 0 0 0
273Kswapd skipped wait 28076 786 0 61 6
274THP fault alloc 609 383 753 906 1433
275THP collapse alloc 12 6 0 0 6
276THP splits 536 211 456 593 1136
277THP fault fallback 4406 4633 4263 4110 3583
278THP collapse fail 120 127 0 0 4
279Compaction stalls 1810 728 623 779 3200
280Compaction success 196 53 60 80 123
281Compaction failures 1614 675 563 699 3077
282Compaction pages moved 193158 53545 243185 333457 226688
283Compaction move failure 9952 9396 16424 23676 45070
284
285The main things to look at are
286
2871. Page In/out figures are much reduced by the series.
288
2892. Direct page scanning is incredibly high (264745.137 pages scanned
290 per second on the vanilla kernel) but isolating PageReclaim pages
291 on their own list reduces the number of pages scanned significantly.
292
2933. The fact that "Page rescued immediate" is a positive number implies
294 that we sometimes race removing pages from the LRU_IMMEDIATE list
295 that need to be put back on a normal LRU but it happens only for
296 0.07% of the pages marked for immediate reclaim.
297
298writebackCPDeviceext4
299 3.1.0-vanilla rc5-vanilla freemore-v6r1 isolate-v6r1 andrea-v2r1
300System Time 1.51 ( 0.00%) 1.77 ( -17.66%) 1.46 ( 2.92%) 1.15 ( 23.77%) 1.89 ( -25.63%)
301+/- 0.27 ( 0.00%) 0.67 ( -148.52%) 0.33 ( -22.76%) 0.30 ( -11.15%) 0.19 ( 30.16%)
302User Time 0.03 ( 0.00%) 0.04 ( -37.50%) 0.05 ( -62.50%) 0.07 ( -112.50%) 0.04 ( -18.75%)
303+/- 0.01 ( 0.00%) 0.02 ( -146.64%) 0.02 ( -97.91%) 0.02 ( -75.59%) 0.02 ( -63.30%)
304Elapsed Time 124.93 ( 0.00%) 114.49 ( 8.36%) 96.77 ( 22.55%) 27.48 ( 78.00%) 205.70 ( -64.65%)
305+/- 20.20 ( 0.00%) 74.39 ( -268.34%) 59.88 ( -196.48%) 7.72 ( 61.79%) 25.03 ( -23.95%)
306THP Active 161.80 ( 0.00%) 83.60 ( 51.67%) 141.20 ( 87.27%) 84.60 ( 52.29%) 82.60 ( 51.05%)
307+/- 71.95 ( 0.00%) 43.80 ( 60.88%) 26.91 ( 37.40%) 59.02 ( 82.03%) 52.13 ( 72.45%)
308Fault Alloc 471.40 ( 0.00%) 228.60 ( 48.49%) 282.20 ( 59.86%) 225.20 ( 47.77%) 388.40 ( 82.39%)
309+/- 88.07 ( 0.00%) 87.42 ( 99.26%) 73.79 ( 83.78%) 109.62 ( 124.47%) 82.62 ( 93.81%)
310Fault Fallback 531.60 ( 0.00%) 774.60 ( -45.71%) 720.80 ( -35.59%) 777.80 ( -46.31%) 614.80 ( -15.65%)
311+/- 88.07 ( 0.00%) 87.26 ( 0.92%) 73.79 ( 16.22%) 109.62 ( -24.47%) 82.29 ( 6.56%)
312MMTests Statistics: duration
313User/Sys Time Running Test (seconds) 50.22 33.76 30.65 24.14 128.45
314Total Elapsed Time (seconds) 1113.73 1132.19 1029.45 759.49 1707.26
315
316Similar test but the USB stick is using ext4 instead of vfat. As
317ext4 does not use writepage for migration, the large stalls due to
318compaction when THP is enabled are not observed. Still, isolating
319PageReclaim pages on their own list helped completion time largely
320by reducing the number of pages scanned by direct reclaim although
321time spend in congestion_wait could also be a factor.
322
323Again, Andrea's series had far higher success rates for THP allocation
324at the cost of elapsed time. I didn't look too closely but a quick
325look at the vmstat figures tells me kswapd reclaimed 8 times more pages
326than the patch series and direct reclaim reclaimed roughly three times
327as many pages. It follows that if memory is aggressively reclaimed,
328there will be more available for THP.
329
330writebackCPFilevfat
331 3.1.0-vanilla rc5-vanilla freemore-v6r1 isolate-v6r1 andrea-v2r1
332System Time 1.76 ( 0.00%) 29.10 (-1555.52%) 46.01 (-2517.18%) 4.79 ( -172.35%) 54.89 (-3022.53%)
333+/- 0.14 ( 0.00%) 25.61 (-18185.17%) 2.15 (-1434.83%) 6.60 (-4610.03%) 9.75
334(-6863.76%)
335User Time 0.05 ( 0.00%) 0.07 ( -45.83%) 0.05 ( -4.17%) 0.06 ( -29.17%) 0.06 ( -16.67%)
336+/- 0.02 ( 0.00%) 0.02 ( 20.11%) 0.02 ( -3.14%) 0.01 ( 31.58%) 0.01 ( 47.41%)
337Elapsed Time 22520.79 ( 0.00%) 1082.85 ( 95.19%) 73.30 ( 99.67%) 32.43 ( 99.86%) 291.84 ( 98.70%)
338+/- 7277.23 ( 0.00%) 706.29 ( 90.29%) 19.05 ( 99.74%) 17.05 ( 99.77%) 125.55 ( 98.27%)
339THP Active 83.80 ( 0.00%) 12.80 ( 15.27%) 15.60 ( 18.62%) 13.00 ( 15.51%) 0.80 ( 0.95%)
340+/- 66.81 ( 0.00%) 20.19 ( 30.22%) 5.92 ( 8.86%) 15.06 ( 22.54%) 1.17 ( 1.75%)
341Fault Alloc 171.00 ( 0.00%) 67.80 ( 39.65%) 97.40 ( 56.96%) 125.60 ( 73.45%) 133.00 ( 77.78%)
342+/- 82.91 ( 0.00%) 30.69 ( 37.02%) 53.91 ( 65.02%) 55.05 ( 66.40%) 21.19 ( 25.56%)
343Fault Fallback 832.00 ( 0.00%) 935.20 ( -12.40%) 906.00 ( -8.89%) 877.40 ( -5.46%) 870.20 ( -4.59%)
344+/- 82.91 ( 0.00%) 30.69 ( 62.98%) 54.01 ( 34.86%) 55.05 ( 33.60%) 20.91 ( 74.78%)
345MMTests Statistics: duration
346User/Sys Time Running Test (seconds) 7229.81 928.42 704.52 80.68 1330.76
347Total Elapsed Time (seconds) 112849.04 5618.69 571.11 360.54 1664.28
348
349In this case, the test is reading/writing only from filesystems but as
350it's vfat, it's slow due to calling writepage during compaction. Little
351to observe really - the time to complete the test goes way down
352with the series applied and THP allocation success rates go up in
353comparison to 3.2-rc5. The success rates are lower than 3.1.0 but
354the elapsed time for that kernel is abysmal so it is not really a
355sensible comparison.
356
357As before, Andrea's series allocates more THPs at the cost of overall
358performance.
359
360writebackCPFileext4
361 3.1.0-vanilla rc5-vanilla freemore-v6r1 isolate-v6r1 andrea-v2r1
362System Time 1.51 ( 0.00%) 1.77 ( -17.66%) 1.46 ( 2.92%) 1.15 ( 23.77%) 1.89 ( -25.63%)
363+/- 0.27 ( 0.00%) 0.67 ( -148.52%) 0.33 ( -22.76%) 0.30 ( -11.15%) 0.19 ( 30.16%)
364User Time 0.03 ( 0.00%) 0.04 ( -37.50%) 0.05 ( -62.50%) 0.07 ( -112.50%) 0.04 ( -18.75%)
365+/- 0.01 ( 0.00%) 0.02 ( -146.64%) 0.02 ( -97.91%) 0.02 ( -75.59%) 0.02 ( -63.30%)
366Elapsed Time 124.93 ( 0.00%) 114.49 ( 8.36%) 96.77 ( 22.55%) 27.48 ( 78.00%) 205.70 ( -64.65%)
367+/- 20.20 ( 0.00%) 74.39 ( -268.34%) 59.88 ( -196.48%) 7.72 ( 61.79%) 25.03 ( -23.95%)
368THP Active 161.80 ( 0.00%) 83.60 ( 51.67%) 141.20 ( 87.27%) 84.60 ( 52.29%) 82.60 ( 51.05%)
369+/- 71.95 ( 0.00%) 43.80 ( 60.88%) 26.91 ( 37.40%) 59.02 ( 82.03%) 52.13 ( 72.45%)
370Fault Alloc 471.40 ( 0.00%) 228.60 ( 48.49%) 282.20 ( 59.86%) 225.20 ( 47.77%) 388.40 ( 82.39%)
371+/- 88.07 ( 0.00%) 87.42 ( 99.26%) 73.79 ( 83.78%) 109.62 ( 124.47%) 82.62 ( 93.81%)
372Fault Fallback 531.60 ( 0.00%) 774.60 ( -45.71%) 720.80 ( -35.59%) 777.80 ( -46.31%) 614.80 ( -15.65%)
373+/- 88.07 ( 0.00%) 87.26 ( 0.92%) 73.79 ( 16.22%) 109.62 ( -24.47%) 82.29 ( 6.56%)
374MMTests Statistics: duration
375User/Sys Time Running Test (seconds) 50.22 33.76 30.65 24.14 128.45
376Total Elapsed Time (seconds) 1113.73 1132.19 1029.45 759.49 1707.26
377
378Same type of story - elapsed times go down. In this case, allocation
379success rates are roughtly the same. As before, Andrea's has higher
380success rates but takes a lot longer.
381
382Overall the series does reduce latencies and while the tests are
383inherency racy as alloc competes with the cp processes, the variability
384was included. The THP allocation rates are not as high as they could
385be but that is because we would have to be more aggressive about
386reclaim and compaction impacting overall performance.
387
388This patch:
389
390Commit 39deaf85 ("mm: compaction: make isolate_lru_page() filter-aware")
391noted that compaction does not migrate dirty or writeback pages and that
392is was meaningless to pick the page and re-add it to the LRU list.
393
394What was missed during review is that asynchronous migration moves dirty
395pages if their ->migratepage callback is migrate_page() because these can
396be moved without blocking. This potentially impacted hugepage allocation
397success rates by a factor depending on how many dirty pages are in the
398system.
399
400This patch partially reverts 39deaf85 to allow migration to isolate dirty
401pages again. This increases how much compaction disrupts the LRU but that
402is addressed later in the series.
403
404Signed-off-by: Mel Gorman <mgorman@suse.de>
405Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
406Reviewed-by: Rik van Riel <riel@redhat.com>
407Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
408Cc: Dave Jones <davej@redhat.com>
409Cc: Jan Kara <jack@suse.cz>
410Cc: Andy Isaacson <adi@hexapodia.org>
411Cc: Nai Xia <nai.xia@gmail.com>
412Cc: Johannes Weiner <jweiner@redhat.com>
413Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
414Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
415Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
416---
417 mm/compaction.c | 3 ---
418 1 files changed, 0 insertions(+), 3 deletions(-)
419
420diff --git a/mm/compaction.c b/mm/compaction.c
421index 50f1c60..b81625d 100644
422--- a/mm/compaction.c
423+++ b/mm/compaction.c
424@@ -371,9 +371,6 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
425 continue;
426 }
427
428- if (!cc->sync)
429- mode |= ISOLATE_CLEAN;
430-
431 /* Try isolate the page */
432 if (__isolate_lru_page(page, mode, 0) != 0)
433 continue;
434--
4351.7.7.6
436
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0003-mm-compaction-determine-if-dirty-pages-can-be-migrat.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0003-mm-compaction-determine-if-dirty-pages-can-be-migrat.patch
new file mode 100644
index 00000000..b6a461b0
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0003-mm-compaction-determine-if-dirty-pages-can-be-migrat.patch
@@ -0,0 +1,376 @@
1From 45d9f4db29d9a2f44900c90ab81514c7e04cb1b9 Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:34 -0800
4Subject: [PATCH 03/73] mm: compaction: determine if dirty pages can be
5 migrated without blocking within ->migratepage
6
7commit b969c4ab9f182a6e1b2a0848be349f99714947b0 upstream.
8
9Stable note: Not tracked in Bugzilla. A fix aimed at preserving page
10 aging information by reducing LRU list churning had the side-effect
11 of reducing THP allocation success rates. This was part of a series
12 to restore the success rates while preserving the reclaim fix.
13
14Asynchronous compaction is used when allocating transparent hugepages to
15avoid blocking for long periods of time. Due to reports of stalling,
16there was a debate on disabling synchronous compaction but this severely
17impacted allocation success rates. Part of the reason was that many dirty
18pages are skipped in asynchronous compaction by the following check;
19
20 if (PageDirty(page) && !sync &&
21 mapping->a_ops->migratepage != migrate_page)
22 rc = -EBUSY;
23
24This skips over all mapping aops using buffer_migrate_page() even though
25it is possible to migrate some of these pages without blocking. This
26patch updates the ->migratepage callback with a "sync" parameter. It is
27the responsibility of the callback to fail gracefully if migration would
28block.
29
30Signed-off-by: Mel Gorman <mgorman@suse.de>
31Reviewed-by: Rik van Riel <riel@redhat.com>
32Cc: Andrea Arcangeli <aarcange@redhat.com>
33Cc: Minchan Kim <minchan.kim@gmail.com>
34Cc: Dave Jones <davej@redhat.com>
35Cc: Jan Kara <jack@suse.cz>
36Cc: Andy Isaacson <adi@hexapodia.org>
37Cc: Nai Xia <nai.xia@gmail.com>
38Cc: Johannes Weiner <jweiner@redhat.com>
39Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
40Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
41Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
42---
43 fs/btrfs/disk-io.c | 4 +-
44 fs/hugetlbfs/inode.c | 3 +-
45 fs/nfs/internal.h | 2 +-
46 fs/nfs/write.c | 4 +-
47 include/linux/fs.h | 9 ++-
48 include/linux/migrate.h | 2 +-
49 mm/migrate.c | 129 +++++++++++++++++++++++++++++++++-------------
50 7 files changed, 106 insertions(+), 47 deletions(-)
51
52diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
53index f44b392..fa7cddf 100644
54--- a/fs/btrfs/disk-io.c
55+++ b/fs/btrfs/disk-io.c
56@@ -872,7 +872,7 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
57
58 #ifdef CONFIG_MIGRATION
59 static int btree_migratepage(struct address_space *mapping,
60- struct page *newpage, struct page *page)
61+ struct page *newpage, struct page *page, bool sync)
62 {
63 /*
64 * we can't safely write a btree page from here,
65@@ -887,7 +887,7 @@ static int btree_migratepage(struct address_space *mapping,
66 if (page_has_private(page) &&
67 !try_to_release_page(page, GFP_KERNEL))
68 return -EAGAIN;
69- return migrate_page(mapping, newpage, page);
70+ return migrate_page(mapping, newpage, page, sync);
71 }
72 #endif
73
74diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
75index ebc2f4d..217b771 100644
76--- a/fs/hugetlbfs/inode.c
77+++ b/fs/hugetlbfs/inode.c
78@@ -569,7 +569,8 @@ static int hugetlbfs_set_page_dirty(struct page *page)
79 }
80
81 static int hugetlbfs_migrate_page(struct address_space *mapping,
82- struct page *newpage, struct page *page)
83+ struct page *newpage, struct page *page,
84+ bool sync)
85 {
86 int rc;
87
88diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
89index 3f4d957..8d96ed6 100644
90--- a/fs/nfs/internal.h
91+++ b/fs/nfs/internal.h
92@@ -330,7 +330,7 @@ void nfs_commit_release_pages(struct nfs_write_data *data);
93
94 #ifdef CONFIG_MIGRATION
95 extern int nfs_migrate_page(struct address_space *,
96- struct page *, struct page *);
97+ struct page *, struct page *, bool);
98 #else
99 #define nfs_migrate_page NULL
100 #endif
101diff --git a/fs/nfs/write.c b/fs/nfs/write.c
102index 4efd421..31b2461 100644
103--- a/fs/nfs/write.c
104+++ b/fs/nfs/write.c
105@@ -1711,7 +1711,7 @@ out_error:
106
107 #ifdef CONFIG_MIGRATION
108 int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
109- struct page *page)
110+ struct page *page, bool sync)
111 {
112 /*
113 * If PagePrivate is set, then the page is currently associated with
114@@ -1726,7 +1726,7 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
115
116 nfs_fscache_release_page(page, GFP_KERNEL);
117
118- return migrate_page(mapping, newpage, page);
119+ return migrate_page(mapping, newpage, page, sync);
120 }
121 #endif
122
123diff --git a/include/linux/fs.h b/include/linux/fs.h
124index 43d36b7..2ae90d3 100644
125--- a/include/linux/fs.h
126+++ b/include/linux/fs.h
127@@ -609,9 +609,12 @@ struct address_space_operations {
128 loff_t offset, unsigned long nr_segs);
129 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
130 void **, unsigned long *);
131- /* migrate the contents of a page to the specified target */
132+ /*
133+ * migrate the contents of a page to the specified target. If sync
134+ * is false, it must not block.
135+ */
136 int (*migratepage) (struct address_space *,
137- struct page *, struct page *);
138+ struct page *, struct page *, bool);
139 int (*launder_page) (struct page *);
140 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
141 unsigned long);
142@@ -2586,7 +2589,7 @@ extern int generic_check_addressable(unsigned, u64);
143
144 #ifdef CONFIG_MIGRATION
145 extern int buffer_migrate_page(struct address_space *,
146- struct page *, struct page *);
147+ struct page *, struct page *, bool);
148 #else
149 #define buffer_migrate_page NULL
150 #endif
151diff --git a/include/linux/migrate.h b/include/linux/migrate.h
152index e39aeec..14e6d2a 100644
153--- a/include/linux/migrate.h
154+++ b/include/linux/migrate.h
155@@ -11,7 +11,7 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
156
157 extern void putback_lru_pages(struct list_head *l);
158 extern int migrate_page(struct address_space *,
159- struct page *, struct page *);
160+ struct page *, struct page *, bool);
161 extern int migrate_pages(struct list_head *l, new_page_t x,
162 unsigned long private, bool offlining,
163 bool sync);
164diff --git a/mm/migrate.c b/mm/migrate.c
165index 177aca4..65c12d2 100644
166--- a/mm/migrate.c
167+++ b/mm/migrate.c
168@@ -220,6 +220,55 @@ out:
169 pte_unmap_unlock(ptep, ptl);
170 }
171
172+#ifdef CONFIG_BLOCK
173+/* Returns true if all buffers are successfully locked */
174+static bool buffer_migrate_lock_buffers(struct buffer_head *head, bool sync)
175+{
176+ struct buffer_head *bh = head;
177+
178+ /* Simple case, sync compaction */
179+ if (sync) {
180+ do {
181+ get_bh(bh);
182+ lock_buffer(bh);
183+ bh = bh->b_this_page;
184+
185+ } while (bh != head);
186+
187+ return true;
188+ }
189+
190+ /* async case, we cannot block on lock_buffer so use trylock_buffer */
191+ do {
192+ get_bh(bh);
193+ if (!trylock_buffer(bh)) {
194+ /*
195+ * We failed to lock the buffer and cannot stall in
196+ * async migration. Release the taken locks
197+ */
198+ struct buffer_head *failed_bh = bh;
199+ put_bh(failed_bh);
200+ bh = head;
201+ while (bh != failed_bh) {
202+ unlock_buffer(bh);
203+ put_bh(bh);
204+ bh = bh->b_this_page;
205+ }
206+ return false;
207+ }
208+
209+ bh = bh->b_this_page;
210+ } while (bh != head);
211+ return true;
212+}
213+#else
214+static inline bool buffer_migrate_lock_buffers(struct buffer_head *head,
215+ bool sync)
216+{
217+ return true;
218+}
219+#endif /* CONFIG_BLOCK */
220+
221 /*
222 * Replace the page in the mapping.
223 *
224@@ -229,7 +278,8 @@ out:
225 * 3 for pages with a mapping and PagePrivate/PagePrivate2 set.
226 */
227 static int migrate_page_move_mapping(struct address_space *mapping,
228- struct page *newpage, struct page *page)
229+ struct page *newpage, struct page *page,
230+ struct buffer_head *head, bool sync)
231 {
232 int expected_count;
233 void **pslot;
234@@ -259,6 +309,19 @@ static int migrate_page_move_mapping(struct address_space *mapping,
235 }
236
237 /*
238+ * In the async migration case of moving a page with buffers, lock the
239+ * buffers using trylock before the mapping is moved. If the mapping
240+ * was moved, we later failed to lock the buffers and could not move
241+ * the mapping back due to an elevated page count, we would have to
242+ * block waiting on other references to be dropped.
243+ */
244+ if (!sync && head && !buffer_migrate_lock_buffers(head, sync)) {
245+ page_unfreeze_refs(page, expected_count);
246+ spin_unlock_irq(&mapping->tree_lock);
247+ return -EAGAIN;
248+ }
249+
250+ /*
251 * Now we know that no one else is looking at the page.
252 */
253 get_page(newpage); /* add cache reference */
254@@ -415,13 +478,13 @@ EXPORT_SYMBOL(fail_migrate_page);
255 * Pages are locked upon entry and exit.
256 */
257 int migrate_page(struct address_space *mapping,
258- struct page *newpage, struct page *page)
259+ struct page *newpage, struct page *page, bool sync)
260 {
261 int rc;
262
263 BUG_ON(PageWriteback(page)); /* Writeback must be complete */
264
265- rc = migrate_page_move_mapping(mapping, newpage, page);
266+ rc = migrate_page_move_mapping(mapping, newpage, page, NULL, sync);
267
268 if (rc)
269 return rc;
270@@ -438,28 +501,28 @@ EXPORT_SYMBOL(migrate_page);
271 * exist.
272 */
273 int buffer_migrate_page(struct address_space *mapping,
274- struct page *newpage, struct page *page)
275+ struct page *newpage, struct page *page, bool sync)
276 {
277 struct buffer_head *bh, *head;
278 int rc;
279
280 if (!page_has_buffers(page))
281- return migrate_page(mapping, newpage, page);
282+ return migrate_page(mapping, newpage, page, sync);
283
284 head = page_buffers(page);
285
286- rc = migrate_page_move_mapping(mapping, newpage, page);
287+ rc = migrate_page_move_mapping(mapping, newpage, page, head, sync);
288
289 if (rc)
290 return rc;
291
292- bh = head;
293- do {
294- get_bh(bh);
295- lock_buffer(bh);
296- bh = bh->b_this_page;
297-
298- } while (bh != head);
299+ /*
300+ * In the async case, migrate_page_move_mapping locked the buffers
301+ * with an IRQ-safe spinlock held. In the sync case, the buffers
302+ * need to be locked now
303+ */
304+ if (sync)
305+ BUG_ON(!buffer_migrate_lock_buffers(head, sync));
306
307 ClearPagePrivate(page);
308 set_page_private(newpage, page_private(page));
309@@ -536,10 +599,13 @@ static int writeout(struct address_space *mapping, struct page *page)
310 * Default handling if a filesystem does not provide a migration function.
311 */
312 static int fallback_migrate_page(struct address_space *mapping,
313- struct page *newpage, struct page *page)
314+ struct page *newpage, struct page *page, bool sync)
315 {
316- if (PageDirty(page))
317+ if (PageDirty(page)) {
318+ if (!sync)
319+ return -EBUSY;
320 return writeout(mapping, page);
321+ }
322
323 /*
324 * Buffers may be managed in a filesystem specific way.
325@@ -549,7 +615,7 @@ static int fallback_migrate_page(struct address_space *mapping,
326 !try_to_release_page(page, GFP_KERNEL))
327 return -EAGAIN;
328
329- return migrate_page(mapping, newpage, page);
330+ return migrate_page(mapping, newpage, page, sync);
331 }
332
333 /*
334@@ -585,29 +651,18 @@ static int move_to_new_page(struct page *newpage, struct page *page,
335
336 mapping = page_mapping(page);
337 if (!mapping)
338- rc = migrate_page(mapping, newpage, page);
339- else {
340+ rc = migrate_page(mapping, newpage, page, sync);
341+ else if (mapping->a_ops->migratepage)
342 /*
343- * Do not writeback pages if !sync and migratepage is
344- * not pointing to migrate_page() which is nonblocking
345- * (swapcache/tmpfs uses migratepage = migrate_page).
346+ * Most pages have a mapping and most filesystems provide a
347+ * migratepage callback. Anonymous pages are part of swap
348+ * space which also has its own migratepage callback. This
349+ * is the most common path for page migration.
350 */
351- if (PageDirty(page) && !sync &&
352- mapping->a_ops->migratepage != migrate_page)
353- rc = -EBUSY;
354- else if (mapping->a_ops->migratepage)
355- /*
356- * Most pages have a mapping and most filesystems
357- * should provide a migration function. Anonymous
358- * pages are part of swap space which also has its
359- * own migration function. This is the most common
360- * path for page migration.
361- */
362- rc = mapping->a_ops->migratepage(mapping,
363- newpage, page);
364- else
365- rc = fallback_migrate_page(mapping, newpage, page);
366- }
367+ rc = mapping->a_ops->migratepage(mapping,
368+ newpage, page, sync);
369+ else
370+ rc = fallback_migrate_page(mapping, newpage, page, sync);
371
372 if (rc) {
373 newpage->mapping = NULL;
374--
3751.7.7.6
376
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch
new file mode 100644
index 00000000..7d71a05f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0004-mm-page-allocator-do-not-call-direct-reclaim-for-THP.patch
@@ -0,0 +1,143 @@
1From 246126d86b5c74067beda5a972d4c0e1a03ec9ef Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:41 -0800
4Subject: [PATCH 04/73] mm: page allocator: do not call direct reclaim for THP
5 allocations while compaction is deferred
6
7commit 66199712e9eef5aede09dbcd9dfff87798a66917 upstream.
8
9Stable note: Not tracked in Buzilla. This was part of a series that
10 reduced interactivity stalls experienced when THP was enabled.
11
12If compaction is deferred, direct reclaim is used to try to free enough
13pages for the allocation to succeed. For small high-orders, this has a
14reasonable chance of success. However, if the caller has specified
15__GFP_NO_KSWAPD to limit the disruption to the system, it makes more sense
16to fail the allocation rather than stall the caller in direct reclaim.
17This patch skips direct reclaim if compaction is deferred and the caller
18specifies __GFP_NO_KSWAPD.
19
20Async compaction only considers a subset of pages so it is possible for
21compaction to be deferred prematurely and not enter direct reclaim even in
22cases where it should. To compensate for this, this patch also defers
23compaction only if sync compaction failed.
24
25Signed-off-by: Mel Gorman <mgorman@suse.de>
26Acked-by: Minchan Kim <minchan.kim@gmail.com>
27Reviewed-by: Rik van Riel<riel@redhat.com>
28Cc: Andrea Arcangeli <aarcange@redhat.com>
29Cc: Dave Jones <davej@redhat.com>
30Cc: Jan Kara <jack@suse.cz>
31Cc: Andy Isaacson <adi@hexapodia.org>
32Cc: Nai Xia <nai.xia@gmail.com>
33Cc: Johannes Weiner <jweiner@redhat.com>
34Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
35Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
36Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
37---
38 mm/page_alloc.c | 45 +++++++++++++++++++++++++++++++++++----------
39 1 files changed, 35 insertions(+), 10 deletions(-)
40
41diff --git a/mm/page_alloc.c b/mm/page_alloc.c
42index cb3460e..ef6e1a1 100644
43--- a/mm/page_alloc.c
44+++ b/mm/page_alloc.c
45@@ -1886,14 +1886,20 @@ static struct page *
46 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
47 struct zonelist *zonelist, enum zone_type high_zoneidx,
48 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
49- int migratetype, unsigned long *did_some_progress,
50- bool sync_migration)
51+ int migratetype, bool sync_migration,
52+ bool *deferred_compaction,
53+ unsigned long *did_some_progress)
54 {
55 struct page *page;
56
57- if (!order || compaction_deferred(preferred_zone))
58+ if (!order)
59 return NULL;
60
61+ if (compaction_deferred(preferred_zone)) {
62+ *deferred_compaction = true;
63+ return NULL;
64+ }
65+
66 current->flags |= PF_MEMALLOC;
67 *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask,
68 nodemask, sync_migration);
69@@ -1921,7 +1927,13 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
70 * but not enough to satisfy watermarks.
71 */
72 count_vm_event(COMPACTFAIL);
73- defer_compaction(preferred_zone);
74+
75+ /*
76+ * As async compaction considers a subset of pageblocks, only
77+ * defer if the failure was a sync compaction failure.
78+ */
79+ if (sync_migration)
80+ defer_compaction(preferred_zone);
81
82 cond_resched();
83 }
84@@ -1933,8 +1945,9 @@ static inline struct page *
85 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
86 struct zonelist *zonelist, enum zone_type high_zoneidx,
87 nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
88- int migratetype, unsigned long *did_some_progress,
89- bool sync_migration)
90+ int migratetype, bool sync_migration,
91+ bool *deferred_compaction,
92+ unsigned long *did_some_progress)
93 {
94 return NULL;
95 }
96@@ -2084,6 +2097,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
97 unsigned long pages_reclaimed = 0;
98 unsigned long did_some_progress;
99 bool sync_migration = false;
100+ bool deferred_compaction = false;
101
102 /*
103 * In the slowpath, we sanity check order to avoid ever trying to
104@@ -2164,12 +2178,22 @@ rebalance:
105 zonelist, high_zoneidx,
106 nodemask,
107 alloc_flags, preferred_zone,
108- migratetype, &did_some_progress,
109- sync_migration);
110+ migratetype, sync_migration,
111+ &deferred_compaction,
112+ &did_some_progress);
113 if (page)
114 goto got_pg;
115 sync_migration = true;
116
117+ /*
118+ * If compaction is deferred for high-order allocations, it is because
119+ * sync compaction recently failed. In this is the case and the caller
120+ * has requested the system not be heavily disrupted, fail the
121+ * allocation now instead of entering direct reclaim
122+ */
123+ if (deferred_compaction && (gfp_mask & __GFP_NO_KSWAPD))
124+ goto nopage;
125+
126 /* Try direct reclaim and then allocating */
127 page = __alloc_pages_direct_reclaim(gfp_mask, order,
128 zonelist, high_zoneidx,
129@@ -2232,8 +2256,9 @@ rebalance:
130 zonelist, high_zoneidx,
131 nodemask,
132 alloc_flags, preferred_zone,
133- migratetype, &did_some_progress,
134- sync_migration);
135+ migratetype, sync_migration,
136+ &deferred_compaction,
137+ &did_some_progress);
138 if (page)
139 goto got_pg;
140 }
141--
1421.7.7.6
143
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0005-mm-compaction-make-isolate_lru_page-filter-aware-aga.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0005-mm-compaction-make-isolate_lru_page-filter-aware-aga.patch
new file mode 100644
index 00000000..1cf5109f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0005-mm-compaction-make-isolate_lru_page-filter-aware-aga.patch
@@ -0,0 +1,117 @@
1From 67c64d699499fd5b83ca0be6f66eaca18cc29601 Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:38 -0800
4Subject: [PATCH 05/73] mm: compaction: make isolate_lru_page() filter-aware
5 again
6
7commit c82449352854ff09e43062246af86bdeb628f0c3 upstream.
8
9Stable note: Not tracked in Bugzilla. A fix aimed at preserving page aging
10 information by reducing LRU list churning had the side-effect of
11 reducing THP allocation success rates. This was part of a series
12 to restore the success rates while preserving the reclaim fix.
13
14Commit 39deaf85 ("mm: compaction: make isolate_lru_page() filter-aware")
15noted that compaction does not migrate dirty or writeback pages and that
16is was meaningless to pick the page and re-add it to the LRU list. This
17had to be partially reverted because some dirty pages can be migrated by
18compaction without blocking.
19
20This patch updates "mm: compaction: make isolate_lru_page" by skipping
21over pages that migration has no possibility of migrating to minimise LRU
22disruption.
23
24Signed-off-by: Mel Gorman <mgorman@suse.de>
25Reviewed-by: Rik van Riel<riel@redhat.com>
26Cc: Andrea Arcangeli <aarcange@redhat.com>
27Reviewed-by: Minchan Kim <minchan@kernel.org>
28Cc: Dave Jones <davej@redhat.com>
29Cc: Jan Kara <jack@suse.cz>
30Cc: Andy Isaacson <adi@hexapodia.org>
31Cc: Nai Xia <nai.xia@gmail.com>
32Cc: Johannes Weiner <jweiner@redhat.com>
33Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
34Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
35Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
36---
37 include/linux/mmzone.h | 2 ++
38 mm/compaction.c | 3 +++
39 mm/vmscan.c | 35 +++++++++++++++++++++++++++++++++--
40 3 files changed, 38 insertions(+), 2 deletions(-)
41
42diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
43index 905b1e1..25842b6 100644
44--- a/include/linux/mmzone.h
45+++ b/include/linux/mmzone.h
46@@ -173,6 +173,8 @@ static inline int is_unevictable_lru(enum lru_list l)
47 #define ISOLATE_CLEAN ((__force isolate_mode_t)0x4)
48 /* Isolate unmapped file */
49 #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8)
50+/* Isolate for asynchronous migration */
51+#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x10)
52
53 /* LRU Isolation modes. */
54 typedef unsigned __bitwise__ isolate_mode_t;
55diff --git a/mm/compaction.c b/mm/compaction.c
56index b81625d..979a919 100644
57--- a/mm/compaction.c
58+++ b/mm/compaction.c
59@@ -371,6 +371,9 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
60 continue;
61 }
62
63+ if (!cc->sync)
64+ mode |= ISOLATE_ASYNC_MIGRATE;
65+
66 /* Try isolate the page */
67 if (__isolate_lru_page(page, mode, 0) != 0)
68 continue;
69diff --git a/mm/vmscan.c b/mm/vmscan.c
70index 8342119..1b95e4c 100644
71--- a/mm/vmscan.c
72+++ b/mm/vmscan.c
73@@ -1061,8 +1061,39 @@ int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file)
74
75 ret = -EBUSY;
76
77- if ((mode & ISOLATE_CLEAN) && (PageDirty(page) || PageWriteback(page)))
78- return ret;
79+ /*
80+ * To minimise LRU disruption, the caller can indicate that it only
81+ * wants to isolate pages it will be able to operate on without
82+ * blocking - clean pages for the most part.
83+ *
84+ * ISOLATE_CLEAN means that only clean pages should be isolated. This
85+ * is used by reclaim when it is cannot write to backing storage
86+ *
87+ * ISOLATE_ASYNC_MIGRATE is used to indicate that it only wants to pages
88+ * that it is possible to migrate without blocking
89+ */
90+ if (mode & (ISOLATE_CLEAN|ISOLATE_ASYNC_MIGRATE)) {
91+ /* All the caller can do on PageWriteback is block */
92+ if (PageWriteback(page))
93+ return ret;
94+
95+ if (PageDirty(page)) {
96+ struct address_space *mapping;
97+
98+ /* ISOLATE_CLEAN means only clean pages */
99+ if (mode & ISOLATE_CLEAN)
100+ return ret;
101+
102+ /*
103+ * Only pages without mappings or that have a
104+ * ->migratepage callback are possible to migrate
105+ * without blocking
106+ */
107+ mapping = page_mapping(page);
108+ if (mapping && !mapping->a_ops->migratepage)
109+ return ret;
110+ }
111+ }
112
113 if ((mode & ISOLATE_UNMAPPED) && page_mapped(page))
114 return ret;
115--
1161.7.7.6
117
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0006-mm-compaction-introduce-sync-light-migration-for-use.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0006-mm-compaction-introduce-sync-light-migration-for-use.patch
new file mode 100644
index 00000000..25e33ab4
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0006-mm-compaction-introduce-sync-light-migration-for-use.patch
@@ -0,0 +1,547 @@
1From 0fe5ee08804cfadf02801cf6d82f0e2594cd04bd Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:43 -0800
4Subject: [PATCH 06/73] mm: compaction: introduce sync-light migration for use
5 by compaction
6
7commit a6bc32b899223a877f595ef9ddc1e89ead5072b8 upstream.
8
9Stable note: Not tracked in Buzilla. This was part of a series that
10 reduced interactivity stalls experienced when THP was enabled.
11 These stalls were particularly noticable when copying data
12 to a USB stick but the experiences for users varied a lot.
13
14This patch adds a lightweight sync migrate operation MIGRATE_SYNC_LIGHT
15mode that avoids writing back pages to backing storage. Async compaction
16maps to MIGRATE_ASYNC while sync compaction maps to MIGRATE_SYNC_LIGHT.
17For other migrate_pages users such as memory hotplug, MIGRATE_SYNC is
18used.
19
20This avoids sync compaction stalling for an excessive length of time,
21particularly when copying files to a USB stick where there might be a
22large number of dirty pages backed by a filesystem that does not support
23->writepages.
24
25[aarcange@redhat.com: This patch is heavily based on Andrea's work]
26[akpm@linux-foundation.org: fix fs/nfs/write.c build]
27[akpm@linux-foundation.org: fix fs/btrfs/disk-io.c build]
28Signed-off-by: Mel Gorman <mgorman@suse.de>
29Reviewed-by: Rik van Riel <riel@redhat.com>
30Cc: Andrea Arcangeli <aarcange@redhat.com>
31Cc: Minchan Kim <minchan.kim@gmail.com>
32Cc: Dave Jones <davej@redhat.com>
33Cc: Jan Kara <jack@suse.cz>
34Cc: Andy Isaacson <adi@hexapodia.org>
35Cc: Nai Xia <nai.xia@gmail.com>
36Cc: Johannes Weiner <jweiner@redhat.com>
37Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
38Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
39Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
40---
41 fs/btrfs/disk-io.c | 5 ++-
42 fs/hugetlbfs/inode.c | 2 +-
43 fs/nfs/internal.h | 2 +-
44 fs/nfs/write.c | 4 +-
45 include/linux/fs.h | 6 ++-
46 include/linux/migrate.h | 23 +++++++++++---
47 mm/compaction.c | 2 +-
48 mm/memory-failure.c | 2 +-
49 mm/memory_hotplug.c | 2 +-
50 mm/mempolicy.c | 2 +-
51 mm/migrate.c | 78 ++++++++++++++++++++++++++---------------------
52 11 files changed, 76 insertions(+), 52 deletions(-)
53
54diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
55index fa7cddf..6b2a724 100644
56--- a/fs/btrfs/disk-io.c
57+++ b/fs/btrfs/disk-io.c
58@@ -872,7 +872,8 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
59
60 #ifdef CONFIG_MIGRATION
61 static int btree_migratepage(struct address_space *mapping,
62- struct page *newpage, struct page *page, bool sync)
63+ struct page *newpage, struct page *page,
64+ enum migrate_mode mode)
65 {
66 /*
67 * we can't safely write a btree page from here,
68@@ -887,7 +888,7 @@ static int btree_migratepage(struct address_space *mapping,
69 if (page_has_private(page) &&
70 !try_to_release_page(page, GFP_KERNEL))
71 return -EAGAIN;
72- return migrate_page(mapping, newpage, page, sync);
73+ return migrate_page(mapping, newpage, page, mode);
74 }
75 #endif
76
77diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
78index 217b771..0aa424a 100644
79--- a/fs/hugetlbfs/inode.c
80+++ b/fs/hugetlbfs/inode.c
81@@ -570,7 +570,7 @@ static int hugetlbfs_set_page_dirty(struct page *page)
82
83 static int hugetlbfs_migrate_page(struct address_space *mapping,
84 struct page *newpage, struct page *page,
85- bool sync)
86+ enum migrate_mode mode)
87 {
88 int rc;
89
90diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
91index 8d96ed6..68b3f20 100644
92--- a/fs/nfs/internal.h
93+++ b/fs/nfs/internal.h
94@@ -330,7 +330,7 @@ void nfs_commit_release_pages(struct nfs_write_data *data);
95
96 #ifdef CONFIG_MIGRATION
97 extern int nfs_migrate_page(struct address_space *,
98- struct page *, struct page *, bool);
99+ struct page *, struct page *, enum migrate_mode);
100 #else
101 #define nfs_migrate_page NULL
102 #endif
103diff --git a/fs/nfs/write.c b/fs/nfs/write.c
104index 31b2461..c6e523a 100644
105--- a/fs/nfs/write.c
106+++ b/fs/nfs/write.c
107@@ -1711,7 +1711,7 @@ out_error:
108
109 #ifdef CONFIG_MIGRATION
110 int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
111- struct page *page, bool sync)
112+ struct page *page, enum migrate_mode mode)
113 {
114 /*
115 * If PagePrivate is set, then the page is currently associated with
116@@ -1726,7 +1726,7 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
117
118 nfs_fscache_release_page(page, GFP_KERNEL);
119
120- return migrate_page(mapping, newpage, page, sync);
121+ return migrate_page(mapping, newpage, page, mode);
122 }
123 #endif
124
125diff --git a/include/linux/fs.h b/include/linux/fs.h
126index 2ae90d3..29b6353 100644
127--- a/include/linux/fs.h
128+++ b/include/linux/fs.h
129@@ -525,6 +525,7 @@ enum positive_aop_returns {
130 struct page;
131 struct address_space;
132 struct writeback_control;
133+enum migrate_mode;
134
135 struct iov_iter {
136 const struct iovec *iov;
137@@ -614,7 +615,7 @@ struct address_space_operations {
138 * is false, it must not block.
139 */
140 int (*migratepage) (struct address_space *,
141- struct page *, struct page *, bool);
142+ struct page *, struct page *, enum migrate_mode);
143 int (*launder_page) (struct page *);
144 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
145 unsigned long);
146@@ -2589,7 +2590,8 @@ extern int generic_check_addressable(unsigned, u64);
147
148 #ifdef CONFIG_MIGRATION
149 extern int buffer_migrate_page(struct address_space *,
150- struct page *, struct page *, bool);
151+ struct page *, struct page *,
152+ enum migrate_mode);
153 #else
154 #define buffer_migrate_page NULL
155 #endif
156diff --git a/include/linux/migrate.h b/include/linux/migrate.h
157index 14e6d2a..eaf8674 100644
158--- a/include/linux/migrate.h
159+++ b/include/linux/migrate.h
160@@ -6,18 +6,31 @@
161
162 typedef struct page *new_page_t(struct page *, unsigned long private, int **);
163
164+/*
165+ * MIGRATE_ASYNC means never block
166+ * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
167+ * on most operations but not ->writepage as the potential stall time
168+ * is too significant
169+ * MIGRATE_SYNC will block when migrating pages
170+ */
171+enum migrate_mode {
172+ MIGRATE_ASYNC,
173+ MIGRATE_SYNC_LIGHT,
174+ MIGRATE_SYNC,
175+};
176+
177 #ifdef CONFIG_MIGRATION
178 #define PAGE_MIGRATION 1
179
180 extern void putback_lru_pages(struct list_head *l);
181 extern int migrate_page(struct address_space *,
182- struct page *, struct page *, bool);
183+ struct page *, struct page *, enum migrate_mode);
184 extern int migrate_pages(struct list_head *l, new_page_t x,
185 unsigned long private, bool offlining,
186- bool sync);
187+ enum migrate_mode mode);
188 extern int migrate_huge_pages(struct list_head *l, new_page_t x,
189 unsigned long private, bool offlining,
190- bool sync);
191+ enum migrate_mode mode);
192
193 extern int fail_migrate_page(struct address_space *,
194 struct page *, struct page *);
195@@ -36,10 +49,10 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
196 static inline void putback_lru_pages(struct list_head *l) {}
197 static inline int migrate_pages(struct list_head *l, new_page_t x,
198 unsigned long private, bool offlining,
199- bool sync) { return -ENOSYS; }
200+ enum migrate_mode mode) { return -ENOSYS; }
201 static inline int migrate_huge_pages(struct list_head *l, new_page_t x,
202 unsigned long private, bool offlining,
203- bool sync) { return -ENOSYS; }
204+ enum migrate_mode mode) { return -ENOSYS; }
205
206 static inline int migrate_prep(void) { return -ENOSYS; }
207 static inline int migrate_prep_local(void) { return -ENOSYS; }
208diff --git a/mm/compaction.c b/mm/compaction.c
209index 979a919..46973fb 100644
210--- a/mm/compaction.c
211+++ b/mm/compaction.c
212@@ -577,7 +577,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
213 nr_migrate = cc->nr_migratepages;
214 err = migrate_pages(&cc->migratepages, compaction_alloc,
215 (unsigned long)cc, false,
216- cc->sync);
217+ cc->sync ? MIGRATE_SYNC_LIGHT : MIGRATE_ASYNC);
218 update_nr_listpages(cc);
219 nr_remaining = cc->nr_migratepages;
220
221diff --git a/mm/memory-failure.c b/mm/memory-failure.c
222index 06d3479..56080ea 100644
223--- a/mm/memory-failure.c
224+++ b/mm/memory-failure.c
225@@ -1557,7 +1557,7 @@ int soft_offline_page(struct page *page, int flags)
226 page_is_file_cache(page));
227 list_add(&page->lru, &pagelist);
228 ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
229- 0, true);
230+ 0, MIGRATE_SYNC);
231 if (ret) {
232 putback_lru_pages(&pagelist);
233 pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
234diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
235index 2168489..6629faf 100644
236--- a/mm/memory_hotplug.c
237+++ b/mm/memory_hotplug.c
238@@ -809,7 +809,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
239 }
240 /* this function returns # of failed pages */
241 ret = migrate_pages(&source, hotremove_migrate_alloc, 0,
242- true, true);
243+ true, MIGRATE_SYNC);
244 if (ret)
245 putback_lru_pages(&source);
246 }
247diff --git a/mm/mempolicy.c b/mm/mempolicy.c
248index b26aae2..f2650bc 100644
249--- a/mm/mempolicy.c
250+++ b/mm/mempolicy.c
251@@ -942,7 +942,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest,
252
253 if (!list_empty(&pagelist)) {
254 err = migrate_pages(&pagelist, new_node_page, dest,
255- false, true);
256+ false, MIGRATE_SYNC);
257 if (err)
258 putback_lru_pages(&pagelist);
259 }
260diff --git a/mm/migrate.c b/mm/migrate.c
261index 65c12d2..180d97f 100644
262--- a/mm/migrate.c
263+++ b/mm/migrate.c
264@@ -222,12 +222,13 @@ out:
265
266 #ifdef CONFIG_BLOCK
267 /* Returns true if all buffers are successfully locked */
268-static bool buffer_migrate_lock_buffers(struct buffer_head *head, bool sync)
269+static bool buffer_migrate_lock_buffers(struct buffer_head *head,
270+ enum migrate_mode mode)
271 {
272 struct buffer_head *bh = head;
273
274 /* Simple case, sync compaction */
275- if (sync) {
276+ if (mode != MIGRATE_ASYNC) {
277 do {
278 get_bh(bh);
279 lock_buffer(bh);
280@@ -263,7 +264,7 @@ static bool buffer_migrate_lock_buffers(struct buffer_head *head, bool sync)
281 }
282 #else
283 static inline bool buffer_migrate_lock_buffers(struct buffer_head *head,
284- bool sync)
285+ enum migrate_mode mode)
286 {
287 return true;
288 }
289@@ -279,7 +280,7 @@ static inline bool buffer_migrate_lock_buffers(struct buffer_head *head,
290 */
291 static int migrate_page_move_mapping(struct address_space *mapping,
292 struct page *newpage, struct page *page,
293- struct buffer_head *head, bool sync)
294+ struct buffer_head *head, enum migrate_mode mode)
295 {
296 int expected_count;
297 void **pslot;
298@@ -315,7 +316,8 @@ static int migrate_page_move_mapping(struct address_space *mapping,
299 * the mapping back due to an elevated page count, we would have to
300 * block waiting on other references to be dropped.
301 */
302- if (!sync && head && !buffer_migrate_lock_buffers(head, sync)) {
303+ if (mode == MIGRATE_ASYNC && head &&
304+ !buffer_migrate_lock_buffers(head, mode)) {
305 page_unfreeze_refs(page, expected_count);
306 spin_unlock_irq(&mapping->tree_lock);
307 return -EAGAIN;
308@@ -478,13 +480,14 @@ EXPORT_SYMBOL(fail_migrate_page);
309 * Pages are locked upon entry and exit.
310 */
311 int migrate_page(struct address_space *mapping,
312- struct page *newpage, struct page *page, bool sync)
313+ struct page *newpage, struct page *page,
314+ enum migrate_mode mode)
315 {
316 int rc;
317
318 BUG_ON(PageWriteback(page)); /* Writeback must be complete */
319
320- rc = migrate_page_move_mapping(mapping, newpage, page, NULL, sync);
321+ rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode);
322
323 if (rc)
324 return rc;
325@@ -501,17 +504,17 @@ EXPORT_SYMBOL(migrate_page);
326 * exist.
327 */
328 int buffer_migrate_page(struct address_space *mapping,
329- struct page *newpage, struct page *page, bool sync)
330+ struct page *newpage, struct page *page, enum migrate_mode mode)
331 {
332 struct buffer_head *bh, *head;
333 int rc;
334
335 if (!page_has_buffers(page))
336- return migrate_page(mapping, newpage, page, sync);
337+ return migrate_page(mapping, newpage, page, mode);
338
339 head = page_buffers(page);
340
341- rc = migrate_page_move_mapping(mapping, newpage, page, head, sync);
342+ rc = migrate_page_move_mapping(mapping, newpage, page, head, mode);
343
344 if (rc)
345 return rc;
346@@ -521,8 +524,8 @@ int buffer_migrate_page(struct address_space *mapping,
347 * with an IRQ-safe spinlock held. In the sync case, the buffers
348 * need to be locked now
349 */
350- if (sync)
351- BUG_ON(!buffer_migrate_lock_buffers(head, sync));
352+ if (mode != MIGRATE_ASYNC)
353+ BUG_ON(!buffer_migrate_lock_buffers(head, mode));
354
355 ClearPagePrivate(page);
356 set_page_private(newpage, page_private(page));
357@@ -599,10 +602,11 @@ static int writeout(struct address_space *mapping, struct page *page)
358 * Default handling if a filesystem does not provide a migration function.
359 */
360 static int fallback_migrate_page(struct address_space *mapping,
361- struct page *newpage, struct page *page, bool sync)
362+ struct page *newpage, struct page *page, enum migrate_mode mode)
363 {
364 if (PageDirty(page)) {
365- if (!sync)
366+ /* Only writeback pages in full synchronous migration */
367+ if (mode != MIGRATE_SYNC)
368 return -EBUSY;
369 return writeout(mapping, page);
370 }
371@@ -615,7 +619,7 @@ static int fallback_migrate_page(struct address_space *mapping,
372 !try_to_release_page(page, GFP_KERNEL))
373 return -EAGAIN;
374
375- return migrate_page(mapping, newpage, page, sync);
376+ return migrate_page(mapping, newpage, page, mode);
377 }
378
379 /*
380@@ -630,7 +634,7 @@ static int fallback_migrate_page(struct address_space *mapping,
381 * == 0 - success
382 */
383 static int move_to_new_page(struct page *newpage, struct page *page,
384- int remap_swapcache, bool sync)
385+ int remap_swapcache, enum migrate_mode mode)
386 {
387 struct address_space *mapping;
388 int rc;
389@@ -651,7 +655,7 @@ static int move_to_new_page(struct page *newpage, struct page *page,
390
391 mapping = page_mapping(page);
392 if (!mapping)
393- rc = migrate_page(mapping, newpage, page, sync);
394+ rc = migrate_page(mapping, newpage, page, mode);
395 else if (mapping->a_ops->migratepage)
396 /*
397 * Most pages have a mapping and most filesystems provide a
398@@ -660,9 +664,9 @@ static int move_to_new_page(struct page *newpage, struct page *page,
399 * is the most common path for page migration.
400 */
401 rc = mapping->a_ops->migratepage(mapping,
402- newpage, page, sync);
403+ newpage, page, mode);
404 else
405- rc = fallback_migrate_page(mapping, newpage, page, sync);
406+ rc = fallback_migrate_page(mapping, newpage, page, mode);
407
408 if (rc) {
409 newpage->mapping = NULL;
410@@ -677,7 +681,7 @@ static int move_to_new_page(struct page *newpage, struct page *page,
411 }
412
413 static int __unmap_and_move(struct page *page, struct page *newpage,
414- int force, bool offlining, bool sync)
415+ int force, bool offlining, enum migrate_mode mode)
416 {
417 int rc = -EAGAIN;
418 int remap_swapcache = 1;
419@@ -686,7 +690,7 @@ static int __unmap_and_move(struct page *page, struct page *newpage,
420 struct anon_vma *anon_vma = NULL;
421
422 if (!trylock_page(page)) {
423- if (!force || !sync)
424+ if (!force || mode == MIGRATE_ASYNC)
425 goto out;
426
427 /*
428@@ -732,10 +736,12 @@ static int __unmap_and_move(struct page *page, struct page *newpage,
429
430 if (PageWriteback(page)) {
431 /*
432- * For !sync, there is no point retrying as the retry loop
433- * is expected to be too short for PageWriteback to be cleared
434+ * Only in the case of a full syncronous migration is it
435+ * necessary to wait for PageWriteback. In the async case,
436+ * the retry loop is too short and in the sync-light case,
437+ * the overhead of stalling is too much
438 */
439- if (!sync) {
440+ if (mode != MIGRATE_SYNC) {
441 rc = -EBUSY;
442 goto uncharge;
443 }
444@@ -806,7 +812,7 @@ static int __unmap_and_move(struct page *page, struct page *newpage,
445
446 skip_unmap:
447 if (!page_mapped(page))
448- rc = move_to_new_page(newpage, page, remap_swapcache, sync);
449+ rc = move_to_new_page(newpage, page, remap_swapcache, mode);
450
451 if (rc && remap_swapcache)
452 remove_migration_ptes(page, page);
453@@ -829,7 +835,8 @@ out:
454 * to the newly allocated page in newpage.
455 */
456 static int unmap_and_move(new_page_t get_new_page, unsigned long private,
457- struct page *page, int force, bool offlining, bool sync)
458+ struct page *page, int force, bool offlining,
459+ enum migrate_mode mode)
460 {
461 int rc = 0;
462 int *result = NULL;
463@@ -847,7 +854,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
464 if (unlikely(split_huge_page(page)))
465 goto out;
466
467- rc = __unmap_and_move(page, newpage, force, offlining, sync);
468+ rc = __unmap_and_move(page, newpage, force, offlining, mode);
469 out:
470 if (rc != -EAGAIN) {
471 /*
472@@ -895,7 +902,8 @@ out:
473 */
474 static int unmap_and_move_huge_page(new_page_t get_new_page,
475 unsigned long private, struct page *hpage,
476- int force, bool offlining, bool sync)
477+ int force, bool offlining,
478+ enum migrate_mode mode)
479 {
480 int rc = 0;
481 int *result = NULL;
482@@ -908,7 +916,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
483 rc = -EAGAIN;
484
485 if (!trylock_page(hpage)) {
486- if (!force || !sync)
487+ if (!force || mode != MIGRATE_SYNC)
488 goto out;
489 lock_page(hpage);
490 }
491@@ -919,7 +927,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
492 try_to_unmap(hpage, TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS);
493
494 if (!page_mapped(hpage))
495- rc = move_to_new_page(new_hpage, hpage, 1, sync);
496+ rc = move_to_new_page(new_hpage, hpage, 1, mode);
497
498 if (rc)
499 remove_migration_ptes(hpage, hpage);
500@@ -962,7 +970,7 @@ out:
501 */
502 int migrate_pages(struct list_head *from,
503 new_page_t get_new_page, unsigned long private, bool offlining,
504- bool sync)
505+ enum migrate_mode mode)
506 {
507 int retry = 1;
508 int nr_failed = 0;
509@@ -983,7 +991,7 @@ int migrate_pages(struct list_head *from,
510
511 rc = unmap_and_move(get_new_page, private,
512 page, pass > 2, offlining,
513- sync);
514+ mode);
515
516 switch(rc) {
517 case -ENOMEM:
518@@ -1013,7 +1021,7 @@ out:
519
520 int migrate_huge_pages(struct list_head *from,
521 new_page_t get_new_page, unsigned long private, bool offlining,
522- bool sync)
523+ enum migrate_mode mode)
524 {
525 int retry = 1;
526 int nr_failed = 0;
527@@ -1030,7 +1038,7 @@ int migrate_huge_pages(struct list_head *from,
528
529 rc = unmap_and_move_huge_page(get_new_page,
530 private, page, pass > 2, offlining,
531- sync);
532+ mode);
533
534 switch(rc) {
535 case -ENOMEM:
536@@ -1159,7 +1167,7 @@ set_status:
537 err = 0;
538 if (!list_empty(&pagelist)) {
539 err = migrate_pages(&pagelist, new_page_node,
540- (unsigned long)pm, 0, true);
541+ (unsigned long)pm, 0, MIGRATE_SYNC);
542 if (err)
543 putback_lru_pages(&pagelist);
544 }
545--
5461.7.7.6
547
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch
new file mode 100644
index 00000000..a3746f10
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0007-mm-vmscan-when-reclaiming-for-compaction-ensure-ther.patch
@@ -0,0 +1,120 @@
1From 70bd5ad826ce15eedd0434f9926730716a1d5c53 Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:45 -0800
4Subject: [PATCH 07/73] mm: vmscan: when reclaiming for compaction, ensure
5 there are sufficient free pages available
6
7commit fe4b1b244bdb96136855f2c694071cb09d140766 upstream.
8
9Stable note: Not tracked on Bugzilla. THP and compaction was found to
10 aggressively reclaim pages and stall systems under different
11 situations that was addressed piecemeal over time. This patch
12 addresses a problem where the fix regressed THP allocation
13 success rates.
14
15In commit e0887c19 ("vmscan: limit direct reclaim for higher order
16allocations"), Rik noted that reclaim was too aggressive when THP was
17enabled. In his initial patch he used the number of free pages to decide
18if reclaim should abort for compaction. My feedback was that reclaim and
19compaction should be using the same logic when deciding if reclaim should
20be aborted.
21
22Unfortunately, this had the effect of reducing THP success rates when the
23workload included something like streaming reads that continually
24allocated pages. The window during which compaction could run and return
25a THP was too small.
26
27This patch combines Rik's two patches together. compaction_suitable() is
28still used to decide if reclaim should be aborted to allow compaction is
29used. However, it will also ensure that there is a reasonable buffer of
30free pages available. This improves upon the THP allocation success rates
31but bounds the number of pages that are freed for compaction.
32
33Signed-off-by: Mel Gorman <mgorman@suse.de>
34Reviewed-by: Rik van Riel<riel@redhat.com>
35Cc: Andrea Arcangeli <aarcange@redhat.com>
36Cc: Minchan Kim <minchan.kim@gmail.com>
37Cc: Dave Jones <davej@redhat.com>
38Cc: Jan Kara <jack@suse.cz>
39Cc: Andy Isaacson <adi@hexapodia.org>
40Cc: Nai Xia <nai.xia@gmail.com>
41Cc: Johannes Weiner <jweiner@redhat.com>
42Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
43Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
44Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
45---
46 mm/vmscan.c | 44 +++++++++++++++++++++++++++++++++++++++-----
47 1 files changed, 39 insertions(+), 5 deletions(-)
48
49diff --git a/mm/vmscan.c b/mm/vmscan.c
50index 1b95e4c..fd47744 100644
51--- a/mm/vmscan.c
52+++ b/mm/vmscan.c
53@@ -2119,6 +2119,42 @@ restart:
54 throttle_vm_writeout(sc->gfp_mask);
55 }
56
57+/* Returns true if compaction should go ahead for a high-order request */
58+static inline bool compaction_ready(struct zone *zone, struct scan_control *sc)
59+{
60+ unsigned long balance_gap, watermark;
61+ bool watermark_ok;
62+
63+ /* Do not consider compaction for orders reclaim is meant to satisfy */
64+ if (sc->order <= PAGE_ALLOC_COSTLY_ORDER)
65+ return false;
66+
67+ /*
68+ * Compaction takes time to run and there are potentially other
69+ * callers using the pages just freed. Continue reclaiming until
70+ * there is a buffer of free pages available to give compaction
71+ * a reasonable chance of completing and allocating the page
72+ */
73+ balance_gap = min(low_wmark_pages(zone),
74+ (zone->present_pages + KSWAPD_ZONE_BALANCE_GAP_RATIO-1) /
75+ KSWAPD_ZONE_BALANCE_GAP_RATIO);
76+ watermark = high_wmark_pages(zone) + balance_gap + (2UL << sc->order);
77+ watermark_ok = zone_watermark_ok_safe(zone, 0, watermark, 0, 0);
78+
79+ /*
80+ * If compaction is deferred, reclaim up to a point where
81+ * compaction will have a chance of success when re-enabled
82+ */
83+ if (compaction_deferred(zone))
84+ return watermark_ok;
85+
86+ /* If compaction is not ready to start, keep reclaiming */
87+ if (!compaction_suitable(zone, sc->order))
88+ return false;
89+
90+ return watermark_ok;
91+}
92+
93 /*
94 * This is the direct reclaim path, for page-allocating processes. We only
95 * try to reclaim pages from zones which will satisfy the caller's allocation
96@@ -2136,8 +2172,8 @@ restart:
97 * scan then give up on it.
98 *
99 * This function returns true if a zone is being reclaimed for a costly
100- * high-order allocation and compaction is either ready to begin or deferred.
101- * This indicates to the caller that it should retry the allocation or fail.
102+ * high-order allocation and compaction is ready to begin. This indicates to
103+ * the caller that it should retry the allocation or fail.
104 */
105 static bool shrink_zones(int priority, struct zonelist *zonelist,
106 struct scan_control *sc)
107@@ -2171,9 +2207,7 @@ static bool shrink_zones(int priority, struct zonelist *zonelist,
108 * noticable problem, like transparent huge page
109 * allocations.
110 */
111- if (sc->order > PAGE_ALLOC_COSTLY_ORDER &&
112- (compaction_suitable(zone, sc->order) ||
113- compaction_deferred(zone))) {
114+ if (compaction_ready(zone, sc)) {
115 should_abort_reclaim = true;
116 continue;
117 }
118--
1191.7.7.6
120
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0008-mm-vmscan-do-not-OOM-if-aborting-reclaim-to-start-co.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0008-mm-vmscan-do-not-OOM-if-aborting-reclaim-to-start-co.patch
new file mode 100644
index 00000000..3531d783
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0008-mm-vmscan-do-not-OOM-if-aborting-reclaim-to-start-co.patch
@@ -0,0 +1,71 @@
1From c60330596c8497a94d53b80c5b96799b01846248 Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:33 -0800
4Subject: [PATCH 08/73] mm: vmscan: do not OOM if aborting reclaim to start
5 compaction
6
7commit 7335084d446b83cbcb15da80497d03f0c1dc9e21 upstream.
8
9Stable note: Not tracked in Bugzilla. This patch makes later patches
10 easier to apply but otherwise has little to justify it. The
11 problem it fixes was never observed but the source of the
12 theoretical problem did not exist for very long.
13
14During direct reclaim it is possible that reclaim will be aborted so that
15compaction can be attempted to satisfy a high-order allocation. If this
16decision is made before any pages are reclaimed, it is possible that 0 is
17returned to the page allocator potentially triggering an OOM. This has
18not been observed but it is a possibility so this patch addresses it.
19
20Signed-off-by: Mel Gorman <mgorman@suse.de>
21Reviewed-by: Rik van Riel <riel@redhat.com>
22Cc: Andrea Arcangeli <aarcange@redhat.com>
23Cc: Minchan Kim <minchan.kim@gmail.com>
24Cc: Dave Jones <davej@redhat.com>
25Cc: Jan Kara <jack@suse.cz>
26Cc: Andy Isaacson <adi@hexapodia.org>
27Cc: Nai Xia <nai.xia@gmail.com>
28Cc: Johannes Weiner <jweiner@redhat.com>
29Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
30Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
31Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
32---
33 mm/vmscan.c | 8 +++++++-
34 1 files changed, 7 insertions(+), 1 deletions(-)
35
36diff --git a/mm/vmscan.c b/mm/vmscan.c
37index fd47744..662a5ea 100644
38--- a/mm/vmscan.c
39+++ b/mm/vmscan.c
40@@ -2284,6 +2284,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
41 struct zoneref *z;
42 struct zone *zone;
43 unsigned long writeback_threshold;
44+ bool should_abort_reclaim;
45
46 get_mems_allowed();
47 delayacct_freepages_start();
48@@ -2295,7 +2296,8 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
49 sc->nr_scanned = 0;
50 if (!priority)
51 disable_swap_token(sc->mem_cgroup);
52- if (shrink_zones(priority, zonelist, sc))
53+ should_abort_reclaim = shrink_zones(priority, zonelist, sc);
54+ if (should_abort_reclaim)
55 break;
56
57 /*
58@@ -2363,6 +2365,10 @@ out:
59 if (oom_killer_disabled)
60 return 0;
61
62+ /* Aborting reclaim to try compaction? don't OOM, then */
63+ if (should_abort_reclaim)
64+ return 1;
65+
66 /* top priority shrink_zones still had more to do? don't OOM, then */
67 if (scanning_global_lru(sc) && !all_unreclaimable(zonelist, sc))
68 return 1;
69--
701.7.7.6
71
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0009-mm-vmscan-check-if-reclaim-should-really-abort-even-.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0009-mm-vmscan-check-if-reclaim-should-really-abort-even-.patch
new file mode 100644
index 00000000..76a434de
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0009-mm-vmscan-check-if-reclaim-should-really-abort-even-.patch
@@ -0,0 +1,119 @@
1From 0f7e2171b241704ee17ab27e4b8a7ef8c7f1dc32 Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Thu, 12 Jan 2012 17:19:49 -0800
4Subject: [PATCH 09/73] mm: vmscan: check if reclaim should really abort even
5 if compaction_ready() is true for one zone
6
7commit 0cee34fd72c582b4f8ad8ce00645b75fb4168199 upstream.
8
9Stable note: Not tracked on Bugzilla. THP and compaction was found to
10 aggressively reclaim pages and stall systems under different
11 situations that was addressed piecemeal over time.
12
13If compaction can proceed for a given zone, shrink_zones() does not
14reclaim any more pages from it. After commit [e0c2327: vmscan: abort
15reclaim/compaction if compaction can proceed], do_try_to_free_pages()
16tries to finish as soon as possible once one zone can compact.
17
18This was intended to prevent slabs being shrunk unnecessarily but there
19are side-effects. One is that a small zone that is ready for compaction
20will abort reclaim even if the chances of successfully allocating a THP
21from that zone is small. It also means that reclaim can return too early
22even though sc->nr_to_reclaim pages were not reclaimed.
23
24This partially reverts the commit until it is proven that slabs are really
25being shrunk unnecessarily but preserves the check to return 1 to avoid
26OOM if reclaim was aborted prematurely.
27
28[aarcange@redhat.com: This patch replaces a revert from Andrea]
29Signed-off-by: Mel Gorman <mgorman@suse.de>
30Reviewed-by: Rik van Riel <riel@redhat.com>
31Cc: Andrea Arcangeli <aarcange@redhat.com>
32Cc: Minchan Kim <minchan.kim@gmail.com>
33Cc: Dave Jones <davej@redhat.com>
34Cc: Jan Kara <jack@suse.cz>
35Cc: Andy Isaacson <adi@hexapodia.org>
36Cc: Nai Xia <nai.xia@gmail.com>
37Cc: Johannes Weiner <jweiner@redhat.com>
38Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
39Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
40Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
41---
42 mm/vmscan.c | 19 +++++++++----------
43 1 files changed, 9 insertions(+), 10 deletions(-)
44
45diff --git a/mm/vmscan.c b/mm/vmscan.c
46index 662a5ea..9e89de6 100644
47--- a/mm/vmscan.c
48+++ b/mm/vmscan.c
49@@ -2173,7 +2173,8 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc)
50 *
51 * This function returns true if a zone is being reclaimed for a costly
52 * high-order allocation and compaction is ready to begin. This indicates to
53- * the caller that it should retry the allocation or fail.
54+ * the caller that it should consider retrying the allocation instead of
55+ * further reclaim.
56 */
57 static bool shrink_zones(int priority, struct zonelist *zonelist,
58 struct scan_control *sc)
59@@ -2182,7 +2183,7 @@ static bool shrink_zones(int priority, struct zonelist *zonelist,
60 struct zone *zone;
61 unsigned long nr_soft_reclaimed;
62 unsigned long nr_soft_scanned;
63- bool should_abort_reclaim = false;
64+ bool aborted_reclaim = false;
65
66 for_each_zone_zonelist_nodemask(zone, z, zonelist,
67 gfp_zone(sc->gfp_mask), sc->nodemask) {
68@@ -2208,7 +2209,7 @@ static bool shrink_zones(int priority, struct zonelist *zonelist,
69 * allocations.
70 */
71 if (compaction_ready(zone, sc)) {
72- should_abort_reclaim = true;
73+ aborted_reclaim = true;
74 continue;
75 }
76 }
77@@ -2230,7 +2231,7 @@ static bool shrink_zones(int priority, struct zonelist *zonelist,
78 shrink_zone(priority, zone, sc);
79 }
80
81- return should_abort_reclaim;
82+ return aborted_reclaim;
83 }
84
85 static bool zone_reclaimable(struct zone *zone)
86@@ -2284,7 +2285,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
87 struct zoneref *z;
88 struct zone *zone;
89 unsigned long writeback_threshold;
90- bool should_abort_reclaim;
91+ bool aborted_reclaim;
92
93 get_mems_allowed();
94 delayacct_freepages_start();
95@@ -2296,9 +2297,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
96 sc->nr_scanned = 0;
97 if (!priority)
98 disable_swap_token(sc->mem_cgroup);
99- should_abort_reclaim = shrink_zones(priority, zonelist, sc);
100- if (should_abort_reclaim)
101- break;
102+ aborted_reclaim = shrink_zones(priority, zonelist, sc);
103
104 /*
105 * Don't shrink slabs when reclaiming memory from
106@@ -2365,8 +2364,8 @@ out:
107 if (oom_killer_disabled)
108 return 0;
109
110- /* Aborting reclaim to try compaction? don't OOM, then */
111- if (should_abort_reclaim)
112+ /* Aborted reclaim to try compaction? don't OOM, then */
113+ if (aborted_reclaim)
114 return 1;
115
116 /* top priority shrink_zones still had more to do? don't OOM, then */
117--
1181.7.7.6
119
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0010-vmscan-promote-shared-file-mapped-pages.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0010-vmscan-promote-shared-file-mapped-pages.patch
new file mode 100644
index 00000000..e1037d4e
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0010-vmscan-promote-shared-file-mapped-pages.patch
@@ -0,0 +1,82 @@
1From 2a487f6e48c8ee80432e512e3618a6837f6ff448 Mon Sep 17 00:00:00 2001
2From: Konstantin Khlebnikov <khlebnikov@openvz.org>
3Date: Tue, 10 Jan 2012 15:06:59 -0800
4Subject: [PATCH 10/73] vmscan: promote shared file mapped pages
5
6commit 34dbc67a644f11ab3475d822d72e25409911e760 upstream.
7
8Stable note: Not tracked in Bugzilla. There were reports of shared
9 mapped pages being unfairly reclaimed in comparison to older kernels.
10 This is being addressed over time. The specific workload being
11 addressed here in described in paragraph four and while paragraph
12 five says it did not help performance as such, it made a difference
13 to major page faults. I'm aware of at least one bug for a large
14 vendor that was due to increased major faults.
15
16Commit 645747462435 ("vmscan: detect mapped file pages used only once")
17greatly decreases lifetime of single-used mapped file pages.
18Unfortunately it also decreases life time of all shared mapped file
19pages. Because after commit bf3f3bc5e7347 ("mm: don't mark_page_accessed
20in fault path") page-fault handler does not mark page active or even
21referenced.
22
23Thus page_check_references() activates file page only if it was used twice
24while it stays in inactive list, meanwhile it activates anon pages after
25first access. Inactive list can be small enough, this way reclaimer can
26accidentally throw away any widely used page if it wasn't used twice in
27short period.
28
29After this patch page_check_references() also activate file mapped page at
30first inactive list scan if this page is already used multiple times via
31several ptes.
32
33I found this while trying to fix degragation in rhel6 (~2.6.32) from rhel5
34(~2.6.18). There a complete mess with >100 web/mail/spam/ftp containers,
35they share all their files but there a lot of anonymous pages: ~500mb
36shared file mapped memory and 15-20Gb non-shared anonymous memory. In
37this situation major-pagefaults are very costly, because all containers
38share the same page. In my load kernel created a disproportionate
39pressure on the file memory, compared with the anonymous, they equaled
40only if I raise swappiness up to 150 =)
41
42These patches actually wasn't helped a lot in my problem, but I saw
43noticable (10-20 times) reduce in count and average time of
44major-pagefault in file-mapped areas.
45
46Actually both patches are fixes for commit v2.6.33-5448-g6457474, because
47it was aimed at one scenario (singly used pages), but it breaks the logic
48in other scenarios (shared and/or executable pages)
49
50Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
51Acked-by: Pekka Enberg <penberg@kernel.org>
52Acked-by: Minchan Kim <minchan.kim@gmail.com>
53Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
54Cc: Wu Fengguang <fengguang.wu@intel.com>
55Cc: Johannes Weiner <hannes@cmpxchg.org>
56Cc: Nick Piggin <npiggin@kernel.dk>
57Cc: Mel Gorman <mel@csn.ul.ie>
58Cc: Shaohua Li <shaohua.li@intel.com>
59Cc: Rik van Riel <riel@redhat.com>
60Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
61Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
62Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
63---
64 mm/vmscan.c | 2 +-
65 1 files changed, 1 insertions(+), 1 deletions(-)
66
67diff --git a/mm/vmscan.c b/mm/vmscan.c
68index 9e89de6..cd27455 100644
69--- a/mm/vmscan.c
70+++ b/mm/vmscan.c
71@@ -715,7 +715,7 @@ static enum page_references page_check_references(struct page *page,
72 */
73 SetPageReferenced(page);
74
75- if (referenced_page)
76+ if (referenced_page || referenced_ptes > 1)
77 return PAGEREF_ACTIVATE;
78
79 return PAGEREF_KEEP;
80--
811.7.7.6
82
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0011-vmscan-activate-executable-pages-after-first-usage.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0011-vmscan-activate-executable-pages-after-first-usage.patch
new file mode 100644
index 00000000..0f242088
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0011-vmscan-activate-executable-pages-after-first-usage.patch
@@ -0,0 +1,56 @@
1From 7560f662e5e895619c356365f675715d7f4ea577 Mon Sep 17 00:00:00 2001
2From: Konstantin Khlebnikov <khlebnikov@openvz.org>
3Date: Tue, 10 Jan 2012 15:07:03 -0800
4Subject: [PATCH 11/73] vmscan: activate executable pages after first usage
5
6commit c909e99364c8b6ca07864d752950b6b4ecf6bef4 upstream.
7
8Stable note: Not tracked in Bugzilla. There were reports of shared
9 mapped pages being unfairly reclaimed in comparison to older kernels.
10 This is being addressed over time.
11
12Logic added in commit 8cab4754d24a0 ("vmscan: make mapped executable pages
13the first class citizen") was noticeably weakened in commit
14645747462435d84 ("vmscan: detect mapped file pages used only once").
15
16Currently these pages can become "first class citizens" only after second
17usage. After this patch page_check_references() will activate they after
18first usage, and executable code gets yet better chance to stay in memory.
19
20Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
21Cc: Pekka Enberg <penberg@kernel.org>
22Cc: Minchan Kim <minchan.kim@gmail.com>
23Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
24Cc: Wu Fengguang <fengguang.wu@intel.com>
25Cc: Johannes Weiner <hannes@cmpxchg.org>
26Cc: Nick Piggin <npiggin@kernel.dk>
27Cc: Mel Gorman <mel@csn.ul.ie>
28Cc: Shaohua Li <shaohua.li@intel.com>
29Cc: Rik van Riel <riel@redhat.com>
30Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
31Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
32Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
33---
34 mm/vmscan.c | 6 ++++++
35 1 files changed, 6 insertions(+), 0 deletions(-)
36
37diff --git a/mm/vmscan.c b/mm/vmscan.c
38index cd27455..87de9c6 100644
39--- a/mm/vmscan.c
40+++ b/mm/vmscan.c
41@@ -718,6 +718,12 @@ static enum page_references page_check_references(struct page *page,
42 if (referenced_page || referenced_ptes > 1)
43 return PAGEREF_ACTIVATE;
44
45+ /*
46+ * Activate file-backed executable pages after first usage.
47+ */
48+ if (vm_flags & VM_EXEC)
49+ return PAGEREF_ACTIVATE;
50+
51 return PAGEREF_KEEP;
52 }
53
54--
551.7.7.6
56
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0012-mm-vmscan.c-consider-swap-space-when-deciding-whethe.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0012-mm-vmscan.c-consider-swap-space-when-deciding-whethe.patch
new file mode 100644
index 00000000..63186e3a
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0012-mm-vmscan.c-consider-swap-space-when-deciding-whethe.patch
@@ -0,0 +1,50 @@
1From 2f1cec6b7649ab76eb3b0f736028388e4a7e9047 Mon Sep 17 00:00:00 2001
2From: Minchan Kim <minchan@kernel.org>
3Date: Tue, 10 Jan 2012 15:08:18 -0800
4Subject: [PATCH 12/73] mm/vmscan.c: consider swap space when deciding whether
5 to continue reclaim
6
7commit 86cfd3a45042ab242d47f3935a02811a402beab6 upstream.
8
9Stable note: Not tracked in Bugzilla. This patch reduces kswapd CPU
10 usage on swapless systems with high anonymous memory usage.
11
12It's pointless to continue reclaiming when we have no swap space and lots
13of anon pages in the inactive list.
14
15Without this patch, it is possible when swap is disabled to continue
16trying to reclaim when there are only anonymous pages in the system even
17though that will not make any progress.
18
19Signed-off-by: Minchan Kim <minchan@kernel.org>
20Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
21Acked-by: Mel Gorman <mgorman@suse.de>
22Reviewed-by: Rik van Riel <riel@redhat.com>
23Cc: Johannes Weiner <jweiner@redhat.com>
24Cc: Andrea Arcangeli <aarcange@redhat.com>
25Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
26Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
28---
29 mm/vmscan.c | 5 +++--
30 1 files changed, 3 insertions(+), 2 deletions(-)
31
32diff --git a/mm/vmscan.c b/mm/vmscan.c
33index 87de9c6..ba763be 100644
34--- a/mm/vmscan.c
35+++ b/mm/vmscan.c
36@@ -2049,8 +2049,9 @@ static inline bool should_continue_reclaim(struct zone *zone,
37 * inactive lists are large enough, continue reclaiming
38 */
39 pages_for_compaction = (2UL << sc->order);
40- inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON) +
41- zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE);
42+ inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE);
43+ if (nr_swap_pages > 0)
44+ inactive_lru_pages += zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON);
45 if (sc->nr_reclaimed < pages_for_compaction &&
46 inactive_lru_pages > pages_for_compaction)
47 return true;
48--
491.7.7.6
50
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0013-mm-test-PageSwapBacked-in-lumpy-reclaim.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0013-mm-test-PageSwapBacked-in-lumpy-reclaim.patch
new file mode 100644
index 00000000..fe39de94
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0013-mm-test-PageSwapBacked-in-lumpy-reclaim.patch
@@ -0,0 +1,42 @@
1From 0b642dde6e6cd5dc940498c7cdb676fc56e4cdf4 Mon Sep 17 00:00:00 2001
2From: Hugh Dickins <hughd@google.com>
3Date: Tue, 10 Jan 2012 15:08:33 -0800
4Subject: [PATCH 13/73] mm: test PageSwapBacked in lumpy reclaim
5
6commit 043bcbe5ec51e0478ef2b44acef17193e01d7f70 upstream.
7
8Stable note: Not tracked in Bugzilla. There were reports of shared
9 mapped pages being unfairly reclaimed in comparison to older kernels.
10 This is being addressed over time. Even though the subject
11 refers to lumpy reclaim, it impacts compaction as well.
12
13Lumpy reclaim does well to stop at a PageAnon when there's no swap, but
14better is to stop at any PageSwapBacked, which includes shmem/tmpfs too.
15
16Signed-off-by: Hugh Dickins <hughd@google.com>
17Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
18Reviewed-by: Minchan Kim <minchan@kernel.org>
19Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21Signed-off-by: Mel Gorman <mgorman@suse.de>
22Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
23---
24 mm/vmscan.c | 2 +-
25 1 files changed, 1 insertions(+), 1 deletions(-)
26
27diff --git a/mm/vmscan.c b/mm/vmscan.c
28index ba763be..b9eaa06 100644
29--- a/mm/vmscan.c
30+++ b/mm/vmscan.c
31@@ -1215,7 +1215,7 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
32 * anon page which don't already have a swap slot is
33 * pointless.
34 */
35- if (nr_swap_pages <= 0 && PageAnon(cursor_page) &&
36+ if (nr_swap_pages <= 0 && PageSwapBacked(cursor_page) &&
37 !PageSwapCache(cursor_page))
38 break;
39
40--
411.7.7.6
42
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0014-mm-vmscan-convert-global-reclaim-to-per-memcg-LRU-li.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0014-mm-vmscan-convert-global-reclaim-to-per-memcg-LRU-li.patch
new file mode 100644
index 00000000..0be1dd45
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0014-mm-vmscan-convert-global-reclaim-to-per-memcg-LRU-li.patch
@@ -0,0 +1,58 @@
1From 2c44243518b5d2a8bb5cd67691efe747e4424cc1 Mon Sep 17 00:00:00 2001
2From: Johannes Weiner <jweiner@redhat.com>
3Date: Thu, 12 Jan 2012 17:18:06 -0800
4Subject: [PATCH 14/73] mm: vmscan: convert global reclaim to per-memcg LRU
5 lists
6
7commit b95a2f2d486d0d768a92879c023a03757b9c7e58 upstream - WARNING: this is a substitute patch.
8
9Stable note: Not tracked in Bugzilla. This is a partial backport of an
10 upstream commit addressing a completely different issue
11 that accidentally contained an important fix. The workload
12 this patch helps was memcached when IO is started in the
13 background. memcached should stay resident but without this patch
14 it gets swapped. Sometimes this manifests as a drop in throughput
15 but mostly it was observed through /proc/vmstat.
16
17Commit [246e87a9: memcg: fix get_scan_count() for small targets] was meant
18to fix a problem whereby small scan targets on memcg were ignored causing
19priority to raise too sharply. It forced scanning to take place if the
20target was small, memcg or kswapd.
21
22From the time it was introduced it caused excessive reclaim by kswapd
23with workloads being pushed to swap that previously would have stayed
24resident. This was accidentally fixed in commit [b95a2f2d: mm: vmscan:
25convert global reclaim to per-memcg LRU lists] by making it harder for
26kswapd to force scan small targets but that patchset is not suitable for
27backporting. This was later changed again by commit [90126375: mm/vmscan:
28push lruvec pointer into get_scan_count()] into a format that looks
29like it would be a straight-forward backport but there is a subtle
30difference due to the use of lruvecs.
31
32The impact of the accidental fix is to make it harder for kswapd to force
33scan small targets by taking zone->all_unreclaimable into account. This
34patch is the closest equivalent available based on what is backported.
35
36Signed-off-by: Mel Gorman <mgorman@suse.de>
37Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
38---
39 mm/vmscan.c | 3 ++-
40 1 files changed, 2 insertions(+), 1 deletions(-)
41
42diff --git a/mm/vmscan.c b/mm/vmscan.c
43index b9eaa06..ded1857 100644
44--- a/mm/vmscan.c
45+++ b/mm/vmscan.c
46@@ -1911,7 +1911,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
47 * latencies, so it's better to scan a minimum amount there as
48 * well.
49 */
50- if (scanning_global_lru(sc) && current_is_kswapd())
51+ if (scanning_global_lru(sc) && current_is_kswapd() &&
52+ zone->all_unreclaimable)
53 force_scan = true;
54 if (!scanning_global_lru(sc))
55 force_scan = true;
56--
571.7.7.6
58
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0015-cpuset-mm-reduce-large-amounts-of-memory-barrier-rel.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0015-cpuset-mm-reduce-large-amounts-of-memory-barrier-rel.patch
new file mode 100644
index 00000000..d834bc2a
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0015-cpuset-mm-reduce-large-amounts-of-memory-barrier-rel.patch
@@ -0,0 +1,655 @@
1From 8d847c6e95dab1977636cd9d3d5da5851f5c95aa Mon Sep 17 00:00:00 2001
2From: Mel Gorman <mgorman@suse.de>
3Date: Wed, 21 Mar 2012 16:34:11 -0700
4Subject: [PATCH 15/73] cpuset: mm: reduce large amounts of memory barrier
5 related damage v3
6
7commit cc9a6c8776615f9c194ccf0b63a0aa5628235545 upstream.
8
9Stable note: Not tracked in Bugzilla. [get|put]_mems_allowed() is extremely
10 expensive and severely impacted page allocator performance. This
11 is part of a series of patches that reduce page allocator overhead.
12
13Commit c0ff7453bb5c ("cpuset,mm: fix no node to alloc memory when
14changing cpuset's mems") wins a super prize for the largest number of
15memory barriers entered into fast paths for one commit.
16
17[get|put]_mems_allowed is incredibly heavy with pairs of full memory
18barriers inserted into a number of hot paths. This was detected while
19investigating at large page allocator slowdown introduced some time
20after 2.6.32. The largest portion of this overhead was shown by
21oprofile to be at an mfence introduced by this commit into the page
22allocator hot path.
23
24For extra style points, the commit introduced the use of yield() in an
25implementation of what looks like a spinning mutex.
26
27This patch replaces the full memory barriers on both read and write
28sides with a sequence counter with just read barriers on the fast path
29side. This is much cheaper on some architectures, including x86. The
30main bulk of the patch is the retry logic if the nodemask changes in a
31manner that can cause a false failure.
32
33While updating the nodemask, a check is made to see if a false failure
34is a risk. If it is, the sequence number gets bumped and parallel
35allocators will briefly stall while the nodemask update takes place.
36
37In a page fault test microbenchmark, oprofile samples from
38__alloc_pages_nodemask went from 4.53% of all samples to 1.15%. The
39actual results were
40
41 3.3.0-rc3 3.3.0-rc3
42 rc3-vanilla nobarrier-v2r1
43 Clients 1 UserTime 0.07 ( 0.00%) 0.08 (-14.19%)
44 Clients 2 UserTime 0.07 ( 0.00%) 0.07 ( 2.72%)
45 Clients 4 UserTime 0.08 ( 0.00%) 0.07 ( 3.29%)
46 Clients 1 SysTime 0.70 ( 0.00%) 0.65 ( 6.65%)
47 Clients 2 SysTime 0.85 ( 0.00%) 0.82 ( 3.65%)
48 Clients 4 SysTime 1.41 ( 0.00%) 1.41 ( 0.32%)
49 Clients 1 WallTime 0.77 ( 0.00%) 0.74 ( 4.19%)
50 Clients 2 WallTime 0.47 ( 0.00%) 0.45 ( 3.73%)
51 Clients 4 WallTime 0.38 ( 0.00%) 0.37 ( 1.58%)
52 Clients 1 Flt/sec/cpu 497620.28 ( 0.00%) 520294.53 ( 4.56%)
53 Clients 2 Flt/sec/cpu 414639.05 ( 0.00%) 429882.01 ( 3.68%)
54 Clients 4 Flt/sec/cpu 257959.16 ( 0.00%) 258761.48 ( 0.31%)
55 Clients 1 Flt/sec 495161.39 ( 0.00%) 517292.87 ( 4.47%)
56 Clients 2 Flt/sec 820325.95 ( 0.00%) 850289.77 ( 3.65%)
57 Clients 4 Flt/sec 1020068.93 ( 0.00%) 1022674.06 ( 0.26%)
58 MMTests Statistics: duration
59 Sys Time Running Test (seconds) 135.68 132.17
60 User+Sys Time Running Test (seconds) 164.2 160.13
61 Total Elapsed Time (seconds) 123.46 120.87
62
63The overall improvement is small but the System CPU time is much
64improved and roughly in correlation to what oprofile reported (these
65performance figures are without profiling so skew is expected). The
66actual number of page faults is noticeably improved.
67
68For benchmarks like kernel builds, the overall benefit is marginal but
69the system CPU time is slightly reduced.
70
71To test the actual bug the commit fixed I opened two terminals. The
72first ran within a cpuset and continually ran a small program that
73faulted 100M of anonymous data. In a second window, the nodemask of the
74cpuset was continually randomised in a loop.
75
76Without the commit, the program would fail every so often (usually
77within 10 seconds) and obviously with the commit everything worked fine.
78With this patch applied, it also worked fine so the fix should be
79functionally equivalent.
80
81Signed-off-by: Mel Gorman <mgorman@suse.de>
82Cc: Miao Xie <miaox@cn.fujitsu.com>
83Cc: David Rientjes <rientjes@google.com>
84Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
85Cc: Christoph Lameter <cl@linux.com>
86Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
87Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
88Signed-off-by: Mel Gorman <mgorman@suse.de>
89[bwh: Forward-ported from 3.0 to 3.2: apply the upstream changes
90 to get_any_partial()]
91Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
92---
93 include/linux/cpuset.h | 47 +++++++++++++++++++-------------------------
94 include/linux/init_task.h | 8 +++++++
95 include/linux/sched.h | 2 +-
96 kernel/cpuset.c | 43 +++++++---------------------------------
97 kernel/fork.c | 3 ++
98 mm/filemap.c | 11 ++++++---
99 mm/hugetlb.c | 15 ++++++++++---
100 mm/mempolicy.c | 28 ++++++++++++++++++++------
101 mm/page_alloc.c | 33 ++++++++++++++++++++++---------
102 mm/slab.c | 13 +++++++----
103 mm/slub.c | 40 +++++++++++++++++++++++--------------
104 mm/vmscan.c | 2 -
105 12 files changed, 135 insertions(+), 110 deletions(-)
106
107diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
108index e9eaec5..7a7e5fd 100644
109--- a/include/linux/cpuset.h
110+++ b/include/linux/cpuset.h
111@@ -89,42 +89,33 @@ extern void rebuild_sched_domains(void);
112 extern void cpuset_print_task_mems_allowed(struct task_struct *p);
113
114 /*
115- * reading current mems_allowed and mempolicy in the fastpath must protected
116- * by get_mems_allowed()
117+ * get_mems_allowed is required when making decisions involving mems_allowed
118+ * such as during page allocation. mems_allowed can be updated in parallel
119+ * and depending on the new value an operation can fail potentially causing
120+ * process failure. A retry loop with get_mems_allowed and put_mems_allowed
121+ * prevents these artificial failures.
122 */
123-static inline void get_mems_allowed(void)
124+static inline unsigned int get_mems_allowed(void)
125 {
126- current->mems_allowed_change_disable++;
127-
128- /*
129- * ensure that reading mems_allowed and mempolicy happens after the
130- * update of ->mems_allowed_change_disable.
131- *
132- * the write-side task finds ->mems_allowed_change_disable is not 0,
133- * and knows the read-side task is reading mems_allowed or mempolicy,
134- * so it will clear old bits lazily.
135- */
136- smp_mb();
137+ return read_seqcount_begin(&current->mems_allowed_seq);
138 }
139
140-static inline void put_mems_allowed(void)
141+/*
142+ * If this returns false, the operation that took place after get_mems_allowed
143+ * may have failed. It is up to the caller to retry the operation if
144+ * appropriate.
145+ */
146+static inline bool put_mems_allowed(unsigned int seq)
147 {
148- /*
149- * ensure that reading mems_allowed and mempolicy before reducing
150- * mems_allowed_change_disable.
151- *
152- * the write-side task will know that the read-side task is still
153- * reading mems_allowed or mempolicy, don't clears old bits in the
154- * nodemask.
155- */
156- smp_mb();
157- --ACCESS_ONCE(current->mems_allowed_change_disable);
158+ return !read_seqcount_retry(&current->mems_allowed_seq, seq);
159 }
160
161 static inline void set_mems_allowed(nodemask_t nodemask)
162 {
163 task_lock(current);
164+ write_seqcount_begin(&current->mems_allowed_seq);
165 current->mems_allowed = nodemask;
166+ write_seqcount_end(&current->mems_allowed_seq);
167 task_unlock(current);
168 }
169
170@@ -234,12 +225,14 @@ static inline void set_mems_allowed(nodemask_t nodemask)
171 {
172 }
173
174-static inline void get_mems_allowed(void)
175+static inline unsigned int get_mems_allowed(void)
176 {
177+ return 0;
178 }
179
180-static inline void put_mems_allowed(void)
181+static inline bool put_mems_allowed(unsigned int seq)
182 {
183+ return true;
184 }
185
186 #endif /* !CONFIG_CPUSETS */
187diff --git a/include/linux/init_task.h b/include/linux/init_task.h
188index 32574ee..df53fdf 100644
189--- a/include/linux/init_task.h
190+++ b/include/linux/init_task.h
191@@ -30,6 +30,13 @@ extern struct fs_struct init_fs;
192 #define INIT_THREADGROUP_FORK_LOCK(sig)
193 #endif
194
195+#ifdef CONFIG_CPUSETS
196+#define INIT_CPUSET_SEQ \
197+ .mems_allowed_seq = SEQCNT_ZERO,
198+#else
199+#define INIT_CPUSET_SEQ
200+#endif
201+
202 #define INIT_SIGNALS(sig) { \
203 .nr_threads = 1, \
204 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
205@@ -193,6 +200,7 @@ extern struct cred init_cred;
206 INIT_FTRACE_GRAPH \
207 INIT_TRACE_RECURSION \
208 INIT_TASK_RCU_PREEMPT(tsk) \
209+ INIT_CPUSET_SEQ \
210 }
211
212
213diff --git a/include/linux/sched.h b/include/linux/sched.h
214index 5afa2a3..a96cb8c 100644
215--- a/include/linux/sched.h
216+++ b/include/linux/sched.h
217@@ -1481,7 +1481,7 @@ struct task_struct {
218 #endif
219 #ifdef CONFIG_CPUSETS
220 nodemask_t mems_allowed; /* Protected by alloc_lock */
221- int mems_allowed_change_disable;
222+ seqcount_t mems_allowed_seq; /* Seqence no to catch updates */
223 int cpuset_mem_spread_rotor;
224 int cpuset_slab_spread_rotor;
225 #endif
226diff --git a/kernel/cpuset.c b/kernel/cpuset.c
227index 0b1712d..46a1d3c 100644
228--- a/kernel/cpuset.c
229+++ b/kernel/cpuset.c
230@@ -964,7 +964,6 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk,
231 {
232 bool need_loop;
233
234-repeat:
235 /*
236 * Allow tasks that have access to memory reserves because they have
237 * been OOM killed to get memory anywhere.
238@@ -983,45 +982,19 @@ repeat:
239 */
240 need_loop = task_has_mempolicy(tsk) ||
241 !nodes_intersects(*newmems, tsk->mems_allowed);
242- nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems);
243- mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1);
244
245- /*
246- * ensure checking ->mems_allowed_change_disable after setting all new
247- * allowed nodes.
248- *
249- * the read-side task can see an nodemask with new allowed nodes and
250- * old allowed nodes. and if it allocates page when cpuset clears newly
251- * disallowed ones continuous, it can see the new allowed bits.
252- *
253- * And if setting all new allowed nodes is after the checking, setting
254- * all new allowed nodes and clearing newly disallowed ones will be done
255- * continuous, and the read-side task may find no node to alloc page.
256- */
257- smp_mb();
258+ if (need_loop)
259+ write_seqcount_begin(&tsk->mems_allowed_seq);
260
261- /*
262- * Allocation of memory is very fast, we needn't sleep when waiting
263- * for the read-side.
264- */
265- while (need_loop && ACCESS_ONCE(tsk->mems_allowed_change_disable)) {
266- task_unlock(tsk);
267- if (!task_curr(tsk))
268- yield();
269- goto repeat;
270- }
271-
272- /*
273- * ensure checking ->mems_allowed_change_disable before clearing all new
274- * disallowed nodes.
275- *
276- * if clearing newly disallowed bits before the checking, the read-side
277- * task may find no node to alloc page.
278- */
279- smp_mb();
280+ nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems);
281+ mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1);
282
283 mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP2);
284 tsk->mems_allowed = *newmems;
285+
286+ if (need_loop)
287+ write_seqcount_end(&tsk->mems_allowed_seq);
288+
289 task_unlock(tsk);
290 }
291
292diff --git a/kernel/fork.c b/kernel/fork.c
293index 79ee71f..222457a 100644
294--- a/kernel/fork.c
295+++ b/kernel/fork.c
296@@ -979,6 +979,9 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
297 #ifdef CONFIG_CGROUPS
298 init_rwsem(&sig->threadgroup_fork_lock);
299 #endif
300+#ifdef CONFIG_CPUSETS
301+ seqcount_init(&tsk->mems_allowed_seq);
302+#endif
303
304 sig->oom_adj = current->signal->oom_adj;
305 sig->oom_score_adj = current->signal->oom_score_adj;
306diff --git a/mm/filemap.c b/mm/filemap.c
307index 03c5b0e..556858c 100644
308--- a/mm/filemap.c
309+++ b/mm/filemap.c
310@@ -500,10 +500,13 @@ struct page *__page_cache_alloc(gfp_t gfp)
311 struct page *page;
312
313 if (cpuset_do_page_mem_spread()) {
314- get_mems_allowed();
315- n = cpuset_mem_spread_node();
316- page = alloc_pages_exact_node(n, gfp, 0);
317- put_mems_allowed();
318+ unsigned int cpuset_mems_cookie;
319+ do {
320+ cpuset_mems_cookie = get_mems_allowed();
321+ n = cpuset_mem_spread_node();
322+ page = alloc_pages_exact_node(n, gfp, 0);
323+ } while (!put_mems_allowed(cpuset_mems_cookie) && !page);
324+
325 return page;
326 }
327 return alloc_pages(gfp, 0);
328diff --git a/mm/hugetlb.c b/mm/hugetlb.c
329index 7c535b0..1e747e4 100644
330--- a/mm/hugetlb.c
331+++ b/mm/hugetlb.c
332@@ -532,14 +532,16 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
333 struct vm_area_struct *vma,
334 unsigned long address, int avoid_reserve)
335 {
336- struct page *page = NULL;
337+ struct page *page;
338 struct mempolicy *mpol;
339 nodemask_t *nodemask;
340 struct zonelist *zonelist;
341 struct zone *zone;
342 struct zoneref *z;
343+ unsigned int cpuset_mems_cookie;
344
345- get_mems_allowed();
346+retry_cpuset:
347+ cpuset_mems_cookie = get_mems_allowed();
348 zonelist = huge_zonelist(vma, address,
349 htlb_alloc_mask, &mpol, &nodemask);
350 /*
351@@ -566,10 +568,15 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
352 }
353 }
354 }
355-err:
356+
357 mpol_cond_put(mpol);
358- put_mems_allowed();
359+ if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
360+ goto retry_cpuset;
361 return page;
362+
363+err:
364+ mpol_cond_put(mpol);
365+ return NULL;
366 }
367
368 static void update_and_free_page(struct hstate *h, struct page *page)
369diff --git a/mm/mempolicy.c b/mm/mempolicy.c
370index f2650bc..c0007f9 100644
371--- a/mm/mempolicy.c
372+++ b/mm/mempolicy.c
373@@ -1843,18 +1843,24 @@ struct page *
374 alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
375 unsigned long addr, int node)
376 {
377- struct mempolicy *pol = get_vma_policy(current, vma, addr);
378+ struct mempolicy *pol;
379 struct zonelist *zl;
380 struct page *page;
381+ unsigned int cpuset_mems_cookie;
382+
383+retry_cpuset:
384+ pol = get_vma_policy(current, vma, addr);
385+ cpuset_mems_cookie = get_mems_allowed();
386
387- get_mems_allowed();
388 if (unlikely(pol->mode == MPOL_INTERLEAVE)) {
389 unsigned nid;
390
391 nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order);
392 mpol_cond_put(pol);
393 page = alloc_page_interleave(gfp, order, nid);
394- put_mems_allowed();
395+ if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
396+ goto retry_cpuset;
397+
398 return page;
399 }
400 zl = policy_zonelist(gfp, pol, node);
401@@ -1865,7 +1871,8 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
402 struct page *page = __alloc_pages_nodemask(gfp, order,
403 zl, policy_nodemask(gfp, pol));
404 __mpol_put(pol);
405- put_mems_allowed();
406+ if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
407+ goto retry_cpuset;
408 return page;
409 }
410 /*
411@@ -1873,7 +1880,8 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
412 */
413 page = __alloc_pages_nodemask(gfp, order, zl,
414 policy_nodemask(gfp, pol));
415- put_mems_allowed();
416+ if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
417+ goto retry_cpuset;
418 return page;
419 }
420
421@@ -1900,11 +1908,14 @@ struct page *alloc_pages_current(gfp_t gfp, unsigned order)
422 {
423 struct mempolicy *pol = current->mempolicy;
424 struct page *page;
425+ unsigned int cpuset_mems_cookie;
426
427 if (!pol || in_interrupt() || (gfp & __GFP_THISNODE))
428 pol = &default_policy;
429
430- get_mems_allowed();
431+retry_cpuset:
432+ cpuset_mems_cookie = get_mems_allowed();
433+
434 /*
435 * No reference counting needed for current->mempolicy
436 * nor system default_policy
437@@ -1915,7 +1926,10 @@ struct page *alloc_pages_current(gfp_t gfp, unsigned order)
438 page = __alloc_pages_nodemask(gfp, order,
439 policy_zonelist(gfp, pol, numa_node_id()),
440 policy_nodemask(gfp, pol));
441- put_mems_allowed();
442+
443+ if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
444+ goto retry_cpuset;
445+
446 return page;
447 }
448 EXPORT_SYMBOL(alloc_pages_current);
449diff --git a/mm/page_alloc.c b/mm/page_alloc.c
450index ef6e1a1..065dbe8 100644
451--- a/mm/page_alloc.c
452+++ b/mm/page_alloc.c
453@@ -2282,8 +2282,9 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
454 {
455 enum zone_type high_zoneidx = gfp_zone(gfp_mask);
456 struct zone *preferred_zone;
457- struct page *page;
458+ struct page *page = NULL;
459 int migratetype = allocflags_to_migratetype(gfp_mask);
460+ unsigned int cpuset_mems_cookie;
461
462 gfp_mask &= gfp_allowed_mask;
463
464@@ -2302,15 +2303,15 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
465 if (unlikely(!zonelist->_zonerefs->zone))
466 return NULL;
467
468- get_mems_allowed();
469+retry_cpuset:
470+ cpuset_mems_cookie = get_mems_allowed();
471+
472 /* The preferred zone is used for statistics later */
473 first_zones_zonelist(zonelist, high_zoneidx,
474 nodemask ? : &cpuset_current_mems_allowed,
475 &preferred_zone);
476- if (!preferred_zone) {
477- put_mems_allowed();
478- return NULL;
479- }
480+ if (!preferred_zone)
481+ goto out;
482
483 /* First allocation attempt */
484 page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, order,
485@@ -2320,9 +2321,19 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
486 page = __alloc_pages_slowpath(gfp_mask, order,
487 zonelist, high_zoneidx, nodemask,
488 preferred_zone, migratetype);
489- put_mems_allowed();
490
491 trace_mm_page_alloc(page, order, gfp_mask, migratetype);
492+
493+out:
494+ /*
495+ * When updating a task's mems_allowed, it is possible to race with
496+ * parallel threads in such a way that an allocation can fail while
497+ * the mask is being updated. If a page allocation is about to fail,
498+ * check if the cpuset changed during allocation and if so, retry.
499+ */
500+ if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
501+ goto retry_cpuset;
502+
503 return page;
504 }
505 EXPORT_SYMBOL(__alloc_pages_nodemask);
506@@ -2546,13 +2557,15 @@ void si_meminfo_node(struct sysinfo *val, int nid)
507 bool skip_free_areas_node(unsigned int flags, int nid)
508 {
509 bool ret = false;
510+ unsigned int cpuset_mems_cookie;
511
512 if (!(flags & SHOW_MEM_FILTER_NODES))
513 goto out;
514
515- get_mems_allowed();
516- ret = !node_isset(nid, cpuset_current_mems_allowed);
517- put_mems_allowed();
518+ do {
519+ cpuset_mems_cookie = get_mems_allowed();
520+ ret = !node_isset(nid, cpuset_current_mems_allowed);
521+ } while (!put_mems_allowed(cpuset_mems_cookie));
522 out:
523 return ret;
524 }
525diff --git a/mm/slab.c b/mm/slab.c
526index 83311c9a..cd3ab93 100644
527--- a/mm/slab.c
528+++ b/mm/slab.c
529@@ -3267,12 +3267,10 @@ static void *alternate_node_alloc(struct kmem_cache *cachep, gfp_t flags)
530 if (in_interrupt() || (flags & __GFP_THISNODE))
531 return NULL;
532 nid_alloc = nid_here = numa_mem_id();
533- get_mems_allowed();
534 if (cpuset_do_slab_mem_spread() && (cachep->flags & SLAB_MEM_SPREAD))
535 nid_alloc = cpuset_slab_spread_node();
536 else if (current->mempolicy)
537 nid_alloc = slab_node(current->mempolicy);
538- put_mems_allowed();
539 if (nid_alloc != nid_here)
540 return ____cache_alloc_node(cachep, flags, nid_alloc);
541 return NULL;
542@@ -3295,14 +3293,17 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)
543 enum zone_type high_zoneidx = gfp_zone(flags);
544 void *obj = NULL;
545 int nid;
546+ unsigned int cpuset_mems_cookie;
547
548 if (flags & __GFP_THISNODE)
549 return NULL;
550
551- get_mems_allowed();
552- zonelist = node_zonelist(slab_node(current->mempolicy), flags);
553 local_flags = flags & (GFP_CONSTRAINT_MASK|GFP_RECLAIM_MASK);
554
555+retry_cpuset:
556+ cpuset_mems_cookie = get_mems_allowed();
557+ zonelist = node_zonelist(slab_node(current->mempolicy), flags);
558+
559 retry:
560 /*
561 * Look through allowed nodes for objects available
562@@ -3355,7 +3356,9 @@ retry:
563 }
564 }
565 }
566- put_mems_allowed();
567+
568+ if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !obj))
569+ goto retry_cpuset;
570 return obj;
571 }
572
573diff --git a/mm/slub.c b/mm/slub.c
574index af47188..5710788 100644
575--- a/mm/slub.c
576+++ b/mm/slub.c
577@@ -1582,6 +1582,7 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags,
578 struct zone *zone;
579 enum zone_type high_zoneidx = gfp_zone(flags);
580 void *object;
581+ unsigned int cpuset_mems_cookie;
582
583 /*
584 * The defrag ratio allows a configuration of the tradeoffs between
585@@ -1605,23 +1606,32 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags,
586 get_cycles() % 1024 > s->remote_node_defrag_ratio)
587 return NULL;
588
589- get_mems_allowed();
590- zonelist = node_zonelist(slab_node(current->mempolicy), flags);
591- for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) {
592- struct kmem_cache_node *n;
593-
594- n = get_node(s, zone_to_nid(zone));
595-
596- if (n && cpuset_zone_allowed_hardwall(zone, flags) &&
597- n->nr_partial > s->min_partial) {
598- object = get_partial_node(s, n, c);
599- if (object) {
600- put_mems_allowed();
601- return object;
602+ do {
603+ cpuset_mems_cookie = get_mems_allowed();
604+ zonelist = node_zonelist(slab_node(current->mempolicy), flags);
605+ for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) {
606+ struct kmem_cache_node *n;
607+
608+ n = get_node(s, zone_to_nid(zone));
609+
610+ if (n && cpuset_zone_allowed_hardwall(zone, flags) &&
611+ n->nr_partial > s->min_partial) {
612+ object = get_partial_node(s, n, c);
613+ if (object) {
614+ /*
615+ * Return the object even if
616+ * put_mems_allowed indicated that
617+ * the cpuset mems_allowed was
618+ * updated in parallel. It's a
619+ * harmless race between the alloc
620+ * and the cpuset update.
621+ */
622+ put_mems_allowed(cpuset_mems_cookie);
623+ return object;
624+ }
625 }
626 }
627- }
628- put_mems_allowed();
629+ } while (!put_mems_allowed(cpuset_mems_cookie));
630 #endif
631 return NULL;
632 }
633diff --git a/mm/vmscan.c b/mm/vmscan.c
634index ded1857..48febd7 100644
635--- a/mm/vmscan.c
636+++ b/mm/vmscan.c
637@@ -2295,7 +2295,6 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
638 unsigned long writeback_threshold;
639 bool aborted_reclaim;
640
641- get_mems_allowed();
642 delayacct_freepages_start();
643
644 if (scanning_global_lru(sc))
645@@ -2359,7 +2358,6 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
646
647 out:
648 delayacct_freepages_end();
649- put_mems_allowed();
650
651 if (sc->nr_reclaimed)
652 return sc->nr_reclaimed;
653--
6541.7.7.6
655
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0016-mm-hugetlb-fix-warning-in-alloc_huge_page-dequeue_hu.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0016-mm-hugetlb-fix-warning-in-alloc_huge_page-dequeue_hu.patch
new file mode 100644
index 00000000..9c4a09a4
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0016-mm-hugetlb-fix-warning-in-alloc_huge_page-dequeue_hu.patch
@@ -0,0 +1,50 @@
1From f9871f8705a930f3c3c4588a8c990cf76db2b95e Mon Sep 17 00:00:00 2001
2From: Konstantin Khlebnikov <khlebnikov@openvz.org>
3Date: Wed, 25 Apr 2012 16:01:46 -0700
4Subject: [PATCH 16/73] mm/hugetlb: fix warning in
5 alloc_huge_page/dequeue_huge_page_vma
6
7commit b1c12cbcd0a02527c180a862e8971e249d3b347d upstream.
8
9Stable note: Not tracked in Bugzilla. [get|put]_mems_allowed() is extremely
10 expensive and severely impacted page allocator performance. This
11 is part of a series of patches that reduce page allocator overhead.
12
13Fix a gcc warning (and bug?) introduced in cc9a6c877 ("cpuset: mm: reduce
14large amounts of memory barrier related damage v3")
15
16Local variable "page" can be uninitialized if the nodemask from vma policy
17does not intersects with nodemask from cpuset. Even if it doesn't happens
18it is better to initialize this variable explicitly than to introduce
19a kernel oops in a weird corner case.
20
21mm/hugetlb.c: In function `alloc_huge_page':
22mm/hugetlb.c:1135:5: warning: `page' may be used uninitialized in this function
23
24Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
25Acked-by: Mel Gorman <mgorman@suse.de>
26Acked-by: David Rientjes <rientjes@google.com>
27Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
28Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
29Signed-off-by: Mel Gorman <mgorman@suse.de>
30Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
31---
32 mm/hugetlb.c | 2 +-
33 1 files changed, 1 insertions(+), 1 deletions(-)
34
35diff --git a/mm/hugetlb.c b/mm/hugetlb.c
36index 1e747e4..b1e1bad 100644
37--- a/mm/hugetlb.c
38+++ b/mm/hugetlb.c
39@@ -532,7 +532,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
40 struct vm_area_struct *vma,
41 unsigned long address, int avoid_reserve)
42 {
43- struct page *page;
44+ struct page *page = NULL;
45 struct mempolicy *mpol;
46 nodemask_t *nodemask;
47 struct zonelist *zonelist;
48--
491.7.7.6
50
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0017-Fix-NULL-dereferences-in-scsi_cmd_to_driver.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0017-Fix-NULL-dereferences-in-scsi_cmd_to_driver.patch
new file mode 100644
index 00000000..b56b57e5
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0017-Fix-NULL-dereferences-in-scsi_cmd_to_driver.patch
@@ -0,0 +1,71 @@
1From 67fed15f639763628507a2e704441acabcce4bdd Mon Sep 17 00:00:00 2001
2From: Mark Rustad <mark.d.rustad@intel.com>
3Date: Thu, 21 Jun 2012 12:23:42 -0700
4Subject: [PATCH 17/73] Fix NULL dereferences in scsi_cmd_to_driver
5
6commit 222a806af830fda34ad1f6bc991cd226916de060 upstream.
7
8Avoid crashing if the private_data pointer happens to be NULL. This has
9been seen sometimes when a host reset happens, notably when there are
10many LUNs:
11
12host3: Assigned Port ID 0c1601
13scsi host3: libfc: Host reset succeeded on port (0c1601)
14BUG: unable to handle kernel NULL pointer dereference at 0000000000000350
15IP: [<ffffffff81352bb8>] scsi_send_eh_cmnd+0x58/0x3a0
16<snip>
17Process scsi_eh_3 (pid: 4144, threadinfo ffff88030920c000, task ffff880326b160c0)
18Stack:
19 000000010372e6ba 0000000000000282 000027100920dca0 ffffffffa0038ee0
20 0000000000000000 0000000000030003 ffff88030920dc80 ffff88030920dc80
21 00000002000e0000 0000000a00004000 ffff8803242f7760 ffff88031326ed80
22Call Trace:
23 [<ffffffff8105b590>] ? lock_timer_base+0x70/0x70
24 [<ffffffff81352fbe>] scsi_eh_tur+0x3e/0xc0
25 [<ffffffff81353a36>] scsi_eh_test_devices+0x76/0x170
26 [<ffffffff81354125>] scsi_eh_host_reset+0x85/0x160
27 [<ffffffff81354291>] scsi_eh_ready_devs+0x91/0x110
28 [<ffffffff813543fd>] scsi_unjam_host+0xed/0x1f0
29 [<ffffffff813546a8>] scsi_error_handler+0x1a8/0x200
30 [<ffffffff81354500>] ? scsi_unjam_host+0x1f0/0x1f0
31 [<ffffffff8106ec3e>] kthread+0x9e/0xb0
32 [<ffffffff81509264>] kernel_thread_helper+0x4/0x10
33 [<ffffffff8106eba0>] ? kthread_freezable_should_stop+0x70/0x70
34 [<ffffffff81509260>] ? gs_change+0x13/0x13
35Code: 25 28 00 00 00 48 89 45 c8 31 c0 48 8b 87 80 00 00 00 48 8d b5 60 ff ff ff 89 d1 48 89 fb 41 89 d6 4c 89 fa 48 8b 80 b8 00 00 00
36 <48> 8b 80 50 03 00 00 48 8b 00 48 89 85 38 ff ff ff 48 8b 07 4c
37RIP [<ffffffff81352bb8>] scsi_send_eh_cmnd+0x58/0x3a0
38 RSP <ffff88030920dc50>
39CR2: 0000000000000350
40
41Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
42Tested-by: Marcus Dennis <marcusx.e.dennis@intel.com>
43Signed-off-by: James Bottomley <JBottomley@Parallels.com>
44[bwh: Backported to 3.2: adjust filename, context]
45Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
46---
47 drivers/scsi/scsi.c | 8 +++++++-
48 1 files changed, 7 insertions(+), 1 deletions(-)
49
50diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
51index 2aeb2e9..831db24 100644
52--- a/drivers/scsi/scsi.c
53+++ b/drivers/scsi/scsi.c
54@@ -785,7 +785,13 @@ static void scsi_done(struct scsi_cmnd *cmd)
55 /* Move this to a header if it becomes more generally useful */
56 static struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
57 {
58- return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
59+ struct scsi_driver **sdp;
60+
61+ sdp = (struct scsi_driver **)cmd->request->rq_disk->private_data;
62+ if (!sdp)
63+ return NULL;
64+
65+ return *sdp;
66 }
67
68 /**
69--
701.7.7.6
71
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch
new file mode 100644
index 00000000..6548d426
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0018-sched-nohz-Fix-rq-cpu_load-calculations.patch
@@ -0,0 +1,137 @@
1From af56d9e56ec0729f6aa8c3a51b9bddbdcd8dfcf0 Mon Sep 17 00:00:00 2001
2From: Peter Zijlstra <a.p.zijlstra@chello.nl>
3Date: Fri, 11 May 2012 17:31:26 +0200
4Subject: [PATCH 18/73] sched/nohz: Fix rq->cpu_load[] calculations
5
6commit 556061b00c9f2fd6a5524b6bde823ef12f299ecf upstream.
7
8While investigating why the load-balancer did funny I found that the
9rq->cpu_load[] tables were completely screwy.. a bit more digging
10revealed that the updates that got through were missing ticks followed
11by a catchup of 2 ticks.
12
13The catchup assumes the cpu was idle during that time (since only nohz
14can cause missed ticks and the machine is idle etc..) this means that
15esp. the higher indices were significantly lower than they ought to
16be.
17
18The reason for this is that its not correct to compare against jiffies
19on every jiffy on any other cpu than the cpu that updates jiffies.
20
21This patch cludges around it by only doing the catch-up stuff from
22nohz_idle_balance() and doing the regular stuff unconditionally from
23the tick.
24
25Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
26Cc: pjt@google.com
27Cc: Venkatesh Pallipadi <venki@google.com>
28Link: http://lkml.kernel.org/n/tip-tp4kj18xdd5aj4vvj0qg55s2@git.kernel.org
29Signed-off-by: Ingo Molnar <mingo@kernel.org>
30[bwh: Backported to 3.2: adjust filenames and context; keep functions static]
31Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
32---
33 kernel/sched.c | 53 ++++++++++++++++++++++++++++++++++++++------------
34 kernel/sched_fair.c | 2 +-
35 2 files changed, 41 insertions(+), 14 deletions(-)
36
37diff --git a/kernel/sched.c b/kernel/sched.c
38index 52ac69b..a409d81 100644
39--- a/kernel/sched.c
40+++ b/kernel/sched.c
41@@ -1887,7 +1887,7 @@ static void double_rq_unlock(struct rq *rq1, struct rq *rq2)
42
43 static void update_sysctl(void);
44 static int get_update_sysctl_factor(void);
45-static void update_cpu_load(struct rq *this_rq);
46+static void update_idle_cpu_load(struct rq *this_rq);
47
48 static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
49 {
50@@ -3855,22 +3855,13 @@ decay_load_missed(unsigned long load, unsigned long missed_updates, int idx)
51 * scheduler tick (TICK_NSEC). With tickless idle this will not be called
52 * every tick. We fix it up based on jiffies.
53 */
54-static void update_cpu_load(struct rq *this_rq)
55+static void __update_cpu_load(struct rq *this_rq, unsigned long this_load,
56+ unsigned long pending_updates)
57 {
58- unsigned long this_load = this_rq->load.weight;
59- unsigned long curr_jiffies = jiffies;
60- unsigned long pending_updates;
61 int i, scale;
62
63 this_rq->nr_load_updates++;
64
65- /* Avoid repeated calls on same jiffy, when moving in and out of idle */
66- if (curr_jiffies == this_rq->last_load_update_tick)
67- return;
68-
69- pending_updates = curr_jiffies - this_rq->last_load_update_tick;
70- this_rq->last_load_update_tick = curr_jiffies;
71-
72 /* Update our load: */
73 this_rq->cpu_load[0] = this_load; /* Fasttrack for idx 0 */
74 for (i = 1, scale = 2; i < CPU_LOAD_IDX_MAX; i++, scale += scale) {
75@@ -3895,9 +3886,45 @@ static void update_cpu_load(struct rq *this_rq)
76 sched_avg_update(this_rq);
77 }
78
79+/*
80+ * Called from nohz_idle_balance() to update the load ratings before doing the
81+ * idle balance.
82+ */
83+static void update_idle_cpu_load(struct rq *this_rq)
84+{
85+ unsigned long curr_jiffies = jiffies;
86+ unsigned long load = this_rq->load.weight;
87+ unsigned long pending_updates;
88+
89+ /*
90+ * Bloody broken means of dealing with nohz, but better than nothing..
91+ * jiffies is updated by one cpu, another cpu can drift wrt the jiffy
92+ * update and see 0 difference the one time and 2 the next, even though
93+ * we ticked at roughtly the same rate.
94+ *
95+ * Hence we only use this from nohz_idle_balance() and skip this
96+ * nonsense when called from the scheduler_tick() since that's
97+ * guaranteed a stable rate.
98+ */
99+ if (load || curr_jiffies == this_rq->last_load_update_tick)
100+ return;
101+
102+ pending_updates = curr_jiffies - this_rq->last_load_update_tick;
103+ this_rq->last_load_update_tick = curr_jiffies;
104+
105+ __update_cpu_load(this_rq, load, pending_updates);
106+}
107+
108+/*
109+ * Called from scheduler_tick()
110+ */
111 static void update_cpu_load_active(struct rq *this_rq)
112 {
113- update_cpu_load(this_rq);
114+ /*
115+ * See the mess in update_idle_cpu_load().
116+ */
117+ this_rq->last_load_update_tick = jiffies;
118+ __update_cpu_load(this_rq, this_rq->load.weight, 1);
119
120 calc_load_account_active(this_rq);
121 }
122diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
123index 8a39fa3..66e4576 100644
124--- a/kernel/sched_fair.c
125+++ b/kernel/sched_fair.c
126@@ -4735,7 +4735,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle)
127
128 raw_spin_lock_irq(&this_rq->lock);
129 update_rq_clock(this_rq);
130- update_cpu_load(this_rq);
131+ update_idle_cpu_load(this_rq);
132 raw_spin_unlock_irq(&this_rq->lock);
133
134 rebalance_domains(balance_cpu, CPU_IDLE);
135--
1361.7.7.6
137
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0019-sched-nohz-Fix-rq-cpu_load-calculations-some-more.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0019-sched-nohz-Fix-rq-cpu_load-calculations-some-more.patch
new file mode 100644
index 00000000..130bbe6f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0019-sched-nohz-Fix-rq-cpu_load-calculations-some-more.patch
@@ -0,0 +1,147 @@
1From 5886fe4d82654fa7b041fcc2dd81794d28e2f0a7 Mon Sep 17 00:00:00 2001
2From: Peter Zijlstra <a.p.zijlstra@chello.nl>
3Date: Thu, 17 May 2012 17:15:29 +0200
4Subject: [PATCH 19/73] sched/nohz: Fix rq->cpu_load calculations some more
5
6commit 5aaa0b7a2ed5b12692c9ffb5222182bd558d3146 upstream.
7
8Follow up on commit 556061b00 ("sched/nohz: Fix rq->cpu_load[]
9calculations") since while that fixed the busy case it regressed the
10mostly idle case.
11
12Add a callback from the nohz exit to also age the rq->cpu_load[]
13array. This closes the hole where either there was no nohz load
14balance pass during the nohz, or there was a 'significant' amount of
15idle time between the last nohz balance and the nohz exit.
16
17So we'll update unconditionally from the tick to not insert any
18accidental 0 load periods while busy, and we try and catch up from
19nohz idle balance and nohz exit. Both these are still prone to missing
20a jiffy, but that has always been the case.
21
22Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
23Cc: pjt@google.com
24Cc: Venkatesh Pallipadi <venki@google.com>
25Link: http://lkml.kernel.org/n/tip-kt0trz0apodbf84ucjfdbr1a@git.kernel.org
26Signed-off-by: Ingo Molnar <mingo@kernel.org>
27[bwh: Backported to 3.2: adjust filenames and context]
28Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
29---
30 include/linux/sched.h | 1 +
31 kernel/sched.c | 53 +++++++++++++++++++++++++++++++++++++--------
32 kernel/time/tick-sched.c | 1 +
33 3 files changed, 45 insertions(+), 10 deletions(-)
34
35diff --git a/include/linux/sched.h b/include/linux/sched.h
36index a96cb8c..d336c35 100644
37--- a/include/linux/sched.h
38+++ b/include/linux/sched.h
39@@ -145,6 +145,7 @@ extern unsigned long this_cpu_load(void);
40
41
42 extern void calc_global_load(unsigned long ticks);
43+extern void update_cpu_load_nohz(void);
44
45 extern unsigned long get_parent_ip(unsigned long addr);
46
47diff --git a/kernel/sched.c b/kernel/sched.c
48index a409d81..9cd8ca7 100644
49--- a/kernel/sched.c
50+++ b/kernel/sched.c
51@@ -3886,25 +3886,32 @@ static void __update_cpu_load(struct rq *this_rq, unsigned long this_load,
52 sched_avg_update(this_rq);
53 }
54
55+#ifdef CONFIG_NO_HZ
56+/*
57+ * There is no sane way to deal with nohz on smp when using jiffies because the
58+ * cpu doing the jiffies update might drift wrt the cpu doing the jiffy reading
59+ * causing off-by-one errors in observed deltas; {0,2} instead of {1,1}.
60+ *
61+ * Therefore we cannot use the delta approach from the regular tick since that
62+ * would seriously skew the load calculation. However we'll make do for those
63+ * updates happening while idle (nohz_idle_balance) or coming out of idle
64+ * (tick_nohz_idle_exit).
65+ *
66+ * This means we might still be one tick off for nohz periods.
67+ */
68+
69 /*
70 * Called from nohz_idle_balance() to update the load ratings before doing the
71 * idle balance.
72 */
73 static void update_idle_cpu_load(struct rq *this_rq)
74 {
75- unsigned long curr_jiffies = jiffies;
76+ unsigned long curr_jiffies = ACCESS_ONCE(jiffies);
77 unsigned long load = this_rq->load.weight;
78 unsigned long pending_updates;
79
80 /*
81- * Bloody broken means of dealing with nohz, but better than nothing..
82- * jiffies is updated by one cpu, another cpu can drift wrt the jiffy
83- * update and see 0 difference the one time and 2 the next, even though
84- * we ticked at roughtly the same rate.
85- *
86- * Hence we only use this from nohz_idle_balance() and skip this
87- * nonsense when called from the scheduler_tick() since that's
88- * guaranteed a stable rate.
89+ * bail if there's load or we're actually up-to-date.
90 */
91 if (load || curr_jiffies == this_rq->last_load_update_tick)
92 return;
93@@ -3916,12 +3923,38 @@ static void update_idle_cpu_load(struct rq *this_rq)
94 }
95
96 /*
97+ * Called from tick_nohz_idle_exit() -- try and fix up the ticks we missed.
98+ */
99+void update_cpu_load_nohz(void)
100+{
101+ struct rq *this_rq = this_rq();
102+ unsigned long curr_jiffies = ACCESS_ONCE(jiffies);
103+ unsigned long pending_updates;
104+
105+ if (curr_jiffies == this_rq->last_load_update_tick)
106+ return;
107+
108+ raw_spin_lock(&this_rq->lock);
109+ pending_updates = curr_jiffies - this_rq->last_load_update_tick;
110+ if (pending_updates) {
111+ this_rq->last_load_update_tick = curr_jiffies;
112+ /*
113+ * We were idle, this means load 0, the current load might be
114+ * !0 due to remote wakeups and the sort.
115+ */
116+ __update_cpu_load(this_rq, 0, pending_updates);
117+ }
118+ raw_spin_unlock(&this_rq->lock);
119+}
120+#endif /* CONFIG_NO_HZ */
121+
122+/*
123 * Called from scheduler_tick()
124 */
125 static void update_cpu_load_active(struct rq *this_rq)
126 {
127 /*
128- * See the mess in update_idle_cpu_load().
129+ * See the mess around update_idle_cpu_load() / update_cpu_load_nohz().
130 */
131 this_rq->last_load_update_tick = jiffies;
132 __update_cpu_load(this_rq, this_rq->load.weight, 1);
133diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
134index 9955ebd..793548c 100644
135--- a/kernel/time/tick-sched.c
136+++ b/kernel/time/tick-sched.c
137@@ -549,6 +549,7 @@ void tick_nohz_restart_sched_tick(void)
138 /* Update jiffies first */
139 select_nohz_load_balancer(0);
140 tick_do_update_jiffies64(now);
141+ update_cpu_load_nohz();
142
143 #ifndef CONFIG_VIRT_CPU_ACCOUNTING
144 /*
145--
1461.7.7.6
147
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0020-powerpc-ftrace-Fix-assembly-trampoline-register-usag.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0020-powerpc-ftrace-Fix-assembly-trampoline-register-usag.patch
new file mode 100644
index 00000000..f55431da
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0020-powerpc-ftrace-Fix-assembly-trampoline-register-usag.patch
@@ -0,0 +1,50 @@
1From 033f6d41630ea9916446d27526cad10233c43839 Mon Sep 17 00:00:00 2001
2From: roger blofeld <blofeldus@yahoo.com>
3Date: Thu, 21 Jun 2012 05:27:14 +0000
4Subject: [PATCH 20/73] powerpc/ftrace: Fix assembly trampoline register usage
5
6commit fd5a42980e1cf327b7240adf5e7b51ea41c23437 upstream.
7
8Just like the module loader, ftrace needs to be updated to use r12
9instead of r11 with newer gcc's.
10
11Signed-off-by: Roger Blofeld <blofeldus@yahoo.com>
12Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
14---
15 arch/powerpc/kernel/ftrace.c | 12 ++++++------
16 1 files changed, 6 insertions(+), 6 deletions(-)
17
18diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
19index bf99cfa..6324008 100644
20--- a/arch/powerpc/kernel/ftrace.c
21+++ b/arch/powerpc/kernel/ftrace.c
22@@ -245,9 +245,9 @@ __ftrace_make_nop(struct module *mod,
23
24 /*
25 * On PPC32 the trampoline looks like:
26- * 0x3d, 0x60, 0x00, 0x00 lis r11,sym@ha
27- * 0x39, 0x6b, 0x00, 0x00 addi r11,r11,sym@l
28- * 0x7d, 0x69, 0x03, 0xa6 mtctr r11
29+ * 0x3d, 0x80, 0x00, 0x00 lis r12,sym@ha
30+ * 0x39, 0x8c, 0x00, 0x00 addi r12,r12,sym@l
31+ * 0x7d, 0x89, 0x03, 0xa6 mtctr r12
32 * 0x4e, 0x80, 0x04, 0x20 bctr
33 */
34
35@@ -262,9 +262,9 @@ __ftrace_make_nop(struct module *mod,
36 pr_devel(" %08x %08x ", jmp[0], jmp[1]);
37
38 /* verify that this is what we expect it to be */
39- if (((jmp[0] & 0xffff0000) != 0x3d600000) ||
40- ((jmp[1] & 0xffff0000) != 0x396b0000) ||
41- (jmp[2] != 0x7d6903a6) ||
42+ if (((jmp[0] & 0xffff0000) != 0x3d800000) ||
43+ ((jmp[1] & 0xffff0000) != 0x398c0000) ||
44+ (jmp[2] != 0x7d8903a6) ||
45 (jmp[3] != 0x4e800420)) {
46 printk(KERN_ERR "Not a trampoline\n");
47 return -EINVAL;
48--
491.7.7.6
50
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0021-cx25821-Remove-bad-strcpy-to-read-only-char.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0021-cx25821-Remove-bad-strcpy-to-read-only-char.patch
new file mode 100644
index 00000000..bc425dc8
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0021-cx25821-Remove-bad-strcpy-to-read-only-char.patch
@@ -0,0 +1,53 @@
1From 030eee1110a4bb7e4bce1cb32eb0f1a4fbd9923a Mon Sep 17 00:00:00 2001
2From: Ezequiel Garcia <elezegarcia@gmail.com>
3Date: Wed, 18 Jul 2012 10:05:26 -0300
4Subject: [PATCH 21/73] cx25821: Remove bad strcpy to read-only char*
5
6commit 380e99fc44d79bc35af9ff1d3316ef4027ce775e upstream.
7
8The strcpy was being used to set the name of the board. Since the
9destination char* was read-only and the name is set statically at
10compile time; this was both wrong and redundant.
11
12The type of char* is changed to const char* to prevent future errors.
13
14Reported-by: Radek Masin <radek@masin.eu>
15Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
16[ Taking directly due to vacations - Linus ]
17Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
18Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
19---
20 drivers/media/video/cx25821/cx25821-core.c | 3 ---
21 drivers/media/video/cx25821/cx25821.h | 2 +-
22 2 files changed, 1 insertions(+), 4 deletions(-)
23
24diff --git a/drivers/media/video/cx25821/cx25821-core.c b/drivers/media/video/cx25821/cx25821-core.c
25index a7fa38f..e572ce5 100644
26--- a/drivers/media/video/cx25821/cx25821-core.c
27+++ b/drivers/media/video/cx25821/cx25821-core.c
28@@ -914,9 +914,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
29 list_add_tail(&dev->devlist, &cx25821_devlist);
30 mutex_unlock(&cx25821_devlist_mutex);
31
32- strcpy(cx25821_boards[UNKNOWN_BOARD].name, "unknown");
33- strcpy(cx25821_boards[CX25821_BOARD].name, "cx25821");
34-
35 if (dev->pci->device != 0x8210) {
36 pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n",
37 __func__, dev->pci->device);
38diff --git a/drivers/media/video/cx25821/cx25821.h b/drivers/media/video/cx25821/cx25821.h
39index 2d2d009..bf54360 100644
40--- a/drivers/media/video/cx25821/cx25821.h
41+++ b/drivers/media/video/cx25821/cx25821.h
42@@ -187,7 +187,7 @@ enum port {
43 };
44
45 struct cx25821_board {
46- char *name;
47+ const char *name;
48 enum port porta;
49 enum port portb;
50 enum port portc;
51--
521.7.7.6
53
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0022-x86-Fix-boot-on-Twinhead-H12Y.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0022-x86-Fix-boot-on-Twinhead-H12Y.patch
new file mode 100644
index 00000000..b5eccde1
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0022-x86-Fix-boot-on-Twinhead-H12Y.patch
@@ -0,0 +1,54 @@
1From 25b4c57c33b9972f3b03d5a74c827b27cd9babcf Mon Sep 17 00:00:00 2001
2From: Alan Cox <alan@linux.intel.com>
3Date: Tue, 15 May 2012 18:44:15 +0100
4Subject: [PATCH 22/73] x86: Fix boot on Twinhead H12Y
5
6commit 80b3e557371205566a71e569fbfcce5b11f92dbe upstream.
7
8Despite lots of investigation into why this is needed we don't
9know or have an elegant cure. The only answer found on this
10laptop is to mark a problem region as used so that Linux doesn't
11put anything there.
12
13Currently all the users add reserve= command lines and anyone
14not knowing this needs to find the magic page that documents it.
15Automate it instead.
16
17Signed-off-by: Alan Cox <alan@linux.intel.com>
18Tested-and-bugfixed-by: Arne Fitzenreiter <arne@fitzenreiter.de>
19Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=10231
20Link: http://lkml.kernel.org/r/20120515174347.5109.94551.stgit@bluebook
21Signed-off-by: Ingo Molnar <mingo@kernel.org>
22Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
23---
24 arch/x86/pci/fixup.c | 17 +++++++++++++++++
25 1 files changed, 17 insertions(+), 0 deletions(-)
26
27diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
28index 6dd8955..0951b81 100644
29--- a/arch/x86/pci/fixup.c
30+++ b/arch/x86/pci/fixup.c
31@@ -521,3 +521,20 @@ static void sb600_disable_hpet_bar(struct pci_dev *dev)
32 }
33 }
34 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar);
35+
36+/*
37+ * Twinhead H12Y needs us to block out a region otherwise we map devices
38+ * there and any access kills the box.
39+ *
40+ * See: https://bugzilla.kernel.org/show_bug.cgi?id=10231
41+ *
42+ * Match off the LPC and svid/sdid (older kernels lose the bridge subvendor)
43+ */
44+static void __devinit twinhead_reserve_killing_zone(struct pci_dev *dev)
45+{
46+ if (dev->subsystem_vendor == 0x14FF && dev->subsystem_device == 0xA003) {
47+ pr_info("Reserving memory on Twinhead H12Y\n");
48+ request_mem_region(0xFFB00000, 0x100000, "twinhead");
49+ }
50+}
51+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone);
52--
531.7.7.6
54
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0023-r8169-RxConfig-hack-for-the-8168evl.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0023-r8169-RxConfig-hack-for-the-8168evl.patch
new file mode 100644
index 00000000..35d29c7b
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0023-r8169-RxConfig-hack-for-the-8168evl.patch
@@ -0,0 +1,47 @@
1From 57961c5a47473e6a6aa03292828484bb2d293f04 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?fran=C3=A7ois=20romieu?= <romieu@fr.zoreil.com>
3Date: Wed, 20 Jun 2012 12:09:18 +0000
4Subject: [PATCH 23/73] r8169: RxConfig hack for the 8168evl.
5
6commit eb2dc35d99028b698cdedba4f5522bc43e576bd2 upstream.
7
8The 8168evl (RTL_GIGA_MAC_VER_34) based Gigabyte GA-990FXA motherboards
9are very prone to NETDEV watchdog problems without this change. See
10https://bugzilla.kernel.org/show_bug.cgi?id=42899 for instance.
11
12I don't know why it *works*. It's depressingly effective though.
13
14For the record:
15- the problem may go along IOMMU (AMD-Vi) errors but it really looks
16 like a red herring.
17- the patch sets the RX_MULTI_EN bit. If the 8168c doc is any guide,
18 the chipset now fetches several Rx descriptors at a time.
19- long ago the driver ignored the RX_MULTI_EN bit.
20 e542a2269f232d61270ceddd42b73a4348dee2bb changed the RxConfig
21 settings. Whatever the problem it's now labeled a regression.
22- Realtek's own driver can identify two different 8168evl devices
23 (CFG_METHOD_16 and CFG_METHOD_17) where the r8169 driver only
24 sees one. It sucks.
25
26Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
27Signed-off-by: David S. Miller <davem@davemloft.net>
28Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
29---
30 drivers/net/ethernet/realtek/r8169.c | 1 +
31 1 files changed, 1 insertions(+), 0 deletions(-)
32
33diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
34index 9e61d6b..ed1be8a 100644
35--- a/drivers/net/ethernet/realtek/r8169.c
36+++ b/drivers/net/ethernet/realtek/r8169.c
37@@ -3770,6 +3770,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
38 case RTL_GIGA_MAC_VER_22:
39 case RTL_GIGA_MAC_VER_23:
40 case RTL_GIGA_MAC_VER_24:
41+ case RTL_GIGA_MAC_VER_34:
42 RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST);
43 break;
44 default:
45--
461.7.7.6
47
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0024-cifs-when-CONFIG_HIGHMEM-is-set-serialize-the-read-w.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0024-cifs-when-CONFIG_HIGHMEM-is-set-serialize-the-read-w.patch
new file mode 100644
index 00000000..004839e6
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0024-cifs-when-CONFIG_HIGHMEM-is-set-serialize-the-read-w.patch
@@ -0,0 +1,124 @@
1From 3e3da899949f18869c6958a30a861d89f2d4b73c Mon Sep 17 00:00:00 2001
2From: Jeff Layton <jlayton@redhat.com>
3Date: Wed, 11 Jul 2012 09:09:36 -0400
4Subject: [PATCH 24/73] cifs: when CONFIG_HIGHMEM is set, serialize the
5 read/write kmaps
6
7commit 3cf003c08be785af4bee9ac05891a15bcbff856a upstream.
8
9Jian found that when he ran fsx on a 32 bit arch with a large wsize the
10process and one of the bdi writeback kthreads would sometimes deadlock
11with a stack trace like this:
12
13crash> bt
14PID: 2789 TASK: f02edaa0 CPU: 3 COMMAND: "fsx"
15 #0 [eed63cbc] schedule at c083c5b3
16 #1 [eed63d80] kmap_high at c0500ec8
17 #2 [eed63db0] cifs_async_writev at f7fabcd7 [cifs]
18 #3 [eed63df0] cifs_writepages at f7fb7f5c [cifs]
19 #4 [eed63e50] do_writepages at c04f3e32
20 #5 [eed63e54] __filemap_fdatawrite_range at c04e152a
21 #6 [eed63ea4] filemap_fdatawrite at c04e1b3e
22 #7 [eed63eb4] cifs_file_aio_write at f7fa111a [cifs]
23 #8 [eed63ecc] do_sync_write at c052d202
24 #9 [eed63f74] vfs_write at c052d4ee
25#10 [eed63f94] sys_write at c052df4c
26#11 [eed63fb0] ia32_sysenter_target at c0409a98
27 EAX: 00000004 EBX: 00000003 ECX: abd73b73 EDX: 012a65c6
28 DS: 007b ESI: 012a65c6 ES: 007b EDI: 00000000
29 SS: 007b ESP: bf8db178 EBP: bf8db1f8 GS: 0033
30 CS: 0073 EIP: 40000424 ERR: 00000004 EFLAGS: 00000246
31
32Each task would kmap part of its address array before getting stuck, but
33not enough to actually issue the write.
34
35This patch fixes this by serializing the marshal_iov operations for
36async reads and writes. The idea here is to ensure that cifs
37aggressively tries to populate a request before attempting to fulfill
38another one. As soon as all of the pages are kmapped for a request, then
39we can unlock and allow another one to proceed.
40
41There's no need to do this serialization on non-CONFIG_HIGHMEM arches
42however, so optimize all of this out when CONFIG_HIGHMEM isn't set.
43
44Reported-by: Jian Li <jiali@redhat.com>
45Signed-off-by: Jeff Layton <jlayton@redhat.com>
46Signed-off-by: Steve French <smfrench@gmail.com>
47[bwh: Backported to 3.2: adjust context]
48Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
49---
50 fs/cifs/cifssmb.c | 30 ++++++++++++++++++++++++++++++
51 1 files changed, 30 insertions(+), 0 deletions(-)
52
53diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
54index 6aa7457..c858a29 100644
55--- a/fs/cifs/cifssmb.c
56+++ b/fs/cifs/cifssmb.c
57@@ -89,6 +89,32 @@ static struct {
58 /* Forward declarations */
59 static void cifs_readv_complete(struct work_struct *work);
60
61+#ifdef CONFIG_HIGHMEM
62+/*
63+ * On arches that have high memory, kmap address space is limited. By
64+ * serializing the kmap operations on those arches, we ensure that we don't
65+ * end up with a bunch of threads in writeback with partially mapped page
66+ * arrays, stuck waiting for kmap to come back. That situation prevents
67+ * progress and can deadlock.
68+ */
69+static DEFINE_MUTEX(cifs_kmap_mutex);
70+
71+static inline void
72+cifs_kmap_lock(void)
73+{
74+ mutex_lock(&cifs_kmap_mutex);
75+}
76+
77+static inline void
78+cifs_kmap_unlock(void)
79+{
80+ mutex_unlock(&cifs_kmap_mutex);
81+}
82+#else /* !CONFIG_HIGHMEM */
83+#define cifs_kmap_lock() do { ; } while(0)
84+#define cifs_kmap_unlock() do { ; } while(0)
85+#endif /* CONFIG_HIGHMEM */
86+
87 /* Mark as invalid, all open files on tree connections since they
88 were closed when session to server was lost */
89 static void mark_open_files_invalid(struct cifs_tcon *pTcon)
90@@ -1540,6 +1566,7 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
91 eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0;
92 cFYI(1, "eof=%llu eof_index=%lu", eof, eof_index);
93
94+ cifs_kmap_lock();
95 list_for_each_entry_safe(page, tpage, &rdata->pages, lru) {
96 if (remaining >= PAGE_CACHE_SIZE) {
97 /* enough data to fill the page */
98@@ -1589,6 +1616,7 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
99 page_cache_release(page);
100 }
101 }
102+ cifs_kmap_unlock();
103
104 /* issue the read if we have any iovecs left to fill */
105 if (rdata->nr_iov > 1) {
106@@ -2171,6 +2199,7 @@ cifs_async_writev(struct cifs_writedata *wdata)
107 iov[0].iov_base = smb;
108
109 /* marshal up the pages into iov array */
110+ cifs_kmap_lock();
111 wdata->bytes = 0;
112 for (i = 0; i < wdata->nr_pages; i++) {
113 iov[i + 1].iov_len = min(inode->i_size -
114@@ -2179,6 +2208,7 @@ cifs_async_writev(struct cifs_writedata *wdata)
115 iov[i + 1].iov_base = kmap(wdata->pages[i]);
116 wdata->bytes += iov[i + 1].iov_len;
117 }
118+ cifs_kmap_unlock();
119
120 cFYI(1, "async write at %llu %u bytes", wdata->offset, wdata->bytes);
121
122--
1231.7.7.6
124
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0025-wireless-rt2x00-rt2800usb-add-more-devices-ids.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0025-wireless-rt2x00-rt2800usb-add-more-devices-ids.patch
new file mode 100644
index 00000000..71216d76
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0025-wireless-rt2x00-rt2800usb-add-more-devices-ids.patch
@@ -0,0 +1,89 @@
1From 1b993bd614946837177ce94e29f3d6febec2d7dc Mon Sep 17 00:00:00 2001
2From: Xose Vazquez Perez <xose.vazquez@gmail.com>
3Date: Tue, 17 Apr 2012 01:50:32 +0200
4Subject: [PATCH 25/73] wireless: rt2x00: rt2800usb add more devices ids
5
6commit 63b376411173c343bbcb450f95539da91f079e0c upstream.
7
8They were taken from ralink drivers:
92011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO
102012_03_22_RT5572_Linux_STA_v2.6.0.0_DPO
11
120x1eda,0x2210 RT3070 Airties
13
140x083a,0xb511 RT3370 Panasonic
150x0471,0x20dd RT3370 Philips
16
170x1690,0x0764 RT35xx Askey
180x0df6,0x0065 RT35xx Sitecom
190x0df6,0x0066 RT35xx Sitecom
200x0df6,0x0068 RT35xx Sitecom
21
220x2001,0x3c1c RT5370 DLink
230x2001,0x3c1d RT5370 DLink
24
252001 is D-Link not Alpha
26
27Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
28Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
29Signed-off-by: John W. Linville <linville@tuxdriver.com>
30[bwh: Backported to 3.2: drop the 5372 devices]
31Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
32---
33 drivers/net/wireless/rt2x00/rt2800usb.c | 12 ++++++++++++
34 1 files changed, 12 insertions(+), 0 deletions(-)
35
36diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
37index 0ffa111..f05a12d 100644
38--- a/drivers/net/wireless/rt2x00/rt2800usb.c
39+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
40@@ -876,6 +876,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
41 { USB_DEVICE(0x1482, 0x3c09) },
42 /* AirTies */
43 { USB_DEVICE(0x1eda, 0x2012) },
44+ { USB_DEVICE(0x1eda, 0x2210) },
45 { USB_DEVICE(0x1eda, 0x2310) },
46 /* Allwin */
47 { USB_DEVICE(0x8516, 0x2070) },
48@@ -1088,6 +1089,10 @@ static struct usb_device_id rt2800usb_device_table[] = {
49 #ifdef CONFIG_RT2800USB_RT33XX
50 /* Belkin */
51 { USB_DEVICE(0x050d, 0x945b) },
52+ /* Panasonic */
53+ { USB_DEVICE(0x083a, 0xb511) },
54+ /* Philips */
55+ { USB_DEVICE(0x0471, 0x20dd) },
56 /* Ralink */
57 { USB_DEVICE(0x148f, 0x3370) },
58 { USB_DEVICE(0x148f, 0x8070) },
59@@ -1099,6 +1104,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
60 { USB_DEVICE(0x8516, 0x3572) },
61 /* Askey */
62 { USB_DEVICE(0x1690, 0x0744) },
63+ { USB_DEVICE(0x1690, 0x0764) },
64 /* Cisco */
65 { USB_DEVICE(0x167b, 0x4001) },
66 /* EnGenius */
67@@ -1113,6 +1119,9 @@ static struct usb_device_id rt2800usb_device_table[] = {
68 /* Sitecom */
69 { USB_DEVICE(0x0df6, 0x0041) },
70 { USB_DEVICE(0x0df6, 0x0062) },
71+ { USB_DEVICE(0x0df6, 0x0065) },
72+ { USB_DEVICE(0x0df6, 0x0066) },
73+ { USB_DEVICE(0x0df6, 0x0068) },
74 /* Toshiba */
75 { USB_DEVICE(0x0930, 0x0a07) },
76 /* Zinwell */
77@@ -1122,6 +1131,9 @@ static struct usb_device_id rt2800usb_device_table[] = {
78 /* Azurewave */
79 { USB_DEVICE(0x13d3, 0x3329) },
80 { USB_DEVICE(0x13d3, 0x3365) },
81+ /* D-Link */
82+ { USB_DEVICE(0x2001, 0x3c1c) },
83+ { USB_DEVICE(0x2001, 0x3c1d) },
84 /* Ralink */
85 { USB_DEVICE(0x148f, 0x5370) },
86 { USB_DEVICE(0x148f, 0x5372) },
87--
881.7.7.6
89
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0026-wireless-rt2x00-rt2800usb-more-devices-were-identifi.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0026-wireless-rt2x00-rt2800usb-more-devices-were-identifi.patch
new file mode 100644
index 00000000..afed1376
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0026-wireless-rt2x00-rt2800usb-more-devices-were-identifi.patch
@@ -0,0 +1,79 @@
1From 53157c2a7eda6ba98def241f183a06a6f28f852f Mon Sep 17 00:00:00 2001
2From: Xose Vazquez Perez <xose.vazquez@gmail.com>
3Date: Tue, 17 Apr 2012 16:28:05 +0200
4Subject: [PATCH 26/73] wireless: rt2x00: rt2800usb more devices were
5 identified
6
7commit e828b9fb4f6c3513950759d5fb902db5bd054048 upstream.
8
9found in 2012_03_22_RT5572_Linux_STA_v2.6.0.0_DPO
10
11RT3070:
12(0x2019,0x5201) Planex Communications, Inc. RT8070
13(0x7392,0x4085) 2L Central Europe BV 8070
147392 is Edimax
15
16RT35xx:
17(0x1690,0x0761) Askey
18was Fujitsu Stylistic 550, but 1690 is Askey
19
20Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
21Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
22Signed-off-by: John W. Linville <linville@tuxdriver.com>
23Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
24---
25 drivers/net/wireless/rt2x00/rt2800usb.c | 8 +++-----
26 1 files changed, 3 insertions(+), 5 deletions(-)
27
28diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
29index f05a12d..76ebba4 100644
30--- a/drivers/net/wireless/rt2x00/rt2800usb.c
31+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
32@@ -946,6 +946,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
33 /* DVICO */
34 { USB_DEVICE(0x0fe9, 0xb307) },
35 /* Edimax */
36+ { USB_DEVICE(0x7392, 0x4085) },
37 { USB_DEVICE(0x7392, 0x7711) },
38 { USB_DEVICE(0x7392, 0x7717) },
39 { USB_DEVICE(0x7392, 0x7718) },
40@@ -1021,6 +1022,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
41 /* Philips */
42 { USB_DEVICE(0x0471, 0x200f) },
43 /* Planex */
44+ { USB_DEVICE(0x2019, 0x5201) },
45 { USB_DEVICE(0x2019, 0xab25) },
46 { USB_DEVICE(0x2019, 0xed06) },
47 /* Quanta */
48@@ -1104,6 +1106,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
49 { USB_DEVICE(0x8516, 0x3572) },
50 /* Askey */
51 { USB_DEVICE(0x1690, 0x0744) },
52+ { USB_DEVICE(0x1690, 0x0761) },
53 { USB_DEVICE(0x1690, 0x0764) },
54 /* Cisco */
55 { USB_DEVICE(0x167b, 0x4001) },
56@@ -1176,12 +1179,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
57 { USB_DEVICE(0x07d1, 0x3c0b) },
58 { USB_DEVICE(0x07d1, 0x3c17) },
59 { USB_DEVICE(0x2001, 0x3c17) },
60- /* Edimax */
61- { USB_DEVICE(0x7392, 0x4085) },
62 /* Encore */
63 { USB_DEVICE(0x203d, 0x14a1) },
64- /* Fujitsu Stylistic 550 */
65- { USB_DEVICE(0x1690, 0x0761) },
66 /* Gemtek */
67 { USB_DEVICE(0x15a9, 0x0010) },
68 /* Gigabyte */
69@@ -1202,7 +1201,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
70 { USB_DEVICE(0x05a6, 0x0101) },
71 { USB_DEVICE(0x1d4d, 0x0010) },
72 /* Planex */
73- { USB_DEVICE(0x2019, 0x5201) },
74 { USB_DEVICE(0x2019, 0xab24) },
75 /* Qcom */
76 { USB_DEVICE(0x18e8, 0x6259) },
77--
781.7.7.6
79
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0027-rt2800usb-2001-3c17-is-an-RT3370-device.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0027-rt2800usb-2001-3c17-is-an-RT3370-device.patch
new file mode 100644
index 00000000..fb65d15a
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0027-rt2800usb-2001-3c17-is-an-RT3370-device.patch
@@ -0,0 +1,41 @@
1From b35733e76251b308e5a65e60630261571c85f9f3 Mon Sep 17 00:00:00 2001
2From: Albert Pool <albertpool@solcon.nl>
3Date: Mon, 14 May 2012 18:08:32 +0200
4Subject: [PATCH 27/73] rt2800usb: 2001:3c17 is an RT3370 device
5
6commit 8fd9d059af12786341dec5a688e607bcdb372238 upstream.
7
8D-Link DWA-123 rev A1
9
10Signed-off-by: Albert Pool<albertpool@solcon.nl>
11Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
12Signed-off-by: John W. Linville <linville@tuxdriver.com>
13Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
14---
15 drivers/net/wireless/rt2x00/rt2800usb.c | 3 ++-
16 1 files changed, 2 insertions(+), 1 deletions(-)
17
18diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
19index 76ebba4..bdf960b 100644
20--- a/drivers/net/wireless/rt2x00/rt2800usb.c
21+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
22@@ -1091,6 +1091,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
23 #ifdef CONFIG_RT2800USB_RT33XX
24 /* Belkin */
25 { USB_DEVICE(0x050d, 0x945b) },
26+ /* D-Link */
27+ { USB_DEVICE(0x2001, 0x3c17) },
28 /* Panasonic */
29 { USB_DEVICE(0x083a, 0xb511) },
30 /* Philips */
31@@ -1178,7 +1180,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
32 /* D-Link */
33 { USB_DEVICE(0x07d1, 0x3c0b) },
34 { USB_DEVICE(0x07d1, 0x3c17) },
35- { USB_DEVICE(0x2001, 0x3c17) },
36 /* Encore */
37 { USB_DEVICE(0x203d, 0x14a1) },
38 /* Gemtek */
39--
401.7.7.6
41
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0028-usb-gadget-Fix-g_ether-interface-link-status.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0028-usb-gadget-Fix-g_ether-interface-link-status.patch
new file mode 100644
index 00000000..2dcadb88
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0028-usb-gadget-Fix-g_ether-interface-link-status.patch
@@ -0,0 +1,61 @@
1From f91bc4d604edd5b09021245b6643cfeebc707f2b Mon Sep 17 00:00:00 2001
2From: Kevin Cernekee <cernekee@gmail.com>
3Date: Sun, 24 Jun 2012 21:11:22 -0700
4Subject: [PATCH 28/73] usb: gadget: Fix g_ether interface link status
5
6commit 31bde1ceaa873bcaecd49e829bfabceacc4c512d upstream.
7
8A "usb0" interface that has never been connected to a host has an unknown
9operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted
10when queried by ifconfig, ifplugd, etc. This is a result of calling
11netif_carrier_off() too early in the probe function; it should be called
12after register_netdev().
13
14Similar problems have been fixed in many other drivers, e.g.:
15
16 e826eafa6 (bonding: Call netif_carrier_off after register_netdevice)
17 0d672e9f8 (drivers/net: Call netif_carrier_off at the end of the probe)
18 6a3c869a6 (cxgb4: fix reported state of interfaces without link)
19
20Fix is to move netif_carrier_off() to the end of the function.
21
22Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
23Signed-off-by: Felipe Balbi <balbi@ti.com>
24Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
25---
26 drivers/usb/gadget/u_ether.c | 12 ++++++------
27 1 files changed, 6 insertions(+), 6 deletions(-)
28
29diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
30index 29c854b..4e1f0aa 100644
31--- a/drivers/usb/gadget/u_ether.c
32+++ b/drivers/usb/gadget/u_ether.c
33@@ -796,12 +796,6 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
34
35 SET_ETHTOOL_OPS(net, &ops);
36
37- /* two kinds of host-initiated state changes:
38- * - iff DATA transfer is active, carrier is "on"
39- * - tx queueing enabled if open *and* carrier is "on"
40- */
41- netif_carrier_off(net);
42-
43 dev->gadget = g;
44 SET_NETDEV_DEV(net, &g->dev);
45 SET_NETDEV_DEVTYPE(net, &gadget_type);
46@@ -815,6 +809,12 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
47 INFO(dev, "HOST MAC %pM\n", dev->host_mac);
48
49 the_dev = dev;
50+
51+ /* two kinds of host-initiated state changes:
52+ * - iff DATA transfer is active, carrier is "on"
53+ * - tx queueing enabled if open *and* carrier is "on"
54+ */
55+ netif_carrier_off(net);
56 }
57
58 return status;
59--
601.7.7.6
61
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0029-ext4-pass-a-char-to-ext4_count_free-instead-of-a-buf.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0029-ext4-pass-a-char-to-ext4_count_free-instead-of-a-buf.patch
new file mode 100644
index 00000000..9286436a
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0029-ext4-pass-a-char-to-ext4_count_free-instead-of-a-buf.patch
@@ -0,0 +1,88 @@
1From e872f4ac0de4e1898a669e2c8a7185ef76f266fb Mon Sep 17 00:00:00 2001
2From: Theodore Ts'o <tytso@mit.edu>
3Date: Sat, 30 Jun 2012 19:14:57 -0400
4Subject: [PATCH 29/73] ext4: pass a char * to ext4_count_free() instead of a
5 buffer_head ptr
6
7commit f6fb99cadcd44660c68e13f6eab28333653621e6 upstream.
8
9Make it possible for ext4_count_free to operate on buffers and not
10just data in buffer_heads.
11
12Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13[bwh: Backported to 3.2: adjust context]
14Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
15---
16 fs/ext4/balloc.c | 3 ++-
17 fs/ext4/bitmap.c | 8 +++-----
18 fs/ext4/ext4.h | 2 +-
19 fs/ext4/ialloc.c | 3 ++-
20 4 files changed, 8 insertions(+), 8 deletions(-)
21
22diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
23index 914bf9e..d6970f7 100644
24--- a/fs/ext4/balloc.c
25+++ b/fs/ext4/balloc.c
26@@ -557,7 +557,8 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
27 if (bitmap_bh == NULL)
28 continue;
29
30- x = ext4_count_free(bitmap_bh, sb->s_blocksize);
31+ x = ext4_count_free(bitmap_bh->b_data,
32+ EXT4_BLOCKS_PER_GROUP(sb) / 8);
33 printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n",
34 i, ext4_free_group_clusters(sb, gdp), x);
35 bitmap_count += x;
36diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
37index fa3af81..012faaa 100644
38--- a/fs/ext4/bitmap.c
39+++ b/fs/ext4/bitmap.c
40@@ -15,15 +15,13 @@
41
42 static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
43
44-unsigned int ext4_count_free(struct buffer_head *map, unsigned int numchars)
45+unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
46 {
47 unsigned int i, sum = 0;
48
49- if (!map)
50- return 0;
51 for (i = 0; i < numchars; i++)
52- sum += nibblemap[map->b_data[i] & 0xf] +
53- nibblemap[(map->b_data[i] >> 4) & 0xf];
54+ sum += nibblemap[bitmap[i] & 0xf] +
55+ nibblemap[(bitmap[i] >> 4) & 0xf];
56 return sum;
57 }
58
59diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
60index 7b1cd5c..873897c 100644
61--- a/fs/ext4/ext4.h
62+++ b/fs/ext4/ext4.h
63@@ -1757,7 +1757,7 @@ struct mmpd_data {
64 # define NORET_AND noreturn,
65
66 /* bitmap.c */
67-extern unsigned int ext4_count_free(struct buffer_head *, unsigned);
68+extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
69
70 /* balloc.c */
71 extern unsigned int ext4_block_group(struct super_block *sb,
72diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
73index 8fb6844..6266799 100644
74--- a/fs/ext4/ialloc.c
75+++ b/fs/ext4/ialloc.c
76@@ -1057,7 +1057,8 @@ unsigned long ext4_count_free_inodes(struct super_block *sb)
77 if (!bitmap_bh)
78 continue;
79
80- x = ext4_count_free(bitmap_bh, EXT4_INODES_PER_GROUP(sb) / 8);
81+ x = ext4_count_free(bitmap_bh->b_data,
82+ EXT4_INODES_PER_GROUP(sb) / 8);
83 printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n",
84 (unsigned long) i, ext4_free_inodes_count(sb, gdp), x);
85 bitmap_count += x;
86--
871.7.7.6
88
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0030-ftrace-Disable-function-tracing-during-suspend-resum.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0030-ftrace-Disable-function-tracing-during-suspend-resum.patch
new file mode 100644
index 00000000..3ec5202b
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0030-ftrace-Disable-function-tracing-during-suspend-resum.patch
@@ -0,0 +1,113 @@
1From 951ac5885b5a314d394ea0668dedccd7ed9216e5 Mon Sep 17 00:00:00 2001
2From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
3Date: Sat, 16 Jun 2012 15:30:45 +0200
4Subject: [PATCH 30/73] ftrace: Disable function tracing during suspend/resume
5 and hibernation, again
6
7commit 443772d408a25af62498793f6f805ce3c559309a upstream.
8
9If function tracing is enabled for some of the low-level suspend/resume
10functions, it leads to triple fault during resume from suspend, ultimately
11ending up in a reboot instead of a resume (or a total refusal to come out
12of suspended state, on some machines).
13
14This issue was explained in more detail in commit f42ac38c59e0a03d (ftrace:
15disable tracing for suspend to ram). However, the changes made by that commit
16got reverted by commit cbe2f5a6e84eebb (tracing: allow tracing of
17suspend/resume & hibernation code again). So, unfortunately since things are
18not yet robust enough to allow tracing of low-level suspend/resume functions,
19suspend/resume is still broken when ftrace is enabled.
20
21So fix this by disabling function tracing during suspend/resume & hibernation.
22
23Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
24Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
25Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
26---
27 kernel/power/hibernate.c | 6 ++++++
28 kernel/power/suspend.c | 3 +++
29 2 files changed, 9 insertions(+), 0 deletions(-)
30
31diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
32index 7c0d578..013bd2e 100644
33--- a/kernel/power/hibernate.c
34+++ b/kernel/power/hibernate.c
35@@ -367,6 +367,7 @@ int hibernation_snapshot(int platform_mode)
36 }
37
38 suspend_console();
39+ ftrace_stop();
40 pm_restrict_gfp_mask();
41 error = dpm_suspend(PMSG_FREEZE);
42 if (error)
43@@ -392,6 +393,7 @@ int hibernation_snapshot(int platform_mode)
44 if (error || !in_suspend)
45 pm_restore_gfp_mask();
46
47+ ftrace_start();
48 resume_console();
49 dpm_complete(msg);
50
51@@ -496,6 +498,7 @@ int hibernation_restore(int platform_mode)
52
53 pm_prepare_console();
54 suspend_console();
55+ ftrace_stop();
56 pm_restrict_gfp_mask();
57 error = dpm_suspend_start(PMSG_QUIESCE);
58 if (!error) {
59@@ -503,6 +506,7 @@ int hibernation_restore(int platform_mode)
60 dpm_resume_end(PMSG_RECOVER);
61 }
62 pm_restore_gfp_mask();
63+ ftrace_start();
64 resume_console();
65 pm_restore_console();
66 return error;
67@@ -529,6 +533,7 @@ int hibernation_platform_enter(void)
68
69 entering_platform_hibernation = true;
70 suspend_console();
71+ ftrace_stop();
72 error = dpm_suspend_start(PMSG_HIBERNATE);
73 if (error) {
74 if (hibernation_ops->recover)
75@@ -572,6 +577,7 @@ int hibernation_platform_enter(void)
76 Resume_devices:
77 entering_platform_hibernation = false;
78 dpm_resume_end(PMSG_RESTORE);
79+ ftrace_start();
80 resume_console();
81
82 Close:
83diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
84index 4953dc0..af48faa 100644
85--- a/kernel/power/suspend.c
86+++ b/kernel/power/suspend.c
87@@ -25,6 +25,7 @@
88 #include <linux/export.h>
89 #include <linux/suspend.h>
90 #include <linux/syscore_ops.h>
91+#include <linux/ftrace.h>
92 #include <trace/events/power.h>
93
94 #include "power.h"
95@@ -220,6 +221,7 @@ int suspend_devices_and_enter(suspend_state_t state)
96 goto Close;
97 }
98 suspend_console();
99+ ftrace_stop();
100 suspend_test_start();
101 error = dpm_suspend_start(PMSG_SUSPEND);
102 if (error) {
103@@ -239,6 +241,7 @@ int suspend_devices_and_enter(suspend_state_t state)
104 suspend_test_start();
105 dpm_resume_end(PMSG_RESUME);
106 suspend_test_finish("resume devices");
107+ ftrace_start();
108 resume_console();
109 Close:
110 if (suspend_ops->end)
111--
1121.7.7.6
113
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0031-x86-microcode-microcode_core.c-simple_strtoul-cleanu.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0031-x86-microcode-microcode_core.c-simple_strtoul-cleanu.patch
new file mode 100644
index 00000000..abdc7b17
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0031-x86-microcode-microcode_core.c-simple_strtoul-cleanu.patch
@@ -0,0 +1,44 @@
1From a0ac7c345c81631057085b53d0b5de53efb8d241 Mon Sep 17 00:00:00 2001
2From: Shuah Khan <shuahkhan@gmail.com>
3Date: Sun, 6 May 2012 11:11:04 -0600
4Subject: [PATCH 31/73] x86, microcode: microcode_core.c simple_strtoul
5 cleanup
6
7commit e826abd523913f63eb03b59746ffb16153c53dc4 upstream.
8
9Change reload_for_cpu() in kernel/microcode_core.c to call kstrtoul()
10instead of calling obsoleted simple_strtoul().
11
12Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
13Reviewed-by: Borislav Petkov <bp@alien8.de>
14Link: http://lkml.kernel.org/r/1336324264.2897.9.camel@lorien2
15Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
16Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
17---
18 arch/x86/kernel/microcode_core.c | 9 ++++-----
19 1 files changed, 4 insertions(+), 5 deletions(-)
20
21diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
22index 563a09d..19c7af1 100644
23--- a/arch/x86/kernel/microcode_core.c
24+++ b/arch/x86/kernel/microcode_core.c
25@@ -298,12 +298,11 @@ static ssize_t reload_store(struct sys_device *dev,
26 {
27 unsigned long val;
28 int cpu = dev->id;
29- int ret = 0;
30- char *end;
31+ ssize_t ret = 0;
32
33- val = simple_strtoul(buf, &end, 0);
34- if (end == buf)
35- return -EINVAL;
36+ ret = kstrtoul(buf, 0, &val);
37+ if (ret)
38+ return ret;
39
40 if (val == 1) {
41 get_online_cpus();
42--
431.7.7.6
44
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0032-x86-microcode-Sanitize-per-cpu-microcode-reloading-i.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0032-x86-microcode-Sanitize-per-cpu-microcode-reloading-i.patch
new file mode 100644
index 00000000..824c0394
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0032-x86-microcode-Sanitize-per-cpu-microcode-reloading-i.patch
@@ -0,0 +1,92 @@
1From 6a7d02f3957e572d5e35fc71df90a3a7311e383d Mon Sep 17 00:00:00 2001
2From: Borislav Petkov <borislav.petkov@amd.com>
3Date: Thu, 21 Jun 2012 14:07:16 +0200
4Subject: [PATCH 32/73] x86, microcode: Sanitize per-cpu microcode reloading
5 interface
6
7commit c9fc3f778a6a215ace14ee556067c73982b6d40f upstream.
8
9Microcode reloading in a per-core manner is a very bad idea for both
10major x86 vendors. And the thing is, we have such interface with which
11we can end up with different microcode versions applied on different
12cores of an otherwise homogeneous wrt (family,model,stepping) system.
13
14So turn off the possibility of doing that per core and allow it only
15system-wide.
16
17This is a minimal fix which we'd like to see in stable too thus the
18more-or-less arbitrary decision to allow system-wide reloading only on
19the BSP:
20
21$ echo 1 > /sys/devices/system/cpu/cpu0/microcode/reload
22...
23
24and disable the interface on the other cores:
25
26$ echo 1 > /sys/devices/system/cpu/cpu23/microcode/reload
27-bash: echo: write error: Invalid argument
28
29Also, allowing the reload only from one CPU (the BSP in
30that case) doesn't allow the reload procedure to degenerate
31into an O(n^2) deal when triggering reloads from all
32/sys/devices/system/cpu/cpuX/microcode/reload sysfs nodes
33simultaneously.
34
35A more generic fix will follow.
36
37Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
38Cc: Peter Zijlstra <peterz@infradead.org>
39Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
40Link: http://lkml.kernel.org/r/1340280437-7718-2-git-send-email-bp@amd64.org
41Signed-off-by: H. Peter Anvin <hpa@zytor.com>
42Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
43---
44 arch/x86/kernel/microcode_core.c | 26 +++++++++++++++++++-------
45 1 files changed, 19 insertions(+), 7 deletions(-)
46
47diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
48index 19c7af1..29c95d7 100644
49--- a/arch/x86/kernel/microcode_core.c
50+++ b/arch/x86/kernel/microcode_core.c
51@@ -297,19 +297,31 @@ static ssize_t reload_store(struct sys_device *dev,
52 const char *buf, size_t size)
53 {
54 unsigned long val;
55- int cpu = dev->id;
56- ssize_t ret = 0;
57+ int cpu;
58+ ssize_t ret = 0, tmp_ret;
59+
60+ /* allow reload only from the BSP */
61+ if (boot_cpu_data.cpu_index != dev->id)
62+ return -EINVAL;
63
64 ret = kstrtoul(buf, 0, &val);
65 if (ret)
66 return ret;
67
68- if (val == 1) {
69- get_online_cpus();
70- if (cpu_online(cpu))
71- ret = reload_for_cpu(cpu);
72- put_online_cpus();
73+ if (val != 1)
74+ return size;
75+
76+ get_online_cpus();
77+ for_each_online_cpu(cpu) {
78+ tmp_ret = reload_for_cpu(cpu);
79+ if (tmp_ret != 0)
80+ pr_warn("Error reloading microcode on CPU %d\n", cpu);
81+
82+ /* save retval of the first encountered reload error */
83+ if (!ret)
84+ ret = tmp_ret;
85 }
86+ put_online_cpus();
87
88 if (!ret)
89 ret = size;
90--
911.7.7.6
92
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0033-usbdevfs-Correct-amount-of-data-copied-to-user-in-pr.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0033-usbdevfs-Correct-amount-of-data-copied-to-user-in-pr.patch
new file mode 100644
index 00000000..044c7d0f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0033-usbdevfs-Correct-amount-of-data-copied-to-user-in-pr.patch
@@ -0,0 +1,45 @@
1From ab66ac59913202f29a32377f4e8bcfd730a8f31d Mon Sep 17 00:00:00 2001
2From: Hans de Goede <hdegoede@redhat.com>
3Date: Wed, 4 Jul 2012 09:18:01 +0200
4Subject: [PATCH 33/73] usbdevfs: Correct amount of data copied to user in
5 processcompl_compat
6
7commit 2102e06a5f2e414694921f23591f072a5ba7db9f upstream.
8
9iso data buffers may have holes in them if some packets were short, so for
10iso urbs we should always copy the entire buffer, just like the regular
11processcompl does.
12
13Signed-off-by: Hans de Goede <hdegoede@redhat.com>
14Acked-by: Alan Stern <stern@rowland.harvard.edu>
15Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
17---
18 drivers/usb/core/devio.c | 10 +++++++---
19 1 files changed, 7 insertions(+), 3 deletions(-)
20
21diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
22index f6ff837..a9df218 100644
23--- a/drivers/usb/core/devio.c
24+++ b/drivers/usb/core/devio.c
25@@ -1555,10 +1555,14 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
26 void __user *addr = as->userurb;
27 unsigned int i;
28
29- if (as->userbuffer && urb->actual_length)
30- if (copy_to_user(as->userbuffer, urb->transfer_buffer,
31- urb->actual_length))
32+ if (as->userbuffer && urb->actual_length) {
33+ if (urb->number_of_packets > 0) /* Isochronous */
34+ i = urb->transfer_buffer_length;
35+ else /* Non-Isoc */
36+ i = urb->actual_length;
37+ if (copy_to_user(as->userbuffer, urb->transfer_buffer, i))
38 return -EFAULT;
39+ }
40 if (put_user(as->status, &userurb->status))
41 return -EFAULT;
42 if (put_user(urb->actual_length, &userurb->actual_length))
43--
441.7.7.6
45
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0034-ext4-fix-overhead-calculation-used-by-ext4_statfs.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0034-ext4-fix-overhead-calculation-used-by-ext4_statfs.patch
new file mode 100644
index 00000000..3fc3812f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0034-ext4-fix-overhead-calculation-used-by-ext4_statfs.patch
@@ -0,0 +1,294 @@
1From 838475547b3c83537e291b997da546b518f591b3 Mon Sep 17 00:00:00 2001
2From: Theodore Ts'o <tytso@mit.edu>
3Date: Mon, 9 Jul 2012 16:27:05 -0400
4Subject: [PATCH 34/73] ext4: fix overhead calculation used by ext4_statfs()
5
6commit 952fc18ef9ec707ebdc16c0786ec360295e5ff15 upstream.
7
8Commit f975d6bcc7a introduced bug which caused ext4_statfs() to
9miscalculate the number of file system overhead blocks. This causes
10the f_blocks field in the statfs structure to be larger than it should
11be. This would in turn cause the "df" output to show the number of
12data blocks in the file system and the number of data blocks used to
13be larger than they should be.
14
15Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
16[bwh: Backported to 3.2: adjust context]
17Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
18---
19 fs/ext4/bitmap.c | 4 -
20 fs/ext4/ext4.h | 4 +-
21 fs/ext4/resize.c | 5 ++
22 fs/ext4/super.c | 174 ++++++++++++++++++++++++++++++++++++++----------------
23 4 files changed, 131 insertions(+), 56 deletions(-)
24
25diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
26index 012faaa..bbde5d5 100644
27--- a/fs/ext4/bitmap.c
28+++ b/fs/ext4/bitmap.c
29@@ -11,8 +11,6 @@
30 #include <linux/jbd2.h>
31 #include "ext4.h"
32
33-#ifdef EXT4FS_DEBUG
34-
35 static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
36
37 unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
38@@ -25,5 +23,3 @@ unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
39 return sum;
40 }
41
42-#endif /* EXT4FS_DEBUG */
43-
44diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
45index 873897c..8cb184c 100644
46--- a/fs/ext4/ext4.h
47+++ b/fs/ext4/ext4.h
48@@ -1123,8 +1123,7 @@ struct ext4_sb_info {
49 unsigned long s_desc_per_block; /* Number of group descriptors per block */
50 ext4_group_t s_groups_count; /* Number of groups in the fs */
51 ext4_group_t s_blockfile_groups;/* Groups acceptable for non-extent files */
52- unsigned long s_overhead_last; /* Last calculated overhead */
53- unsigned long s_blocks_last; /* Last seen block count */
54+ unsigned long s_overhead; /* # of fs overhead clusters */
55 unsigned int s_cluster_ratio; /* Number of blocks per cluster */
56 unsigned int s_cluster_bits; /* log2 of s_cluster_ratio */
57 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
58@@ -1925,6 +1924,7 @@ extern int ext4_group_extend(struct super_block *sb,
59 ext4_fsblk_t n_blocks_count);
60
61 /* super.c */
62+extern int ext4_calculate_overhead(struct super_block *sb);
63 extern void *ext4_kvmalloc(size_t size, gfp_t flags);
64 extern void *ext4_kvzalloc(size_t size, gfp_t flags);
65 extern void ext4_kvfree(void *ptr);
66diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
67index 996780a..4eac337 100644
68--- a/fs/ext4/resize.c
69+++ b/fs/ext4/resize.c
70@@ -952,6 +952,11 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
71 &sbi->s_flex_groups[flex_group].free_inodes);
72 }
73
74+ /*
75+ * Update the fs overhead information
76+ */
77+ ext4_calculate_overhead(sb);
78+
79 ext4_handle_dirty_super(handle, sb);
80
81 exit_journal:
82diff --git a/fs/ext4/super.c b/fs/ext4/super.c
83index a93486e..a071348 100644
84--- a/fs/ext4/super.c
85+++ b/fs/ext4/super.c
86@@ -3083,6 +3083,114 @@ static void ext4_destroy_lazyinit_thread(void)
87 kthread_stop(ext4_lazyinit_task);
88 }
89
90+/*
91+ * Note: calculating the overhead so we can be compatible with
92+ * historical BSD practice is quite difficult in the face of
93+ * clusters/bigalloc. This is because multiple metadata blocks from
94+ * different block group can end up in the same allocation cluster.
95+ * Calculating the exact overhead in the face of clustered allocation
96+ * requires either O(all block bitmaps) in memory or O(number of block
97+ * groups**2) in time. We will still calculate the superblock for
98+ * older file systems --- and if we come across with a bigalloc file
99+ * system with zero in s_overhead_clusters the estimate will be close to
100+ * correct especially for very large cluster sizes --- but for newer
101+ * file systems, it's better to calculate this figure once at mkfs
102+ * time, and store it in the superblock. If the superblock value is
103+ * present (even for non-bigalloc file systems), we will use it.
104+ */
105+static int count_overhead(struct super_block *sb, ext4_group_t grp,
106+ char *buf)
107+{
108+ struct ext4_sb_info *sbi = EXT4_SB(sb);
109+ struct ext4_group_desc *gdp;
110+ ext4_fsblk_t first_block, last_block, b;
111+ ext4_group_t i, ngroups = ext4_get_groups_count(sb);
112+ int s, j, count = 0;
113+
114+ first_block = le32_to_cpu(sbi->s_es->s_first_data_block) +
115+ (grp * EXT4_BLOCKS_PER_GROUP(sb));
116+ last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1;
117+ for (i = 0; i < ngroups; i++) {
118+ gdp = ext4_get_group_desc(sb, i, NULL);
119+ b = ext4_block_bitmap(sb, gdp);
120+ if (b >= first_block && b <= last_block) {
121+ ext4_set_bit(EXT4_B2C(sbi, b - first_block), buf);
122+ count++;
123+ }
124+ b = ext4_inode_bitmap(sb, gdp);
125+ if (b >= first_block && b <= last_block) {
126+ ext4_set_bit(EXT4_B2C(sbi, b - first_block), buf);
127+ count++;
128+ }
129+ b = ext4_inode_table(sb, gdp);
130+ if (b >= first_block && b + sbi->s_itb_per_group <= last_block)
131+ for (j = 0; j < sbi->s_itb_per_group; j++, b++) {
132+ int c = EXT4_B2C(sbi, b - first_block);
133+ ext4_set_bit(c, buf);
134+ count++;
135+ }
136+ if (i != grp)
137+ continue;
138+ s = 0;
139+ if (ext4_bg_has_super(sb, grp)) {
140+ ext4_set_bit(s++, buf);
141+ count++;
142+ }
143+ for (j = ext4_bg_num_gdb(sb, grp); j > 0; j--) {
144+ ext4_set_bit(EXT4_B2C(sbi, s++), buf);
145+ count++;
146+ }
147+ }
148+ if (!count)
149+ return 0;
150+ return EXT4_CLUSTERS_PER_GROUP(sb) -
151+ ext4_count_free(buf, EXT4_CLUSTERS_PER_GROUP(sb) / 8);
152+}
153+
154+/*
155+ * Compute the overhead and stash it in sbi->s_overhead
156+ */
157+int ext4_calculate_overhead(struct super_block *sb)
158+{
159+ struct ext4_sb_info *sbi = EXT4_SB(sb);
160+ struct ext4_super_block *es = sbi->s_es;
161+ ext4_group_t i, ngroups = ext4_get_groups_count(sb);
162+ ext4_fsblk_t overhead = 0;
163+ char *buf = (char *) get_zeroed_page(GFP_KERNEL);
164+
165+ memset(buf, 0, PAGE_SIZE);
166+ if (!buf)
167+ return -ENOMEM;
168+
169+ /*
170+ * Compute the overhead (FS structures). This is constant
171+ * for a given filesystem unless the number of block groups
172+ * changes so we cache the previous value until it does.
173+ */
174+
175+ /*
176+ * All of the blocks before first_data_block are overhead
177+ */
178+ overhead = EXT4_B2C(sbi, le32_to_cpu(es->s_first_data_block));
179+
180+ /*
181+ * Add the overhead found in each block group
182+ */
183+ for (i = 0; i < ngroups; i++) {
184+ int blks;
185+
186+ blks = count_overhead(sb, i, buf);
187+ overhead += blks;
188+ if (blks)
189+ memset(buf, 0, PAGE_SIZE);
190+ cond_resched();
191+ }
192+ sbi->s_overhead = overhead;
193+ smp_wmb();
194+ free_page((unsigned long) buf);
195+ return 0;
196+}
197+
198 static int ext4_fill_super(struct super_block *sb, void *data, int silent)
199 {
200 char *orig_data = kstrdup(data, GFP_KERNEL);
201@@ -3695,6 +3803,18 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
202
203 no_journal:
204 /*
205+ * Get the # of file system overhead blocks from the
206+ * superblock if present.
207+ */
208+ if (es->s_overhead_clusters)
209+ sbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);
210+ else {
211+ ret = ext4_calculate_overhead(sb);
212+ if (ret)
213+ goto failed_mount_wq;
214+ }
215+
216+ /*
217 * The maximum number of concurrent works can be high and
218 * concurrency isn't really necessary. Limit it to 1.
219 */
220@@ -4568,67 +4688,21 @@ restore_opts:
221 return err;
222 }
223
224-/*
225- * Note: calculating the overhead so we can be compatible with
226- * historical BSD practice is quite difficult in the face of
227- * clusters/bigalloc. This is because multiple metadata blocks from
228- * different block group can end up in the same allocation cluster.
229- * Calculating the exact overhead in the face of clustered allocation
230- * requires either O(all block bitmaps) in memory or O(number of block
231- * groups**2) in time. We will still calculate the superblock for
232- * older file systems --- and if we come across with a bigalloc file
233- * system with zero in s_overhead_clusters the estimate will be close to
234- * correct especially for very large cluster sizes --- but for newer
235- * file systems, it's better to calculate this figure once at mkfs
236- * time, and store it in the superblock. If the superblock value is
237- * present (even for non-bigalloc file systems), we will use it.
238- */
239 static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
240 {
241 struct super_block *sb = dentry->d_sb;
242 struct ext4_sb_info *sbi = EXT4_SB(sb);
243 struct ext4_super_block *es = sbi->s_es;
244- struct ext4_group_desc *gdp;
245+ ext4_fsblk_t overhead = 0;
246 u64 fsid;
247 s64 bfree;
248
249- if (test_opt(sb, MINIX_DF)) {
250- sbi->s_overhead_last = 0;
251- } else if (es->s_overhead_clusters) {
252- sbi->s_overhead_last = le32_to_cpu(es->s_overhead_clusters);
253- } else if (sbi->s_blocks_last != ext4_blocks_count(es)) {
254- ext4_group_t i, ngroups = ext4_get_groups_count(sb);
255- ext4_fsblk_t overhead = 0;
256-
257- /*
258- * Compute the overhead (FS structures). This is constant
259- * for a given filesystem unless the number of block groups
260- * changes so we cache the previous value until it does.
261- */
262-
263- /*
264- * All of the blocks before first_data_block are
265- * overhead
266- */
267- overhead = EXT4_B2C(sbi, le32_to_cpu(es->s_first_data_block));
268-
269- /*
270- * Add the overhead found in each block group
271- */
272- for (i = 0; i < ngroups; i++) {
273- gdp = ext4_get_group_desc(sb, i, NULL);
274- overhead += ext4_num_overhead_clusters(sb, i, gdp);
275- cond_resched();
276- }
277- sbi->s_overhead_last = overhead;
278- smp_wmb();
279- sbi->s_blocks_last = ext4_blocks_count(es);
280- }
281+ if (!test_opt(sb, MINIX_DF))
282+ overhead = sbi->s_overhead;
283
284 buf->f_type = EXT4_SUPER_MAGIC;
285 buf->f_bsize = sb->s_blocksize;
286- buf->f_blocks = (ext4_blocks_count(es) -
287- EXT4_C2B(sbi, sbi->s_overhead_last));
288+ buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, sbi->s_overhead);
289 bfree = percpu_counter_sum_positive(&sbi->s_freeclusters_counter) -
290 percpu_counter_sum_positive(&sbi->s_dirtyclusters_counter);
291 /* prevent underflow in case that few free space is available */
292--
2931.7.7.6
294
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0035-udf-Improve-table-length-check-to-avoid-possible-ove.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0035-udf-Improve-table-length-check-to-avoid-possible-ove.patch
new file mode 100644
index 00000000..2548a59d
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0035-udf-Improve-table-length-check-to-avoid-possible-ove.patch
@@ -0,0 +1,36 @@
1From 27f12e5bea3378be70c81b258660fcaa44496cb4 Mon Sep 17 00:00:00 2001
2From: Jan Kara <jack@suse.cz>
3Date: Tue, 10 Jul 2012 17:58:04 +0200
4Subject: [PATCH 35/73] udf: Improve table length check to avoid possible
5 overflow
6
7commit 57b9655d01ef057a523e810d29c37ac09b80eead upstream.
8
9When a partition table length is corrupted to be close to 1 << 32, the
10check for its length may overflow on 32-bit systems and we will think
11the length is valid. Later on the kernel can crash trying to read beyond
12end of buffer. Fix the check to avoid possible overflow.
13
14Reported-by: Ben Hutchings <ben@decadent.org.uk>
15Signed-off-by: Jan Kara <jack@suse.cz>
16Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
17---
18 fs/udf/super.c | 2 +-
19 1 files changed, 1 insertions(+), 1 deletions(-)
20
21diff --git a/fs/udf/super.c b/fs/udf/super.c
22index 270e135..516b7f0 100644
23--- a/fs/udf/super.c
24+++ b/fs/udf/super.c
25@@ -1285,7 +1285,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
26 BUG_ON(ident != TAG_IDENT_LVD);
27 lvd = (struct logicalVolDesc *)bh->b_data;
28 table_len = le32_to_cpu(lvd->mapTableLength);
29- if (sizeof(*lvd) + table_len > sb->s_blocksize) {
30+ if (table_len > sb->s_blocksize - sizeof(*lvd)) {
31 udf_err(sb, "error loading logical volume descriptor: "
32 "Partition table too long (%u > %lu)\n", table_len,
33 sb->s_blocksize - sizeof(*lvd));
34--
351.7.7.6
36
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0036-powerpc-Add-memory-attribute-for-mfmsr.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0036-powerpc-Add-memory-attribute-for-mfmsr.patch
new file mode 100644
index 00000000..f6315644
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0036-powerpc-Add-memory-attribute-for-mfmsr.patch
@@ -0,0 +1,34 @@
1From 3fed281f20c3b2cdfe1a1f087973b0c0e3b4cd05 Mon Sep 17 00:00:00 2001
2From: Tiejun Chen <tiejun.chen@windriver.com>
3Date: Wed, 11 Jul 2012 14:22:46 +1000
4Subject: [PATCH 36/73] powerpc: Add "memory" attribute for mfmsr()
5
6commit b416c9a10baae6a177b4f9ee858b8d309542fbef upstream.
7
8Add "memory" attribute in inline assembly language as a compiler
9barrier to make sure 4.6.x GCC don't reorder mfmsr().
10
11Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
12Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
14---
15 arch/powerpc/include/asm/reg.h | 3 ++-
16 1 files changed, 2 insertions(+), 1 deletions(-)
17
18diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
19index 559da19..578e5a0 100644
20--- a/arch/powerpc/include/asm/reg.h
21+++ b/arch/powerpc/include/asm/reg.h
22@@ -1016,7 +1016,8 @@
23 /* Macros for setting and retrieving special purpose registers */
24 #ifndef __ASSEMBLY__
25 #define mfmsr() ({unsigned long rval; \
26- asm volatile("mfmsr %0" : "=r" (rval)); rval;})
27+ asm volatile("mfmsr %0" : "=r" (rval) : \
28+ : "memory"); rval;})
29 #ifdef CONFIG_PPC_BOOK3S_64
30 #define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \
31 : : "r" (v) : "memory")
32--
331.7.7.6
34
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0037-mwifiex-correction-in-mcs-index-check.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0037-mwifiex-correction-in-mcs-index-check.patch
new file mode 100644
index 00000000..5934302b
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0037-mwifiex-correction-in-mcs-index-check.patch
@@ -0,0 +1,41 @@
1From 10c6ca210b55595833c5b18def07f077947fa88d Mon Sep 17 00:00:00 2001
2From: Amitkumar Karwar <akarwar@marvell.com>
3Date: Wed, 11 Jul 2012 18:12:57 -0700
4Subject: [PATCH 37/73] mwifiex: correction in mcs index check
5
6commit fe020120cb863ba918c6d603345342a880272c4d upstream.
7
8mwifiex driver supports 2x2 chips as well. Hence valid mcs values
9are 0 to 15. The check for mcs index is corrected in this patch.
10
11For example: if 40MHz is enabled and mcs index is 11, "iw link"
12command would show "tx bitrate: 108.0 MBit/s" without this patch.
13Now it shows "tx bitrate: 108.0 MBit/s MCS 11 40Mhz" with the patch.
14
15Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
16Signed-off-by: Bing Zhao <bzhao@marvell.com>
17Signed-off-by: John W. Linville <linville@tuxdriver.com>
18Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
19---
20 drivers/net/wireless/mwifiex/cfg80211.c | 4 ++--
21 1 files changed, 2 insertions(+), 2 deletions(-)
22
23diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
24index 01dcb1a..727c129 100644
25--- a/drivers/net/wireless/mwifiex/cfg80211.c
26+++ b/drivers/net/wireless/mwifiex/cfg80211.c
27@@ -545,9 +545,9 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
28
29 /*
30 * Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid
31- * MCS index values for us are 0 to 7.
32+ * MCS index values for us are 0 to 15.
33 */
34- if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 8)) {
35+ if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) {
36 sinfo->txrate.mcs = priv->tx_rate;
37 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
38 /* 40MHz rate */
39--
401.7.7.6
41
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0038-USB-option-Ignore-ZTE-Vodafone-K3570-71-net-interfac.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0038-USB-option-Ignore-ZTE-Vodafone-K3570-71-net-interfac.patch
new file mode 100644
index 00000000..34b5fe5e
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0038-USB-option-Ignore-ZTE-Vodafone-K3570-71-net-interfac.patch
@@ -0,0 +1,37 @@
1From 06c8b933f7ff30224a62e134cf8e5f19ee9f4975 Mon Sep 17 00:00:00 2001
2From: "Andrew Bird (Sphere Systems)" <ajb@spheresystems.co.uk>
3Date: Sun, 25 Mar 2012 00:10:28 +0000
4Subject: [PATCH 38/73] USB: option: Ignore ZTE (Vodafone) K3570/71 net
5 interfaces
6
7commit f264ddea0109bf7ce8aab920d64a637e830ace5b upstream.
8
9These interfaces need to be handled by QMI/WWAN driver
10
11Signed-off-by: Andrew Bird <ajb@spheresystems.co.uk>
12Signed-off-by: David S. Miller <davem@davemloft.net>
13Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
14---
15 drivers/usb/serial/option.c | 6 ++++--
16 1 files changed, 4 insertions(+), 2 deletions(-)
17
18diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
19index 5971c95..6d97d2f 100644
20--- a/drivers/usb/serial/option.c
21+++ b/drivers/usb/serial/option.c
22@@ -932,8 +932,10 @@ static const struct usb_device_id option_ids[] = {
23 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
24 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
25 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
26- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) },
27- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) },
28+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
29+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
30+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
31+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
32 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
33 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
34 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
35--
361.7.7.6
37
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0039-USB-option-add-ZTE-MF821D.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0039-USB-option-add-ZTE-MF821D.patch
new file mode 100644
index 00000000..a9a075d0
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0039-USB-option-add-ZTE-MF821D.patch
@@ -0,0 +1,36 @@
1From da7998e23b2a112f2134db067ed2b1d5593113fb Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
3Date: Thu, 12 Jul 2012 12:37:32 +0200
4Subject: [PATCH 39/73] USB: option: add ZTE MF821D
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9commit 09110529780890804b22e997ae6b4fe3f0b3b158 upstream.
10
11Sold by O2 (telefonica germany) under the name "LTE4G"
12
13Tested-by: Thomas Schäfer <tschaefer@t-online.de>
14Signed-off-by: Bjørn Mork <bjorn@mork.no>
15Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
17---
18 drivers/usb/serial/option.c | 2 ++
19 1 files changed, 2 insertions(+), 0 deletions(-)
20
21diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
22index 6d97d2f..d89aac1 100644
23--- a/drivers/usb/serial/option.c
24+++ b/drivers/usb/serial/option.c
25@@ -932,6 +932,8 @@ static const struct usb_device_id option_ids[] = {
26 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
27 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
28 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
29+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
30+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
31 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
32 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
33 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
34--
351.7.7.6
36
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0040-target-Add-generation-of-LOGICAL-BLOCK-ADDRESS-OUT-O.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0040-target-Add-generation-of-LOGICAL-BLOCK-ADDRESS-OUT-O.patch
new file mode 100644
index 00000000..9d170842
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0040-target-Add-generation-of-LOGICAL-BLOCK-ADDRESS-OUT-O.patch
@@ -0,0 +1,64 @@
1From 5d43c09da407f76f1dae2ec3ca08cb62051dea6f Mon Sep 17 00:00:00 2001
2From: Roland Dreier <roland@purestorage.com>
3Date: Mon, 16 Jul 2012 15:34:21 -0700
4Subject: [PATCH 40/73] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF
5 RANGE
6
7commit e2397c704429025bc6b331a970f699e52f34283e upstream.
8
9Many SCSI commands are defined to return a CHECK CONDITION / ILLEGAL
10REQUEST with ASC set to LOGICAL BLOCK ADDRESS OUT OF RANGE if the
11initiator sends a command that accesses a too-big LBA. Add an enum
12value and case entries so that target code can return this status.
13
14Signed-off-by: Roland Dreier <roland@purestorage.com>
15Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
16Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
17---
18 drivers/target/target_core_transport.c | 10 ++++++++++
19 include/target/target_core_base.h | 1 +
20 2 files changed, 11 insertions(+), 0 deletions(-)
21
22diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
23index 5660916..94c03d2 100644
24--- a/drivers/target/target_core_transport.c
25+++ b/drivers/target/target_core_transport.c
26@@ -1820,6 +1820,7 @@ static void transport_generic_request_failure(struct se_cmd *cmd)
27 case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE:
28 case TCM_UNKNOWN_MODE_PAGE:
29 case TCM_WRITE_PROTECTED:
30+ case TCM_ADDRESS_OUT_OF_RANGE:
31 case TCM_CHECK_CONDITION_ABORT_CMD:
32 case TCM_CHECK_CONDITION_UNIT_ATTENTION:
33 case TCM_CHECK_CONDITION_NOT_READY:
34@@ -4496,6 +4497,15 @@ int transport_send_check_condition_and_sense(
35 /* WRITE PROTECTED */
36 buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27;
37 break;
38+ case TCM_ADDRESS_OUT_OF_RANGE:
39+ /* CURRENT ERROR */
40+ buffer[offset] = 0x70;
41+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
42+ /* ILLEGAL REQUEST */
43+ buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
44+ /* LOGICAL BLOCK ADDRESS OUT OF RANGE */
45+ buffer[offset+SPC_ASC_KEY_OFFSET] = 0x21;
46+ break;
47 case TCM_CHECK_CONDITION_UNIT_ATTENTION:
48 /* CURRENT ERROR */
49 buffer[offset] = 0x70;
50diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
51index 94bbec3..6ee550e 100644
52--- a/include/target/target_core_base.h
53+++ b/include/target/target_core_base.h
54@@ -157,6 +157,7 @@ enum tcm_sense_reason_table {
55 TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e,
56 TCM_CHECK_CONDITION_NOT_READY = 0x0f,
57 TCM_RESERVATION_CONFLICT = 0x10,
58+ TCM_ADDRESS_OUT_OF_RANGE = 0x11,
59 };
60
61 struct se_obj {
62--
631.7.7.6
64
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0041-target-Add-range-checking-to-UNMAP-emulation.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0041-target-Add-range-checking-to-UNMAP-emulation.patch
new file mode 100644
index 00000000..32404671
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0041-target-Add-range-checking-to-UNMAP-emulation.patch
@@ -0,0 +1,46 @@
1From 43b1ce67a53720ba82fbe5dbf0a323ae761368bb Mon Sep 17 00:00:00 2001
2From: Roland Dreier <roland@purestorage.com>
3Date: Mon, 16 Jul 2012 15:34:22 -0700
4Subject: [PATCH 41/73] target: Add range checking to UNMAP emulation
5
6commit 2594e29865c291db162313187612cd9f14538f33 upstream.
7
8When processing an UNMAP command, we need to make sure that the number
9of blocks we're asked to UNMAP does not exceed our reported maximum
10number of blocks per UNMAP, and that the range of blocks we're
11unmapping doesn't go past the end of the device.
12
13Signed-off-by: Roland Dreier <roland@purestorage.com>
14Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
15[bwh: Backported to 3.2: adjust filename, context]
16Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
17---
18 drivers/target/target_core_cdb.c | 12 ++++++++++++
19 1 files changed, 12 insertions(+), 0 deletions(-)
20
21diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
22index 93b9406..45a3ed4 100644
23--- a/drivers/target/target_core_cdb.c
24+++ b/drivers/target/target_core_cdb.c
25@@ -1145,6 +1145,18 @@ int target_emulate_unmap(struct se_task *task)
26 pr_debug("UNMAP: Using lba: %llu and range: %u\n",
27 (unsigned long long)lba, range);
28
29+ if (range > dev->se_sub_dev->se_dev_attrib.max_unmap_lba_count) {
30+ cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
31+ ret = -EINVAL;
32+ goto err;
33+ }
34+
35+ if (lba + range > dev->transport->get_blocks(dev) + 1) {
36+ cmd->scsi_sense_reason = TCM_ADDRESS_OUT_OF_RANGE;
37+ ret = -EINVAL;
38+ goto err;
39+ }
40+
41 ret = dev->transport->do_discard(dev, lba, range);
42 if (ret < 0) {
43 pr_err("blkdev_issue_discard() failed: %d\n",
44--
451.7.7.6
46
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0042-target-Fix-reading-of-data-length-fields-for-UNMAP-c.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0042-target-Fix-reading-of-data-length-fields-for-UNMAP-c.patch
new file mode 100644
index 00000000..0102742c
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0042-target-Fix-reading-of-data-length-fields-for-UNMAP-c.patch
@@ -0,0 +1,51 @@
1From b31df389ada54f5b2725826cd8d9a13ace960168 Mon Sep 17 00:00:00 2001
2From: Roland Dreier <roland@purestorage.com>
3Date: Mon, 16 Jul 2012 15:34:23 -0700
4Subject: [PATCH 42/73] target: Fix reading of data length fields for UNMAP
5 commands
6
7commit 1a5fa4576ec8a462313c7516b31d7453481ddbe8 upstream.
8
9The UNMAP DATA LENGTH and UNMAP BLOCK DESCRIPTOR DATA LENGTH fields
10are in the unmap descriptor (the payload transferred to our data out
11buffer), not in the CDB itself. Read them from the correct place in
12target_emulated_unmap.
13
14Signed-off-by: Roland Dreier <roland@purestorage.com>
15Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
16[bwh: Backported to 3.2: adjust filename, context]
17Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
18---
19 drivers/target/target_core_cdb.c | 6 +++---
20 1 files changed, 3 insertions(+), 3 deletions(-)
21
22diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
23index 45a3ed4..b1f5cf0 100644
24--- a/drivers/target/target_core_cdb.c
25+++ b/drivers/target/target_core_cdb.c
26@@ -1114,7 +1114,6 @@ int target_emulate_unmap(struct se_task *task)
27 struct se_cmd *cmd = task->task_se_cmd;
28 struct se_device *dev = cmd->se_dev;
29 unsigned char *buf, *ptr = NULL;
30- unsigned char *cdb = &cmd->t_task_cdb[0];
31 sector_t lba;
32 unsigned int size = cmd->data_length, range;
33 int ret = 0, offset;
34@@ -1130,11 +1129,12 @@ int target_emulate_unmap(struct se_task *task)
35 /* First UNMAP block descriptor starts at 8 byte offset */
36 offset = 8;
37 size -= 8;
38- dl = get_unaligned_be16(&cdb[0]);
39- bd_dl = get_unaligned_be16(&cdb[2]);
40
41 buf = transport_kmap_data_sg(cmd);
42
43+ dl = get_unaligned_be16(&buf[0]);
44+ bd_dl = get_unaligned_be16(&buf[2]);
45+
46 ptr = &buf[offset];
47 pr_debug("UNMAP: Sub: %s Using dl: %hu bd_dl: %hu size: %hu"
48 " ptr: %p\n", dev->transport->name, dl, bd_dl, size, ptr);
49--
501.7.7.6
51
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0043-target-Fix-possible-integer-underflow-in-UNMAP-emula.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0043-target-Fix-possible-integer-underflow-in-UNMAP-emula.patch
new file mode 100644
index 00000000..345d149a
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0043-target-Fix-possible-integer-underflow-in-UNMAP-emula.patch
@@ -0,0 +1,75 @@
1From 8d14ccd4bd5dab58984030c13a71953d396e792d Mon Sep 17 00:00:00 2001
2From: Roland Dreier <roland@purestorage.com>
3Date: Mon, 16 Jul 2012 15:34:24 -0700
4Subject: [PATCH 43/73] target: Fix possible integer underflow in UNMAP
5 emulation
6
7commit b7fc7f3777582dea85156a821d78a522a0c083aa upstream.
8
9It's possible for an initiator to send us an UNMAP command with a
10descriptor that is less than 8 bytes; in that case it's really bad for
11us to set an unsigned int to that value, subtract 8 from it, and then
12use that as a limit for our loop (since the value will wrap around to
13a huge positive value).
14
15Fix this by making size be signed and only looping if size >= 16 (ie
16if we have at least a full descriptor available).
17
18Also remove offset as an obfuscated name for the constant 8.
19
20Signed-off-by: Roland Dreier <roland@purestorage.com>
21Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
22[bwh: Backported to 3.2: adjust filename, context]
23Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
24---
25 drivers/target/target_core_cdb.c | 20 ++++++++++----------
26 1 files changed, 10 insertions(+), 10 deletions(-)
27
28diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
29index b1f5cf0..00f0f7d 100644
30--- a/drivers/target/target_core_cdb.c
31+++ b/drivers/target/target_core_cdb.c
32@@ -1115,9 +1115,10 @@ int target_emulate_unmap(struct se_task *task)
33 struct se_device *dev = cmd->se_dev;
34 unsigned char *buf, *ptr = NULL;
35 sector_t lba;
36- unsigned int size = cmd->data_length, range;
37- int ret = 0, offset;
38- unsigned short dl, bd_dl;
39+ int size = cmd->data_length;
40+ u32 range;
41+ int ret = 0;
42+ int dl, bd_dl;
43
44 if (!dev->transport->do_discard) {
45 pr_err("UNMAP emulation not supported for: %s\n",
46@@ -1126,20 +1127,19 @@ int target_emulate_unmap(struct se_task *task)
47 return -ENOSYS;
48 }
49
50- /* First UNMAP block descriptor starts at 8 byte offset */
51- offset = 8;
52- size -= 8;
53-
54 buf = transport_kmap_data_sg(cmd);
55
56 dl = get_unaligned_be16(&buf[0]);
57 bd_dl = get_unaligned_be16(&buf[2]);
58
59- ptr = &buf[offset];
60- pr_debug("UNMAP: Sub: %s Using dl: %hu bd_dl: %hu size: %hu"
61+ size = min(size - 8, bd_dl);
62+
63+ /* First UNMAP block descriptor starts at 8 byte offset */
64+ ptr = &buf[8];
65+ pr_debug("UNMAP: Sub: %s Using dl: %u bd_dl: %u size: %u"
66 " ptr: %p\n", dev->transport->name, dl, bd_dl, size, ptr);
67
68- while (size) {
69+ while (size >= 16) {
70 lba = get_unaligned_be64(&ptr[0]);
71 range = get_unaligned_be32(&ptr[8]);
72 pr_debug("UNMAP: Using lba: %llu and range: %u\n",
73--
741.7.7.6
75
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0044-target-Check-number-of-unmap-descriptors-against-our.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0044-target-Check-number-of-unmap-descriptors-against-our.patch
new file mode 100644
index 00000000..64f87f3f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0044-target-Check-number-of-unmap-descriptors-against-our.patch
@@ -0,0 +1,38 @@
1From 9e2f53ebf9ec64a0999669060222a8cbfae313b2 Mon Sep 17 00:00:00 2001
2From: Roland Dreier <roland@purestorage.com>
3Date: Mon, 16 Jul 2012 15:34:25 -0700
4Subject: [PATCH 44/73] target: Check number of unmap descriptors against our
5 limit
6
7commit 7409a6657aebf8be74c21d0eded80709b27275cb upstream.
8
9Fail UNMAP commands that have more than our reported limit on unmap
10descriptors.
11
12Signed-off-by: Roland Dreier <roland@purestorage.com>
13Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
14[bwh: Backported to 3.2: adjust filename]
15Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16---
17 drivers/target/target_core_cdb.c | 5 +++++
18 1 files changed, 5 insertions(+), 0 deletions(-)
19
20diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
21index 00f0f7d..717a8d4 100644
22--- a/drivers/target/target_core_cdb.c
23+++ b/drivers/target/target_core_cdb.c
24@@ -1133,6 +1133,11 @@ int target_emulate_unmap(struct se_task *task)
25 bd_dl = get_unaligned_be16(&buf[2]);
26
27 size = min(size - 8, bd_dl);
28+ if (size / 16 > dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) {
29+ cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
30+ ret = -EINVAL;
31+ goto err;
32+ }
33
34 /* First UNMAP block descriptor starts at 8 byte offset */
35 ptr = &buf[8];
36--
371.7.7.6
38
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0045-s390-idle-fix-sequence-handling-vs-cpu-hotplug.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0045-s390-idle-fix-sequence-handling-vs-cpu-hotplug.patch
new file mode 100644
index 00000000..445cbc5e
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0045-s390-idle-fix-sequence-handling-vs-cpu-hotplug.patch
@@ -0,0 +1,80 @@
1From 9385ba7e09e3360516f2b3c78c7d8f233dd1119f Mon Sep 17 00:00:00 2001
2From: Heiko Carstens <heiko.carstens@de.ibm.com>
3Date: Fri, 13 Jul 2012 15:45:33 +0200
4Subject: [PATCH 45/73] s390/idle: fix sequence handling vs cpu hotplug
5
6commit 0008204ffe85d23382d6fd0f971f3f0fbe70bae2 upstream.
7
8The s390 idle accounting code uses a sequence counter which gets used
9when the per cpu idle statistics get updated and read.
10
11One assumption on read access is that only when the sequence counter is
12even and did not change while reading all values the result is valid.
13On cpu hotplug however the per cpu data structure gets initialized via
14a cpu hotplug notifier on CPU_ONLINE.
15CPU_ONLINE however is too late, since the onlined cpu is already running
16and might access the per cpu data. Worst case is that the data structure
17gets initialized while an idle thread is updating its idle statistics.
18This will result in an uneven sequence counter after an update.
19
20As a result user space tools like top, which access /proc/stat in order
21to get idle stats, will busy loop waiting for the sequence counter to
22become even again, which will never happen until the queried cpu will
23update its idle statistics again. And even then the sequence counter
24will only have an even value for a couple of cpu cycles.
25
26Fix this by moving the initialization of the per cpu idle statistics
27to cpu_init(). I prefer that solution in favor of changing the
28notifier to CPU_UP_PREPARE, which would be a different solution to
29the problem.
30
31Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
32Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
33[bwh: Backported to 3.2: adjust context]
34Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
35---
36 arch/s390/kernel/processor.c | 2 ++
37 arch/s390/kernel/smp.c | 3 ---
38 2 files changed, 2 insertions(+), 3 deletions(-)
39
40diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
41index 6e0073e..07c7bf4 100644
42--- a/arch/s390/kernel/processor.c
43+++ b/arch/s390/kernel/processor.c
44@@ -26,12 +26,14 @@ static DEFINE_PER_CPU(struct cpuid, cpu_id);
45 void __cpuinit cpu_init(void)
46 {
47 struct cpuid *id = &per_cpu(cpu_id, smp_processor_id());
48+ struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
49
50 get_cpu_id(id);
51 atomic_inc(&init_mm.mm_count);
52 current->active_mm = &init_mm;
53 BUG_ON(current->mm);
54 enter_lazy_tlb(&init_mm, current);
55+ memset(idle, 0, sizeof(*idle));
56 }
57
58 /*
59diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
60index 3ea8728..1df64a8 100644
61--- a/arch/s390/kernel/smp.c
62+++ b/arch/s390/kernel/smp.c
63@@ -1020,14 +1020,11 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
64 unsigned int cpu = (unsigned int)(long)hcpu;
65 struct cpu *c = &per_cpu(cpu_devices, cpu);
66 struct sys_device *s = &c->sysdev;
67- struct s390_idle_data *idle;
68 int err = 0;
69
70 switch (action) {
71 case CPU_ONLINE:
72 case CPU_ONLINE_FROZEN:
73- idle = &per_cpu(s390_idle, cpu);
74- memset(idle, 0, sizeof(struct s390_idle_data));
75 err = sysfs_create_group(&s->kobj, &cpu_online_attr_group);
76 break;
77 case CPU_DEAD:
78--
791.7.7.6
80
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0046-rtlwifi-rtl8192de-Fix-phy-based-version-calculation.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0046-rtlwifi-rtl8192de-Fix-phy-based-version-calculation.patch
new file mode 100644
index 00000000..e52f4d78
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0046-rtlwifi-rtl8192de-Fix-phy-based-version-calculation.patch
@@ -0,0 +1,61 @@
1From fccb712c5ec20bb379e0c57e6a8b286e117ee2db Mon Sep 17 00:00:00 2001
2From: Forest Bond <forest.bond@rapidrollout.com>
3Date: Fri, 13 Jul 2012 12:26:06 -0400
4Subject: [PATCH 46/73] rtlwifi: rtl8192de: Fix phy-based version calculation
5
6commit f1b00f4dab29b57bdf1bc03ef12020b280fd2a72 upstream.
7
8Commit d83579e2a50ac68389e6b4c58b845c702cf37516 incorporated some
9changes from the vendor driver that made it newly important that the
10calculated hardware version correctly include the CHIP_92D bit, as all
11of the IS_92D_* macros were changed to depend on it. However, this bit
12was being unset for dual-mac, dual-phy devices. The vendor driver
13behavior was modified to not do this, but unfortunately this change was
14not picked up along with the others. This caused scanning in the 2.4GHz
15band to be broken, and possibly other bugs as well.
16
17This patch brings the version calculation logic in parity with the
18vendor driver in this regard, and in doing so fixes the regression.
19However, the version calculation code in general continues to be largely
20incoherent and messy, and needs to be cleaned up.
21
22Signed-off-by: Forest Bond <forest.bond@rapidrollout.com>
23Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
24Signed-off-by: John W. Linville <linville@tuxdriver.com>
25Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
26---
27 drivers/net/wireless/rtlwifi/rtl8192de/phy.c | 6 +++---
28 1 files changed, 3 insertions(+), 3 deletions(-)
29
30diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
31index 2cf4c5f..de9faa9 100644
32--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
33+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
34@@ -3462,21 +3462,21 @@ void rtl92d_phy_config_macphymode_info(struct ieee80211_hw *hw)
35 switch (rtlhal->macphymode) {
36 case DUALMAC_SINGLEPHY:
37 rtlphy->rf_type = RF_2T2R;
38- rtlhal->version |= CHIP_92D_SINGLEPHY;
39+ rtlhal->version |= RF_TYPE_2T2R;
40 rtlhal->bandset = BAND_ON_BOTH;
41 rtlhal->current_bandtype = BAND_ON_2_4G;
42 break;
43
44 case SINGLEMAC_SINGLEPHY:
45 rtlphy->rf_type = RF_2T2R;
46- rtlhal->version |= CHIP_92D_SINGLEPHY;
47+ rtlhal->version |= RF_TYPE_2T2R;
48 rtlhal->bandset = BAND_ON_BOTH;
49 rtlhal->current_bandtype = BAND_ON_2_4G;
50 break;
51
52 case DUALMAC_DUALPHY:
53 rtlphy->rf_type = RF_1T1R;
54- rtlhal->version &= (~CHIP_92D_SINGLEPHY);
55+ rtlhal->version &= RF_TYPE_1T1R;
56 /* Now we let MAC0 run on 5G band. */
57 if (rtlhal->interfaceindex == 0) {
58 rtlhal->bandset = BAND_ON_5G;
59--
601.7.7.6
61
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0047-workqueue-perform-cpu-down-operations-from-low-prior.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0047-workqueue-perform-cpu-down-operations-from-low-prior.patch
new file mode 100644
index 00000000..772eafb5
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0047-workqueue-perform-cpu-down-operations-from-low-prior.patch
@@ -0,0 +1,120 @@
1From 47ba7731c120a3ed09336d18b85493bd85d926f2 Mon Sep 17 00:00:00 2001
2From: Tejun Heo <tj@kernel.org>
3Date: Tue, 17 Jul 2012 12:39:26 -0700
4Subject: [PATCH 47/73] workqueue: perform cpu down operations from low
5 priority cpu_notifier()
6
7commit 6575820221f7a4dd6eadecf7bf83cdd154335eda upstream.
8
9Currently, all workqueue cpu hotplug operations run off
10CPU_PRI_WORKQUEUE which is higher than normal notifiers. This is to
11ensure that workqueue is up and running while bringing up a CPU before
12other notifiers try to use workqueue on the CPU.
13
14Per-cpu workqueues are supposed to remain working and bound to the CPU
15for normal CPU_DOWN_PREPARE notifiers. This holds mostly true even
16with workqueue offlining running with higher priority because
17workqueue CPU_DOWN_PREPARE only creates a bound trustee thread which
18runs the per-cpu workqueue without concurrency management without
19explicitly detaching the existing workers.
20
21However, if the trustee needs to create new workers, it creates
22unbound workers which may wander off to other CPUs while
23CPU_DOWN_PREPARE notifiers are in progress. Furthermore, if the CPU
24down is cancelled, the per-CPU workqueue may end up with workers which
25aren't bound to the CPU.
26
27While reliably reproducible with a convoluted artificial test-case
28involving scheduling and flushing CPU burning work items from CPU down
29notifiers, this isn't very likely to happen in the wild, and, even
30when it happens, the effects are likely to be hidden by the following
31successful CPU down.
32
33Fix it by using different priorities for up and down notifiers - high
34priority for up operations and low priority for down operations.
35
36Workqueue cpu hotplug operations will soon go through further cleanup.
37
38Signed-off-by: Tejun Heo <tj@kernel.org>
39Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
40Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
41---
42 include/linux/cpu.h | 5 +++--
43 kernel/workqueue.c | 38 +++++++++++++++++++++++++++++++++++++-
44 2 files changed, 40 insertions(+), 3 deletions(-)
45
46diff --git a/include/linux/cpu.h b/include/linux/cpu.h
47index 6cb60fd..c692acc 100644
48--- a/include/linux/cpu.h
49+++ b/include/linux/cpu.h
50@@ -66,8 +66,9 @@ enum {
51 /* migration should happen before other stuff but after perf */
52 CPU_PRI_PERF = 20,
53 CPU_PRI_MIGRATION = 10,
54- /* prepare workqueues for other notifiers */
55- CPU_PRI_WORKQUEUE = 5,
56+ /* bring up workqueues before normal notifiers and down after */
57+ CPU_PRI_WORKQUEUE_UP = 5,
58+ CPU_PRI_WORKQUEUE_DOWN = -5,
59 };
60
61 #define CPU_ONLINE 0x0002 /* CPU (unsigned)v is up */
62diff --git a/kernel/workqueue.c b/kernel/workqueue.c
63index 7947e16..a650bee 100644
64--- a/kernel/workqueue.c
65+++ b/kernel/workqueue.c
66@@ -3586,6 +3586,41 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb,
67 return notifier_from_errno(0);
68 }
69
70+/*
71+ * Workqueues should be brought up before normal priority CPU notifiers.
72+ * This will be registered high priority CPU notifier.
73+ */
74+static int __devinit workqueue_cpu_up_callback(struct notifier_block *nfb,
75+ unsigned long action,
76+ void *hcpu)
77+{
78+ switch (action & ~CPU_TASKS_FROZEN) {
79+ case CPU_UP_PREPARE:
80+ case CPU_UP_CANCELED:
81+ case CPU_DOWN_FAILED:
82+ case CPU_ONLINE:
83+ return workqueue_cpu_callback(nfb, action, hcpu);
84+ }
85+ return NOTIFY_OK;
86+}
87+
88+/*
89+ * Workqueues should be brought down after normal priority CPU notifiers.
90+ * This will be registered as low priority CPU notifier.
91+ */
92+static int __devinit workqueue_cpu_down_callback(struct notifier_block *nfb,
93+ unsigned long action,
94+ void *hcpu)
95+{
96+ switch (action & ~CPU_TASKS_FROZEN) {
97+ case CPU_DOWN_PREPARE:
98+ case CPU_DYING:
99+ case CPU_POST_DEAD:
100+ return workqueue_cpu_callback(nfb, action, hcpu);
101+ }
102+ return NOTIFY_OK;
103+}
104+
105 #ifdef CONFIG_SMP
106
107 struct work_for_cpu {
108@@ -3779,7 +3814,8 @@ static int __init init_workqueues(void)
109 unsigned int cpu;
110 int i;
111
112- cpu_notifier(workqueue_cpu_callback, CPU_PRI_WORKQUEUE);
113+ cpu_notifier(workqueue_cpu_up_callback, CPU_PRI_WORKQUEUE_UP);
114+ cpu_notifier(workqueue_cpu_down_callback, CPU_PRI_WORKQUEUE_DOWN);
115
116 /* initialize gcwqs */
117 for_each_gcwq_cpu(cpu) {
118--
1191.7.7.6
120
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0048-ALSA-hda-Add-support-for-Realtek-ALC282.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0048-ALSA-hda-Add-support-for-Realtek-ALC282.patch
new file mode 100644
index 00000000..cabf58f3
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0048-ALSA-hda-Add-support-for-Realtek-ALC282.patch
@@ -0,0 +1,34 @@
1From 1438a7338f8ea623f9cfc21c6201ad48273caf12 Mon Sep 17 00:00:00 2001
2From: David Henningsson <david.henningsson@canonical.com>
3Date: Wed, 18 Jul 2012 07:38:46 +0200
4Subject: [PATCH 48/73] ALSA: hda - Add support for Realtek ALC282
5
6commit 4e01ec636e64707d202a1ca21a47bbc6d53085b7 upstream.
7
8This codec has a separate dmic path (separate dmic only ADC),
9and thus it looks mostly like ALC275.
10
11BugLink: https://bugs.launchpad.net/bugs/1025377
12Tested-by: Ray Chen <ray.chen@canonical.com>
13Signed-off-by: David Henningsson <david.henningsson@canonical.com>
14Signed-off-by: Takashi Iwai <tiwai@suse.de>
15Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16---
17 sound/pci/hda/patch_realtek.c | 1 +
18 1 files changed, 1 insertions(+), 0 deletions(-)
19
20diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
21index 5f096a5..191fd78 100644
22--- a/sound/pci/hda/patch_realtek.c
23+++ b/sound/pci/hda/patch_realtek.c
24@@ -5989,6 +5989,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
25 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
26 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
27 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
28+ { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
29 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
30 .patch = patch_alc861 },
31 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
32--
331.7.7.6
34
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0049-iommu-amd-Fix-hotplug-with-iommu-pt.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0049-iommu-amd-Fix-hotplug-with-iommu-pt.patch
new file mode 100644
index 00000000..879ea879
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0049-iommu-amd-Fix-hotplug-with-iommu-pt.patch
@@ -0,0 +1,48 @@
1From 05f62dd05ef7d48fc3f9a778a5413ebcc8dc681f Mon Sep 17 00:00:00 2001
2From: Joerg Roedel <joerg.roedel@amd.com>
3Date: Thu, 19 Jul 2012 13:42:54 +0200
4Subject: [PATCH 49/73] iommu/amd: Fix hotplug with iommu=pt
5
6commit 2c9195e990297068d0f1f1bd8e2f1d09538009da upstream.
7
8This did not work because devices are not put into the
9pt_domain. Fix this.
10
11Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
12[bwh: Backported to 3.2: do not use iommu_dev_data::passthrough]
13Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
14---
15 drivers/iommu/amd_iommu.c | 10 ++++++----
16 1 files changed, 6 insertions(+), 4 deletions(-)
17
18diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
19index a1b8caa..0f074e0 100644
20--- a/drivers/iommu/amd_iommu.c
21+++ b/drivers/iommu/amd_iommu.c
22@@ -1865,6 +1865,11 @@ static int device_change_notifier(struct notifier_block *nb,
23
24 iommu_init_device(dev);
25
26+ if (iommu_pass_through) {
27+ attach_device(dev, pt_domain);
28+ break;
29+ }
30+
31 domain = domain_for_device(dev);
32
33 /* allocate a protection domain if a device is added */
34@@ -1880,10 +1885,7 @@ static int device_change_notifier(struct notifier_block *nb,
35 list_add_tail(&dma_domain->list, &iommu_pd_list);
36 spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
37
38- if (!iommu_pass_through)
39- dev->archdata.dma_ops = &amd_iommu_dma_ops;
40- else
41- dev->archdata.dma_ops = &nommu_dma_ops;
42+ dev->archdata.dma_ops = &amd_iommu_dma_ops;
43
44 break;
45 case BUS_NOTIFY_DEL_DEVICE:
46--
471.7.7.6
48
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0050-drm-radeon-Try-harder-to-avoid-HW-cursor-ending-on-a.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0050-drm-radeon-Try-harder-to-avoid-HW-cursor-ending-on-a.patch
new file mode 100644
index 00000000..7b500ec1
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0050-drm-radeon-Try-harder-to-avoid-HW-cursor-ending-on-a.patch
@@ -0,0 +1,50 @@
1From c5666fb07de9499337e69ebde032d9cbcad7e418 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
3Date: Tue, 17 Jul 2012 19:02:09 +0200
4Subject: [PATCH 50/73] drm/radeon: Try harder to avoid HW cursor ending on a
5 multiple of 128 columns.
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10commit f60ec4c7df043df81e62891ac45383d012afe0da upstream.
11
12This could previously fail if either of the enabled displays was using a
13horizontal resolution that is a multiple of 128, and only the leftmost column
14of the cursor was (supposed to be) visible at the right edge of that display.
15
16The solution is to move the cursor one pixel to the left in that case.
17
18Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183
19
20Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
21Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
22Signed-off-by: Dave Airlie <airlied@redhat.com>
23Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
24---
25 drivers/gpu/drm/radeon/radeon_cursor.c | 8 +++++++-
26 1 files changed, 7 insertions(+), 1 deletions(-)
27
28diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
29index 986d608..2132109 100644
30--- a/drivers/gpu/drm/radeon/radeon_cursor.c
31+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
32@@ -257,8 +257,14 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
33 if (!(cursor_end & 0x7f))
34 w--;
35 }
36- if (w <= 0)
37+ if (w <= 0) {
38 w = 1;
39+ cursor_end = x - xorigin + w;
40+ if (!(cursor_end & 0x7f)) {
41+ x--;
42+ WARN_ON_ONCE(x < 0);
43+ }
44+ }
45 }
46 }
47
48--
491.7.7.6
50
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0051-ALSA-hda-Turn-on-PIN_OUT-from-hdmi-playback-prepare.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0051-ALSA-hda-Turn-on-PIN_OUT-from-hdmi-playback-prepare.patch
new file mode 100644
index 00000000..fce75146
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0051-ALSA-hda-Turn-on-PIN_OUT-from-hdmi-playback-prepare.patch
@@ -0,0 +1,66 @@
1From d9c222f79d4fa6da0c113afe452968a2f0d226f4 Mon Sep 17 00:00:00 2001
2From: Dylan Reid <dgreid@chromium.org>
3Date: Thu, 19 Jul 2012 17:52:58 -0700
4Subject: [PATCH 51/73] ALSA: hda - Turn on PIN_OUT from hdmi playback
5 prepare.
6
7commit 9e76e6d031482194a5b24d8e9ab88063fbd6b4b5 upstream.
8
9Turn on the pin widget's PIN_OUT bit from playback prepare. The pin is
10enabled in open, but is disabled in hdmi_init_pin which is called during
11system resume. This causes a system suspend/resume during playback to
12mute HDMI/DP. Enabling the pin in prepare instead of open allows calling
13snd_pcm_prepare after a system resume to restore audio.
14
15Signed-off-by: Dylan Reid <dgreid@chromium.org>
16Signed-off-by: Takashi Iwai <tiwai@suse.de>
17Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
18---
19 sound/pci/hda/patch_hdmi.c | 12 ++++++------
20 1 files changed, 6 insertions(+), 6 deletions(-)
21
22diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
23index c505fd5..c119f33 100644
24--- a/sound/pci/hda/patch_hdmi.c
25+++ b/sound/pci/hda/patch_hdmi.c
26@@ -868,7 +868,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
27 struct hdmi_spec_per_pin *per_pin;
28 struct hdmi_eld *eld;
29 struct hdmi_spec_per_cvt *per_cvt = NULL;
30- int pinctl;
31
32 /* Validate hinfo */
33 pin_idx = hinfo_to_pin_index(spec, hinfo);
34@@ -904,11 +903,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
35 snd_hda_codec_write(codec, per_pin->pin_nid, 0,
36 AC_VERB_SET_CONNECT_SEL,
37 mux_idx);
38- pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
39- AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
40- snd_hda_codec_write(codec, per_pin->pin_nid, 0,
41- AC_VERB_SET_PIN_WIDGET_CONTROL,
42- pinctl | PIN_OUT);
43 snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
44
45 /* Initially set the converter's capabilities */
46@@ -1147,11 +1141,17 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
47 struct hdmi_spec *spec = codec->spec;
48 int pin_idx = hinfo_to_pin_index(spec, hinfo);
49 hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
50+ int pinctl;
51
52 hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
53
54 hdmi_setup_audio_infoframe(codec, pin_idx, substream);
55
56+ pinctl = snd_hda_codec_read(codec, pin_nid, 0,
57+ AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
58+ snd_hda_codec_write(codec, pin_nid, 0,
59+ AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
60+
61 return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
62 }
63
64--
651.7.7.6
66
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0052-block-add-blk_queue_dead.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0052-block-add-blk_queue_dead.patch
new file mode 100644
index 00000000..d9de19d2
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0052-block-add-blk_queue_dead.patch
@@ -0,0 +1,140 @@
1From 964e5928138f09dc58d9d507ce51a6adccfdb7e0 Mon Sep 17 00:00:00 2001
2From: Tejun Heo <tj@kernel.org>
3Date: Wed, 14 Dec 2011 00:33:37 +0100
4Subject: [PATCH 52/73] block: add blk_queue_dead()
5
6commit 34f6055c80285e4efb3f602a9119db75239744dc upstream.
7
8There are a number of QUEUE_FLAG_DEAD tests. Add blk_queue_dead()
9macro and use it.
10
11This patch doesn't introduce any functional difference.
12
13Signed-off-by: Tejun Heo <tj@kernel.org>
14Signed-off-by: Jens Axboe <axboe@kernel.dk>
15Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16---
17 block/blk-core.c | 6 +++---
18 block/blk-exec.c | 2 +-
19 block/blk-sysfs.c | 4 ++--
20 block/blk-throttle.c | 4 ++--
21 block/blk.h | 2 +-
22 include/linux/blkdev.h | 1 +
23 6 files changed, 10 insertions(+), 9 deletions(-)
24
25diff --git a/block/blk-core.c b/block/blk-core.c
26index 15de223..49d9e91 100644
27--- a/block/blk-core.c
28+++ b/block/blk-core.c
29@@ -607,7 +607,7 @@ EXPORT_SYMBOL(blk_init_allocated_queue);
30
31 int blk_get_queue(struct request_queue *q)
32 {
33- if (likely(!test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) {
34+ if (likely(!blk_queue_dead(q))) {
35 kobject_get(&q->kobj);
36 return 0;
37 }
38@@ -754,7 +754,7 @@ static struct request *get_request(struct request_queue *q, int rw_flags,
39 const bool is_sync = rw_is_sync(rw_flags) != 0;
40 int may_queue;
41
42- if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
43+ if (unlikely(blk_queue_dead(q)))
44 return NULL;
45
46 may_queue = elv_may_queue(q, rw_flags);
47@@ -874,7 +874,7 @@ static struct request *get_request_wait(struct request_queue *q, int rw_flags,
48 struct io_context *ioc;
49 struct request_list *rl = &q->rq;
50
51- if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
52+ if (unlikely(blk_queue_dead(q)))
53 return NULL;
54
55 prepare_to_wait_exclusive(&rl->wait[is_sync], &wait,
56diff --git a/block/blk-exec.c b/block/blk-exec.c
57index a1ebceb..6053285 100644
58--- a/block/blk-exec.c
59+++ b/block/blk-exec.c
60@@ -50,7 +50,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
61 {
62 int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK;
63
64- if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) {
65+ if (unlikely(blk_queue_dead(q))) {
66 rq->errors = -ENXIO;
67 if (rq->end_io)
68 rq->end_io(rq, rq->errors);
69diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
70index e7f9f65..f0b2ca8 100644
71--- a/block/blk-sysfs.c
72+++ b/block/blk-sysfs.c
73@@ -425,7 +425,7 @@ queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
74 if (!entry->show)
75 return -EIO;
76 mutex_lock(&q->sysfs_lock);
77- if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)) {
78+ if (blk_queue_dead(q)) {
79 mutex_unlock(&q->sysfs_lock);
80 return -ENOENT;
81 }
82@@ -447,7 +447,7 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
83
84 q = container_of(kobj, struct request_queue, kobj);
85 mutex_lock(&q->sysfs_lock);
86- if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)) {
87+ if (blk_queue_dead(q)) {
88 mutex_unlock(&q->sysfs_lock);
89 return -ENOENT;
90 }
91diff --git a/block/blk-throttle.c b/block/blk-throttle.c
92index 4553245..5eed6a7 100644
93--- a/block/blk-throttle.c
94+++ b/block/blk-throttle.c
95@@ -310,7 +310,7 @@ static struct throtl_grp * throtl_get_tg(struct throtl_data *td)
96 struct request_queue *q = td->queue;
97
98 /* no throttling for dead queue */
99- if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
100+ if (unlikely(blk_queue_dead(q)))
101 return NULL;
102
103 rcu_read_lock();
104@@ -335,7 +335,7 @@ static struct throtl_grp * throtl_get_tg(struct throtl_data *td)
105 spin_lock_irq(q->queue_lock);
106
107 /* Make sure @q is still alive */
108- if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) {
109+ if (unlikely(blk_queue_dead(q))) {
110 kfree(tg);
111 return NULL;
112 }
113diff --git a/block/blk.h b/block/blk.h
114index 3f6551b..e38691d 100644
115--- a/block/blk.h
116+++ b/block/blk.h
117@@ -85,7 +85,7 @@ static inline struct request *__elv_next_request(struct request_queue *q)
118 q->flush_queue_delayed = 1;
119 return NULL;
120 }
121- if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags) ||
122+ if (unlikely(blk_queue_dead(q)) ||
123 !q->elevator->ops->elevator_dispatch_fn(q, 0))
124 return NULL;
125 }
126diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
127index 0ed1eb0..ff039f0 100644
128--- a/include/linux/blkdev.h
129+++ b/include/linux/blkdev.h
130@@ -481,6 +481,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
131
132 #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
133 #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
134+#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
135 #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
136 #define blk_queue_noxmerges(q) \
137 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
138--
1391.7.7.6
140
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0053-Fix-device-removal-NULL-pointer-dereference.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0053-Fix-device-removal-NULL-pointer-dereference.patch
new file mode 100644
index 00000000..6cf674e8
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0053-Fix-device-removal-NULL-pointer-dereference.patch
@@ -0,0 +1,163 @@
1From 494efb27e48c4689686b72d1490e9f44fcbd08e8 Mon Sep 17 00:00:00 2001
2From: Bart Van Assche <bvanassche@acm.org>
3Date: Fri, 29 Jun 2012 15:33:22 +0000
4Subject: [PATCH 53/73] Fix device removal NULL pointer dereference
5
6commit 67bd94130015c507011af37858989b199c52e1de upstream.
7
8Use blk_queue_dead() to test whether the queue is dead instead
9of !sdev. Since scsi_prep_fn() may be invoked concurrently with
10__scsi_remove_device(), keep the queuedata (sdev) pointer in
11__scsi_remove_device(). This patch fixes a kernel oops that
12can be triggered by USB device removal. See also
13http://www.spinics.net/lists/linux-scsi/msg56254.html.
14
15Other changes included in this patch:
16- Swap the blk_cleanup_queue() and kfree() calls in
17 scsi_host_dev_release() to make that code easier to grasp.
18- Remove the queue dead check from scsi_run_queue() since the
19 queue state can change anyway at any point in that function
20 where the queue lock is not held.
21- Remove the queue dead check from the start of scsi_request_fn()
22 since it is redundant with the scsi_device_online() check.
23
24Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
25Signed-off-by: Bart Van Assche <bvanassche@acm.org>
26Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
27Reviewed-by: Tejun Heo <tj@kernel.org>
28Signed-off-by: James Bottomley <JBottomley@Parallels.com>
29Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
30---
31 drivers/scsi/hosts.c | 7 ++++---
32 drivers/scsi/scsi_lib.c | 32 ++++----------------------------
33 drivers/scsi/scsi_priv.h | 1 -
34 drivers/scsi/scsi_sysfs.c | 5 +----
35 4 files changed, 9 insertions(+), 36 deletions(-)
36
37diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
38index 351dc0b..ee77a58 100644
39--- a/drivers/scsi/hosts.c
40+++ b/drivers/scsi/hosts.c
41@@ -287,6 +287,7 @@ static void scsi_host_dev_release(struct device *dev)
42 struct Scsi_Host *shost = dev_to_shost(dev);
43 struct device *parent = dev->parent;
44 struct request_queue *q;
45+ void *queuedata;
46
47 scsi_proc_hostdir_rm(shost->hostt);
48
49@@ -296,9 +297,9 @@ static void scsi_host_dev_release(struct device *dev)
50 destroy_workqueue(shost->work_q);
51 q = shost->uspace_req_q;
52 if (q) {
53- kfree(q->queuedata);
54- q->queuedata = NULL;
55- scsi_free_queue(q);
56+ queuedata = q->queuedata;
57+ blk_cleanup_queue(q);
58+ kfree(queuedata);
59 }
60
61 scsi_destroy_command_freelist(shost);
62diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
63index f0ab58e..4f68ba6 100644
64--- a/drivers/scsi/scsi_lib.c
65+++ b/drivers/scsi/scsi_lib.c
66@@ -406,10 +406,6 @@ static void scsi_run_queue(struct request_queue *q)
67 LIST_HEAD(starved_list);
68 unsigned long flags;
69
70- /* if the device is dead, sdev will be NULL, so no queue to run */
71- if (!sdev)
72- return;
73-
74 shost = sdev->host;
75 if (scsi_target(sdev)->single_lun)
76 scsi_single_lun_run(sdev);
77@@ -1374,16 +1370,16 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
78 * may be changed after request stacking drivers call the function,
79 * regardless of taking lock or not.
80 *
81- * When scsi can't dispatch I/Os anymore and needs to kill I/Os
82- * (e.g. !sdev), scsi needs to return 'not busy'.
83- * Otherwise, request stacking drivers may hold requests forever.
84+ * When scsi can't dispatch I/Os anymore and needs to kill I/Os scsi
85+ * needs to return 'not busy'. Otherwise, request stacking drivers
86+ * may hold requests forever.
87 */
88 static int scsi_lld_busy(struct request_queue *q)
89 {
90 struct scsi_device *sdev = q->queuedata;
91 struct Scsi_Host *shost;
92
93- if (!sdev)
94+ if (blk_queue_dead(q))
95 return 0;
96
97 shost = sdev->host;
98@@ -1494,12 +1490,6 @@ static void scsi_request_fn(struct request_queue *q)
99 struct scsi_cmnd *cmd;
100 struct request *req;
101
102- if (!sdev) {
103- while ((req = blk_peek_request(q)) != NULL)
104- scsi_kill_request(req, q);
105- return;
106- }
107-
108 if(!get_device(&sdev->sdev_gendev))
109 /* We must be tearing the block queue down already */
110 return;
111@@ -1701,20 +1691,6 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
112 return q;
113 }
114
115-void scsi_free_queue(struct request_queue *q)
116-{
117- unsigned long flags;
118-
119- WARN_ON(q->queuedata);
120-
121- /* cause scsi_request_fn() to kill all non-finished requests */
122- spin_lock_irqsave(q->queue_lock, flags);
123- q->request_fn(q);
124- spin_unlock_irqrestore(q->queue_lock, flags);
125-
126- blk_cleanup_queue(q);
127-}
128-
129 /*
130 * Function: scsi_block_requests()
131 *
132diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
133index 5b475d0..d58adca 100644
134--- a/drivers/scsi/scsi_priv.h
135+++ b/drivers/scsi/scsi_priv.h
136@@ -85,7 +85,6 @@ extern void scsi_next_command(struct scsi_cmnd *cmd);
137 extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
138 extern void scsi_run_host_queues(struct Scsi_Host *shost);
139 extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
140-extern void scsi_free_queue(struct request_queue *q);
141 extern int scsi_init_queue(void);
142 extern void scsi_exit_queue(void);
143 struct request_queue;
144diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
145index 04c2a27..42c35ff 100644
146--- a/drivers/scsi/scsi_sysfs.c
147+++ b/drivers/scsi/scsi_sysfs.c
148@@ -971,11 +971,8 @@ void __scsi_remove_device(struct scsi_device *sdev)
149 sdev->host->hostt->slave_destroy(sdev);
150 transport_destroy_device(dev);
151
152- /* cause the request function to reject all I/O requests */
153- sdev->request_queue->queuedata = NULL;
154-
155 /* Freeing the queue signals to block that we're done */
156- scsi_free_queue(sdev->request_queue);
157+ blk_cleanup_queue(sdev->request_queue);
158 put_device(dev);
159 }
160
161--
1621.7.7.6
163
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0054-Avoid-dangling-pointer-in-scsi_requeue_command.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0054-Avoid-dangling-pointer-in-scsi_requeue_command.patch
new file mode 100644
index 00000000..98e6b5b9
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0054-Avoid-dangling-pointer-in-scsi_requeue_command.patch
@@ -0,0 +1,57 @@
1From c24bb6a70695fb930fc0b976db55fad4334cd992 Mon Sep 17 00:00:00 2001
2From: Bart Van Assche <bvanassche@acm.org>
3Date: Fri, 29 Jun 2012 15:34:26 +0000
4Subject: [PATCH 54/73] Avoid dangling pointer in scsi_requeue_command()
5
6commit 940f5d47e2f2e1fa00443921a0abf4822335b54d upstream.
7
8When we call scsi_unprep_request() the command associated with the request
9gets destroyed and therefore drops its reference on the device. If this was
10the only reference, the device may get released and we end up with a NULL
11pointer deref when we call blk_requeue_request.
12
13Reported-by: Mike Christie <michaelc@cs.wisc.edu>
14Signed-off-by: Bart Van Assche <bvanassche@acm.org>
15Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
16Reviewed-by: Tejun Heo <tj@kernel.org>
17[jejb: enhance commend and add commit log for stable]
18Signed-off-by: James Bottomley <JBottomley@Parallels.com>
19Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
20---
21 drivers/scsi/scsi_lib.c | 11 +++++++++++
22 1 files changed, 11 insertions(+), 0 deletions(-)
23
24diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
25index 4f68ba6..6c4b620 100644
26--- a/drivers/scsi/scsi_lib.c
27+++ b/drivers/scsi/scsi_lib.c
28@@ -479,15 +479,26 @@ void scsi_requeue_run_queue(struct work_struct *work)
29 */
30 static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
31 {
32+ struct scsi_device *sdev = cmd->device;
33 struct request *req = cmd->request;
34 unsigned long flags;
35
36+ /*
37+ * We need to hold a reference on the device to avoid the queue being
38+ * killed after the unlock and before scsi_run_queue is invoked which
39+ * may happen because scsi_unprep_request() puts the command which
40+ * releases its reference on the device.
41+ */
42+ get_device(&sdev->sdev_gendev);
43+
44 spin_lock_irqsave(q->queue_lock, flags);
45 scsi_unprep_request(req);
46 blk_requeue_request(q, req);
47 spin_unlock_irqrestore(q->queue_lock, flags);
48
49 scsi_run_queue(q);
50+
51+ put_device(&sdev->sdev_gendev);
52 }
53
54 void scsi_next_command(struct scsi_cmnd *cmd)
55--
561.7.7.6
57
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0055-fix-hot-unplug-vs-async-scan-race.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0055-fix-hot-unplug-vs-async-scan-race.patch
new file mode 100644
index 00000000..9d7c97a9
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0055-fix-hot-unplug-vs-async-scan-race.patch
@@ -0,0 +1,122 @@
1From 04ed7d216271c757e1f14ff369f5aa1908f04189 Mon Sep 17 00:00:00 2001
2From: Dan Williams <dan.j.williams@intel.com>
3Date: Thu, 21 Jun 2012 23:47:28 -0700
4Subject: [PATCH 55/73] fix hot unplug vs async scan race
5
6commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.
7
8The following crash results from cases where the end_device has been
9removed before scsi_sysfs_add_sdev has had a chance to run.
10
11 BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
12 IP: [<ffffffff8115e100>] sysfs_create_dir+0x32/0xb6
13 ...
14 Call Trace:
15 [<ffffffff8125e4a8>] kobject_add_internal+0x120/0x1e3
16 [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf
17 [<ffffffff8125e641>] kobject_add_varg+0x41/0x50
18 [<ffffffff8125e70b>] kobject_add+0x64/0x66
19 [<ffffffff8131122b>] device_add+0x12d/0x63a
20 [<ffffffff814b65ea>] ? _raw_spin_unlock_irqrestore+0x47/0x56
21 [<ffffffff8107de15>] ? module_refcount+0x89/0xa0
22 [<ffffffff8132f348>] scsi_sysfs_add_sdev+0x4e/0x28a
23 [<ffffffff8132dcbb>] do_scan_async+0x9c/0x145
24
25...teach scsi_sysfs_add_devices() to check for deleted devices() before
26trying to add them, and teach scsi_remove_target() how to remove targets
27that have not been added via device_add().
28
29Reported-by: Dariusz Majchrzak <dariusz.majchrzak@intel.com>
30Signed-off-by: Dan Williams <dan.j.williams@intel.com>
31Signed-off-by: James Bottomley <JBottomley@Parallels.com>
32Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
33---
34 drivers/scsi/scsi_scan.c | 3 +++
35 drivers/scsi/scsi_sysfs.c | 41 ++++++++++++++++++++++++++---------------
36 2 files changed, 29 insertions(+), 15 deletions(-)
37
38diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
39index 6e7ea4a..a48b59c 100644
40--- a/drivers/scsi/scsi_scan.c
41+++ b/drivers/scsi/scsi_scan.c
42@@ -1710,6 +1710,9 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
43 {
44 struct scsi_device *sdev;
45 shost_for_each_device(sdev, shost) {
46+ /* target removed before the device could be added */
47+ if (sdev->sdev_state == SDEV_DEL)
48+ continue;
49 if (!scsi_host_scan_allowed(shost) ||
50 scsi_sysfs_add_sdev(sdev) != 0)
51 __scsi_remove_device(sdev);
52diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
53index 42c35ff..bb7c482 100644
54--- a/drivers/scsi/scsi_sysfs.c
55+++ b/drivers/scsi/scsi_sysfs.c
56@@ -997,7 +997,6 @@ static void __scsi_remove_target(struct scsi_target *starget)
57 struct scsi_device *sdev;
58
59 spin_lock_irqsave(shost->host_lock, flags);
60- starget->reap_ref++;
61 restart:
62 list_for_each_entry(sdev, &shost->__devices, siblings) {
63 if (sdev->channel != starget->channel ||
64@@ -1011,14 +1010,6 @@ static void __scsi_remove_target(struct scsi_target *starget)
65 goto restart;
66 }
67 spin_unlock_irqrestore(shost->host_lock, flags);
68- scsi_target_reap(starget);
69-}
70-
71-static int __remove_child (struct device * dev, void * data)
72-{
73- if (scsi_is_target_device(dev))
74- __scsi_remove_target(to_scsi_target(dev));
75- return 0;
76 }
77
78 /**
79@@ -1031,14 +1022,34 @@ static int __remove_child (struct device * dev, void * data)
80 */
81 void scsi_remove_target(struct device *dev)
82 {
83- if (scsi_is_target_device(dev)) {
84- __scsi_remove_target(to_scsi_target(dev));
85- return;
86+ struct Scsi_Host *shost = dev_to_shost(dev->parent);
87+ struct scsi_target *starget, *found;
88+ unsigned long flags;
89+
90+ restart:
91+ found = NULL;
92+ spin_lock_irqsave(shost->host_lock, flags);
93+ list_for_each_entry(starget, &shost->__targets, siblings) {
94+ if (starget->state == STARGET_DEL)
95+ continue;
96+ if (starget->dev.parent == dev || &starget->dev == dev) {
97+ found = starget;
98+ found->reap_ref++;
99+ break;
100+ }
101 }
102+ spin_unlock_irqrestore(shost->host_lock, flags);
103
104- get_device(dev);
105- device_for_each_child(dev, NULL, __remove_child);
106- put_device(dev);
107+ if (found) {
108+ __scsi_remove_target(found);
109+ scsi_target_reap(found);
110+ /* in the case where @dev has multiple starget children,
111+ * continue removing.
112+ *
113+ * FIXME: does such a case exist?
114+ */
115+ goto restart;
116+ }
117 }
118 EXPORT_SYMBOL(scsi_remove_target);
119
120--
1211.7.7.6
122
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0056-fix-eh-wakeup-scsi_schedule_eh-vs-scsi_restart_opera.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0056-fix-eh-wakeup-scsi_schedule_eh-vs-scsi_restart_opera.patch
new file mode 100644
index 00000000..a2028644
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0056-fix-eh-wakeup-scsi_schedule_eh-vs-scsi_restart_opera.patch
@@ -0,0 +1,62 @@
1From 3936af31e073e2eb55d8d2eee05ec10999f0dacc Mon Sep 17 00:00:00 2001
2From: Dan Williams <dan.j.williams@intel.com>
3Date: Thu, 21 Jun 2012 23:25:32 -0700
4Subject: [PATCH 56/73] fix eh wakeup (scsi_schedule_eh vs
5 scsi_restart_operations)
6
7commit 57fc2e335fd3c2f898ee73570dc81426c28dc7b4 upstream.
8
9Rapid ata hotplug on a libsas controller results in cases where libsas
10is waiting indefinitely on eh to perform an ata probe.
11
12A race exists between scsi_schedule_eh() and scsi_restart_operations()
13in the case when scsi_restart_operations() issues i/o to other devices
14in the sas domain. When this happens the host state transitions from
15SHOST_RECOVERY (set by scsi_schedule_eh) back to SHOST_RUNNING and
16->host_busy is non-zero so we put the eh thread to sleep even though
17->host_eh_scheduled is active.
18
19Before putting the error handler to sleep we need to check if the
20host_state needs to return to SHOST_RECOVERY for another trip through
21eh. Since i/o that is released by scsi_restart_operations has been
22blocked for at least one eh cycle, this implementation allows those
23i/o's to run before another eh cycle starts to discourage hung task
24timeouts.
25
26Reported-by: Tom Jackson <thomas.p.jackson@intel.com>
27Tested-by: Tom Jackson <thomas.p.jackson@intel.com>
28Signed-off-by: Dan Williams <dan.j.williams@intel.com>
29Signed-off-by: James Bottomley <JBottomley@Parallels.com>
30Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
31---
32 drivers/scsi/scsi_error.c | 14 ++++++++++++++
33 1 files changed, 14 insertions(+), 0 deletions(-)
34
35diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
36index dc6131e..456b131 100644
37--- a/drivers/scsi/scsi_error.c
38+++ b/drivers/scsi/scsi_error.c
39@@ -1673,6 +1673,20 @@ static void scsi_restart_operations(struct Scsi_Host *shost)
40 * requests are started.
41 */
42 scsi_run_host_queues(shost);
43+
44+ /*
45+ * if eh is active and host_eh_scheduled is pending we need to re-run
46+ * recovery. we do this check after scsi_run_host_queues() to allow
47+ * everything pent up since the last eh run a chance to make forward
48+ * progress before we sync again. Either we'll immediately re-run
49+ * recovery or scsi_device_unbusy() will wake us again when these
50+ * pending commands complete.
51+ */
52+ spin_lock_irqsave(shost->host_lock, flags);
53+ if (shost->host_eh_scheduled)
54+ if (scsi_host_set_state(shost, SHOST_RECOVERY))
55+ WARN_ON(scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY));
56+ spin_unlock_irqrestore(shost->host_lock, flags);
57 }
58
59 /**
60--
611.7.7.6
62
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0057-libsas-continue-revalidation.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0057-libsas-continue-revalidation.patch
new file mode 100644
index 00000000..2a242099
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0057-libsas-continue-revalidation.patch
@@ -0,0 +1,49 @@
1From 07925ac535d9c4f774b0ba817fece3557670013f Mon Sep 17 00:00:00 2001
2From: Dan Williams <dan.j.williams@intel.com>
3Date: Thu, 21 Jun 2012 23:36:15 -0700
4Subject: [PATCH 57/73] libsas: continue revalidation
5
6commit 26f2f199ff150d8876b2641c41e60d1c92d2fb81 upstream.
7
8Continue running revalidation until no more broadcast devices are
9discovered. Fixes cases where re-discovery completes too early in a
10domain with multiple expanders with pending re-discovery events.
11Servicing BCNs can get backed up behind error recovery.
12
13Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14Signed-off-by: James Bottomley <JBottomley@Parallels.com>
15Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16---
17 drivers/scsi/libsas/sas_expander.c | 8 ++++----
18 1 files changed, 4 insertions(+), 4 deletions(-)
19
20diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
21index e48ba4b..6330110 100644
22--- a/drivers/scsi/libsas/sas_expander.c
23+++ b/drivers/scsi/libsas/sas_expander.c
24@@ -1983,9 +1983,7 @@ int sas_ex_revalidate_domain(struct domain_device *port_dev)
25 struct domain_device *dev = NULL;
26
27 res = sas_find_bcast_dev(port_dev, &dev);
28- if (res)
29- goto out;
30- if (dev) {
31+ while (res == 0 && dev) {
32 struct expander_device *ex = &dev->ex_dev;
33 int i = 0, phy_id;
34
35@@ -1997,8 +1995,10 @@ int sas_ex_revalidate_domain(struct domain_device *port_dev)
36 res = sas_rediscover(dev, phy_id);
37 i = phy_id + 1;
38 } while (i < ex->num_phys);
39+
40+ dev = NULL;
41+ res = sas_find_bcast_dev(port_dev, &dev);
42 }
43-out:
44 return res;
45 }
46
47--
481.7.7.6
49
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0058-libsas-fix-sas_discover_devices-return-code-handling.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0058-libsas-fix-sas_discover_devices-return-code-handling.patch
new file mode 100644
index 00000000..4542c151
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0058-libsas-fix-sas_discover_devices-return-code-handling.patch
@@ -0,0 +1,128 @@
1From 61141b84f7a92caf6a6670396f9b2dec5345bc0e Mon Sep 17 00:00:00 2001
2From: Dan Williams <dan.j.williams@intel.com>
3Date: Thu, 21 Jun 2012 23:36:20 -0700
4Subject: [PATCH 58/73] libsas: fix sas_discover_devices return code handling
5
6commit b17caa174a7e1fd2e17b26e210d4ee91c4c28b37 upstream.
7
8commit 198439e4 [SCSI] libsas: do not set res = 0 in sas_ex_discover_dev()
9commit 19252de6 [SCSI] libsas: fix wide port hotplug issues
10
11The above commits seem to have confused the return value of
12sas_ex_discover_dev which is non-zero on failure and
13sas_ex_join_wide_port which just indicates short circuiting discovery on
14already established ports. The result is random discovery failures
15depending on configuration.
16
17Calls to sas_ex_join_wide_port are the source of the trouble as its
18return value is errantly assigned to 'res'. Convert it to bool and stop
19returning its result up the stack.
20
21Tested-by: Dan Melnic <dan.melnic@amd.com>
22Reported-by: Dan Melnic <dan.melnic@amd.com>
23Signed-off-by: Dan Williams <dan.j.williams@intel.com>
24Reviewed-by: Jack Wang <jack_wang@usish.com>
25Signed-off-by: James Bottomley <JBottomley@Parallels.com>
26Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
27---
28 drivers/scsi/libsas/sas_expander.c | 39 +++++++++++------------------------
29 1 files changed, 12 insertions(+), 27 deletions(-)
30
31diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
32index 6330110..dbe3568 100644
33--- a/drivers/scsi/libsas/sas_expander.c
34+++ b/drivers/scsi/libsas/sas_expander.c
35@@ -774,7 +774,7 @@ static struct domain_device *sas_ex_discover_end_dev(
36 }
37
38 /* See if this phy is part of a wide port */
39-static int sas_ex_join_wide_port(struct domain_device *parent, int phy_id)
40+static bool sas_ex_join_wide_port(struct domain_device *parent, int phy_id)
41 {
42 struct ex_phy *phy = &parent->ex_dev.ex_phy[phy_id];
43 int i;
44@@ -790,11 +790,11 @@ static int sas_ex_join_wide_port(struct domain_device *parent, int phy_id)
45 sas_port_add_phy(ephy->port, phy->phy);
46 phy->port = ephy->port;
47 phy->phy_state = PHY_DEVICE_DISCOVERED;
48- return 0;
49+ return true;
50 }
51 }
52
53- return -ENODEV;
54+ return false;
55 }
56
57 static struct domain_device *sas_ex_discover_expander(
58@@ -932,8 +932,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
59 return res;
60 }
61
62- res = sas_ex_join_wide_port(dev, phy_id);
63- if (!res) {
64+ if (sas_ex_join_wide_port(dev, phy_id)) {
65 SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n",
66 phy_id, SAS_ADDR(ex_phy->attached_sas_addr));
67 return res;
68@@ -978,8 +977,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
69 if (SAS_ADDR(ex->ex_phy[i].attached_sas_addr) ==
70 SAS_ADDR(child->sas_addr)) {
71 ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED;
72- res = sas_ex_join_wide_port(dev, i);
73- if (!res)
74+ if (sas_ex_join_wide_port(dev, i))
75 SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n",
76 i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr));
77
78@@ -1849,32 +1847,20 @@ static int sas_discover_new(struct domain_device *dev, int phy_id)
79 {
80 struct ex_phy *ex_phy = &dev->ex_dev.ex_phy[phy_id];
81 struct domain_device *child;
82- bool found = false;
83- int res, i;
84+ int res;
85
86 SAS_DPRINTK("ex %016llx phy%d new device attached\n",
87 SAS_ADDR(dev->sas_addr), phy_id);
88 res = sas_ex_phy_discover(dev, phy_id);
89 if (res)
90- goto out;
91- /* to support the wide port inserted */
92- for (i = 0; i < dev->ex_dev.num_phys; i++) {
93- struct ex_phy *ex_phy_temp = &dev->ex_dev.ex_phy[i];
94- if (i == phy_id)
95- continue;
96- if (SAS_ADDR(ex_phy_temp->attached_sas_addr) ==
97- SAS_ADDR(ex_phy->attached_sas_addr)) {
98- found = true;
99- break;
100- }
101- }
102- if (found) {
103- sas_ex_join_wide_port(dev, phy_id);
104+ return res;
105+
106+ if (sas_ex_join_wide_port(dev, phy_id))
107 return 0;
108- }
109+
110 res = sas_ex_discover_devices(dev, phy_id);
111- if (!res)
112- goto out;
113+ if (res)
114+ return res;
115 list_for_each_entry(child, &dev->ex_dev.children, siblings) {
116 if (SAS_ADDR(child->sas_addr) ==
117 SAS_ADDR(ex_phy->attached_sas_addr)) {
118@@ -1884,7 +1870,6 @@ static int sas_discover_new(struct domain_device *dev, int phy_id)
119 break;
120 }
121 }
122-out:
123 return res;
124 }
125
126--
1271.7.7.6
128
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0059-iscsi-target-Drop-bogus-struct-file-usage-for-iSCSI-.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0059-iscsi-target-Drop-bogus-struct-file-usage-for-iSCSI-.patch
new file mode 100644
index 00000000..cfe9c565
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0059-iscsi-target-Drop-bogus-struct-file-usage-for-iSCSI-.patch
@@ -0,0 +1,230 @@
1From ea954b6e038224e5946f09b1a359d19e672cde3a Mon Sep 17 00:00:00 2001
2From: Al Viro <viro@ZenIV.linux.org.uk>
3Date: Sat, 21 Jul 2012 08:55:18 +0100
4Subject: [PATCH 59/73] iscsi-target: Drop bogus struct file usage for
5 iSCSI/SCTP
6
7commit bf6932f44a7b3fa7e2246a8b18a44670e5eab6c2 upstream.
8
9From Al Viro:
10
11 BTW, speaking of struct file treatment related to sockets -
12 there's this piece of code in iscsi:
13 /*
14 * The SCTP stack needs struct socket->file.
15 */
16 if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
17 (np->np_network_transport == ISCSI_SCTP_UDP)) {
18 if (!new_sock->file) {
19 new_sock->file = kzalloc(
20 sizeof(struct file), GFP_KERNEL);
21
22For one thing, as far as I can see it'not true - sctp does *not* depend on
23socket->file being non-NULL; it does, in one place, check socket->file->f_flags
24for O_NONBLOCK, but there it treats NULL socket->file as "flag not set".
25Which is the case here anyway - the fake struct file created in
26__iscsi_target_login_thread() (and in iscsi_target_setup_login_socket(), with
27the same excuse) do *not* get that flag set.
28
29Moreover, it's a bloody serious violation of a bunch of asserts in VFS;
30all struct file instances should come from filp_cachep, via get_empty_filp()
31(or alloc_file(), which is a wrapper for it). FWIW, I'm very tempted to
32do this and be done with the entire mess:
33
34Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
35Cc: Andy Grover <agrover@redhat.com>
36Cc: Hannes Reinecke <hare@suse.de>
37Cc: Christoph Hellwig <hch@lst.de>
38Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
39[bwh: Backported to 3.2: adjust context]
40Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
41---
42 drivers/target/iscsi/iscsi_target.c | 22 +---------
43 drivers/target/iscsi/iscsi_target_core.h | 2 -
44 drivers/target/iscsi/iscsi_target_login.c | 60 +---------------------------
45 3 files changed, 6 insertions(+), 78 deletions(-)
46
47diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
48index 0842cc7..2ff1255 100644
49--- a/drivers/target/iscsi/iscsi_target.c
50+++ b/drivers/target/iscsi/iscsi_target.c
51@@ -427,19 +427,8 @@ int iscsit_reset_np_thread(
52
53 int iscsit_del_np_comm(struct iscsi_np *np)
54 {
55- if (!np->np_socket)
56- return 0;
57-
58- /*
59- * Some network transports allocate their own struct sock->file,
60- * see if we need to free any additional allocated resources.
61- */
62- if (np->np_flags & NPF_SCTP_STRUCT_FILE) {
63- kfree(np->np_socket->file);
64- np->np_socket->file = NULL;
65- }
66-
67- sock_release(np->np_socket);
68+ if (np->np_socket)
69+ sock_release(np->np_socket);
70 return 0;
71 }
72
73@@ -4105,13 +4094,8 @@ int iscsit_close_connection(
74 kfree(conn->conn_ops);
75 conn->conn_ops = NULL;
76
77- if (conn->sock) {
78- if (conn->conn_flags & CONNFLAG_SCTP_STRUCT_FILE) {
79- kfree(conn->sock->file);
80- conn->sock->file = NULL;
81- }
82+ if (conn->sock)
83 sock_release(conn->sock);
84- }
85 conn->thread_set = NULL;
86
87 pr_debug("Moving to TARG_CONN_STATE_FREE.\n");
88diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
89index 7da2d6a..0f68197 100644
90--- a/drivers/target/iscsi/iscsi_target_core.h
91+++ b/drivers/target/iscsi/iscsi_target_core.h
92@@ -224,7 +224,6 @@ enum iscsi_timer_flags_table {
93 /* Used for struct iscsi_np->np_flags */
94 enum np_flags_table {
95 NPF_IP_NETWORK = 0x00,
96- NPF_SCTP_STRUCT_FILE = 0x01 /* Bugfix */
97 };
98
99 /* Used for struct iscsi_np->np_thread_state */
100@@ -511,7 +510,6 @@ struct iscsi_conn {
101 u16 local_port;
102 int net_size;
103 u32 auth_id;
104-#define CONNFLAG_SCTP_STRUCT_FILE 0x01
105 u32 conn_flags;
106 /* Used for iscsi_tx_login_rsp() */
107 u32 login_itt;
108diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
109index bd2adec..2ec5339 100644
110--- a/drivers/target/iscsi/iscsi_target_login.c
111+++ b/drivers/target/iscsi/iscsi_target_login.c
112@@ -793,22 +793,6 @@ int iscsi_target_setup_login_socket(
113 }
114 np->np_socket = sock;
115 /*
116- * The SCTP stack needs struct socket->file.
117- */
118- if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
119- (np->np_network_transport == ISCSI_SCTP_UDP)) {
120- if (!sock->file) {
121- sock->file = kzalloc(sizeof(struct file), GFP_KERNEL);
122- if (!sock->file) {
123- pr_err("Unable to allocate struct"
124- " file for SCTP\n");
125- ret = -ENOMEM;
126- goto fail;
127- }
128- np->np_flags |= NPF_SCTP_STRUCT_FILE;
129- }
130- }
131- /*
132 * Setup the np->np_sockaddr from the passed sockaddr setup
133 * in iscsi_target_configfs.c code..
134 */
135@@ -857,21 +841,15 @@ int iscsi_target_setup_login_socket(
136
137 fail:
138 np->np_socket = NULL;
139- if (sock) {
140- if (np->np_flags & NPF_SCTP_STRUCT_FILE) {
141- kfree(sock->file);
142- sock->file = NULL;
143- }
144-
145+ if (sock)
146 sock_release(sock);
147- }
148 return ret;
149 }
150
151 static int __iscsi_target_login_thread(struct iscsi_np *np)
152 {
153 u8 buffer[ISCSI_HDR_LEN], iscsi_opcode, zero_tsih = 0;
154- int err, ret = 0, ip_proto, sock_type, set_sctp_conn_flag, stop;
155+ int err, ret = 0, ip_proto, sock_type, stop;
156 struct iscsi_conn *conn = NULL;
157 struct iscsi_login *login;
158 struct iscsi_portal_group *tpg = NULL;
159@@ -882,7 +860,6 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
160 struct sockaddr_in6 sock_in6;
161
162 flush_signals(current);
163- set_sctp_conn_flag = 0;
164 sock = np->np_socket;
165 ip_proto = np->np_ip_proto;
166 sock_type = np->np_sock_type;
167@@ -907,35 +884,12 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
168 spin_unlock_bh(&np->np_thread_lock);
169 goto out;
170 }
171- /*
172- * The SCTP stack needs struct socket->file.
173- */
174- if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
175- (np->np_network_transport == ISCSI_SCTP_UDP)) {
176- if (!new_sock->file) {
177- new_sock->file = kzalloc(
178- sizeof(struct file), GFP_KERNEL);
179- if (!new_sock->file) {
180- pr_err("Unable to allocate struct"
181- " file for SCTP\n");
182- sock_release(new_sock);
183- /* Get another socket */
184- return 1;
185- }
186- set_sctp_conn_flag = 1;
187- }
188- }
189-
190 iscsi_start_login_thread_timer(np);
191
192 conn = kzalloc(sizeof(struct iscsi_conn), GFP_KERNEL);
193 if (!conn) {
194 pr_err("Could not allocate memory for"
195 " new connection\n");
196- if (set_sctp_conn_flag) {
197- kfree(new_sock->file);
198- new_sock->file = NULL;
199- }
200 sock_release(new_sock);
201 /* Get another socket */
202 return 1;
203@@ -945,9 +899,6 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
204 conn->conn_state = TARG_CONN_STATE_FREE;
205 conn->sock = new_sock;
206
207- if (set_sctp_conn_flag)
208- conn->conn_flags |= CONNFLAG_SCTP_STRUCT_FILE;
209-
210 pr_debug("Moving to TARG_CONN_STATE_XPT_UP.\n");
211 conn->conn_state = TARG_CONN_STATE_XPT_UP;
212
213@@ -1195,13 +1146,8 @@ old_sess_out:
214 iscsi_release_param_list(conn->param_list);
215 conn->param_list = NULL;
216 }
217- if (conn->sock) {
218- if (conn->conn_flags & CONNFLAG_SCTP_STRUCT_FILE) {
219- kfree(conn->sock->file);
220- conn->sock->file = NULL;
221- }
222+ if (conn->sock)
223 sock_release(conn->sock);
224- }
225 kfree(conn);
226
227 if (tpg) {
228--
2291.7.7.6
230
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0060-mmc-sdhci-pci-CaFe-has-broken-card-detection.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0060-mmc-sdhci-pci-CaFe-has-broken-card-detection.patch
new file mode 100644
index 00000000..22812ab7
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0060-mmc-sdhci-pci-CaFe-has-broken-card-detection.patch
@@ -0,0 +1,42 @@
1From eb0aa45b9b49d8daeef285f1c5bb0be392caaddf Mon Sep 17 00:00:00 2001
2From: Daniel Drake <dsd@laptop.org>
3Date: Tue, 3 Jul 2012 23:13:39 +0100
4Subject: [PATCH 60/73] mmc: sdhci-pci: CaFe has broken card detection
5
6commit 55fc05b7414274f17795cd0e8a3b1546f3649d5e upstream.
7
8At http://dev.laptop.org/ticket/11980 we have determined that the
9Marvell CaFe SDHCI controller reports bad card presence during
10resume. It reports that no card is present even when it is.
11This is a regression -- resume worked back around 2.6.37.
12
13Around 400ms after resuming, a "card inserted" interrupt is
14generated, at which point it starts reporting presence.
15
16Work around this hardware oddity by setting the
17SDHCI_QUIRK_BROKEN_CARD_DETECTION flag.
18Thanks to Chris Ball for helping with diagnosis.
19
20Signed-off-by: Daniel Drake <dsd@laptop.org>
21[stable@: please apply to 3.0+]
22Signed-off-by: Chris Ball <cjb@laptop.org>
23Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
24---
25 drivers/mmc/host/sdhci-pci.c | 1 +
26 1 files changed, 1 insertions(+), 0 deletions(-)
27
28diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
29index 6878a94..83b51b5 100644
30--- a/drivers/mmc/host/sdhci-pci.c
31+++ b/drivers/mmc/host/sdhci-pci.c
32@@ -148,6 +148,7 @@ static const struct sdhci_pci_fixes sdhci_ene_714 = {
33 static const struct sdhci_pci_fixes sdhci_cafe = {
34 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
35 SDHCI_QUIRK_NO_BUSY_IRQ |
36+ SDHCI_QUIRK_BROKEN_CARD_DETECTION |
37 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
38 };
39
40--
411.7.7.6
42
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch
new file mode 100644
index 00000000..428571df
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch
@@ -0,0 +1,55 @@
1From a09474d4d4bba3e468ff96d826b90b5551f98111 Mon Sep 17 00:00:00 2001
2From: Brian Foster <bfoster@redhat.com>
3Date: Sun, 22 Jul 2012 23:59:40 -0400
4Subject: [PATCH 61/73] ext4: don't let i_reserved_meta_blocks go negative
5
6commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream.
7
8If we hit a condition where we have allocated metadata blocks that
9were not appropriately reserved, we risk underflow of
10ei->i_reserved_meta_blocks. In turn, this can throw
11sbi->s_dirtyclusters_counter significantly out of whack and undermine
12the nondelalloc fallback logic in ext4_nonda_switch(). Warn if this
13occurs and set i_allocated_meta_blocks to avoid this problem.
14
15This condition is reproduced by xfstests 270 against ext2 with
16delalloc enabled:
17
18Mar 28 08:58:02 localhost kernel: [ 171.526344] EXT4-fs (loop1): delayed block allocation failed for inode 14 at logical offset 64486 with max blocks 64 with error -28
19Mar 28 08:58:02 localhost kernel: [ 171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost
20
21270 ultimately fails with an inconsistent filesystem and requires an
22fsck to repair. The cause of the error is an underflow in
23ext4_da_update_reserve_space() due to an unreserved meta block
24allocation.
25
26Signed-off-by: Brian Foster <bfoster@redhat.com>
27Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
28Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
29---
30 fs/ext4/inode.c | 9 +++++++++
31 1 files changed, 9 insertions(+), 0 deletions(-)
32
33diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
34index d0dc109..03373c3 100644
35--- a/fs/ext4/inode.c
36+++ b/fs/ext4/inode.c
37@@ -277,6 +277,15 @@ void ext4_da_update_reserve_space(struct inode *inode,
38 used = ei->i_reserved_data_blocks;
39 }
40
41+ if (unlikely(ei->i_allocated_meta_blocks > ei->i_reserved_meta_blocks)) {
42+ ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, allocated %d "
43+ "with only %d reserved metadata blocks\n", __func__,
44+ inode->i_ino, ei->i_allocated_meta_blocks,
45+ ei->i_reserved_meta_blocks);
46+ WARN_ON(1);
47+ ei->i_allocated_meta_blocks = ei->i_reserved_meta_blocks;
48+ }
49+
50 /* Update per-inode reservations */
51 ei->i_reserved_data_blocks -= used;
52 ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
53--
541.7.7.6
55
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0062-ext4-undo-ext4_calc_metadata_amount-if-we-fail-to-cl.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0062-ext4-undo-ext4_calc_metadata_amount-if-we-fail-to-cl.patch
new file mode 100644
index 00000000..dac384ad
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0062-ext4-undo-ext4_calc_metadata_amount-if-we-fail-to-cl.patch
@@ -0,0 +1,93 @@
1From f7aa52ca54cad12194d0c48a95c2d4ccdf487c6c Mon Sep 17 00:00:00 2001
2From: Theodore Ts'o <tytso@mit.edu>
3Date: Mon, 23 Jul 2012 00:00:20 -0400
4Subject: [PATCH 62/73] ext4: undo ext4_calc_metadata_amount if we fail to
5 claim space
6
7commit 03179fe92318e7934c180d96f12eff2cb36ef7b6 upstream.
8
9The function ext4_calc_metadata_amount() has side effects, although
10it's not obvious from its function name. So if we fail to claim
11space, regardless of whether we retry to claim the space again, or
12return an error, we need to undo these side effects.
13
14Otherwise we can end up incorrectly calculating the number of metadata
15blocks needed for the operation, which was responsible for an xfstests
16failure for test #271 when using an ext2 file system with delalloc
17enabled.
18
19Reported-by: Brian Foster <bfoster@redhat.com>
20Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
21Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
22---
23 fs/ext4/inode.c | 32 +++++++++++++++++++++-----------
24 1 files changed, 21 insertions(+), 11 deletions(-)
25
26diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
27index 03373c3..b556994 100644
28--- a/fs/ext4/inode.c
29+++ b/fs/ext4/inode.c
30@@ -1111,6 +1111,17 @@ static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock)
31 struct ext4_inode_info *ei = EXT4_I(inode);
32 unsigned int md_needed;
33 int ret;
34+ ext4_lblk_t save_last_lblock;
35+ int save_len;
36+
37+ /*
38+ * We will charge metadata quota at writeout time; this saves
39+ * us from metadata over-estimation, though we may go over by
40+ * a small amount in the end. Here we just reserve for data.
41+ */
42+ ret = dquot_reserve_block(inode, EXT4_C2B(sbi, 1));
43+ if (ret)
44+ return ret;
45
46 /*
47 * recalculate the amount of metadata blocks to reserve
48@@ -1119,32 +1130,31 @@ static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock)
49 */
50 repeat:
51 spin_lock(&ei->i_block_reservation_lock);
52+ /*
53+ * ext4_calc_metadata_amount() has side effects, which we have
54+ * to be prepared undo if we fail to claim space.
55+ */
56+ save_len = ei->i_da_metadata_calc_len;
57+ save_last_lblock = ei->i_da_metadata_calc_last_lblock;
58 md_needed = EXT4_NUM_B2C(sbi,
59 ext4_calc_metadata_amount(inode, lblock));
60 trace_ext4_da_reserve_space(inode, md_needed);
61- spin_unlock(&ei->i_block_reservation_lock);
62
63 /*
64- * We will charge metadata quota at writeout time; this saves
65- * us from metadata over-estimation, though we may go over by
66- * a small amount in the end. Here we just reserve for data.
67- */
68- ret = dquot_reserve_block(inode, EXT4_C2B(sbi, 1));
69- if (ret)
70- return ret;
71- /*
72 * We do still charge estimated metadata to the sb though;
73 * we cannot afford to run out of free blocks.
74 */
75 if (ext4_claim_free_clusters(sbi, md_needed + 1, 0)) {
76- dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
77+ ei->i_da_metadata_calc_len = save_len;
78+ ei->i_da_metadata_calc_last_lblock = save_last_lblock;
79+ spin_unlock(&ei->i_block_reservation_lock);
80 if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
81 yield();
82 goto repeat;
83 }
84+ dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
85 return -ENOSPC;
86 }
87- spin_lock(&ei->i_block_reservation_lock);
88 ei->i_reserved_data_blocks++;
89 ei->i_reserved_meta_blocks += md_needed;
90 spin_unlock(&ei->i_block_reservation_lock);
91--
921.7.7.6
93
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0063-ASoC-dapm-Fix-_PRE-and-_POST-events-for-DAPM-perform.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0063-ASoC-dapm-Fix-_PRE-and-_POST-events-for-DAPM-perform.patch
new file mode 100644
index 00000000..a1fc4639
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0063-ASoC-dapm-Fix-_PRE-and-_POST-events-for-DAPM-perform.patch
@@ -0,0 +1,46 @@
1From 8fbf76d6e7e81a95a44e627e0c6dbeef231700f2 Mon Sep 17 00:00:00 2001
2From: Mark Brown <broonie@opensource.wolfsonmicro.com>
3Date: Fri, 20 Jul 2012 17:29:34 +0100
4Subject: [PATCH 63/73] ASoC: dapm: Fix _PRE and _POST events for DAPM
5 performance improvements
6
7commit 0ff97ebf0804d2e519d578fcb4db03f104d2ca8c upstream.
8
9Ever since the DAPM performance improvements we've been marking all widgets
10as not dirty after each DAPM run. Since _PRE and _POST events aren't part
11of the DAPM graph this has rendered them non-functional, they will never be
12marked dirty again and thus will never be run again.
13
14Fix this by skipping them when marking widgets as not dirty.
15
16Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
17Acked-by: Liam Girdwood <lrg@ti.com>
18Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
19---
20 sound/soc/soc-dapm.c | 10 +++++++++-
21 1 files changed, 9 insertions(+), 1 deletions(-)
22
23diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
24index 90e93bf..0dc441c 100644
25--- a/sound/soc/soc-dapm.c
26+++ b/sound/soc/soc-dapm.c
27@@ -1381,7 +1381,15 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
28 }
29
30 list_for_each_entry(w, &card->widgets, list) {
31- list_del_init(&w->dirty);
32+ switch (w->id) {
33+ case snd_soc_dapm_pre:
34+ case snd_soc_dapm_post:
35+ /* These widgets always need to be powered */
36+ break;
37+ default:
38+ list_del_init(&w->dirty);
39+ break;
40+ }
41
42 if (w->power) {
43 d = w->dapm;
44--
451.7.7.6
46
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0064-locks-fix-checking-of-fcntl_setlease-argument.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0064-locks-fix-checking-of-fcntl_setlease-argument.patch
new file mode 100644
index 00000000..7296221e
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0064-locks-fix-checking-of-fcntl_setlease-argument.patch
@@ -0,0 +1,57 @@
1From fb13198419fd31d8cbe249d285abd4f69d2c4f6d Mon Sep 17 00:00:00 2001
2From: "J. Bruce Fields" <bfields@fieldses.org>
3Date: Mon, 23 Jul 2012 15:17:17 -0400
4Subject: [PATCH 64/73] locks: fix checking of fcntl_setlease argument
5
6commit 0ec4f431eb56d633da3a55da67d5c4b88886ccc7 upstream.
7
8The only checks of the long argument passed to fcntl(fd,F_SETLEASE,.)
9are done after converting the long to an int. Thus some illegal values
10may be let through and cause problems in later code.
11
12[ They actually *don't* cause problems in mainline, as of Dave Jones's
13 commit 8d657eb3b438 "Remove easily user-triggerable BUG from
14 generic_setlease", but we should fix this anyway. And this patch will
15 be necessary to fix real bugs on earlier kernels. ]
16
17Signed-off-by: J. Bruce Fields <bfields@redhat.com>
18Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
19Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
20---
21 fs/locks.c | 6 +++---
22 1 files changed, 3 insertions(+), 3 deletions(-)
23
24diff --git a/fs/locks.c b/fs/locks.c
25index 6a64f15..fcc50ab 100644
26--- a/fs/locks.c
27+++ b/fs/locks.c
28@@ -308,7 +308,7 @@ static int flock_make_lock(struct file *filp, struct file_lock **lock,
29 return 0;
30 }
31
32-static int assign_type(struct file_lock *fl, int type)
33+static int assign_type(struct file_lock *fl, long type)
34 {
35 switch (type) {
36 case F_RDLCK:
37@@ -445,7 +445,7 @@ static const struct lock_manager_operations lease_manager_ops = {
38 /*
39 * Initialize a lease, use the default lock manager operations
40 */
41-static int lease_init(struct file *filp, int type, struct file_lock *fl)
42+static int lease_init(struct file *filp, long type, struct file_lock *fl)
43 {
44 if (assign_type(fl, type) != 0)
45 return -EINVAL;
46@@ -463,7 +463,7 @@ static int lease_init(struct file *filp, int type, struct file_lock *fl)
47 }
48
49 /* Allocate a file_lock initialised to this type of lease */
50-static struct file_lock *lease_alloc(struct file *filp, int type)
51+static struct file_lock *lease_alloc(struct file *filp, long type)
52 {
53 struct file_lock *fl = locks_alloc_lock();
54 int error = -ENOMEM;
55--
561.7.7.6
57
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0065-ACPI-AC-prevent-OOPS-on-some-boxes-due-to-missing-ch.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0065-ACPI-AC-prevent-OOPS-on-some-boxes-due-to-missing-ch.patch
new file mode 100644
index 00000000..5fa53fb5
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0065-ACPI-AC-prevent-OOPS-on-some-boxes-due-to-missing-ch.patch
@@ -0,0 +1,45 @@
1From 847ccb9086b1b76d8db67f37e36e909727c010cb Mon Sep 17 00:00:00 2001
2From: Lan Tianyu <tianyu.lan@intel.com>
3Date: Fri, 20 Jul 2012 13:29:16 +0800
4Subject: [PATCH 65/73] ACPI/AC: prevent OOPS on some boxes due to missing
5 check power_supply_register() return value check
6
7commit f197ac13f6eeb351b31250b9ab7d0da17434ea36 upstream.
8
9In the ac.c, power_supply_register()'s return value is not checked.
10
11As a result, the driver's add() ops may return success
12even though the device failed to initialize.
13
14For example, some BIOS may describe two ACADs in the same DSDT.
15The second ACAD device will fail to register,
16but ACPI driver's add() ops returns sucessfully.
17The ACPI device will receive ACPI notification and cause OOPS.
18
19https://bugzilla.redhat.com/show_bug.cgi?id=772730
20
21Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
22Signed-off-by: Len Brown <len.brown@intel.com>
23Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
24---
25 drivers/acpi/ac.c | 4 +++-
26 1 files changed, 3 insertions(+), 1 deletions(-)
27
28diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
29index 6512b20..d1fcbc0 100644
30--- a/drivers/acpi/ac.c
31+++ b/drivers/acpi/ac.c
32@@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_device *device)
33 ac->charger.properties = ac_props;
34 ac->charger.num_properties = ARRAY_SIZE(ac_props);
35 ac->charger.get_property = get_ac_property;
36- power_supply_register(&ac->device->dev, &ac->charger);
37+ result = power_supply_register(&ac->device->dev, &ac->charger);
38+ if (result)
39+ goto end;
40
41 printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
42 acpi_device_name(device), acpi_device_bid(device),
43--
441.7.7.6
45
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0066-drm-radeon-fix-bo-creation-retry-path.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0066-drm-radeon-fix-bo-creation-retry-path.patch
new file mode 100644
index 00000000..065e87be
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0066-drm-radeon-fix-bo-creation-retry-path.patch
@@ -0,0 +1,47 @@
1From 9fc722e4c6da369ecad425d55a4fe50c6dbd21d9 Mon Sep 17 00:00:00 2001
2From: Jerome Glisse <jglisse@redhat.com>
3Date: Thu, 12 Jul 2012 18:23:05 -0400
4Subject: [PATCH 66/73] drm/radeon: fix bo creation retry path
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9commit d1c7871ddb1f588b8eb35affd9ee1a3d5e11cd0c upstream.
10
11Retry label was at wrong place in function leading to memory
12leak.
13
14Signed-off-by: Jerome Glisse <jglisse@redhat.com>
15Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
16Reviewed-by: Christian König <christian.koenig@amd.com>
17Signed-off-by: Dave Airlie <airlied@redhat.com>
18[bwh: Backported to 3.2: adjust context]
19Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
20---
21 drivers/gpu/drm/radeon/radeon_object.c | 3 ++-
22 1 files changed, 2 insertions(+), 1 deletions(-)
23
24diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
25index f3ae607..39497c7 100644
26--- a/drivers/gpu/drm/radeon/radeon_object.c
27+++ b/drivers/gpu/drm/radeon/radeon_object.c
28@@ -117,7 +117,6 @@ int radeon_bo_create(struct radeon_device *rdev,
29 return -ENOMEM;
30 }
31
32-retry:
33 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
34 if (bo == NULL)
35 return -ENOMEM;
36@@ -130,6 +129,8 @@ retry:
37 bo->gem_base.driver_private = NULL;
38 bo->surface_reg = -1;
39 INIT_LIST_HEAD(&bo->list);
40+
41+retry:
42 radeon_ttm_placement_from_domain(bo, domain);
43 /* Kernel allocation are uninterruptible */
44 mutex_lock(&rdev->vram_mutex);
45--
461.7.7.6
47
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0067-drm-radeon-fix-non-revealent-error-message.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0067-drm-radeon-fix-non-revealent-error-message.patch
new file mode 100644
index 00000000..85e0cad3
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0067-drm-radeon-fix-non-revealent-error-message.patch
@@ -0,0 +1,70 @@
1From 0521c32992bd885e150c17f413200d82fa83911c Mon Sep 17 00:00:00 2001
2From: Jerome Glisse <jglisse@redhat.com>
3Date: Tue, 17 Jul 2012 17:17:16 -0400
4Subject: [PATCH 67/73] drm/radeon: fix non revealent error message
5
6commit 8d1c702aa0b2c4b22b0742b72a1149d91690674b upstream.
7
8We want to print link status query failed only if it's
9an unexepected fail. If we query to see if we need
10link training it might be because there is nothing
11connected and thus link status query have the right
12to fail in that case.
13
14To avoid printing failure when it's expected, move the
15failure message to proper place.
16
17Signed-off-by: Jerome Glisse <jglisse@redhat.com>
18Signed-off-by: Dave Airlie <airlied@redhat.com>
19Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
20---
21 drivers/gpu/drm/radeon/atombios_dp.c | 10 +++++++---
22 1 files changed, 7 insertions(+), 3 deletions(-)
23
24diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
25index 552b436..3254d51 100644
26--- a/drivers/gpu/drm/radeon/atombios_dp.c
27+++ b/drivers/gpu/drm/radeon/atombios_dp.c
28@@ -22,6 +22,7 @@
29 *
30 * Authors: Dave Airlie
31 * Alex Deucher
32+ * Jerome Glisse
33 */
34 #include "drmP.h"
35 #include "radeon_drm.h"
36@@ -634,7 +635,6 @@ static bool radeon_dp_get_link_status(struct radeon_connector *radeon_connector,
37 ret = radeon_dp_aux_native_read(radeon_connector, DP_LANE0_1_STATUS,
38 link_status, DP_LINK_STATUS_SIZE, 100);
39 if (ret <= 0) {
40- DRM_ERROR("displayport link status failed\n");
41 return false;
42 }
43
44@@ -812,8 +812,10 @@ static int radeon_dp_link_train_cr(struct radeon_dp_link_train_info *dp_info)
45 else
46 mdelay(dp_info->rd_interval * 4);
47
48- if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status))
49+ if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status)) {
50+ DRM_ERROR("displayport link status failed\n");
51 break;
52+ }
53
54 if (dp_clock_recovery_ok(dp_info->link_status, dp_info->dp_lane_count)) {
55 clock_recovery = true;
56@@ -875,8 +877,10 @@ static int radeon_dp_link_train_ce(struct radeon_dp_link_train_info *dp_info)
57 else
58 mdelay(dp_info->rd_interval * 4);
59
60- if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status))
61+ if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status)) {
62+ DRM_ERROR("displayport link status failed\n");
63 break;
64+ }
65
66 if (dp_channel_eq_ok(dp_info->link_status, dp_info->dp_lane_count)) {
67 channel_eq = true;
68--
691.7.7.6
70
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0068-drm-radeon-fix-hotplug-of-DP-to-DVI-HDMI-passive-ada.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0068-drm-radeon-fix-hotplug-of-DP-to-DVI-HDMI-passive-ada.patch
new file mode 100644
index 00000000..0872ed35
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0068-drm-radeon-fix-hotplug-of-DP-to-DVI-HDMI-passive-ada.patch
@@ -0,0 +1,69 @@
1From 0de546b55811738998d83bb6e677306d65e90861 Mon Sep 17 00:00:00 2001
2From: Jerome Glisse <jglisse@redhat.com>
3Date: Thu, 19 Jul 2012 17:15:56 -0400
4Subject: [PATCH 68/73] drm/radeon: fix hotplug of DP to DVI|HDMI passive
5 adapters (v2)
6
7commit 266dcba541a1ef7e5d82d9e67c67fde2910636e8 upstream.
8
9No need to retrain the link for passive adapters.
10
11v2: agd5f
12- no passive DP to VGA adapters, update comments
13- assign radeon_connector_atom_dig after we are sure
14 we have a digital connector as analog connectors
15 have different private data.
16- get new sink type before checking for retrain. No
17 need to check if it's no longer a DP connection.
18
19Signed-off-by: Jerome Glisse <jglisse@redhat.com>
20Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
21Signed-off-by: Dave Airlie <airlied@redhat.com>
22Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
23---
24 drivers/gpu/drm/radeon/radeon_connectors.c | 29 ++++++++++++++++++++-------
25 1 files changed, 21 insertions(+), 8 deletions(-)
26
27diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
28index 4a4493f..fb8db7a 100644
29--- a/drivers/gpu/drm/radeon/radeon_connectors.c
30+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
31@@ -64,14 +64,27 @@ void radeon_connector_hotplug(struct drm_connector *connector)
32
33 /* just deal with DP (not eDP) here. */
34 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
35- int saved_dpms = connector->dpms;
36-
37- /* Only turn off the display it it's physically disconnected */
38- if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
39- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
40- else if (radeon_dp_needs_link_train(radeon_connector))
41- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
42- connector->dpms = saved_dpms;
43+ struct radeon_connector_atom_dig *dig_connector =
44+ radeon_connector->con_priv;
45+
46+ /* if existing sink type was not DP no need to retrain */
47+ if (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT)
48+ return;
49+
50+ /* first get sink type as it may be reset after (un)plug */
51+ dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
52+ /* don't do anything if sink is not display port, i.e.,
53+ * passive dp->(dvi|hdmi) adaptor
54+ */
55+ if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
56+ int saved_dpms = connector->dpms;
57+ /* Only turn off the display if it's physically disconnected */
58+ if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
59+ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
60+ else if (radeon_dp_needs_link_train(radeon_connector))
61+ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
62+ connector->dpms = saved_dpms;
63+ }
64 }
65 }
66
67--
681.7.7.6
69
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0069-drm-radeon-on-hotplug-force-link-training-to-happen-.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0069-drm-radeon-on-hotplug-force-link-training-to-happen-.patch
new file mode 100644
index 00000000..67959f97
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0069-drm-radeon-on-hotplug-force-link-training-to-happen-.patch
@@ -0,0 +1,51 @@
1From 66ce98f9164b89ce8566d303265e209829f41c9f Mon Sep 17 00:00:00 2001
2From: Jerome Glisse <jglisse@redhat.com>
3Date: Thu, 19 Jul 2012 17:25:55 -0400
4Subject: [PATCH 69/73] drm/radeon: on hotplug force link training to happen
5 (v2)
6
7commit ca2ccde5e2f24a792caa4cca919fc5c6f65d1887 upstream.
8
9To have DP behave like VGA/DVI we need to retrain the link
10on hotplug. For this to happen we need to force link
11training to happen by setting connector dpms to off
12before asking it turning it on again.
13
14v2: agd5f
15- drop the dp_get_link_status() change in atombios_dp.c
16 for now. We still need the dpms OFF change.
17
18Signed-off-by: Jerome Glisse <jglisse@redhat.com>
19Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
20Signed-off-by: Dave Airlie <airlied@redhat.com>
21Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
22---
23 drivers/gpu/drm/radeon/radeon_connectors.c | 10 ++++++++--
24 1 files changed, 8 insertions(+), 2 deletions(-)
25
26diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
27index fb8db7a..87d494d 100644
28--- a/drivers/gpu/drm/radeon/radeon_connectors.c
29+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
30@@ -79,10 +79,16 @@ void radeon_connector_hotplug(struct drm_connector *connector)
31 if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
32 int saved_dpms = connector->dpms;
33 /* Only turn off the display if it's physically disconnected */
34- if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
35+ if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
36 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
37- else if (radeon_dp_needs_link_train(radeon_connector))
38+ } else if (radeon_dp_needs_link_train(radeon_connector)) {
39+ /* set it to OFF so that drm_helper_connector_dpms()
40+ * won't return immediately since the current state
41+ * is ON at this point.
42+ */
43+ connector->dpms = DRM_MODE_DPMS_OFF;
44 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
45+ }
46 connector->dpms = saved_dpms;
47 }
48 }
49--
501.7.7.6
51
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0070-Btrfs-call-the-ordered-free-operation-without-any-lo.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0070-Btrfs-call-the-ordered-free-operation-without-any-lo.patch
new file mode 100644
index 00000000..871e6c0d
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0070-Btrfs-call-the-ordered-free-operation-without-any-lo.patch
@@ -0,0 +1,48 @@
1From f9254351de93ec535792d9a66b462d835875a6d3 Mon Sep 17 00:00:00 2001
2From: Chris Mason <chris.mason@fusionio.com>
3Date: Wed, 25 Jul 2012 15:57:13 -0400
4Subject: [PATCH 70/73] Btrfs: call the ordered free operation without any
5 locks held
6
7commit e9fbcb42201c862fd6ab45c48ead4f47bb2dea9d upstream.
8
9Each ordered operation has a free callback, and this was called with the
10worker spinlock held. Josef made the free callback also call iput,
11which we can't do with the spinlock.
12
13This drops the spinlock for the free operation and grabs it again before
14moving through the rest of the list. We'll circle back around to this
15and find a cleaner way that doesn't bounce the lock around so much.
16
17Signed-off-by: Chris Mason <chris.mason@fusionio.com>
18Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
19---
20 fs/btrfs/async-thread.c | 9 ++++++++-
21 1 files changed, 8 insertions(+), 1 deletions(-)
22
23diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
24index 0b39458..03321e5 100644
25--- a/fs/btrfs/async-thread.c
26+++ b/fs/btrfs/async-thread.c
27@@ -206,10 +206,17 @@ static noinline int run_ordered_completions(struct btrfs_workers *workers,
28
29 work->ordered_func(work);
30
31- /* now take the lock again and call the freeing code */
32+ /* now take the lock again and drop our item from the list */
33 spin_lock(&workers->order_lock);
34 list_del(&work->order_list);
35+ spin_unlock(&workers->order_lock);
36+
37+ /*
38+ * we don't want to call the ordered free functions
39+ * with the lock held though
40+ */
41 work->ordered_free(work);
42+ spin_lock(&workers->order_lock);
43 }
44
45 spin_unlock(&workers->order_lock);
46--
471.7.7.6
48
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0071-nouveau-Fix-alignment-requirements-on-src-and-dst-ad.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0071-nouveau-Fix-alignment-requirements-on-src-and-dst-ad.patch
new file mode 100644
index 00000000..96bdd5da
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0071-nouveau-Fix-alignment-requirements-on-src-and-dst-ad.patch
@@ -0,0 +1,748 @@
1From ea77473ebf8397a7462fd28ad93e01a50084b146 Mon Sep 17 00:00:00 2001
2From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
3Date: Mon, 4 Jun 2012 12:00:31 +0200
4Subject: [PATCH 71/73] nouveau: Fix alignment requirements on src and dst
5 addresses
6
7commit ce806a30470bcd846d148bf39d46de3ad7748228 upstream.
8
9Linear copy works by adding the offset to the buffer address,
10which may end up not being 16-byte aligned.
11
12Some tests I've written for prime_pcopy show that the engine
13allows this correctly, so the restriction on lowest 4 bits of
14address can be lifted safely.
15
16The comments added were by envyas, I think because I used
17a newer version.
18
19Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
20[bwh: Backported to 3.2: no # prefixes in nva3_copy.fuc]
21Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
22---
23 drivers/gpu/drm/nouveau/nva3_copy.fuc | 4 +-
24 drivers/gpu/drm/nouveau/nva3_copy.fuc.h | 94 +++++++++++++++++++++++++++++-
25 drivers/gpu/drm/nouveau/nvc0_copy.fuc.h | 87 +++++++++++++++++++++++++++-
26 3 files changed, 175 insertions(+), 10 deletions(-)
27
28diff --git a/drivers/gpu/drm/nouveau/nva3_copy.fuc b/drivers/gpu/drm/nouveau/nva3_copy.fuc
29index eaf35f8..d894731 100644
30--- a/drivers/gpu/drm/nouveau/nva3_copy.fuc
31+++ b/drivers/gpu/drm/nouveau/nva3_copy.fuc
32@@ -118,9 +118,9 @@ dispatch_dma:
33 // mthd 0x030c-0x0340, various stuff
34 .b16 0xc3 14
35 .b32 ctx_src_address_high ~0x000000ff
36-.b32 ctx_src_address_low ~0xfffffff0
37+.b32 ctx_src_address_low ~0xffffffff
38 .b32 ctx_dst_address_high ~0x000000ff
39-.b32 ctx_dst_address_low ~0xfffffff0
40+.b32 ctx_dst_address_low ~0xffffffff
41 .b32 ctx_src_pitch ~0x0007ffff
42 .b32 ctx_dst_pitch ~0x0007ffff
43 .b32 ctx_xcnt ~0x0000ffff
44diff --git a/drivers/gpu/drm/nouveau/nva3_copy.fuc.h b/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
45index 2731de2..e2a0e88 100644
46--- a/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
47+++ b/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
48@@ -1,37 +1,72 @@
49-uint32_t nva3_pcopy_data[] = {
50+u32 nva3_pcopy_data[] = {
51+/* 0x0000: ctx_object */
52 0x00000000,
53+/* 0x0004: ctx_dma */
54+/* 0x0004: ctx_dma_query */
55 0x00000000,
56+/* 0x0008: ctx_dma_src */
57 0x00000000,
58+/* 0x000c: ctx_dma_dst */
59 0x00000000,
60+/* 0x0010: ctx_query_address_high */
61 0x00000000,
62+/* 0x0014: ctx_query_address_low */
63 0x00000000,
64+/* 0x0018: ctx_query_counter */
65 0x00000000,
66+/* 0x001c: ctx_src_address_high */
67 0x00000000,
68+/* 0x0020: ctx_src_address_low */
69 0x00000000,
70+/* 0x0024: ctx_src_pitch */
71 0x00000000,
72+/* 0x0028: ctx_src_tile_mode */
73 0x00000000,
74+/* 0x002c: ctx_src_xsize */
75 0x00000000,
76+/* 0x0030: ctx_src_ysize */
77 0x00000000,
78+/* 0x0034: ctx_src_zsize */
79 0x00000000,
80+/* 0x0038: ctx_src_zoff */
81 0x00000000,
82+/* 0x003c: ctx_src_xoff */
83 0x00000000,
84+/* 0x0040: ctx_src_yoff */
85 0x00000000,
86+/* 0x0044: ctx_src_cpp */
87 0x00000000,
88+/* 0x0048: ctx_dst_address_high */
89 0x00000000,
90+/* 0x004c: ctx_dst_address_low */
91 0x00000000,
92+/* 0x0050: ctx_dst_pitch */
93 0x00000000,
94+/* 0x0054: ctx_dst_tile_mode */
95 0x00000000,
96+/* 0x0058: ctx_dst_xsize */
97 0x00000000,
98+/* 0x005c: ctx_dst_ysize */
99 0x00000000,
100+/* 0x0060: ctx_dst_zsize */
101 0x00000000,
102+/* 0x0064: ctx_dst_zoff */
103 0x00000000,
104+/* 0x0068: ctx_dst_xoff */
105 0x00000000,
106+/* 0x006c: ctx_dst_yoff */
107 0x00000000,
108+/* 0x0070: ctx_dst_cpp */
109 0x00000000,
110+/* 0x0074: ctx_format */
111 0x00000000,
112+/* 0x0078: ctx_swz_const0 */
113 0x00000000,
114+/* 0x007c: ctx_swz_const1 */
115 0x00000000,
116+/* 0x0080: ctx_xcnt */
117 0x00000000,
118+/* 0x0084: ctx_ycnt */
119 0x00000000,
120 0x00000000,
121 0x00000000,
122@@ -63,6 +98,7 @@ uint32_t nva3_pcopy_data[] = {
123 0x00000000,
124 0x00000000,
125 0x00000000,
126+/* 0x0100: dispatch_table */
127 0x00010000,
128 0x00000000,
129 0x00000000,
130@@ -73,6 +109,7 @@ uint32_t nva3_pcopy_data[] = {
131 0x00010162,
132 0x00000000,
133 0x00030060,
134+/* 0x0128: dispatch_dma */
135 0x00010170,
136 0x00000000,
137 0x00010170,
138@@ -118,11 +155,11 @@ uint32_t nva3_pcopy_data[] = {
139 0x0000001c,
140 0xffffff00,
141 0x00000020,
142- 0x0000000f,
143+ 0x00000000,
144 0x00000048,
145 0xffffff00,
146 0x0000004c,
147- 0x0000000f,
148+ 0x00000000,
149 0x00000024,
150 0xfff80000,
151 0x00000050,
152@@ -146,7 +183,8 @@ uint32_t nva3_pcopy_data[] = {
153 0x00000800,
154 };
155
156-uint32_t nva3_pcopy_code[] = {
157+u32 nva3_pcopy_code[] = {
158+/* 0x0000: main */
159 0x04fe04bd,
160 0x3517f000,
161 0xf10010fe,
162@@ -158,23 +196,31 @@ uint32_t nva3_pcopy_code[] = {
163 0x17f11031,
164 0x27f01200,
165 0x0012d003,
166+/* 0x002f: spin */
167 0xf40031f4,
168 0x0ef40028,
169+/* 0x0035: ih */
170 0x8001cffd,
171 0xf40812c4,
172 0x21f4060b,
173+/* 0x0041: ih_no_chsw */
174 0x0412c472,
175 0xf4060bf4,
176+/* 0x004a: ih_no_cmd */
177 0x11c4c321,
178 0x4001d00c,
179+/* 0x0052: swctx */
180 0x47f101f8,
181 0x4bfe7700,
182 0x0007fe00,
183 0xf00204b9,
184 0x01f40643,
185 0x0604fa09,
186+/* 0x006b: swctx_load */
187 0xfa060ef4,
188+/* 0x006e: swctx_done */
189 0x03f80504,
190+/* 0x0072: chsw */
191 0x27f100f8,
192 0x23cf1400,
193 0x1e3fc800,
194@@ -183,18 +229,22 @@ uint32_t nva3_pcopy_code[] = {
195 0x1e3af052,
196 0xf00023d0,
197 0x24d00147,
198+/* 0x0093: chsw_no_unload */
199 0xcf00f880,
200 0x3dc84023,
201 0x220bf41e,
202 0xf40131f4,
203 0x57f05221,
204 0x0367f004,
205+/* 0x00a8: chsw_load_ctx_dma */
206 0xa07856bc,
207 0xb6018068,
208 0x87d00884,
209 0x0162b600,
210+/* 0x00bb: chsw_finish_load */
211 0xf0f018f4,
212 0x23d00237,
213+/* 0x00c3: dispatch */
214 0xf100f880,
215 0xcf190037,
216 0x33cf4032,
217@@ -202,6 +252,7 @@ uint32_t nva3_pcopy_code[] = {
218 0x1024b607,
219 0x010057f1,
220 0x74bd64bd,
221+/* 0x00dc: dispatch_loop */
222 0x58005658,
223 0x50b60157,
224 0x0446b804,
225@@ -211,6 +262,7 @@ uint32_t nva3_pcopy_code[] = {
226 0xb60276bb,
227 0x57bb0374,
228 0xdf0ef400,
229+/* 0x0100: dispatch_valid_mthd */
230 0xb60246bb,
231 0x45bb0344,
232 0x01459800,
233@@ -220,31 +272,41 @@ uint32_t nva3_pcopy_code[] = {
234 0xb0014658,
235 0x1bf40064,
236 0x00538009,
237+/* 0x0127: dispatch_cmd */
238 0xf4300ef4,
239 0x55f90132,
240 0xf40c01f4,
241+/* 0x0132: dispatch_invalid_bitfield */
242 0x25f0250e,
243+/* 0x0135: dispatch_illegal_mthd */
244 0x0125f002,
245+/* 0x0138: dispatch_error */
246 0x100047f1,
247 0xd00042d0,
248 0x27f04043,
249 0x0002d040,
250+/* 0x0148: hostirq_wait */
251 0xf08002cf,
252 0x24b04024,
253 0xf71bf400,
254+/* 0x0154: dispatch_done */
255 0x1d0027f1,
256 0xd00137f0,
257 0x00f80023,
258+/* 0x0160: cmd_nop */
259+/* 0x0162: cmd_pm_trigger */
260 0x27f100f8,
261 0x34bd2200,
262 0xd00233f0,
263 0x00f80023,
264+/* 0x0170: cmd_dma */
265 0x012842b7,
266 0xf00145b6,
267 0x43801e39,
268 0x0040b701,
269 0x0644b606,
270 0xf80043d0,
271+/* 0x0189: cmd_exec_set_format */
272 0xf030f400,
273 0xb00001b0,
274 0x01b00101,
275@@ -256,20 +318,26 @@ uint32_t nva3_pcopy_code[] = {
276 0x70b63847,
277 0x0232f401,
278 0x94bd84bd,
279+/* 0x01b4: ncomp_loop */
280 0xb60f4ac4,
281 0xb4bd0445,
282+/* 0x01bc: bpc_loop */
283 0xf404a430,
284 0xa5ff0f18,
285 0x00cbbbc0,
286 0xf40231f4,
287+/* 0x01ce: cmp_c0 */
288 0x1bf4220e,
289 0x10c7f00c,
290 0xf400cbbb,
291+/* 0x01da: cmp_c1 */
292 0xa430160e,
293 0x0c18f406,
294 0xbb14c7f0,
295 0x0ef400cb,
296+/* 0x01e9: cmp_zero */
297 0x80c7f107,
298+/* 0x01ed: bpc_next */
299 0x01c83800,
300 0xb60180b6,
301 0xb5b801b0,
302@@ -280,6 +348,7 @@ uint32_t nva3_pcopy_code[] = {
303 0x98110680,
304 0x68fd2008,
305 0x0502f400,
306+/* 0x0216: dst_xcnt */
307 0x75fd64bd,
308 0x1c078000,
309 0xf10078fd,
310@@ -304,6 +373,7 @@ uint32_t nva3_pcopy_code[] = {
311 0x980056d0,
312 0x56d01f06,
313 0x1030f440,
314+/* 0x0276: cmd_exec_set_surface_tiled */
315 0x579800f8,
316 0x6879c70a,
317 0xb66478c7,
318@@ -311,9 +381,11 @@ uint32_t nva3_pcopy_code[] = {
319 0x0e76b060,
320 0xf0091bf4,
321 0x0ef40477,
322+/* 0x0291: xtile64 */
323 0x027cf00f,
324 0xfd1170b6,
325 0x77f00947,
326+/* 0x029d: xtileok */
327 0x0f5a9806,
328 0xfd115b98,
329 0xb7f000ab,
330@@ -371,6 +443,7 @@ uint32_t nva3_pcopy_code[] = {
331 0x67d00600,
332 0x0060b700,
333 0x0068d004,
334+/* 0x0382: cmd_exec_set_surface_linear */
335 0x6cf000f8,
336 0x0260b702,
337 0x0864b602,
338@@ -381,13 +454,16 @@ uint32_t nva3_pcopy_code[] = {
339 0xb70067d0,
340 0x98040060,
341 0x67d00957,
342+/* 0x03ab: cmd_exec_wait */
343 0xf900f800,
344 0xf110f900,
345 0xb6080007,
346+/* 0x03b6: loop */
347 0x01cf0604,
348 0x0114f000,
349 0xfcfa1bf4,
350 0xf800fc10,
351+/* 0x03c5: cmd_exec_query */
352 0x0d34c800,
353 0xf5701bf4,
354 0xf103ab21,
355@@ -417,6 +493,7 @@ uint32_t nva3_pcopy_code[] = {
356 0x47f10153,
357 0x44b60800,
358 0x0045d006,
359+/* 0x0438: query_counter */
360 0x03ab21f5,
361 0x080c47f1,
362 0x980644b6,
363@@ -439,11 +516,13 @@ uint32_t nva3_pcopy_code[] = {
364 0x47f10153,
365 0x44b60800,
366 0x0045d006,
367+/* 0x0492: cmd_exec */
368 0x21f500f8,
369 0x3fc803ab,
370 0x0e0bf400,
371 0x018921f5,
372 0x020047f1,
373+/* 0x04a7: cmd_exec_no_format */
374 0xf11e0ef4,
375 0xb6081067,
376 0x77f00664,
377@@ -451,19 +530,24 @@ uint32_t nva3_pcopy_code[] = {
378 0x981c0780,
379 0x67d02007,
380 0x4067d000,
381+/* 0x04c2: cmd_exec_init_src_surface */
382 0x32f444bd,
383 0xc854bd02,
384 0x0bf4043f,
385 0x8221f50a,
386 0x0a0ef403,
387+/* 0x04d4: src_tiled */
388 0x027621f5,
389+/* 0x04db: cmd_exec_init_dst_surface */
390 0xf40749f0,
391 0x57f00231,
392 0x083fc82c,
393 0xf50a0bf4,
394 0xf4038221,
395+/* 0x04ee: dst_tiled */
396 0x21f50a0e,
397 0x49f00276,
398+/* 0x04f5: cmd_exec_kick */
399 0x0057f108,
400 0x0654b608,
401 0xd0210698,
402@@ -473,6 +557,8 @@ uint32_t nva3_pcopy_code[] = {
403 0xc80054d0,
404 0x0bf40c3f,
405 0xc521f507,
406+/* 0x0519: cmd_exec_done */
407+/* 0x051b: cmd_wrcache_flush */
408 0xf100f803,
409 0xbd220027,
410 0x0133f034,
411diff --git a/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h b/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
412index 4199038..9e87036 100644
413--- a/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
414+++ b/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
415@@ -1,34 +1,65 @@
416-uint32_t nvc0_pcopy_data[] = {
417+u32 nvc0_pcopy_data[] = {
418+/* 0x0000: ctx_object */
419 0x00000000,
420+/* 0x0004: ctx_query_address_high */
421 0x00000000,
422+/* 0x0008: ctx_query_address_low */
423 0x00000000,
424+/* 0x000c: ctx_query_counter */
425 0x00000000,
426+/* 0x0010: ctx_src_address_high */
427 0x00000000,
428+/* 0x0014: ctx_src_address_low */
429 0x00000000,
430+/* 0x0018: ctx_src_pitch */
431 0x00000000,
432+/* 0x001c: ctx_src_tile_mode */
433 0x00000000,
434+/* 0x0020: ctx_src_xsize */
435 0x00000000,
436+/* 0x0024: ctx_src_ysize */
437 0x00000000,
438+/* 0x0028: ctx_src_zsize */
439 0x00000000,
440+/* 0x002c: ctx_src_zoff */
441 0x00000000,
442+/* 0x0030: ctx_src_xoff */
443 0x00000000,
444+/* 0x0034: ctx_src_yoff */
445 0x00000000,
446+/* 0x0038: ctx_src_cpp */
447 0x00000000,
448+/* 0x003c: ctx_dst_address_high */
449 0x00000000,
450+/* 0x0040: ctx_dst_address_low */
451 0x00000000,
452+/* 0x0044: ctx_dst_pitch */
453 0x00000000,
454+/* 0x0048: ctx_dst_tile_mode */
455 0x00000000,
456+/* 0x004c: ctx_dst_xsize */
457 0x00000000,
458+/* 0x0050: ctx_dst_ysize */
459 0x00000000,
460+/* 0x0054: ctx_dst_zsize */
461 0x00000000,
462+/* 0x0058: ctx_dst_zoff */
463 0x00000000,
464+/* 0x005c: ctx_dst_xoff */
465 0x00000000,
466+/* 0x0060: ctx_dst_yoff */
467 0x00000000,
468+/* 0x0064: ctx_dst_cpp */
469 0x00000000,
470+/* 0x0068: ctx_format */
471 0x00000000,
472+/* 0x006c: ctx_swz_const0 */
473 0x00000000,
474+/* 0x0070: ctx_swz_const1 */
475 0x00000000,
476+/* 0x0074: ctx_xcnt */
477 0x00000000,
478+/* 0x0078: ctx_ycnt */
479 0x00000000,
480 0x00000000,
481 0x00000000,
482@@ -63,6 +94,7 @@ uint32_t nvc0_pcopy_data[] = {
483 0x00000000,
484 0x00000000,
485 0x00000000,
486+/* 0x0100: dispatch_table */
487 0x00010000,
488 0x00000000,
489 0x00000000,
490@@ -111,11 +143,11 @@ uint32_t nvc0_pcopy_data[] = {
491 0x00000010,
492 0xffffff00,
493 0x00000014,
494- 0x0000000f,
495+ 0x00000000,
496 0x0000003c,
497 0xffffff00,
498 0x00000040,
499- 0x0000000f,
500+ 0x00000000,
501 0x00000018,
502 0xfff80000,
503 0x00000044,
504@@ -139,7 +171,8 @@ uint32_t nvc0_pcopy_data[] = {
505 0x00000800,
506 };
507
508-uint32_t nvc0_pcopy_code[] = {
509+u32 nvc0_pcopy_code[] = {
510+/* 0x0000: main */
511 0x04fe04bd,
512 0x3517f000,
513 0xf10010fe,
514@@ -151,15 +184,20 @@ uint32_t nvc0_pcopy_code[] = {
515 0x17f11031,
516 0x27f01200,
517 0x0012d003,
518+/* 0x002f: spin */
519 0xf40031f4,
520 0x0ef40028,
521+/* 0x0035: ih */
522 0x8001cffd,
523 0xf40812c4,
524 0x21f4060b,
525+/* 0x0041: ih_no_chsw */
526 0x0412c4ca,
527 0xf5070bf4,
528+/* 0x004b: ih_no_cmd */
529 0xc4010221,
530 0x01d00c11,
531+/* 0x0053: swctx */
532 0xf101f840,
533 0xfe770047,
534 0x47f1004b,
535@@ -188,8 +226,11 @@ uint32_t nvc0_pcopy_code[] = {
536 0xf00204b9,
537 0x01f40643,
538 0x0604fa09,
539+/* 0x00c3: swctx_load */
540 0xfa060ef4,
541+/* 0x00c6: swctx_done */
542 0x03f80504,
543+/* 0x00ca: chsw */
544 0x27f100f8,
545 0x23cf1400,
546 0x1e3fc800,
547@@ -198,18 +239,22 @@ uint32_t nvc0_pcopy_code[] = {
548 0x1e3af053,
549 0xf00023d0,
550 0x24d00147,
551+/* 0x00eb: chsw_no_unload */
552 0xcf00f880,
553 0x3dc84023,
554 0x090bf41e,
555 0xf40131f4,
556+/* 0x00fa: chsw_finish_load */
557 0x37f05321,
558 0x8023d002,
559+/* 0x0102: dispatch */
560 0x37f100f8,
561 0x32cf1900,
562 0x0033cf40,
563 0x07ff24e4,
564 0xf11024b6,
565 0xbd010057,
566+/* 0x011b: dispatch_loop */
567 0x5874bd64,
568 0x57580056,
569 0x0450b601,
570@@ -219,6 +264,7 @@ uint32_t nvc0_pcopy_code[] = {
571 0xbb0f08f4,
572 0x74b60276,
573 0x0057bb03,
574+/* 0x013f: dispatch_valid_mthd */
575 0xbbdf0ef4,
576 0x44b60246,
577 0x0045bb03,
578@@ -229,24 +275,33 @@ uint32_t nvc0_pcopy_code[] = {
579 0x64b00146,
580 0x091bf400,
581 0xf4005380,
582+/* 0x0166: dispatch_cmd */
583 0x32f4300e,
584 0xf455f901,
585 0x0ef40c01,
586+/* 0x0171: dispatch_invalid_bitfield */
587 0x0225f025,
588+/* 0x0174: dispatch_illegal_mthd */
589+/* 0x0177: dispatch_error */
590 0xf10125f0,
591 0xd0100047,
592 0x43d00042,
593 0x4027f040,
594+/* 0x0187: hostirq_wait */
595 0xcf0002d0,
596 0x24f08002,
597 0x0024b040,
598+/* 0x0193: dispatch_done */
599 0xf1f71bf4,
600 0xf01d0027,
601 0x23d00137,
602+/* 0x019f: cmd_nop */
603 0xf800f800,
604+/* 0x01a1: cmd_pm_trigger */
605 0x0027f100,
606 0xf034bd22,
607 0x23d00233,
608+/* 0x01af: cmd_exec_set_format */
609 0xf400f800,
610 0x01b0f030,
611 0x0101b000,
612@@ -258,20 +313,26 @@ uint32_t nvc0_pcopy_code[] = {
613 0x3847c701,
614 0xf40170b6,
615 0x84bd0232,
616+/* 0x01da: ncomp_loop */
617 0x4ac494bd,
618 0x0445b60f,
619+/* 0x01e2: bpc_loop */
620 0xa430b4bd,
621 0x0f18f404,
622 0xbbc0a5ff,
623 0x31f400cb,
624 0x220ef402,
625+/* 0x01f4: cmp_c0 */
626 0xf00c1bf4,
627 0xcbbb10c7,
628 0x160ef400,
629+/* 0x0200: cmp_c1 */
630 0xf406a430,
631 0xc7f00c18,
632 0x00cbbb14,
633+/* 0x020f: cmp_zero */
634 0xf1070ef4,
635+/* 0x0213: bpc_next */
636 0x380080c7,
637 0x80b601c8,
638 0x01b0b601,
639@@ -283,6 +344,7 @@ uint32_t nvc0_pcopy_code[] = {
640 0x1d08980e,
641 0xf40068fd,
642 0x64bd0502,
643+/* 0x023c: dst_xcnt */
644 0x800075fd,
645 0x78fd1907,
646 0x1057f100,
647@@ -307,15 +369,18 @@ uint32_t nvc0_pcopy_code[] = {
648 0x1c069800,
649 0xf44056d0,
650 0x00f81030,
651+/* 0x029c: cmd_exec_set_surface_tiled */
652 0xc7075798,
653 0x78c76879,
654 0x0380b664,
655 0xb06077c7,
656 0x1bf40e76,
657 0x0477f009,
658+/* 0x02b7: xtile64 */
659 0xf00f0ef4,
660 0x70b6027c,
661 0x0947fd11,
662+/* 0x02c3: xtileok */
663 0x980677f0,
664 0x5b980c5a,
665 0x00abfd0e,
666@@ -374,6 +439,7 @@ uint32_t nvc0_pcopy_code[] = {
667 0xb70067d0,
668 0xd0040060,
669 0x00f80068,
670+/* 0x03a8: cmd_exec_set_surface_linear */
671 0xb7026cf0,
672 0xb6020260,
673 0x57980864,
674@@ -384,12 +450,15 @@ uint32_t nvc0_pcopy_code[] = {
675 0x0060b700,
676 0x06579804,
677 0xf80067d0,
678+/* 0x03d1: cmd_exec_wait */
679 0xf900f900,
680 0x0007f110,
681 0x0604b608,
682+/* 0x03dc: loop */
683 0xf00001cf,
684 0x1bf40114,
685 0xfc10fcfa,
686+/* 0x03eb: cmd_exec_query */
687 0xc800f800,
688 0x1bf40d34,
689 0xd121f570,
690@@ -419,6 +488,7 @@ uint32_t nvc0_pcopy_code[] = {
691 0x0153f026,
692 0x080047f1,
693 0xd00644b6,
694+/* 0x045e: query_counter */
695 0x21f50045,
696 0x47f103d1,
697 0x44b6080c,
698@@ -442,11 +512,13 @@ uint32_t nvc0_pcopy_code[] = {
699 0x080047f1,
700 0xd00644b6,
701 0x00f80045,
702+/* 0x04b8: cmd_exec */
703 0x03d121f5,
704 0xf4003fc8,
705 0x21f50e0b,
706 0x47f101af,
707 0x0ef40200,
708+/* 0x04cd: cmd_exec_no_format */
709 0x1067f11e,
710 0x0664b608,
711 0x800177f0,
712@@ -454,18 +526,23 @@ uint32_t nvc0_pcopy_code[] = {
713 0x1d079819,
714 0xd00067d0,
715 0x44bd4067,
716+/* 0x04e8: cmd_exec_init_src_surface */
717 0xbd0232f4,
718 0x043fc854,
719 0xf50a0bf4,
720 0xf403a821,
721+/* 0x04fa: src_tiled */
722 0x21f50a0e,
723 0x49f0029c,
724+/* 0x0501: cmd_exec_init_dst_surface */
725 0x0231f407,
726 0xc82c57f0,
727 0x0bf4083f,
728 0xa821f50a,
729 0x0a0ef403,
730+/* 0x0514: dst_tiled */
731 0x029c21f5,
732+/* 0x051b: cmd_exec_kick */
733 0xf10849f0,
734 0xb6080057,
735 0x06980654,
736@@ -475,7 +552,9 @@ uint32_t nvc0_pcopy_code[] = {
737 0x54d00546,
738 0x0c3fc800,
739 0xf5070bf4,
740+/* 0x053f: cmd_exec_done */
741 0xf803eb21,
742+/* 0x0541: cmd_wrcache_flush */
743 0x0027f100,
744 0xf034bd22,
745 0x23d00133,
746--
7471.7.7.6
748
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0072-mm-fix-wrong-argument-of-migrate_huge_pages-in-soft_.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0072-mm-fix-wrong-argument-of-migrate_huge_pages-in-soft_.patch
new file mode 100644
index 00000000..6d93ddaa
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0072-mm-fix-wrong-argument-of-migrate_huge_pages-in-soft_.patch
@@ -0,0 +1,58 @@
1From 10d09034790926ded3c2ee655d72c48219d61122 Mon Sep 17 00:00:00 2001
2From: Joonsoo Kim <js1304@gmail.com>
3Date: Mon, 30 Jul 2012 14:39:04 -0700
4Subject: [PATCH 72/73] mm: fix wrong argument of migrate_huge_pages() in
5 soft_offline_huge_page()
6
7commit dc32f63453f56d07a1073a697dcd843dd3098c09 upstream.
8
9Commit a6bc32b89922 ("mm: compaction: introduce sync-light migration for
10use by compaction") changed the declaration of migrate_pages() and
11migrate_huge_pages().
12
13But it missed changing the argument of migrate_huge_pages() in
14soft_offline_huge_page(). In this case, we should call
15migrate_huge_pages() with MIGRATE_SYNC.
16
17Additionally, there is a mismatch between type the of argument and the
18function declaration for migrate_pages().
19
20Signed-off-by: Joonsoo Kim <js1304@gmail.com>
21Cc: Christoph Lameter <cl@linux.com>
22Cc: Mel Gorman <mgorman@suse.de>
23Acked-by: David Rientjes <rientjes@google.com>
24Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
25Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
26Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
28---
29 mm/memory-failure.c | 6 +++---
30 1 files changed, 3 insertions(+), 3 deletions(-)
31
32diff --git a/mm/memory-failure.c b/mm/memory-failure.c
33index 56080ea..5bd5bb1 100644
34--- a/mm/memory-failure.c
35+++ b/mm/memory-failure.c
36@@ -1427,8 +1427,8 @@ static int soft_offline_huge_page(struct page *page, int flags)
37 /* Keep page count to indicate a given hugepage is isolated. */
38
39 list_add(&hpage->lru, &pagelist);
40- ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 0,
41- true);
42+ ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, false,
43+ MIGRATE_SYNC);
44 if (ret) {
45 struct page *page1, *page2;
46 list_for_each_entry_safe(page1, page2, &pagelist, lru)
47@@ -1557,7 +1557,7 @@ int soft_offline_page(struct page *page, int flags)
48 page_is_file_cache(page));
49 list_add(&page->lru, &pagelist);
50 ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
51- 0, MIGRATE_SYNC);
52+ false, MIGRATE_SYNC);
53 if (ret) {
54 putback_lru_pages(&pagelist);
55 pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
56--
571.7.7.6
58
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0073-Linux-3.2.25.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0073-Linux-3.2.25.patch
new file mode 100644
index 00000000..cb9db480
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0073-Linux-3.2.25.patch
@@ -0,0 +1,24 @@
1From d5f196e5b0f7d3770840af22c9fbd4b8355fd792 Mon Sep 17 00:00:00 2001
2From: Ben Hutchings <ben@decadent.org.uk>
3Date: Thu, 2 Aug 2012 14:38:04 +0100
4Subject: [PATCH 73/73] Linux 3.2.25
5
6---
7 Makefile | 2 +-
8 1 files changed, 1 insertions(+), 1 deletions(-)
9
10diff --git a/Makefile b/Makefile
11index 80bb4fd..e13e4e7 100644
12--- a/Makefile
13+++ b/Makefile
14@@ -1,6 +1,6 @@
15 VERSION = 3
16 PATCHLEVEL = 2
17-SUBLEVEL = 24
18+SUBLEVEL = 25
19 EXTRAVERSION =
20 NAME = Saber-toothed Squirrel
21
22--
231.7.7.6
24