From: Mike Krinkin <krinkin.m.u@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: peterz@infradead.org, jason.low2@hpe.com, mingo@kernel.org,
tglx@linutronix.de, chris@chris-wilson.co.uk,
linux-kernel@vger.kernel.org
Subject: Re: Commit "locking/drm: Kill mutex trickery" causes hangs
Date: Mon, 31 Oct 2016 16:19:30 +0300 [thread overview]
Message-ID: <20161031131928.GA9699@gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.11.1610301645180.28429@eggly.anvils>
On Sun, Oct 30, 2016 at 05:09:41PM -0700, Hugh Dickins wrote:
> On Mon, 31 Oct 2016, Mike Krinkin wrote:
> >
> > i faced system hangs with recent linux-next versions, bisect points at the
> > commit 3ab7c086d5ec72585ef0 ("locking/drm: Kill mutex trickery"), bisect log
> > attached. System just hangs after few minutes when i compile kernel with -j4
> > and watch some video simultaneously.
> [...]
> > also lspci -vvv output:
> [...]
> > Kernel driver in use: i915
> > Kernel modules: i915
>
> Yes, that's hit me too, on mmotm on i915. i915_gem_shrinker_lock()
> is broken: but copy the pattern from msm_gem_shrinker_lock() and it's
> okay - patch below. Well, okay-ish: I'm reluctant to sign off on that
> as more than a quick fix for i915 linux-next users, since the unlock
> variable and those _gem_shrinker_lock() wrappers should just be deleted
> (if the mutex trickery is indeed to be killed).
>
> And I'm still left with a "sleeping function called from invalid context"
> warning, which seems easier to live with: I've not looked to see whether
> that's a consequence of the mutex trickery killage or something else.
>
> [ 12.887922] BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:956
> [ 12.887925] in_atomic(): 1, irqs_disabled(): 0, pid: 787, name: X
> [ 12.887927] 1 lock held by X/787:
> [ 12.887928] #0:
> [ 12.887929] (
> [ 12.887930] &dev->struct_mutex
> [ 12.887931] ){+.+.+.}
> [ 12.887932] , at:
> [ 12.887937] [<ffffffff813e0ccb>] i915_mutex_lock_interruptible+0x23/0x26
> [ 12.887939] Preemption disabled at:
> [ 12.887943] [<ffffffff813d67c0>] i915_gem_execbuffer_relocate_entry+0x5fb/0x70f
> [ 12.887947] CPU: 2 PID: 787 Comm: X Not tainted 4.9.0-rc2-mm1 #5
> [ 12.887948] Hardware name: LENOVO 4174EH1/4174EH1, BIOS 8CET51WW (1.31 ) 11/29/2011
> [ 12.887950] Call Trace:
> [ 12.887955] dump_stack+0x67/0x90
> [ 12.887958] ? i915_gem_execbuffer_relocate_entry+0x5fb/0x70f
> [ 12.887961] ___might_sleep+0x223/0x23a
> [ 12.887963] __might_sleep+0x6d/0x81
> [ 12.887966] __pm_runtime_resume+0x35/0x7a
> [ 12.887970] intel_runtime_pm_get+0x20/0x7f
> [ 12.887973] aliasing_gtt_bind_vma+0x4d/0xb1
> [ 12.887975] i915_vma_bind+0x67/0xbd
> [ 12.887977] i915_gem_execbuffer_relocate_entry+0xc6/0x70f
> [ 12.887981] ? _raw_spin_unlock_irq+0x27/0x45
> [ 12.887984] i915_gem_execbuffer_relocate_vma+0x128/0x1dd
> [ 12.887987] ? nommu_map_sg+0x9e/0xca
> [ 12.887990] ? __i915_vma_do_pin+0x3da/0x421
> [ 12.887994] ? i915_gem_execbuffer_reserve_vma.isra.34+0xbc/0x189
> [ 12.887996] ? i915_gem_execbuffer_reserve.isra.35+0x32f/0x3da
> [ 12.887999] i915_gem_do_execbuffer.isra.36+0x64c/0x10a9
> [ 12.888002] i915_gem_execbuffer2+0x15d/0x203
> [ 12.888005] drm_ioctl+0x25a/0x38b
> [ 12.888007] ? i915_gem_execbuffer+0x2d3/0x2d3
> [ 12.888011] vfs_ioctl+0x1c/0x33
> [ 12.888014] do_vfs_ioctl+0x5c5/0x601
> [ 12.888016] ? __fget+0x17e/0x18f
> [ 12.888019] ? expand_files+0x23e/0x23e
> [ 12.888021] SyS_ioctl+0x38/0x60
> [ 12.888023] entry_SYSCALL_64_fastpath+0x18/0xad
>
> --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> @@ -229,8 +229,9 @@ unsigned long i915_gem_shrink_all(struct
> static bool i915_gem_shrinker_lock(struct drm_device *dev, bool *unlock)
> {
> if (!mutex_trylock(&dev->struct_mutex))
> - *unlock = false;
> + return false;
>
> + *unlock = true;
> return true;
> }
Works for me, no warnings noted yet. Thank you.
>
next prev parent reply other threads:[~2016-10-31 13:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-30 22:06 Commit "locking/drm: Kill mutex trickery" causes hangs Mike Krinkin
2016-10-31 0:09 ` Hugh Dickins
2016-10-31 13:19 ` Mike Krinkin [this message]
2016-11-03 6:25 ` [tip:locking/core] locking/drm: Fix i915_gem_shrinker_lock() locking tip-bot for Ingo Molnar
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=20161031131928.GA9699@gmail.com \
--to=krinkin.m.u@gmail.com \
--cc=chris@chris-wilson.co.uk \
--cc=hughd@google.com \
--cc=jason.low2@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).