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 7981DC27C65 for ; Tue, 11 Jun 2024 16:44:13 +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:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UircSFfas676MrPA/GVwe5/hr9iwjMS0n/qObNqPxic=; b=TvUNX+WZ2TCc1l ugNw0P8knAgIMnEifw+tged/eojHCKMtiOEDdzWpU2gIcusz/cSlQzatawT7v1mZEUw89i2lqMvTF lURSGky9UuykQpLYz4Tqj8yfeJxesWYguF6ceVbhIYu+kePrCf5aVzg1vjp2OT9t15hoyTopWmmLD e58/Q5V4X1As7mlyOO3leNG836uOnb4RvE9F/hQ4eyZGxaXaeiLkB1kEpPtBZfdXfo83ptd+TMc6S /Dv7/i83ep0Khm4HuU961yD/vfr7AHjGhW9RxeUhf0HoWjj8irIhqAuWVNhUmQlrnkF1uX8mq2pA0 9AxXNS/wbGB+9Xnt13tQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sH4bG-00000009Y0D-1sDW; Tue, 11 Jun 2024 16:43:58 +0000 Received: from out-189.mta0.migadu.com ([2001:41d0:1004:224b::bd]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sH4bD-00000009Xzf-2Myo for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2024 16:43:57 +0000 X-Envelope-To: andrew@lunn.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1718124231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2BDVLU3eO/EwCDct2pFFi2rm42Ko7vIZl6fyc22jgNI=; b=Dg3k7Hf/nQTK5iphvQSdeQt8pxsI5LS6drfPWq699EOaY9u2Yy9FlT2I9j9iM56R4C60Jb 3A7pWp5oRsnOAujSjD4oxJ4qb+b9n8jd84qp5Lrcjs4jFpA28B4HbyRqTyMzAGVNjea0Pi UsI1+c3HhTC8hYfOb6wpj784Qep5jvY= X-Envelope-To: radhey.shyam.pandey@amd.com X-Envelope-To: netdev@vger.kernel.org X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: michal.simek@amd.com X-Envelope-To: kuba@kernel.org X-Envelope-To: linux@armlinux.org.uk X-Envelope-To: pabeni@redhat.com X-Envelope-To: edumazet@google.com X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: davem@davemloft.net Message-ID: <7eccba8f-2b4d-42cc-8a12-8badc41e1c01@linux.dev> Date: Tue, 11 Jun 2024 12:43:45 -0400 MIME-Version: 1.0 Subject: Re: [PATCH net-next 3/3] net: xilinx: axienet: Add statistics support To: Andrew Lunn Cc: Radhey Shyam Pandey , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michal Simek , Jakub Kicinski , Russell King , Paolo Abeni , Eric Dumazet , linux-kernel@vger.kernel.org, "David S . Miller" References: <20240610231022.2460953-1-sean.anderson@linux.dev> <20240610231022.2460953-4-sean.anderson@linux.dev> <7c06c9d7-ad11-4acd-8c80-fbeb902da40d@lunn.ch> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240611_094356_000587_49BD99A0 X-CRM114-Status: GOOD ( 17.76 ) 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 On 6/10/24 20:29, Andrew Lunn wrote: > On Tue, Jun 11, 2024 at 02:13:40AM +0200, Andrew Lunn wrote: >> On Mon, Jun 10, 2024 at 07:10:22PM -0400, Sean Anderson wrote: >> > Add support for reading the statistics counters, if they are enabled. >> > The counters may be 64-bit, but we can't detect this as there's no >> > ability bit for it and the counters are read-only. Therefore, we assume >> > the counters are 32-bits. >> >> > +static void axienet_stats_update(struct axienet_local *lp) >> > +{ >> > + enum temac_stat stat; >> > + >> > + lockdep_assert_held(&lp->stats_lock); >> > + >> > + u64_stats_update_begin(&lp->hw_stat_sync); >> > + for (stat = 0; stat < STAT_COUNT; stat++) { >> > + u32 counter = axienet_ior(lp, XAE_STATS_OFFSET + stat * 8); >> >> The * 8 here suggests the counters are spaced so that they could be 64 >> bit wide, even when only 32 bits are used. Does the documentation say >> anything about the upper 32 bits when the counters are only 32 bits? >> Are they guaranteed to read as zero? I'm just wondering if the code >> should be forward looking and read all 64 bits? > > Actually, if you read the upper 32 bits and they are not 0, you know > you have 64 bit counters. You can then kill off your period task, it > is not needed because your software counters will wrap around the same > time as the hardware counters. Yes, but then our stats remain stale forever, because we don't refresh stats before reading them as detailed in my other response. --Sean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel