Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4468305rwb; Tue, 6 Sep 2022 07:59:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4tUZkKzCYR9qwZCAXWbdBG+8OVOgz+Tbd7gfcPQJtXZuNHpTYq1qlNkg5NNkXyAzSzTdG9 X-Received: by 2002:a05:6a00:4146:b0:537:df7d:d5d2 with SMTP id bv6-20020a056a00414600b00537df7dd5d2mr51655541pfb.31.1662476391470; Tue, 06 Sep 2022 07:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476391; cv=none; d=google.com; s=arc-20160816; b=uQufbZp19Rd7oKSvVkhWEc5v1T/chhC8QxHAPq5zFNdAYSaOlDtEtteHhmPI7HmxjV FB1s/hL1Wa2WIpRP178QNWez4AEjwJxvBSLOBKkvUp5zCedI7fjDWnQAhDG+WB80CbRr 24gZeORAnIVaEQMnJZ45XK5Vsuvsb0N1UKxam69LVRDlVzTBgOeSCvq0+hdIkLryAR0i e7fX8D7EhJU9h1uPzHwVXB7Fr6F2+tSu5m/qhNIjGgriztxO/+SpPY5uEgHp58txKIbU OCepBd9dk5CBLmq88wylnZdquJi/qB+rhVykgo24dieiwruM5bI7Uev+7YmoXDhhhu2U KJnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TjtPUvtWSXs19KX0rNcRWWLeh3h4X/1hBYytJdz7tRI=; b=vOKkUz8h02/U9bpdV42URkSA2O4aq8olZKTOFBauvqkIYpSeaXL7k6tb9mD1LoyzYW hTUtR7FIS1Wvj/CslnpYoTqk39VrfbMFsliEnSQFwaPEeaJagwzkg7H22VIz9zfR+Dga +jwuBpMiA0OMfqwtAup2EXrDXQDXemuLatY+k7IHZsIV/N47kmnKhkyGniAlcwEjOphQ 0CPtmWxsxLEHr4y9mmUdoqMEjQzEOPmD3soYCRdN1fXxYiZOr6o9CIsP0WvthAceTN7d PRo+E/zCDbzhZ06PKbgZ+FXEXNrsXUMRElo/aoCxlCtaIkU/g7N/UWAaj85D9JGi30BL yqjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m9oWsGIy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v63-20020a638942000000b00434b5250df7si1506938pgd.548.2022.09.06.07.59.25; Tue, 06 Sep 2022 07:59:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m9oWsGIy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240979AbiIFOIV (ORCPT + 99 others); Tue, 6 Sep 2022 10:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239801AbiIFOHU (ORCPT ); Tue, 6 Sep 2022 10:07:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80DC85F84; Tue, 6 Sep 2022 06:45:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 83040B8162F; Tue, 6 Sep 2022 13:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB0FDC433D7; Tue, 6 Sep 2022 13:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471873; bh=99zUrlUzgDoAoInppoeVr3lh4X3fhNxHqvt5PoHBQNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9oWsGIyY2l/DV0e6/7/KfKyTxLjYNbM8ifHr4u+gW3Ko97AU1+KF8bcpDV6jrYag rcQGwoUHA8BwIw+UiXkJFgecILgWkoo7jdLVeY4w/3p64QCqE5IVkIdtRRM2jnsJ22 Bw2aDW3rbOZYc4deWRNjHDgsjVE4uhZZxJ6ZK3Ag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , Florian Fainelli , George McCollister , Vivien Didelot , Vladimir Oltean , Sebastian Andrzej Siewior , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 037/155] net: dsa: xrs700x: Use irqsave variant for u64 stats update Date: Tue, 6 Sep 2022 15:29:45 +0200 Message-Id: <20220906132830.996581586@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior [ Upstream commit 3f8ae9fe0409698799e173f698b714f34570b64b ] xrs700x_read_port_counters() updates the stats from a worker using the u64_stats_update_begin() version. This is okay on 32-UP since on the reader side preemption is disabled. On 32bit-SMP the writer can be preempted by the reader at which point the reader will spin on the seqcount until writer continues and completes the update. Assigning the mib_mutex mutex to the underlying seqcount would ensure proper synchronisation. The API for that on the u64_stats_init() side isn't available. Since it is the only user, just use disable interrupts during the update. Use u64_stats_update_begin_irqsave() on the writer side to ensure an uninterrupted update. Fixes: ee00b24f32eb8 ("net: dsa: add Arrow SpeedChips XRS700x driver") Cc: Andrew Lunn Cc: Florian Fainelli Cc: George McCollister Cc: Vivien Didelot Cc: Vladimir Oltean Signed-off-by: Sebastian Andrzej Siewior Acked-by: George McCollister Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/xrs700x/xrs700x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c index 3887ed33c5fe2..fa622639d6401 100644 --- a/drivers/net/dsa/xrs700x/xrs700x.c +++ b/drivers/net/dsa/xrs700x/xrs700x.c @@ -109,6 +109,7 @@ static void xrs700x_read_port_counters(struct xrs700x *priv, int port) { struct xrs700x_port *p = &priv->ports[port]; struct rtnl_link_stats64 stats; + unsigned long flags; int i; memset(&stats, 0, sizeof(stats)); @@ -138,9 +139,9 @@ static void xrs700x_read_port_counters(struct xrs700x *priv, int port) */ stats.rx_packets += stats.multicast; - u64_stats_update_begin(&p->syncp); + flags = u64_stats_update_begin_irqsave(&p->syncp); p->stats64 = stats; - u64_stats_update_end(&p->syncp); + u64_stats_update_end_irqrestore(&p->syncp, flags); mutex_unlock(&p->mib_mutex); } -- 2.35.1