Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp555329pxb; Wed, 6 Oct 2021 10:23:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6I2ceATFW91hwpgYzCaxE0xKQ1C2dINPu3b8A7JpRSDJT4FKRoBkF7uZQ/de1ENMs0x7s X-Received: by 2002:a62:29c7:0:b0:424:e840:47ef with SMTP id p190-20020a6229c7000000b00424e84047efmr37939157pfp.72.1633541004671; Wed, 06 Oct 2021 10:23:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633541004; cv=none; d=google.com; s=arc-20160816; b=z36lPyeSnFVRcLX/AMEhRTQxQaDO26uVqR5d8tVHyZvsTelvdGbPPPKCryTT+4qdq4 BVO6F/5weB/AYSI7xQrvZeaosOUkozikWhIang6mH/rBaCNXQF54/UrxbdAJZ64sCc7D bZkbVrlpeShDpOANV9JKXUhGFb3a9jLJ35c1j3DmbwsdUOB/ivTt+z1r3hIAR0muFopW oW/GXQCl5Tidgr5p8gNy5O31Fjz8irY2zzpHFuAK95aXDDZP1bwvbwKBUoTu951/w/PZ lKy25sQdJfJvfX2G5ri3HFfHKHdvARPzCP2BzOPXgtXfKmzwa0XqVvy2pOD4/gekRl1x G13g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=NMywna8Bb2zH+axHijA23cmz6C32aHpzL6JKEscWvLQ=; b=i4C2a246Z5XYsSlV7IvxcqdaE9nMtmbO8iVXNKah/qBsnMiqI9D/OXts2DzCkg+nNQ HbqT4u/iZT3y2BQP3oDOLWi1vFQi8NhHb6/c+tlxPseQD/HFeq4/zs70Sq/SEJyq/1GF CYq+1IsucqVGI4ArEYsP7rNvBGMTzSroJ97EhSCDVbGdw9LNsd//sSL1RpafbXIHY8a7 WErpk6WRbSppUvUTmeogHmCXtZxYhu8VlqUOL1LiVZ/fULeTTut5J7NEchFMFqa4DUhR g3VhHS5pCOF0BZgkkZjpBGV7dux5SJqCO5uw7IX/xu0MFZZKsFCOkFyO5NAfJ8GRObeH OhJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si3179720plg.171.2021.10.06.10.23.11; Wed, 06 Oct 2021 10:23:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238378AbhJFRXZ (ORCPT + 99 others); Wed, 6 Oct 2021 13:23:25 -0400 Received: from mga01.intel.com ([192.55.52.88]:20573 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231624AbhJFRXY (ORCPT ); Wed, 6 Oct 2021 13:23:24 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10129"; a="249336865" X-IronPort-AV: E=Sophos;i="5.85,352,1624345200"; d="scan'208";a="249336865" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2021 10:17:17 -0700 X-IronPort-AV: E=Sophos;i="5.85,352,1624345200"; d="scan'208";a="439196358" Received: from jons-linux-dev-box.fm.intel.com (HELO jons-linux-dev-box) ([10.1.27.20]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2021 10:17:16 -0700 Date: Wed, 6 Oct 2021 10:12:29 -0700 From: Matthew Brost To: Tvrtko Ursulin Cc: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tvrtko Ursulin , Daniele Ceraolo Spurio Subject: Re: [RFC 6/8] drm/i915: Make some recently added vfuncs use full scheduling attribute Message-ID: <20211006171228.GA7906@jons-linux-dev-box> References: <20211004143650.699120-1-tvrtko.ursulin@linux.intel.com> <20211004143650.699120-7-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211004143650.699120-7-tvrtko.ursulin@linux.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 04, 2021 at 03:36:48PM +0100, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin > > Code added in 71ed60112d5d ("drm/i915: Add kick_backend function to > i915_sched_engine") and ee242ca704d3 ("drm/i915/guc: Implement GuC > priority management") introduced some scheduling related vfuncs which > take integer request priority as argument. > > Make them instead take struct i915_sched_attr, which is the type > encapsulating this information, so it probably aligns with the design > better. It definitely enables extending the set of scheduling attributes. > Understand the motivation here but the i915_scheduler is going to disapear when we move to the DRM scheduler or at least its functionality of priority inheritance will be pushed into the DRM scheduler. I'd be very careful making any changes here as the priority in the DRM scheduler is defined as single enum: /* These are often used as an (initial) index * to an array, and as such should start at 0. */ enum drm_sched_priority { DRM_SCHED_PRIORITY_MIN, DRM_SCHED_PRIORITY_NORMAL, DRM_SCHED_PRIORITY_HIGH, DRM_SCHED_PRIORITY_KERNEL, DRM_SCHED_PRIORITY_COUNT, DRM_SCHED_PRIORITY_UNSET = -2 }; Adding a field to the i915_sched_attr is fairly easy as we already have a structure but changing the DRM scheduler might be a tougher sell. Anyway you can make this work without adding the 'nice' field to i915_sched_attr? Might be worth exploring so when we move to the DRM scheduler this feature drops in a little cleaner. Matt > Signed-off-by: Tvrtko Ursulin > Cc: Matthew Brost > Cc: Daniele Ceraolo Spurio > --- > drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 4 +++- > drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 ++- > drivers/gpu/drm/i915/i915_scheduler.c | 4 ++-- > drivers/gpu/drm/i915/i915_scheduler_types.h | 4 ++-- > 4 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c > index 7147fe80919e..e91d803a6453 100644 > --- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c > +++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c > @@ -3216,11 +3216,13 @@ static bool can_preempt(struct intel_engine_cs *engine) > return engine->class != RENDER_CLASS; > } > > -static void kick_execlists(const struct i915_request *rq, int prio) > +static void kick_execlists(const struct i915_request *rq, > + const struct i915_sched_attr *attr) > { > struct intel_engine_cs *engine = rq->engine; > struct i915_sched_engine *sched_engine = engine->sched_engine; > const struct i915_request *inflight; > + const int prio = attr->priority; > > /* > * We only need to kick the tasklet once for the high priority > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > index ba0de35f6323..b5883a4365ca 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > @@ -2414,9 +2414,10 @@ static void guc_init_breadcrumbs(struct intel_engine_cs *engine) > } > > static void guc_bump_inflight_request_prio(struct i915_request *rq, > - int prio) > + const struct i915_sched_attr *attr) > { > struct intel_context *ce = rq->context; > + const int prio = attr->priority; > u8 new_guc_prio = map_i915_prio_to_guc_prio(prio); > > /* Short circuit function */ > diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c > index 762127dd56c5..534bab99fcdc 100644 > --- a/drivers/gpu/drm/i915/i915_scheduler.c > +++ b/drivers/gpu/drm/i915/i915_scheduler.c > @@ -255,7 +255,7 @@ static void __i915_schedule(struct i915_sched_node *node, > > /* Must be called before changing the nodes priority */ > if (sched_engine->bump_inflight_request_prio) > - sched_engine->bump_inflight_request_prio(from, prio); > + sched_engine->bump_inflight_request_prio(from, attr); > > WRITE_ONCE(node->attr.priority, prio); > > @@ -280,7 +280,7 @@ static void __i915_schedule(struct i915_sched_node *node, > > /* Defer (tasklet) submission until after all of our updates. */ > if (sched_engine->kick_backend) > - sched_engine->kick_backend(node_to_request(node), prio); > + sched_engine->kick_backend(node_to_request(node), attr); > } > > spin_unlock(&sched_engine->lock); > diff --git a/drivers/gpu/drm/i915/i915_scheduler_types.h b/drivers/gpu/drm/i915/i915_scheduler_types.h > index b0a1b58c7893..24b9ac1c2ce2 100644 > --- a/drivers/gpu/drm/i915/i915_scheduler_types.h > +++ b/drivers/gpu/drm/i915/i915_scheduler_types.h > @@ -177,13 +177,13 @@ struct i915_sched_engine { > * @kick_backend: kick backend after a request's priority has changed > */ > void (*kick_backend)(const struct i915_request *rq, > - int prio); > + const struct i915_sched_attr *attr); > > /** > * @bump_inflight_request_prio: update priority of an inflight request > */ > void (*bump_inflight_request_prio)(struct i915_request *rq, > - int prio); > + const struct i915_sched_attr *attr); > > /** > * @retire_inflight_request_prio: indicate request is retired to > -- > 2.30.2 >