From patchwork Mon Jan 22 09:53:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10178023 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 9F74260224 for ; Mon, 22 Jan 2018 09:53:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 925BA27F88 for ; Mon, 22 Jan 2018 09:53:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8468D27FA3; Mon, 22 Jan 2018 09:53:32 +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.2 required=2.0 tests=BAYES_00, 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 1548F27F88 for ; Mon, 22 Jan 2018 09:53:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 735FE6E0EA; Mon, 22 Jan 2018 09:53:31 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 691B26E0EA for ; Mon, 22 Jan 2018 09:53:30 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 01:53:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,396,1511856000"; d="scan'208";a="23629878" Received: from tursulin-mobl.ger.corp.intel.com (HELO [10.252.22.76]) ([10.252.22.76]) by fmsmga004.fm.intel.com with ESMTP; 22 Jan 2018 01:53:27 -0800 To: Chris Wilson , Tvrtko Ursulin , Intel-gfx@lists.freedesktop.org References: <20180119134528.4720-1-tvrtko.ursulin@linux.intel.com> <20180119134528.4720-3-tvrtko.ursulin@linux.intel.com> <151639610152.29369.4625279817495176727@mail.alporthouse.com> From: Tvrtko Ursulin Message-ID: Date: Mon, 22 Jan 2018 09:53:27 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <151639610152.29369.4625279817495176727@mail.alporthouse.com> Content-Language: en-GB Cc: gordon.kelly@intel.com Subject: Re: [Intel-gfx] [PATCH 2/6] drm/i915: Allow clients to query own per-engine 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP On 19/01/2018 21:08, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2018-01-19 13:45:24) >> + case I915_CONTEXT_GET_ENGINE_BUSY: >> + engine = intel_engine_lookup_user(i915, args->class, >> + args->instance); >> + if (!engine) { >> + ret = -EINVAL; >> + break; >> + } >> + >> + ce = &ctx->engine[engine->id]; >> + if (!READ_ONCE(ce->stats.enabled)) { >> + ret = i915_mutex_lock_interruptible(dev); >> + if (!ret) >> + break; >> + >> + if (!ce->stats.enabled) { >> + ret = intel_enable_engine_stats(engine); > > * Blink. > > This caught me by surprise. (Other than struct_mutex) Not too offensive, > but surprising. At the very least call out to a function to handle the > request. Where did args->class, args->instance come from? You surely > didn't extend the ioctl struct just for that? Haven't extended it no, just did this: Tvrtko --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -1468,7 +1468,16 @@ struct drm_i915_gem_context_param { #define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */ #define I915_CONTEXT_DEFAULT_PRIORITY 0 #define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */ - __u64 value; +#define I915_CONTEXT_GET_ENGINE_BUSY 0x7 + union { + __u64 value; + struct { + __u8 pad[6]; /* unused */ + + __u8 class; + __u8 instance; + }; + }; }; Regards,