All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomas Elf <tomas.elf@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Mika Kuoppala <mika.kuoppala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org, miku@iki.fi
Subject: Re: [PATCH 15/21] drm/i915/gtt: Fill scratch page
Date: Thu, 04 Jun 2015 12:08:17 +0100	[thread overview]
Message-ID: <557031A1.9050201@intel.com> (raw)
In-Reply-To: <20150601155342.GB28531@nuc-i3427.alporthouse.com>

On 01/06/2015 16:53, Chris Wilson wrote:
> On Wed, May 27, 2015 at 07:12:02PM +0100, Tomas Elf wrote:
>> On 22/05/2015 18:05, Mika Kuoppala wrote:
>>> During review of dynamic page tables series, I was able
>>> to hit a lite restore bug with execlists. I assume that
>>> due to incorrect pd, the batch run out of legit address space
>>> and into the scratch page area. The ACTHD was increasing
>>> due to scratch being all zeroes (MI_NOOPs). And as gen8
>>> address space is quite large, the hangcheck happily waited
>>> for a long long time, keeping the process effectively stuck.
>>>
>>> According to Chris Wilson any modern gpu will grind to halt
>>> if it encounters commands of all ones. This seemed to do the
>>> trick and hang was declared promptly when the gpu wandered into
>>> the scratch land.
>>>
>>> v2: Use 0xffff00ff pattern (Chris)
>>
>> Just for my own benefit:
>>
>> 1. Is there any particular reason for this pattern rather than 0xffffffff?
>
> It is more obvious when userspace reads from the page and copies it into
> its own data structures or surfaces. See below, if this does impact
> userspace we should probably revert this patch anyway.
>
>> 2. Someone please correct me if I'm wrong here but at least based on
>> my own experiences with gen9 submitting batch buffers filled with
>> bad instructions (0xffffffff) to the GPU does not hang it. I'm
>> guessing that is because there's allegedly a hardware security
>> parser that MI_NOOPs out invalid instructions during execution. If
>> that's the case here then I guess we might have to come up with
>> something else for gen9+ if we want to induce engine hangs once the
>> execution reaches the scratch page?
>
> It's not a problem, there will be a GPU hang eventually (in theory at
> least). Mika is just trying to shortcircuit that by causing an immediate
> hang.

Interesting! Why do you think the execution would hang eventually? 
Simply because it would end up at an invalid opcode somewhere in memory 
at some point, which would trig a hang? If we're talking gen9 then I'm 
assuming that the security parser would MI_NOOP out all invalid opcodes 
before they get a chance to hang the GPU (that would certainly be the 
case with 0xffffffff and 0xffff00ff, based on my own experiments). Or 
are we assuming that at some point the execution would end up at a valid 
opcode that would still put the GPU in an arbitrary execution state that 
would take a practically infinite amount of time to complete? Such as 
executing a semaphore instruction that no thread would ever think of 
signalling?

Thanks,
Tomas

