Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89DFE606A31B for ; Wed, 4 Nov 2026 00:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VZ2qeMcm Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47CFA10E66C; Wed, 4 Nov 2026 00:52:47 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CACC10F8E6 for ; Wed, 4 Nov 2026 00:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1793753562; x=1825289562; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KoVQ7Qch+FzWShMxLrS7p54pbgktg9YnohKdZHUQrwA=; b=VZ2qeMcmEbinStlBI867YTef+9qHvem1taJt1QvZdmneT5VvENEi2R+t EZmpCozLdCR7IqJ4h7j32q+RR5Y+BEklairMxxn+vnhZOWmszNtFwYaQD omtHS9riVm0tn7o2W9LpC9F2p1ahlj+flPKzE+TT+QbqYUJCktrZBuw+N oChrK4gLHjnEKdqY+bOdbXrMN0f5w/POHNTdVr4vxW8vA9ZG9K8SrxaP+ InJiwuiexLw3eavkMSZk6l24EEE0LTpdJdX5bOxaon6j+UQJHrP/3z5pg WdTj6sLDivkNubj6BG/4BHfzs4/SFAIi+RNGb7QViryF2yOwst1OcBf9P g==; X-CSE-ConnectionGUID: HVfYsQEcQ0GJzX5mwBaLHQ== X-CSE-MsgGUID: jJgS1zA6T6ir2N+1HAL2jw== X-IronPort-AV: E=McAfee;i="6800,10657,11955"; a="2529526" X-IronPort-AV: E=Sophos;i="6.27,194,1787036400"; d="scan'208";a="2529526" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2026 16:52:31 -0800 X-CSE-ConnectionGUID: dm3sOu9tTmSk0Ib8yT3Pjw== X-CSE-MsgGUID: o3ZhRFkjRiqbGTU8+vFrhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,194,1787036400"; d="scan'208";a="6649331" Received: from orsosgc001.jf.intel.com ([10.54.56.63]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2026 16:52:30 -0800 From: Umesh Nerlige Ramappa To: intel-xe@lists.freedesktop.org, shekhar.chauhan@intel.com, Matthew Brost Cc: harish.chegondi@intel.com Subject: [PATCH v3 3/5] drm/xe/oa: Take the runtime PM reference in xe_oa_destroy_locked() Date: Tue, 3 Nov 2026 16:52:25 -0800 Message-ID: <20261104005221.3230003-10-umesh.nerlige.ramappa@intel.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261104005221.3230003-7-umesh.nerlige.ramappa@intel.com> References: <20261104005221.3230003-7-umesh.nerlige.ramappa@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Move the runtime PM get/put around stream destruction from xe_oa_release() into xe_oa_destroy_locked(), the only caller, so the reference is held just around the code that needs the device awake. This lets a following patch free a stream of a removed device without taking a runtime PM reference on it. No functional change. Signed-off-by: Umesh Nerlige Ramappa --- drivers/gpu/drm/xe/xe_oa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index cc10403f51e0..7a151f338ae2 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -1691,6 +1691,8 @@ static long xe_oa_ioctl(struct file *file, static void xe_oa_destroy_locked(struct xe_oa_stream *stream) { + xe_pm_runtime_get(gt_to_xe(stream->gt)); + if (stream->enabled) xe_oa_disable_locked(stream); @@ -1700,6 +1702,7 @@ static void xe_oa_destroy_locked(struct xe_oa_stream *stream) xe_exec_queue_put(stream->exec_q); drm_syncobj_put(stream->ufence_syncobj); + xe_pm_runtime_put(gt_to_xe(stream->gt)); kfree(stream); } @@ -1708,11 +1711,9 @@ static int xe_oa_release(struct inode *inode, struct file *file) struct xe_oa_stream *stream = file->private_data; struct xe_gt *gt = stream->gt; - xe_pm_runtime_get(gt_to_xe(gt)); mutex_lock(>->oa.gt_lock); xe_oa_destroy_locked(stream); mutex_unlock(>->oa.gt_lock); - xe_pm_runtime_put(gt_to_xe(gt)); /* Release the reference the OA stream kept on the driver */ drm_dev_put(>_to_xe(gt)->drm); -- 2.55.0