From patchwork Mon Aug 7 12:36:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9885285 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 80C80603B4 for ; Mon, 7 Aug 2017 12:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71EE0285DA for ; Mon, 7 Aug 2017 12:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66C592867B; Mon, 7 Aug 2017 12:36:57 +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 2BA84285DA for ; Mon, 7 Aug 2017 12:36:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 980B76E521; Mon, 7 Aug 2017 12:36:55 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id D33D96E507 for ; Mon, 7 Aug 2017 12:36:53 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 8147965-1500050 for multiple; Mon, 07 Aug 2017 13:36:38 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Mon, 07 Aug 2017 13:36:40 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 7 Aug 2017 13:36:36 +0100 Message-Id: <20170807123636.24907-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170807123636.24907-1-chris@chris-wilson.co.uk> References: <20170807123636.24907-1-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Cc: daniel.vetter@ffwll.ch Subject: [Intel-gfx] [PATCH igt 2/2] lib: Remove illegal instructions from hang injection 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 The idea behind using an illegal instruction was to hang the GPU must faster than simply using the recursive batch. However, we stopped doing so on gen8+ as the CS parser was much laxer and allowed the illegal command through but still interpreted the packet length (jumping over the recursive batch buffer start that followed). Sandybridge doesn't just hang the GPU when it encounters an illegal command on the BLT engine, it hangs the machine. That goes above and beyond testing our hangcheck + reset, so remove the deadly instructions. Signed-off-by: Chris Wilson Reviewed-by: Mika Kuoppala --- lib/igt_gt.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/lib/igt_gt.c b/lib/igt_gt.c index 6f7daa5e..d5e8b557 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -270,30 +270,15 @@ igt_hang_t igt_hang_ctx(int fd, memset(b, 0xc5, sizeof(b)); - /* - * We emit invalid command to provoke a gpu hang. - * If that doesn't work, we do bb start loop. - * Note that the bb start aligment is illegal due this. - * But hey, we are here to hang the gpu so whatever works. - * We skip 0xfffffff on gen9 as it confuses hw in an such a way that - * it will skip over the bb start, causing runaway head and - * thus much slower hang detection. - */ len = 2; - if (intel_gen(intel_get_drm_devid(fd)) >= 8) { - b[0] = MI_NOOP; + if (intel_gen(intel_get_drm_devid(fd)) >= 8) len++; - } else { - b[0] = 0xffffffff; - } - - b[1] = MI_BATCH_BUFFER_START | (len - 2); - b[1+len] = MI_BATCH_BUFFER_END; - b[2+len] = MI_NOOP; + b[0] = MI_BATCH_BUFFER_START | (len - 2); + b[len] = MI_BATCH_BUFFER_END; + b[len+1] = MI_NOOP; gem_write(fd, exec.handle, 0, b, sizeof(b)); - reloc.offset = 8; - reloc.delta = 4; + reloc.offset = sizeof(uint32_t); reloc.target_handle = exec.handle; reloc.read_domains = I915_GEM_DOMAIN_COMMAND;