31 Jul, 2020

1 commit

  • This converts all the existing DECLARE_TASKLET() (and ...DISABLED)
    macros with DECLARE_TASKLET_OLD() in preparation for refactoring the
    tasklet callback type. All existing DECLARE_TASKLET() users had a "0"
    data argument, it has been removed here as well.

    Reviewed-by: Greg Kroah-Hartman
    Acked-by: Thomas Gleixner
    Signed-off-by: Kees Cook

    Kees Cook
     

05 Sep, 2019

1 commit


31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 Jun, 2018

1 commit

  • While documentation suggests atomic_inc_not_zero_hint() will perform better
    than atomic_inc_not_zero(), this is unlikely to be the case. No architectures
    implement atomic_inc_not_zero_hint() directly, and thus it either falls back to
    atomic_inc_not_zero(), or a loop using atomic_cmpxchg().

    Whenever the hint does not match the value in memory, the repeated use of
    atomic_cmpxchg() will be more expensive than the read that
    atomic_inc_not_zero_hint() attempts to avoid. For architectures with LL/SC
    atomics, a read cannot be avoided, and it would always be better to use
    atomic_inc_not_zero() directly. For other architectures, their own
    atomic_inc_not_zero() is likely to be more optimal than an atomic_cmpxchg()
    loop regardless.

    Generally, atomic_inc_not_zero_hint() is liable to perform worse than
    atomic_inc_not_zero(). Further, atomic_inc_not_zero_hint() only exists
    for atomic_t, and not atomic64_t or atomic_long_t, and there is only one
    user in the kernel tree.

    Given all this, let's remove atomic_inc_not_zero_hint(), and migrate the
    existing user over to atomic_inc_not_zero().

    There should be no functional change as a result of this patch.

    Signed-off-by: Mark Rutland
    Reviewed-by: Will Deacon
    Acked-by: Peter Zijlstra (Intel)
    Cc: Boqun Feng
    Cc: Linus Torvalds
    Cc: Thomas Gleixner
    Link: https://lore.kernel.org/lkml/20180621121321.4761-4-mark.rutland@arm.com
    Signed-off-by: Ingo Molnar

    Mark Rutland
     

17 Jun, 2018

