intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 3/6] drm/i915: change power_well->lock to be mutex
Date: Wed, 16 Oct 2013 19:31:29 +0300	[thread overview]
Message-ID: <1381941089.22425.29.camel@intelbox> (raw)
In-Reply-To: <CA+gsUGTFVgnmBHVfyKJSDvhygfL0iGiTjd8vtUk9x0dhSWOiJw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 5132 bytes --]

On Wed, 2013-10-16 at 13:19 -0300, Paulo Zanoni wrote:
> 2013/10/16 Imre Deak <imre.deak@intel.com>:
> > There is no hard need for this to be a spin lock, as we don't take these
> > locks in irq context from anywhere. An upcoming patch will add calls to
> > punit read/write functions from within regions protected by this lock
> > and those functions need a mutex in turn. As a solution for that convert
> > the spin lock to be a mutex.
> 
> Not even from snd_hda_intel? Did we check this?

Yea, at least I tried to check this at all call sites and haven't found
any place where they request the power well in atomic context. In any
case I think it's a design problem if they do ..

--Imre

> 
> >
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h |  2 +-
> >  drivers/gpu/drm/i915/intel_pm.c | 26 +++++++++++++-------------
> >  2 files changed, 14 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index ca05f3a..e4354dd 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -910,7 +910,7 @@ struct intel_ilk_power_mgmt {
> >  /* Power well structure for haswell */
> >  struct i915_power_well {
> >         struct drm_device *device;
> > -       spinlock_t lock;
> > +       struct mutex lock;
> >         /* power well enable/disable usage count */
> >         int count;
> >         int i915_request;
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 57d08a2..f7363a8 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -5476,9 +5476,9 @@ void intel_display_power_get(struct drm_device *dev,
> >         if (is_always_on_power_domain(dev, domain))
> >                 return;
> >
> > -       spin_lock_irq(&power_well->lock);
> > +       mutex_lock(&power_well->lock);
> >         __intel_power_well_get(power_well);
> > -       spin_unlock_irq(&power_well->lock);
> > +       mutex_unlock(&power_well->lock);
> >  }
> >
> >  void intel_display_power_put(struct drm_device *dev,
> > @@ -5493,9 +5493,9 @@ void intel_display_power_put(struct drm_device *dev,
> >         if (is_always_on_power_domain(dev, domain))
> >                 return;
> >
> > -       spin_lock_irq(&power_well->lock);
> > +       mutex_lock(&power_well->lock);
> >         __intel_power_well_put(power_well);
> > -       spin_unlock_irq(&power_well->lock);
> > +       mutex_unlock(&power_well->lock);
> >  }
> >
> >  static struct i915_power_well *hsw_pwr;
> > @@ -5506,9 +5506,9 @@ void i915_request_power_well(void)
> >         if (WARN_ON(!hsw_pwr))
> >                 return;
> >
> > -       spin_lock_irq(&hsw_pwr->lock);
> > +       mutex_lock(&hsw_pwr->lock);
> >         __intel_power_well_get(hsw_pwr);
> > -       spin_unlock_irq(&hsw_pwr->lock);
> > +       mutex_unlock(&hsw_pwr->lock);
> >  }
> >  EXPORT_SYMBOL_GPL(i915_request_power_well);
> >
> > @@ -5518,9 +5518,9 @@ void i915_release_power_well(void)
> >         if (WARN_ON(!hsw_pwr))
> >                 return;
> >
> > -       spin_lock_irq(&hsw_pwr->lock);
> > +       mutex_lock(&hsw_pwr->lock);
> >         __intel_power_well_put(hsw_pwr);
> > -       spin_unlock_irq(&hsw_pwr->lock);
> > +       mutex_unlock(&hsw_pwr->lock);
> >  }
> >  EXPORT_SYMBOL_GPL(i915_release_power_well);
> >
> > @@ -5531,7 +5531,7 @@ int i915_init_power_well(struct drm_device *dev)
> >         hsw_pwr = &dev_priv->power_well;
> >
> >         hsw_pwr->device = dev;
> > -       spin_lock_init(&hsw_pwr->lock);
> > +       mutex_init(&hsw_pwr->lock);
> >         hsw_pwr->count = 0;
> >
> >         return 0;
> > @@ -5553,7 +5553,7 @@ void intel_set_power_well(struct drm_device *dev, bool enable)
> >         if (!i915_disable_power_well && !enable)
> >                 return;
> >
> > -       spin_lock_irq(&power_well->lock);
> > +       mutex_lock(&power_well->lock);
> >
> >         /*
> >          * This function will only ever contribute one
> > @@ -5572,7 +5572,7 @@ void intel_set_power_well(struct drm_device *dev, bool enable)
> >                 __intel_power_well_put(power_well);
> >
> >   out:
> > -       spin_unlock_irq(&power_well->lock);
> > +       mutex_unlock(&power_well->lock);
> >  }
> >
> >  static void intel_resume_power_well(struct drm_device *dev)
> > @@ -5583,9 +5583,9 @@ static void intel_resume_power_well(struct drm_device *dev)
> >         if (!HAS_POWER_WELL(dev))
> >                 return;
> >
> > -       spin_lock_irq(&power_well->lock);
> > +       mutex_lock(&power_well->lock);
> >         __intel_set_power_well(dev, power_well->count > 0);
> > -       spin_unlock_irq(&power_well->lock);
> > +       mutex_unlock(&power_well->lock);
> >  }
> >
> >  /*
> > --
> > 1.8.4
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

  reply	other threads:[~2013-10-16 16:31 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 14:25 [PATCH 0/6] preparation for multiple power-wells Imre Deak
2013-10-16 14:25 ` [PATCH 1/6] drm/i915: make the intel_display_power_domain enum compact Imre Deak
2013-10-18 18:48   ` Jesse Barnes
2013-10-16 14:25 ` [PATCH 2/6] drm/i915: factor out is_always_on_domain Imre Deak
2013-10-18 18:49   ` Jesse Barnes
2013-10-16 14:25 ` [PATCH 3/6] drm/i915: change power_well->lock to be mutex Imre Deak
2013-10-16 16:19   ` Paulo Zanoni
2013-10-16 16:31     ` Imre Deak [this message]
2013-10-18 18:50   ` Jesse Barnes
2013-10-19 11:02     ` Daniel Vetter
2013-10-16 14:25 ` [PATCH 4/6] drm/i915: factor out modeset_update_power_wells Imre Deak
2013-10-18 18:51   ` Jesse Barnes
2013-10-16 14:25 ` [PATCH 5/6] drm/i915: enable only the needed power domains during modeset Imre Deak
2013-10-18 18:53   ` Jesse Barnes
2013-10-22 20:07     ` Paulo Zanoni
2013-10-23  9:02       ` Imre Deak
2013-10-16 14:25 ` [PATCH 6/6] drm/i915: use power get/put instead of set for power on after init Imre Deak
2013-10-18 18:56   ` Jesse Barnes
2013-10-21 19:02   ` Daniel Vetter
2013-10-22 17:47   ` [PATCH 1/2] drm/i915: prepare for multiple power wells Imre Deak
2013-10-22 17:47     ` [PATCH v2 2/2] drm/i915: use power get/put instead of set for power on after init Imre Deak
2013-10-23 13:56     ` [PATCH 1/2] drm/i915: prepare for multiple power wells Paulo Zanoni
2013-10-23 14:46       ` Imre Deak
2013-10-25 14:36     ` [PATCH v3 0/4] " Imre Deak
2013-10-25 14:36     ` [PATCH v3 1/4] drm/i915: " Imre Deak
2013-10-25 14:36     ` [PATCH v3 2/4] drm/i915: use power get/put instead of set for power on after init Imre Deak
2013-10-25 19:31       ` Paulo Zanoni
2013-10-25 14:36     ` [PATCH v3 3/4] drm/i915: remove device field from struct power_well Imre Deak
2013-10-25 19:50       ` Paulo Zanoni
2013-10-27 19:30         ` Daniel Vetter
2013-10-28 17:41           ` Paulo Zanoni
2013-10-28 18:31             ` Imre Deak
2013-10-25 14:36     ` [PATCH v3 4/4] drm/i915: rename i915_init_power_well to i915_init_power_domains Imre Deak
2013-10-25 20:10       ` Paulo Zanoni
2013-10-27 12:44         ` Daniel Vetter
2013-10-28 15:20       ` [PATCH v4] drm/i915: rename i915_init_power_well to init_power_domains_init Imre Deak
2013-10-28 18:51         ` Paulo Zanoni
2013-10-29 17:53           ` Daniel Vetter

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=1381941089.22425.29.camel@intelbox \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=przanoni@gmail.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;
as well as URLs for NNTP newsgroup(s).