Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp283515rdb; Fri, 5 Jan 2024 09:37:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhsSXxvD4ADaHxd6Mj3l3JQJsyZqKdfPcQMNQIdrxmJZLTMSeZOjviNaWahqFGuc7F0Z89 X-Received: by 2002:a05:600c:a0b:b0:40d:8dcc:ffd6 with SMTP id z11-20020a05600c0a0b00b0040d8dccffd6mr1315781wmp.136.1704476243698; Fri, 05 Jan 2024 09:37:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704476243; cv=none; d=google.com; s=arc-20160816; b=rblSzTHKhyVIirPioGjlTuZRMnuxo7uErfJpWl1baykvQZtaAxgwajjZBoePw89/C2 Xw/+jww6oeDf/IouxFsroifgsS5U5r6cIz6dEBsApSaTybNjPOjaIwZylGvy3wKuEdPD gO/ZjGhYC7yOWc0rVGukvDUzTgRE01jeNzwu5yJ02xBrYC54LSWu6MM05VJVyAupbu5W lbZuljKFZ2qX6V2Zdftg72pdCh6lHpNUhxoRFfgou3YFpLsJxAep3V8GeHz0ea91d7L5 8PzbTbuIEaaTdOX+6pB+owbST7XypXN6TZUcKo0rzeQ7ZGjxSQvGirqPayy93vTrZZgt x2QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qEr1jYijCqIp7tZDUzFDfoa3b/R4ZBz68yiDJpW40qg=; fh=AfDgA/Jgle0p4qM/FdKU2C8XeQoEtUnxXlvU32WOE1M=; b=N40JK83E+EzoJAOjMAo9slTO2nTFXflosslkrf7KxeWkkQOxzI/15MtLDnnX/xJnbz 49O7IM9oi1d3/CPKJF9RUbQnibkR5tQT34PaHjnDYGoLMMgQm6kaO7GfYlqO9ii05uKl C1ztIJCO2JjduqYrObETmrMCQSK+oK5KvQkyfdmnG8VvtVBV9DErEy4xLQsn23Isb0fw aXKvz0oW219wMidRFhJf7k4AxTw34D2KnCRasdGI1XKmp1k1rBRDKwg1pDOuN3S5GdkD ssLYMx4nck8KbfSclNKBpgeZuqhv0wNIOf2fPLPwfcD8ss1Mu3M7WGlaxracG9O2hQcs s7oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5mgkcPg4; spf=pass (google.com: domain of linux-kernel+bounces-18122-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18122-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j8-20020a1709066dc800b00a26e25778dbsi770555ejt.999.2024.01.05.09.37.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 09:37:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18122-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5mgkcPg4; spf=pass (google.com: domain of linux-kernel+bounces-18122-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18122-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6DB341F2227B for ; Fri, 5 Jan 2024 17:37:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3AB8328A7; Fri, 5 Jan 2024 17:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="5mgkcPg4" X-Original-To: linux-kernel@vger.kernel.org Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77B59328AD; Fri, 5 Jan 2024 17:37:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch 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=qEr1jYijCqIp7tZDUzFDfoa3b/R4ZBz68yiDJpW40qg=; b=5mgkcPg4mKbAYOZMncV/6Qor0W ZIl15YN0vYCQPxlECBy3+2sQmRZ5ACW01M8RPPkHOzpfganoOZ+rSl4xbIdAfrxWFcbKMGDbVeFPr 1NsKUoBh/AVWwE9a2UGTpmLg+s1spccRNsGrFnejxM9Ice+LK5+TB2RuuLRhaZzpnxUU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rLo7i-004TT2-08; Fri, 05 Jan 2024 18:36:46 +0100 Date: Fri, 5 Jan 2024 18:36:45 +0100 From: Andrew Lunn To: Petr =?utf-8?B?VGVzYcWZw61r?= 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 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240105154558.2ca38aca@meshulam.tesarici.cz> > 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. Maybe look at mvneta.c for inspiration. Andrew