Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2384268rdb; Thu, 21 Sep 2023 18:02:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsLrPse7QVSDpfxGckJDbih9M9x3g9EnqPOfWk28F+lJJOf04rPlqpKH6GcoinuJ134HR/ X-Received: by 2002:a17:902:ab48:b0:1b7:ca9c:4f5c with SMTP id ij8-20020a170902ab4800b001b7ca9c4f5cmr1436287plb.28.1695344558527; Thu, 21 Sep 2023 18:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695344558; cv=none; d=google.com; s=arc-20160816; b=gvEm0TWej01SMvMrMu7EVZPxXJKT/ZNj7KGfeKx80U6en+zsR6+4F8USQRJtnQ4Y/j zz0mrWHsQYs+kK7k0sUibeSuGorow3EznRS0cCBbpJJUrUjKGc6/S9jHRW9XlJQyWFAx 0IXAGkxkCej0DXBsUBCiRGm2dQtcYFNaufbdzzt0M5+Tuwbe2da4LvdWx8fs8a23UDm9 d6N1YjmEKGVnD3v86BS2+N0/PzuCGLnFxjYFCIUUCg3+fz8t3dky47bDDSq6JZpHmwTp x63fbqNIGp0ACUitJF9iknGHdu6f1hf1P3wSoplYymJJ67dEf7mGmJMLHy04o3ebDNXR xEgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:sender:dkim-signature; bh=JyEngoB20EiGdQxWeRrp1wv5Ks/o+AuWbIIGFDAcGkc=; fh=xAcdzzg5pdSgP+7lRg75M++UHOpwqoj1IFhzSXyuw+A=; b=hDBy6mrmeYn5zMPyzc3eeO4I7SJa++VxregpV2FaOaS6zvyH+r+UrCgSY3Mf5wpkag byT6TAMDbS5hUtQ+sfBuT3xfdePbbXJYN9JLWfzDeqU4FA0WT4Ai3610pw7vDnDNd8Tc 2ucsiAp7eXuozLr12YNot/qzxheIc9IVd3nATjpQvNQhvH+8vWKd9qPux7vs2A3u1O2u S4wBQsdLOdaY8YNQ4PEo48skIuPOmXu4akwjYfXff0XOGuFvq8JwaS+fQUwUYzIK8LMg w7QrXbemRjr18NjqSZ5srb5aGDx//DCWObR6P7CW/qeXc6NsK3C561swEZxlRyXITqiR abFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Cq82qJPL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u8-20020a17090282c800b001b8a699d248si2520738plz.389.2023.09.21.18.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Cq82qJPL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 94457826EC40; Thu, 21 Sep 2023 13:41:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229878AbjIUUl2 (ORCPT + 99 others); Thu, 21 Sep 2023 16:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbjIUUlH (ORCPT ); Thu, 21 Sep 2023 16:41:07 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C967FF83A; Thu, 21 Sep 2023 13:14:50 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c5dd017b30so6435785ad.0; Thu, 21 Sep 2023 13:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695327290; x=1695932090; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:sender :from:to:cc:subject:date:message-id:reply-to; bh=JyEngoB20EiGdQxWeRrp1wv5Ks/o+AuWbIIGFDAcGkc=; b=Cq82qJPLnBw0PQroS1GAaxWyadVPIxbTqUWPZtPXMjo4x+eRMAFLeX6irGvBLxgJ0D EXiC+oVpJYn5MmU+pbrgl2BzyAbd9ss6c/qrWuqBgqcJ6J6wC498WvZtp56l3u+/gox0 Q5/jWAbPN69pQGbb4al5xyPeBD4xWWq08Yh/hxCWPacQeJ/m49wkuQtluhSO9G2u+pNv 3Mun4YawjX7t6Re9obCUdT5l2AhXjYLym2aGRRuln4iEBJJtFfBLJpSQiAJQU1vCK4Yh 0QcJn7heAQ2YiVY6MU9CDqLK8JgJczxMugvEk5XCr5XTmAjf1B8RtnqQXnBlne3IG4dC SD7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695327290; x=1695932090; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JyEngoB20EiGdQxWeRrp1wv5Ks/o+AuWbIIGFDAcGkc=; b=BmR7mDY1JWMwFtz7vSwPV+4Wiy6EknfYlSso7BHD8jsc85F+llY4PkIRP8vymtoSTJ t0wh5MHjarPzC6HUu3pVK0zizfcTdPmIvnyRsRbZYcqwbGM48KAsTfmffguztuoEifOp 19dXgqGfbbIjydAKHECudUwLc67S/3j/ED4Dk9hBxAqLiUDalUUWe3dtUzLuQsWz3a6h W/jMYRqDOGl/jidQiBan7Ef58N+F87UrEMjpUUoJkxTrWf4JI6valmga7aJ/g0vATmia ay7lLbOZJtIzNE88XXRI7OAELN6/FVFY5snSvX6a3YZIFNQIPNb8Wtp25exQnevPyvGD CUVg== X-Gm-Message-State: AOJu0Yz8QTIaYkLjT82Qm2JxBAiX8xKlkiA72ouydGb0IsdIl0szTPyy +Nb2BEZ+0H5Pm1OUy/64luQ= X-Received: by 2002:a17:902:ab48:b0:1b7:ca9c:4f5c with SMTP id ij8-20020a170902ab4800b001b7ca9c4f5cmr725279plb.28.1695327289856; Thu, 21 Sep 2023 13:14:49 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id g4-20020a170902c38400b001b8a00d4f7asm1940872plg.9.2023.09.21.13.14.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Sep 2023 13:14:49 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Thu, 21 Sep 2023 13:14:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Content-Language: en-US To: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= Cc: Jisheng Zhang , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev References: <20230717160630.1892-1-jszhang@kernel.org> <20230717160630.1892-3-jszhang@kernel.org> <11fce633-4699-470f-a2f3-94b99b3e6da6@roeck-us.net> <20230921195608.dlol2f6fifx6ahd6@pengutronix.de> From: Guenter Roeck Subject: Re: [PATCH net-next v5 2/2] net: stmmac: use per-queue 64 bit statistics where necessary In-Reply-To: <20230921195608.dlol2f6fifx6ahd6@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 21 Sep 2023 13:41:48 -0700 (PDT) On 9/21/23 12:56, Uwe Kleine-König wrote: > Hello Guenter, > > On Thu, Sep 21, 2023 at 11:34:09AM -0700, Guenter Roeck wrote: >> On Tue, Jul 18, 2023 at 12:06:30AM +0800, Jisheng Zhang wrote: >>> Currently, there are two major issues with stmmac driver statistics >>> First of all, statistics in stmmac_extra_stats, stmmac_rxq_stats >>> and stmmac_txq_stats are 32 bit variables on 32 bit platforms. This >>> can cause some stats to overflow after several minutes of >>> high traffic, for example rx_pkt_n, tx_pkt_n and so on. >>> >>> Secondly, if HW supports multiqueues, there are frequent cacheline >>> ping pongs on some driver statistic vars, for example, normal_irq_n, >>> tx_pkt_n and so on. What's more, frequent cacheline ping pongs on >>> normal_irq_n happens in ISR, this makes the situation worse. >>> >>> To improve the driver, we convert those statistics to 64 bit, implement >>> ndo_get_stats64 and update .get_ethtool_stats implementation >>> accordingly. We also use per-queue statistics where necessary to remove >>> the cacheline ping pongs as much as possible to make multiqueue >>> operations faster. Those statistics which are not possible to overflow >>> and not frequently updated are kept as is. >>> >>> Signed-off-by: Jisheng Zhang >> >> Your patch results in lockdep splats. This is with the orangepi-pc >> emulation in qemu. >> >> [ 11.126950] dwmac-sun8i 1c30000.ethernet eth0: PHY [mdio_mux-0.1:01] driver [Generic PHY] (irq=POLL) >> [ 11.127912] dwmac-sun8i 1c30000.ethernet eth0: No Safety Features support found >> [ 11.128294] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available >> [ 11.128511] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW >> [ 11.138990] dwmac-sun8i 1c30000.ethernet eth0: configuring for phy/mii link mode >> [ 11.144387] INFO: trying to register non-static key. >> [ 11.144483] The code is fine but needs lockdep annotation, or maybe >> [ 11.144568] you didn't initialize this object before use? >> [ 11.144640] turning off the locking correctness validator. >> [ 11.144845] CPU: 2 PID: 688 Comm: ip Tainted: G N 6.6.0-rc2 #1 >> [ 11.144956] Hardware name: Allwinner sun8i Family >> [ 11.145137] unwind_backtrace from show_stack+0x10/0x14 >> [ 11.145610] show_stack from dump_stack_lvl+0x68/0x90 >> [ 11.145692] dump_stack_lvl from register_lock_class+0x99c/0x9b0 >> [ 11.145779] register_lock_class from __lock_acquire+0x6c/0x2244 >> [ 11.145861] __lock_acquire from lock_acquire+0x11c/0x368 >> [ 11.145938] lock_acquire from stmmac_get_stats64+0x350/0x374 >> [ 11.146021] stmmac_get_stats64 from dev_get_stats+0x3c/0x160 >> [ 11.146101] dev_get_stats from rtnl_fill_stats+0x30/0x118 >> [ 11.146179] rtnl_fill_stats from rtnl_fill_ifinfo.constprop.0+0x82c/0x1770 >> [ 11.146273] rtnl_fill_ifinfo.constprop.0 from rtmsg_ifinfo_build_skb+0xac/0x138 >> [ 11.146370] rtmsg_ifinfo_build_skb from rtmsg_ifinfo+0x44/0x7c >> [ 11.146452] rtmsg_ifinfo from __dev_notify_flags+0xac/0xd8 >> [ 11.146531] __dev_notify_flags from dev_change_flags+0x48/0x54 >> [ 11.146612] dev_change_flags from do_setlink+0x244/0xe6c >> [ 11.146689] do_setlink from rtnl_newlink+0x514/0x838 >> [ 11.146761] rtnl_newlink from rtnetlink_rcv_msg+0x170/0x5b0 >> [ 11.146841] rtnetlink_rcv_msg from netlink_rcv_skb+0xb4/0x10c >> [ 11.146925] netlink_rcv_skb from netlink_unicast+0x190/0x254 >> [ 11.147006] netlink_unicast from netlink_sendmsg+0x1dc/0x460 >> [ 11.147086] netlink_sendmsg from ____sys_sendmsg+0xa0/0x2a0 >> [ 11.147168] ____sys_sendmsg from ___sys_sendmsg+0x68/0x94 >> [ 11.147245] ___sys_sendmsg from sys_sendmsg+0x4c/0x88 >> [ 11.147329] sys_sendmsg from ret_fast_syscall+0x0/0x1c >> [ 11.147439] Exception stack(0xf23edfa8 to 0xf23edff0) >> [ 11.147558] dfa0: 00000000 00000000 00000003 bef9a8d8 00000000 00000000 >> [ 11.147668] dfc0: 00000000 00000000 ffffffff 00000128 00000001 00000002 bef9af4a bef9af4d >> [ 11.147769] dfe0: bef9a868 bef9a858 b6f9ddac b6f9d228 >> [ 11.150020] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx >> >> My apologies for the noise if this has already been reported. > > This seems to be the issue I reported earlier. So you might want to test > the patch that fixed it for me: > https://lore.kernel.org/netdev/20230917165328.3403-1-jszhang@kernel.org/ > That just showed up in mainline and, yes, of course it fixes the problem. As I said, sorry for the noise. Guenter