>
>> On the other hand, on gen9+ page faulting is supposedly not broken
>> anymore so maybe we don't need the scratch page to begin with there
>> so maybe it's all moot at that point? Again, if I'm making no sense
>> here feel free to set things straight, I'm very curious about how
>> all of this is supposed to work.
>
> Generating a pagefault for invalid access is an ABI change and requires
> opt-in (we have discussed context flags in the past). The most obvious
> example is the CS prefetch, which we have to prevent generating faults by
> providing guard pages (on older chipsets at least). But as we have been
> historically lax on allowing userspace to access invalid pages, we have
> to assume that userspace has been taking advantage of that.
> -Chris
>

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

  reply	other threads:[~2015-06-04 11:08 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 17:04 [PATCH 00/21] ppgtt cleanups / scratch merge (V2) Mika Kuoppala
2015-05-22 17:04 ` [PATCH 01/21] drm/i915/gtt: Mark TLBS dirty for gen8+ Mika Kuoppala
2015-06-01 14:51   ` Joonas Lahtinen
2015-06-11 17:37     ` Mika Kuoppala
2015-06-23 11:10       ` Joonas Lahtinen
2015-06-01 15:52   ` Michel Thierry
2015-05-22 17:04 ` [PATCH 02/21] drm/i915/gtt: Workaround for HW preload not flushing pdps Mika Kuoppala
2015-05-29 11:05   ` Michel Thierry
2015-05-29 12:53     ` Michel Thierry
2015-06-10 11:42       ` Michel Thierry
2015-06-11  7:31         ` Dave Gordon
2015-06-11 10:46           ` Michel Thierry
2015-06-11 13:57           ` Mika Kuoppala
2015-08-11  5:05             ` Zhiyuan Lv
2015-08-12  7:56               ` Michel Thierry
2015-08-12 15:09                 ` Dave Gordon
2015-08-13  9:36                   ` Zhiyuan Lv
2015-08-13  9:54                     ` Michel Thierry
2015-08-13  9:08                 ` Zhiyuan Lv
2015-08-13 10:12                   ` Michel Thierry
2015-08-13 11:42                     ` Dave Gordon
2015-08-13 12:03                       ` Dave Gordon
2015-08-13 14:56                         ` Zhiyuan Lv
2015-05-22 17:04 ` [PATCH 03/21] drm/i915/gtt: Check va range against vm size Mika Kuoppala
2015-06-01 15:33   ` Joonas Lahtinen
2015-06-11 14:23     ` Mika Kuoppala
2015-06-24 14:48       ` Michel Thierry
2015-05-22 17:04 ` [PATCH 04/21] drm/i915/gtt: Allow >= 4GB sizes for vm Mika Kuoppala
2015-05-26  7:15   ` Daniel Vetter
2015-06-11 17:38     ` Mika Kuoppala
2015-05-22 17:04 ` [PATCH 05/21] drm/i915/gtt: Don't leak scratch page on mapping error Mika Kuoppala
2015-06-01 15:02   ` Joonas Lahtinen
2015-06-15 10:13     ` Daniel Vetter
2015-05-22 17:04 ` [PATCH 06/21] drm/i915/gtt: Remove _single from page table allocator Mika Kuoppala
2015-06-02  9:53   ` Joonas Lahtinen
2015-06-02  9:56   ` Michel Thierry
2015-06-15 10:14     ` Daniel Vetter
2015-05-22 17:05 ` [PATCH 07/21] drm/i915/gtt: Introduce i915_page_dir_dma_addr Mika Kuoppala
2015-06-02 10:11   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 08/21] drm/i915/gtt: Introduce struct i915_page_dma Mika Kuoppala
2015-06-02 12:39   ` Michel Thierry
2015-06-11 17:48     ` Mika Kuoppala
2015-06-22 14:05       ` Michel Thierry
2015-05-22 17:05 ` [PATCH 09/21] drm/i915/gtt: Rename unmap_and_free_px to free_px Mika Kuoppala
2015-06-02 13:08   ` Michel Thierry
2015-06-11 17:48     ` Mika Kuoppala
2015-06-22 14:09       ` Michel Thierry
2015-06-22 14:43         ` Daniel Vetter
2015-05-22 17:05 ` [PATCH 10/21] drm/i915/gtt: Remove superfluous free_pd with gen6/7 Mika Kuoppala
2015-06-02 14:07   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 11/21] drm/i915/gtt: Introduce fill_page_dma() Mika Kuoppala
2015-06-02 14:51   ` Michel Thierry
2015-06-02 15:01     ` Ville Syrjälä
2015-06-15 10:16       ` Daniel Vetter
2015-06-11 17:50     ` Mika Kuoppala
2015-06-24 15:05       ` Michel Thierry
2015-05-22 17:05 ` [PATCH 12/21] drm/i915/gtt: Introduce kmap|kunmap for dma page Mika Kuoppala
2015-06-03 10:55   ` Michel Thierry
2015-06-11 17:50     ` Mika Kuoppala
2015-06-24 15:06       ` Michel Thierry
2015-05-22 17:05 ` [PATCH 13/21] drm/i915/gtt: Use macros to access dma mapped pages Mika Kuoppala
2015-06-03 10:57   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 14/21] drm/i915/gtt: Make scratch page i915_page_dma compatible Mika Kuoppala
2015-06-03 13:44   ` Michel Thierry
2015-06-11 16:30     ` Mika Kuoppala
2015-06-24 14:59       ` Michel Thierry
2015-05-22 17:05 ` [PATCH 15/21] drm/i915/gtt: Fill scratch page Mika Kuoppala
2015-05-27 18:12   ` Tomas Elf
2015-06-01 15:53     ` Chris Wilson
2015-06-04 11:08       ` Tomas Elf [this message]
2015-06-04 11:24         ` Chris Wilson
2015-06-11 16:37     ` Mika Kuoppala
2015-06-03 14:03   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 16/21] drm/i915/gtt: Pin vma during virtual address allocation Mika Kuoppala
2015-06-03 14:27   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 17/21] drm/i915/gtt: Cleanup page directory encoding Mika Kuoppala
2015-06-03 14:58   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 18/21] drm/i915/gtt: Move scratch_pd and scratch_pt into vm area Mika Kuoppala
2015-06-03 16:46   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 19/21] drm/i915/gtt: One instance of scratch page table/directory Mika Kuoppala
2015-06-03 16:57   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 20/21] drm/i915/gtt: Use nonatomic bitmap ops Mika Kuoppala
2015-06-03 17:07   ` Michel Thierry
2015-05-22 17:05 ` [PATCH 21/21] drm/i915/gtt: Reorder page alloc/free/init functions Mika Kuoppala
2015-06-03 17:14   ` Michel Thierry
2015-06-11 17:52     ` Mika Kuoppala

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=557031A1.9050201@intel.com \
    --to=tomas.elf@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    --cc=miku@iki.fi \
    /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.