From patchwork Tue Jan 17 15:59:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 9521447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 650CF601C3 for ; Tue, 17 Jan 2017 16:01:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52B8C28571 for ; Tue, 17 Jan 2017 16:01:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46F0A28574; Tue, 17 Jan 2017 16:01:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2E45828571 for ; Tue, 17 Jan 2017 16:01:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A00FF6E6A3; Tue, 17 Jan 2017 16:01:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id E00C16E6A3 for ; Tue, 17 Jan 2017 16:01:25 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 17 Jan 2017 08:01:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.33,245,1477983600"; d="scan'208"; a="1084048534" Received: from rosetta.fi.intel.com ([10.237.72.176]) by orsmga001.jf.intel.com with ESMTP; 17 Jan 2017 08:01:24 -0800 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id C2E20840474; Tue, 17 Jan 2017 17:59:09 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Tue, 17 Jan 2017 17:59:07 +0200 Message-Id: <1484668747-9120-7-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484668747-9120-1-git-send-email-mika.kuoppala@intel.com> References: <1484668747-9120-1-git-send-email-mika.kuoppala@intel.com> Subject: [Intel-gfx] [PATCH 7/7] drm/i915: Add comment how we treat hung contexts X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Explain in a comment how and why we treat hung context like we do. Cc: Chris Wilson Cc: Tvrtko Ursulin Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/i915_gem.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 3e10e81..7e0a0de 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2697,6 +2697,27 @@ static bool i915_gem_reset_request(struct drm_i915_gem_request *request) /* Read once and return the resolution */ const bool guilty = engine_stalled(request->engine); + /* The guilty request will get skipped on a hung engine. + * + * Users of client default context do not rely on logical + * state preserved between batches so it is safe to execute + * queued requests following the hang. Non default context + * rely on preserved state so skipping a batch loses the + * evolution of the state and it needs to be considered corrupted. + * Executing more queued batches on top of corrupted state is + * risky. But we take the risk by trying to advance through + * the queued requests in order to make the client behaviour + * more predictable around resets, by not throwing away random + * amount of batches it has prepared for execution. Sophisticated + * clients can use gem_reset_stats_ioctl and dma fence status + * to observe when it loses the context state and should + * rebuild accordingly. + * + * Context ban and ultimately the client ban mechanism are safety + * valves if a context state vs client submission ends up resulting + * nothing more than a subsequent hangs. + */ + if (guilty) { i915_gem_context_mark_guilty(request->ctx); skip_request(request);