From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88FA342FB5; Wed, 2 Aug 2023 09:09:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CAA340DDB; Wed, 2 Aug 2023 09:09:18 +0200 (CEST) Received: from mgamail.intel.com (unknown [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 5BEE54021D for ; Wed, 2 Aug 2023 09:09:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690960156; x=1722496156; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ILRoArVS8KzL1KmjCbIp4eGZM5nHGyEsh+Grx5A8PV0=; b=L5wL8gHyxQPmviViN2ZOBGa3vcOI3hsW2lgqH/iRPBNH++adP+GLbO6W /klvxlSrfQV5Ph7v/6TuKu09Ob8lrWRNbzuTGVwI0bdmYUUsaPnkbGhi4 wlUNx7INsxZo7Zpxf4e7zb06Ir37YqbskyBEBxz0/f8niSRkV9nTw4y3m 7Kr5Y9d1+uCUi6rWMwcl4z3nur6PF/rFzXnT2TP2GCNLknbfZMNlwFnyt h1jomiO/fd/VYKjYOxlE/5oIVDBKxAcKoBy1vWNUyOejlOeSE9Ybm2y4s 1GDiF4EoeXtBF7/fo3UMorTfnE5NnO1DyzV6skmw5bF1Tliov6moAFgkp w==; X-IronPort-AV: E=McAfee;i="6600,9927,10789"; a="349102266" X-IronPort-AV: E=Sophos;i="6.01,248,1684825200"; d="scan'208";a="349102266" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 00:08:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="872359440" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 00:08:47 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, songx.jiale@intel.com, Zhichao Zeng , Jingjing Wu , Beilei Xing Subject: [PATCH] net/iavf: fix ASan error caused by watchdog Date: Wed, 2 Aug 2023 15:15:21 +0800 Message-Id: <20230802071521.1842377-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Cancel rte alarm when closing the watchdog at the same time to avoid ASan error, and optimize the prompt when opening and closing the watchdog. Fixes: af801b0374e3 ("net/iavf: add devargs to control watchdog") Signed-off-by: Zhichao Zeng --- drivers/net/iavf/iavf_ethdev.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index f2fc5a5621..c0ca733c67 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -324,24 +324,31 @@ iavf_dev_watchdog(void *cb_arg) void iavf_dev_watchdog_enable(struct iavf_adapter *adapter) { - if (adapter->devargs.watchdog_period && !adapter->vf.watchdog_enabled) { - PMD_DRV_LOG(INFO, "Enabling device watchdog, period is %dμs", - adapter->devargs.watchdog_period); - adapter->vf.watchdog_enabled = true; - if (rte_eal_alarm_set(adapter->devargs.watchdog_period, - &iavf_dev_watchdog, (void *)adapter)) - PMD_DRV_LOG(ERR, "Failed to enabled device watchdog"); - } else { + if (!adapter->devargs.watchdog_period) { PMD_DRV_LOG(INFO, "Device watchdog is disabled"); + } else { + if (!adapter->vf.watchdog_enabled) { + PMD_DRV_LOG(INFO, "Enabling device watchdog, period is %dμs", + adapter->devargs.watchdog_period); + adapter->vf.watchdog_enabled = true; + if (rte_eal_alarm_set(adapter->devargs.watchdog_period, + &iavf_dev_watchdog, (void *)adapter)) + PMD_DRV_LOG(ERR, "Failed to enable device watchdog"); + } } } void iavf_dev_watchdog_disable(struct iavf_adapter *adapter) { - if (adapter->devargs.watchdog_period && adapter->vf.watchdog_enabled) { - PMD_DRV_LOG(INFO, "Disabling device watchdog"); - adapter->vf.watchdog_enabled = false; + if (!adapter->devargs.watchdog_period) { + PMD_DRV_LOG(INFO, "Device watchdog is not enabled"); + } else { + if (adapter->vf.watchdog_enabled) { + PMD_DRV_LOG(INFO, "Disabling device watchdog"); + adapter->vf.watchdog_enabled = false; + rte_eal_alarm_cancel(&iavf_dev_watchdog, (void *)adapter); + } } } -- 2.34.1