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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BFB30C2BBCA for ; Wed, 26 Jun 2024 00:29:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBC8510E134; Wed, 26 Jun 2024 00:29:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="KX54YDCx"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id DFEF910E134 for ; Wed, 26 Jun 2024 00:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719361787; x=1750897787; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=KoMYjkNREObQL09Pl7NHLat0zx2FSMzeiGkXpL+FfZE=; b=KX54YDCx4Re7uww8u2bxturb+4gtFA5hCFgu3IRoXnIhQl4Gk+cYovef pbAHmzVCYjjwthLIp7q58iIEAt5FVLfjEBvElbY6+g+RdPHDUh8BkA0Ac pGhO8lk4mlJVY84ibrJxVDUAXxzDhXoAe6+KJGy0709s350N+Hox1Nrch uZ5ehxvLG9kFreQ+hJ5v0kBYedLzWYd6PrlDp5jSdcB8Zg3HRpyJ0zDGA z9lMQkYbldV21XpIGcneLit6lYD4NBL9J3Tte+kf7wwcRt5v+BFieAp+x aNI82kt/Yvg4nMYne3PGiBkLQIFfY5/Ejd/hX1wvznokdbNwbvvP9/HP9 Q==; X-CSE-ConnectionGUID: 674XJnagRuSQcOgMqQyQpw== X-CSE-MsgGUID: utKe1xGSRKiZLdjXXfnLEw== X-IronPort-AV: E=McAfee;i="6700,10204,11114"; a="16287518" X-IronPort-AV: E=Sophos;i="6.08,265,1712646000"; d="scan'208";a="16287518" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 17:29:46 -0700 X-CSE-ConnectionGUID: IcgiXtM2SRWAO6cDKyImMA== X-CSE-MsgGUID: Uw8VEboiSPm3tA9tLITzkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,265,1712646000"; d="scan'208";a="43795617" Received: from tlhardin-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.125.225.168]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 17:29:46 -0700 Date: Tue, 25 Jun 2024 17:24:59 -0700 Message-ID: <87le2sh7ok.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Matthew Brost , Umesh Nerlige Ramappa Cc: intel-xe@lists.freedesktop.org, Lionel Landwerlin , Jose Souza Subject: Re: [PATCH 2/3] drm/xe: Exec queue op's to enable/disable preemption and timeslicing In-Reply-To: References: <20240625201518.766925-1-ashutosh.dixit@intel.com> <20240625201518.766925-3-ashutosh.dixit@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Tue, 25 Jun 2024 15:01:16 -0700, Matthew Brost wrote: > > On Tue, Jun 25, 2024 at 02:57:15PM -0700, Umesh Nerlige Ramappa wrote: > > On Tue, Jun 25, 2024 at 01:15:17PM -0700, Ashutosh Dixit wrote: > > > +static int guc_exec_queue_set_no_preempt(struct xe_exec_queue *q) > > > +{ > > > + struct xe_sched_msg *msg; > > > + > > > + if ((!q->sched_props.preempt_timeout_us && !q->sched_props.timeslice_us) || > > > + exec_queue_killed_or_banned_or_wedged(q)) > > > + return 0; > > > + > > > + msg = kmalloc(sizeof(*msg), GFP_KERNEL); > > > + if (!msg) > > > + return -ENOMEM; > > > + > > > + /* Setting values to 0 will disable preemption and timeslicing */ > > > + q->sched_props.preempt_timeout_us = 0; > > > + q->sched_props.timeslice_us = 0; > > > + > > > + guc_exec_queue_add_msg(q, msg, SET_SCHED_PROPS); > > > + > > > + return 0; > > > +} > > > + > > > +static int guc_exec_queue_clear_no_preempt(struct xe_exec_queue *q) > > > +{ > > > + struct xe_sched_msg *msg; > > > + > > > + if ((q->sched_props.preempt_timeout_us == > > > + q->hwe->eclass->sched_props.preempt_timeout_us && > > > + q->sched_props.timeslice_us == q->hwe->eclass->sched_props.timeslice_us) || > > > + exec_queue_killed_or_banned_or_wedged(q)) > > > + return 0; > > > + > > > + msg = kmalloc(sizeof(*msg), GFP_KERNEL); > > > + if (!msg) > > > + return -ENOMEM; > > > + > > > + q->sched_props.preempt_timeout_us = q->hwe->eclass->sched_props.preempt_timeout_us; > > > + q->sched_props.timeslice_us = q->hwe->eclass->sched_props.timeslice_us; > > > + > > > + guc_exec_queue_add_msg(q, msg, SET_SCHED_PROPS); > > > + > > > + return 0; > > > +} > > > > Why not just use the .set_timeslice and .set_preempt_timeout hooks instead > > of defining a new one to do both? > > > Umesh's thinking seems correct. > > Just use the existing set_timeslice & set_preempt_timeout hooks with 0 > for disable and q->hwe->eclass->sched_props.timeslice_us for enable. This was the approach I had taken in v1, I just resurrected v1 as v4 and sent it out. > > Also how do you check if this operation succeeeded? Is there a response from > > GuC indicating success? > > .set_timeslice and .set_preempt_timeout have an error return. But otherwise I don't know what happens after these ops call guc_exec_queue_add_msg(). Maybe Matt Brost knows? Matt, is this operation guaranteed to always succeed? Since there is no return code from these ops except -ENOMEM. Thanks. -- Ashutosh > > Matt > > > Thanks, > > Umesh > > > > > + > > > static int guc_exec_queue_suspend(struct xe_exec_queue *q) > > > { > > > struct xe_sched_msg *msg = q->guc->static_msgs + STATIC_MSG_SUSPEND; > > > @@ -1598,6 +1641,8 @@ static const struct xe_exec_queue_ops guc_exec_queue_ops = { > > > .set_priority = guc_exec_queue_set_priority, > > > .set_timeslice = guc_exec_queue_set_timeslice, > > > .set_preempt_timeout = guc_exec_queue_set_preempt_timeout, > > > + .set_no_preempt = guc_exec_queue_set_no_preempt, > > > + .clear_no_preempt = guc_exec_queue_clear_no_preempt, > > > .suspend = guc_exec_queue_suspend, > > > .suspend_wait = guc_exec_queue_suspend_wait, > > > .resume = guc_exec_queue_resume, > > > -- > > > 2.41.0 > > >