30 Sep, 2016

1 commit

  • Introduce light versions of u64_stats helpers for context where
    either preempt or IRQs are disabled. This way we can make this library
    usable by scheduler irqtime accounting which currenty implement its
    ad-hoc version.

    Signed-off-by: Frederic Weisbecker
    Cc: Eric Dumazet
    Cc: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Paolo Bonzini
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Cc: Wanpeng Li
    Link: http://lkml.kernel.org/r/1474849761-12678-4-git-send-email-fweisbec@gmail.com
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

05 May, 2016

1 commit

  • tcp_snd_una_update() and tcp_rcv_nxt_update() call
    u64_stats_update_begin() either from process context or BH handler.

    This triggers a lockdep splat on 32bit & SMP builds.

    We could add u64_stats_update_begin_bh() variant but this would
    slow down 32bit builds with useless local_disable_bh() and
    local_enable_bh() pairs, since we own the socket lock at this point.

    I add sock_owned_by_me() helper to have proper lockdep support
    even on 64bit builds, and new u64_stats_update_begin_raw()
    and u64_stats_update_end_raw methods.

    Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible")
    Reported-by: Fabio Estevam
    Diagnosed-by: Francois Romieu
    Signed-off-by: Eric Dumazet
    Tested-by: Fabio Estevam
    Signed-off-by: David S. Miller

    Eric Dumazet
     

16 Jun, 2015

1 commit

  • Using a function instead of a macro is cleaner and remove
    following W=1 warnings (extract)

    In file included from net/ipv6/ip6_vti.c:29:0:
    net/ipv6/ip6_vti.c: In function ‘vti6_dev_init_gen’:
    include/linux/netdevice.h:2029:18: warning: variable ‘stat’ set but not
    used [-Wunused-but-set-variable]
    typeof(type) *stat; \
    ^
    net/ipv6/ip6_vti.c:862:16: note: in expansion of macro
    ‘netdev_alloc_pcpu_stats’
    dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
    ^
    CC [M] net/ipv6/sit.o
    In file included from net/ipv6/sit.c:30:0:
    net/ipv6/sit.c: In function ‘ipip6_tunnel_init’:
    include/linux/netdevice.h:2029:18: warning: variable ‘stat’ set but not
    used [-Wunused-but-set-variable]
    typeof(type) *stat; \
    ^

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

15 Mar, 2014

1 commit

  • Replace the bh safe variant with the hard irq safe variant.

    We need a hard irq safe variant to deal with netpoll transmitting
    packets from hard irq context, and we need it in most if not all of
    the places using the bh safe variant.

    Except on 32bit uni-processor the code is exactly the same so don't
    bother with a bh variant, just have a hard irq safe variant that
    everyone can use.

    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

06 Nov, 2013

1 commit

  • In order to enable lockdep on seqcount/seqlock structures, we
    must explicitly initialize any locks.

    The u64_stats_sync structure, uses a seqcount, and thus we need
    to introduce a u64_stats_init() function and use it to initialize
    the structure.

    This unfortunately adds a lot of fairly trivial initialization code
    to a number of drivers. But the benefit of ensuring correctness makes
    this worth while.

    Because these changes are required for lockdep to be enabled, and the
    changes are quite trivial, I've not yet split this patch out into 30-some
    separate patches, as I figured it would be better to get the various
    maintainers thoughts on how to best merge this change along with
    the seqcount lockdep enablement.

    Feedback would be appreciated!

    Signed-off-by: John Stultz
    Acked-by: Julian Anastasov
    Signed-off-by: Peter Zijlstra
    Cc: Alexey Kuznetsov
    Cc: "David S. Miller"
    Cc: Eric Dumazet
    Cc: Hideaki YOSHIFUJI
    Cc: James Morris
    Cc: Jesse Gross
    Cc: Mathieu Desnoyers
    Cc: "Michael S. Tsirkin"
    Cc: Mirko Lindner
    Cc: Patrick McHardy
    Cc: Roger Luethi
    Cc: Rusty Russell
    Cc: Simon Horman
    Cc: Stephen Hemminger
    Cc: Steven Rostedt
    Cc: Thomas Petazzoni
    Cc: Wensong Zhang
    Cc: netdev@vger.kernel.org
    Link: http://lkml.kernel.org/r/1381186321-4906-2-git-send-email-john.stultz@linaro.org
    Signed-off-by: Ingo Molnar

    John Stultz
     

29 Nov, 2010

1 commit

  • These warnings are spewed during a build of a 'allnoconfig' kernel
    (especially the ones from u64_stats_sync.h show up a lot) when building
    with -Wextra (which I often do)..
    They are
    a) annoying
    b) easy to get rid of.
    This patch kills them off.

    include/linux/u64_stats_sync.h:70:1: warning: ‘inline’ is not at beginning of declaration
    include/linux/u64_stats_sync.h:77:1: warning: ‘inline’ is not at beginning of declaration
    include/linux/u64_stats_sync.h:84:1: warning: ‘inline’ is not at beginning of declaration
    include/linux/u64_stats_sync.h:96:1: warning: ‘inline’ is not at beginning of declaration
    include/linux/u64_stats_sync.h:115:1: warning: ‘inline’ is not at beginning of declaration
    include/linux/u64_stats_sync.h:127:1: warning: ‘inline’ is not at beginning of declaration
    kernel/time.c:241:1: warning: ‘inline’ is not at beginning of declaration
    kernel/time.c:257:1: warning: ‘inline’ is not at beginning of declaration
    kernel/perf_event.c:4513:1: warning: ‘inline’ is not at beginning of declaration
    mm/page_alloc.c:4012:1: warning: ‘inline’ is not at beginning of declaration

    Signed-off-by: Jesper Juhl
    Signed-off-by: Jiri Kosina

    Jesper Juhl
     

29 Jun, 2010

2 commits


24 Jun, 2010

1 commit

  • To properly implement 64bits network statistics on 32bit or 64bit hosts,
    we provide one new type and four methods, to ease conversions.

    Stats producer should use following template granted it already got an
    exclusive access to counters (include/linux/u64_stats_sync.h contains
    some documentation about details)

    u64_stats_update_begin(&stats->syncp);
    stats->bytes64 += len;
    stats->packets64++;
    u64_stats_update_end(&stats->syncp);

    While a consumer should use following template to get consistent
    snapshot :

    u64 tbytes, tpackets;
    unsigned int start;

    do {
    start = u64_stats_fetch_begin(&stats->syncp);
    tbytes = stats->bytes64;
    tpackets = stats->packets64;
    } while (u64_stats_fetch_retry(&stats->lock, syncp));

    Suggested by David Miller, and comments courtesy of Nick Piggin.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet