1 |
commit: 880d575a3330d9626698dd16935b7b664d62739d |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Oct 28 10:19:17 2016 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 28 10:19:17 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=880d575a |
7 |
|
8 |
Linux patch 4.1.35 |
9 |
|
10 |
0000_README | 4 + |
11 |
1034_linux-4.1.35.patch | 215 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 219 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 72df015..5bb6b6b 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -179,6 +179,10 @@ Patch: 1033_linux-4.1.34.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.1.34 |
21 |
|
22 |
+Patch: 1034_linux-4.1.35.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.1.35 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1034_linux-4.1.35.patch b/1034_linux-4.1.35.patch |
31 |
new file mode 100644 |
32 |
index 0000000..cfb75c7 |
33 |
--- /dev/null |
34 |
+++ b/1034_linux-4.1.35.patch |
35 |
@@ -0,0 +1,215 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index 2d4dea4b3107..21f657f2c4e6 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 1 |
43 |
+-SUBLEVEL = 34 |
44 |
++SUBLEVEL = 35 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Series 4800 |
47 |
+ |
48 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
49 |
+index cc1993c5556e..9d781d3ccc09 100644 |
50 |
+--- a/drivers/usb/host/xhci-hub.c |
51 |
++++ b/drivers/usb/host/xhci-hub.c |
52 |
+@@ -619,8 +619,30 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, |
53 |
+ if ((raw_port_status & PORT_RESET) || |
54 |
+ !(raw_port_status & PORT_PE)) |
55 |
+ return 0xffffffff; |
56 |
+- if (time_after_eq(jiffies, |
57 |
+- bus_state->resume_done[wIndex])) { |
58 |
++ /* did port event handler already start resume timing? */ |
59 |
++ if (!bus_state->resume_done[wIndex]) { |
60 |
++ /* If not, maybe we are in a host initated resume? */ |
61 |
++ if (test_bit(wIndex, &bus_state->resuming_ports)) { |
62 |
++ /* Host initated resume doesn't time the resume |
63 |
++ * signalling using resume_done[]. |
64 |
++ * It manually sets RESUME state, sleeps 20ms |
65 |
++ * and sets U0 state. This should probably be |
66 |
++ * changed, but not right now. |
67 |
++ */ |
68 |
++ } else { |
69 |
++ /* port resume was discovered now and here, |
70 |
++ * start resume timing |
71 |
++ */ |
72 |
++ unsigned long timeout = jiffies + |
73 |
++ msecs_to_jiffies(USB_RESUME_TIMEOUT); |
74 |
++ |
75 |
++ set_bit(wIndex, &bus_state->resuming_ports); |
76 |
++ bus_state->resume_done[wIndex] = timeout; |
77 |
++ mod_timer(&hcd->rh_timer, timeout); |
78 |
++ } |
79 |
++ /* Has resume been signalled for USB_RESUME_TIME yet? */ |
80 |
++ } else if (time_after_eq(jiffies, |
81 |
++ bus_state->resume_done[wIndex])) { |
82 |
+ int time_left; |
83 |
+ |
84 |
+ xhci_dbg(xhci, "Resume USB2 port %d\n", |
85 |
+@@ -661,13 +683,24 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, |
86 |
+ } else { |
87 |
+ /* |
88 |
+ * The resume has been signaling for less than |
89 |
+- * 20ms. Report the port status as SUSPEND, |
90 |
+- * let the usbcore check port status again |
91 |
+- * and clear resume signaling later. |
92 |
++ * USB_RESUME_TIME. Report the port status as SUSPEND, |
93 |
++ * let the usbcore check port status again and clear |
94 |
++ * resume signaling later. |
95 |
+ */ |
96 |
+ status |= USB_PORT_STAT_SUSPEND; |
97 |
+ } |
98 |
+ } |
99 |
++ /* |
100 |
++ * Clear stale usb2 resume signalling variables in case port changed |
101 |
++ * state during resume signalling. For example on error |
102 |
++ */ |
103 |
++ if ((bus_state->resume_done[wIndex] || |
104 |
++ test_bit(wIndex, &bus_state->resuming_ports)) && |
105 |
++ (raw_port_status & PORT_PLS_MASK) != XDEV_U3 && |
106 |
++ (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME) { |
107 |
++ bus_state->resume_done[wIndex] = 0; |
108 |
++ clear_bit(wIndex, &bus_state->resuming_ports); |
109 |
++ } |
110 |
+ if ((raw_port_status & PORT_PLS_MASK) == XDEV_U0 |
111 |
+ && (raw_port_status & PORT_POWER) |
112 |
+ && (bus_state->suspended_ports & (1 << wIndex))) { |
113 |
+@@ -998,6 +1031,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
114 |
+ if ((temp & PORT_PE) == 0) |
115 |
+ goto error; |
116 |
+ |
117 |
++ set_bit(wIndex, &bus_state->resuming_ports); |
118 |
+ xhci_set_link_state(xhci, port_array, wIndex, |
119 |
+ XDEV_RESUME); |
120 |
+ spin_unlock_irqrestore(&xhci->lock, flags); |
121 |
+@@ -1005,6 +1039,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
122 |
+ spin_lock_irqsave(&xhci->lock, flags); |
123 |
+ xhci_set_link_state(xhci, port_array, wIndex, |
124 |
+ XDEV_U0); |
125 |
++ clear_bit(wIndex, &bus_state->resuming_ports); |
126 |
+ } |
127 |
+ bus_state->port_c_suspend |= 1 << wIndex; |
128 |
+ |
129 |
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
130 |
+index 6a2911743829..2d8e77ff7821 100644 |
131 |
+--- a/drivers/usb/host/xhci-ring.c |
132 |
++++ b/drivers/usb/host/xhci-ring.c |
133 |
+@@ -1605,7 +1605,8 @@ static void handle_port_status(struct xhci_hcd *xhci, |
134 |
+ */ |
135 |
+ bogus_port_status = true; |
136 |
+ goto cleanup; |
137 |
+- } else { |
138 |
++ } else if (!test_bit(faked_port_index, |
139 |
++ &bus_state->resuming_ports)) { |
140 |
+ xhci_dbg(xhci, "resume HS port %d\n", port_id); |
141 |
+ bus_state->resume_done[faked_port_index] = jiffies + |
142 |
+ msecs_to_jiffies(USB_RESUME_TIMEOUT); |
143 |
+diff --git a/include/linux/mm.h b/include/linux/mm.h |
144 |
+index 6b85ec64d302..7cadf0a660e7 100644 |
145 |
+--- a/include/linux/mm.h |
146 |
++++ b/include/linux/mm.h |
147 |
+@@ -2064,6 +2064,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma, |
148 |
+ #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ |
149 |
+ #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ |
150 |
+ #define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */ |
151 |
++#define FOLL_COW 0x4000 /* internal GUP flag */ |
152 |
+ |
153 |
+ typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, |
154 |
+ void *data); |
155 |
+diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
156 |
+index 8fcc801fde15..d9f112bd42a7 100644 |
157 |
+--- a/kernel/time/timekeeping.c |
158 |
++++ b/kernel/time/timekeeping.c |
159 |
+@@ -309,17 +309,34 @@ u32 (*arch_gettimeoffset)(void) = default_arch_gettimeoffset; |
160 |
+ static inline u32 arch_gettimeoffset(void) { return 0; } |
161 |
+ #endif |
162 |
+ |
163 |
++static inline s64 timekeeping_delta_to_ns(struct tk_read_base *tkr, |
164 |
++ cycle_t delta) |
165 |
++{ |
166 |
++ s64 nsec; |
167 |
++ |
168 |
++ nsec = delta * tkr->mult + tkr->xtime_nsec; |
169 |
++ nsec >>= tkr->shift; |
170 |
++ |
171 |
++ /* If arch requires, add in get_arch_timeoffset() */ |
172 |
++ return nsec + arch_gettimeoffset(); |
173 |
++} |
174 |
++ |
175 |
+ static inline s64 timekeeping_get_ns(struct tk_read_base *tkr) |
176 |
+ { |
177 |
+ cycle_t delta; |
178 |
+- s64 nsec; |
179 |
+ |
180 |
+ delta = timekeeping_get_delta(tkr); |
181 |
++ return timekeeping_delta_to_ns(tkr, delta); |
182 |
++} |
183 |
+ |
184 |
+- nsec = (delta * tkr->mult + tkr->xtime_nsec) >> tkr->shift; |
185 |
++static inline s64 timekeeping_cycles_to_ns(struct tk_read_base *tkr, |
186 |
++ cycle_t cycles) |
187 |
++{ |
188 |
++ cycle_t delta; |
189 |
+ |
190 |
+- /* If arch requires, add in get_arch_timeoffset() */ |
191 |
+- return nsec + arch_gettimeoffset(); |
192 |
++ /* calculate the delta since the last update_wall_time */ |
193 |
++ delta = clocksource_delta(cycles, tkr->cycle_last, tkr->mask); |
194 |
++ return timekeeping_delta_to_ns(tkr, delta); |
195 |
+ } |
196 |
+ |
197 |
+ /** |
198 |
+@@ -421,8 +438,11 @@ static __always_inline u64 __ktime_get_fast_ns(struct tk_fast *tkf) |
199 |
+ tkr = tkf->base + (seq & 0x01); |
200 |
+ now = ktime_to_ns(tkr->base); |
201 |
+ |
202 |
+- now += clocksource_delta(tkr->read(tkr->clock), |
203 |
+- tkr->cycle_last, tkr->mask); |
204 |
++ now += timekeeping_delta_to_ns(tkr, |
205 |
++ clocksource_delta( |
206 |
++ tkr->read(tkr->clock), |
207 |
++ tkr->cycle_last, |
208 |
++ tkr->mask)); |
209 |
+ } while (read_seqcount_retry(&tkf->seq, seq)); |
210 |
+ |
211 |
+ return now; |
212 |
+diff --git a/mm/gup.c b/mm/gup.c |
213 |
+index 6297f6bccfb1..e6de9e74e4ae 100644 |
214 |
+--- a/mm/gup.c |
215 |
++++ b/mm/gup.c |
216 |
+@@ -32,6 +32,16 @@ static struct page *no_page_table(struct vm_area_struct *vma, |
217 |
+ return NULL; |
218 |
+ } |
219 |
+ |
220 |
++/* |
221 |
++ * FOLL_FORCE can write to even unwritable pte's, but only |
222 |
++ * after we've gone through a COW cycle and they are dirty. |
223 |
++ */ |
224 |
++static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) |
225 |
++{ |
226 |
++ return pte_write(pte) || |
227 |
++ ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); |
228 |
++} |
229 |
++ |
230 |
+ static struct page *follow_page_pte(struct vm_area_struct *vma, |
231 |
+ unsigned long address, pmd_t *pmd, unsigned int flags) |
232 |
+ { |
233 |
+@@ -66,7 +76,7 @@ retry: |
234 |
+ } |
235 |
+ if ((flags & FOLL_NUMA) && pte_protnone(pte)) |
236 |
+ goto no_page; |
237 |
+- if ((flags & FOLL_WRITE) && !pte_write(pte)) { |
238 |
++ if ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) { |
239 |
+ pte_unmap_unlock(ptep, ptl); |
240 |
+ return NULL; |
241 |
+ } |
242 |
+@@ -315,7 +325,7 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, |
243 |
+ * reCOWed by userspace write). |
244 |
+ */ |
245 |
+ if ((ret & VM_FAULT_WRITE) && !(vma->vm_flags & VM_WRITE)) |
246 |
+- *flags &= ~FOLL_WRITE; |
247 |
++ *flags |= FOLL_COW; |
248 |
+ return 0; |
249 |
+ } |
250 |
+ |