Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2794458rwl; Thu, 13 Apr 2023 10:56:49 -0700 (PDT) X-Google-Smtp-Source: AKy350bWem+71QohzYcPS35IyAa0R3fRbqX0vUlFQU2KEv3aJR1MCJ5qNRqwP4LzY7Y93Baz+Hkb X-Received: by 2002:a17:90a:c402:b0:23f:3539:d326 with SMTP id i2-20020a17090ac40200b0023f3539d326mr2937717pjt.0.1681408609052; Thu, 13 Apr 2023 10:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681408609; cv=none; d=google.com; s=arc-20160816; b=dmunT7WpKpaTXtYMNX5Td5pqjdQ9sAr6iSMWjFpfI+GdU75FnNvcgRfjvyTeXUAa8p sa0pyVwzF+YzunU2F6vRHdmXqBErLfoX5ScI++8bWKwEvfxXQA/843BGC50OL98GRqSS UhRQLQIILdunqM4gsWSGFVdF/B5nxZK8FRfSlynm4VzxcwCMLdi08C14tuCdKppyiXVA gBNMLUay1lcYdNWVVGQvi51zW/B12fKy3FGnuoSlV+e8yO5DWz66KCmf9I1GYp9BSrMI eLhUQL47jfNxiscFj+LNW9Hxt2r/gtr/m6t4GTwcHQfTKCehLzugJTc7cyks0WqcRHMp duwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eIiirAaDA9eFVxHe7848A9thDVoy/Iisyo0XYKsmV0o=; b=AuYTGFqNWBoqm3RqMrctB8+l/G+8S8duRLUAwgiq4sHMsk+e3y9iKROkApj4HvrwBk Gx68C7PhreeTCuyrzSK+vZXOIIOLzslWHVwV3+ZdsGNdZpoFew1h7d/R8lQU+5snK2vL rtbz3+QL6ymiNeK3kVBB+75aQ+v2i5iaVLW20Wx+Nj7uCgeFSIticxEUiz9IDWI1Ifd9 UziFGg2BMM9Z2ZcbeWI0CY+aqcdSanEisnRYYMN7PZgzJ3c5KuRxOEqJpiq7k2aKbeFm Fp5yLRHDVPVSzA5IQeWxSQ4oKs1B8SmfoCv0YoERHzOOoOsNP5LKqehJIBzqBS1+JUTC APRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HgLQzS6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a17090abb8900b0024496072b1csi2457008pjr.73.2023.04.13.10.56.33; Thu, 13 Apr 2023 10:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HgLQzS6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230009AbjDMRli (ORCPT + 99 others); Thu, 13 Apr 2023 13:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbjDMRlf (ORCPT ); Thu, 13 Apr 2023 13:41:35 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53EC219A3; Thu, 13 Apr 2023 10:41:33 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id jg21so39035589ejc.2; Thu, 13 Apr 2023 10:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681407692; x=1683999692; 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=eIiirAaDA9eFVxHe7848A9thDVoy/Iisyo0XYKsmV0o=; b=HgLQzS6hpyE1ox3/UQZbfYrUg+fXCMocSiDRxSrIGBjrPBzPqXOJUbiMV8NCUVxh/B 1ymadqD5jQ6I+DzdMmfxZ/1JSADwiCoWjOLc9jTx86dHwt7ABINegcDwoHOxFAzepYUx nt+Erld+cUwRDlzVbA1hjCpP/78cRv00dJ9th0mrTJOSsERaGQIejvqWPW+5iWjaCMdv Mkbew89xglCbWfDmOcgGVZzCUwVeFEA1mN0JQweGzgjZp0xe7TtWRm5ByRJbFKznJ289 b13iy7mAKHNwbh8MdouO8Bk7Umt9DbFZF/B3gCjQOwhE5dJkMvpoWU51k4cWmX8Sv0vH loHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681407692; x=1683999692; 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=eIiirAaDA9eFVxHe7848A9thDVoy/Iisyo0XYKsmV0o=; b=MTrEiuOX3vXRDliR90uCoAzBbYV4PZ8SsgK4Ouidf+5+BVZcqhlzVPJri/iJ/di5Tb OcTa7xoXANw5G9zzCMZOBDbEGHwQ7uKJc4fchTZqogNwIkrxrOPsQ1tJpM5feWfenS3o pSQE4n/cZHU3CmDZ+rNrD+hZqXbkQdHGXwQKWVl2gOt7boJyfVarGTFvTPVea5VwWlRH bxhgyepcbXFAmPmA23N6P0Bk0aAHWC1UwYNN31HxBg6RaVDmWbugxKPeSDNm8SLa2BrC i+LXWhMtn9SRKlDCOEb2YmW2Htwnfum9Pa6OrpzdNghNaDVWRhwonIZLW6Mc2CdO+3f+ GwLg== X-Gm-Message-State: AAQBX9fuFScQ6BHDWYr3KENEz1bNFkRU1Pgt+0NrOD/k8x7k0zohf/Ll oNUOOeM8UeB+qC+3S3QYgXGMAn7yK+RU0g== X-Received: by 2002:a17:906:cf9c:b0:932:f88c:c2ff with SMTP id um28-20020a170906cf9c00b00932f88cc2ffmr6641850ejb.34.1681407692066; Thu, 13 Apr 2023 10:41:32 -0700 (PDT) Received: from skbuf ([188.27.184.189]) by smtp.gmail.com with ESMTPSA id mf12-20020a170906cb8c00b00947a40ded80sm1253991ejb.104.2023.04.13.10.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 10:41:31 -0700 (PDT) Date: Thu, 13 Apr 2023 20:41:29 +0300 From: Vladimir Oltean To: Florian Fainelli Cc: Jacob Keller , Yan Wang , davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, kuba@kernel.org, mcoquelin.stm32@gmail.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "open list:STMMAC ETHERNET DRIVER" , "moderated list:ARM/STM32 ARCHITECTURE" , "moderated list:ARM/STM32 ARCHITECTURE" , open list Subject: Re: [PATCH net-next v4] net: stmmac:fix system hang when setting up tag_8021q VLAN for DSA ports Message-ID: <20230413174129.dafmlq57a3pc2ppn@skbuf> References: <01ef9d4f-d2dc-d584-4733-798cffda49a1@intel.com> <298c045a-5438-6761-46d8-c46c57989812@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <298c045a-5438-6761-46d8-c46c57989812@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 13, 2023 at 10:15:55AM -0700, Florian Fainelli wrote: > On 4/13/23 10:07, Jacob Keller wrote: > > On 4/13/2023 8:06 AM, Yan Wang wrote: > > > The system hang because of dsa_tag_8021q_port_setup()-> > > > stmmac_vlan_rx_add_vid(). > > > > > > I found in stmmac_drv_probe() that cailing pm_runtime_put() > > > disabled the clock. > > > > > > First, when the kernel is compiled with CONFIG_PM=y,The stmmac's > > > resume/suspend is active. > > > > > > Secondly,stmmac as DSA master,the dsa_tag_8021q_port_setup() function > > > will callback stmmac_vlan_rx_add_vid when DSA dirver starts. However, > > > The system is hanged for the stmmac_vlan_rx_add_vid() accesses its > > > registers after stmmac's clock is closed. > > > > > > I would suggest adding the pm_runtime_resume_and_get() to the > > > stmmac_vlan_rx_add_vid().This guarantees that resuming clock output > > > while in use. > > > > > > Signed-off-by: Yan Wang > > > > This looks identical to the net fix you posted at [1]. I don't think we > > need both? > > > > [1]: > > https://lore.kernel.org/netdev/KL1PR01MB5448020DE191340AE64530B0E6989@KL1PR01MB5448.apcprd01.prod.exchangelabs.com/ > > Unfortunately both still lack a proper Fixes: tag, and this is bug fix. > -- > Florian > I guess that would be: Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver") although in this case, that would be only part of the story. That commit split the runtime PM handling between stmmac_vlan_rx_add_vid() and stmmac_vlan_rx_kill_vid() in a strange way, where an added VLAN RX filter takes a refcount on the device, and a deleted filter one drops the refcount. That is... strange?! but it worked in a way, I guess. Then commit b3dcb3127786 ("net: stmmac: correct clocks enabled in stmmac_vlan_rx_kill_vid()") came a few months later and blamed that oddity on a bad merge conflict resolution... ?! Basically, from what I can tell, it's this later commit the one that broke things, for using runtime PM only for stmmac_vlan_rx_kill_vid() but not for stmmac_vlan_rx_add_vid().