From patchwork Wed Oct 3 12:03:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10624699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 795AA13BB for ; Wed, 3 Oct 2018 12:04:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FFD828952 for ; Wed, 3 Oct 2018 12:04:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5419D2896A; Wed, 3 Oct 2018 12:04:18 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 C439D28952 for ; Wed, 3 Oct 2018 12:04:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C403E6E453; Wed, 3 Oct 2018 12:04:16 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA9476E453 for ; Wed, 3 Oct 2018 12:04:13 +0000 (UTC) Received: by mail-wr1-x434.google.com with SMTP id y16so5835242wrw.3 for ; Wed, 03 Oct 2018 05:04:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zv9Gf4zVCDi7AUo2GkVMQXWSdx32+gwd1ryagOODbUU=; b=DTOJz8VBsHtR1/6EKR1D5XSzECG0jUDk6OFRXGlMqRdGuI67jbT6Fz7OKx7KUXDPss 297ksboW0dv4Ak5SIFq1Lw3cTc7z1iiliOtji0PJ71Hgur8ZSJkHJo2VYgGay1zEHDYV fMqSoFaGnb4Tiv6yXUEroS/7e46a3K+VZ3T7g5AT5D0j5lp20x4JFKZsXEzkeSNKAp9R nhPLShGu18ltlwmzZoDDny71IToW8w/8jXCAntESpzc8rGDMzxxWWUPAlJUNigffOwA7 sJB9BRD5XJ33h3QHYIWUFUEO3pZkn0GSGX+hKW23PCvQdkIODeJEXKx3og4qFczkXSeZ kzwg== X-Gm-Message-State: ABuFfoj8jwXrxWQZHLQmKUho+O+KtGKy74vtKvCji+3gcBmzTe3dGeSz 23RcMF6M9S907fttELLl5ZYgLME6tUs= X-Google-Smtp-Source: ACcGV62LnR5TdR37owd+Ix+hwiwQvNWy0drM4lOhVKXDUt3kau19QaphVATQSRG24HaaON3BrxfL2g== X-Received: by 2002:adf:ef86:: with SMTP id d6-v6mr1003293wro.204.1538568252220; Wed, 03 Oct 2018 05:04:12 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.37]) by smtp.gmail.com with ESMTPSA id f69-v6sm866657wmf.34.2018.10.03.05.04.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 05:04:11 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 3 Oct 2018 13:03:53 +0100 Message-Id: <20181003120406.6784-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [Intel-gfx] [RFC 00/13] 21st century intel_gpu_top X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin A collection of patches which I have been sending before, sometimes together and sometimes separately, which enable intel_gpu_top to report queue depths (also translates as overall GPU load average) and per DRM client per engine busyness. This enables a fancy intel_gpu_top which looks like this (a picture is worth a thousand words): intel-gpu-top - load avg 3.30, 1.51, 0.08; 949/ 949 MHz; 0% RC6; 14.66 Watts; 3605 irqs/s IMC reads: 4651 MiB/s IMC writes: 25 MiB/s ENGINE BUSY Q r R MI_SEMA MI_WAIT Render/3D/0 61.51% |█████████████████████████████████████████████▌ | 3 0 1 0% 0% Blitter/0 0.00% | | 0 0 0 0% 0% Video/0 60.86% |█████████████████████████████████████████████ | 1 0 1 0% 0% Video/1 59.04% |███████████████████████████████████████████▋ | 1 0 1 0% 0% VideoEnhance/0 0.00% | | 0 0 0 0% 0% PID NAME Render/3D/0 Blitter/0 Video/0 Video/1 VideoEnhance/0 23373 gem_wsim |█████▎ || ||████████▍ ||█████▎ || | 23374 gem_wsim |███▉ || ||██▏ ||███ || | 23375 gem_wsim |███ || ||█▍ ||███▌ || | All of this work actually came to be via different feature requests not directly asking for this. Things like engine queue depth query and per context engine busyness ioctl. Those bits need userspace which is not there yet and so I have removed them from this posting to avoid confusion. What remains is a set of patches which add some PMU counters and a completely new sysfs interface to enable intel_gpu_top to read the per client stats. IGT counterpart will be sent separately. Tvrtko Ursulin (13): drm/i915/pmu: Fix enable count array size and bounds checking drm/i915: Keep a count of requests waiting for a slot on GPU drm/i915: Keep a count of requests submitted from userspace drm/i915/pmu: Add queued counter drm/i915/pmu: Add runnable counter drm/i915/pmu: Add running counter drm/i915: Store engine backpointer in the intel_context drm/i915: Move intel_engine_context_in/out into intel_lrc.c drm/i915: Track per-context engine busyness drm/i915: Expose list of clients in sysfs drm/i915: Update client name on context create drm/i915: Expose per-engine client busyness drm/i915: Add sysfs toggle to enable per-client engine stats drivers/gpu/drm/i915/i915_drv.h | 39 +++++ drivers/gpu/drm/i915/i915_gem.c | 197 +++++++++++++++++++++++- drivers/gpu/drm/i915/i915_gem_context.c | 18 ++- drivers/gpu/drm/i915/i915_gem_context.h | 18 +++ drivers/gpu/drm/i915/i915_pmu.c | 103 +++++++++++-- drivers/gpu/drm/i915/i915_request.c | 10 ++ drivers/gpu/drm/i915/i915_sysfs.c | 81 ++++++++++ drivers/gpu/drm/i915/intel_engine_cs.c | 33 +++- drivers/gpu/drm/i915/intel_lrc.c | 109 ++++++++++++- drivers/gpu/drm/i915/intel_ringbuffer.h | 76 +++------ include/uapi/drm/i915_drm.h | 19 ++- 11 files changed, 614 insertions(+), 89 deletions(-)