From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 9EF72C43603 for ; Fri, 20 Dec 2019 07:56:30 +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 7AC8920716 for ; Fri, 20 Dec 2019 07:56:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AC8920716 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 E15886EBE2; Fri, 20 Dec 2019 07:56:29 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id B066B6EBE3 for ; Fri, 20 Dec 2019 07:56:28 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 23:56:28 -0800 X-IronPort-AV: E=Sophos;i="5.69,335,1571727600"; d="scan'208";a="210741088" Received: from dtriolet-mobl1.ger.corp.intel.com (HELO [10.251.84.191]) ([10.251.84.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 19 Dec 2019 23:56:26 -0800 To: Chris Wilson , Intel-gfx@lists.freedesktop.org References: <20191219180019.25562-1-tvrtko.ursulin@linux.intel.com> <20191219180019.25562-4-tvrtko.ursulin@linux.intel.com> <157678851938.6469.1830542116916640880@skylake-alporthouse-com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: <88c3d8a8-0a37-036a-5c79-845d3157ecf4@linux.intel.com> Date: Fri, 20 Dec 2019 07:56:25 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <157678851938.6469.1830542116916640880@skylake-alporthouse-com> Content-Language: en-US Subject: Re: [Intel-gfx] [RFC 3/8] drm/i915: Expose list of clients in sysfs 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 19/12/2019 20:48, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2019-12-19 18:00:14) >> From: Tvrtko Ursulin >> >> Expose a list of clients with open file handles in sysfs. >> >> This will be a basis for a top-like utility showing per-client and per- >> engine GPU load. >> >> Currently we only expose each client's pid and name under opaque numbered >> directories in /sys/class/drm/card0/clients/. >> >> For instance: >> >> /sys/class/drm/card0/clients/3/name: Xorg >> /sys/class/drm/card0/clients/3/pid: 5664 >> >> v2: >> Chris Wilson: >> * Enclose new members into dedicated structs. >> * Protect against failed sysfs registration. >> >> v3: >> * sysfs_attr_init. >> >> v4: >> * Fix for internal clients. >> >> v5: >> * Use cyclic ida for client id. (Chris) >> * Do not leak pid reference. (Chris) >> * Tidy code with some locals. >> >> v6: >> * Use xa_alloc_cyclic to simplify locking. (Chris) >> * No need to unregister individial sysfs files. (Chris) >> * Rebase on top of fpriv kref. >> * Track client closed status and reflect in sysfs. >> >> Signed-off-by: Tvrtko Ursulin >> --- >> drivers/gpu/drm/i915/i915_drv.h | 20 +++++ >> drivers/gpu/drm/i915/i915_gem.c | 133 ++++++++++++++++++++++++++++-- >> drivers/gpu/drm/i915/i915_sysfs.c | 8 ++ >> 3 files changed, 155 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h >> index 6f13f0c619e9..e1d8361aafd7 100644 >> --- a/drivers/gpu/drm/i915/i915_drv.h >> +++ b/drivers/gpu/drm/i915/i915_drv.h >> @@ -188,6 +188,7 @@ struct i915_hotplug { >> struct drm_i915_private; >> struct i915_mm_struct; >> struct i915_mmu_object; >> +struct i915_drm_clients; >> >> struct drm_i915_file_private { >> struct kref kref; >> @@ -226,6 +227,19 @@ struct drm_i915_file_private { >> /** ban_score: Accumulated score of all ctx bans and fast hangs. */ >> atomic_t ban_score; >> unsigned long hang_timestamp; >> + >> + struct i915_drm_client { > > I agree with the distinction here between drm_client and > gem_client. (This concept will be required beyond GEM.) So you think I should keep the i915_drm_client naming for these bits throughout? >> + unsigned int id; >> + struct pid *pid; >> + char *name; >> + bool closed; >> + >> + struct kobject *root; >> + struct { >> + struct device_attribute pid; >> + struct device_attribute name; >> + } attr; >> + } client; >> }; >> >> /* Interface history: >> @@ -1280,6 +1294,12 @@ struct drm_i915_private { >> >> struct i915_pmu pmu; >> >> + struct i915_drm_clients { >> + struct xarray xarray; >> + >> + struct kobject *root; >> + } clients; > > You might as well pull this out into i915_drm_client.[ch] > Actually make that into a please. :) Np. Maybe next year though. :) Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx