All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Dave Airlie <airlied@redhat.com>,
	Ben Skeggs <bskeggs@redhat.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Lyude Paul <lyude@redhat.com>, Lukas Wunner <lukas@wunner.de>
Subject: [PATCH 4.9 08/86] drm: Allow determining if current task is output poll worker
Date: Fri, 16 Mar 2018 16:22:31 +0100	[thread overview]
Message-ID: <20180316152317.837266563@linuxfoundation.org> (raw)
In-Reply-To: <20180316152317.167709497@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lukas Wunner <lukas@wunner.de>

commit 25c058ccaf2ebbc3e250ec1e199e161f91fe27d4 upstream.

Introduce a helper to determine if the current task is an output poll
worker.

This allows us to fix a long-standing deadlock in several DRM drivers
wherein the ->runtime_suspend callback waits for the output poll worker
to finish and the worker in turn calls a ->detect callback which waits
for runtime suspend to finish.  The ->detect callback is invoked from
multiple call sites and waiting for runtime suspend to finish is the
correct thing to do except if it's executing in the context of the
worker.

v2: Expand kerneldoc to specifically mention deadlock between
    output poll worker and autosuspend worker as use case. (Lyude)

Cc: Dave Airlie <airlied@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: https://patchwork.freedesktop.org/patch/msgid/3549ce32e7f1467102e70d3e9cbf70c46bfe108e.1518593424.git.lukas@wunner.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/drm_probe_helper.c |   20 ++++++++++++++++++++
 include/drm/drm_crtc_helper.h      |    1 +
 2 files changed, 21 insertions(+)

