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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AE3FC433F5 for ; Thu, 6 Oct 2022 08:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbiJFIXx (ORCPT ); Thu, 6 Oct 2022 04:23:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbiJFIX2 (ORCPT ); Thu, 6 Oct 2022 04:23:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E783915CD for ; Thu, 6 Oct 2022 01:23:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8C5C6B8203D for ; Thu, 6 Oct 2022 08:23:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4926FC433D6; Thu, 6 Oct 2022 08:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665044602; bh=u+xJMHnlD6MOkaiwKV5Eg3L6VAtZuvoqkbE0tC5A8d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Obb8s3wvyTxa2SHf4rKJpx6LjRP9xCF4qndzCjkoxkMX+hpQGP5ytJoJzF+15BHXR 46UqyyBJ+9oXZ441aYIJCzJbQOQSgk4DLZtD0ycpn5rF5YfTv6cvjwEPG7eewwYZ9r K6KRNAxsyKGcUlf8ywFZ8MaS0Zk8R7YsHLesv9tvezq++XGTv7IwEKBgL/0gT8/V2k jk+dybTzemVAq2rAKnlIwetvfAbIpN54dLC8rWmO5MO6dv6XXBrKmof2W0iUAyrnJC 3rY008d0pBlpqot1ajpYbdFIT8garYd/npl7YQlAWFLSVXoDYmmDAxIQX3CBgKXnsS GNq1CM0nTDo/g== From: Oded Gabbay To: linux-kernel@vger.kernel.org Cc: Tomer Tayar Subject: [PATCH 07/13] habanalabs: skip idle status check if reset on device release Date: Thu, 6 Oct 2022 11:23:02 +0300 Message-Id: <20221006082308.1266716-7-ogabbay@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221006082308.1266716-1-ogabbay@kernel.org> References: <20221006082308.1266716-1-ogabbay@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomer Tayar If reset upon device release is enabled, there is no need to check the device idle status in hpriv_release(), because device is going to be reset in any case. Signed-off-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/device.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c index bf675cf39f71..e60ed0c8a9db 100644 --- a/drivers/misc/habanalabs/common/device.c +++ b/drivers/misc/habanalabs/common/device.c @@ -398,16 +398,14 @@ static void hpriv_release(struct kref *ref) mutex_destroy(&hpriv->ctx_lock); mutex_destroy(&hpriv->restore_phase_mutex); - if ((!hdev->pldm) && (hdev->pdev) && - (!hdev->asic_funcs->is_device_idle(hdev, - idle_mask, - HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL))) { - dev_err(hdev->dev, - "device not idle after user context is closed (0x%llx_%llx)\n", - idle_mask[1], idle_mask[0]); + /* No need for idle status check if device is going to be reset in any case */ + if (!hdev->reset_upon_device_release && hdev->pdev && !hdev->pldm) + device_is_idle = hdev->asic_funcs->is_device_idle(hdev, idle_mask, + HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL); - device_is_idle = false; - } + if (!device_is_idle) + dev_err(hdev->dev, "device not idle after user context is closed (0x%llx_%llx)\n", + idle_mask[1], idle_mask[0]); /* We need to remove the user from the list to make sure the reset process won't * try to kill the user process. Because, if we got here, it means there are no -- 2.25.1