From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Widawsky Subject: Re: [PATCH] drm/i915: set ctx->initialized only after RCS Date: Mon, 30 Dec 2013 13:34:46 -0800 Message-ID: <20131230213445.GA1022@bwidawsk.net> References: <1388266309-1178-1-git-send-email-benjamin.widawsky@intel.com> <20131229095926.GA6005@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail.bwidawsk.net (bwidawsk.net [166.78.191.112]) by gabe.freedesktop.org (Postfix) with ESMTP id 437AEFBA00 for ; Mon, 30 Dec 2013 13:34:51 -0800 (PST) Content-Disposition: inline In-Reply-To: <20131229095926.GA6005@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson , Ben Widawsky , Intel GFX List-Id: intel-gfx@lists.freedesktop.org On Sun, Dec 29, 2013 at 09:59:26AM +0000, Chris Wilson wrote: > On Sat, Dec 28, 2013 at 01:31:49PM -0800, Ben Widawsky wrote: > > The initialized flag is used to specify a context has been initialized > > and it's context is safe to load, ie. the 3d state is setup properly. > > With full PPGTT, we emit the address space loads during context switch > > and this currently marks a context as initialized. With full PPGTT > > patches, if a client first emits a batch to !RCS, then later, RCS, the > > code will mistake the context as initialized and try to reload an > > uninitialized context. > > > > 1. context 1 blit // context initialized > +context marked as initialised > > > 2. context 2 // saves context 1 random state > > 3. context 1 render // loads random state from step 2 > > Note that step 2 is not required since the tracking is per-ring. > This is missing an extremely important caveat which I was incorrectly correlating earlier in our discussion. Yes, step 2 is not required. The step which is required is the page allocated must be non-zero when allocated, and the contents of the page must be capable of hanging the GPU when used as a context object. Otherwise, the uninitialized context would always be all 0, which if I understand the HW correctly, is "safe" As long as you don't disagree, I'll fix the commit message with that info. > > It is really easy to hit this with a planned upcoming patch which makes > > default context reuse possible. > > > > NOTE: This should only effect full PPGTT branches, ie. current > > drm-intel-nightly. > > Though we did postulate that mesa could hit this in a pathological > scenario with a freshly created context. > > > Thanks to Chris for helping me track this down. > > > > Cc: Chris Wilson > > Signed-off-by: Ben Widawsky > Reviewed-by: Chris Wilson > -Chris > > -- > Chris Wilson, Intel Open Source Technology Centre -- Ben Widawsky, Intel Open Source Technology Center