--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -461,6 +461,26 @@ out:
 }
 
 /**
+ * drm_kms_helper_is_poll_worker - is %current task an output poll worker?
+ *
+ * Determine if %current task is an output poll worker.  This can be used
+ * to select distinct code paths for output polling versus other contexts.
+ *
+ * One use case is to avoid a deadlock between the output poll worker and
+ * the autosuspend worker wherein the latter waits for polling to finish
+ * upon calling drm_kms_helper_poll_disable(), while the former waits for
+ * runtime suspend to finish upon calling pm_runtime_get_sync() in a
+ * connector ->detect hook.
+ */
+bool drm_kms_helper_is_poll_worker(void)
+{
+	struct work_struct *work = current_work();
+
+	return work && work->func == output_poll_execute;
+}
+EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
+
+/**
  * drm_kms_helper_poll_disable - disable output polling
  * @dev: drm_device
  *
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -74,5 +74,6 @@ extern void drm_kms_helper_hotplug_event
 extern void drm_kms_helper_poll_disable(struct drm_device *dev);
 extern void drm_kms_helper_poll_enable(struct drm_device *dev);
 extern void drm_kms_helper_poll_enable_locked(struct drm_device *dev);
+extern bool drm_kms_helper_is_poll_worker(void);
 
 #endif

  parent reply	other threads:[~2018-03-16 15:22 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16 15:22 [PATCH 4.9 00/86] 4.9.88-stable review Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 01/86] RDMA/ucma: Limit possible option size Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 02/86] RDMA/ucma: Check that user doesnt overflow QP state Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 03/86] RDMA/mlx5: Fix integer overflow while resizing CQ Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 04/86] drm/i915: Try EDID bitbanging on HDMI after failed read Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 05/86] scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS Greg Kroah-Hartman
2018-03-16 15:22   ` Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 06/86] drm/i915: Always call to intel_display_set_init_power() in resume_early Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 07/86] workqueue: Allow retrieval of current tasks work struct Greg Kroah-Hartman
2018-03-16 15:22 ` Greg Kroah-Hartman [this message]
2018-03-16 15:22 ` [PATCH 4.9 09/86] drm/nouveau: Fix deadlock on runtime suspend Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 10/86] drm/radeon: " Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 11/86] drm/amdgpu: " Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 12/86] drm/amdgpu: Notify sbios device ready before send request Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 13/86] drm/radeon: fix KV harvesting Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 14/86] drm/amdgpu: " Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 15/86] drm/amdgpu:Correct max uvd handles Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 16/86] drm/amdgpu:Always save uvd vcpu_bo in VM Mode Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 17/86] MIPS: BMIPS: Do not mask IPIs during suspend Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 18/86] MIPS: ath25: Check for kzalloc allocation failure Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 19/86] MIPS: OCTEON: irq: Check for null return on kzalloc allocation Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 20/86] Input: matrix_keypad - fix race when disabling interrupts Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 21/86] loop: Fix lost writes caused by missing flag Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 22/86] virtio_ring: fix num_free handling in error case Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 23/86] KVM: s390: fix memory overwrites when not using SCA entries Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 24/86] kbuild: Handle builtin dtb file names containing hyphens Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 25/86] IB/mlx5: Fix incorrect size of klms in the memory region Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 26/86] bcache: fix crashes in duplicate cache device register Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 27/86] bcache: dont attach backing with duplicate UUID Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 28/86] x86/MCE: Serialize sysfs changes Greg Kroah-Hartman
2018-03-16 15:22   ` [4.9,28/86] " Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 29/86] perf tools: Fix trigger class trigger_on() Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 30/86] x86/spectre_v2: Dont check microcode versions when running under hypervisors Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 31/86] ALSA: hda/realtek: Limit mic boost on T480 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 32/86] ALSA: hda/realtek - Fix dock line-out volume on Dell Precision 7520 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 33/86] ALSA: hda/realtek - Make dock sound work on ThinkPad L570 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 34/86] ALSA: seq: Dont allow resizing pool in use Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 35/86] ALSA: seq: More protection for concurrent write and ioctl races Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.9 36/86] ALSA: hda: add dock and led support for HP EliteBook 820 G3 Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 37/86] ALSA: hda: add dock and led support for HP ProBook 640 G2 Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 38/86] nospec: Kill array_index_nospec_mask_check() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 39/86] nospec: Include <asm/barrier.h> dependency Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 40/86] Revert "x86/retpoline: Simplify vmexit_fill_RSB()" Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 41/86] x86/speculation: Use IBRS if available before calling into firmware Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 42/86] x86/retpoline: Support retpoline builds with Clang Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 43/86] x86/speculation, objtool: Annotate indirect calls/jumps for objtool Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 44/86] x86/boot, objtool: Annotate indirect jump in secondary_startup_64() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 45/86] x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 46/86] x86/paravirt, objtool: Annotate indirect calls Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 47/86] watchdog: hpwdt: SMBIOS check Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 48/86] watchdog: hpwdt: Check source of NMI Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 49/86] watchdog: hpwdt: fix unused variable warning Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 50/86] watchdog: hpwdt: Remove legacy NMI sourcing Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 51/86] ARM: omap2: hide omap3_save_secure_ram on non-OMAP3 builds Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 52/86] Input: tca8418_keypad - remove double read of key event register Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 53/86] [media] tc358743: fix register i2c_rd/wr function fix Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 54/86] netfilter: add back stackpointer size checks Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 55/86] netfilter: x_tables: fix missing timer initialization in xt_LED Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 56/86] netfilter: nat: cope with negative port range Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 57/86] netfilter: IDLETIMER: be syzkaller friendly Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 58/86] netfilter: ebtables: CONFIG_COMPAT: dont trust userland offsets Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 59/86] netfilter: bridge: ebt_among: add missing match size checks Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 60/86] netfilter: ipv6: fix use-after-free Write in nf_nat_ipv6_manip_pkt Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 61/86] netfilter: x_tables: pass xt_counters struct instead of packet counter Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 62/86] netfilter: x_tables: pass xt_counters struct to counter allocator Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 63/86] netfilter: x_tables: pack percpu counter allocations Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 64/86] ext4: inplace xattr block update fails to deduplicate blocks Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 65/86] ubi: Fix race condition between ubi volume creation and udev Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 66/86] scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 67/86] NFS: Fix an incorrect type in struct nfs_direct_req Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 68/86] NFS: Fix unstable write completion Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 69/86] x86/module: Detect and skip invalid relocations Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 70/86] x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 71/86] ASoC: sgtl5000: Fix suspend/resume Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 72/86] ASoC: rt5651: Fix regcache sync errors on resume Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 73/86] serial: sh-sci: prevent lockup on full TTY buffers Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 74/86] tty/serial: atmel: add new version check for usart Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 75/86] uas: fix comparison for error code Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 76/86] staging: comedi: fix comedi_nsamples_left Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 77/86] staging: android: ashmem: Fix lockdep issue during llseek Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 78/86] USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 79/86] usbip: vudc: fix null pointer dereference on udc->lock Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 80/86] usb: quirks: add control message delay for 1b1c:1b20 Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 81/86] usb: usbmon: Read text within supplied buffer size Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 82/86] usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 83/86] serial: 8250_pci: Add Brainboxes UC-260 4 port serial device Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 84/86] serial: core: mark port as initialized in autoconfig Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 85/86] earlycon: add reg-offset to physical address before mapping Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.9 86/86] PCI: dwc: Fix enumeration end when reaching root subordinate Greg Kroah-Hartman
2018-03-16 23:20 ` [PATCH 4.9 00/86] 4.9.88-stable review kernelci.org bot
2018-03-17 10:18 ` Naresh Kamboju
2018-03-18 10:27   ` Greg Kroah-Hartman
2018-03-20 23:49     ` Ben Hutchings
2018-03-21 13:32       ` Greg Kroah-Hartman
2018-03-21 17:50         ` Naresh Kamboju
2018-03-22  8:19           ` Greg Kroah-Hartman
2018-03-22 17:47             ` Naresh Kamboju
2018-03-17 14:41 ` Guenter Roeck
2018-03-18 10:27   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180316152317.837266563@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=bskeggs@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=lyude@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.