From nobody Tue Oct 15 17:43:08 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XShJs19BWz5Ym27; Tue, 15 Oct 2024 17:43:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XShJr56ssz4YwM; Tue, 15 Oct 2024 17:43:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014188; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RCxhOlH8rE0msnn0sWpfjPVk5Sj0/egbYfKzHmvagp0=; b=dTEW9q3/Mnf25w9KrelTHWbw13T5g8wdJGqLKp8zwY48f7SCWcfJggRws/9TeBk8lSDqYI TYfECHdL4oBMjrTEA1RYECexMSPvRWK+noq1KgWUsaALr8S8VJ3BodFdAHjwqOYcHcFgec B/4aD5BEx3xUuixhhPiRdSqdHeuv28OkdZeEdXeanvrU4R8Xvu/7xR4APxCCBkumreAxzm 7lkkRIjcGt3EamU2SFM0Qdm+Bq2pbez/1kTlxSVVK5x1wYHndqky/CAgEgLZuWdbsJRQto 7oNXvSPhWT2g7b537ZFLGgE5fQRBOTi9aXuQ3t8p4nhkC9yjauWJ7qyArFVUcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729014188; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RCxhOlH8rE0msnn0sWpfjPVk5Sj0/egbYfKzHmvagp0=; b=j//7B7pl/0n4mcgXW4iC0+zoUUAgsSdWHo2iHycfgk28kn4/h2pGIfYm3/KbR/Ixsod9EJ Z0elolB4+G33zMZTXupGV6ZvJCBCoEg35LoUt2NOkB37aIa+aHV2BKXEzNwZtpaWoybNuz arLq4iPlm176bEeiykRbEmxq14cQJIsY+WZQfGniEw1uUR/kBd4zAsXDzybjY6cbkQRP2+ BYjqXGnFLe4SNxzvK4OSuZszWTaJ1IdZlDtuSLXyGThyqJBcV12TyA8mMw6uLorel7dAEZ 0QFtMgBmiMM1z3iESYjmC9gRf80K24J9sUA+M3SUG71mFV1HaDuImdqrjtQNsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729014188; a=rsa-sha256; cv=none; b=fSpfdvC3EYEmghv4/lUo0Xhr2hn/iwNBRSqNiiCtT2kKqwBK6FaaQi67nEb9KYUmS71nTD svbqpx2toelvT1DoVD6bfiOzD+3agq1fLVV1GjnHSJTwCHI+2c5LW/1PEMWvAwDv5SFQmP XcHXVZmgQC2vWjco4X4Lv1QTw0oZA0ezXfYW18EykDVx4PaOPyD1fO1ZeB9csAvs+lrpwA 9D3MRb/sCb6HuvrJOXWI8GZsnNhOgyABqWY//ka3jdFk9r6n1Pry4rrmGNX32cH4k2Qqtp HAOF9wEc8pqjbteonP/DP19EGrysC2ddo+wUZSA+JiItH08VcIWF9K5ROBJ1UQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XShJr4kzlzX54; Tue, 15 Oct 2024 17:43:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49FHh8CQ062191; Tue, 15 Oct 2024 17:43:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FHh88G062188; Tue, 15 Oct 2024 17:43:08 GMT (envelope-from git) Date: Tue, 15 Oct 2024 17:43:08 GMT Message-Id: <202410151743.49FHh88G062188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Osama Abboud Subject: git: 274319acb484 - main - ena: Add reset reason for missing admin interrupt List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: osamaabb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 274319acb48424958242d55e1b0c7d4528da7f70 Auto-Submitted: auto-generated The branch main has been updated by osamaabb: URL: https://cgit.FreeBSD.org/src/commit/?id=274319acb48424958242d55e1b0c7d4528da7f70 commit 274319acb48424958242d55e1b0c7d4528da7f70 Author: Osama Abboud AuthorDate: 2024-08-07 06:24:19 +0000 Commit: Osama Abboud CommitDate: 2024-10-15 17:38:31 +0000 ena: Add reset reason for missing admin interrupt There can be cases when we trigger reset if an admin interrupt is missing. In order to identify this use-case specifically, this commit adds a new reset reason. Approved by: cperciva (mentor) MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.c | 13 +++++++++++-- sys/dev/ena/ena.h | 5 ++++- sys/dev/ena/ena_sysctl.c | 4 ++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index 3f3a4946ccca..36e9ac15e8ff 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -3029,6 +3029,7 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter) { sbintime_t timestamp, time; + enum ena_regs_reset_reason_types reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO; if (adapter->wd_active == 0) return; @@ -3040,7 +3041,10 @@ check_for_missing_keep_alive(struct ena_adapter *adapter) time = getsbinuptime() - timestamp; if (unlikely(time > adapter->keep_alive_timeout)) { ena_log(adapter->pdev, ERR, "Keep alive watchdog timeout.\n"); - ena_trigger_reset(adapter, ENA_REGS_RESET_KEEP_ALIVE_TO); + if (ena_com_aenq_has_keep_alive(adapter->ena_dev)) + reset_reason = ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT; + + ena_trigger_reset(adapter, reset_reason); } } @@ -3048,10 +3052,15 @@ check_for_missing_keep_alive(struct ena_adapter *adapter) static void check_for_admin_com_state(struct ena_adapter *adapter) { + enum ena_regs_reset_reason_types reset_reason = ENA_REGS_RESET_ADMIN_TO; if (unlikely(ena_com_get_admin_running_state(adapter->ena_dev) == false)) { ena_log(adapter->pdev, ERR, "ENA admin queue is not in running state!\n"); - ena_trigger_reset(adapter, ENA_REGS_RESET_ADMIN_TO); + counter_u64_add(adapter->dev_stats.admin_q_pause, 1); + if (ena_com_get_missing_admin_interrupt(adapter->ena_dev)) + reset_reason = ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT; + + ena_trigger_reset(adapter, reset_reason); } } diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index b747736224d8..1a436a702ba1 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -391,6 +391,8 @@ struct ena_stats_dev { counter_u64_t missing_intr; counter_u64_t tx_desc_malformed; counter_u64_t rx_desc_malformed; + counter_u64_t missing_admin_interrupt; + counter_u64_t admin_to; }; struct ena_hw_stats { @@ -542,7 +544,7 @@ struct ena_reset_stats_offset { static const struct ena_reset_stats_offset resets_to_stats_offset_map[ENA_REGS_RESET_LAST] = { ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_KEEP_ALIVE_TO, wd_expired), - ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_ADMIN_TO, admin_q_pause), + ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_ADMIN_TO, admin_to), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_OS_TRIGGER, os_trigger), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISS_TX_CMPL, missing_tx_cmpl), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_INV_RX_REQ_ID, bad_rx_req_id), @@ -552,6 +554,7 @@ static const struct ena_reset_stats_offset resets_to_stats_offset_map[ENA_REGS_R ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISS_INTERRUPT, missing_intr), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED, tx_desc_malformed), ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED, rx_desc_malformed), + ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT, missing_admin_interrupt), }; int ena_up(struct ena_adapter *adapter); diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index 79c167221a0f..b9c880e2e8e4 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -298,6 +298,10 @@ ena_sysctl_add_stats(struct ena_adapter *adapter) &dev_stats->tx_desc_malformed, "TX descriptors malformed count"); SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "rx_desc_malformed", CTLFLAG_RD, &dev_stats->rx_desc_malformed, "RX descriptors malformed count"); + SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "missing_admin_interrupt", CTLFLAG_RD, + &dev_stats->missing_admin_interrupt, "Missing admin interrupts count"); + SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "admin_to", CTLFLAG_RD, + &dev_stats->admin_to, "Admin queue timeouts count"); SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "total_resets", CTLFLAG_RD, &dev_stats->total_resets, "Total resets count");