Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp403975rdb; Mon, 22 Jan 2024 07:46:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxkY19rIPGy4RKWrxDXmyod/lWBdLTWx5ytveurzrwmW/luM6QL55wkPMRy2ZHVPWC3cI5 X-Received: by 2002:a17:902:b110:b0:1d4:cae:99f9 with SMTP id q16-20020a170902b11000b001d40cae99f9mr4474442plr.45.1705938366640; Mon, 22 Jan 2024 07:46:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705938366; cv=pass; d=google.com; s=arc-20160816; b=YNLdwR3auw/VHb90iLm8oUyomwDAlmtpgDCd0S3B7g21xcEXs5hWWoAVOjHiBCIUpj AUdUeCPzkIbmvm7Lve5OsVAspBXpOb+sgVMKB5I+lvvb2njXN1/E/g4hKqvxoO+n9zY/ er6gCstgBWTl6HVZ2m2NjWQESFuuZ7V2OK+TuuQLc+JSSZ/1ACtIvib9JJpiR+aFfGp9 J73rGAzOrtaqXveD4ui9CxigxsjlhjOg9ToQCZW10eV5EgAOdVdgbY8atPy6UF4RmbzN M7RIlMBiYtWxLyV7WupDfkpn0LOWGWbBibvqwD8heKUH7sPxO475A//Dy4PMKbqhm1+w VrPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YUCsQNvcnvKHyV+DZoxUaibnHC4qVcUFI8qrU/8n7t4=; fh=I/J7LIhEAKgsn7QVmHy/HcXycQdJruFIEx6hZ5eZCUU=; b=aAD/YsbuPqUYZArASQWZ5JdBssAr4MdtSOJa2yyJBAsgw0f/AST8rYAbVYVz68egh3 QyxllNXutIQMDag7FYqKi5CWxplz9kra1Y9FPOKJhhVE9WSXci6lrm99UynYzFDVDOLc 5haDGtHdJhDakjZGpU20uMooKZuQdX5dsDa5eIYunEm5vidNl5OeEZRwVCyxmQHMSweK emDnSya66KgdILyB6B8DXGuAx8Qfc+sDTEBiKpydjXyKMKv35euaooF1eNalWX5VdPJ8 rlCqYFtJgyngzxBBcMBfBcXE1kgK7QT44a5BXOa4xJK4g+jIgjKh34Pn7po5uvgX2dCh loQQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qf7BUyYQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33286-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n14-20020a170902e54e00b001d72ba4b3cbsi4762499plf.44.2024.01.22.07.46.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qf7BUyYQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33286-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2E3CBB2D29E for ; Mon, 22 Jan 2024 15:23:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E468B5C5ED; Mon, 22 Jan 2024 15:00:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qf7BUyYQ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1854D5C5E1; Mon, 22 Jan 2024 15:00:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935615; cv=none; b=WXvaCfuFo2+b+q4iSUwLqIQKOammjMuznflS2n95e7BafcFr2eQMF5r8zTQbOiL4fSLA+lT4cjP0UA4KM9IeIbQ0ltOSgBQSFMScQXgwUmMCfV7OuOBne8D68m3GF0KDrLu7xBzop9syX/XDJ76M0utd0Y+WcgLC43jQSBWzOkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935615; c=relaxed/simple; bh=kOnajDdCG2w3ab9S/kUTAjC7AbVcgzSsg+UPepbB180=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y/iLw25yHWY/nc6UsxEnDdB+pAGIhfJByTU8Tdzlj7B/W+2fL10TMwkwUvgk+78z9bmvpFATP5+fC/zLdt36fIjHpg+HSROkJlUgO5Jn49jZduaLSmtP1/VWn9Z4T2e6yB3W+FW97CYgA5GArM/LeZcjlgOzuDkOGhBMhK4JJcU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qf7BUyYQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A926BC433A6; Mon, 22 Jan 2024 15:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935614; bh=kOnajDdCG2w3ab9S/kUTAjC7AbVcgzSsg+UPepbB180=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qf7BUyYQSGN1m6VY2a+cl+8vRwUWtQwOkFKNotZwoV4QDesbOkJer0q32tiRWRn1S xn5CU11Z2I8arMw2uDfzJRgGcfJl2W5Q1uPp7SkAbq8uczey5Z+8wA8z4/mJRdUB+R BDAwSy+LwU7+4rsO7dn48oA9T4ntevkDYFOpgYhRMK+U83V7MrQq6PgH3A1+n9H1zO KnLRw9liFkMaxHQT8L8iOsbQBm2lBGtOZbfulxCquEpfaTjnxlt/toHG1THnpLb5Fy GzCA+OOO0smBBfxAm1N5mEm2ksYx+UherJerk30N6gnykn/H6PvSTr3se61Ha0twxs RcIbp7pdm1NJQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Farah Kassabri , Oded Gabbay , Sasha Levin , ttayar@habana.ai, stanislaw.gruszka@linux.intel.com, kelbaz@habana.ai, dhirschfeld@habana.ai, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.7 64/88] accel/habanalabs: fix EQ heartbeat mechanism Date: Mon, 22 Jan 2024 09:51:37 -0500 Message-ID: <20240122145608.990137-64-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.1 Content-Transfer-Encoding: 8bit From: Farah Kassabri [ Upstream commit d1958dce5ab6a3e089c60cf474e8c9b7e96e70ad ] Stop rescheduling another heartbeat check when EQ heartbeat check fails as it generates confusing logs in dmesg that the heartbeat fails. Signed-off-by: Farah Kassabri Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/accel/habanalabs/common/device.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c index 9e461c03e705..9290d4374551 100644 --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -1044,18 +1044,19 @@ static bool is_pci_link_healthy(struct hl_device *hdev) return (vendor_id == PCI_VENDOR_ID_HABANALABS); } -static void hl_device_eq_heartbeat(struct hl_device *hdev) +static int hl_device_eq_heartbeat_check(struct hl_device *hdev) { - u64 event_mask = HL_NOTIFIER_EVENT_DEVICE_RESET | HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE; struct asic_fixed_properties *prop = &hdev->asic_prop; if (!prop->cpucp_info.eq_health_check_supported) - return; + return 0; if (hdev->eq_heartbeat_received) hdev->eq_heartbeat_received = false; else - hl_device_cond_reset(hdev, HL_DRV_RESET_HARD, event_mask); + return -EIO; + + return 0; } static void hl_device_heartbeat(struct work_struct *work) @@ -1072,10 +1073,9 @@ static void hl_device_heartbeat(struct work_struct *work) /* * For EQ health check need to check if driver received the heartbeat eq event * in order to validate the eq is working. + * Only if both the EQ is healthy and we managed to send the next heartbeat reschedule. */ - hl_device_eq_heartbeat(hdev); - - if (!hdev->asic_funcs->send_heartbeat(hdev)) + if ((!hl_device_eq_heartbeat_check(hdev)) && (!hdev->asic_funcs->send_heartbeat(hdev))) goto reschedule; if (hl_device_operational(hdev, NULL)) -- 2.43.0