1. 31 Mar, 2009 18 commits
    • Rusty Russell's avatar
      module: don't use stop_machine on module load · e91defa2
      Rusty Russell authored
      Kay Sievers <kay.sievers@vrfy.org> discovered that boot times are slowed
      by about half a second because all the stop_machine_create() calls,
      and he only probes about 40 modules (I have 125 loaded on this laptop).
      
      We only do stop_machine_create() so we can unlink the module if
      something goes wrong, but it's overkill (and buggy anyway: if
      stop_machine_create() fails we still call stop_machine_destroy()).
      
      Since we are only protecting against kallsyms (esp. oops) walking the
      list, synchronize_sched() is sufficient (synchronize_rcu() is probably
      sufficient, but we're not in a hurry).
      
      Kay says of this patch:
      	... no module takes more than 40 millisecs to link now, most of
      	them are between 3 and 8 millisecs.
      
      	That looks very different to the numbers without this patch
      	and the otherwise same setup, where we get heavy noise in the
      	traces and many delays of up to 200 millisecs until linking,
      	most of them taking 30+ millisecs.
      Tested-by: default avatarKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      e91defa2
    • Arjan van de Ven's avatar
      module: create a request_module_nowait() · acae0515
      Arjan van de Ven authored
      There seems to be a common pattern in the kernel where drivers want to
      call request_module() from inside a module_init() function. Currently
      this would deadlock.
      
      As a result, several drivers go through hoops like scheduling things via
      kevent, or creating custom work queues (because kevent can deadlock on them).
      
      This patch changes this to use a request_module_nowait() function macro instead,
      which just fires the modprobe off but doesn't wait for it, and thus avoids the
      original deadlock entirely.
      
      On my laptop this already results in one less kernel thread running..
      
      (Includes Jiri's patch to use enum umh_wait)
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (bool-ified)
      Cc: Jiri Slaby <jirislaby@gmail.com>
      acae0515
    • Rusty Russell's avatar
      module: include other structures in module version check · 8c8ef42a
      Rusty Russell authored
      With CONFIG_MODVERSIONS, we version 'struct module' using a dummy
      export, but other things matter too:
      
      1) 'struct modversion_info' determines the layout of the __versions section,
      2) 'struct kernel_param' determines the layout of the __params section,
      3) 'struct kernel_symbol' determines __ksymtab*.
      4) 'struct marker' determines __markers.
      5) 'struct tracepoint' determines __tracepoints.
      
      So we rename 'struct_module' to 'module_layout' and include these in
      the signature.  Now it's general we can add others later on without
      confusion.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      8c8ef42a
    • Rusty Russell's avatar
      module: remove the SHF_ALLOC flag on the __versions section. · 9cb610d8
      Rusty Russell authored
      Impact: reduce kernel memory usage
      
      This patch just takes off the SHF_ALLOC flag on __versions so we don't
      keep them around after module load.
      
      This saves about 7% of module memory if CONFIG_MODVERSIONS=y.
      
      Cc: Shawn Bohrer <shawn.bohrer@gmail.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      9cb610d8
    • Rusty Russell's avatar
      module: clarify the force-loading taint message. · c6e665c8
      Rusty Russell authored
      Impact: Message cleanup
      
      Two of three callers of try_to_force_load() are not because of a
      missing version, so change the messages:
      
      Old:
      	<modname>: no version for "magic" found: kernel tainted.
      New:
      	<modname>: bad vermagic: kernel tainted.
      
      Old:
      	<modname>: no version for "nocrc" found: kernel tainted.
      New:
      	<modname>: no versions for exported symbols: kernel tainted.
      
      Old:
      	<modname>: no version for "<symname>" found: kernel tainted.
      New:
      	<modname>: <symname>: kernel tainted.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c6e665c8
    • Tim Abbott's avatar
      module: Export symbols needed for Ksplice · c6b37801
      Tim Abbott authored
      Impact: Expose some module.c symbols
      
      Ksplice uses several functions from module.c in order to resolve
      symbols and implement dependency handling.  Calling these functions
      requires holding module_mutex, so it is exported.
      
      (This is just the module part of a bigger add-exports patch from Tim).
      
      Cc: Anders Kaseorg <andersk@mit.edu>
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Signed-off-by: default avatarTim Abbott <tabbott@mit.edu>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c6b37801
    • Anders Kaseorg's avatar
      Ksplice: Add functions for walking kallsyms symbols · 75a66614
      Anders Kaseorg authored
      Impact: New API
      
      kallsyms_lookup_name only returns the first match that it finds.  Ksplice
      needs information about all symbols with a given name in order to correctly
      resolve local symbols.
      
      kallsyms_on_each_symbol provides a generic mechanism for iterating over the
      kallsyms table.
      
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Cc: Tim Abbott <tabbott@mit.edu>
      Signed-off-by: default avatarAnders Kaseorg <andersk@mit.edu>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      75a66614
    • Rusty Russell's avatar
      module: remove module_text_address() · a6e6abd5
      Rusty Russell authored
      Impact: Replace and remove risky (non-EXPORTed) API
      
      module_text_address() returns a pointer to the module, which given locking
      improvements in module.c, is useless except to test for NULL:
      
      1) If the module can't go away, use __module_text_address.
      2) Otherwise, just use is_module_text_address().
      
      Cc: linux-mtd@lists.infradead.org
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      a6e6abd5
    • Rusty Russell's avatar
      module: __module_address · e610499e
      Rusty Russell authored
      Impact: New API, cleanup
      
      ksplice wants to know the bounds of a module, not just the module text.
      
      It makes sense to have __module_address.  We then implement
      is_module_address and __module_text_address in terms of this (and
      change is_module_text_address() to bool while we're at it).
      
      Also, add proper kerneldoc for them all.
      
      Cc: Anders Kaseorg <andersk@mit.edu>
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Cc: Tim Abbott <tabbott@mit.edu>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      e610499e
    • Tim Abbott's avatar
      module: Make find_symbol return a struct kernel_symbol · 414fd31b
      Tim Abbott authored
      Impact: Cleanup, internal API change
      
      Ksplice needs access to the kernel_symbol structure in order to support
      modifications to the exported symbol table.
      
      Cc: Anders Kaseorg <andersk@mit.edu>
      Cc: Jeff Arnold <jbarnold@mit.edu>
      Signed-off-by: default avatarTim Abbott <tabbott@mit.edu>
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (bugfix and style)
      414fd31b
    • Américo Wang's avatar
      kernel/module.c: fix an unused goto label · b10153fe
      Américo Wang authored
      Impact: cleanup
      
      Label 'free_init' is only used when defined(CONFIG_MODULE_UNLOAD) &&
      defined(CONFIG_SMP), so move it inside to shut up gcc.
      Signed-off-by: default avatarWANG Cong <xiyou.wangcong@gmail.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      b10153fe
    • Rusty Russell's avatar
      param: fix charp parameters set via sysfs · e180a6b7
      Rusty Russell authored
      Impact: fix crash on reading from /sys/module/.../ieee80211_default_rc_algo
      
      The module_param type "charp" simply sets a char * pointer in the
      module to the parameter in the commandline string: this is why we keep
      the (mangled) module command line around.  But when set via sysfs (as
      about 11 charp parameters can be) this memory is freed on the way
      out of the write().  Future reads hit random mem.
      
      So we kstrdup instead: we have to check we're not in early commandline
      parsing, and we have to note when we've used it so we can reliably
      kfree the parameter when it's next overwritten, and also on module
      unload.
      
      (Thanks to Randy Dunlap for CONFIG_SYSFS=n fixes)
      Reported-by: default avatarSitsofe Wheeler <sitsofe@yahoo.com>
      Diagnosed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Tested-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Tested-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      e180a6b7
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 · 15f7176e
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
        wireless: remove duplicated .ndo_set_mac_address
        netfilter: xtables: fix IPv6 dependency in the cluster match
        tg3: Add GRO support.
        niu: Add GRO support.
        ucc_geth: Fix use-after-of_node_put() in ucc_geth_probe().
        gianfar: Fix use-after-of_node_put() in gfar_of_init().
        kernel: remove HIPQUAD()
        netpoll: store local and remote ip in net-endian
        netfilter: fix endian bug in conntrack printks
        dmascc: fix incomplete conversion to network_device_ops
        gso: Fix support for linear packets
        skbuff.h: fix missing kernel-doc
        ni5010: convert to net_device_ops
      15f7176e
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 · d3d52d68
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
        sparc64: Fix reset hangs on Niagara systems.
        cpumask: use mm_cpumask() wrapper: sparc
        cpumask: remove dangerous CPU_MASK_ALL_PTR, &CPU_MASK_ALL.: sparc
        cpumask: remove the now-obsoleted pcibus_to_cpumask(): sparc
        cpumask: remove cpu_coregroup_map: sparc
        cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: sparc
        cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: sparc64
        cpumask: Use accessors code.: sparc64
        cpumask: Use accessors code: sparc
        cpumask: arch_send_call_function_ipi_mask: sparc
        cpumask: Use smp_call_function_many(): sparc64
      d3d52d68
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-cpumask · d17abcd5
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-cpumask:
        oprofile: Thou shalt not call __exit functions from __init functions
        cpumask: remove the now-obsoleted pcibus_to_cpumask(): generic
        cpumask: remove cpumask_t from core
        cpumask: convert rcutorture.c
        cpumask: use new cpumask_ functions in core code.
        cpumask: remove references to struct irqaction's mask field.
        cpumask: use mm_cpumask() wrapper: kernel/fork.c
        cpumask: use set_cpu_active in init/main.c
        cpumask: remove node_to_first_cpu
        cpumask: fix seq_bitmap_*() functions.
        cpumask: remove dangerous CPU_MASK_ALL_PTR, &CPU_MASK_ALL
      d17abcd5
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-lguest-and-virtio · db6f2040
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-lguest-and-virtio:
        lguest: barrier me harder
        lguest: use bool instead of int
        lguest: use KVM hypercalls
        lguest: wire up pte_update/pte_update_defer
        lguest: fix spurious BUG_ON() on invalid guest stack.
        virtio: more neatening of virtio_ring macros.
        virtio: fix BAD_RING, START_US and END_USE macros
      db6f2040
    • Linus Torvalds's avatar
      Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6 · 3c6fae67
      Linus Torvalds authored
      * 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
        hwmon: (fschmd) Add support for the FSC Hades IC
        hwmon: (fschmd) Add support for the FSC Syleus IC
        i2c-i801: Instantiate FSC hardware montioring chips
        dmi: Let dmi_walk() users pass private data
        hwmon: Define a standard interface for chassis intrusion detection
        Move the pcf8591 driver to hwmon
        hwmon: (w83627ehf) Only expose in6 or temp3 on the W83667HG
        hwmon: (w83627ehf) Add support for W83667HG
        hwmon: (w83627ehf) Invert fan pin variables logic
        hwmon: (hdaps) Fix Thinkpad X41 axis inversion
        hwmon: (hdaps) Allow inversion of separate axis
        hwmon: (ds1621) Clean up documentation
        hwmon: (ds1621) Avoid unneeded register access
        hwmon: (ds1621) Clean up register access
        hwmon: (ds1621) Reorder code statements
      3c6fae67
    • Linus Torvalds's avatar
      Merge branch 'locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip · c4e1aa67
      Linus Torvalds authored
      * 'locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (33 commits)
        lockdep: fix deadlock in lockdep_trace_alloc
        lockdep: annotate reclaim context (__GFP_NOFS), fix SLOB
        lockdep: annotate reclaim context (__GFP_NOFS), fix
        lockdep: build fix for !PROVE_LOCKING
        lockstat: warn about disabled lock debugging
        lockdep: use stringify.h
        lockdep: simplify check_prev_add_irq()
        lockdep: get_user_chars() redo
        lockdep: simplify get_user_chars()
        lockdep: add comments to mark_lock_irq()
        lockdep: remove macro usage from mark_held_locks()
        lockdep: fully reduce mark_lock_irq()
        lockdep: merge the !_READ mark_lock_irq() helpers
        lockdep: merge the _READ mark_lock_irq() helpers
        lockdep: simplify mark_lock_irq() helpers #3
        lockdep: further simplify mark_lock_irq() helpers
        lockdep: simplify the mark_lock_irq() helpers
        lockdep: split up mark_lock_irq()
        lockdep: generate usage strings
        lockdep: generate the state bit definitions
        ...
      c4e1aa67
  2. 30 Mar, 2009 22 commits