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 A5221C3DA6E for ; Mon, 8 Jan 2024 10:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YWVS7XIBPORMc3ECEYt33GnZ2io018VaA/ApHv2DMnE=; b=yxt+L140A5c3Ue S7BFprq2kyT41CFk8xbqjp8nyRTldeSHmH6w98fqHk3ty4vLXmnwOYXLpRPOCYwP9Kvn/JQ5yIYYM rZAvVHyHhFYRq+ZWDwmbk5jq0qRR2FFzQH5I0lgBDow0HWoKs+Zf0LzkRGsN/UDfWw2WPTrmo5qVQ 9GyKSzB3DhFU3YKgLy3pwDGHEo9M8puTi4Ti1tOczwqYvrw3Sgp7g8Vsy1L+cRBPWKOszE5i2vE06 RW/QmERCW8Za+YzBDAhtkDuoCyYloygupXl4OMH3OZIhsdM2iJatqqwxpop0oJt0HHPMPm8Ed/pPm JSoNFSmYsyolU0T8JRsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rMmyN-004cXM-1Z; Mon, 08 Jan 2024 10:35:11 +0000 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rMmyK-004cWm-1P for linux-arm-kernel@lists.infradead.org; Mon, 08 Jan 2024 10:35:10 +0000 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-131-SSdTflTDNiSgu7lU4QYbVg-1; Mon, 08 Jan 2024 10:35:00 +0000 X-MC-Unique: SSdTflTDNiSgu7lU4QYbVg-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 8 Jan 2024 10:34:35 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Mon, 8 Jan 2024 10:34:35 +0000 From: David Laight To: 'Andrew Lunn' , =?iso-8859-2?Q?Petr_Tesa=F8=EDk?= CC: Eric Dumazet , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , "Chen-Yu Tsai" , Jernej Skrabec , "Samuel Holland" , "open list:STMMAC ETHERNET DRIVER" , "moderated list:ARM/STM32 ARCHITECTURE" , "moderated list:ARM/STM32 ARCHITECTURE" , open list , "open list:ARM/Allwinner sunXi SoC support" , Jiri Pirko Subject: RE: [PATCH] net: stmmac: protect statistics updates with a spinlock Thread-Topic: [PATCH] net: stmmac: protect statistics updates with a spinlock Thread-Index: AQHaP/3Ni9qIc9t6xUGHU0aBdMePobDPuW8A Date: Mon, 8 Jan 2024 10:34:35 +0000 Message-ID: References: <20240105091556.15516-1-petr@tesarici.cz> <20240105113402.0f5f1232@meshulam.tesarici.cz> <20240105121447.11ae80d1@meshulam.tesarici.cz> <20240105142732.1903bc70@meshulam.tesarici.cz> <20240105154558.2ca38aca@meshulam.tesarici.cz> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240108_023508_819014_21F17CD8 X-CRM114-Status: GOOD ( 12.25 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Andrew Lunn > Sent: 05 January 2024 17:37 > > > This only leaves an atomic_t in hard irq context. I have tried to find > > something that could relax the requirement, but AFAICS at least some > > setups use several interrupts that can be delivered to different CPUs > > simultaneously, and all of them will walk over all channels. So we're > > left with an atomic_t here. > > You might want to consider per CPU statistics. Since each CPU has its > own structure of statistics, you don't need atomic. > > The code actually using the statistics then needs to sum up the per > CPU statistics, and using syncp should be sufficient for that. Doesn't that consume rather a lot of memory on systems with 'silly numbers' of cpu? Updating an atomic_t is (pretty much) the same as taking a lock. unlock() is also likely to also contain an atomic operation. So if you update more than two atomic_t it is likely that a lock will be faster. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel