public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: sedat.dilek@gmail.com
Cc: "Hans de Goede" <hdegoede@redhat.com>,
	"Aaron Lu" <aaron.lu@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Zhang Rui" <rui.zhang@intel.com>, "Len Brown" <lenb@kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Linux ACPI" <linux-acpi@vger.kernel.org>,
	intel-gfx <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] ACPI / video: Fix circular lock dependency issue in the video-detect code
Date: Fri, 14 Aug 2015 12:16:37 +0200	[thread overview]
Message-ID: <1673005.imgGpLoWeL@vostro.rjw.lan> (raw)
In-Reply-To: <CA+icZUXusiLBN0LishXE1GUZ+TYrDmzyoJ4QnoQ1JokjyxphDw@mail.gmail.com>

On Friday, August 14, 2015 11:36:41 AM Sedat Dilek wrote:
> On Fri, Aug 14, 2015 at 11:39 AM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > On Thursday, August 13, 2015 10:39:08 PM Sedat Dilek wrote:
> >>
> >> --f46d04447e7fc2306e051d3753a5
> >> Content-Type: text/plain; charset=UTF-8
> >>
> >> On Thu, Aug 13, 2015 at 6:53 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> >> > Before this commit, the following would happen:
> >> >
> >> > a) acpi_video_get_backlight_type() gets called
> >> > b) acpi_video_get_backlight_type() calls acpi_video_init_backlight_type()
> >> > c) acpi_video_init_backlight_type() locks its function static init_mutex
> >> > d) acpi_video_init_backlight_type() calls backlight_register_notifier()
> >> > e) backlight_register_notifier() takes its notifier-chain lock
> >> >
> >> > And when the backlight notifier chain gets called we've:
> >> >
> >> > 1) blocking_notifier_call_chain() gets called
> >> > 2) blocking_notifier_call_chain() takes the notifier-chain lock
> >> > 3) blocking_notifier_call_chain() calls acpi_video_backlight_notify()
> >> > 4) acpi_video_backlight_notify() calls acpi_video_get_backlight_type()
> >> > 5) acpi_video_get_backlight_type() calls acpi_video_init_backlight_type()
> >> > 6) acpi_video_init_backlight_type() locks its function static init_mutex
> >> >
> >> > So in the first call sequence we have:
> >> >
> >> > a) init_mutex gets locked
> >> > b) notifier-chain gets locked
> >> >
> >> > and in the second call sequence we have:
> >> >
> >> > 1) notifier-chain gets locked
> >> > 2) init_mutex gets locked
> >> >
> >> > And we've a circular locking dependency. This specific locking dependency
> >> > is fixable without using the big hammer otherwise known as a workqueue,
> >> > but further analysis shows a similar problem with the backlight notifier
> >> > chain lock vs register_count_mutex from drivers/acpi/acpi_video.c,
> >> > and fixing that becomes problematic.
> >> >
> >> > So this commit simply fixes this with the big hammer, performance
> >> > wise this is a non issue as we expect the work to get scheduled
> >> > exactly zero or one times during normal system use.
> >> >
> >>
> >> This patch on top of Linux v4.2-rc6 fixes the issue for me.
> >>
> >> Feel free to add my...
> >>
> >>    Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> >>    Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> >
> > Applied, thanks!
> >
> 
> Thanks for carrying this one.
> Isn't this a for-4.2/acpi-video-fixes?

I have no branch like that.

> Why did you apply this in your linux-next Git branch?

Because that's what I do normally with patches I'm going to push to Linus.

Thanks,
Rafael


  reply	other threads:[~2015-08-14  9:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 16:53 [PATCH] ACPI / video: Fix circular lock dependency issue in the video-detect code Hans de Goede
2015-08-13 20:39 ` Sedat Dilek
2015-08-14  9:39   ` Rafael J. Wysocki
2015-08-14  9:36     ` Sedat Dilek
2015-08-14 10:16       ` Rafael J. Wysocki [this message]
2015-08-14  9:57         ` Sedat Dilek

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=1673005.imgGpLoWeL@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=aaron.lu@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sedat.dilek@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=ville.syrjala@linux.intel.com \
    /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