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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 46E2DCD5BC9 for ; Mon, 25 May 2026 13:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7ROzJMGxgGji9kSxPsQTiQtOcWhXTsX9E1VNaJINSl8=; b=HYFHh1IoyYTMwV8hk0gxhhFG8t LYAxKnaaUdT2MNqQoEX2thCkrDfxiXSLAHdbo/YWN9Y1AlX8MSXqqm77/5AVUdPhNyVuf72Lsy6VV kEmqQttdTSTFaKhLYCAYTZFixKaSj/K33xrb7kFh++SkOX8n/SDrymIPVks2QK2917qiPGDSYyl0F fvRaPC5F5DG45Hhu2cfDKb5IPZ2njM1Dd8k0NJ5qk9uoa8YL08fXGtSnCjV/6htGUQic9ktcJqcjz 1yAo6762luGH8xmEuxUVEkJ+mtRQYo2vQLj9C0Ye+Bb+7s6hlXFrE1js/EjDKmH5jvJAbvruA4Uz2 HC2dlZzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wRVdz-0000000HLdK-0MDl; Mon, 25 May 2026 13:46:59 +0000 Received: from vps0.lunn.ch ([156.67.10.101]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wRVdw-0000000HLcZ-2BvA for linux-arm-kernel@lists.infradead.org; Mon, 25 May 2026 13:46:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=7ROzJMGxgGji9kSxPsQTiQtOcWhXTsX9E1VNaJINSl8=; b=44H9Tv3oI6aUay45FA2s/0JwiI xqcZvzNObbjcHkA6ToiaO/D7Cuf0OhXKHMdhwy1Xt5F42Bctpy69ENTOH9kJakxHi0bPq0uOzIYRY lRWdycm2s0D7GniP/JyOjR73J5Db7qTxK0HNZ148D0+QZZmS1Bb2MZbGMzYL+FSdcC0M=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1wRVdY-004TZz-Ek; Mon, 25 May 2026 15:46:32 +0200 Date: Mon, 25 May 2026 15:46:32 +0200 From: Andrew Lunn To: muhammad.nazim.amirul.nazle.asmade@altera.com Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, rmk+kernel@armlinux.org.uk, maxime.chevallier@bootlin.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: stmmac: Improve Tx timer arm logic further Message-ID: <3766daef-80d0-4657-935a-579bf17a11d4@lunn.ch> References: <20260525061653.22548-1-muhammad.nazim.amirul.nazle.asmade@altera.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260525061653.22548-1-muhammad.nazim.amirul.nazle.asmade@altera.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260525_064656_563336_CF037F03 X-CRM114-Status: GOOD ( 19.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, May 24, 2026 at 11:16:53PM -0700, muhammad.nazim.amirul.nazle.asmade@altera.com wrote: > From: Nazim Amirul > > Currently hrtimer_start is called even if hrtimer is > active. This is unnecessary and expensive in some targets. > This patch avoids calling hrtimer_start unnecessarily. > > Signed-off-by: Rohan G Thomas > Signed-off-by: Nazim Amirul > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 3591755ea30b..35da51c26248 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3341,12 +3341,14 @@ static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue) > * Try to cancel any timer if napi is scheduled, timer will be armed > * again in the next scheduled napi. > */ > - if (unlikely(!napi_is_scheduled(napi))) > - hrtimer_start(&tx_q->txtimer, > - STMMAC_COAL_TIMER(tx_coal_timer), > - HRTIMER_MODE_REL); > - else > + if (unlikely(!napi_is_scheduled(napi))) { > + if (unlikely(!(hrtimer_active(&tx_q->txtimer)))) > + hrtimer_start(&tx_q->txtimer, > + STMMAC_COAL_TIMER(tx_coal_timer), > + HRTIMER_MODE_REL); Is there a race condition here? I've not thought about it enough to know if there is/is not. Also, does this change the meaning of tx_coal_timer? I think the commit message needs expanding, to cover these issues. For performance changes, it is also normal to include some performance numbers, before/after, in the commit message. Andrew --- pw-bot: cr