All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: __mutex_lock_common() unlikely very likely
Date: Wed, 18 Jan 2017 15:58:24 -0500	[thread overview]
Message-ID: <20170118155824.689a9996@gandalf.local.home> (raw)

Chris,

My branch tracer flagged the unlikely in __mutex_lock_common() as
always hit. That's the:

	if (use_ww_ctx) {
		[...]
		if (unlikely(ww_ctx == READ_ONCE(ww->ctx)))
			return -EALREADY;
	}

This is hit 100% of the time, and its coming from the drm logic:

for example:

<stack trace>
 => drm_atomic_get_crtc_state
 => drm_atomic_helper_duplicate_state
 => intel_modeset_init
 => i915_driver_load
 => i915_pci_probe
 => local_pci_probe
 => pci_device_probe
 => driver_probe_device
 => __driver_attach
 => bus_for_each_dev
 => driver_attach
 => bus_add_driver
 => driver_register
 => __pci_register_driver
 => ext4_has_free_clusters
 => do_one_initcall
 => do_init_module
 => load_module
 => SYSC_init_module
 => SyS_init_module
 => entry_SYSCALL_64_fastpath

This is happening on 3 boxes of mine running normal loads (servers,
email, facebook, etc).

Commit 0422e83d84ae2 says:

    Recursive locking for ww_mutexes was originally conceived as an
    exception. However, it is heavily used by the DRM atomic modesetting
    code. Currently, the recursive deadlock is checked after we have queued
    up for a busy-spin and as we never release the lock, we spin until
    kicked, whereupon the deadlock is discovered and reported.

Should this be converted to a likely?

-- Steve

             reply	other threads:[~2017-01-18 21:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 20:58 Steven Rostedt [this message]
2017-01-19  8:55 ` __mutex_lock_common() unlikely very likely Chris Wilson
2017-01-19 13:32   ` Steven Rostedt
2017-01-19 13:54   ` [PATCH] mutex: Remove ww_ctx unlikely() from __mutex_lock_common() Steven Rostedt (VMware)
2017-01-19 16:42     ` Peter Zijlstra
2017-01-19 16:50       ` Steven Rostedt

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=20170118155824.689a9996@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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.