Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2878086rdb; Tue, 12 Sep 2023 15:19:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEexuvpbRz9/b0oDiQNa0Co7rXIKOzATAIF7SoUmT6wmrs0Y87a4n+wb6Ji7OccexAcA/wx X-Received: by 2002:a17:90a:f009:b0:263:9e9b:5586 with SMTP id bt9-20020a17090af00900b002639e9b5586mr552831pjb.44.1694557156526; Tue, 12 Sep 2023 15:19:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694557156; cv=none; d=google.com; s=arc-20160816; b=fCTpLAfXzpDIvmtytDjbmk6/royoNfGpsIXRVkRky8xK0ioPdyM7nt4KrJ5DZpHuWK n+72AxYLaJK2++pr1VzWCHQqMxxhMSvTO3kuZnGA7TOQ9VTsngDhoiQUHIl/aXkJQrAI BA4PTulxuT4ofCoO2kJLB2argMfETiLvKynWrfMoJXxLK6pBG2oXJLnf5aD8i203tQt0 w1HOgjWBTxODuPmRudo/J2SMRZlJuRuASAPjZfNcYxjT6GnR6v7c/gpevLnV0yDH335I 9sqjhvGYrUxeR7UrkSUP3q/YcmN4LXXcngsK8yxSXLAF4VgD/y/Q26VNT2CLNSR5tG+F DdfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=66b1dQizWW+fC+qmJ4SM+GQt1e88uQ9iq/5zT3+gwsg=; fh=QId1vhGZTJdC0aDrXLZm0zWOtGF4ANdlTjGltPoEQWg=; b=dTIag+30+oeSoNTBlijms6Xxo4caFFxBfW0dDqaekgmIzyupue9Akjd//tJsbiBAnN vNpunbVwq4H/olpKUV4lUtnqsO+mKQXgcBg59aYnzp3tc1YghyZtK5762iQnMjctjwuG NHcYZDu20Fs5ccKLn8/2ypKCnRJUdq/d3/QbtqQRmfDIYrq8dFhUZkRrDRAd4YBHQmMU RHxSIWkcKKnfXgzamdBvtM5eVcB8nNdcvILuxtNHQESx2bZOTZV9zlRmY8gMGOjsO+RW EFucuXvCRY/4o+Yf+QfdCVd2Zj3zP4VbjI+54grYtz9GFqsdaOw2nKztbdnByq1B01S8 RaMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=VoDvG1Ev; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k8-20020a17090a9d8800b00274077b3ff1si200147pjp.54.2023.09.12.15.19.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:19:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=VoDvG1Ev; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 23B6B80787EF; Tue, 12 Sep 2023 02:30:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233558AbjILJae (ORCPT + 99 others); Tue, 12 Sep 2023 05:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbjILJad (ORCPT ); Tue, 12 Sep 2023 05:30:33 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE18AA; Tue, 12 Sep 2023 02:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=66b1dQizWW+fC+qmJ4SM+GQt1e88uQ9iq/5zT3+gwsg=; t=1694511029; x=1695720629; b=VoDvG1EvU00rHRt+YnhGzMFmb2Y11gXcqsejiqev8loU+dv nLr2b94EH9jKDpEbXKBwsafqRKDFLbBsxbKo3HvlXsB7dv9jeUUeygnnQfWeDywO0xCedoLh6wIxw CWYdNy4Ctq9v3Xmidi44qke8GDWK9OD+2TQBog+nUkEDxmFfZaE3CRi+rB3i4DNnXYSonz7Zn78YT DoVoBnmVNxTW7uKV4fC38Vd3TbDqJXEdrlA33SBf+0D1dhM6XOb7ikxUrnxQBNbvFzBDw3a3b2hMK Ldo0FSMvfUQOa/SeFn9ocUIFl30vYF/EvhgnbwaksfVWQ+RlTCWqVAZMCBeRq0zw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1qfzit-00CWw1-1f; Tue, 12 Sep 2023 11:30:19 +0200 Message-ID: <2fcc9fb0e40ceff8ea4ae55cca3ce0aff75a20ca.camel@sipsolutions.net> Subject: Re: [REGRESSION] [PATCH net-next v5 2/2] net: stmmac: use per-queue 64 bit statistics where necessary From: Johannes Berg To: Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , Lucas Stach , Jisheng Zhang Cc: Maxime Coquelin , Eric Dumazet , Samuel Holland , netdev@vger.kernel.org, "David S . Miller" , Alexandre Torgue , Jernej Skrabec , linux-kernel@vger.kernel.org, Chen-Yu Tsai , Jose Abreu , kernel@pengutronix.de, Giuseppe Cavallaro , Jakub Kicinski , Paolo Abeni , linux-sunxi@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Date: Tue, 12 Sep 2023 11:30:14 +0200 In-Reply-To: <20230912092411.pprnpvrbxwz77x6a@pengutronix.de> References: <20230717160630.1892-1-jszhang@kernel.org> <20230717160630.1892-3-jszhang@kernel.org> <20230911171102.cwieugrpthm7ywbm@pengutronix.de> <99695befef06b025de2c457ea5f861aa81a0883c.camel@pengutronix.de> <20230912092411.pprnpvrbxwz77x6a@pengutronix.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-malware-bazaar: not-scanned 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 (lipwig.vger.email [0.0.0.0]); Tue, 12 Sep 2023 02:30:36 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 lipwig.vger.email On Tue, 2023-09-12 at 11:24 +0200, Uwe Kleine-K=C3=B6nig wrote: > >=20 > > The newly added "struct u64_stats_sync syncp" uses a seqlock > > internally, which is broken into multiple words on 32bit machines, and > > needs to be initialized properly. You need to call u64_stats_init on > > syncp before first usage. >=20 > This is done. The problematic thing is that in stmmac_open() -> > __stmmac_open() the syncp initialized before is overwritten by >=20 > memcpy(&priv->dma_conf, dma_conf, sizeof(*dma_conf)); >=20 > Do I need to point out that this is ugly? I think it also leaks the (lockdep) state since it reinits the syncp (and a lot of other state) doing this. This is also called when the MTU changes. Also, I couldn't convince myself that it's even race-free? Even if it is, it's not really obvious, IMHO. So it seems to me that really this needs to be split into data that actually should be reinitialized, and data that shouldn't, or just not use memcpy() here but copy only the relevant state? But anyway, I have no skin in this game - just reviewing this because I was trying to help out Uwe. johannes