1. 05 6月, 2010 5 次提交
    • R
      module: make locking more fine-grained. · 75676500
      Rusty Russell 提交于
      Kay Sievers <kay.sievers@vrfy.org> reports that we still have some
      contention over module loading which is slowing boot.
      
      Linus also disliked a previous "drop lock and regrab" patch to fix the
      bne2 "gave up waiting for init of module libcrc32c" message.
      
      This is more ambitious: we only grab the lock where we need it.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Brandon Philips <brandon@ifup.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      75676500
    • R
      module: Make module sysfs functions private. · 6407ebb2
      Rusty Russell 提交于
      These were placed in the header in ef665c1a to get the various
      SYSFS/MODULE config combintations to compile.
      
      That may have been necessary then, but it's not now.  These functions
      are all local to module.c.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      6407ebb2
    • R
      module: move sysfs exposure to end of load_module · 80a3d1bb
      Rusty Russell 提交于
      This means a little extra work, but is more logical: we don't put
      anything in sysfs until we're about to put the module into the
      global list an parse its parameters.
      
      This also gives us a logical place to put duplicate module detection
      in the next patch.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      80a3d1bb
    • R
      module: fix kdb's illicit use of struct module_use. · c8e21ced
      Rusty Russell 提交于
      Linus changed the structure, and luckily this didn't compile any more.
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Cc: Martin Hicks <mort@sgi.com>
      c8e21ced
    • L
      module: Make the 'usage' lists be two-way · 2c02dfe7
      Linus Torvalds 提交于
      When adding a module that depends on another one, we used to create a
      one-way list of "modules_which_use_me", so that module unloading could
      see who needs a module.
      
      It's actually quite simple to make that list go both ways: so that we
      not only can see "who uses me", but also see a list of modules that are
      "used by me".
      
      In fact, we always wanted that list in "module_unload_free()": when we
      unload a module, we want to also release all the other modules that are
      used by that module.  But because we didn't have that list, we used to
      first iterate over all modules, and then iterate over each "used by me"
      list of that module.
      
      By making the list two-way, we simplify module_unload_free(), and it
      allows for some trivial fixes later too.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cleaned & rebased)
      2c02dfe7
  2. 01 6月, 2010 1 次提交
  3. 26 5月, 2010 1 次提交
  4. 25 5月, 2010 1 次提交
  5. 22 5月, 2010 1 次提交
  6. 21 5月, 2010 1 次提交
  7. 19 5月, 2010 1 次提交
  8. 07 5月, 2010 1 次提交
    • T
      stop_machine: reimplement using cpu_stop · 3fc1f1e2
      Tejun Heo 提交于
      Reimplement stop_machine using cpu_stop.  As cpu stoppers are
      guaranteed to be available for all online cpus,
      stop_machine_create/destroy() are no longer necessary and removed.
      
      With resource management and synchronization handled by cpu_stop, the
      new implementation is much simpler.  Asking the cpu_stop to execute
      the stop_cpu() state machine on all online cpus with cpu hotplug
      disabled is enough.
      
      stop_machine itself doesn't need to manage any global resources
      anymore, so all per-instance information is rolled into struct
      stop_machine_data and the mutex and all static data variables are
      removed.
      
      The previous implementation created and destroyed RT workqueues as
      necessary which made stop_machine() calls highly expensive on very
      large machines.  According to Dimitri Sivanich, preventing the dynamic
      creation/destruction makes booting faster more than twice on very
      large machines.  cpu_stop resources are preallocated for all online
      cpus and should have the same effect.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Dimitri Sivanich <sivanich@sgi.com>
      3fc1f1e2
  9. 06 4月, 2010 1 次提交
    • N
      Fix up possibly racy module refcounting · 5fbfb18d
      Nick Piggin 提交于
      Module refcounting is implemented with a per-cpu counter for speed.
      However there is a race when tallying the counter where a reference may
      be taken by one CPU and released by another.  Reference count summation
      may then see the decrement without having seen the previous increment,
      leading to lower than expected count.  A module which never has its
      actual reference drop below 1 may return a reference count of 0 due to
      this race.
      
      Module removal generally runs under stop_machine, which prevents this
      race causing bugs due to removal of in-use modules.  However there are
      other real bugs in module.c code and driver code (module_refcount is
      exported) where the callers do not run under stop_machine.
      
      Fix this by maintaining running per-cpu counters for the number of
      module refcount increments and the number of refcount decrements.  The
      increments are tallied after the decrements, so any decrement seen will
      always have its corresponding increment counted.  The final refcount is
      the difference of the total increments and decrements, preventing a
      low-refcount from being returned.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5fbfb18d
  10. 01 4月, 2010 2 次提交
  11. 29 3月, 2010 2 次提交
  12. 08 3月, 2010 1 次提交
  13. 03 3月, 2010 1 次提交
  14. 06 1月, 2010 1 次提交
  15. 05 1月, 2010 1 次提交
  16. 15 12月, 2009 1 次提交
  17. 03 12月, 2009 1 次提交
    • H
      modules: don't export section names of empty sections via sysfs · 35dead42
      Helge Deller 提交于
      On the parisc architecture we face for each and every loaded kernel module
      this kernel "badness warning":
        sysfs: cannot create duplicate filename '/module/ac97_bus/sections/.text'
        Badness at fs/sysfs/dir.c:487
      
      Reason for that is, that on parisc all kernel modules do have multiple
      .text sections due to the usage of the -ffunction-sections compiler flag
      which is needed to reach all jump targets on this platform.
      
      An objdump on such a kernel module gives:
      Sections:
      Idx Name          Size      VMA       LMA       File off  Algn
        0 .note.gnu.build-id 00000024  00000000  00000000  00000034  2**2
                        CONTENTS, ALLOC, LOAD, READONLY, DATA
        1 .text         00000000  00000000  00000000  00000058  2**0
                        CONTENTS, ALLOC, LOAD, READONLY, CODE
        2 .text.ac97_bus_match 0000001c  00000000  00000000  00000058  2**2
                        CONTENTS, ALLOC, LOAD, READONLY, CODE
        3 .text         00000000  00000000  00000000  000000d4  2**0
                        CONTENTS, ALLOC, LOAD, READONLY, CODE
      ...
      Since the .text sections are empty (size of 0 bytes) and won't be
      loaded by the kernel module loader anyway, I don't see a reason
      why such sections need to be listed under
      /sys/module/<module_name>/sections/<section_name> either.
      
      The attached patch does solve this issue by not exporting section
      names which are empty.
      
      This fixes bugzilla http://bugzilla.kernel.org/show_bug.cgi?id=14703Signed-off-by: NHelge Deller <deller@gmx.de>
      CC: rusty@rustcorp.com.au
      CC: akpm@linux-foundation.org
      CC: James.Bottomley@HansenPartnership.com
      CC: roland@redhat.com
      CC: dave@hiauly1.hia.nrc.ca
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      35dead42
  18. 29 10月, 2009 1 次提交
  19. 28 10月, 2009 1 次提交
  20. 02 10月, 2009 2 次提交
    • T
      percpu: kill legacy percpu allocator · 23fb064b
      Tejun Heo 提交于
      With ia64 converted, there's no arch left which still uses legacy
      percpu allocator.  Kill it.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Delightedly-acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      23fb064b
    • P
      module: fix up CONFIG_KALLSYMS=n build. · 3ae91c21
      Paul Mundt 提交于
      Starting from commit 4a496226 "reduce
      symbol table for loaded modules (v2)", the kernel/module.c build is broken
      with CONFIG_KALLSYMS disabled.
      
        CC      kernel/module.o
      kernel/module.c:1995: warning: type defaults to 'int' in declaration of 'Elf_Hdr'
      kernel/module.c:1995: error: expected ';', ',' or ')' before '*' token
      kernel/module.c: In function 'load_module':
      kernel/module.c:2203: error: 'strmap' undeclared (first use in this function)
      kernel/module.c:2203: error: (Each undeclared identifier is reported only once
      kernel/module.c:2203: error: for each function it appears in.)
      kernel/module.c:2239: error: 'symoffs' undeclared (first use in this function)
      kernel/module.c:2239: error: implicit declaration of function 'layout_symtab'
      kernel/module.c:2240: error: 'stroffs' undeclared (first use in this function)
      make[1]: *** [kernel/module.o] Error 1
      make: *** [kernel/module.o] Error 2
      
      There are three different issues:
      
          - layout_symtab() takes a const Elf_Ehdr
      
          - layout_symtab() needs to return a value
      
          - symoffs/stroffs/strmap are referenced by the load_module() code
            despite being ifdefed out, which seems unnecessary given the noop
            behaviour of layout_symtab()/add_kallsyms() in the case of
            CONFIG_KALLSYMS=n.
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      Acked-by: NJan Beulich <jbeulich@novell.com>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3ae91c21
  21. 24 9月, 2009 4 次提交
  22. 23 9月, 2009 1 次提交
    • I
      modules, tracing: Remove stale struct marker signature from module_layout() · 115e8a28
      Ingo Molnar 提交于
      Linus reported this new build warning:
      
        kernel/module.c:2951: warning: ?struct marker? declared inside parameter list
        kernel/module.c:2951: warning: its scope is only this definition or declaration, which is probably not what you want
      
      Caused by:
      
        fc537766: tracing: Remove markers
      
      module_layout() is an artificial symbol with 'significant' symbols
      listed in its argument list so that it gets a proper argument types
      signature that modversions can pick up to decide whether a
      module is version-compatible or not. If these dont match then we
      wont even look at a module.
      
      Remove the stale marker symbol.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <alpine.LFD.2.01.0909210908020.4950@localhost.localdomain>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      115e8a28
  23. 22 9月, 2009 1 次提交
  24. 19 9月, 2009 1 次提交
  25. 29 8月, 2009 1 次提交
    • I
      modules: Fix build error in the !CONFIG_KALLSYMS case · ea6bff36
      Ingo Molnar 提交于
      > James Bottomley (1):
      >       module: workaround duplicate section names
      
      -tip testing found that this patch breaks the build on x86 if
      CONFIG_KALLSYMS is disabled:
      
       kernel/module.c: In function ‘load_module’:
       kernel/module.c:2367: error: ‘struct module’ has no member named ‘sect_attrs’
       distcc[8269] ERROR: compile kernel/module.c on ph/32 failed
       make[1]: *** [kernel/module.o] Error 1
       make: *** [kernel] Error 2
       make: *** Waiting for unfinished jobs....
      
      Commit 1b364bf4 misses the fact that section attributes are only
      built and dealt with if kallsyms is enabled. The patch below fixes
      this.
      
      ( note, technically speaking this should depend on CONFIG_SYSFS as
        well but this patch is correct too and keeps the #ifdef less
        intrusive - in the KALLSYMS && !SYSFS case the code is a NOP. )
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      [ Replaced patch with a slightly cleaner variation by James Bottomley ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ea6bff36
  26. 28 8月, 2009 2 次提交
  27. 17 8月, 2009 1 次提交
    • L
      tracing/events: Add module tracepoints · 7ead8b83
      Li Zefan 提交于
      Add trace points to trace module_load, module_free, module_get,
      module_put and module_request, and use trace_event facility to
      get the trace output.
      
      Here's the sample output:
      
           TASK-PID    CPU#    TIMESTAMP  FUNCTION
              | |       |          |         |
          <...>-42    [000]     1.758380: module_request: fb0 wait=1 call_site=fb_open
          ...
          <...>-60    [000]     3.269403: module_load: scsi_wait_scan
          <...>-60    [000]     3.269432: module_put: scsi_wait_scan call_site=sys_init_module refcnt=0
          <...>-61    [001]     3.273168: module_free: scsi_wait_scan
          ...
          <...>-1021  [000]    13.836081: module_load: sunrpc
          <...>-1021  [000]    13.840589: module_put: sunrpc call_site=sys_init_module refcnt=-1
          <...>-1027  [000]    13.848098: module_get: sunrpc call_site=try_module_get refcnt=0
          <...>-1027  [000]    13.848308: module_get: sunrpc call_site=get_filesystem refcnt=1
          <...>-1027  [000]    13.848692: module_put: sunrpc call_site=put_filesystem refcnt=0
          ...
       modprobe-2587  [001]  1088.437213: module_load: trace_events_sample F
       modprobe-2587  [001]  1088.437786: module_put: trace_events_sample call_site=sys_init_module refcnt=0
      
      Note:
      
      - the taints flag can be 'F', 'C' and/or 'P' if mod->taints != 0
      
      - the module refcnt is percpu, so it can be negative in a
        specific cpu
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <4A891B3C.5030608@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7ead8b83
  28. 28 7月, 2009 1 次提交
  29. 09 7月, 2009 1 次提交