From: Greg Kroah-Hartman Date: Fri, 3 Oct 2014 20:16:26 +0000 (-0700) Subject: 3.14-stable patches X-Git-Tag: v3.16.4~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0b1ba817ea06f217fbf5694eb56a888fd5436c4;p=thirdparty%2Fkernel%2Fstable-queue.git 3.14-stable patches added patches: drm-nouveau-runpm-fix-module-unload.patch drm-radeon-px-fix-module-unload.patch perf-fix-a-race-condition-in-perf_remove_from_context.patch vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch --- diff --git a/queue-3.14/drm-nouveau-runpm-fix-module-unload.patch b/queue-3.14/drm-nouveau-runpm-fix-module-unload.patch new file mode 100644 index 00000000000..92b33df4d25 --- /dev/null +++ b/queue-3.14/drm-nouveau-runpm-fix-module-unload.patch @@ -0,0 +1,49 @@ +From 53beaa01e0fe8e4202f43485a03b32fcf5dfea74 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 12 Sep 2014 18:06:56 -0400 +Subject: drm/nouveau/runpm: fix module unload +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 53beaa01e0fe8e4202f43485a03b32fcf5dfea74 upstream. + +Use the new vga_switcheroo_fini_domain_pm_ops function +to unregister the pm ops. + +Based on a patch from: +Pali Rohár + +bug: +https://bugzilla.kernel.org/show_bug.cgi?id=84431 + +Reviewed-by: Ben Skeggs +Signed-off-by: Alex Deucher +Cc: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/nouveau_vga.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/gpu/drm/nouveau/nouveau_vga.c ++++ b/drivers/gpu/drm/nouveau/nouveau_vga.c +@@ -100,7 +100,16 @@ void + nouveau_vga_fini(struct nouveau_drm *drm) + { + struct drm_device *dev = drm->dev; ++ bool runtime = false; ++ ++ if (nouveau_runtime_pm == 1) ++ runtime = true; ++ if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) ++ runtime = true; ++ + vga_switcheroo_unregister_client(dev->pdev); ++ if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) ++ vga_switcheroo_fini_domain_pm_ops(drm->dev->dev); + vga_client_register(dev->pdev, NULL, NULL, NULL); + } + diff --git a/queue-3.14/drm-radeon-px-fix-module-unload.patch b/queue-3.14/drm-radeon-px-fix-module-unload.patch new file mode 100644 index 00000000000..d49077c3fdb --- /dev/null +++ b/queue-3.14/drm-radeon-px-fix-module-unload.patch @@ -0,0 +1,72 @@ +From 2e97140dd58cab8772bf77d73eabda213e45202d Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 12 Sep 2014 18:00:53 -0400 +Subject: drm/radeon/px: fix module unload +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 2e97140dd58cab8772bf77d73eabda213e45202d upstream. + +Use the new vga_switcheroo_fini_domain_pm_ops function +to unregister the pm ops. + +Based on a patch from: +Pali Rohár + +bug: +https://bugzilla.kernel.org/show_bug.cgi?id=84431 + +Reviewed-by: Ben Skeggs +Signed-off-by: Alex Deucher +Signed-off-by: Pali Rohár +Cc: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/radeon_device.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/radeon/radeon_device.c ++++ b/drivers/gpu/drm/radeon/radeon_device.c +@@ -1314,7 +1314,7 @@ int radeon_device_init(struct radeon_dev + + r = radeon_init(rdev); + if (r) +- return r; ++ goto failed; + + r = radeon_ib_ring_tests(rdev); + if (r) +@@ -1334,7 +1334,7 @@ int radeon_device_init(struct radeon_dev + radeon_agp_disable(rdev); + r = radeon_init(rdev); + if (r) +- return r; ++ goto failed; + } + + if ((radeon_testing & 1)) { +@@ -1356,6 +1356,11 @@ int radeon_device_init(struct radeon_dev + DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); + } + return 0; ++ ++failed: ++ if (runtime) ++ vga_switcheroo_fini_domain_pm_ops(rdev->dev); ++ return r; + } + + static void radeon_debugfs_remove_files(struct radeon_device *rdev); +@@ -1376,6 +1381,8 @@ void radeon_device_fini(struct radeon_de + radeon_bo_evict_vram(rdev); + radeon_fini(rdev); + vga_switcheroo_unregister_client(rdev->pdev); ++ if (rdev->flags & RADEON_IS_PX) ++ vga_switcheroo_fini_domain_pm_ops(rdev->dev); + vga_client_register(rdev->pdev, NULL, NULL, NULL); + if (rdev->rio_mem) + pci_iounmap(rdev->pdev, rdev->rio_mem); diff --git a/queue-3.14/perf-fix-a-race-condition-in-perf_remove_from_context.patch b/queue-3.14/perf-fix-a-race-condition-in-perf_remove_from_context.patch new file mode 100644 index 00000000000..c930e28e849 --- /dev/null +++ b/queue-3.14/perf-fix-a-race-condition-in-perf_remove_from_context.patch @@ -0,0 +1,63 @@ +From 3577af70a2ce4853d58e57d832e687d739281479 Mon Sep 17 00:00:00 2001 +From: Cong Wang +Date: Tue, 2 Sep 2014 15:27:20 -0700 +Subject: perf: Fix a race condition in perf_remove_from_context() + +From: Cong Wang + +commit 3577af70a2ce4853d58e57d832e687d739281479 upstream. + +We saw a kernel soft lockup in perf_remove_from_context(), +it looks like the `perf` process, when exiting, could not go +out of the retry loop. Meanwhile, the target process was forking +a child. So either the target process should execute the smp +function call to deactive the event (if it was running) or it should +do a context switch which deactives the event. + +It seems we optimize out a context switch in perf_event_context_sched_out(), +and what's more important, we still test an obsolete task pointer when +retrying, so no one actually would deactive that event in this situation. +Fix it directly by reloading the task pointer in perf_remove_from_context(). + +This should cure the above soft lockup. + +Signed-off-by: Cong Wang +Signed-off-by: Cong Wang +Signed-off-by: Peter Zijlstra +Cc: Paul Mackerras +Cc: Arnaldo Carvalho de Melo +Cc: Linus Torvalds +Link: http://lkml.kernel.org/r/1409696840-843-1-git-send-email-xiyou.wangcong@gmail.com +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/events/core.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -1516,6 +1516,11 @@ retry: + */ + if (ctx->is_active) { + raw_spin_unlock_irq(&ctx->lock); ++ /* ++ * Reload the task pointer, it might have been changed by ++ * a concurrent perf_event_context_sched_out(). ++ */ ++ task = ctx->task; + goto retry; + } + +@@ -1957,6 +1962,11 @@ retry: + */ + if (ctx->is_active) { + raw_spin_unlock_irq(&ctx->lock); ++ /* ++ * Reload the task pointer, it might have been changed by ++ * a concurrent perf_event_context_sched_out(). ++ */ ++ task = ctx->task; + goto retry; + } + diff --git a/queue-3.14/series b/queue-3.14/series index da42ebcb451..3aa8323ac3f 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -202,3 +202,7 @@ ib-qib-correct-reference-counting-in-debugfs-qp_stats.patch ib-mlx4-avoid-null-pointer-dereference-in-mlx4_ib_scan_netdevs.patch ib-mlx4-don-t-duplicate-the-default-roce-gid.patch ib-core-when-marshaling-uverbs-path-clear-unused-fields.patch +perf-fix-a-race-condition-in-perf_remove_from_context.patch +vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch +drm-nouveau-runpm-fix-module-unload.patch +drm-radeon-px-fix-module-unload.patch diff --git a/queue-3.14/vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch b/queue-3.14/vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch new file mode 100644 index 00000000000..817e111e6ff --- /dev/null +++ b/queue-3.14/vgaswitcheroo-add-vga_switcheroo_fini_domain_pm_ops.patch @@ -0,0 +1,61 @@ +From 766a53d059d1500c9755c8af017bd411bd8f1b20 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 12 Sep 2014 17:51:29 -0400 +Subject: vgaswitcheroo: add vga_switcheroo_fini_domain_pm_ops +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 766a53d059d1500c9755c8af017bd411bd8f1b20 upstream. + +Drivers should call this on unload to unregister pmops. + +Bug: +https://bugzilla.kernel.org/show_bug.cgi?id=84431 + +Reviewed-by: Ben Skeggs +Signed-off-by: Alex Deucher +Signed-off-by: Pali Rohár +Cc: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/vga/vga_switcheroo.c | 6 ++++++ + include/linux/vga_switcheroo.h | 2 ++ + 2 files changed, 8 insertions(+) + +--- a/drivers/gpu/vga/vga_switcheroo.c ++++ b/drivers/gpu/vga/vga_switcheroo.c +@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(st + } + EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); + ++void vga_switcheroo_fini_domain_pm_ops(struct device *dev) ++{ ++ dev->pm_domain = NULL; ++} ++EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops); ++ + static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) + { + struct pci_dev *pdev = to_pci_dev(dev); +--- a/include/linux/vga_switcheroo.h ++++ b/include/linux/vga_switcheroo.h +@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(stru + void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); + + int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); ++void vga_switcheroo_fini_domain_pm_ops(struct device *dev); + int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); + #else + +@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_cli + static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} + + static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } ++static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {} + static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } + + #endif