1 |
Author: mpagano |
2 |
Date: 2013-01-28 23:19:34 +0000 (Mon, 28 Jan 2013) |
3 |
New Revision: 2265 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.7/1004_linux-3.7.5.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.7/0000_README |
9 |
Log: |
10 |
Linux patch 3.7.5 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.7/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.7/0000_README 2013-01-26 00:22:40 UTC (rev 2264) |
15 |
+++ genpatches-2.6/trunk/3.7/0000_README 2013-01-28 23:19:34 UTC (rev 2265) |
16 |
@@ -55,6 +55,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.7.4 |
19 |
|
20 |
+Patch: 1004_linux-3.7.5.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 3.7.5 |
23 |
+ |
24 |
Patch: 2400_kcopy-patch-for-infiniband-driver.patch |
25 |
From: Alexey Shvetsov <alexxy@g.o> |
26 |
Desc: Zero copy for infiniband psm userspace driver |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.7/1004_linux-3.7.5.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.7/1004_linux-3.7.5.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.7/1004_linux-3.7.5.patch 2013-01-28 23:19:34 UTC (rev 2265) |
32 |
@@ -0,0 +1,2006 @@ |
33 |
+diff --git a/Makefile b/Makefile |
34 |
+index f9196bc..ecf87b1 100644 |
35 |
+--- a/Makefile |
36 |
++++ b/Makefile |
37 |
+@@ -1,6 +1,6 @@ |
38 |
+ VERSION = 3 |
39 |
+ PATCHLEVEL = 7 |
40 |
+-SUBLEVEL = 4 |
41 |
++SUBLEVEL = 5 |
42 |
+ EXTRAVERSION = |
43 |
+ NAME = Terrified Chipmunk |
44 |
+ |
45 |
+@@ -169,7 +169,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ |
46 |
+ -e s/arm.*/arm/ -e s/sa110/arm/ \ |
47 |
+ -e s/s390x/s390/ -e s/parisc64/parisc/ \ |
48 |
+ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ |
49 |
+- -e s/sh[234].*/sh/ ) |
50 |
++ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) |
51 |
+ |
52 |
+ # Cross compiling and selecting different set of gcc/bin-utils |
53 |
+ # --------------------------------------------------------------------------- |
54 |
+diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h |
55 |
+index 07fea29..fe32c0e 100644 |
56 |
+--- a/arch/arm64/include/asm/elf.h |
57 |
++++ b/arch/arm64/include/asm/elf.h |
58 |
+@@ -26,7 +26,10 @@ |
59 |
+ |
60 |
+ typedef unsigned long elf_greg_t; |
61 |
+ |
62 |
+-#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) |
63 |
++#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t)) |
64 |
++#define ELF_CORE_COPY_REGS(dest, regs) \ |
65 |
++ *(struct user_pt_regs *)&(dest) = (regs)->user_regs; |
66 |
++ |
67 |
+ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
68 |
+ typedef struct user_fpsimd_state elf_fpregset_t; |
69 |
+ |
70 |
+diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c |
71 |
+index 4a3374e..d18b2b8 100644 |
72 |
+--- a/arch/x86/kernel/cpu/perf_event.c |
73 |
++++ b/arch/x86/kernel/cpu/perf_event.c |
74 |
+@@ -340,9 +340,6 @@ int x86_setup_perfctr(struct perf_event *event) |
75 |
+ /* BTS is currently only allowed for user-mode. */ |
76 |
+ if (!attr->exclude_kernel) |
77 |
+ return -EOPNOTSUPP; |
78 |
+- |
79 |
+- if (!attr->exclude_guest) |
80 |
+- return -EOPNOTSUPP; |
81 |
+ } |
82 |
+ |
83 |
+ hwc->config |= config; |
84 |
+@@ -385,9 +382,6 @@ int x86_pmu_hw_config(struct perf_event *event) |
85 |
+ if (event->attr.precise_ip) { |
86 |
+ int precise = 0; |
87 |
+ |
88 |
+- if (!event->attr.exclude_guest) |
89 |
+- return -EOPNOTSUPP; |
90 |
+- |
91 |
+ /* Support for constant skid */ |
92 |
+ if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) { |
93 |
+ precise++; |
94 |
+diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c |
95 |
+index cd3b243..9b4d51d 100644 |
96 |
+--- a/arch/x86/kernel/step.c |
97 |
++++ b/arch/x86/kernel/step.c |
98 |
+@@ -165,10 +165,11 @@ void set_task_blockstep(struct task_struct *task, bool on) |
99 |
+ * Ensure irq/preemption can't change debugctl in between. |
100 |
+ * Note also that both TIF_BLOCKSTEP and debugctl should |
101 |
+ * be changed atomically wrt preemption. |
102 |
+- * FIXME: this means that set/clear TIF_BLOCKSTEP is simply |
103 |
+- * wrong if task != current, SIGKILL can wakeup the stopped |
104 |
+- * tracee and set/clear can play with the running task, this |
105 |
+- * can confuse the next __switch_to_xtra(). |
106 |
++ * |
107 |
++ * NOTE: this means that set/clear TIF_BLOCKSTEP is only safe if |
108 |
++ * task is current or it can't be running, otherwise we can race |
109 |
++ * with __switch_to_xtra(). We rely on ptrace_freeze_traced() but |
110 |
++ * PTRACE_KILL is not safe. |
111 |
+ */ |
112 |
+ local_irq_disable(); |
113 |
+ debugctl = get_debugctlmsr(); |
114 |
+diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c |
115 |
+index e8086c7..53dc256 100644 |
116 |
+--- a/drivers/acpi/processor_idle.c |
117 |
++++ b/drivers/acpi/processor_idle.c |
118 |
+@@ -1009,6 +1009,9 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr) |
119 |
+ return -EINVAL; |
120 |
+ } |
121 |
+ |
122 |
++ if (!dev) |
123 |
++ return -EINVAL; |
124 |
++ |
125 |
+ dev->cpu = pr->id; |
126 |
+ |
127 |
+ if (max_cstate == 0) |
128 |
+@@ -1200,6 +1203,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) |
129 |
+ } |
130 |
+ |
131 |
+ /* Populate Updated C-state information */ |
132 |
++ acpi_processor_get_power_info(pr); |
133 |
+ acpi_processor_setup_cpuidle_states(pr); |
134 |
+ |
135 |
+ /* Enable all cpuidle devices */ |
136 |
+diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c |
137 |
+index 836bfe0..53e7ac9 100644 |
138 |
+--- a/drivers/acpi/processor_perflib.c |
139 |
++++ b/drivers/acpi/processor_perflib.c |
140 |
+@@ -340,6 +340,13 @@ static void amd_fixup_frequency(struct acpi_processor_px *px, int i) |
141 |
+ if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) |
142 |
+ || boot_cpu_data.x86 == 0x11) { |
143 |
+ rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi); |
144 |
++ /* |
145 |
++ * MSR C001_0064+: |
146 |
++ * Bit 63: PstateEn. Read-write. If set, the P-state is valid. |
147 |
++ */ |
148 |
++ if (!(hi & BIT(31))) |
149 |
++ return; |
150 |
++ |
151 |
+ fid = lo & 0x3f; |
152 |
+ did = (lo >> 6) & 7; |
153 |
+ if (boot_cpu_data.x86 == 0x10) |
154 |
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c |
155 |
+index 7862d17..4979127 100644 |
156 |
+--- a/drivers/ata/ahci.c |
157 |
++++ b/drivers/ata/ahci.c |
158 |
+@@ -53,6 +53,7 @@ |
159 |
+ |
160 |
+ enum { |
161 |
+ AHCI_PCI_BAR_STA2X11 = 0, |
162 |
++ AHCI_PCI_BAR_ENMOTUS = 2, |
163 |
+ AHCI_PCI_BAR_STANDARD = 5, |
164 |
+ }; |
165 |
+ |
166 |
+@@ -410,6 +411,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { |
167 |
+ { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ |
168 |
+ { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ |
169 |
+ |
170 |
++ /* Enmotus */ |
171 |
++ { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, |
172 |
++ |
173 |
+ /* Generic, PCI class code for AHCI */ |
174 |
+ { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
175 |
+ PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, |
176 |
+@@ -1098,9 +1102,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
177 |
+ dev_info(&pdev->dev, |
178 |
+ "PDC42819 can only drive SATA devices with this driver\n"); |
179 |
+ |
180 |
+- /* The Connext uses non-standard BAR */ |
181 |
++ /* Both Connext and Enmotus devices use non-standard BARs */ |
182 |
+ if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06) |
183 |
+ ahci_pci_bar = AHCI_PCI_BAR_STA2X11; |
184 |
++ else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) |
185 |
++ ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; |
186 |
+ |
187 |
+ /* acquire resources */ |
188 |
+ rc = pcim_enable_device(pdev); |
189 |
+diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
190 |
+index 4201e53..1d40fe8 100644 |
191 |
+--- a/drivers/ata/libahci.c |
192 |
++++ b/drivers/ata/libahci.c |
193 |
+@@ -1951,13 +1951,13 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) |
194 |
+ /* Use the nominal value 10 ms if the read MDAT is zero, |
195 |
+ * the nominal value of DETO is 20 ms. |
196 |
+ */ |
197 |
+- if (dev->sata_settings[ATA_LOG_DEVSLP_VALID] & |
198 |
++ if (dev->devslp_timing[ATA_LOG_DEVSLP_VALID] & |
199 |
+ ATA_LOG_DEVSLP_VALID_MASK) { |
200 |
+- mdat = dev->sata_settings[ATA_LOG_DEVSLP_MDAT] & |
201 |
++ mdat = dev->devslp_timing[ATA_LOG_DEVSLP_MDAT] & |
202 |
+ ATA_LOG_DEVSLP_MDAT_MASK; |
203 |
+ if (!mdat) |
204 |
+ mdat = 10; |
205 |
+- deto = dev->sata_settings[ATA_LOG_DEVSLP_DETO]; |
206 |
++ deto = dev->devslp_timing[ATA_LOG_DEVSLP_DETO]; |
207 |
+ if (!deto) |
208 |
+ deto = 20; |
209 |
+ } else { |
210 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
211 |
+index 586362e..c8ac4fe 100644 |
212 |
+--- a/drivers/ata/libata-core.c |
213 |
++++ b/drivers/ata/libata-core.c |
214 |
+@@ -2324,24 +2324,28 @@ int ata_dev_configure(struct ata_device *dev) |
215 |
+ } |
216 |
+ } |
217 |
+ |
218 |
+- /* check and mark DevSlp capability */ |
219 |
+- if (ata_id_has_devslp(dev->id)) |
220 |
+- dev->flags |= ATA_DFLAG_DEVSLP; |
221 |
+- |
222 |
+- /* Obtain SATA Settings page from Identify Device Data Log, |
223 |
+- * which contains DevSlp timing variables etc. |
224 |
+- * Exclude old devices with ata_id_has_ncq() |
225 |
++ /* Check and mark DevSlp capability. Get DevSlp timing variables |
226 |
++ * from SATA Settings page of Identify Device Data Log. |
227 |
+ */ |
228 |
+- if (ata_id_has_ncq(dev->id)) { |
229 |
++ if (ata_id_has_devslp(dev->id)) { |
230 |
++ u8 sata_setting[ATA_SECT_SIZE]; |
231 |
++ int i, j; |
232 |
++ |
233 |
++ dev->flags |= ATA_DFLAG_DEVSLP; |
234 |
+ err_mask = ata_read_log_page(dev, |
235 |
+ ATA_LOG_SATA_ID_DEV_DATA, |
236 |
+ ATA_LOG_SATA_SETTINGS, |
237 |
+- dev->sata_settings, |
238 |
++ sata_setting, |
239 |
+ 1); |
240 |
+ if (err_mask) |
241 |
+ ata_dev_dbg(dev, |
242 |
+ "failed to get Identify Device Data, Emask 0x%x\n", |
243 |
+ err_mask); |
244 |
++ else |
245 |
++ for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) { |
246 |
++ j = ATA_LOG_DEVSLP_OFFSET + i; |
247 |
++ dev->devslp_timing[i] = sata_setting[j]; |
248 |
++ } |
249 |
+ } |
250 |
+ |
251 |
+ dev->cdb_len = 16; |
252 |
+diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c |
253 |
+index bf039b0..bcf4437 100644 |
254 |
+--- a/drivers/ata/libata-eh.c |
255 |
++++ b/drivers/ata/libata-eh.c |
256 |
+@@ -2094,7 +2094,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, |
257 |
+ */ |
258 |
+ static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) |
259 |
+ { |
260 |
+- if (qc->flags & AC_ERR_MEDIA) |
261 |
++ if (qc->err_mask & AC_ERR_MEDIA) |
262 |
+ return 0; /* don't retry media errors */ |
263 |
+ if (qc->flags & ATA_QCFLAG_IO) |
264 |
+ return 1; /* otherwise retry anything from fs stack */ |
265 |
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
266 |
+index 0bdde8f..07a18e2 100644 |
267 |
+--- a/drivers/block/virtio_blk.c |
268 |
++++ b/drivers/block/virtio_blk.c |
269 |
+@@ -889,6 +889,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) |
270 |
+ { |
271 |
+ struct virtio_blk *vblk = vdev->priv; |
272 |
+ int index = vblk->index; |
273 |
++ int refc; |
274 |
+ |
275 |
+ /* Prevent config work handler from accessing the device. */ |
276 |
+ mutex_lock(&vblk->config_lock); |
277 |
+@@ -903,11 +904,15 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) |
278 |
+ |
279 |
+ flush_work(&vblk->config_work); |
280 |
+ |
281 |
++ refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount); |
282 |
+ put_disk(vblk->disk); |
283 |
+ mempool_destroy(vblk->pool); |
284 |
+ vdev->config->del_vqs(vdev); |
285 |
+ kfree(vblk); |
286 |
+- ida_simple_remove(&vd_index_ida, index); |
287 |
++ |
288 |
++ /* Only free device id if we don't have any users */ |
289 |
++ if (refc == 1) |
290 |
++ ida_simple_remove(&vd_index_ida, index); |
291 |
+ } |
292 |
+ |
293 |
+ #ifdef CONFIG_PM |
294 |
+diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86 |
295 |
+index 934854a..7227cd7 100644 |
296 |
+--- a/drivers/cpufreq/Kconfig.x86 |
297 |
++++ b/drivers/cpufreq/Kconfig.x86 |
298 |
+@@ -106,7 +106,7 @@ config X86_POWERNOW_K7_ACPI |
299 |
+ config X86_POWERNOW_K8 |
300 |
+ tristate "AMD Opteron/Athlon64 PowerNow!" |
301 |
+ select CPU_FREQ_TABLE |
302 |
+- depends on ACPI && ACPI_PROCESSOR |
303 |
++ depends on ACPI && ACPI_PROCESSOR && X86_ACPI_CPUFREQ |
304 |
+ help |
305 |
+ This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors. |
306 |
+ Support for K10 and newer processors is now in acpi-cpufreq. |
307 |
+diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c |
308 |
+index 0d048f6..7b0d49d 100644 |
309 |
+--- a/drivers/cpufreq/acpi-cpufreq.c |
310 |
++++ b/drivers/cpufreq/acpi-cpufreq.c |
311 |
+@@ -1030,4 +1030,11 @@ MODULE_PARM_DESC(acpi_pstate_strict, |
312 |
+ late_initcall(acpi_cpufreq_init); |
313 |
+ module_exit(acpi_cpufreq_exit); |
314 |
+ |
315 |
++static const struct x86_cpu_id acpi_cpufreq_ids[] = { |
316 |
++ X86_FEATURE_MATCH(X86_FEATURE_ACPI), |
317 |
++ X86_FEATURE_MATCH(X86_FEATURE_HW_PSTATE), |
318 |
++ {} |
319 |
++}; |
320 |
++MODULE_DEVICE_TABLE(x86cpu, acpi_cpufreq_ids); |
321 |
++ |
322 |
+ MODULE_ALIAS("acpi"); |
323 |
+diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c |
324 |
+index f7f1dc6..ed0e8b7 100644 |
325 |
+--- a/drivers/dma/ioat/dma_v3.c |
326 |
++++ b/drivers/dma/ioat/dma_v3.c |
327 |
+@@ -951,7 +951,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device) |
328 |
+ goto free_resources; |
329 |
+ } |
330 |
+ } |
331 |
+- dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_TO_DEVICE); |
332 |
++ dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_FROM_DEVICE); |
333 |
+ |
334 |
+ /* skip validate if the capability is not present */ |
335 |
+ if (!dma_has_cap(DMA_XOR_VAL, dma_chan->device->cap_mask)) |
336 |
+diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c |
337 |
+index 528c62d..3cf2ca8 100644 |
338 |
+--- a/drivers/dma/tegra20-apb-dma.c |
339 |
++++ b/drivers/dma/tegra20-apb-dma.c |
340 |
+@@ -266,6 +266,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get( |
341 |
+ if (async_tx_test_ack(&dma_desc->txd)) { |
342 |
+ list_del(&dma_desc->node); |
343 |
+ spin_unlock_irqrestore(&tdc->lock, flags); |
344 |
++ dma_desc->txd.flags = 0; |
345 |
+ return dma_desc; |
346 |
+ } |
347 |
+ } |
348 |
+@@ -1050,7 +1051,9 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( |
349 |
+ TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT; |
350 |
+ ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32; |
351 |
+ |
352 |
+- csr |= TEGRA_APBDMA_CSR_FLOW | TEGRA_APBDMA_CSR_IE_EOC; |
353 |
++ csr |= TEGRA_APBDMA_CSR_FLOW; |
354 |
++ if (flags & DMA_PREP_INTERRUPT) |
355 |
++ csr |= TEGRA_APBDMA_CSR_IE_EOC; |
356 |
+ csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; |
357 |
+ |
358 |
+ apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1; |
359 |
+@@ -1095,7 +1098,8 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( |
360 |
+ mem += len; |
361 |
+ } |
362 |
+ sg_req->last_sg = true; |
363 |
+- dma_desc->txd.flags = 0; |
364 |
++ if (flags & DMA_CTRL_ACK) |
365 |
++ dma_desc->txd.flags = DMA_CTRL_ACK; |
366 |
+ |
367 |
+ /* |
368 |
+ * Make sure that mode should not be conflicting with currently |
369 |
+diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c |
370 |
+index b298158..fd3ae62 100644 |
371 |
+--- a/drivers/firmware/dmi_scan.c |
372 |
++++ b/drivers/firmware/dmi_scan.c |
373 |
+@@ -16,6 +16,7 @@ |
374 |
+ */ |
375 |
+ static char dmi_empty_string[] = " "; |
376 |
+ |
377 |
++static u16 __initdata dmi_ver; |
378 |
+ /* |
379 |
+ * Catch too early calls to dmi_check_system(): |
380 |
+ */ |
381 |
+@@ -118,12 +119,12 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, |
382 |
+ return 0; |
383 |
+ } |
384 |
+ |
385 |
+-static int __init dmi_checksum(const u8 *buf) |
386 |
++static int __init dmi_checksum(const u8 *buf, u8 len) |
387 |
+ { |
388 |
+ u8 sum = 0; |
389 |
+ int a; |
390 |
+ |
391 |
+- for (a = 0; a < 15; a++) |
392 |
++ for (a = 0; a < len; a++) |
393 |
+ sum += buf[a]; |
394 |
+ |
395 |
+ return sum == 0; |
396 |
+@@ -161,8 +162,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde |
397 |
+ return; |
398 |
+ |
399 |
+ for (i = 0; i < 16 && (is_ff || is_00); i++) { |
400 |
+- if(d[i] != 0x00) is_ff = 0; |
401 |
+- if(d[i] != 0xFF) is_00 = 0; |
402 |
++ if (d[i] != 0x00) |
403 |
++ is_00 = 0; |
404 |
++ if (d[i] != 0xFF) |
405 |
++ is_ff = 0; |
406 |
+ } |
407 |
+ |
408 |
+ if (is_ff || is_00) |
409 |
+@@ -172,7 +175,15 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde |
410 |
+ if (!s) |
411 |
+ return; |
412 |
+ |
413 |
+- sprintf(s, "%pUB", d); |
414 |
++ /* |
415 |
++ * As of version 2.6 of the SMBIOS specification, the first 3 fields of |
416 |
++ * the UUID are supposed to be little-endian encoded. The specification |
417 |
++ * says that this is the defacto standard. |
418 |
++ */ |
419 |
++ if (dmi_ver >= 0x0206) |
420 |
++ sprintf(s, "%pUL", d); |
421 |
++ else |
422 |
++ sprintf(s, "%pUB", d); |
423 |
+ |
424 |
+ dmi_ident[slot] = s; |
425 |
+ } |
426 |
+@@ -404,29 +415,57 @@ static int __init dmi_present(const char __iomem *p) |
427 |
+ u8 buf[15]; |
428 |
+ |
429 |
+ memcpy_fromio(buf, p, 15); |
430 |
+- if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { |
431 |
++ if (dmi_checksum(buf, 15)) { |
432 |
+ dmi_num = (buf[13] << 8) | buf[12]; |
433 |
+ dmi_len = (buf[7] << 8) | buf[6]; |
434 |
+ dmi_base = (buf[11] << 24) | (buf[10] << 16) | |
435 |
+ (buf[9] << 8) | buf[8]; |
436 |
+ |
437 |
+- /* |
438 |
+- * DMI version 0.0 means that the real version is taken from |
439 |
+- * the SMBIOS version, which we don't know at this point. |
440 |
+- */ |
441 |
+- if (buf[14] != 0) |
442 |
+- printk(KERN_INFO "DMI %d.%d present.\n", |
443 |
+- buf[14] >> 4, buf[14] & 0xF); |
444 |
+- else |
445 |
+- printk(KERN_INFO "DMI present.\n"); |
446 |
+ if (dmi_walk_early(dmi_decode) == 0) { |
447 |
++ if (dmi_ver) |
448 |
++ pr_info("SMBIOS %d.%d present.\n", |
449 |
++ dmi_ver >> 8, dmi_ver & 0xFF); |
450 |
++ else { |
451 |
++ dmi_ver = (buf[14] & 0xF0) << 4 | |
452 |
++ (buf[14] & 0x0F); |
453 |
++ pr_info("Legacy DMI %d.%d present.\n", |
454 |
++ dmi_ver >> 8, dmi_ver & 0xFF); |
455 |
++ } |
456 |
+ dmi_dump_ids(); |
457 |
+ return 0; |
458 |
+ } |
459 |
+ } |
460 |
++ dmi_ver = 0; |
461 |
+ return 1; |
462 |
+ } |
463 |
+ |
464 |
++static int __init smbios_present(const char __iomem *p) |
465 |
++{ |
466 |
++ u8 buf[32]; |
467 |
++ int offset = 0; |
468 |
++ |
469 |
++ memcpy_fromio(buf, p, 32); |
470 |
++ if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) { |
471 |
++ dmi_ver = (buf[6] << 8) + buf[7]; |
472 |
++ |
473 |
++ /* Some BIOS report weird SMBIOS version, fix that up */ |
474 |
++ switch (dmi_ver) { |
475 |
++ case 0x021F: |
476 |
++ case 0x0221: |
477 |
++ pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", |
478 |
++ dmi_ver & 0xFF, 3); |
479 |
++ dmi_ver = 0x0203; |
480 |
++ break; |
481 |
++ case 0x0233: |
482 |
++ pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6); |
483 |
++ dmi_ver = 0x0206; |
484 |
++ break; |
485 |
++ } |
486 |
++ offset = 16; |
487 |
++ } |
488 |
++ return dmi_present(buf + offset); |
489 |
++} |
490 |
++ |
491 |
+ void __init dmi_scan_machine(void) |
492 |
+ { |
493 |
+ char __iomem *p, *q; |
494 |
+@@ -444,7 +483,7 @@ void __init dmi_scan_machine(void) |
495 |
+ if (p == NULL) |
496 |
+ goto error; |
497 |
+ |
498 |
+- rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ |
499 |
++ rc = smbios_present(p); |
500 |
+ dmi_iounmap(p, 32); |
501 |
+ if (!rc) { |
502 |
+ dmi_available = 1; |
503 |
+@@ -462,7 +501,12 @@ void __init dmi_scan_machine(void) |
504 |
+ goto error; |
505 |
+ |
506 |
+ for (q = p; q < p + 0x10000; q += 16) { |
507 |
+- rc = dmi_present(q); |
508 |
++ if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0) |
509 |
++ rc = smbios_present(q); |
510 |
++ else if (memcmp(q, "_DMI_", 5) == 0) |
511 |
++ rc = dmi_present(q); |
512 |
++ else |
513 |
++ continue; |
514 |
+ if (!rc) { |
515 |
+ dmi_available = 1; |
516 |
+ dmi_iounmap(p, 0x10000); |
517 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
518 |
+index 3eea143..67036e9 100644 |
519 |
+--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
520 |
++++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c |
521 |
+@@ -548,6 +548,8 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, |
522 |
+ total = 0; |
523 |
+ for (i = 0; i < count; i++) { |
524 |
+ struct drm_i915_gem_relocation_entry __user *user_relocs; |
525 |
++ u64 invalid_offset = (u64)-1; |
526 |
++ int j; |
527 |
+ |
528 |
+ user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr; |
529 |
+ |
530 |
+@@ -558,6 +560,25 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, |
531 |
+ goto err; |
532 |
+ } |
533 |
+ |
534 |
++ /* As we do not update the known relocation offsets after |
535 |
++ * relocating (due to the complexities in lock handling), |
536 |
++ * we need to mark them as invalid now so that we force the |
537 |
++ * relocation processing next time. Just in case the target |
538 |
++ * object is evicted and then rebound into its old |
539 |
++ * presumed_offset before the next execbuffer - if that |
540 |
++ * happened we would make the mistake of assuming that the |
541 |
++ * relocations were valid. |
542 |
++ */ |
543 |
++ for (j = 0; j < exec[i].relocation_count; j++) { |
544 |
++ if (copy_to_user(&user_relocs[j].presumed_offset, |
545 |
++ &invalid_offset, |
546 |
++ sizeof(invalid_offset))) { |
547 |
++ ret = -EFAULT; |
548 |
++ mutex_lock(&dev->struct_mutex); |
549 |
++ goto err; |
550 |
++ } |
551 |
++ } |
552 |
++ |
553 |
+ reloc_offset[i] = total; |
554 |
+ total += exec[i].relocation_count; |
555 |
+ } |
556 |
+diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
557 |
+index 09ae4b0..ecec134 100644 |
558 |
+--- a/drivers/gpu/drm/i915/i915_reg.h |
559 |
++++ b/drivers/gpu/drm/i915/i915_reg.h |
560 |
+@@ -514,6 +514,7 @@ |
561 |
+ * the enables for writing to the corresponding low bit. |
562 |
+ */ |
563 |
+ #define _3D_CHICKEN 0x02084 |
564 |
++#define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10) |
565 |
+ #define _3D_CHICKEN2 0x0208c |
566 |
+ /* Disables pipelining of read flushes past the SF-WIZ interface. |
567 |
+ * Required on all Ironlake steppings according to the B-Spec, but the |
568 |
+diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
569 |
+index eaaff3c..e87fa47 100644 |
570 |
+--- a/drivers/gpu/drm/i915/intel_pm.c |
571 |
++++ b/drivers/gpu/drm/i915/intel_pm.c |
572 |
+@@ -3412,6 +3412,10 @@ static void gen6_init_clock_gating(struct drm_device *dev) |
573 |
+ I915_READ(ILK_DISPLAY_CHICKEN2) | |
574 |
+ ILK_ELPIN_409_SELECT); |
575 |
+ |
576 |
++ /* WaDisableHiZPlanesWhenMSAAEnabled */ |
577 |
++ I915_WRITE(_3D_CHICKEN, |
578 |
++ _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); |
579 |
++ |
580 |
+ I915_WRITE(WM3_LP_ILK, 0); |
581 |
+ I915_WRITE(WM2_LP_ILK, 0); |
582 |
+ I915_WRITE(WM1_LP_ILK, 0); |
583 |
+diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c |
584 |
+index 0670da7..a6fad94 100644 |
585 |
+--- a/drivers/i2c/busses/i2c-mxs.c |
586 |
++++ b/drivers/i2c/busses/i2c-mxs.c |
587 |
+@@ -127,7 +127,7 @@ struct mxs_i2c_dev { |
588 |
+ struct device *dev; |
589 |
+ void __iomem *regs; |
590 |
+ struct completion cmd_complete; |
591 |
+- u32 cmd_err; |
592 |
++ int cmd_err; |
593 |
+ struct i2c_adapter adapter; |
594 |
+ const struct mxs_i2c_speed_config *speed; |
595 |
+ |
596 |
+diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c |
597 |
+index b0f6b4c..e0fbe77 100644 |
598 |
+--- a/drivers/idle/intel_idle.c |
599 |
++++ b/drivers/idle/intel_idle.c |
600 |
+@@ -460,8 +460,6 @@ static int intel_idle_probe(void) |
601 |
+ else |
602 |
+ on_each_cpu(__setup_broadcast_timer, (void *)true, 1); |
603 |
+ |
604 |
+- register_cpu_notifier(&cpu_hotplug_notifier); |
605 |
+- |
606 |
+ pr_debug(PREFIX "v" INTEL_IDLE_VERSION |
607 |
+ " model 0x%X\n", boot_cpu_data.x86_model); |
608 |
+ |
609 |
+@@ -624,6 +622,7 @@ static int __init intel_idle_init(void) |
610 |
+ return retval; |
611 |
+ } |
612 |
+ } |
613 |
++ register_cpu_notifier(&cpu_hotplug_notifier); |
614 |
+ |
615 |
+ return 0; |
616 |
+ } |
617 |
+diff --git a/drivers/media/usb/gspca/kinect.c b/drivers/media/usb/gspca/kinect.c |
618 |
+index 40ad668..3773a8a7 100644 |
619 |
+--- a/drivers/media/usb/gspca/kinect.c |
620 |
++++ b/drivers/media/usb/gspca/kinect.c |
621 |
+@@ -381,6 +381,7 @@ static const struct sd_desc sd_desc = { |
622 |
+ /* -- module initialisation -- */ |
623 |
+ static const struct usb_device_id device_table[] = { |
624 |
+ {USB_DEVICE(0x045e, 0x02ae)}, |
625 |
++ {USB_DEVICE(0x045e, 0x02bf)}, |
626 |
+ {} |
627 |
+ }; |
628 |
+ |
629 |
+diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c |
630 |
+index 04a8199..988da4d 100644 |
631 |
+--- a/drivers/misc/ti-st/st_kim.c |
632 |
++++ b/drivers/misc/ti-st/st_kim.c |
633 |
+@@ -468,6 +468,11 @@ long st_kim_start(void *kim_data) |
634 |
+ if (pdata->chip_enable) |
635 |
+ pdata->chip_enable(kim_gdata); |
636 |
+ |
637 |
++ /* Configure BT nShutdown to HIGH state */ |
638 |
++ gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
639 |
++ mdelay(5); /* FIXME: a proper toggle */ |
640 |
++ gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); |
641 |
++ mdelay(100); |
642 |
+ /* re-initialize the completion */ |
643 |
+ INIT_COMPLETION(kim_gdata->ldisc_installed); |
644 |
+ /* send notification to UIM */ |
645 |
+@@ -509,7 +514,8 @@ long st_kim_start(void *kim_data) |
646 |
+ * (b) upon failure to either install ldisc or download firmware. |
647 |
+ * The function is responsible to (a) notify UIM about un-installation, |
648 |
+ * (b) flush UART if the ldisc was installed. |
649 |
+- * (c) invoke platform's chip disabling routine. |
650 |
++ * (c) reset BT_EN - pull down nshutdown at the end. |
651 |
++ * (d) invoke platform's chip disabling routine. |
652 |
+ */ |
653 |
+ long st_kim_stop(void *kim_data) |
654 |
+ { |
655 |
+@@ -541,6 +547,13 @@ long st_kim_stop(void *kim_data) |
656 |
+ err = -ETIMEDOUT; |
657 |
+ } |
658 |
+ |
659 |
++ /* By default configure BT nShutdown to LOW state */ |
660 |
++ gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
661 |
++ mdelay(1); |
662 |
++ gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); |
663 |
++ mdelay(1); |
664 |
++ gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
665 |
++ |
666 |
+ /* platform specific disable */ |
667 |
+ if (pdata->chip_disable) |
668 |
+ pdata->chip_disable(kim_gdata); |
669 |
+@@ -732,6 +745,20 @@ static int kim_probe(struct platform_device *pdev) |
670 |
+ /* refer to itself */ |
671 |
+ kim_gdata->core_data->kim_data = kim_gdata; |
672 |
+ |
673 |
++ /* Claim the chip enable nShutdown gpio from the system */ |
674 |
++ kim_gdata->nshutdown = pdata->nshutdown_gpio; |
675 |
++ status = gpio_request(kim_gdata->nshutdown, "kim"); |
676 |
++ if (unlikely(status)) { |
677 |
++ pr_err(" gpio %ld request failed ", kim_gdata->nshutdown); |
678 |
++ return status; |
679 |
++ } |
680 |
++ |
681 |
++ /* Configure nShutdown GPIO as output=0 */ |
682 |
++ status = gpio_direction_output(kim_gdata->nshutdown, 0); |
683 |
++ if (unlikely(status)) { |
684 |
++ pr_err(" unable to configure gpio %ld", kim_gdata->nshutdown); |
685 |
++ return status; |
686 |
++ } |
687 |
+ /* get reference of pdev for request_firmware |
688 |
+ */ |
689 |
+ kim_gdata->kim_pdev = pdev; |
690 |
+@@ -767,10 +794,18 @@ static int kim_probe(struct platform_device *pdev) |
691 |
+ |
692 |
+ static int kim_remove(struct platform_device *pdev) |
693 |
+ { |
694 |
++ /* free the GPIOs requested */ |
695 |
++ struct ti_st_plat_data *pdata = pdev->dev.platform_data; |
696 |
+ struct kim_data_s *kim_gdata; |
697 |
+ |
698 |
+ kim_gdata = dev_get_drvdata(&pdev->dev); |
699 |
+ |
700 |
++ /* Free the Bluetooth/FM/GPIO |
701 |
++ * nShutdown gpio from the system |
702 |
++ */ |
703 |
++ gpio_free(pdata->nshutdown_gpio); |
704 |
++ pr_info("nshutdown GPIO Freed"); |
705 |
++ |
706 |
+ debugfs_remove_recursive(kim_debugfs_dir); |
707 |
+ sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); |
708 |
+ pr_info("sysfs entries removed"); |
709 |
+diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h |
710 |
+index 26ffd3e..2c113de 100644 |
711 |
+--- a/drivers/pci/hotplug/pciehp.h |
712 |
++++ b/drivers/pci/hotplug/pciehp.h |
713 |
+@@ -44,7 +44,6 @@ extern bool pciehp_poll_mode; |
714 |
+ extern int pciehp_poll_time; |
715 |
+ extern bool pciehp_debug; |
716 |
+ extern bool pciehp_force; |
717 |
+-extern struct workqueue_struct *pciehp_wq; |
718 |
+ |
719 |
+ #define dbg(format, arg...) \ |
720 |
+ do { \ |
721 |
+@@ -78,6 +77,7 @@ struct slot { |
722 |
+ struct hotplug_slot *hotplug_slot; |
723 |
+ struct delayed_work work; /* work for button event */ |
724 |
+ struct mutex lock; |
725 |
++ struct workqueue_struct *wq; |
726 |
+ }; |
727 |
+ |
728 |
+ struct event_info { |
729 |
+diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c |
730 |
+index 916bf4f..939bd1d 100644 |
731 |
+--- a/drivers/pci/hotplug/pciehp_core.c |
732 |
++++ b/drivers/pci/hotplug/pciehp_core.c |
733 |
+@@ -42,7 +42,6 @@ bool pciehp_debug; |
734 |
+ bool pciehp_poll_mode; |
735 |
+ int pciehp_poll_time; |
736 |
+ bool pciehp_force; |
737 |
+-struct workqueue_struct *pciehp_wq; |
738 |
+ |
739 |
+ #define DRIVER_VERSION "0.4" |
740 |
+ #define DRIVER_AUTHOR "Dan Zink <dan.zink@××××××.com>, Greg Kroah-Hartman <greg@×××××.com>, Dely Sy <dely.l.sy@×××××.com>" |
741 |
+@@ -340,18 +339,13 @@ static int __init pcied_init(void) |
742 |
+ { |
743 |
+ int retval = 0; |
744 |
+ |
745 |
+- pciehp_wq = alloc_workqueue("pciehp", 0, 0); |
746 |
+- if (!pciehp_wq) |
747 |
+- return -ENOMEM; |
748 |
+- |
749 |
+ pciehp_firmware_init(); |
750 |
+ retval = pcie_port_service_register(&hpdriver_portdrv); |
751 |
+ dbg("pcie_port_service_register = %d\n", retval); |
752 |
+ info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
753 |
+- if (retval) { |
754 |
+- destroy_workqueue(pciehp_wq); |
755 |
++ if (retval) |
756 |
+ dbg("Failure to register service\n"); |
757 |
+- } |
758 |
++ |
759 |
+ return retval; |
760 |
+ } |
761 |
+ |
762 |
+@@ -359,7 +353,6 @@ static void __exit pcied_cleanup(void) |
763 |
+ { |
764 |
+ dbg("unload_pciehpd()\n"); |
765 |
+ pcie_port_service_unregister(&hpdriver_portdrv); |
766 |
+- destroy_workqueue(pciehp_wq); |
767 |
+ info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); |
768 |
+ } |
769 |
+ |
770 |
+diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c |
771 |
+index 27f4429..38f0186 100644 |
772 |
+--- a/drivers/pci/hotplug/pciehp_ctrl.c |
773 |
++++ b/drivers/pci/hotplug/pciehp_ctrl.c |
774 |
+@@ -49,7 +49,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) |
775 |
+ info->p_slot = p_slot; |
776 |
+ INIT_WORK(&info->work, interrupt_event_handler); |
777 |
+ |
778 |
+- queue_work(pciehp_wq, &info->work); |
779 |
++ queue_work(p_slot->wq, &info->work); |
780 |
+ |
781 |
+ return 0; |
782 |
+ } |
783 |
+@@ -344,7 +344,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work) |
784 |
+ kfree(info); |
785 |
+ goto out; |
786 |
+ } |
787 |
+- queue_work(pciehp_wq, &info->work); |
788 |
++ queue_work(p_slot->wq, &info->work); |
789 |
+ out: |
790 |
+ mutex_unlock(&p_slot->lock); |
791 |
+ } |
792 |
+@@ -377,7 +377,7 @@ static void handle_button_press_event(struct slot *p_slot) |
793 |
+ if (ATTN_LED(ctrl)) |
794 |
+ pciehp_set_attention_status(p_slot, 0); |
795 |
+ |
796 |
+- queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ); |
797 |
++ queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); |
798 |
+ break; |
799 |
+ case BLINKINGOFF_STATE: |
800 |
+ case BLINKINGON_STATE: |
801 |
+@@ -439,7 +439,7 @@ static void handle_surprise_event(struct slot *p_slot) |
802 |
+ else |
803 |
+ p_slot->state = POWERON_STATE; |
804 |
+ |
805 |
+- queue_work(pciehp_wq, &info->work); |
806 |
++ queue_work(p_slot->wq, &info->work); |
807 |
+ } |
808 |
+ |
809 |
+ static void interrupt_event_handler(struct work_struct *work) |
810 |
+diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c |
811 |
+index 13b2eaf..5127f3f 100644 |
812 |
+--- a/drivers/pci/hotplug/pciehp_hpc.c |
813 |
++++ b/drivers/pci/hotplug/pciehp_hpc.c |
814 |
+@@ -773,23 +773,32 @@ static void pcie_shutdown_notification(struct controller *ctrl) |
815 |
+ static int pcie_init_slot(struct controller *ctrl) |
816 |
+ { |
817 |
+ struct slot *slot; |
818 |
++ char name[32]; |
819 |
+ |
820 |
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL); |
821 |
+ if (!slot) |
822 |
+ return -ENOMEM; |
823 |
+ |
824 |
++ snprintf(name, sizeof(name), "pciehp-%u", PSN(ctrl)); |
825 |
++ slot->wq = alloc_workqueue(name, 0, 0); |
826 |
++ if (!slot->wq) |
827 |
++ goto abort; |
828 |
++ |
829 |
+ slot->ctrl = ctrl; |
830 |
+ mutex_init(&slot->lock); |
831 |
+ INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); |
832 |
+ ctrl->slot = slot; |
833 |
+ return 0; |
834 |
++abort: |
835 |
++ kfree(slot); |
836 |
++ return -ENOMEM; |
837 |
+ } |
838 |
+ |
839 |
+ static void pcie_cleanup_slot(struct controller *ctrl) |
840 |
+ { |
841 |
+ struct slot *slot = ctrl->slot; |
842 |
+ cancel_delayed_work(&slot->work); |
843 |
+- flush_workqueue(pciehp_wq); |
844 |
++ destroy_workqueue(slot->wq); |
845 |
+ kfree(slot); |
846 |
+ } |
847 |
+ |
848 |
+diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h |
849 |
+index ca64932..b849f995 100644 |
850 |
+--- a/drivers/pci/hotplug/shpchp.h |
851 |
++++ b/drivers/pci/hotplug/shpchp.h |
852 |
+@@ -46,8 +46,6 @@ |
853 |
+ extern bool shpchp_poll_mode; |
854 |
+ extern int shpchp_poll_time; |
855 |
+ extern bool shpchp_debug; |
856 |
+-extern struct workqueue_struct *shpchp_wq; |
857 |
+-extern struct workqueue_struct *shpchp_ordered_wq; |
858 |
+ |
859 |
+ #define dbg(format, arg...) \ |
860 |
+ do { \ |
861 |
+@@ -91,6 +89,7 @@ struct slot { |
862 |
+ struct list_head slot_list; |
863 |
+ struct delayed_work work; /* work for button event */ |
864 |
+ struct mutex lock; |
865 |
++ struct workqueue_struct *wq; |
866 |
+ u8 hp_slot; |
867 |
+ }; |
868 |
+ |
869 |
+diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c |
870 |
+index b6de307..ea15fdc 100644 |
871 |
+--- a/drivers/pci/hotplug/shpchp_core.c |
872 |
++++ b/drivers/pci/hotplug/shpchp_core.c |
873 |
+@@ -39,8 +39,6 @@ |
874 |
+ bool shpchp_debug; |
875 |
+ bool shpchp_poll_mode; |
876 |
+ int shpchp_poll_time; |
877 |
+-struct workqueue_struct *shpchp_wq; |
878 |
+-struct workqueue_struct *shpchp_ordered_wq; |
879 |
+ |
880 |
+ #define DRIVER_VERSION "0.4" |
881 |
+ #define DRIVER_AUTHOR "Dan Zink <dan.zink@××××××.com>, Greg Kroah-Hartman <greg@×××××.com>, Dely Sy <dely.l.sy@×××××.com>" |
882 |
+@@ -129,6 +127,14 @@ static int init_slots(struct controller *ctrl) |
883 |
+ slot->device = ctrl->slot_device_offset + i; |
884 |
+ slot->hpc_ops = ctrl->hpc_ops; |
885 |
+ slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); |
886 |
++ |
887 |
++ snprintf(name, sizeof(name), "shpchp-%d", slot->number); |
888 |
++ slot->wq = alloc_workqueue(name, 0, 0); |
889 |
++ if (!slot->wq) { |
890 |
++ retval = -ENOMEM; |
891 |
++ goto error_info; |
892 |
++ } |
893 |
++ |
894 |
+ mutex_init(&slot->lock); |
895 |
+ INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work); |
896 |
+ |
897 |
+@@ -148,7 +154,7 @@ static int init_slots(struct controller *ctrl) |
898 |
+ if (retval) { |
899 |
+ ctrl_err(ctrl, "pci_hp_register failed with error %d\n", |
900 |
+ retval); |
901 |
+- goto error_info; |
902 |
++ goto error_slotwq; |
903 |
+ } |
904 |
+ |
905 |
+ get_power_status(hotplug_slot, &info->power_status); |
906 |
+@@ -160,6 +166,8 @@ static int init_slots(struct controller *ctrl) |
907 |
+ } |
908 |
+ |
909 |
+ return 0; |
910 |
++error_slotwq: |
911 |
++ destroy_workqueue(slot->wq); |
912 |
+ error_info: |
913 |
+ kfree(info); |
914 |
+ error_hpslot: |
915 |
+@@ -180,8 +188,7 @@ void cleanup_slots(struct controller *ctrl) |
916 |
+ slot = list_entry(tmp, struct slot, slot_list); |
917 |
+ list_del(&slot->slot_list); |
918 |
+ cancel_delayed_work(&slot->work); |
919 |
+- flush_workqueue(shpchp_wq); |
920 |
+- flush_workqueue(shpchp_ordered_wq); |
921 |
++ destroy_workqueue(slot->wq); |
922 |
+ pci_hp_deregister(slot->hotplug_slot); |
923 |
+ } |
924 |
+ } |
925 |
+@@ -364,25 +371,11 @@ static struct pci_driver shpc_driver = { |
926 |
+ |
927 |
+ static int __init shpcd_init(void) |
928 |
+ { |
929 |
+- int retval = 0; |
930 |
+- |
931 |
+- shpchp_wq = alloc_ordered_workqueue("shpchp", 0); |
932 |
+- if (!shpchp_wq) |
933 |
+- return -ENOMEM; |
934 |
+- |
935 |
+- shpchp_ordered_wq = alloc_ordered_workqueue("shpchp_ordered", 0); |
936 |
+- if (!shpchp_ordered_wq) { |
937 |
+- destroy_workqueue(shpchp_wq); |
938 |
+- return -ENOMEM; |
939 |
+- } |
940 |
++ int retval; |
941 |
+ |
942 |
+ retval = pci_register_driver(&shpc_driver); |
943 |
+ dbg("%s: pci_register_driver = %d\n", __func__, retval); |
944 |
+ info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
945 |
+- if (retval) { |
946 |
+- destroy_workqueue(shpchp_ordered_wq); |
947 |
+- destroy_workqueue(shpchp_wq); |
948 |
+- } |
949 |
+ return retval; |
950 |
+ } |
951 |
+ |
952 |
+@@ -390,8 +383,6 @@ static void __exit shpcd_cleanup(void) |
953 |
+ { |
954 |
+ dbg("unload_shpchpd()\n"); |
955 |
+ pci_unregister_driver(&shpc_driver); |
956 |
+- destroy_workqueue(shpchp_ordered_wq); |
957 |
+- destroy_workqueue(shpchp_wq); |
958 |
+ info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); |
959 |
+ } |
960 |
+ |
961 |
+diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c |
962 |
+index f9b5a52..5849927 100644 |
963 |
+--- a/drivers/pci/hotplug/shpchp_ctrl.c |
964 |
++++ b/drivers/pci/hotplug/shpchp_ctrl.c |
965 |
+@@ -51,7 +51,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) |
966 |
+ info->p_slot = p_slot; |
967 |
+ INIT_WORK(&info->work, interrupt_event_handler); |
968 |
+ |
969 |
+- queue_work(shpchp_wq, &info->work); |
970 |
++ queue_work(p_slot->wq, &info->work); |
971 |
+ |
972 |
+ return 0; |
973 |
+ } |
974 |
+@@ -453,7 +453,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work) |
975 |
+ kfree(info); |
976 |
+ goto out; |
977 |
+ } |
978 |
+- queue_work(shpchp_ordered_wq, &info->work); |
979 |
++ queue_work(p_slot->wq, &info->work); |
980 |
+ out: |
981 |
+ mutex_unlock(&p_slot->lock); |
982 |
+ } |
983 |
+@@ -501,7 +501,7 @@ static void handle_button_press_event(struct slot *p_slot) |
984 |
+ p_slot->hpc_ops->green_led_blink(p_slot); |
985 |
+ p_slot->hpc_ops->set_attention_status(p_slot, 0); |
986 |
+ |
987 |
+- queue_delayed_work(shpchp_wq, &p_slot->work, 5*HZ); |
988 |
++ queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); |
989 |
+ break; |
990 |
+ case BLINKINGOFF_STATE: |
991 |
+ case BLINKINGON_STATE: |
992 |
+diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c |
993 |
+index af4e31c..43caf53 100644 |
994 |
+--- a/drivers/pci/pcie/aer/aerdrv_core.c |
995 |
++++ b/drivers/pci/pcie/aer/aerdrv_core.c |
996 |
+@@ -616,6 +616,7 @@ static void aer_recover_work_func(struct work_struct *work) |
997 |
+ continue; |
998 |
+ } |
999 |
+ do_recovery(pdev, entry.severity); |
1000 |
++ pci_dev_put(pdev); |
1001 |
+ } |
1002 |
+ } |
1003 |
+ #endif |
1004 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
1005 |
+index 213753b..449f257 100644 |
1006 |
+--- a/drivers/pci/pcie/aspm.c |
1007 |
++++ b/drivers/pci/pcie/aspm.c |
1008 |
+@@ -773,6 +773,9 @@ void pcie_clear_aspm(struct pci_bus *bus) |
1009 |
+ { |
1010 |
+ struct pci_dev *child; |
1011 |
+ |
1012 |
++ if (aspm_force) |
1013 |
++ return; |
1014 |
++ |
1015 |
+ /* |
1016 |
+ * Clear any ASPM setup that the firmware has carried out on this bus |
1017 |
+ */ |
1018 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
1019 |
+index 352bc77..a45e12a 100644 |
1020 |
+--- a/drivers/scsi/sd.c |
1021 |
++++ b/drivers/scsi/sd.c |
1022 |
+@@ -3116,10 +3116,6 @@ static int __init init_sd(void) |
1023 |
+ if (err) |
1024 |
+ goto err_out; |
1025 |
+ |
1026 |
+- err = scsi_register_driver(&sd_template.gendrv); |
1027 |
+- if (err) |
1028 |
+- goto err_out_class; |
1029 |
+- |
1030 |
+ sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE, |
1031 |
+ 0, 0, NULL); |
1032 |
+ if (!sd_cdb_cache) { |
1033 |
+@@ -3133,8 +3129,15 @@ static int __init init_sd(void) |
1034 |
+ goto err_out_cache; |
1035 |
+ } |
1036 |
+ |
1037 |
++ err = scsi_register_driver(&sd_template.gendrv); |
1038 |
++ if (err) |
1039 |
++ goto err_out_driver; |
1040 |
++ |
1041 |
+ return 0; |
1042 |
+ |
1043 |
++err_out_driver: |
1044 |
++ mempool_destroy(sd_cdb_pool); |
1045 |
++ |
1046 |
+ err_out_cache: |
1047 |
+ kmem_cache_destroy(sd_cdb_cache); |
1048 |
+ |
1049 |
+@@ -3157,10 +3160,10 @@ static void __exit exit_sd(void) |
1050 |
+ |
1051 |
+ SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n")); |
1052 |
+ |
1053 |
++ scsi_unregister_driver(&sd_template.gendrv); |
1054 |
+ mempool_destroy(sd_cdb_pool); |
1055 |
+ kmem_cache_destroy(sd_cdb_cache); |
1056 |
+ |
1057 |
+- scsi_unregister_driver(&sd_template.gendrv); |
1058 |
+ class_unregister(&sd_disk_class); |
1059 |
+ |
1060 |
+ for (i = 0; i < SD_MAJORS; i++) |
1061 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1062 |
+index 7b7dedd..57f0859 100644 |
1063 |
+--- a/drivers/usb/dwc3/gadget.c |
1064 |
++++ b/drivers/usb/dwc3/gadget.c |
1065 |
+@@ -1605,6 +1605,7 @@ static int __devinit dwc3_gadget_init_endpoints(struct dwc3 *dwc) |
1066 |
+ |
1067 |
+ if (epnum == 0 || epnum == 1) { |
1068 |
+ dep->endpoint.maxpacket = 512; |
1069 |
++ dep->endpoint.maxburst = 1; |
1070 |
+ dep->endpoint.ops = &dwc3_gadget_ep0_ops; |
1071 |
+ if (!epnum) |
1072 |
+ dwc->gadget.ep0 = &dep->endpoint; |
1073 |
+diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c |
1074 |
+index 64c4ec1..7c52ed4 100644 |
1075 |
+--- a/drivers/usb/gadget/f_fs.c |
1076 |
++++ b/drivers/usb/gadget/f_fs.c |
1077 |
+@@ -1153,15 +1153,15 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) |
1078 |
+ pr_err("%s: unmapped value: %lu\n", opts, value); |
1079 |
+ return -EINVAL; |
1080 |
+ } |
1081 |
+- } |
1082 |
+- else if (!memcmp(opts, "gid", 3)) |
1083 |
++ } else if (!memcmp(opts, "gid", 3)) { |
1084 |
+ data->perms.gid = make_kgid(current_user_ns(), value); |
1085 |
+ if (!gid_valid(data->perms.gid)) { |
1086 |
+ pr_err("%s: unmapped value: %lu\n", opts, value); |
1087 |
+ return -EINVAL; |
1088 |
+ } |
1089 |
+- else |
1090 |
++ } else { |
1091 |
+ goto invalid; |
1092 |
++ } |
1093 |
+ break; |
1094 |
+ |
1095 |
+ default: |
1096 |
+diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c |
1097 |
+index 4b9e9ab..4f64d24 100644 |
1098 |
+--- a/drivers/usb/host/uhci-hcd.c |
1099 |
++++ b/drivers/usb/host/uhci-hcd.c |
1100 |
+@@ -447,6 +447,10 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) |
1101 |
+ return IRQ_NONE; |
1102 |
+ uhci_writew(uhci, status, USBSTS); /* Clear it */ |
1103 |
+ |
1104 |
++ spin_lock(&uhci->lock); |
1105 |
++ if (unlikely(!uhci->is_initialized)) /* not yet configured */ |
1106 |
++ goto done; |
1107 |
++ |
1108 |
+ if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) { |
1109 |
+ if (status & USBSTS_HSE) |
1110 |
+ dev_err(uhci_dev(uhci), "host system error, " |
1111 |
+@@ -455,7 +459,6 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) |
1112 |
+ dev_err(uhci_dev(uhci), "host controller process " |
1113 |
+ "error, something bad happened!\n"); |
1114 |
+ if (status & USBSTS_HCH) { |
1115 |
+- spin_lock(&uhci->lock); |
1116 |
+ if (uhci->rh_state >= UHCI_RH_RUNNING) { |
1117 |
+ dev_err(uhci_dev(uhci), |
1118 |
+ "host controller halted, " |
1119 |
+@@ -473,15 +476,15 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) |
1120 |
+ * pending unlinks */ |
1121 |
+ mod_timer(&hcd->rh_timer, jiffies); |
1122 |
+ } |
1123 |
+- spin_unlock(&uhci->lock); |
1124 |
+ } |
1125 |
+ } |
1126 |
+ |
1127 |
+- if (status & USBSTS_RD) |
1128 |
++ if (status & USBSTS_RD) { |
1129 |
++ spin_unlock(&uhci->lock); |
1130 |
+ usb_hcd_poll_rh_status(hcd); |
1131 |
+- else { |
1132 |
+- spin_lock(&uhci->lock); |
1133 |
++ } else { |
1134 |
+ uhci_scan_schedule(uhci); |
1135 |
++ done: |
1136 |
+ spin_unlock(&uhci->lock); |
1137 |
+ } |
1138 |
+ |
1139 |
+@@ -662,9 +665,9 @@ static int uhci_start(struct usb_hcd *hcd) |
1140 |
+ */ |
1141 |
+ mb(); |
1142 |
+ |
1143 |
++ spin_lock_irq(&uhci->lock); |
1144 |
+ configure_hc(uhci); |
1145 |
+ uhci->is_initialized = 1; |
1146 |
+- spin_lock_irq(&uhci->lock); |
1147 |
+ start_rh(uhci); |
1148 |
+ spin_unlock_irq(&uhci->lock); |
1149 |
+ return 0; |
1150 |
+diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c |
1151 |
+index 3a6c2fd..3d37b5d 100644 |
1152 |
+--- a/drivers/usb/musb/cppi_dma.c |
1153 |
++++ b/drivers/usb/musb/cppi_dma.c |
1154 |
+@@ -105,7 +105,7 @@ static void cppi_reset_tx(struct cppi_tx_stateram __iomem *tx, u32 ptr) |
1155 |
+ musb_writel(&tx->tx_complete, 0, ptr); |
1156 |
+ } |
1157 |
+ |
1158 |
+-static void __init cppi_pool_init(struct cppi *cppi, struct cppi_channel *c) |
1159 |
++static void cppi_pool_init(struct cppi *cppi, struct cppi_channel *c) |
1160 |
+ { |
1161 |
+ int j; |
1162 |
+ |
1163 |
+@@ -150,7 +150,7 @@ static void cppi_pool_free(struct cppi_channel *c) |
1164 |
+ c->last_processed = NULL; |
1165 |
+ } |
1166 |
+ |
1167 |
+-static int __init cppi_controller_start(struct dma_controller *c) |
1168 |
++static int cppi_controller_start(struct dma_controller *c) |
1169 |
+ { |
1170 |
+ struct cppi *controller; |
1171 |
+ void __iomem *tibase; |
1172 |
+diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c |
1173 |
+index 4362d9e..f72323e 100644 |
1174 |
+--- a/drivers/vfio/pci/vfio_pci_rdwr.c |
1175 |
++++ b/drivers/vfio/pci/vfio_pci_rdwr.c |
1176 |
+@@ -240,17 +240,17 @@ ssize_t vfio_pci_mem_readwrite(struct vfio_pci_device *vdev, char __user *buf, |
1177 |
+ filled = 1; |
1178 |
+ } else { |
1179 |
+ /* Drop writes, fill reads with FF */ |
1180 |
++ filled = min((size_t)(x_end - pos), count); |
1181 |
+ if (!iswrite) { |
1182 |
+ char val = 0xFF; |
1183 |
+ size_t i; |
1184 |
+ |
1185 |
+- for (i = 0; i < x_end - pos; i++) { |
1186 |
++ for (i = 0; i < filled; i++) { |
1187 |
+ if (put_user(val, buf + i)) |
1188 |
+ goto out; |
1189 |
+ } |
1190 |
+ } |
1191 |
+ |
1192 |
+- filled = x_end - pos; |
1193 |
+ } |
1194 |
+ |
1195 |
+ count -= filled; |
1196 |
+diff --git a/include/linux/ata.h b/include/linux/ata.h |
1197 |
+index 408da95..8f7a3d6 100644 |
1198 |
+--- a/include/linux/ata.h |
1199 |
++++ b/include/linux/ata.h |
1200 |
+@@ -297,10 +297,12 @@ enum { |
1201 |
+ ATA_LOG_SATA_NCQ = 0x10, |
1202 |
+ ATA_LOG_SATA_ID_DEV_DATA = 0x30, |
1203 |
+ ATA_LOG_SATA_SETTINGS = 0x08, |
1204 |
+- ATA_LOG_DEVSLP_MDAT = 0x30, |
1205 |
++ ATA_LOG_DEVSLP_OFFSET = 0x30, |
1206 |
++ ATA_LOG_DEVSLP_SIZE = 0x08, |
1207 |
++ ATA_LOG_DEVSLP_MDAT = 0x00, |
1208 |
+ ATA_LOG_DEVSLP_MDAT_MASK = 0x1F, |
1209 |
+- ATA_LOG_DEVSLP_DETO = 0x31, |
1210 |
+- ATA_LOG_DEVSLP_VALID = 0x37, |
1211 |
++ ATA_LOG_DEVSLP_DETO = 0x01, |
1212 |
++ ATA_LOG_DEVSLP_VALID = 0x07, |
1213 |
+ ATA_LOG_DEVSLP_VALID_MASK = 0x80, |
1214 |
+ |
1215 |
+ /* READ/WRITE LONG (obsolete) */ |
1216 |
+diff --git a/include/linux/libata.h b/include/linux/libata.h |
1217 |
+index e931c9a..1e36c63 100644 |
1218 |
+--- a/include/linux/libata.h |
1219 |
++++ b/include/linux/libata.h |
1220 |
+@@ -652,8 +652,8 @@ struct ata_device { |
1221 |
+ u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ |
1222 |
+ }; |
1223 |
+ |
1224 |
+- /* Identify Device Data Log (30h), SATA Settings (page 08h) */ |
1225 |
+- u8 sata_settings[ATA_SECT_SIZE]; |
1226 |
++ /* DEVSLP Timing Variables from Identify Device Data Log */ |
1227 |
++ u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; |
1228 |
+ |
1229 |
+ /* error history */ |
1230 |
+ int spdn_cnt; |
1231 |
+diff --git a/include/linux/module.h b/include/linux/module.h |
1232 |
+index 7760c6d..1375ee3 100644 |
1233 |
+--- a/include/linux/module.h |
1234 |
++++ b/include/linux/module.h |
1235 |
+@@ -199,11 +199,11 @@ struct module_use { |
1236 |
+ struct module *source, *target; |
1237 |
+ }; |
1238 |
+ |
1239 |
+-enum module_state |
1240 |
+-{ |
1241 |
+- MODULE_STATE_LIVE, |
1242 |
+- MODULE_STATE_COMING, |
1243 |
+- MODULE_STATE_GOING, |
1244 |
++enum module_state { |
1245 |
++ MODULE_STATE_LIVE, /* Normal state. */ |
1246 |
++ MODULE_STATE_COMING, /* Full formed, running module_init. */ |
1247 |
++ MODULE_STATE_GOING, /* Going away. */ |
1248 |
++ MODULE_STATE_UNFORMED, /* Still setting it up. */ |
1249 |
+ }; |
1250 |
+ |
1251 |
+ /** |
1252 |
+diff --git a/include/linux/sched.h b/include/linux/sched.h |
1253 |
+index 0dd42a0..3e63925 100644 |
1254 |
+--- a/include/linux/sched.h |
1255 |
++++ b/include/linux/sched.h |
1256 |
+@@ -2654,7 +2654,16 @@ static inline void thread_group_cputime_init(struct signal_struct *sig) |
1257 |
+ extern void recalc_sigpending_and_wake(struct task_struct *t); |
1258 |
+ extern void recalc_sigpending(void); |
1259 |
+ |
1260 |
+-extern void signal_wake_up(struct task_struct *t, int resume_stopped); |
1261 |
++extern void signal_wake_up_state(struct task_struct *t, unsigned int state); |
1262 |
++ |
1263 |
++static inline void signal_wake_up(struct task_struct *t, bool resume) |
1264 |
++{ |
1265 |
++ signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0); |
1266 |
++} |
1267 |
++static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume) |
1268 |
++{ |
1269 |
++ signal_wake_up_state(t, resume ? __TASK_TRACED : 0); |
1270 |
++} |
1271 |
+ |
1272 |
+ /* |
1273 |
+ * Wrappers for p->thread_info->cpu access. No-op on UP. |
1274 |
+diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c |
1275 |
+index 5e4ded5..f9acf71 100644 |
1276 |
+--- a/init/do_mounts_initrd.c |
1277 |
++++ b/init/do_mounts_initrd.c |
1278 |
+@@ -36,6 +36,10 @@ __setup("noinitrd", no_initrd); |
1279 |
+ static int init_linuxrc(struct subprocess_info *info, struct cred *new) |
1280 |
+ { |
1281 |
+ sys_unshare(CLONE_FS | CLONE_FILES); |
1282 |
++ /* stdin/stdout/stderr for /linuxrc */ |
1283 |
++ sys_open("/dev/console", O_RDWR, 0); |
1284 |
++ sys_dup(0); |
1285 |
++ sys_dup(0); |
1286 |
+ /* move initrd over / and chdir/chroot in initrd root */ |
1287 |
+ sys_chdir("/root"); |
1288 |
+ sys_mount(".", "/", NULL, MS_MOVE, NULL); |
1289 |
+diff --git a/init/main.c b/init/main.c |
1290 |
+index e33e09d..cd147a9 100644 |
1291 |
+--- a/init/main.c |
1292 |
++++ b/init/main.c |
1293 |
+@@ -800,7 +800,7 @@ static int run_init_process(const char *init_filename) |
1294 |
+ return kernel_execve(init_filename, argv_init, envp_init); |
1295 |
+ } |
1296 |
+ |
1297 |
+-static void __init kernel_init_freeable(void); |
1298 |
++static noinline void __init kernel_init_freeable(void); |
1299 |
+ |
1300 |
+ static int __ref kernel_init(void *unused) |
1301 |
+ { |
1302 |
+@@ -844,7 +844,7 @@ static int __ref kernel_init(void *unused) |
1303 |
+ "See Linux Documentation/init.txt for guidance."); |
1304 |
+ } |
1305 |
+ |
1306 |
+-static void __init kernel_init_freeable(void) |
1307 |
++static noinline void __init kernel_init_freeable(void) |
1308 |
+ { |
1309 |
+ /* |
1310 |
+ * Wait until kthreadd is all set-up. |
1311 |
+diff --git a/kernel/async.c b/kernel/async.c |
1312 |
+index 9d31183..8f9f5cf 100644 |
1313 |
+--- a/kernel/async.c |
1314 |
++++ b/kernel/async.c |
1315 |
+@@ -86,18 +86,27 @@ static atomic_t entry_count; |
1316 |
+ */ |
1317 |
+ static async_cookie_t __lowest_in_progress(struct async_domain *running) |
1318 |
+ { |
1319 |
++ async_cookie_t first_running = next_cookie; /* infinity value */ |
1320 |
++ async_cookie_t first_pending = next_cookie; /* ditto */ |
1321 |
+ struct async_entry *entry; |
1322 |
+ |
1323 |
++ /* |
1324 |
++ * Both running and pending lists are sorted but not disjoint. |
1325 |
++ * Take the first cookies from both and return the min. |
1326 |
++ */ |
1327 |
+ if (!list_empty(&running->domain)) { |
1328 |
+ entry = list_first_entry(&running->domain, typeof(*entry), list); |
1329 |
+- return entry->cookie; |
1330 |
++ first_running = entry->cookie; |
1331 |
+ } |
1332 |
+ |
1333 |
+- list_for_each_entry(entry, &async_pending, list) |
1334 |
+- if (entry->running == running) |
1335 |
+- return entry->cookie; |
1336 |
++ list_for_each_entry(entry, &async_pending, list) { |
1337 |
++ if (entry->running == running) { |
1338 |
++ first_pending = entry->cookie; |
1339 |
++ break; |
1340 |
++ } |
1341 |
++ } |
1342 |
+ |
1343 |
+- return next_cookie; /* "infinity" value */ |
1344 |
++ return min(first_running, first_pending); |
1345 |
+ } |
1346 |
+ |
1347 |
+ static async_cookie_t lowest_in_progress(struct async_domain *running) |
1348 |
+@@ -118,13 +127,17 @@ static void async_run_entry_fn(struct work_struct *work) |
1349 |
+ { |
1350 |
+ struct async_entry *entry = |
1351 |
+ container_of(work, struct async_entry, work); |
1352 |
++ struct async_entry *pos; |
1353 |
+ unsigned long flags; |
1354 |
+ ktime_t uninitialized_var(calltime), delta, rettime; |
1355 |
+ struct async_domain *running = entry->running; |
1356 |
+ |
1357 |
+- /* 1) move self to the running queue */ |
1358 |
++ /* 1) move self to the running queue, make sure it stays sorted */ |
1359 |
+ spin_lock_irqsave(&async_lock, flags); |
1360 |
+- list_move_tail(&entry->list, &running->domain); |
1361 |
++ list_for_each_entry_reverse(pos, &running->domain, list) |
1362 |
++ if (entry->cookie < pos->cookie) |
1363 |
++ break; |
1364 |
++ list_move_tail(&entry->list, &pos->list); |
1365 |
+ spin_unlock_irqrestore(&async_lock, flags); |
1366 |
+ |
1367 |
+ /* 2) run (and print duration) */ |
1368 |
+diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c |
1369 |
+index 4d5f8d5..8875254 100644 |
1370 |
+--- a/kernel/debug/kdb/kdb_main.c |
1371 |
++++ b/kernel/debug/kdb/kdb_main.c |
1372 |
+@@ -1970,6 +1970,8 @@ static int kdb_lsmod(int argc, const char **argv) |
1373 |
+ |
1374 |
+ kdb_printf("Module Size modstruct Used by\n"); |
1375 |
+ list_for_each_entry(mod, kdb_modules, list) { |
1376 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1377 |
++ continue; |
1378 |
+ |
1379 |
+ kdb_printf("%-20s%8u 0x%p ", mod->name, |
1380 |
+ mod->core_size, (void *)mod); |
1381 |
+diff --git a/kernel/module.c b/kernel/module.c |
1382 |
+index 6e48c3a..3e544f4 100644 |
1383 |
+--- a/kernel/module.c |
1384 |
++++ b/kernel/module.c |
1385 |
+@@ -185,6 +185,7 @@ struct load_info { |
1386 |
+ ongoing or failed initialization etc. */ |
1387 |
+ static inline int strong_try_module_get(struct module *mod) |
1388 |
+ { |
1389 |
++ BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED); |
1390 |
+ if (mod && mod->state == MODULE_STATE_COMING) |
1391 |
+ return -EBUSY; |
1392 |
+ if (try_module_get(mod)) |
1393 |
+@@ -340,6 +341,9 @@ bool each_symbol_section(bool (*fn)(const struct symsearch *arr, |
1394 |
+ #endif |
1395 |
+ }; |
1396 |
+ |
1397 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1398 |
++ continue; |
1399 |
++ |
1400 |
+ if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data)) |
1401 |
+ return true; |
1402 |
+ } |
1403 |
+@@ -450,16 +454,24 @@ const struct kernel_symbol *find_symbol(const char *name, |
1404 |
+ EXPORT_SYMBOL_GPL(find_symbol); |
1405 |
+ |
1406 |
+ /* Search for module by name: must hold module_mutex. */ |
1407 |
+-struct module *find_module(const char *name) |
1408 |
++static struct module *find_module_all(const char *name, |
1409 |
++ bool even_unformed) |
1410 |
+ { |
1411 |
+ struct module *mod; |
1412 |
+ |
1413 |
+ list_for_each_entry(mod, &modules, list) { |
1414 |
++ if (!even_unformed && mod->state == MODULE_STATE_UNFORMED) |
1415 |
++ continue; |
1416 |
+ if (strcmp(mod->name, name) == 0) |
1417 |
+ return mod; |
1418 |
+ } |
1419 |
+ return NULL; |
1420 |
+ } |
1421 |
++ |
1422 |
++struct module *find_module(const char *name) |
1423 |
++{ |
1424 |
++ return find_module_all(name, false); |
1425 |
++} |
1426 |
+ EXPORT_SYMBOL_GPL(find_module); |
1427 |
+ |
1428 |
+ #ifdef CONFIG_SMP |
1429 |
+@@ -525,6 +537,8 @@ bool is_module_percpu_address(unsigned long addr) |
1430 |
+ preempt_disable(); |
1431 |
+ |
1432 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1433 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1434 |
++ continue; |
1435 |
+ if (!mod->percpu_size) |
1436 |
+ continue; |
1437 |
+ for_each_possible_cpu(cpu) { |
1438 |
+@@ -1048,6 +1062,8 @@ static ssize_t show_initstate(struct module_attribute *mattr, |
1439 |
+ case MODULE_STATE_GOING: |
1440 |
+ state = "going"; |
1441 |
+ break; |
1442 |
++ default: |
1443 |
++ BUG(); |
1444 |
+ } |
1445 |
+ return sprintf(buffer, "%s\n", state); |
1446 |
+ } |
1447 |
+@@ -1786,6 +1802,8 @@ void set_all_modules_text_rw(void) |
1448 |
+ |
1449 |
+ mutex_lock(&module_mutex); |
1450 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1451 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1452 |
++ continue; |
1453 |
+ if ((mod->module_core) && (mod->core_text_size)) { |
1454 |
+ set_page_attributes(mod->module_core, |
1455 |
+ mod->module_core + mod->core_text_size, |
1456 |
+@@ -1807,6 +1825,8 @@ void set_all_modules_text_ro(void) |
1457 |
+ |
1458 |
+ mutex_lock(&module_mutex); |
1459 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1460 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1461 |
++ continue; |
1462 |
+ if ((mod->module_core) && (mod->core_text_size)) { |
1463 |
+ set_page_attributes(mod->module_core, |
1464 |
+ mod->module_core + mod->core_text_size, |
1465 |
+@@ -2938,8 +2958,9 @@ static bool finished_loading(const char *name) |
1466 |
+ bool ret; |
1467 |
+ |
1468 |
+ mutex_lock(&module_mutex); |
1469 |
+- mod = find_module(name); |
1470 |
+- ret = !mod || mod->state != MODULE_STATE_COMING; |
1471 |
++ mod = find_module_all(name, true); |
1472 |
++ ret = !mod || mod->state == MODULE_STATE_LIVE |
1473 |
++ || mod->state == MODULE_STATE_GOING; |
1474 |
+ mutex_unlock(&module_mutex); |
1475 |
+ |
1476 |
+ return ret; |
1477 |
+@@ -2970,6 +2991,32 @@ static struct module *load_module(void __user *umod, |
1478 |
+ goto free_copy; |
1479 |
+ } |
1480 |
+ |
1481 |
++ /* |
1482 |
++ * We try to place it in the list now to make sure it's unique |
1483 |
++ * before we dedicate too many resources. In particular, |
1484 |
++ * temporary percpu memory exhaustion. |
1485 |
++ */ |
1486 |
++ mod->state = MODULE_STATE_UNFORMED; |
1487 |
++again: |
1488 |
++ mutex_lock(&module_mutex); |
1489 |
++ if ((old = find_module_all(mod->name, true)) != NULL) { |
1490 |
++ if (old->state == MODULE_STATE_COMING |
1491 |
++ || old->state == MODULE_STATE_UNFORMED) { |
1492 |
++ /* Wait in case it fails to load. */ |
1493 |
++ mutex_unlock(&module_mutex); |
1494 |
++ err = wait_event_interruptible(module_wq, |
1495 |
++ finished_loading(mod->name)); |
1496 |
++ if (err) |
1497 |
++ goto free_module; |
1498 |
++ goto again; |
1499 |
++ } |
1500 |
++ err = -EEXIST; |
1501 |
++ mutex_unlock(&module_mutex); |
1502 |
++ goto free_module; |
1503 |
++ } |
1504 |
++ list_add_rcu(&mod->list, &modules); |
1505 |
++ mutex_unlock(&module_mutex); |
1506 |
++ |
1507 |
+ #ifdef CONFIG_MODULE_SIG |
1508 |
+ mod->sig_ok = info.sig_ok; |
1509 |
+ if (!mod->sig_ok) |
1510 |
+@@ -2979,7 +3026,7 @@ static struct module *load_module(void __user *umod, |
1511 |
+ /* Now module is in final location, initialize linked lists, etc. */ |
1512 |
+ err = module_unload_init(mod); |
1513 |
+ if (err) |
1514 |
+- goto free_module; |
1515 |
++ goto unlink_mod; |
1516 |
+ |
1517 |
+ /* Now we've got everything in the final locations, we can |
1518 |
+ * find optional sections. */ |
1519 |
+@@ -3014,54 +3061,33 @@ static struct module *load_module(void __user *umod, |
1520 |
+ goto free_arch_cleanup; |
1521 |
+ } |
1522 |
+ |
1523 |
+- /* Mark state as coming so strong_try_module_get() ignores us. */ |
1524 |
+- mod->state = MODULE_STATE_COMING; |
1525 |
+- |
1526 |
+- /* Now sew it into the lists so we can get lockdep and oops |
1527 |
+- * info during argument parsing. No one should access us, since |
1528 |
+- * strong_try_module_get() will fail. |
1529 |
+- * lockdep/oops can run asynchronous, so use the RCU list insertion |
1530 |
+- * function to insert in a way safe to concurrent readers. |
1531 |
+- * The mutex protects against concurrent writers. |
1532 |
+- */ |
1533 |
+-again: |
1534 |
+- mutex_lock(&module_mutex); |
1535 |
+- if ((old = find_module(mod->name)) != NULL) { |
1536 |
+- if (old->state == MODULE_STATE_COMING) { |
1537 |
+- /* Wait in case it fails to load. */ |
1538 |
+- mutex_unlock(&module_mutex); |
1539 |
+- err = wait_event_interruptible(module_wq, |
1540 |
+- finished_loading(mod->name)); |
1541 |
+- if (err) |
1542 |
+- goto free_arch_cleanup; |
1543 |
+- goto again; |
1544 |
+- } |
1545 |
+- err = -EEXIST; |
1546 |
+- goto unlock; |
1547 |
+- } |
1548 |
+- |
1549 |
+- /* This has to be done once we're sure module name is unique. */ |
1550 |
+ dynamic_debug_setup(info.debug, info.num_debug); |
1551 |
+ |
1552 |
+- /* Find duplicate symbols */ |
1553 |
++ mutex_lock(&module_mutex); |
1554 |
++ /* Find duplicate symbols (must be called under lock). */ |
1555 |
+ err = verify_export_symbols(mod); |
1556 |
+ if (err < 0) |
1557 |
+- goto ddebug; |
1558 |
++ goto ddebug_cleanup; |
1559 |
+ |
1560 |
++ /* This relies on module_mutex for list integrity. */ |
1561 |
+ module_bug_finalize(info.hdr, info.sechdrs, mod); |
1562 |
+- list_add_rcu(&mod->list, &modules); |
1563 |
++ |
1564 |
++ /* Mark state as coming so strong_try_module_get() ignores us, |
1565 |
++ * but kallsyms etc. can see us. */ |
1566 |
++ mod->state = MODULE_STATE_COMING; |
1567 |
++ |
1568 |
+ mutex_unlock(&module_mutex); |
1569 |
+ |
1570 |
+ /* Module is ready to execute: parsing args may do that. */ |
1571 |
+ err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, |
1572 |
+ -32768, 32767, &ddebug_dyndbg_module_param_cb); |
1573 |
+ if (err < 0) |
1574 |
+- goto unlink; |
1575 |
++ goto bug_cleanup; |
1576 |
+ |
1577 |
+ /* Link in to syfs. */ |
1578 |
+ err = mod_sysfs_setup(mod, &info, mod->kp, mod->num_kp); |
1579 |
+ if (err < 0) |
1580 |
+- goto unlink; |
1581 |
++ goto bug_cleanup; |
1582 |
+ |
1583 |
+ /* Get rid of temporary copy. */ |
1584 |
+ free_copy(&info); |
1585 |
+@@ -3070,16 +3096,13 @@ again: |
1586 |
+ trace_module_load(mod); |
1587 |
+ return mod; |
1588 |
+ |
1589 |
+- unlink: |
1590 |
++ bug_cleanup: |
1591 |
++ /* module_bug_cleanup needs module_mutex protection */ |
1592 |
+ mutex_lock(&module_mutex); |
1593 |
+- /* Unlink carefully: kallsyms could be walking list. */ |
1594 |
+- list_del_rcu(&mod->list); |
1595 |
+ module_bug_cleanup(mod); |
1596 |
+- wake_up_all(&module_wq); |
1597 |
+- ddebug: |
1598 |
+- dynamic_debug_remove(info.debug); |
1599 |
+- unlock: |
1600 |
++ ddebug_cleanup: |
1601 |
+ mutex_unlock(&module_mutex); |
1602 |
++ dynamic_debug_remove(info.debug); |
1603 |
+ synchronize_sched(); |
1604 |
+ kfree(mod->args); |
1605 |
+ free_arch_cleanup: |
1606 |
+@@ -3088,6 +3111,12 @@ again: |
1607 |
+ free_modinfo(mod); |
1608 |
+ free_unload: |
1609 |
+ module_unload_free(mod); |
1610 |
++ unlink_mod: |
1611 |
++ mutex_lock(&module_mutex); |
1612 |
++ /* Unlink carefully: kallsyms could be walking list. */ |
1613 |
++ list_del_rcu(&mod->list); |
1614 |
++ wake_up_all(&module_wq); |
1615 |
++ mutex_unlock(&module_mutex); |
1616 |
+ free_module: |
1617 |
+ module_deallocate(mod, &info); |
1618 |
+ free_copy: |
1619 |
+@@ -3264,6 +3293,8 @@ const char *module_address_lookup(unsigned long addr, |
1620 |
+ |
1621 |
+ preempt_disable(); |
1622 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1623 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1624 |
++ continue; |
1625 |
+ if (within_module_init(addr, mod) || |
1626 |
+ within_module_core(addr, mod)) { |
1627 |
+ if (modname) |
1628 |
+@@ -3287,6 +3318,8 @@ int lookup_module_symbol_name(unsigned long addr, char *symname) |
1629 |
+ |
1630 |
+ preempt_disable(); |
1631 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1632 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1633 |
++ continue; |
1634 |
+ if (within_module_init(addr, mod) || |
1635 |
+ within_module_core(addr, mod)) { |
1636 |
+ const char *sym; |
1637 |
+@@ -3311,6 +3344,8 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, |
1638 |
+ |
1639 |
+ preempt_disable(); |
1640 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1641 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1642 |
++ continue; |
1643 |
+ if (within_module_init(addr, mod) || |
1644 |
+ within_module_core(addr, mod)) { |
1645 |
+ const char *sym; |
1646 |
+@@ -3338,6 +3373,8 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, |
1647 |
+ |
1648 |
+ preempt_disable(); |
1649 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1650 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1651 |
++ continue; |
1652 |
+ if (symnum < mod->num_symtab) { |
1653 |
+ *value = mod->symtab[symnum].st_value; |
1654 |
+ *type = mod->symtab[symnum].st_info; |
1655 |
+@@ -3380,9 +3417,12 @@ unsigned long module_kallsyms_lookup_name(const char *name) |
1656 |
+ ret = mod_find_symname(mod, colon+1); |
1657 |
+ *colon = ':'; |
1658 |
+ } else { |
1659 |
+- list_for_each_entry_rcu(mod, &modules, list) |
1660 |
++ list_for_each_entry_rcu(mod, &modules, list) { |
1661 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1662 |
++ continue; |
1663 |
+ if ((ret = mod_find_symname(mod, name)) != 0) |
1664 |
+ break; |
1665 |
++ } |
1666 |
+ } |
1667 |
+ preempt_enable(); |
1668 |
+ return ret; |
1669 |
+@@ -3397,6 +3437,8 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, |
1670 |
+ int ret; |
1671 |
+ |
1672 |
+ list_for_each_entry(mod, &modules, list) { |
1673 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1674 |
++ continue; |
1675 |
+ for (i = 0; i < mod->num_symtab; i++) { |
1676 |
+ ret = fn(data, mod->strtab + mod->symtab[i].st_name, |
1677 |
+ mod, mod->symtab[i].st_value); |
1678 |
+@@ -3412,6 +3454,7 @@ static char *module_flags(struct module *mod, char *buf) |
1679 |
+ { |
1680 |
+ int bx = 0; |
1681 |
+ |
1682 |
++ BUG_ON(mod->state == MODULE_STATE_UNFORMED); |
1683 |
+ if (mod->taints || |
1684 |
+ mod->state == MODULE_STATE_GOING || |
1685 |
+ mod->state == MODULE_STATE_COMING) { |
1686 |
+@@ -3453,6 +3496,10 @@ static int m_show(struct seq_file *m, void *p) |
1687 |
+ struct module *mod = list_entry(p, struct module, list); |
1688 |
+ char buf[8]; |
1689 |
+ |
1690 |
++ /* We always ignore unformed modules. */ |
1691 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1692 |
++ return 0; |
1693 |
++ |
1694 |
+ seq_printf(m, "%s %u", |
1695 |
+ mod->name, mod->init_size + mod->core_size); |
1696 |
+ print_unload_info(m, mod); |
1697 |
+@@ -3513,6 +3560,8 @@ const struct exception_table_entry *search_module_extables(unsigned long addr) |
1698 |
+ |
1699 |
+ preempt_disable(); |
1700 |
+ list_for_each_entry_rcu(mod, &modules, list) { |
1701 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1702 |
++ continue; |
1703 |
+ if (mod->num_exentries == 0) |
1704 |
+ continue; |
1705 |
+ |
1706 |
+@@ -3561,10 +3610,13 @@ struct module *__module_address(unsigned long addr) |
1707 |
+ if (addr < module_addr_min || addr > module_addr_max) |
1708 |
+ return NULL; |
1709 |
+ |
1710 |
+- list_for_each_entry_rcu(mod, &modules, list) |
1711 |
++ list_for_each_entry_rcu(mod, &modules, list) { |
1712 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1713 |
++ continue; |
1714 |
+ if (within_module_core(addr, mod) |
1715 |
+ || within_module_init(addr, mod)) |
1716 |
+ return mod; |
1717 |
++ } |
1718 |
+ return NULL; |
1719 |
+ } |
1720 |
+ EXPORT_SYMBOL_GPL(__module_address); |
1721 |
+@@ -3617,8 +3669,11 @@ void print_modules(void) |
1722 |
+ printk(KERN_DEFAULT "Modules linked in:"); |
1723 |
+ /* Most callers should already have preempt disabled, but make sure */ |
1724 |
+ preempt_disable(); |
1725 |
+- list_for_each_entry_rcu(mod, &modules, list) |
1726 |
++ list_for_each_entry_rcu(mod, &modules, list) { |
1727 |
++ if (mod->state == MODULE_STATE_UNFORMED) |
1728 |
++ continue; |
1729 |
+ printk(" %s%s", mod->name, module_flags(mod, buf)); |
1730 |
++ } |
1731 |
+ preempt_enable(); |
1732 |
+ if (last_unloaded_module[0]) |
1733 |
+ printk(" [last unloaded: %s]", last_unloaded_module); |
1734 |
+diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
1735 |
+index 1f5e55d..fbea91d 100644 |
1736 |
+--- a/kernel/ptrace.c |
1737 |
++++ b/kernel/ptrace.c |
1738 |
+@@ -117,11 +117,45 @@ void __ptrace_unlink(struct task_struct *child) |
1739 |
+ * TASK_KILLABLE sleeps. |
1740 |
+ */ |
1741 |
+ if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child)) |
1742 |
+- signal_wake_up(child, task_is_traced(child)); |
1743 |
++ ptrace_signal_wake_up(child, true); |
1744 |
+ |
1745 |
+ spin_unlock(&child->sighand->siglock); |
1746 |
+ } |
1747 |
+ |
1748 |
++/* Ensure that nothing can wake it up, even SIGKILL */ |
1749 |
++static bool ptrace_freeze_traced(struct task_struct *task) |
1750 |
++{ |
1751 |
++ bool ret = false; |
1752 |
++ |
1753 |
++ /* Lockless, nobody but us can set this flag */ |
1754 |
++ if (task->jobctl & JOBCTL_LISTENING) |
1755 |
++ return ret; |
1756 |
++ |
1757 |
++ spin_lock_irq(&task->sighand->siglock); |
1758 |
++ if (task_is_traced(task) && !__fatal_signal_pending(task)) { |
1759 |
++ task->state = __TASK_TRACED; |
1760 |
++ ret = true; |
1761 |
++ } |
1762 |
++ spin_unlock_irq(&task->sighand->siglock); |
1763 |
++ |
1764 |
++ return ret; |
1765 |
++} |
1766 |
++ |
1767 |
++static void ptrace_unfreeze_traced(struct task_struct *task) |
1768 |
++{ |
1769 |
++ if (task->state != __TASK_TRACED) |
1770 |
++ return; |
1771 |
++ |
1772 |
++ WARN_ON(!task->ptrace || task->parent != current); |
1773 |
++ |
1774 |
++ spin_lock_irq(&task->sighand->siglock); |
1775 |
++ if (__fatal_signal_pending(task)) |
1776 |
++ wake_up_state(task, __TASK_TRACED); |
1777 |
++ else |
1778 |
++ task->state = TASK_TRACED; |
1779 |
++ spin_unlock_irq(&task->sighand->siglock); |
1780 |
++} |
1781 |
++ |
1782 |
+ /** |
1783 |
+ * ptrace_check_attach - check whether ptracee is ready for ptrace operation |
1784 |
+ * @child: ptracee to check for |
1785 |
+@@ -151,24 +185,29 @@ int ptrace_check_attach(struct task_struct *child, bool ignore_state) |
1786 |
+ * be changed by us so it's not changing right after this. |
1787 |
+ */ |
1788 |
+ read_lock(&tasklist_lock); |
1789 |
+- if ((child->ptrace & PT_PTRACED) && child->parent == current) { |
1790 |
++ if (child->ptrace && child->parent == current) { |
1791 |
++ WARN_ON(child->state == __TASK_TRACED); |
1792 |
+ /* |
1793 |
+ * child->sighand can't be NULL, release_task() |
1794 |
+ * does ptrace_unlink() before __exit_signal(). |
1795 |
+ */ |
1796 |
+- spin_lock_irq(&child->sighand->siglock); |
1797 |
+- WARN_ON_ONCE(task_is_stopped(child)); |
1798 |
+- if (ignore_state || (task_is_traced(child) && |
1799 |
+- !(child->jobctl & JOBCTL_LISTENING))) |
1800 |
++ if (ignore_state || ptrace_freeze_traced(child)) |
1801 |
+ ret = 0; |
1802 |
+- spin_unlock_irq(&child->sighand->siglock); |
1803 |
+ } |
1804 |
+ read_unlock(&tasklist_lock); |
1805 |
+ |
1806 |
+- if (!ret && !ignore_state) |
1807 |
+- ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH; |
1808 |
++ if (!ret && !ignore_state) { |
1809 |
++ if (!wait_task_inactive(child, __TASK_TRACED)) { |
1810 |
++ /* |
1811 |
++ * This can only happen if may_ptrace_stop() fails and |
1812 |
++ * ptrace_stop() changes ->state back to TASK_RUNNING, |
1813 |
++ * so we should not worry about leaking __TASK_TRACED. |
1814 |
++ */ |
1815 |
++ WARN_ON(child->state == __TASK_TRACED); |
1816 |
++ ret = -ESRCH; |
1817 |
++ } |
1818 |
++ } |
1819 |
+ |
1820 |
+- /* All systems go.. */ |
1821 |
+ return ret; |
1822 |
+ } |
1823 |
+ |
1824 |
+@@ -311,7 +350,7 @@ static int ptrace_attach(struct task_struct *task, long request, |
1825 |
+ */ |
1826 |
+ if (task_is_stopped(task) && |
1827 |
+ task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING)) |
1828 |
+- signal_wake_up(task, 1); |
1829 |
++ signal_wake_up_state(task, __TASK_STOPPED); |
1830 |
+ |
1831 |
+ spin_unlock(&task->sighand->siglock); |
1832 |
+ |
1833 |
+@@ -728,7 +767,7 @@ int ptrace_request(struct task_struct *child, long request, |
1834 |
+ * tracee into STOP. |
1835 |
+ */ |
1836 |
+ if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP))) |
1837 |
+- signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); |
1838 |
++ ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); |
1839 |
+ |
1840 |
+ unlock_task_sighand(child, &flags); |
1841 |
+ ret = 0; |
1842 |
+@@ -754,7 +793,7 @@ int ptrace_request(struct task_struct *child, long request, |
1843 |
+ * start of this trap and now. Trigger re-trap. |
1844 |
+ */ |
1845 |
+ if (child->jobctl & JOBCTL_TRAP_NOTIFY) |
1846 |
+- signal_wake_up(child, true); |
1847 |
++ ptrace_signal_wake_up(child, true); |
1848 |
+ ret = 0; |
1849 |
+ } |
1850 |
+ unlock_task_sighand(child, &flags); |
1851 |
+@@ -891,6 +930,8 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, |
1852 |
+ goto out_put_task_struct; |
1853 |
+ |
1854 |
+ ret = arch_ptrace(child, request, addr, data); |
1855 |
++ if (ret || request != PTRACE_DETACH) |
1856 |
++ ptrace_unfreeze_traced(child); |
1857 |
+ |
1858 |
+ out_put_task_struct: |
1859 |
+ put_task_struct(child); |
1860 |
+@@ -1030,8 +1071,11 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, |
1861 |
+ |
1862 |
+ ret = ptrace_check_attach(child, request == PTRACE_KILL || |
1863 |
+ request == PTRACE_INTERRUPT); |
1864 |
+- if (!ret) |
1865 |
++ if (!ret) { |
1866 |
+ ret = compat_arch_ptrace(child, request, addr, data); |
1867 |
++ if (ret || request != PTRACE_DETACH) |
1868 |
++ ptrace_unfreeze_traced(child); |
1869 |
++ } |
1870 |
+ |
1871 |
+ out_put_task_struct: |
1872 |
+ put_task_struct(child); |
1873 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
1874 |
+index 2d8927f..c529d00 100644 |
1875 |
+--- a/kernel/sched/core.c |
1876 |
++++ b/kernel/sched/core.c |
1877 |
+@@ -1497,7 +1497,8 @@ out: |
1878 |
+ */ |
1879 |
+ int wake_up_process(struct task_struct *p) |
1880 |
+ { |
1881 |
+- return try_to_wake_up(p, TASK_ALL, 0); |
1882 |
++ WARN_ON(task_is_stopped_or_traced(p)); |
1883 |
++ return try_to_wake_up(p, TASK_NORMAL, 0); |
1884 |
+ } |
1885 |
+ EXPORT_SYMBOL(wake_up_process); |
1886 |
+ |
1887 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
1888 |
+index e4d4014..57dde52 100644 |
1889 |
+--- a/kernel/signal.c |
1890 |
++++ b/kernel/signal.c |
1891 |
+@@ -679,23 +679,17 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) |
1892 |
+ * No need to set need_resched since signal event passing |
1893 |
+ * goes through ->blocked |
1894 |
+ */ |
1895 |
+-void signal_wake_up(struct task_struct *t, int resume) |
1896 |
++void signal_wake_up_state(struct task_struct *t, unsigned int state) |
1897 |
+ { |
1898 |
+- unsigned int mask; |
1899 |
+- |
1900 |
+ set_tsk_thread_flag(t, TIF_SIGPENDING); |
1901 |
+- |
1902 |
+ /* |
1903 |
+- * For SIGKILL, we want to wake it up in the stopped/traced/killable |
1904 |
++ * TASK_WAKEKILL also means wake it up in the stopped/traced/killable |
1905 |
+ * case. We don't check t->state here because there is a race with it |
1906 |
+ * executing another processor and just now entering stopped state. |
1907 |
+ * By using wake_up_state, we ensure the process will wake up and |
1908 |
+ * handle its death signal. |
1909 |
+ */ |
1910 |
+- mask = TASK_INTERRUPTIBLE; |
1911 |
+- if (resume) |
1912 |
+- mask |= TASK_WAKEKILL; |
1913 |
+- if (!wake_up_state(t, mask)) |
1914 |
++ if (!wake_up_state(t, state | TASK_INTERRUPTIBLE)) |
1915 |
+ kick_process(t); |
1916 |
+ } |
1917 |
+ |
1918 |
+@@ -843,7 +837,7 @@ static void ptrace_trap_notify(struct task_struct *t) |
1919 |
+ assert_spin_locked(&t->sighand->siglock); |
1920 |
+ |
1921 |
+ task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY); |
1922 |
+- signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); |
1923 |
++ ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); |
1924 |
+ } |
1925 |
+ |
1926 |
+ /* |
1927 |
+@@ -1798,6 +1792,10 @@ static inline int may_ptrace_stop(void) |
1928 |
+ * If SIGKILL was already sent before the caller unlocked |
1929 |
+ * ->siglock we must see ->core_state != NULL. Otherwise it |
1930 |
+ * is safe to enter schedule(). |
1931 |
++ * |
1932 |
++ * This is almost outdated, a task with the pending SIGKILL can't |
1933 |
++ * block in TASK_TRACED. But PTRACE_EVENT_EXIT can be reported |
1934 |
++ * after SIGKILL was already dequeued. |
1935 |
+ */ |
1936 |
+ if (unlikely(current->mm->core_state) && |
1937 |
+ unlikely(current->mm == current->parent->mm)) |
1938 |
+@@ -1923,6 +1921,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) |
1939 |
+ if (gstop_done) |
1940 |
+ do_notify_parent_cldstop(current, false, why); |
1941 |
+ |
1942 |
++ /* tasklist protects us from ptrace_freeze_traced() */ |
1943 |
+ __set_current_state(TASK_RUNNING); |
1944 |
+ if (clear_code) |
1945 |
+ current->exit_code = 0; |
1946 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
1947 |
+index 51b7159..356bc2f 100644 |
1948 |
+--- a/kernel/trace/ftrace.c |
1949 |
++++ b/kernel/trace/ftrace.c |
1950 |
+@@ -3998,7 +3998,7 @@ static int ftrace_module_notify(struct notifier_block *self, |
1951 |
+ |
1952 |
+ struct notifier_block ftrace_module_nb = { |
1953 |
+ .notifier_call = ftrace_module_notify, |
1954 |
+- .priority = 0, |
1955 |
++ .priority = INT_MAX, /* Run before anything that can use kprobes */ |
1956 |
+ }; |
1957 |
+ |
1958 |
+ extern unsigned long __start_mcount_loc[]; |
1959 |
+diff --git a/lib/bug.c b/lib/bug.c |
1960 |
+index a28c141..d0cdf14 100644 |
1961 |
+--- a/lib/bug.c |
1962 |
++++ b/lib/bug.c |
1963 |
+@@ -55,6 +55,7 @@ static inline unsigned long bug_addr(const struct bug_entry *bug) |
1964 |
+ } |
1965 |
+ |
1966 |
+ #ifdef CONFIG_MODULES |
1967 |
++/* Updates are protected by module mutex */ |
1968 |
+ static LIST_HEAD(module_bug_list); |
1969 |
+ |
1970 |
+ static const struct bug_entry *module_find_bug(unsigned long bugaddr) |
1971 |
+diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c |
1972 |
+index dfb2691..7dd538e 100644 |
1973 |
+--- a/security/integrity/evm/evm_crypto.c |
1974 |
++++ b/security/integrity/evm/evm_crypto.c |
1975 |
+@@ -205,9 +205,9 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, |
1976 |
+ rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM, |
1977 |
+ &xattr_data, |
1978 |
+ sizeof(xattr_data), 0); |
1979 |
+- } |
1980 |
+- else if (rc == -ENODATA) |
1981 |
++ } else if (rc == -ENODATA && inode->i_op->removexattr) { |
1982 |
+ rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM); |
1983 |
++ } |
1984 |
+ return rc; |
1985 |
+ } |
1986 |
+ |
1987 |
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
1988 |
+index 8799cf1..63a6801 100644 |
1989 |
+--- a/sound/pci/hda/patch_conexant.c |
1990 |
++++ b/sound/pci/hda/patch_conexant.c |
1991 |
+@@ -4580,6 +4580,12 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { |
1992 |
+ .patch = patch_conexant_auto }, |
1993 |
+ { .id = 0x14f15111, .name = "CX20753/4", |
1994 |
+ .patch = patch_conexant_auto }, |
1995 |
++ { .id = 0x14f15113, .name = "CX20755", |
1996 |
++ .patch = patch_conexant_auto }, |
1997 |
++ { .id = 0x14f15114, .name = "CX20756", |
1998 |
++ .patch = patch_conexant_auto }, |
1999 |
++ { .id = 0x14f15115, .name = "CX20757", |
2000 |
++ .patch = patch_conexant_auto }, |
2001 |
+ {} /* terminator */ |
2002 |
+ }; |
2003 |
+ |
2004 |
+@@ -4603,6 +4609,9 @@ MODULE_ALIAS("snd-hda-codec-id:14f150b9"); |
2005 |
+ MODULE_ALIAS("snd-hda-codec-id:14f1510f"); |
2006 |
+ MODULE_ALIAS("snd-hda-codec-id:14f15110"); |
2007 |
+ MODULE_ALIAS("snd-hda-codec-id:14f15111"); |
2008 |
++MODULE_ALIAS("snd-hda-codec-id:14f15113"); |
2009 |
++MODULE_ALIAS("snd-hda-codec-id:14f15114"); |
2010 |
++MODULE_ALIAS("snd-hda-codec-id:14f15115"); |
2011 |
+ |
2012 |
+ MODULE_LICENSE("GPL"); |
2013 |
+ MODULE_DESCRIPTION("Conexant HD-audio codec"); |
2014 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
2015 |
+index 4bbabdc..bbaf67c 100644 |
2016 |
+--- a/sound/pci/hda/patch_realtek.c |
2017 |
++++ b/sound/pci/hda/patch_realtek.c |
2018 |
+@@ -6211,6 +6211,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
2019 |
+ SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), |
2020 |
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), |
2021 |
+ SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED), |
2022 |
++ SND_PCI_QUIRK(0x103c, 0x1977, "HP Pavilion 14", ALC269_FIXUP_MIC1_MUTE_LED), |
2023 |
+ SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), |
2024 |
+ SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), |
2025 |
+ SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
2026 |
+diff --git a/tools/perf/Makefile b/tools/perf/Makefile |
2027 |
+index 0a619af..627849f 100644 |
2028 |
+--- a/tools/perf/Makefile |
2029 |
++++ b/tools/perf/Makefile |
2030 |
+@@ -58,7 +58,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ |
2031 |
+ -e s/arm.*/arm/ -e s/sa110/arm/ \ |
2032 |
+ -e s/s390x/s390/ -e s/parisc64/parisc/ \ |
2033 |
+ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ |
2034 |
+- -e s/sh[234].*/sh/ ) |
2035 |
++ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) |
2036 |
+ NO_PERF_REGS := 1 |
2037 |
+ |
2038 |
+ CC = $(CROSS_COMPILE)gcc |