28 Apr, 2016

1 commit

  • A small bug with the new autoksyms support showed that there are
    two kernel modules in the Documentation directory that qualify
    as samples, while all other samples are in the samples/ directory.

    This patch was originally meant as a workaround for that bug, but
    it has now been solved in a different way. However, I still think
    it makes sense as a cleanup to consolidate all sample code in
    one place.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Jonathan Corbet

    Arnd Bergmann
     

28 May, 2014

2 commits

  • Applications can submit a set of commands in one packet to the kernel,
    and in some cases it is required such as reading the temperature
    sensor results. This adds an option W1_CN_BUNDLE to the flags of
    cn_msg to request the kernel to reply in one packet for efficiency.

    The cn_msg flags now check for unknown flag values and return an error
    if one is seen. See "Proper handling of unknown flags in system
    calls" http://lwn.net/Articles/588444/

    This corrects the ack values returned as per the protocol standard,
    namely the original ack for status messages and seq + 1 for all others
    such as the data returned from a read.

    Some of the common variable names have been standardized as follows.
    struct cn_msg *cn
    struct w1_netlink_msg *msg
    struct w1_netlink_cmd *cmd
    struct w1_master *dev

    When an argument and a function scope variable would collide, add req_
    to the argument.

    Signed-off-by: David Fries
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Greg Kroah-Hartman

    David Fries
     
  • This increases the amount of bundling to reduce the number of packets
    sent. For the one wire use there can be multiple struct
    w1_netlink_cmd in a struct w1_netlink_msg and multiple of those in
    struct cn_msg, and with this change multiple of those in a struct
    nlmsghdr, and at each level the len identifies there being multiple of
    the next.

    Signed-off-by: David Fries
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Greg Kroah-Hartman

    David Fries
     

08 Feb, 2014

1 commit


03 Oct, 2013

1 commit


27 Jun, 2012

1 commit


23 Apr, 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
     

03 Oct, 2009

1 commit


24 Jul, 2009

1 commit


22 Jul, 2009

1 commit


18 Jul, 2009

3 commits

  • The connector test code currently does not work out of the box. This is
    because it uses a connector id that is above the registered limit. So
    rather than force people to stumble through undocumented code wondering
    why it isn't working, have the test code use one of the "private" ids by
    default. While I'm in here, clean up the code (kernel and user app) so
    that it's a bit more user friendly and verbose in significant things that
    it does. Terse test code wastes people time as they simply enumerate it
    with all the same kind of debug messages to get a better feel of what code
    is running at any time.

    Signed-off-by: Mike Frysinger
    Signed-off-by: David S. Miller

    Mike Frysinger
     
  • The grammar in most of this file is slightly off, and some sections are
    hard to read due to lack of visual clues breaking up related material.

    Signed-off-by: Mike Frysinger
    Signed-off-by: David S. Miller

    Mike Frysinger
     
  • The connector documentation states that the argument to the callback
    function is always a pointer to a struct cn_msg, but rather than encode it
    in the API itself, it uses a void pointer everywhere. This doesn't make
    much sense to encode the pointer in documentation as it prevents proper C
    type checking from occurring and can easily allow people to use the wrong
    pointer type. So convert the argument type to an explicit struct cn_msg
    pointer.

    Signed-off-by: Mike Frysinger
    Signed-off-by: David S. Miller

    Mike Frysinger
     

19 Jun, 2009

1 commit


13 Feb, 2009

1 commit


31 Oct, 2008

1 commit


13 Aug, 2008

1 commit

  • Currently source files in the Documentation/ sub-dir can easily bit-rot
    since they are not generally buildable, either because they are hidden in
    text files or because there are no Makefile rules for them. This needs to
    be fixed so that the source files remain usable and good examples of code
    instead of bad examples.

    Add the ability to build source files that are in the Documentation/ dir.
    Add to Kconfig as "BUILD_DOCSRC" config symbol.

    Use "CONFIG_BUILD_DOCSRC=1 make ..." to build objects from the
    Documentation/ sources. Or enable BUILD_DOCSRC in the *config system.
    However, this symbol depends on HEADERS_CHECK since the header files need
    to be installed (for userspace builds).

    Built (using cross-tools) for x86-64, i386, alpha, ia64, sparc32,
    sparc64, powerpc, sh, m68k, & mips.

    Signed-off-by: Randy Dunlap
    Reviewed-by: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

20 Jul, 2007

1 commit

  • Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).

    Here is a short excerpt of the semantic patch performing
    this transformation:

    @@
    type T2;
    expression x;
    identifier f,fld;
    expression E;
    expression E1,E2;
    expression e1,e2,e3,y;
    statement S;
    @@

    x =
    - kmalloc
    + kzalloc
    (E1,E2)
    ... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
    - memset((T2)x,0,E1);

    @@
    expression E1,E2,E3;
    @@

    - kzalloc(E1 * E2,E3)
    + kcalloc(E1,E2,E3)

    [akpm@linux-foundation.org: get kcalloc args the right way around]
    Signed-off-by: Yoann Padioleau
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Acked-by: Russell King
    Cc: Bryan Wu
    Acked-by: Jiri Slaby
    Cc: Dave Airlie
    Acked-by: Roland Dreier
    Cc: Jiri Kosina
    Acked-by: Dmitry Torokhov
    Cc: Benjamin Herrenschmidt
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Pierre Ossman
    Cc: Jeff Garzik
    Cc: "David S. Miller"
    Acked-by: Greg KH
    Cc: James Bottomley
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yoann Padioleau
     

27 Aug, 2006

1 commit


21 Mar, 2006

1 commit


09 Nov, 2005

1 commit


14 Oct, 2005

1 commit


12 Sep, 2005

1 commit

  • Kernel connector - new userspace kernel space easy to use
    communication module which implements easy to use bidirectional
    message bus using netlink as it's backend. Connector was created to
    eliminate complex skb handling both in send and receive message bus
    direction.

    Connector driver adds possibility to connect various agents using as
    one of it's backends netlink based network. One must register
    callback and identifier. When driver receives special netlink message
    with appropriate identifier, appropriate callback will be called.

    From the userspace point of view it's quite straightforward:

    socket();
    bind();
    send();
    recv();

    But if kernelspace want to use full power of such connections, driver
    writer must create special sockets, must know about struct sk_buff
    handling... Connector allows any kernelspace agents to use netlink
    based networking for inter-process communication in a significantly
    easier way:

    int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
    void cn_netlink_send(struct cn_msg *msg, u32 __groups, int gfp_mask);

    struct cb_id
    {
    __u32 idx;
    __u32 val;
    };

    idx and val are unique identifiers which must be registered in
    connector.h for in-kernel usage. void (*callback) (void *) - is a
    callback function which will be called when message with above idx.val
    will be received by connector core.

    Using connector completely hides low-level transport layer from it's
    users.

    Connector uses new netlink ability to have many groups in one socket.

    [ Incorporating many cleanups and fixes by myself and
    Andrew Morton -DaveM ]

    Signed-off-by: Evgeniy Polyakov
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    Evgeniy Polyakov