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 DEFA0CAC599 for ; Mon, 15 Sep 2025 10:35:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4227510E426; Mon, 15 Sep 2025 10:35:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="PBzpx/D0"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id E8A4F10E426 for ; Mon, 15 Sep 2025 10:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1757932535; x=1789468535; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JH8E/9wgq7qGNErerHqRyYnQSpRXSuHyCLEzkSoxIC4=; b=PBzpx/D0W2RDE6kxmQ28HvuH6DMSnKjW3gh6aZQVj1ZbrH8pOu3kedH6 eyFSSt06Rmit4DpFt9gdFuT0E7Q9FqqfjxDmBsCsVHbZZt7G1WU12zKfI hVMITsEHhG7mblOZG/CkN1Tysl7/pGtYozjraAHbd27WtRNrmKUPhgXKl QmkG/YKv/q1euj4FWEzpp7QLB3ObVz6FvL/GPNe9AwEIM1N8cJH8VD43U n3NTFBIvI2WyqyRiRyqBSbIDWz4+Mb6r/9NtbNR5hmqkHfp5efLBAfqcl shXLQCqkSuDE7y/dXd6Bv5A2TvX2krjIfgMV3Qc7YY9HrHISoxloZfCro g==; X-CSE-ConnectionGUID: WzPhXXMDRgSkQ/ip4XvbeA== X-CSE-MsgGUID: 6amb0ppHRZKjzNo1Ik1bIw== X-IronPort-AV: E=McAfee;i="6800,10657,11553"; a="71278338" X-IronPort-AV: E=Sophos;i="6.18,265,1751266800"; d="scan'208";a="71278338" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2025 03:35:34 -0700 X-CSE-ConnectionGUID: 94zhshKbT++ybbq1WA271Q== X-CSE-MsgGUID: r2B+JJ62QkKMioJCygGAoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,265,1751266800"; d="scan'208";a="173732485" Received: from pl-npu-pc-kwachow.igk.intel.com ([10.91.220.239]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2025 03:35:32 -0700 From: Karol Wachowski To: dri-devel@lists.freedesktop.org Cc: oded.gabbay@gmail.com, jeff.hugo@oss.qualcomm.com, maciej.falkowski@linux.intel.com, lizhi.hou@amd.com, Karol Wachowski Subject: [PATCH] accel/ivpu: Ensure rpm_runtime_put in case of engine reset/resume fail Date: Mon, 15 Sep 2025 12:35:26 +0200 Message-ID: <20250915103526.830130-1-karol.wachowski@linux.intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Previously, aborting work could return early after engine reset or resume failure, skipping the necessary runtime_put cleanup leaving the device with incorrect reference count breaking runtime power management state. Replace early returns with goto statements to ensure runtime_put is always executed. Signed-off-by: Karol Wachowski --- drivers/accel/ivpu/ivpu_job.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c index 521b7ac6e35e..044268d0fc87 100644 --- a/drivers/accel/ivpu/ivpu_job.c +++ b/drivers/accel/ivpu/ivpu_job.c @@ -1050,7 +1050,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work) if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) if (ivpu_jsm_reset_engine(vdev, 0)) - return; + goto runtime_put; mutex_lock(&vdev->context_list_lock); xa_for_each(&vdev->context_xa, ctx_id, file_priv) { @@ -1074,7 +1074,7 @@ void ivpu_context_abort_work_fn(struct work_struct *work) goto runtime_put; if (ivpu_jsm_hws_resume_engine(vdev, 0)) - return; + goto runtime_put; /* * In hardware scheduling mode NPU already has stopped processing jobs * and won't send us any further notifications, thus we have to free job related resources -- 2.43.0