From patchwork Thu Jan 18 10:41:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10172847 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 CD45B60230 for ; Thu, 18 Jan 2018 10:42:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBDAA26255 for ; Thu, 18 Jan 2018 10:42:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B03942625B; Thu, 18 Jan 2018 10:42:33 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 CEBBE269B2 for ; Thu, 18 Jan 2018 10:41:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D20106E528; Thu, 18 Jan 2018 10:41:58 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 659E16E51A for ; Thu, 18 Jan 2018 10:41:51 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id v123so21867044wmd.5 for ; Thu, 18 Jan 2018 02:41:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6ff6PX6m086ueGMfYfNXbxXFzx1vQmlFL3LiWl4OpIk=; b=exGFcvyOY1lEYGG93uC7b2KBFoJV0AezJAgRdaC2gMTQfaOb4FXwFSlpBb03l1YQgL Sw4Q0/DUbyE8R76Z0Z/AB91QyuJNAx4qECDeDrjmoZ3gloWA2YCg9CNM7StSE18GUGbA uSaVY3b4b38eg7jv9OBZXizwBoLK0rxiIFGvqh42viXNp3QV1pWD+gk+FwKZEzMw1xjZ +A0nBqElSeJ6O1BNieMvF6DnEJ6/9IQsUvlk8BAUD6NIU0sCRSGNTbhWflhHckt4ARCX v8XltejPK/Uu04OlgceXjTt81CHjw3nHnkeDhvglNymHaFSfuwJeUU7HPhTOq8gVYs20 +FpQ== 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:in-reply-to :references; bh=6ff6PX6m086ueGMfYfNXbxXFzx1vQmlFL3LiWl4OpIk=; b=VM07rhzeiLmQDF0SabUdDt4enjyOB5UK6olbeyRxpZftWN5cDDKGCOimeNUpzM+skr +fmPZumeRH3Airg8Guki1RzbJZQ+9jEIj41Znr9ID7+oB+8eWcbcxnnKT/7gy7siYuJ+ hlWqPP7SLyC/B5TSFkh+GvBHzUg7zwlBEbp+IQOT0c2nTlzAIVmXHpgJrE7rj4rSoAnE +pxhlSfB4XpJe/D4TqhnnLmjYvPNHuTlRhsw8yTGPhIdwbIncTrohdrymWxaBHnip0lf u1/2z1rXCRcSyjUvnroJTE1o9cgSBOWGt6o7ll/3YxBFx0NzoS2Ie+EQoy5ODANRblKD swVA== X-Gm-Message-State: AKwxytdvZ51t4FIoaPt5KZAxGMl+LNgh7JNASRK+tSQTH+xV+aOnidM9 VbcbvkzlDRGVNO0YPvvQm4VsjW0A X-Google-Smtp-Source: ACJfBovNjJUJcLnPp2yfajy6s7mLWbfnMHCz1hEAHPeBMqM3Y0mwBtDtm/xYemuVZiO4t2sfkGl+ow== X-Received: by 10.28.154.195 with SMTP id c186mr5115646wme.82.1516272109838; Thu, 18 Jan 2018 02:41:49 -0800 (PST) Received: from localhost.localdomain ([95.146.148.3]) by smtp.gmail.com with ESMTPSA id w7sm5379239wra.90.2018.01.18.02.41.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 02:41:49 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 18 Jan 2018 10:41:35 +0000 Message-Id: <20180118104136.32174-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180118104136.32174-1-tvrtko.ursulin@linux.intel.com> References: <20180118104136.32174-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [RFC 5/6] drm/i915/pmu: Add submitted counter 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 From: Tvrtko Ursulin We add a PMU counter to expose the number of requests currently submitted to the driver which are not yet runnable on the GPU (unresolved dependencies or unsignalled fences). This is useful to analyze the overall load of the system. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_pmu.c | 14 ++++++++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +- include/uapi/drm/i915_drm.h | 7 ++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index aaf48e85c35e..d6d08cca2bc8 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -37,7 +37,8 @@ (BIT(I915_SAMPLE_BUSY) | \ BIT(I915_SAMPLE_WAIT) | \ BIT(I915_SAMPLE_SEMA) | \ - BIT(I915_SAMPLE_QUEUED)) + BIT(I915_SAMPLE_QUEUED) | \ + BIT(I915_SAMPLE_SUBMITTED)) #define ENGINE_SAMPLE_BITS (1 << I915_PMU_SAMPLE_BITS) @@ -226,6 +227,11 @@ static void engines_sample(struct drm_i915_private *dev_priv) update_sample(&engine->pmu.sample[I915_SAMPLE_QUEUED], 1 / I915_SAMPLE_QUEUED_SCALE, engine->queued); + + if (engine->pmu.enable & BIT(I915_SAMPLE_SUBMITTED)) + update_sample(&engine->pmu.sample[I915_SAMPLE_SUBMITTED], + 1 / I915_SAMPLE_SUBMITTED_SCALE, + atomic_read(&engine->submitted)); } if (fw) @@ -304,6 +310,7 @@ engine_event_status(struct intel_engine_cs *engine, case I915_SAMPLE_BUSY: case I915_SAMPLE_WAIT: case I915_SAMPLE_QUEUED: + case I915_SAMPLE_SUBMITTED: break; case I915_SAMPLE_SEMA: if (INTEL_GEN(engine->i915) < 6) @@ -415,7 +422,8 @@ static u64 __i915_pmu_event_read(struct perf_event *event) val = engine->pmu.sample[sample].cur; } - if (sample == I915_SAMPLE_QUEUED) + if (sample == I915_SAMPLE_QUEUED || + sample == I915_SAMPLE_SUBMITTED) val = div_u64(val, FREQUENCY); } else { switch (event->attr.config) { @@ -790,6 +798,8 @@ create_event_attributes(struct drm_i915_private *i915) __engine_event(I915_SAMPLE_WAIT, "wait"), __engine_event_scale(I915_SAMPLE_QUEUED, "queued", __stringify(I915_SAMPLE_QUEUED_SCALE)), + __engine_event_scale(I915_SAMPLE_SUBMITTED, "submitted", + __stringify(I915_SAMPLE_SUBMITTED_SCALE)), }; unsigned int count = 0; struct perf_pmu_events_attr *pmu_attr = NULL, *pmu_iter; diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 84541b91bcd8..01355fc24d1e 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -379,7 +379,7 @@ struct intel_engine_cs { * * Our internal timer stores the current counters in this field. */ -#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_QUEUED + 1) +#define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_SUBMITTED + 1) struct i915_pmu_sample sample[I915_ENGINE_SAMPLE_MAX]; /** * @busy_stats: Has enablement of engine stats tracking been diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 83458e5b1ac7..3285027a6ce0 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -111,10 +111,12 @@ enum drm_i915_pmu_engine_sample { I915_SAMPLE_BUSY = 0, I915_SAMPLE_WAIT = 1, I915_SAMPLE_SEMA = 2, - I915_SAMPLE_QUEUED = 3 + I915_SAMPLE_QUEUED = 3, + I915_SAMPLE_SUBMITTED = 4, }; #define I915_SAMPLE_QUEUED_SCALE 1e-2 /* No braces please. */ +#define I915_SAMPLE_SUBMITTED_SCALE 1e-2 /* No braces please. */ #define I915_PMU_SAMPLE_BITS (4) #define I915_PMU_SAMPLE_MASK (0xf) @@ -139,6 +141,9 @@ enum drm_i915_pmu_engine_sample { #define I915_PMU_ENGINE_QUEUED(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_QUEUED) +#define I915_PMU_ENGINE_SUBMITTED(class, instance) \ + __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SUBMITTED) + #define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) #define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)