All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org,
	akash.goel@intel.com, shashidhar.hiremath@intel.com
Subject: Re: [PATCH 10/10] drm/i915: Disable use of stolen area by User when Intel RST is present
Date: Thu, 4 Feb 2016 17:43:17 +0100	[thread overview]
Message-ID: <20160204164317.GA13773@wunner.de> (raw)
In-Reply-To: <20160204160504.GE7134@nuc-i3427.alporthouse.com>

Hi,

On Thu, Feb 04, 2016 at 04:05:04PM +0000, Chris Wilson wrote:
> On Thu, Feb 04, 2016 at 04:46:55PM +0100, Lukas Wunner wrote:
> > > +	/* If the stolen region can be modified behind our backs upon suspend,
> > > +	 * then we cannot use it to store nonvolatile contents (i.e user data)
> > > +	 * as it will be corrupted upon resume.
> > > +	 */
> > > +	dev_priv->mm.nonvolatile_stolen = true;
> > > +#ifdef CONFIG_SUSPEND
> > > +	if (intel_detect_acpi_rst()) {
> > > +		/* BIOSes using RapidStart Technology have been reported
> > > +		 * to overwrite stolen across S3, not just S4.
> > > +		 */
> > > +		dev_priv->mm.nonvolatile_stolen = false;
> > > +	}
> > > +#endif
> > > +
> > 
> > I'd suggest simplifying it like this:
> > 
> > 	dev_priv->mm.nonvolatile_stolen = !(IS_ENABLED(CONFIG_SUSPEND) &&
> > 					    acpi_dev_present("INT3392"));
> 
> Using if (IS_ENABLED(CONFIG_SUSPEND) && intel_detect_acpi_rst()) would
> be better indeed. My main concern here is that we document carefully why
> we had to disable this, and to leave room for future caveats.

Yes absolutely, keep the comments. (Or meld them into one if simplifying
the code as suggested.)

> We could #define INTEL_RAPID_START "INT3392" for
> if (IS_ENABLED(CONFIG_SUSPEND) && acpi_dev_present(INTEL_RAPID_START))
> but Anki wanted to keep the acpi details themselves out of stolen (hence
> the current split).

At the very least the #ifdef needs to be replaced by IS_ENABLED,
Documentation/CodingStyle chapter 20 very clearly states this is
to be preferred.

Less code is almost always better, it's more work for a reader to
follow the logic if things are split across multiple files.

If you absolutely positively want to keep the current split,
the "static const struct acpi_device_id irst_ids[]" data structure
should be replaced by a "static const char*" in order to not waste
memory.

I'd also suggest renaming "dev_priv->mm.nonvolatile_stolen" to
"volatile_stolen" since the only user of the flag uses its negation
and its calculation requires negation as well.

Best regards,

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

  reply	other threads:[~2016-02-04 16:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04  9:30 [PATCH v16 0/10] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-02-04  9:30 ` [PATCH 01/10] drm/i915: Add support for mapping an object page by page ankitprasad.r.sharma
2016-02-11 10:50   ` Tvrtko Ursulin
2016-02-18  8:33     ` Ankitprasad Sharma
2016-02-04  9:30 ` [PATCH 02/10] drm/i915: Introduce i915_gem_object_get_dma_address() ankitprasad.r.sharma
2016-02-11 10:52   ` Tvrtko Ursulin
2016-02-04  9:30 ` [PATCH 03/10] drm/i915: Use insert_page for pwrite_fast ankitprasad.r.sharma
2016-02-04 10:49   ` kbuild test robot
2016-02-04  9:30 ` [PATCH 04/10] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2016-02-04  9:30 ` [PATCH 05/10] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2016-02-04  9:30 ` [PATCH 06/10] drm/i915: Propagating correct error codes to the userspace ankitprasad.r.sharma
2016-02-04  9:30 ` [PATCH 07/10] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2016-02-04  9:30 ` [PATCH 08/10] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2016-02-11 11:40   ` Tvrtko Ursulin
2016-02-18  8:26     ` Ankitprasad Sharma
2016-02-19  5:54     ` Ankitprasad Sharma
2016-02-04  9:30 ` [PATCH 09/10] drm/i915: Migrate stolen objects before hibernation ankitprasad.r.sharma
2016-02-04  9:30 ` [PATCH 10/10] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-02-04 15:46   ` Lukas Wunner
2016-02-04 16:05     ` Chris Wilson
2016-02-04 16:43       ` Lukas Wunner [this message]
2016-02-11 19:08         ` Lukas Wunner
2016-02-11 11:54   ` Tvrtko Ursulin
  -- strict thread matches above, loose matches on Subject: below --
2016-03-18  6:22 [PATCH v19 0/10] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-03-18  6:22 ` [PATCH 10/10] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-02-29  7:39 [PATCH v1 0/10] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-02-29  7:39 ` [PATCH 10/10] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-02-19  6:51 [PATCH v17 0/10] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-02-19  6:51 ` [PATCH 10/10] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-02-19 10:34   ` Tvrtko Ursulin
2016-01-25 19:43 [PATCH v15 0/10] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-01-25 19:43 ` [PATCH 10/10] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-01-26 11:36   ` Chris Wilson
2015-12-22  6:20 [PATCH v13 0/10] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-12-22  6:20 ` [PATCH 10/10] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2015-12-22 12:44   ` Tvrtko Ursulin
2015-12-22 13:14   ` Chris Wilson
2016-01-06  7:52   ` 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=20160204164317.GA13773@wunner.de \
    --to=lukas@wunner.de \
    --cc=akash.goel@intel.com \
    --cc=ankitprasad.r.sharma@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shashidhar.hiremath@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 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.