Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81DAFC10DCE for ; Wed, 18 Mar 2020 14:15:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58B7C20772 for ; Wed, 18 Mar 2020 14:15:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58B7C20772 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A5C76E903; Wed, 18 Mar 2020 14:15:38 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id E519D6E903 for ; Wed, 18 Mar 2020 14:15:36 +0000 (UTC) IronPort-SDR: 2LajPnjqX5G1++g8SlREmW7w3WLYKrEpafUYZHWxptwSsdlG89FYhc3vtQqcKg8i5x/GjR1NQq L2XX62gRdUzw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 07:15:36 -0700 IronPort-SDR: reQaaOTiAdBDKe6Jz4OKTe85mWK/j/V/mBTCNx/5TjfdfvGVefnTdsdCEm14KPq0NWY15dBnMT RbdHRou/XVaw== X-IronPort-AV: E=Sophos;i="5.70,567,1574150400"; d="scan'208";a="238618879" Received: from unknown (HELO [10.214.196.8]) ([10.214.196.8]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 07:15:34 -0700 To: Chris Wilson , Intel-gfx@lists.freedesktop.org References: <20200318121138.909-1-tvrtko.ursulin@linux.intel.com> <20200318121138.909-9-tvrtko.ursulin@linux.intel.com> <158454005479.6873.4857418466512127070@build.alporthouse.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: Date: Wed, 18 Mar 2020 14:15:31 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <158454005479.6873.4857418466512127070@build.alporthouse.com> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 08/10] drm/i915: Expose per-engine client busyness X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 18/03/2020 14:00, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2020-03-18 12:11:37) >> +static u64 >> +pphwsp_busy_add(struct i915_gem_context *ctx, unsigned int class) >> +{ >> + struct i915_gem_engines *engines = rcu_dereference(ctx->engines); >> + struct i915_gem_engines_iter it; >> + struct intel_context *ce; >> + u64 total = 0; >> + >> + for_each_gem_engine(ce, engines, it) { >> + if (ce->engine->uabi_class == class) >> + total += ce->runtime.total; >> + } >> + >> + return total; >> +} >> + >> +static ssize_t >> +show_client_busy(struct device *kdev, struct device_attribute *attr, char *buf) >> +{ >> + struct i915_engine_busy_attribute *i915_attr = >> + container_of(attr, typeof(*i915_attr), attr); >> + unsigned int class = i915_attr->engine_class; >> + struct i915_drm_client *client = i915_attr->client; >> + u64 total = atomic64_read(&client->past_runtime[class]); >> + struct list_head *list = &client->ctx_list; >> + struct i915_gem_context *ctx; >> + >> + rcu_read_lock(); >> + list_for_each_entry_rcu(ctx, list, client_link) { >> + total += atomic64_read(&ctx->past_runtime[class]); >> + total += pphwsp_busy_add(ctx, class); > > Hmm. I would like to have some GEM context agnosticism here. At the > moment, all I have to offer is > > struct client_runtime { > struct list_head client_link; > atomic64_t past_runtime; > u64 (*cur_runtime)(struct client_runtime *); > }; What exactly do you mean here? Who keeps a list and of what and what does the vfunc do? Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx