All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Avoiding reclaim tainting from runtime-pm debug
@ 2019-04-09 17:41 Chris Wilson
  2019-04-09 18:59 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chris Wilson @ 2019-04-09 17:41 UTC (permalink / raw)
  To: intel-gfx

As intel_runtime_pm_get/_put may be called from any blockable context,
we need to avoid allowing reclaim from our mallocs, as we need to
avoid tainting any mutexes held by the callers (as they may themselves
not allow for allocations as they are taken in the shrinker).

<4> [435.339331] WARNING: possible circular locking dependency detected
<4> [435.339364] 5.1.0-rc4-CI-Trybot_4116+ #1 Tainted: G     U
<4> [435.339395] ------------------------------------------------------
<4> [435.339426] gem_caching/1334 is trying to acquire lock:
<4> [435.339456] 000000004505c39b (wakeref#3){+.+.}, at: intel_engine_pm_put+0x1b/0x40 [i915]
<4> [435.339788]
but task is already holding lock:
<4> [435.339819] 00000000ee77b4ed (fs_reclaim){+.+.}, at: fs_reclaim_acquire.part.24+0x0/0x30
<4> [435.339879]
which lock already depends on the new lock.

<4> [435.339918]
the existing dependency chain (in reverse order) is:
<4> [435.339952]
-> #1 (fs_reclaim){+.+.}:
<4> [435.339998]        fs_reclaim_acquire.part.24+0x24/0x30
<4> [435.340035]        kmem_cache_alloc_trace+0x2a/0x290
<4> [435.340311]        __print_intel_runtime_pm_wakeref+0x24/0x160 [i915]
<4> [435.340590]        untrack_intel_runtime_pm_wakeref+0x16e/0x1d0 [i915]
<4> [435.340869]        intel_runtime_pm_put_unchecked+0xd/0x30 [i915]
<4> [435.341147]        __intel_wakeref_put_once+0x22/0x40 [i915]
<4> [435.341508]        i915_request_retire+0x477/0xaf0 [i915]
<4> [435.341871]        ring_retire_requests+0x86/0x160 [i915]
<4> [435.342226]        i915_retire_requests+0x58/0xc0 [i915]
<4> [435.342576]        retire_work_handler+0x5b/0x70 [i915]
<4> [435.342615]        process_one_work+0x245/0x610
<4> [435.342646]        worker_thread+0x37/0x380
<4> [435.342679]        kthread+0x119/0x130
<4> [435.342714]        ret_from_fork+0x3a/0x50
<4> [435.342739]
-> #0 (wakeref#3){+.+.}:
<4> [435.342788]        lock_acquire+0xa6/0x1c0
<4> [435.342822]        __mutex_lock+0x8c/0x960
<4> [435.342853]        atomic_dec_and_mutex_lock+0x33/0x50
<4> [435.343151]        intel_engine_pm_put+0x1b/0x40 [i915]
<4> [435.343501]        i915_request_retire+0x477/0xaf0 [i915]
<4> [435.343851]        ring_retire_requests+0x86/0x160 [i915]
<4> [435.344202]        i915_retire_requests+0x58/0xc0 [i915]
<4> [435.344543]        i915_gem_shrink+0xd8/0x5b0 [i915]
<4> [435.344835]        i915_drop_caches_set+0x17b/0x250 [i915]
<4> [435.344877]        simple_attr_write+0xb0/0xd0
<4> [435.344911]        full_proxy_write+0x51/0x80
<4> [435.344943]        vfs_write+0xbd/0x1b0
<4> [435.344972]        ksys_write+0x55/0xe0
<4> [435.345002]        do_syscall_64+0x55/0x190
<4> [435.345040]        entry_SYSCALL_64_after_hwframe+0x49/0xbe

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index e6d1e592225b..3107a742d8ad 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -162,7 +162,7 @@ static void cancel_intel_runtime_pm_wakeref(struct drm_i915_private *i915,
 		 rpm->debug.count, atomic_read(&rpm->wakeref_count))) {
 		char *buf;
 
-		buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+		buf = kmalloc(PAGE_SIZE, GFP_NOWAIT | __GFP_NOWARN);
 		if (!buf)
 			return;
 
@@ -198,7 +198,7 @@ __print_intel_runtime_pm_wakeref(struct drm_printer *p,
 	unsigned long i;
 	char *buf;
 
-	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+	buf = kmalloc(PAGE_SIZE, GFP_NOWAIT | __GFP_NOWARN);
 	if (!buf)
 		return;
 
@@ -282,7 +282,9 @@ void print_intel_runtime_pm_wakeref(struct drm_i915_private *i915,
 		if (dbg.count <= alloc)
 			break;
 
-		s = krealloc(dbg.owners, dbg.count * sizeof(*s), GFP_KERNEL);
+		s = krealloc(dbg.owners,
+			     dbg.count * sizeof(*s),
+			     GFP_NOWAIT | __GFP_NOWARN);
 		if (!s)
 			goto out;
 
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Avoiding reclaim tainting from runtime-pm debug
  2019-04-09 17:41 [PATCH] drm/i915: Avoiding reclaim tainting from runtime-pm debug Chris Wilson
@ 2019-04-09 18:59 ` Patchwork
  2019-04-09 19:23 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2019-04-09 18:59 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Avoiding reclaim tainting from runtime-pm debug
URL   : https://patchwork.freedesktop.org/series/59242/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
8a7f63e2f75d drm/i915: Avoiding reclaim tainting from runtime-pm debug
-:15: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#15: 
<4> [435.339456] 000000004505c39b (wakeref#3){+.+.}, at: intel_engine_pm_put+0x1b/0x40 [i915]

total: 0 errors, 1 warnings, 0 checks, 26 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Avoiding reclaim tainting from runtime-pm debug
  2019-04-09 17:41 [PATCH] drm/i915: Avoiding reclaim tainting from runtime-pm debug Chris Wilson
  2019-04-09 18:59 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2019-04-09 19:23 ` Patchwork
  2019-04-10  8:41 ` ✓ Fi.CI.IGT: " Patchwork
  2019-04-11 13:13 ` [PATCH] " Mika Kuoppala
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2019-04-09 19:23 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Avoiding reclaim tainting from runtime-pm debug
URL   : https://patchwork.freedesktop.org/series/59242/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5897 -> Patchwork_12744
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/59242/revisions/1/mbox/

Known issues
------------

  Here are the changes found in Patchwork_12744 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_cs_nop@sync-fork-compute0:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109315] +17

  * igt@gem_exec_basic@gtt-bsd1:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109276] +7

  * igt@gem_exec_parse@basic-rejected:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109289] +1

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-6770hq:      PASS -> FAIL [fdo#108511]

  * igt@i915_selftest@live_contexts:
    - fi-icl-u3:          NOTRUN -> DMESG-FAIL [fdo#108569]

  * igt@kms_busy@basic-flip-a:
    - fi-bsw-n3050:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@kms_busy@basic-flip-c:
    - fi-blb-e6850:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_chamelium@hdmi-crc-fast:
    - fi-bsw-n3050:       NOTRUN -> SKIP [fdo#109271] +62

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109284] +8

  * igt@kms_force_connector_basic@prune-stale-modes:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109285] +3

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u3:          NOTRUN -> FAIL [fdo#103167]

  * igt@kms_pipe_crc_basic@hang-read-crc-pipe-c:
    - fi-blb-e6850:       NOTRUN -> SKIP [fdo#109271] +48

  * igt@runner@aborted:
    - fi-glk-dsi:         NOTRUN -> FAIL [k.org#202321]

  
#### Possible fixes ####

  * igt@gem_ctx_exec@basic:
    - fi-icl-u3:          INCOMPLETE [fdo#107713] -> PASS

  * igt@gem_exec_suspend@basic-s4-devices:
    - fi-blb-e6850:       INCOMPLETE [fdo#107718] -> PASS

  * igt@i915_selftest@live_contexts:
    - fi-skl-gvtdvm:      DMESG-FAIL [fdo#110235 ] -> PASS

  
#### Warnings ####

  * igt@i915_pm_rpm@module-reload:
    - fi-glk-dsi:         INCOMPLETE [fdo#103359] / [k.org#198133] -> DMESG-WARN [fdo#105538] / [fdo#107732] / [fdo#109513]

  
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#105538]: https://bugs.freedesktop.org/show_bug.cgi?id=105538
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#107732]: https://bugs.freedesktop.org/show_bug.cgi?id=107732
  [fdo#108511]: https://bugs.freedesktop.org/show_bug.cgi?id=108511
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109513]: https://bugs.freedesktop.org/show_bug.cgi?id=109513
  [fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235 
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133
  [k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321


Participating hosts (44 -> 40)
------------------------------

  Additional (1): fi-bsw-n3050 
  Missing    (5): fi-byt-squawks fi-bsw-cyan fi-apl-guc fi-icl-y fi-bdw-samus 


Build changes
-------------

    * Linux: CI_DRM_5897 -> Patchwork_12744

  CI_DRM_5897: 7d07e025e78603d6270bc115fdb6c1efea6e66a5 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4934: dc4f45eb6874331daec870dc1e4cfc3ac5c49311 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12744: 8a7f63e2f75d2923a70f5e2f4e4734013e60a68a @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

8a7f63e2f75d drm/i915: Avoiding reclaim tainting from runtime-pm debug

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12744/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Avoiding reclaim tainting from runtime-pm debug
  2019-04-09 17:41 [PATCH] drm/i915: Avoiding reclaim tainting from runtime-pm debug Chris Wilson
  2019-04-09 18:59 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
  2019-04-09 19:23 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2019-04-10  8:41 ` Patchwork
  2019-04-11 13:13 ` [PATCH] " Mika Kuoppala
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2019-04-10  8:41 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Avoiding reclaim tainting from runtime-pm debug
URL   : https://patchwork.freedesktop.org/series/59242/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5897_full -> Patchwork_12744_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Known issues
------------

  Here are the changes found in Patchwork_12744_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_pm_rpm@system-suspend-modeset:
    - shard-skl:          PASS -> INCOMPLETE [fdo#104108] / [fdo#107807]

  * igt@kms_atomic_transition@1x-modeset-transitions-nonblocking:
    - shard-apl:          NOTRUN -> FAIL [fdo#109660] +1

  * igt@kms_busy@extended-modeset-hang-newfb-render-e:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +13

  * igt@kms_content_protection@legacy:
    - shard-apl:          NOTRUN -> FAIL [fdo#110321] / [fdo#110336]

  * igt@kms_cursor_crc@cursor-64x21-random:
    - shard-glk:          NOTRUN -> FAIL [fdo#103232]

  * igt@kms_cursor_legacy@pipe-c-single-move:
    - shard-apl:          NOTRUN -> INCOMPLETE [fdo#103927]

  * igt@kms_flip@flip-vs-expired-vblank-interruptible:
    - shard-skl:          PASS -> FAIL [fdo#105363]
    - shard-glk:          PASS -> FAIL [fdo#102887] / [fdo#105363]

  * igt@kms_flip@flip-vs-suspend:
    - shard-snb:          PASS -> INCOMPLETE [fdo#105411]

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-blt:
    - shard-skl:          NOTRUN -> SKIP [fdo#109271] +172

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-indfb-plflip-blt:
    - shard-skl:          PASS -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-blt:
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] +7

  * igt@kms_lease@atomic_implicit_crtc:
    - shard-apl:          NOTRUN -> FAIL [fdo#110279]

  * igt@kms_panel_fitting@legacy:
    - shard-skl:          NOTRUN -> FAIL [fdo#105456]

  * igt@kms_pipe_crc_basic@read-crc-pipe-d:
    - shard-skl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +13

  * igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
    - shard-glk:          PASS -> SKIP [fdo#109271]

  * igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
    - shard-skl:          NOTRUN -> FAIL [fdo#107815] / [fdo#108145] +1

  * igt@kms_plane_alpha_blend@pipe-a-alpha-basic:
    - shard-apl:          NOTRUN -> FAIL [fdo#108145] +2

  * igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
    - shard-skl:          NOTRUN -> FAIL [fdo#108145] +1

  * igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
    - shard-skl:          PASS -> FAIL [fdo#108145]

  * igt@kms_plane_scaling@pipe-b-scaler-with-clipping-clamping:
    - shard-glk:          PASS -> SKIP [fdo#109271] / [fdo#109278] +1

  * igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
    - shard-kbl:          PASS -> DMESG-FAIL [fdo#105763]

  * igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
    - shard-apl:          NOTRUN -> FAIL [fdo#104894]

  * igt@kms_vblank@pipe-b-ts-continuation-suspend:
    - shard-skl:          PASS -> INCOMPLETE [fdo#104108] / [fdo#107773]

  * igt@prime_vgem@sync-bsd1:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] +164

  
#### Possible fixes ####

  * igt@i915_pm_rpm@system-suspend-execbuf:
    - shard-glk:          DMESG-WARN [fdo#109513] -> PASS

  * igt@kms_cursor_crc@cursor-64x64-suspend:
    - shard-kbl:          DMESG-WARN [fdo#108566] -> PASS

  * igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
    - shard-glk:          FAIL [fdo#102887] -> PASS

  * igt@kms_flip@flip-vs-expired-vblank:
    - shard-skl:          FAIL [fdo#105363] -> PASS

  * igt@kms_plane@pixel-format-pipe-c-planes:
    - shard-glk:          SKIP [fdo#109271] -> PASS

  * igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
    - shard-skl:          FAIL [fdo#107815] -> PASS

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-kbl:          FAIL [fdo#109016] -> PASS

  
#### Warnings ####

  * igt@kms_rotation_crc@multiplane-rotation:
    - shard-kbl:          FAIL [fdo#109016] -> DMESG-FAIL [fdo#105763]

  * igt@runner@aborted:
    - shard-glk:          ( 2 FAIL ) [fdo#109373] / [k.org#202321] -> FAIL [fdo#109373] / [k.org#202321]

  
  [fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
  [fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
  [fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#105456]: https://bugs.freedesktop.org/show_bug.cgi?id=105456
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#107773]: https://bugs.freedesktop.org/show_bug.cgi?id=107773
  [fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
  [fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109373]: https://bugs.freedesktop.org/show_bug.cgi?id=109373
  [fdo#109513]: https://bugs.freedesktop.org/show_bug.cgi?id=109513
  [fdo#109660]: https://bugs.freedesktop.org/show_bug.cgi?id=109660
  [fdo#110279]: https://bugs.freedesktop.org/show_bug.cgi?id=110279
  [fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
  [fdo#110336]: https://bugs.freedesktop.org/show_bug.cgi?id=110336
  [k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321


Participating hosts (10 -> 8)
------------------------------

  Missing    (2): shard-hsw shard-iclb 


Build changes
-------------

    * Linux: CI_DRM_5897 -> Patchwork_12744

  CI_DRM_5897: 7d07e025e78603d6270bc115fdb6c1efea6e66a5 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4934: dc4f45eb6874331daec870dc1e4cfc3ac5c49311 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12744: 8a7f63e2f75d2923a70f5e2f4e4734013e60a68a @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12744/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: Avoiding reclaim tainting from runtime-pm debug
  2019-04-09 17:41 [PATCH] drm/i915: Avoiding reclaim tainting from runtime-pm debug Chris Wilson
                   ` (2 preceding siblings ...)
  2019-04-10  8:41 ` ✓ Fi.CI.IGT: " Patchwork
@ 2019-04-11 13:13 ` Mika Kuoppala
  3 siblings, 0 replies; 5+ messages in thread
From: Mika Kuoppala @ 2019-04-11 13:13 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

Chris Wilson <chris@chris-wilson.co.uk> writes:

> As intel_runtime_pm_get/_put may be called from any blockable context,
> we need to avoid allowing reclaim from our mallocs, as we need to
> avoid tainting any mutexes held by the callers (as they may themselves
> not allow for allocations as they are taken in the shrinker).
>
> <4> [435.339331] WARNING: possible circular locking dependency detected
> <4> [435.339364] 5.1.0-rc4-CI-Trybot_4116+ #1 Tainted: G     U
> <4> [435.339395] ------------------------------------------------------
> <4> [435.339426] gem_caching/1334 is trying to acquire lock:
> <4> [435.339456] 000000004505c39b (wakeref#3){+.+.}, at: intel_engine_pm_put+0x1b/0x40 [i915]
> <4> [435.339788]
> but task is already holding lock:
> <4> [435.339819] 00000000ee77b4ed (fs_reclaim){+.+.}, at: fs_reclaim_acquire.part.24+0x0/0x30
> <4> [435.339879]
> which lock already depends on the new lock.
>
> <4> [435.339918]
> the existing dependency chain (in reverse order) is:
> <4> [435.339952]
> -> #1 (fs_reclaim){+.+.}:
> <4> [435.339998]        fs_reclaim_acquire.part.24+0x24/0x30
> <4> [435.340035]        kmem_cache_alloc_trace+0x2a/0x290
> <4> [435.340311]        __print_intel_runtime_pm_wakeref+0x24/0x160 [i915]
> <4> [435.340590]        untrack_intel_runtime_pm_wakeref+0x16e/0x1d0 [i915]
> <4> [435.340869]        intel_runtime_pm_put_unchecked+0xd/0x30 [i915]
> <4> [435.341147]        __intel_wakeref_put_once+0x22/0x40 [i915]
> <4> [435.341508]        i915_request_retire+0x477/0xaf0 [i915]
> <4> [435.341871]        ring_retire_requests+0x86/0x160 [i915]
> <4> [435.342226]        i915_retire_requests+0x58/0xc0 [i915]
> <4> [435.342576]        retire_work_handler+0x5b/0x70 [i915]
> <4> [435.342615]        process_one_work+0x245/0x610
> <4> [435.342646]        worker_thread+0x37/0x380
> <4> [435.342679]        kthread+0x119/0x130
> <4> [435.342714]        ret_from_fork+0x3a/0x50
> <4> [435.342739]
> -> #0 (wakeref#3){+.+.}:
> <4> [435.342788]        lock_acquire+0xa6/0x1c0
> <4> [435.342822]        __mutex_lock+0x8c/0x960
> <4> [435.342853]        atomic_dec_and_mutex_lock+0x33/0x50
> <4> [435.343151]        intel_engine_pm_put+0x1b/0x40 [i915]
> <4> [435.343501]        i915_request_retire+0x477/0xaf0 [i915]
> <4> [435.343851]        ring_retire_requests+0x86/0x160 [i915]
> <4> [435.344202]        i915_retire_requests+0x58/0xc0 [i915]
> <4> [435.344543]        i915_gem_shrink+0xd8/0x5b0 [i915]
> <4> [435.344835]        i915_drop_caches_set+0x17b/0x250 [i915]
> <4> [435.344877]        simple_attr_write+0xb0/0xd0
> <4> [435.344911]        full_proxy_write+0x51/0x80
> <4> [435.344943]        vfs_write+0xbd/0x1b0
> <4> [435.344972]        ksys_write+0x55/0xe0
> <4> [435.345002]        do_syscall_64+0x55/0x190
> <4> [435.345040]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index e6d1e592225b..3107a742d8ad 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -162,7 +162,7 @@ static void cancel_intel_runtime_pm_wakeref(struct drm_i915_private *i915,
>  		 rpm->debug.count, atomic_read(&rpm->wakeref_count))) {
>  		char *buf;
>  
> -		buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
> +		buf = kmalloc(PAGE_SIZE, GFP_NOWAIT | __GFP_NOWARN);
>  		if (!buf)
>  			return;

Ok we then just give up on printing the stack so no harm done
even if we increase our chances to fail the alloc. And there will
be a log entry apriori to indicate the unmatch regardless.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

>  
> @@ -198,7 +198,7 @@ __print_intel_runtime_pm_wakeref(struct drm_printer *p,
>  	unsigned long i;
>  	char *buf;
>  
> -	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
> +	buf = kmalloc(PAGE_SIZE, GFP_NOWAIT | __GFP_NOWARN);
>  	if (!buf)
>  		return;
>  
> @@ -282,7 +282,9 @@ void print_intel_runtime_pm_wakeref(struct drm_i915_private *i915,
>  		if (dbg.count <= alloc)
>  			break;
>  
> -		s = krealloc(dbg.owners, dbg.count * sizeof(*s), GFP_KERNEL);
> +		s = krealloc(dbg.owners,
> +			     dbg.count * sizeof(*s),
> +			     GFP_NOWAIT | __GFP_NOWARN);
>  		if (!s)
>  			goto out;
>  
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-11 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 17:41 [PATCH] drm/i915: Avoiding reclaim tainting from runtime-pm debug Chris Wilson
2019-04-09 18:59 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-04-09 19:23 ` ✓ Fi.CI.BAT: success " Patchwork
2019-04-10  8:41 ` ✓ Fi.CI.IGT: " Patchwork
2019-04-11 13:13 ` [PATCH] " Mika Kuoppala

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.