All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: "Michał Winiarski" <michal.winiarski@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v8] drm/i915: Avoid writing relocs with addresses in non-canonical form
Date: Tue, 29 Dec 2015 17:25:36 +0000	[thread overview]
Message-ID: <20151229172536.GR31221@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1451409259-9492-1-git-send-email-michal.winiarski@intel.com>

On Tue, Dec 29, 2015 at 06:14:19PM +0100, Michał Winiarski wrote:
> According to PRM, some parts of HW require the addresses to be in
> a canonical form, where bits [63:48] == [47]. Let's convert addresses to
> canonical form prior to relocating and return converted offsets to
> userspace. We also need to make sure that userspace is using addresses
> in canonical form in case of softpin.
> 
> v2: Whitespace fixup, gen8_canonical_addr description (Chris, Ville)
> v3: Rebase on top of softpin, fix a hole in relocate_entry,
>     s/expect/require (Chris)
> v4: Handle softpin in validate_exec_list (Chris)
> v5: Convert back to canonical form at copy_to_user time (Chris)
> v6: Don't use struct exec_object2 in place of exec_object
> v7: Use sign_extend64 for converting to canonical form (Joonas),
>     reject non-canonical and non-page-aligned offset for softpin (Chris)
> v8: Convert back to non-canonical form in a function,
>     split the test for EXEC_OBJECT_PINNED (Chris)
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michel Thierry <michel.thierry@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>

I double checked that all the roundtrips between kernel<->userspace
should be idempotent, so

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Out of curiousity, you should not see any difference in runtime of
gem_exec_lut_handle.

There should also be a Testcase: and perhaps a
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92699

> +		/* Offset can be used as input (EXEC_OBJECT_PINNED), reject
> +		 * any non-page-aligned or non-canonial addresses.
                                           ^non-canonical
> +		 */
> +		if (exec[i].flags & EXEC_OBJECT_PINNED) {
> +			if (exec[i].offset !=
> +			    gen8_canonical_addr(exec[i].offset & PAGE_MASK))
> +				return -EINVAL;
> +
> +			/* From drm_mm perspective address space is continuous,
> +			 * so from this point we're always using non-canonical
> +			 * form internally.
> +			 */
> +			exec[i].offset = gen8_noncanonical_addr(exec[i].offset);
> +		}
> +
> +
  ^ extra newline
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-12-29 17:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 11:33 [PATCH] drm/i915: Avoid writing relocs with addresses in non-canonical form Michał Winiarski
2015-12-04 11:56 ` Ville Syrjälä
2015-12-04 12:05 ` Chris Wilson
2015-12-04 15:20 ` [PATCH v2] " Michał Winiarski
2015-12-04 15:39   ` Chris Wilson
2015-12-04 16:18   ` Daniel Vetter
2015-12-04 17:41     ` Winiarski, Michal
2015-12-07  8:31       ` Daniel Vetter
2015-12-10 12:50   ` Chris Wilson
2015-12-11 14:13   ` [PATCH v3] " Michał Winiarski
2015-12-11 14:43     ` Michel Thierry
2015-12-18 16:31     ` Chris Wilson
2015-12-18 20:01     ` [PATCH v4] " Michał Winiarski
2015-12-18 20:26       ` Chris Wilson
2015-12-22 11:00       ` [PATCH v5] " Michał Winiarski
2015-12-22 11:41         ` Winiarski, Michal
2015-12-22 12:37         ` [PATCH v6] " Michał Winiarski
2015-12-22 15:00           ` Chris Wilson
2015-12-29 15:49           ` [PATCH v7] " Michał Winiarski
2015-12-29 16:25             ` Chris Wilson
2015-12-29 17:14             ` [PATCH v8] " Michał Winiarski
2015-12-29 17:24               ` [PATCH v9] " Michał Winiarski
2015-12-29 17:28                 ` Chris Wilson
2016-01-05 10:01                   ` Daniel Vetter
2015-12-29 17:25               ` Chris Wilson [this message]
2015-12-19  8:20 ` ✗ warning: Fi.CI.BAT Patchwork
2015-12-22 11:13 ` Patchwork
2015-12-22 14:49 ` Patchwork
2015-12-29 16:20 ` ✗ failure: Fi.CI.BAT Patchwork
2015-12-29 17:49 ` ✗ warning: Fi.CI.BAT Patchwork

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=20151229172536.GR31221@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.winiarski@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.