1 commit

  • ATM accounts for in-flight TX packets in sk_wmem_alloc of the VCC on
    which they are to be sent. But it doesn't take ownership of those
    packets from the sock (if any) which originally owned them. They should
    remain owned by their actual sender until they've left the box.

    There's a hack in pskb_expand_head() to avoid adjusting skb->truesize
    for certain skbs, precisely to avoid messing up sk_wmem_alloc
    accounting. Ideally that hack would cover the ATM use case too, but it
    doesn't — skbs which aren't owned by any sock, for example PPP control
    frames, still get their truesize adjusted when the low-level ATM driver
    adds headroom.

    This has always been an issue, it seems. The truesize of a packet
    increases, and sk_wmem_alloc on the VCC goes negative. But this wasn't
    for normal traffic, only for control frames. So I think we just got away
    with it, and we probably needed to send 2GiB of LCP echo frames before
    the misaccounting would ever have caused a problem and caused
    atm_may_send() to start refusing packets.

    Commit 14afee4b609 ("net: convert sock.sk_wmem_alloc from atomic_t to
    refcount_t") did exactly what it was intended to do, and turned this
    mostly-theoretical problem into a real one, causing PPPoATM to fail
    immediately as sk_wmem_alloc underflows and atm_may_send() *immediately*
    starts refusing to allow new packets.

    The least intrusive solution to this problem is to stash the value of
    skb->truesize that was accounted to the VCC, in a new member of the
    ATM_SKB(skb) structure. Then in atm_pop_raw() subtract precisely that
    value instead of the then-current value of skb->truesize.

    Fixes: 158f323b9868 ("net: adjust skb->truesize in pskb_expand_head()")
    Signed-off-by: David Woodhouse
    Tested-by: Kevin Darbyshire-Bryant
    Signed-off-by: David S. Miller

    David Woodhouse
     

01 Jul, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: David S. Miller

    Reshetova, Elena
     

18 Apr, 2014

1 commit

  • Mostly scripted conversion of the smp_mb__* barriers.

    Signed-off-by: Peter Zijlstra
    Acked-by: Paul E. McKenney
    Link: http://lkml.kernel.org/n/tip-55dhyhocezdw1dg7u19hmh1u@git.kernel.org
    Cc: Linus Torvalds
    Cc: linux-arch@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

02 Dec, 2012

2 commits


30 Nov, 2012

2 commits

  • The pppoatm_may_send() is quite heavy and it's called three times
    in pppoatm_send() and inlining costs more than 200 bytes of code
    (more than 10% of total pppoatm driver code size).

    add/remove: 1/0 grow/shrink: 0/1 up/down: 132/-367 (-235)
    function old new delta
    pppoatm_may_send - 132 +132
    pppoatm_send 900 533 -367

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The vcc_destroy_socket() closes vcc before the protocol is detached
    from vcc by calling vcc->push() with NULL skb. This leaves some time
    window, where the protocol may call vcc->send() on closed vcc
    and crash.

    Now pppoatm_send(), like vcc_sendmsg(), checks for vcc flags that
    indicate that vcc is not ready. If the vcc is not ready we just
    drop frame. Queueing frames is much more complicated because we
    don't have callbacks that inform us about vcc flags changes.

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     

28 Nov, 2012

3 commits

  • The pppoatm_send() does not take any lock that will prevent concurrent
    vcc_sendmsg(). This causes two problems:

    - there is no locking between checking the send queue size
    with atm_may_send() and incrementing sk_wmem_alloc,
    and the real queue size can be a little higher than sk_sndbuf

    - the vcc->sendmsg() can be called concurrently. I'm not sure
    if it's allowed. Some drivers (eni, nicstar, ...) seem
    to assume it will never happen.

    Now pppoatm_send() takes ATM socket lock, the same that is used
    in vcc_sendmsg() and other ATM socket functions. The pppoatm_send()
    is called with BH disabled, so bh_lock_sock() is used instead
    of lock_sock().

    Signed-off-by: Krzysztof Mazur
    Cc: Chas Williams - CONTRACTOR
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The pppoatm used module_put() during unassignment from vcc with
    hope that we have BKL. This assumption is no longer true.

    Now owner field in atmvcc is used to move this module_put()
    to vcc_destroy_socket().

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The pppoatm does not check if used vcc is in connected state,
    causing an Oops in pppoatm_send() when vcc->send() is called
    on not fully connected socket.

    Now pppoatm can be assigned only on connected sockets; otherwise
    -EINVAL error is returned.

    Signed-off-by: Krzysztof Mazur
    Cc: Chas Williams - CONTRACTOR
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     

04 Jun, 2012

1 commit


14 Apr, 2012

1 commit

  • We discovered that PPPoATM has an excessively deep transmit queue. A
    queue the size of the default socket send buffer (wmem_default) is
    maintained between the PPP generic core and the ATM device.

    Fix it to queue a maximum of *two* packets. The one the ATM device is
    currently working on, and one more for the ATM driver to process
    immediately in its TX done interrupt handler. The PPP core is designed
    to feed packets to the channel with minimal latency, so that really
    ought to be enough to keep the ATM device busy.

    While we're at it, fix the fact that we were triggering the wakeup
    tasklet on *every* pppoatm_pop() call. The comment saying "this is
    inefficient, but doing it right is too hard" turns out to be overly
    pessimistic... I think :)

    On machines like the Traverse Geos, with a slow Geode CPU and two
    high-speed ADSL2+ interfaces, there were reports of extremely high CPU
    usage which could partly be attributed to the extra wakeups.

    (The wakeup handling could actually be made a whole lot easier if we
    stop checking sk->sk_sndbuf altogether. Given that we now only queue
    *two* packets ever, one wonders what the point is. As it is, you could
    already deadlock the thing by setting the sk_sndbuf to a value lower
    than the MTU of the device, and it'd just block for ever.)

    Signed-off-by: David Woodhouse
    Signed-off-by: David S. Miller

    David Woodhouse
     

05 Mar, 2012

1 commit

  • Since all that include/linux/if_ppp.h does is #include ,
    this replaces the occurrences of #include with
    #include .

    It also corrects an error in Documentation/networking/l2tp.txt, where
    it referenced include/linux/if_ppp.h as the source of some definitions
    that are actually now defined in include/linux/if_pppol2tp.h.

    Signed-off-by: Paul Mackerras
    Signed-off-by: David S. Miller

    Paul Mackerras
     

23 Nov, 2011

1 commit


07 Jun, 2011

1 commit


05 Aug, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

27 Jan, 2010

2 commits


11 Oct, 2007

1 commit


22 Jul, 2006

1 commit


01 Jul, 2006

1 commit


12 Jan, 2006

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds