Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.18 commit in: /
Date: Tue, 01 Nov 2016 09:36:21
Message-Id: 1477992909.97a0e1c0517542f965b73dac372a47f9e72d2562.alicef@gentoo
1 commit: 97a0e1c0517542f965b73dac372a47f9e72d2562
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 1 09:35:09 2016 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 1 09:35:09 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=97a0e1c0
7
8 Linux patch 3.18.44
9
10 0000_README | 4 ++
11 1043_linux-3.18.44.patch | 174 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 178 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index cc667fc..bfb562d 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -215,6 +215,10 @@ Patch: 1042_linux-3.18.43.patch
19 From: http://www.kernel.org
20 Desc: Linux 3.18.43
21
22 +Patch: 1043_linux-3.18.44.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 3.18.44
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/1043_linux-3.18.44.patch b/1043_linux-3.18.44.patch
31 new file mode 100644
32 index 0000000..2661d2c
33 --- /dev/null
34 +++ b/1043_linux-3.18.44.patch
35 @@ -0,0 +1,174 @@
36 +diff --git a/Makefile b/Makefile
37 +index 28912c341bd8..05b64e6d1456 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 3
42 + PATCHLEVEL = 18
43 +-SUBLEVEL = 43
44 ++SUBLEVEL = 44
45 + EXTRAVERSION =
46 + NAME = Diseased Newt
47 +
48 +diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
49 +index 88635b301694..69608a4f554b 100644
50 +--- a/arch/x86/kernel/cpu/common.c
51 ++++ b/arch/x86/kernel/cpu/common.c
52 +@@ -291,10 +291,9 @@ __setup("nosmap", setup_disable_smap);
53 +
54 + static __always_inline void setup_smap(struct cpuinfo_x86 *c)
55 + {
56 +- unsigned long eflags;
57 ++ unsigned long eflags = native_save_fl();
58 +
59 + /* This should have been cleared long ago */
60 +- raw_local_save_flags(eflags);
61 + BUG_ON(eflags & X86_EFLAGS_AC);
62 +
63 + if (cpu_has(c, X86_FEATURE_SMAP)) {
64 +diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
65 +index dfe835d21b15..0fa8fd9adeba 100644
66 +--- a/drivers/usb/host/xhci-hub.c
67 ++++ b/drivers/usb/host/xhci-hub.c
68 +@@ -619,8 +619,30 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
69 + if ((raw_port_status & PORT_RESET) ||
70 + !(raw_port_status & PORT_PE))
71 + return 0xffffffff;
72 +- if (time_after_eq(jiffies,
73 +- bus_state->resume_done[wIndex])) {
74 ++ /* did port event handler already start resume timing? */
75 ++ if (!bus_state->resume_done[wIndex]) {
76 ++ /* If not, maybe we are in a host initated resume? */
77 ++ if (test_bit(wIndex, &bus_state->resuming_ports)) {
78 ++ /* Host initated resume doesn't time the resume
79 ++ * signalling using resume_done[].
80 ++ * It manually sets RESUME state, sleeps 20ms
81 ++ * and sets U0 state. This should probably be
82 ++ * changed, but not right now.
83 ++ */
84 ++ } else {
85 ++ /* port resume was discovered now and here,
86 ++ * start resume timing
87 ++ */
88 ++ unsigned long timeout = jiffies +
89 ++ msecs_to_jiffies(USB_RESUME_TIMEOUT);
90 ++
91 ++ set_bit(wIndex, &bus_state->resuming_ports);
92 ++ bus_state->resume_done[wIndex] = timeout;
93 ++ mod_timer(&hcd->rh_timer, timeout);
94 ++ }
95 ++ /* Has resume been signalled for USB_RESUME_TIME yet? */
96 ++ } else if (time_after_eq(jiffies,
97 ++ bus_state->resume_done[wIndex])) {
98 + int time_left;
99 +
100 + xhci_dbg(xhci, "Resume USB2 port %d\n",
101 +@@ -661,13 +683,24 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
102 + } else {
103 + /*
104 + * The resume has been signaling for less than
105 +- * 20ms. Report the port status as SUSPEND,
106 +- * let the usbcore check port status again
107 +- * and clear resume signaling later.
108 ++ * USB_RESUME_TIME. Report the port status as SUSPEND,
109 ++ * let the usbcore check port status again and clear
110 ++ * resume signaling later.
111 + */
112 + status |= USB_PORT_STAT_SUSPEND;
113 + }
114 + }
115 ++ /*
116 ++ * Clear stale usb2 resume signalling variables in case port changed
117 ++ * state during resume signalling. For example on error
118 ++ */
119 ++ if ((bus_state->resume_done[wIndex] ||
120 ++ test_bit(wIndex, &bus_state->resuming_ports)) &&
121 ++ (raw_port_status & PORT_PLS_MASK) != XDEV_U3 &&
122 ++ (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME) {
123 ++ bus_state->resume_done[wIndex] = 0;
124 ++ clear_bit(wIndex, &bus_state->resuming_ports);
125 ++ }
126 + if ((raw_port_status & PORT_PLS_MASK) == XDEV_U0
127 + && (raw_port_status & PORT_POWER)
128 + && (bus_state->suspended_ports & (1 << wIndex))) {
129 +@@ -998,6 +1031,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
130 + if ((temp & PORT_PE) == 0)
131 + goto error;
132 +
133 ++ set_bit(wIndex, &bus_state->resuming_ports);
134 + xhci_set_link_state(xhci, port_array, wIndex,
135 + XDEV_RESUME);
136 + spin_unlock_irqrestore(&xhci->lock, flags);
137 +@@ -1005,6 +1039,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
138 + spin_lock_irqsave(&xhci->lock, flags);
139 + xhci_set_link_state(xhci, port_array, wIndex,
140 + XDEV_U0);
141 ++ clear_bit(wIndex, &bus_state->resuming_ports);
142 + }
143 + bus_state->port_c_suspend |= 1 << wIndex;
144 +
145 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
146 +index c15dbffe660b..cd88034c7a83 100644
147 +--- a/drivers/usb/host/xhci-ring.c
148 ++++ b/drivers/usb/host/xhci-ring.c
149 +@@ -1595,7 +1595,8 @@ static void handle_port_status(struct xhci_hcd *xhci,
150 + */
151 + bogus_port_status = true;
152 + goto cleanup;
153 +- } else {
154 ++ } else if (!test_bit(faked_port_index,
155 ++ &bus_state->resuming_ports)) {
156 + xhci_dbg(xhci, "resume HS port %d\n", port_id);
157 + bus_state->resume_done[faked_port_index] = jiffies +
158 + msecs_to_jiffies(USB_RESUME_TIMEOUT);
159 +diff --git a/include/linux/mm.h b/include/linux/mm.h
160 +index 9eef3a1f2291..db853dee1ec5 100644
161 +--- a/include/linux/mm.h
162 ++++ b/include/linux/mm.h
163 +@@ -2029,6 +2029,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
164 + #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
165 + #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
166 + #define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */
167 ++#define FOLL_COW 0x4000 /* internal GUP flag */
168 +
169 + typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
170 + void *data);
171 +diff --git a/mm/gup.c b/mm/gup.c
172 +index 377a5a796242..3cec4df06e6b 100644
173 +--- a/mm/gup.c
174 ++++ b/mm/gup.c
175 +@@ -32,6 +32,16 @@ static struct page *no_page_table(struct vm_area_struct *vma,
176 + return NULL;
177 + }
178 +
179 ++/*
180 ++ * FOLL_FORCE can write to even unwritable pte's, but only
181 ++ * after we've gone through a COW cycle and they are dirty.
182 ++ */
183 ++static inline bool can_follow_write_pte(pte_t pte, unsigned int flags)
184 ++{
185 ++ return pte_write(pte) ||
186 ++ ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte));
187 ++}
188 ++
189 + static struct page *follow_page_pte(struct vm_area_struct *vma,
190 + unsigned long address, pmd_t *pmd, unsigned int flags)
191 + {
192 +@@ -66,7 +76,7 @@ retry:
193 + }
194 + if ((flags & FOLL_NUMA) && pte_numa(pte))
195 + goto no_page;
196 +- if ((flags & FOLL_WRITE) && !pte_write(pte)) {
197 ++ if ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) {
198 + pte_unmap_unlock(ptep, ptl);
199 + return NULL;
200 + }
201 +@@ -315,7 +325,7 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma,
202 + * reCOWed by userspace write).
203 + */
204 + if ((ret & VM_FAULT_WRITE) && !(vma->vm_flags & VM_WRITE))
205 +- *flags &= ~FOLL_WRITE;
206 ++ *flags |= FOLL_COW;
207 + return 0;
208 + }
209 +