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 ADCAECE7AA3 for ; Fri, 6 Sep 2024 12:51:52 +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=CazLyKDyDWBGE+TrHohi5rRaTCuA6ZV2cOHXjRbJ6FA=; b=xkdn9DRryBTpKN3tYtijRMhSCk ElhwPIVnvEBiTATzVeIcfv/DhJgqUB9uHfKK52O1aWRZtic257Powo2w0WMXbF+h1qq2+YmJC7thq q7dZ7AzFsVj56Ez6xisDpl2VVW+uGFbpM47AsgOaCxrL3EWyz2GdbfXm48yAmmuDpfm7gfMIN8rjj ah1ogZTQtfnPSUNpWk1+0QB43lwWz5OWiPHnco7towOO1zDFmAVJ1I2WBfPwsDi8RWs2qHHkkjGLm BmAzLBqXpdf6t0GBfAN0Y3NDjb0ubOJNVjod/Siao8eeW3N25jd9zkYkTb5Px9K2OeO3UibgycHZB FnNHmQng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smYRC-0000000CEZA-0tKq; Fri, 06 Sep 2024 12:51:42 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smYP5-0000000CDzQ-0509 for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 12:49:32 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-53658e2d828so135822e87.2 for ; Fri, 06 Sep 2024 05:49:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725626969; x=1726231769; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=CazLyKDyDWBGE+TrHohi5rRaTCuA6ZV2cOHXjRbJ6FA=; b=hcIz9eza+vc58IJFblAg2d2xjY78yCrN9Gbkg20tqup1ShN072wRGYX+HHFNqFGQg9 pWXAV9MHtZTVqVPzm5mtG7yP5IiSrnbLIxFNvPAwlgJpjQn7I7Lw2WhoVGSEDfnIr9c6 IB8lvGmsyPWNn1j/QIQD4eMpAj+ufNvhV+8nyUZMnDguBS3SuzxwhNpqf9CSmMCI+iiJ V7H57GALaH1mp7wY8wtQ95Udh215mClLLgEWSL4fwY5hnmcEQ0I86vDIEZkJzHrsh5so ypOFBbhxI+xOIcsX1Yo2qbA9M7OQKcJNjEqs+h06DfgF8GoZJfIyn4aYX88IxPWP8+hG YBJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725626969; x=1726231769; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CazLyKDyDWBGE+TrHohi5rRaTCuA6ZV2cOHXjRbJ6FA=; b=hohLKCMnXUCYymr1JAZ9RmEh7lrvt+JUCBzUqYxI9KM9FNTRLcOXOdhdTTL4wW93vw ROZxuubmZnutL+MVz34NIvo0ML3L0XxSJk7e9BqZZGxOrNGyoqesLqxrSvbMZZlxPfN/ YUYH1B4oA7groTWHTW29x9dZVbC4vXg1hW0/LipBTNodFkr7gU/IiZlMSBHZdRlBhh5U x1dDxW619zbg9zQ/JqkjOnTOtysfpdx7KhZe+sDr9R2QBfNqaDxIYWKBPS8nc7Ss38FC XgH4SAk9u9PK6TDLRtZbOoZQPbJVJ5TpDtqpztTcXtBw/0u2mRtA/LhT68bpJEMks/nZ 39IQ== X-Forwarded-Encrypted: i=1; AJvYcCVaSXjY+4QPEqxv5Q1f9Ckog2GqKu7FezQ24froggLKp1VpsAFgu1UqUcridoQi8Ld+gMLOU1y5wsOE1e8FpiZn@lists.infradead.org X-Gm-Message-State: AOJu0Yx9/4ckKogO9htLIl3dAMyS8Lb3qgrXFadkh/2DqHNVU7Qc1J/J i5ivZVUqYSpLIgmX1OXyG0ANBDgJLQVnfVJerWPsUwg7nKvo5BrR X-Google-Smtp-Source: AGHT+IGDs+OBqeonRw88x+u40y2cJauEoSXB0MFc/Um5YW0NdPJ9YSGIlAJ4uY+T1N91qq87eQ+3ww== X-Received: by 2002:a05:6512:3ba4:b0:535:4144:d785 with SMTP id 2adb3069b0e04-5365881cf56mr870682e87.11.1725626968213; Fri, 06 Sep 2024 05:49:28 -0700 (PDT) Received: from skbuf ([188.25.134.29]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a77f8fefesm198420766b.182.2024.09.06.05.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 05:49:27 -0700 (PDT) Date: Fri, 6 Sep 2024 15:49:24 +0300 From: Vladimir Oltean To: Furong Xu <0x1207@gmail.com> Cc: Serge Semin , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, rmk+kernel@armlinux.org.uk, linux@armlinux.org.uk, xfr@outlook.com, Vladimir Oltean Subject: Re: [PATCH net-next v9 3/7] net: stmmac: refactor FPE verification process Message-ID: <20240906124924.odfhsgiyg4jkrnqx@skbuf> References: <13f5833e52a47895864db726f090f323ec691c62.1725597121.git.0x1207@gmail.com> <13f5833e52a47895864db726f090f323ec691c62.1725597121.git.0x1207@gmail.com> <20240906124109.s4p7lgrycfgr62vp@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240906124109.s4p7lgrycfgr62vp@skbuf> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_054931_087861_8EBD7436 X-CRM114-Status: GOOD ( 17.44 ) 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 Fri, Sep 06, 2024 at 03:41:09PM +0300, Vladimir Oltean wrote: > On Fri, Sep 06, 2024 at 12:55:58PM +0800, Furong Xu wrote: > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > @@ -969,17 +969,30 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, > > static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up) > > { > > struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; > > - enum stmmac_fpe_state *lo_state = &fpe_cfg->lo_fpe_state; > > - enum stmmac_fpe_state *lp_state = &fpe_cfg->lp_fpe_state; > > - bool *hs_enable = &fpe_cfg->hs_enable; > > + unsigned long flags; > > > > - if (is_up && *hs_enable) { > > - stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, > > - MPACKET_VERIFY); > > + timer_shutdown_sync(&fpe_cfg->verify_timer); > > } > > > > static void stmmac_mac_link_down(struct phylink_config *config, > > @@ -4091,10 +4068,10 @@ static int stmmac_release(struct net_device *dev) > > > > stmmac_release_ptp(priv); > > > > - pm_runtime_put(priv->device); > > - > > if (priv->dma_cap.fpesel) > > - stmmac_fpe_stop_wq(priv); > > + timer_shutdown_sync(&priv->fpe_cfg.verify_timer); > > + > > + pm_runtime_put(priv->device); > > > > return 0; > > } > > @@ -7372,53 +7334,88 @@ int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size) > > +static void stmmac_fpe_verify_timer_arm(struct stmmac_fpe_cfg *fpe_cfg) > > +{ > > + if (fpe_cfg->pmac_enabled && fpe_cfg->tx_enabled && > > + fpe_cfg->verify_enabled && > > + fpe_cfg->status != ETHTOOL_MM_VERIFY_STATUS_FAILED && > > + fpe_cfg->status != ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED) { > > + timer_setup(&fpe_cfg->verify_timer, stmmac_fpe_verify_timer, 0); > > + mod_timer(&fpe_cfg->verify_timer, jiffies); > > + } > > +} > > @@ -7875,15 +7874,8 @@ int stmmac_suspend(struct device *dev) > > } > > rtnl_unlock(); > > > > - if (priv->dma_cap.fpesel) { > > - /* Disable FPE */ > > - stmmac_fpe_configure(priv, priv->ioaddr, > > - &priv->fpe_cfg, > > - priv->plat->tx_queues_to_use, > > - priv->plat->rx_queues_to_use, false); > > - > > - stmmac_fpe_stop_wq(priv); > > - } > > + if (priv->dma_cap.fpesel) > > + timer_shutdown_sync(&priv->fpe_cfg.verify_timer); > > > > priv->speed = SPEED_UNKNOWN; > > return 0; > > Calling timer_setup() after timer_shutdown_sync() is a bit unconventional, > but I don't see why it shouldn't work. > > Reviewed-by: Vladimir Oltean Actually, I'm really wondering. Is lockdep okay if you run timer_shutdown_sync() on a timer on which you've never called timer_setup()?