1. 24 Aug, 2016 1 commit
    • Alexey Dobriyan's avatar
      fixdep: faster CONFIG_ search · dee81e98
      Alexey Dobriyan authored
      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: 's avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: 's avatarMichal Marek <mmarek@suse.com>
      dee81e98
  2. 22 Jul, 2016 1 commit
    • Tautschnig, Michael's avatar
      scripts: Fix size mismatch of kexec_purgatory_size · 21532b9e
      Tautschnig, Michael authored
      bin2c is used to create a valid C file out of a binary file where two
      symbols will be globally defined: <name> and <name>_size. <name> 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 <name>_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 <name>_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 <= 0)
      Signed-off-by: 's avatarMichael Tautschnig <tautschn@amazon.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Acked-by: 's avatarDave Young <dyoung@redhat.com>
      Signed-off-by: 's avatarMichal Marek <mmarek@suse.com>
      21532b9e
  3. 29 Mar, 2016 2 commits
    • Nicolas Pitre's avatar
      kbuild: add fine grained build dependencies for exported symbols · c1a95fda
      Nicolas Pitre authored
      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: 's avatarNicolas Pitre <nico@linaro.org>
      Acked-by: 's avatarRusty Russell <rusty@rustcorp.com.au>
      c1a95fda
    • Nicolas Pitre's avatar
      fixdep: accept extra dependencies on stdin · d8329e35
      Nicolas Pitre authored
      ... and merge them in the list of parsed dependencies.
      Signed-off-by: 's avatarNicolas Pitre <nico@linaro.org>
      d8329e35
  4. 17 Feb, 2016 1 commit
  5. 07 Dec, 2015 1 commit
  6. 24 Aug, 2015 2 commits
  7. 08 Aug, 2014 2 commits
    • Vivek Goyal's avatar
      kernel: build bin2c based on config option CONFIG_BUILD_BIN2C · de5b56ba
      Vivek Goyal authored
      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: 's avatarVivek Goyal <vgoyal@redhat.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Greg Kroah-Hartman <greg@kroah.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: WANG Chao <chaowang@redhat.com>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      de5b56ba
    • Vivek Goyal's avatar
      bin2c: move bin2c in scripts/basic · 8370edea
      Vivek Goyal authored
      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: 's avatarVivek Goyal <vgoyal@redhat.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Greg Kroah-Hartman <greg@kroah.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: WANG Chao <chaowang@redhat.com>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      8370edea
  8. 10 Jun, 2014 1 commit
  9. 05 Apr, 2013 1 commit
    • Stephen Warren's avatar
      kbuild: fixdep: support concatenated dep files · 2ab8a996
      Stephen Warren authored
      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's avatarStephen Warren <swarren@nvidia.com>
      Acked-by: 's avatarRob Herring <rob.herring@calxeda.com>
      2ab8a996
  10. 09 Jan, 2013 1 commit
  11. 09 Sep, 2011 1 commit
  12. 02 May, 2011 1 commit
  13. 13 Mar, 2011 1 commit
  14. 21 Feb, 2011 1 commit
  15. 22 Dec, 2010 1 commit
  16. 11 Nov, 2010 1 commit
    • Eric Dumazet's avatar
      fixdep: use hash table instead of a single array · 8af27e1d
      Eric Dumazet authored
      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: 's avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: 's avatarMichal Marek <mmarek@suse.cz>
      8af27e1d
  17. 27 Oct, 2010 1 commit
  18. 22 Sep, 2010 1 commit
  19. 11 Sep, 2010 1 commit
  20. 12 Dec, 2009 1 commit
  21. 21 Sep, 2009 2 commits
  22. 20 Sep, 2009 1 commit
  23. 20 Jun, 2009 1 commit
  24. 14 Jun, 2009 1 commit
  25. 09 Jun, 2009 1 commit
  26. 20 Oct, 2008 1 commit
  27. 16 Oct, 2008 1 commit
    • Jason Baron's avatar
      driver core: basic infrastructure for per-module dynamic debug messages · 346e15be
      Jason Baron authored
      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, <debugfs>/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, 
      <debugfs>/dynamic_printk/modules. This file contains a list of the modules that
      can be enabled. The format of the file is as follows:
      
      	<module_name> <enabled=0/1>
      		.
      		.
      		.
      
      	<module_name> : Name of the module in which the debug call resides
      	<enabled=0/1> : 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 <module_name>" > dynamic_printk/modules
      
      Disable a module:
      
      	$echo "set enabled=0 <module_name>" > 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: 's avatarJason Baron <jbaron@redhat.com>
      Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      346e15be
  28. 28 Jan, 2008 2 commits
  29. 18 Oct, 2007 1 commit
  30. 12 Oct, 2007 1 commit
  31. 09 May, 2007 1 commit
  32. 02 May, 2007 1 commit
  33. 01 Apr, 2007 1 commit
    • Jan Beulich's avatar
      [PATCH] kbuild: fix dependency generation · c21b1e4d
      Jan Beulich authored
      Commit 2e3646e5 changed the way the
      split config tree is built, but failed to also adjust fixdep accordingly
      - if changing a config option from or to m, files referencing the
      respective CONFIG_..._MODULE (but not the corresponding CONFIG_...)
      didn't get rebuilt.
      
      The problem is that trisate symbol are represent with three different
      symbols:
          SYMBOL=n => no symbol defined
          SYMBOL=y => CONFIG_SYMBOL defined to '1'
          SYMBOL=m => CONFIG_SYMBOL_MODULE defined to '1'
      
      But conf_split_config do not distingush between the =y and =m case, so
      only the =y case is honoured.
      
      This is fixed in fixdep so when a CONFIG symbol with _MODULE is found we
      skip that part and only look for the CONFIG_SYMBOL version.
      Signed-off-by: 's avatarJan Beulich <jbeulich@novell.com>
      Signed-off-by: 's avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      c21b1e4d
  34. 03 Nov, 2006 1 commit
  35. 29 Sep, 2006 1 commit