From patchwork Mon Feb 22 02:23:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 8370321 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC0CA9F52D for ; Mon, 22 Feb 2016 02:33:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B48B20382 for ; Mon, 22 Feb 2016 02:33:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 079CE20303 for ; Mon, 22 Feb 2016 02:33:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D93D6E046; Mon, 22 Feb 2016 02:33:24 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.bwidawsk.net (zangief.bwidawsk.net [107.170.211.233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0CAF16E053 for ; Mon, 22 Feb 2016 02:33:22 +0000 (UTC) Received: by mail.bwidawsk.net (Postfix, from userid 5001) id BF748122A61; Sun, 21 Feb 2016 18:24:10 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from gibson.kumite (67-5-174-85.ptld.qwest.net [67.5.174.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.bwidawsk.net (Postfix) with ESMTPSA id 2143A122A5E; Sun, 21 Feb 2016 18:24:04 -0800 (PST) From: Ben Widawsky To: Intel GFX Date: Sun, 21 Feb 2016 18:23:58 -0800 Message-Id: <1456107838-2265-2-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456107838-2265-1-git-send-email-ben@bwidawsk.net> References: <1456107838-2265-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 2/2] intel_gpu_top: Add param to force ring reads for busyness 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 Signed-off-by: Ben Widawsky --- man/intel_gpu_top.man | 3 +++ tools/intel_gpu_top.c | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/man/intel_gpu_top.man b/man/intel_gpu_top.man index d90a7ee..be0f1be 100644 --- a/man/intel_gpu_top.man +++ b/man/intel_gpu_top.man @@ -24,6 +24,9 @@ and output statistics to stdout. execute a command, and leave when it is finished. Note that the entire command with all parameters should be included as one parameter. .TP +.B -f +force reading of ring busyness registers on HSW (may hang system). +.TP .B -h show usage notes .SH EXAMPLES diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 33a8e0c..ab154c8 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -324,13 +324,17 @@ static uint32_t ring_read(struct ring *ring, uint32_t reg) return INREG(ring->mmio + reg); } -static void ring_init(struct ring *ring, uint32_t devid) +static void ring_init(struct ring *ring, uint32_t devid, bool ring_read_override) { ring->size = (((ring_read(ring, RING_LEN) & RING_NR_PAGES) >> 12) + 1) * 4096; if (IS_HASWELL(devid)) { - fprintf(stderr, "Skipping reads of head, and tail registers to avoid hangs\n"); - ring->skip_ring_reads = true; + if (ring_read_override) { + fprintf(stderr, "Forcing reads of head, and tail registers may cause hangs\n"); + } else { + fprintf(stderr, "Skipping reads of head, and tail registers to avoid hangs\n"); + ring->skip_ring_reads = true; + } } } @@ -417,6 +421,7 @@ usage(const char *appname) "[-e ] command to profile\n" "[-o ] output statistics to file. If file is '-'," " run in batch mode and output statistics to stdio only \n" + "[-f] force reading of ring busyness registers on HSW (may hang system)\n" "[-h] show this help screen\n" "\n", appname, @@ -451,9 +456,10 @@ int main(int argc, char **argv) int child_stat; char *cmd=NULL; int interactive=1; + bool force_reads = false; /* Parse options? */ - while ((ch = getopt(argc, argv, "s:o:e:h")) != -1) { + while ((ch = getopt(argc, argv, "s:o:e:fh")) != -1) { switch (ch) { case 'e': cmd = strdup(optarg); break; @@ -477,6 +483,9 @@ int main(int argc, char **argv) exit(1); } break; + case 'f': + force_reads = true; + break; case 'h': usage(argv[0]); exit(0); @@ -531,12 +540,12 @@ int main(int argc, char **argv) /* Grab access to the registers */ intel_register_access_init(pci_dev, 0); - ring_init(&render_ring, devid); + ring_init(&render_ring, devid, force_reads); if (IS_GEN4(devid) || IS_GEN5(devid)) - ring_init(&bsd_ring, devid); + ring_init(&bsd_ring, devid, force_reads); if (IS_GEN6(devid) || IS_GEN7(devid)) { - ring_init(&bsd6_ring, devid); - ring_init(&blt_ring, devid); + ring_init(&bsd6_ring, devid, force_reads); + ring_init(&blt_ring, devid, force_reads); } /* Initialize GPU stats */