10 Aug, 2017

1 commit


09 Aug, 2017

1 commit


25 Aug, 2016

1 commit

  • Do you think kernel build is 100% dominated by gcc? You are wrong!
    One small utility called "fixdep" consistently manages to sneak into
    profile's first page (unless you have small monitor of course).

    The choke point is this clever code:

    for (; m < end; m++) {
    if (*m == INT_CONF) { p = (char *) m ; goto conf; }
    if (*m == INT_ONFI) { p = (char *) m-1; goto conf; }
    if (*m == INT_NFIG) { p = (char *) m-2; goto conf; }
    if (*m == INT_FIG_) { p = (char *) m-3; goto conf; }

    4 branches per 4 characters is not fast.

    Use strstr(3), so that SSE2 etc can be used.

    With this patch, fixdep is so deep at the bottom, it is hard to find it.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Michal Marek

    Alexey Dobriyan
     

22 Jul, 2016

1 commit

  • bin2c is used to create a valid C file out of a binary file where two
    symbols will be globally defined: and _size. is
    passed as the first parameter of the host binary.

    Building using goto-cc reported that the purgatory binary code (the only
    current user of this utility) declares kexec_purgatory_size as 'size_t'
    where bin2c generate _size to be 'int' so in a 64-bit host where
    sizeof(size_t) > sizeof(int) this type mismatch will always yield the
    wrong value for big-endian architectures while for little-endian it will
    be wrong if the object laid in memory directly after
    kexec_purgatory_size contains non-zero value at the time of reading.

    This commit changes _size to be size_t instead.

    Note:

    Another way to fix the problem is to change the type of
    kexec_purgatory_size to be 'int' as there's this check in code:
    (kexec_purgatory_size
    Cc: Vivek Goyal
    Acked-by: Dave Young
    Signed-off-by: Michal Marek

    Tautschnig, Michael
     

30 Mar, 2016

2 commits

  • Like with kconfig options, we now have the ability to compile in and
    out individual EXPORT_SYMBOL() declarations based on the content of
    include/generated/autoksyms.h. However we don't want the entire
    world to be rebuilt whenever that file is touched.

    Let's apply the same build dependency trick used for CONFIG_* symbols
    where the time stamp of empty files whose paths matching those symbols
    is used to trigger fine grained rebuilds. In our case the key is the
    symbol name passed to EXPORT_SYMBOL().

    However, unlike config options, we cannot just use fixdep to parse
    the source code for EXPORT_SYMBOL(ksym) because several variants exist
    and parsing them all in a separate tool, and keeping it in synch, is
    not trivially maintainable. Furthermore, there are variants such as

    EXPORT_SYMBOL_GPL(pci_user_read_config_##size);

    that are instanciated via a macro for which we can't easily determine
    the actual exported symbol name(s) short of actually running the
    preprocessor on them.

    Storing the symbol name string in a special ELF section doesn't work
    for targets that output assembly or preprocessed source.

    So the best way is really to leverage the preprocessor by having it
    output actual symbol names anchored by a special sequence that can be
    easily filtered out. Then the list of symbols is simply fed to fixdep
    to be merged with the other dependencies.

    That implies the preprocessor is executed twice for each source file.
    A previous attempt relied on a warning pragma for each EXPORT_SYMBOL()
    instance that was filtered apart from stderr by the build system with
    a sed script during the actual compilation pass. Unfortunately the
    preprocessor/compiler diagnostic output isn't stable between versions
    and this solution, although more efficient, was deemed too fragile.

    Because of the lowercasing performed by fixdep, there might be name
    collisions triggering spurious rebuilds for similar symbols. But this
    shouldn't be a big issue in practice. (This is the case for CONFIG_*
    symbols and I didn't want to be different here, whatever the original
    reason for doing so.)

    To avoid needless build overhead, the exported symbol name gathering is
    performed only when CONFIG_TRIM_UNUSED_KSYMS is selected.

    Signed-off-by: Nicolas Pitre
    Acked-by: Rusty Russell

    Nicolas Pitre
     
  • ... and merge them in the list of parsed dependencies.

    Signed-off-by: Nicolas Pitre

    Nicolas Pitre
     

18 Feb, 2016

1 commit

  • Coverity has recently added a check that will find when we don't check
    the return code from fstat(2). Copy/paste the checking logic that
    print_deps() has with an appropriate re-wording of the perror() message.

    Signed-off-by: Tom Rini
    Signed-off-by: Michal Marek

    Tom Rini
     

07 Dec, 2015

1 commit


24 Aug, 2015

2 commits


09 Aug, 2014

2 commits

  • currently bin2c builds only if CONFIG_IKCONFIG=y. But bin2c will now be
    used by kexec too. So make it compilation dependent on CONFIG_BUILD_BIN2C
    and this config option can be selected by CONFIG_KEXEC and CONFIG_IKCONFIG.

    Signed-off-by: Vivek Goyal
    Cc: Borislav Petkov
    Cc: Michael Kerrisk
    Cc: Yinghai Lu
    Cc: Eric Biederman
    Cc: H. Peter Anvin
    Cc: Matthew Garrett
    Cc: Greg Kroah-Hartman
    Cc: Dave Young
    Cc: WANG Chao
    Cc: Baoquan He
    Cc: Andy Lutomirski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     
  • This patch series does not do kernel signature verification yet. I plan
    to post another patch series for that. Now distributions are already
    signing PE/COFF bzImage with PKCS7 signature I plan to parse and verify
    those signatures.

    Primary goal of this patchset is to prepare groundwork so that kernel
    image can be signed and signatures be verified during kexec load. This
    should help with two things.

    - It should allow kexec/kdump on secureboot enabled machines.

    - In general it can help even without secureboot. By being able to verify
    kernel image signature in kexec, it should help with avoiding module
    signing restrictions. Matthew Garret showed how to boot into a custom
    kernel, modify first kernel's memory and then jump back to old kernel and
    bypass any policy one wants to.

    This patch (of 15):

    Kexec wants to use bin2c and it wants to use it really early in the build
    process. See arch/x86/purgatory/ code in later patches.

    So move bin2c in scripts/basic so that it can be built very early and
    be usable by arch/x86/purgatory/

    Signed-off-by: Vivek Goyal
    Cc: Borislav Petkov
    Cc: Michael Kerrisk
    Cc: Yinghai Lu
    Cc: Eric Biederman
    Cc: H. Peter Anvin
    Cc: Matthew Garrett
    Cc: Greg Kroah-Hartman
    Cc: Dave Young
    Cc: WANG Chao
    Cc: Baoquan He
    Cc: Andy Lutomirski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     

10 Jun, 2014

1 commit


06 Apr, 2013

1 commit

  • The current use-case for fixdep is: a source file is run through a single
    processing step, which creates a single dependency file as a side-effect,
    which fixdep transforms into the file used by the kernel build process.

    In order to transparently run the C pre-processor on device-tree files,
    we wish to run both gcc -E and dtc on a source file in a single rule.
    This generates two dependency files, which must be transformed together
    into the file used by the kernel build process. This change modifies
    fixdep so it can process the concatenation of multiple separate input
    dependency files, and produce a correct unified output.

    The code changes have the slight benefit of transforming the loop in
    parse_dep_file() into more of a lexer/tokenizer, with the loop body being
    more of a parser. Previously, some of this logic was mixed together
    before the loop. I also added some comments, which I hope are useful.

    Benchmarking shows that on a cross-compiled ARM tegra_defconfig build,
    there is less than 0.5 seconds speed decrease with this change, on top
    of a build time of ~2m24s. This is probably within the noise.

    Signed-off-by: Stephen Warren
    Acked-by: Rob Herring

    Stephen Warren
     

09 Jan, 2013

1 commit


09 Sep, 2011

1 commit

  • The introduction of include/linux/kconfig.h created 3 extraneous
    dependencies:
    include/config/.h
    include/config/h.h
    include/config/foo.h

    Fix this by excluding kconfig.h from fixdep calculations.

    Signed-off-by: Peter Foley
    Signed-off-by: Michal Marek

    Peter Foley
     

03 May, 2011

1 commit


14 Mar, 2011

1 commit

  • Recent change to fixdep:

    commit b7bd182176960fdd139486cadb9962b39f8a2b50
    Author: Michal Marek
    Date: Thu Feb 17 15:13:54 2011 +0100

    fixdep: Do not record dependency on the source file itself

    changed the format of the *.cmd files without realizing that it is also
    used by modpost. Put the path to the source file to the file back, in a
    special variable, so that modpost sees all source files when calculating
    srcversion for modules.

    Reported-and-tested-by: Henrik Rydberg
    Signed-off-by: Michal Marek
    Signed-off-by: Linus Torvalds

    Michal Marek
     

21 Feb, 2011

1 commit

  • The dependency is already expressed by the Makefiles, storing it in the
    .cmd file breaks build if a .c file is replaced by .S or vice versa,
    because the .cmd file contains

    foo/bar.o: foo/bar.c ...

    foo/bar.c ... :

    so the foo/bar.c -> foo/bar.o rule triggers even if there is no
    foo/bar.c anymore.

    Acked-by: Stephen Rothwell
    Signed-off-by: Michal Marek

    Michal Marek
     

23 Dec, 2010

1 commit


15 Dec, 2010

1 commit


12 Nov, 2010

1 commit

  • I noticed fixdep uses ~2% of cpu time in kernel build, in function
    use_config()

    fixdep spends a lot of cpu cycles in linear searches in its internal
    string array. With about 400 stored strings per dep file, this begins to
    be noticeable.

    Convert fixdep to use a hash table.

    kbuild results on my x86_64 allmodconfig

    Before patch :

    real 10m30.414s
    user 61m51.456s
    sys 8m28.200s

    real 10m12.334s
    user 61m50.236s
    sys 8m30.448s

    real 10m42.947s
    user 61m50.028s
    sys 8m32.380s

    After:

    real 10m8.180s
    user 61m22.506s
    sys 8m32.384s

    real 10m35.039s
    user 61m21.654s
    sys 8m32.212s

    real 10m14.487s
    user 61m23.498s
    sys 8m32.312s

    Signed-off-by: Eric Dumazet
    Signed-off-by: Michal Marek

    Eric Dumazet
     

29 Oct, 2010

1 commit

  • * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: (39 commits)
    Revert "namespace: add source file location exceptions"
    Coccinelle: Add contextual message
    Coccinelle: Fix documentation
    Coccinelle: Find doubled arguments to boolean or bit operators.
    Coccinelle: Find nested lock+irqsave functions that use the same flags variables.
    namespace: add source file location exceptions
    scripts/extract-ikconfig: add support for bzip2, lzma and lzo
    kbuild: check return value of asprintf()
    scripts/namespace.pl: improve to get more correct results
    scripts/namespace.pl: some bug fixes
    scripts/namespace.pl: update file exclusion list
    scripts/namespace.pl: fix wrong source path
    Coccinelle: Use the -no_show_diff option for org and report mode
    Coccinelle: Add a new mode named 'chain'
    Coccinelle: Use new comment format to explain kfree.cocci
    Coccinelle: Improve user information with a new kind of comment
    Coccinelle: Update documentation
    MAINTAINERS: Coccinelle: Update email address
    Documentation/kbuild: modules.txt cleanup
    Documentation/kbuild: major edit of modules.txt sections 5-8
    ...

    Linus Torvalds
     

28 Oct, 2010

1 commit

  • Check return value of asprintf() in docsect() and exit if error
    occurs. This removes following warning:

    HOSTCC scripts/basic/docproc
    scripts/basic/docproc.c: In function ‘docsect’:
    scripts/basic/docproc.c:336: warning: ignoring return value of ‘asprintf’,
    declared with attribute warn_unused_result

    Signed-off-by: Namhyung Kim
    Acked-by: Randy Dunlap
    Signed-off-by: Michal Marek

    Namhyung Kim
     

23 Sep, 2010

1 commit


12 Sep, 2010

1 commit

  • When you don't use !E or !I but only !F, then it's very easy to miss
    including some functions, structs etc. in documentation. To help
    finding which ones were missed, allow printing out the unused ones as
    warnings.

    For example, using this on mac80211 yields a lot of warnings like this:

    Warning: didn't use docs for DOC: mac80211 workqueue
    Warning: didn't use docs for ieee80211_max_queues
    Warning: didn't use docs for ieee80211_bss_change
    Warning: didn't use docs for ieee80211_bss_conf

    when generating the documentation for it.

    Signed-off-by: Johannes Berg
    Signed-off-by: Randy Dunlap
    Signed-off-by: Linus Torvalds

    Johannes Berg
     

12 Dec, 2009

1 commit


24 Sep, 2009

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (30 commits)
    Use macros for .data.page_aligned section.
    Use macros for .bss.page_aligned section.
    Use new __init_task_data macro in arch init_task.c files.
    kbuild: Don't define ALIGN and ENTRY when preprocessing linker scripts.
    arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0
    kbuild: add static to prototypes
    kbuild: fail build if recordmcount.pl fails
    kbuild: set -fconserve-stack option for gcc 4.5
    kbuild: echo the record_mcount command
    gconfig: disable "typeahead find" search in treeviews
    kbuild: fix cc1 options check to ensure we do not use -fPIC when compiling
    checkincludes.pl: add option to remove duplicates in place
    markup_oops: use modinfo to avoid confusion with underscored module names
    checkincludes.pl: provide usage helper
    checkincludes.pl: close file as soon as we're done with it
    ctags: usability fix
    kernel hacking: move STRIP_ASM_SYMS from General
    gitignore usr/initramfs_data.cpio.bz2 and usr/initramfs_data.cpio.lzma
    kbuild: Check if linker supports the -X option
    kbuild: introduce ld-option
    ...

    Fix trivial conflict in scripts/basic/fixdep.c

    Linus Torvalds
     

21 Sep, 2009

2 commits


20 Sep, 2009

1 commit


20 Jun, 2009

1 commit

  • Fix the following build error when do 'make htmldocs':

    DOCPROC Documentation/DocBook/debugobjects.xml
    exec /scripts/kernel-doc: No such file or directory
    exec /scripts/kernel-doc: No such file or directory

    Reported-by: Randy Dunlap
    Signed-off-by: WANG Cong
    Acked-by: Randy Dunlap
    Signed-off-by: Sam Ravnborg

    Amerigo Wang
     

15 Jun, 2009

1 commit

  • gcc-4.4.1:

    HOSTCC scripts/basic/fixdep
    scripts/basic/fixdep.c: In function 'traps':
    scripts/basic/fixdep.c:377: warning: dereferencing type-punned pointer will break strict-aliasing rules
    scripts/basic/fixdep.c:379: warning: dereferencing type-punned pointer will break strict-aliasing rules

    (Apparently -fno-strict-aliasing will fix this too)

    Signed-off-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Sam Ravnborg

    Amerigo Wang
     

10 Jun, 2009

1 commit

  • - getcwd returns path without a slash at the end, add the slash
    - add KBUILD_SRC env support, so that we can specify path for
    kernel (to know where scripts/kernel-doc resides) and SRCTREE
    (for searching files referenced in .tmpl) separately

    [v2]
    - use KBUILD_SRC instead of a newly introduced environment variable

    Signed-off-by: Jiri Slaby
    Acked-by: Randy Dunlap
    Signed-off-by: Sam Ravnborg

    Jiri Slaby
     

21 Oct, 2008

1 commit


17 Oct, 2008

1 commit

  • Base infrastructure to enable per-module debug messages.

    I've introduced CONFIG_DYNAMIC_PRINTK_DEBUG, which when enabled centralizes
    control of debugging statements on a per-module basis in one /proc file,
    currently, /dynamic_printk/modules. When, CONFIG_DYNAMIC_PRINTK_DEBUG,
    is not set, debugging statements can still be enabled as before, often by
    defining 'DEBUG' for the proper compilation unit. Thus, this patch set has no
    affect when CONFIG_DYNAMIC_PRINTK_DEBUG is not set.

    The infrastructure currently ties into all pr_debug() and dev_dbg() calls. That
    is, if CONFIG_DYNAMIC_PRINTK_DEBUG is set, all pr_debug() and dev_dbg() calls
    can be dynamically enabled/disabled on a per-module basis.

    Future plans include extending this functionality to subsystems, that define
    their own debug levels and flags.

    Usage:

    Dynamic debugging is controlled by the debugfs file,
    /dynamic_printk/modules. This file contains a list of the modules that
    can be enabled. The format of the file is as follows:


    .
    .
    .

    : Name of the module in which the debug call resides
    : whether the messages are enabled or not

    For example:

    snd_hda_intel enabled=0
    fixup enabled=1
    driver enabled=0

    Enable a module:

    $echo "set enabled=1 " > dynamic_printk/modules

    Disable a module:

    $echo "set enabled=0 " > dynamic_printk/modules

    Enable all modules:

    $echo "set enabled=1 all" > dynamic_printk/modules

    Disable all modules:

    $echo "set enabled=0 all" > dynamic_printk/modules

    Finally, passing "dynamic_printk" at the command line enables
    debugging for all modules. This mode can be turned off via the above
    disable command.

    [gkh: minor cleanups and tweaks to make the build work quietly]

    Signed-off-by: Jason Baron
    Signed-off-by: Greg Kroah-Hartman

    Jason Baron
     

29 Jan, 2008

2 commits

  • The !P directive includes the contents of a DOC: section
    given by title, e.g.
    !Pfilename Title of the section

    Signed-off-by: Johannes Berg
    Signed-off-by: Randy Dunlap
    Signed-off-by: Sam Ravnborg

    Johannes Berg
     
  • When asked by a template to include all functions from a file,
    it will also include DOC: sections wreaking havoc in the generated
    docbook file. This patch makes it use the new -no-doc-sections
    flag for kernel-doc to avoid this.

    Signed-off-by: Johannes Berg
    Signed-off-by: Randy Dunlap
    Signed-off-by: Sam Ravnborg

    Johannes Berg
     

18 Oct, 2007

1 commit


13 Oct, 2007

1 commit