intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: Deepak M <m.deepak@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 09/11] drm/i915: don't use a temp buffer for opregion debugfs file
Date: Mon, 14 Dec 2015 16:45:17 +0200	[thread overview]
Message-ID: <20151214144517.GN4437@intel.com> (raw)
In-Reply-To: <87lh8xt7r1.fsf@intel.com>

On Mon, Dec 14, 2015 at 04:38:58PM +0200, Jani Nikula wrote:
> On Mon, 14 Dec 2015, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Mon, Dec 14, 2015 at 12:50:53PM +0200, Jani Nikula wrote:
> >> Hasn't been necessary since
> >> 
> >> commit 115719fceaa733d646e39cdce83cc32ddb891a49
> >> Author: Williams, Dan J <dan.j.williams@intel.com>
> >> Date:   Mon Oct 12 21:12:57 2015 +0000
> >> 
> >>     i915: switch from acpi_os_ioremap to memremap
> >> 
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/i915_debugfs.c | 11 ++---------
> >>  1 file changed, 2 insertions(+), 9 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> >> index 24318b79bcfc..a9e1f18c36d1 100644
> >> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> >> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> >> @@ -1842,25 +1842,18 @@ static int i915_opregion(struct seq_file *m, void *unused)
> >>  	struct drm_device *dev = node->minor->dev;
> >>  	struct drm_i915_private *dev_priv = dev->dev_private;
> >>  	struct intel_opregion *opregion = &dev_priv->opregion;
> >> -	void *data = kmalloc(OPREGION_SIZE, GFP_KERNEL);
> >>  	int ret;
> >>  
> >> -	if (data == NULL)
> >> -		return -ENOMEM;
> >> -
> >>  	ret = mutex_lock_interruptible(&dev->struct_mutex);
> >>  	if (ret)
> >>  		goto out;
> >
> > A bit off topic, but I wonder what this locking is supposed to protect?
> 
> I thought about it when Chris mentioned locking in the next patch. Some
> opregion mailboxes do change due to driver <-> bios notifications, even
> if the VBT doesn't. Not sure if there's any chance this could lead to us
> dumping an inconsistent opregion, and if so, what difference that could
> make. So I thought better safe than sorry and just let it be.

Do we actually take struct_mutex in places where we intentionally poke
at opregion mailboxes?

The BIOS notifications could anyway be fully asynchronous no? So no way
we could protect against that, except maybe via some ACPI AML lock.

> 
> BR,
> Jani.
> 
> >
> >>  
> >> -	if (opregion->header) {
> >> -		memcpy(data, opregion->header, OPREGION_SIZE);
> >> -		seq_write(m, data, OPREGION_SIZE);
> >> -	}
> >> +	if (opregion->header)
> >> +		seq_write(m, opregion->header, OPREGION_SIZE);
> >>  
> >>  	mutex_unlock(&dev->struct_mutex);
> >>  
> >>  out:
> >> -	kfree(data);
> >>  	return 0;
> >>  }
> >>  
> >> -- 
> >> 2.1.4
> >> 
> >> _______________________________________________
> >> Intel-gfx mailing list
> >> Intel-gfx@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-12-14 14:45 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 10:50 [PATCH 00/11] drm/i915: VBT/opregion refactor to support >6 KB VBT Jani Nikula
2015-12-14 10:50 ` [PATCH 01/11] drm/i915: Add Intel opregion mailbox 5 structure Jani Nikula
2015-12-14 10:50 ` [PATCH 02/11] drm/i915: move "no VBT in opregion" quirk to intel_opregion_setup() Jani Nikula
2015-12-14 10:50 ` [PATCH 03/11] drm/i915/bios: have functions return vbt, not bdb, header pointer Jani Nikula
2015-12-14 10:50 ` [PATCH 04/11] drm/i915/bios: move debug logging about VBT source to intel_parse_bios() Jani Nikula
2015-12-15 11:14   ` [PATCH v2 " Jani Nikula
2015-12-14 10:50 ` [PATCH 05/11] drm/i915/bios: rename intel_parse_bios to intel_bios_init Jani Nikula
2015-12-14 10:50 ` [PATCH 06/11] drm/i915: refactor VBT validation Jani Nikula
2015-12-14 13:41   ` Ville Syrjälä
2015-12-14 14:34     ` Jani Nikula
2015-12-14 14:42       ` Ville Syrjälä
2015-12-15 11:16   ` [PATCH v2 " Jani Nikula
2015-12-14 10:50 ` [PATCH 07/11] drm/i915/opregion: make VBT size limit more strict Jani Nikula
2015-12-14 10:50 ` [PATCH 08/11] drm/i915/opregion: make VBT pointer a const Jani Nikula
2015-12-14 10:50 ` [PATCH 09/11] drm/i915: don't use a temp buffer for opregion debugfs file Jani Nikula
2015-12-14 13:45   ` Ville Syrjälä
2015-12-14 14:38     ` Jani Nikula
2015-12-14 14:45       ` Ville Syrjälä [this message]
2015-12-14 10:50 ` [PATCH 10/11] drm/i915/debugfs: add a separate debugfs file for VBT Jani Nikula
2015-12-14 10:57   ` Chris Wilson
2015-12-14 11:06     ` Jani Nikula
2015-12-14 11:29       ` Chris Wilson
2015-12-14 13:20   ` [PATCH v2 " Jani Nikula
2015-12-15 11:17     ` [PATCH v3 " Jani Nikula
2015-12-14 10:50 ` [PATCH 11/11] drm/i915/opregion: handle VBT sizes bigger than 6 KB Jani Nikula
2015-12-14 14:19   ` Ville Syrjälä
2015-12-14 14:34     ` Ville Syrjälä
2015-12-15 14:02       ` Ville Syrjälä
2015-12-16  9:37         ` Jani Nikula
2015-12-14 14:40     ` Jani Nikula
2015-12-15 11:18   ` [PATCH v2 " Jani Nikula
2015-12-17  7:30   ` [PATCH " Mika Kahola
2015-12-17  9:46     ` Jani Nikula

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=20151214144517.GN4437@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=m.deepak@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;
as well as URLs for NNTP newsgroup(s).