08 May, 2018

1 commit

  • Commit 67db3e4bfbc9 ("tcp: no longer hold ehash lock while calling
    tcp_get_info()") removes the only users of u64_stats_update_end/begin_raw()
    without removing the function in header file.

    Remove no longer used functions.

    Cc: Eric Dumazet
    Signed-off-by: Anna-Maria Gleixner
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: David S. Miller

    Anna-Maria Gleixner
     

08 Mar, 2018

1 commit

  • Marek reported a LOCKDEP issue occurring on 32bit host,
    that we tracked down to the fact that usbnet could either
    run from soft or hard irqs.

    This patch adds u64_stats_update_begin_irqsave() and
    u64_stats_update_end_irqrestore() helpers to solve this case.

    [ 17.768040] ================================
    [ 17.772239] WARNING: inconsistent lock state
    [ 17.776511] 4.16.0-rc3-next-20180227-00007-g876c53a7493c #453 Not tainted
    [ 17.783329] --------------------------------
    [ 17.787580] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
    [ 17.793607] swapper/0/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
    [ 17.798751] (&syncp->seq#5){?.-.}, at: []
    asix_rx_fixup_internal+0x188/0x288
    [ 17.806790] {IN-HARDIRQ-W} state was registered at:
    [ 17.811677] tx_complete+0x100/0x208
    [ 17.815319] __usb_hcd_giveback_urb+0x60/0xf0
    [ 17.819770] xhci_giveback_urb_in_irq+0xa8/0x240
    [ 17.824469] xhci_td_cleanup+0xf4/0x16c
    [ 17.828367] xhci_irq+0xe74/0x2240
    [ 17.831827] usb_hcd_irq+0x24/0x38
    [ 17.835343] __handle_irq_event_percpu+0x98/0x510
    [ 17.840111] handle_irq_event_percpu+0x1c/0x58
    [ 17.844623] handle_irq_event+0x38/0x5c
    [ 17.848519] handle_fasteoi_irq+0xa4/0x138
    [ 17.852681] generic_handle_irq+0x18/0x28
    [ 17.856760] __handle_domain_irq+0x6c/0xe4
    [ 17.860941] gic_handle_irq+0x54/0xa0
    [ 17.864666] __irq_svc+0x70/0xb0
    [ 17.867964] arch_cpu_idle+0x20/0x3c
    [ 17.871578] arch_cpu_idle+0x20/0x3c
    [ 17.875190] do_idle+0x144/0x218
    [ 17.878468] cpu_startup_entry+0x18/0x1c
    [ 17.882454] start_kernel+0x394/0x400
    [ 17.886177] irq event stamp: 161912
    [ 17.889616] hardirqs last enabled at (161912): []
    __netdev_alloc_skb+0xcc/0x140
    [ 17.897893] hardirqs last disabled at (161911): []
    __netdev_alloc_skb+0x94/0x140
    [ 17.904903] exynos5-hsi2c 12ca0000.i2c: tx timeout
    [ 17.906116] softirqs last enabled at (161904): []
    irq_enter+0x78/0x80
    [ 17.906123] softirqs last disabled at (161905): []
    irq_exit+0x134/0x158
    [ 17.925722].
    [ 17.925722] other info that might help us debug this:
    [ 17.933435] Possible unsafe locking scenario:
    [ 17.933435].
    [ 17.940331] CPU0
    [ 17.942488] ----
    [ 17.944894] lock(&syncp->seq#5);
    [ 17.948274]
    [ 17.950847] lock(&syncp->seq#5);
    [ 17.954386].
    [ 17.954386] *** DEADLOCK ***
    [ 17.954386].
    [ 17.962422] no locks held by swapper/0/0.

    Fixes: c8b5d129ee29 ("net: usbnet: support 64bit stats")
    Signed-off-by: Eric Dumazet
    Reported-by: Marek Szyprowski
    Cc: Greg Ungerer
    Signed-off-by: David S. Miller

    Eric Dumazet
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

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