• Sebastian Andrzej Siewior's avatar
    net: stats: Read the statistics in ___gnet_stats_copy_basic() instead of adding. · c5c6e589
    Sebastian Andrzej Siewior authored
    Since the rework, the statistics code always adds up the byte and packet
    value(s). On 32bit architectures a seqcount_t is used in
    gnet_stats_basic_sync to ensure that the 64bit values are not modified
    during the read since two 32bit loads are required. The usage of a
    seqcount_t requires a lock to ensure that only one writer is active at a
    time. This lock leads to disabled preemption during the update.
    
    The lack of disabling preemption is now creating a warning as reported
    by Naresh since the query done by gnet_stats_copy_basic() is in
    preemptible context.
    
    For ___gnet_stats_copy_basic() there is no need to disable preemption
    since the update is performed on stack and can't be modified by another
    writer. Instead of disabling preemption, to avoid the warning,
    simply create a read function to just read the values and return as u64.
    Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
    Fixes: 67c9e627 ("net: sched: Protect Qdisc::bstats with u64_stats")
    Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c5c6e589
gen_stats.c 13.2 KB