Patch "net: dsa: xrs700x: Use irqsave variant for u64 stats update" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: dsa: xrs700x: Use irqsave variant for u64 stats update

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-dsa-xrs700x-use-irqsave-variant-for-u64-stats-up.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit abf4845d4b3d4b6823f09f832fefc3ab5e1d97dc
Author: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Date:   Thu Aug 25 13:36:44 2022 +0200

    net: dsa: xrs700x: Use irqsave variant for u64 stats update
    
    [ 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 <andrew@xxxxxxx>
    Cc: Florian Fainelli <f.fainelli@xxxxxxxxx>
    Cc: George McCollister <george.mccollister@xxxxxxxxx>
    Cc: Vivien Didelot <vivien.didelot@xxxxxxxxx>
    Cc: Vladimir Oltean <olteanv@xxxxxxxxx>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
    Acked-by: George McCollister <george.mccollister@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c
index 469420941054e..cf363d5a30020 100644
--- a/drivers/net/dsa/xrs700x/xrs700x.c
+++ b/drivers/net/dsa/xrs700x/xrs700x.c
@@ -108,6 +108,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));
@@ -137,9 +138,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);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux