28 Mar, 2006

1 commit

  • The kernel's implementation of notifier chains is unsafe. There is no
    protection against entries being added to or removed from a chain while the
    chain is in use. The issues were discussed in this thread:

    http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2

    We noticed that notifier chains in the kernel fall into two basic usage
    classes:

    "Blocking" chains are always called from a process context
    and the callout routines are allowed to sleep;

    "Atomic" chains can be called from an atomic context and
    the callout routines are not allowed to sleep.

    We decided to codify this distinction and make it part of the API. Therefore
    this set of patches introduces three new, parallel APIs: one for blocking
    notifiers, one for atomic notifiers, and one for "raw" notifiers (which is
    really just the old API under a new name). New kinds of data structures are
    used for the heads of the chains, and new routines are defined for
    registration, unregistration, and calling a chain. The three APIs are
    explained in include/linux/notifier.h and their implementation is in
    kernel/sys.c.

    With atomic and blocking chains, the implementation guarantees that the chain
    links will not be corrupted and that chain callers will not get messed up by
    entries being added or removed. For raw chains the implementation provides no
    guarantees at all; users of this API must provide their own protections. (The
    idea was that situations may come up where the assumptions of the atomic and
    blocking APIs are not appropriate, so it should be possible for users to
    handle these things in their own way.)

    There are some limitations, which should not be too hard to live with. For
    atomic/blocking chains, registration and unregistration must always be done in
    a process context since the chain is protected by a mutex/rwsem. Also, a
    callout routine for a non-raw chain must not try to register or unregister
    entries on its own chain. (This did happen in a couple of places and the code
    had to be changed to avoid it.)

    Since atomic chains may be called from within an NMI handler, they cannot use
    spinlocks for synchronization. Instead we use RCU. The overhead falls almost
    entirely in the unregister routine, which is okay since unregistration is much
    less frequent that calling a chain.

    Here is the list of chains that we adjusted and their classifications. None
    of them use the raw API, so for the moment it is only a placeholder.

    ATOMIC CHAINS
    -------------
    arch/i386/kernel/traps.c: i386die_chain
    arch/ia64/kernel/traps.c: ia64die_chain
    arch/powerpc/kernel/traps.c: powerpc_die_chain
    arch/sparc64/kernel/traps.c: sparc64die_chain
    arch/x86_64/kernel/traps.c: die_chain
    drivers/char/ipmi/ipmi_si_intf.c: xaction_notifier_list
    kernel/panic.c: panic_notifier_list
    kernel/profile.c: task_free_notifier
    net/bluetooth/hci_core.c: hci_notifier
    net/ipv4/netfilter/ip_conntrack_core.c: ip_conntrack_chain
    net/ipv4/netfilter/ip_conntrack_core.c: ip_conntrack_expect_chain
    net/ipv6/addrconf.c: inet6addr_chain
    net/netfilter/nf_conntrack_core.c: nf_conntrack_chain
    net/netfilter/nf_conntrack_core.c: nf_conntrack_expect_chain
    net/netlink/af_netlink.c: netlink_chain

    BLOCKING CHAINS
    ---------------
    arch/powerpc/platforms/pseries/reconfig.c: pSeries_reconfig_chain
    arch/s390/kernel/process.c: idle_chain
    arch/x86_64/kernel/process.c idle_notifier
    drivers/base/memory.c: memory_chain
    drivers/cpufreq/cpufreq.c cpufreq_policy_notifier_list
    drivers/cpufreq/cpufreq.c cpufreq_transition_notifier_list
    drivers/macintosh/adb.c: adb_client_list
    drivers/macintosh/via-pmu.c sleep_notifier_list
    drivers/macintosh/via-pmu68k.c sleep_notifier_list
    drivers/macintosh/windfarm_core.c wf_client_list
    drivers/usb/core/notify.c usb_notifier_list
    drivers/video/fbmem.c fb_notifier_list
    kernel/cpu.c cpu_chain
    kernel/module.c module_notify_list
    kernel/profile.c munmap_notifier
    kernel/profile.c task_exit_notifier
    kernel/sys.c reboot_notifier_list
    net/core/dev.c netdev_chain
    net/decnet/dn_dev.c: dnaddr_chain
    net/ipv4/devinet.c: inetaddr_chain

    It's possible that some of these classifications are wrong. If they are,
    please let us know or submit a patch to fix them. Note that any chain that
    gets called very frequently should be atomic, because the rwsem read-locking
    used for blocking chains is very likely to incur cache misses on SMP systems.
    (However, if the chain's callout routines may sleep then the chain cannot be
    atomic.)

    The patch set was written by Alan Stern and Chandra Seetharaman, incorporating
    material written by Keith Owens and suggestions from Paul McKenney and Andrew
    Morton.

    [jes@sgi.com: restructure the notifier chain initialization macros]
    Signed-off-by: Alan Stern
    Signed-off-by: Chandra Seetharaman
    Signed-off-by: Jes Sorensen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Stern
     

26 Mar, 2006

1 commit

  • - Moved check for online cpu out of smp_prepare_cpu()

    - Moved default declaration of smp_prepare_cpu() to kernel/cpu.c

    - Removed lock_cpu_hotplug() from smp_prepare_cpu() to around it, since
    its called from cpu_up() as well now.

    - Removed clearing from cpu_present_map during cpu_offline as it breaks
    using cpu_up() directly during a subsequent online operation.

    Signed-off-by: Ashok Raj
    Cc: Srivatsa Vaddagiri
    Cc: "Li, Shaohua"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ashok Raj
     

23 Mar, 2006

2 commits


22 Mar, 2006

2 commits


21 Mar, 2006

4 commits


15 Mar, 2006

1 commit

  • Adding support for exposing hidden raid components for sg
    interface. The sdev->no_uld_attach flag will set set accordingly.

    The sas module supports adding/removing raid volumes using online
    storage management application interface.

    This patch was provided to me by Christoph Hellwig.

    Signed-off-by: Eric Moore
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: James Bottomley

    Moore, Eric
     

08 Feb, 2006

1 commit


07 Feb, 2006

3 commits


04 Feb, 2006

1 commit

  • The patch implements cpu topology exportation by sysfs.

    Items (attributes) are similar to /proc/cpuinfo.

    1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
    represent the physical package id of cpu X;
    2) /sys/devices/system/cpu/cpuX/topology/core_id:
    represent the cpu core id to cpu X;
    3) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
    represent the thread siblings to cpu X in the same core;
    4) /sys/devices/system/cpu/cpuX/topology/core_siblings:
    represent the thread siblings to cpu X in the same physical package;

    To implement it in an architecture-neutral way, a new source file,
    driver/base/topology.c, is to export the 5 attributes.

    If one architecture wants to support this feature, it just needs to
    implement 4 defines, typically in file include/asm-XXX/topology.h.
    The 4 defines are:
    #define topology_physical_package_id(cpu)
    #define topology_core_id(cpu)
    #define topology_thread_siblings(cpu)
    #define topology_core_siblings(cpu)

    The type of **_id is int.
    The type of siblings is cpumask_t.

    To be consistent on all architectures, the 4 attributes should have
    deafult values if their values are unavailable. Below is the rule.

    1) physical_package_id: If cpu has no physical package id, -1 is the
    default value.

    2) core_id: If cpu doesn't support multi-core, its core id is 0.

    3) thread_siblings: Just include itself, if the cpu doesn't support
    HT/multi-thread.

    4) core_siblings: Just include itself, if the cpu doesn't support
    multi-core and HT/Multi-thread.

    So be careful when declaring the 4 defines in include/asm-XXX/topology.h.

    If an attribute isn't defined on an architecture, it won't be exported.

    Thank Nathan, Greg, Andi, Paul and Venki.

    The patch provides defines for i386/x86_64/ia64.

    Signed-off-by: Zhang, Yanmin
    Cc: Ingo Molnar
    Cc: Nick Piggin
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zhang, Yanmin
     

15 Jan, 2006

1 commit


14 Jan, 2006

3 commits

  • This patch changes device_shutdown() to use the newly introduced safe
    reverse list traversal. We experienced loops on system reboot if we had
    removed and re-inserted our device from the device list.

    We noticed this problem on PPC405. Our PCI IDE device comes and goes a lot.

    Our hypothesis was that there was a loop caused by the driver->shutdown
    freeing memory. It is possible that we do something wrong as well, but
    being unable to reboot is kind of nasty.

    Signed-off-by: Michael Richardson
    Cc: Patrick Mochel
    Cc: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Michael Richardson
     
  • Please fold this typo fix into platform-device-del.patch, as was
    discussed earlier on LKML:
    http://lkml.org/lkml/2005/12/10/76

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • Add bus_type probe, remove and shutdown methods to replace the
    corresponding methods in struct device_driver. This matches
    the way we handle the suspend/resume methods.

    Since the bus methods override the device_driver methods, warn
    if a device driver is registered whose methods will not be
    called.

    The long-term idea is to remove the device_driver methods entirely.

    Signed-off-by: Russell King
    Signed-off-by: Greg Kroah-Hartman

    Russell King
     

12 Jan, 2006

1 commit

  • - Move capable() from sched.h to capability.h;

    - Use where capable() is used
    (in include/, block/, ipc/, kernel/, a few drivers/,
    mm/, security/, & sound/;
    many more drivers/ to go)

    Signed-off-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy.Dunlap
     

11 Jan, 2006

3 commits


07 Jan, 2006

2 commits


06 Jan, 2006

1 commit


05 Jan, 2006

7 commits

  • This patch #if 0's an unused global function.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Adrian Bunk
     
  • Thanks to drivers making their id tables __devinit, we can't allow
    userspace to bind or unbind drivers from devices manually through sysfs.
    So we only allow this if CONFIG_HOTPLUG is enabled.

    Cc: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Driver core: rearrange exports in platform.c

    The new way is to specify export right after symbol definition.
    Rearrange exports to follow new style to avoid mixing two styles
    in one file.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • Driver core: add platform_device_del function

    Having platform_device_del90 allows more straightforward error
    handling code in drivers registering platform devices.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • There are cases in which a device's memory mapped registers overlap
    with another device's memory mapped registers. On several PowerPC
    devices this occurs for the MDIO bus, whose registers tended to overlap
    with one of the ethernet controllers.

    By switching from request_resource to insert_resource we can register
    the MDIO bus as a proper platform device and not hack around how we
    handle its memory mapped registers.

    Signed-off-by: Kumar Gala
    Signed-off-by: Greg Kroah-Hartman

    Kumar Gala
     
  • This patch (as604) makes the driver core hold a device's parent's lock
    as well as the device's lock during calls to the probe and remove
    methods in a driver. This facility is needed by USB device drivers,
    owing to the peculiar way USB devices work:

    A device provides multiple interfaces, and drivers are bound
    to interfaces rather than to devices;

    Nevertheless a reset, reset-configuration, suspend, or resume
    affects the entire device and requires the caller to hold the
    lock for the device, not just a lock for one of the interfaces.

    Since a USB driver's probe method is always called with the interface
    lock held, the locking order rules (always lock parent before child)
    prevent these methods from acquiring the device lock. The solution
    provided here is to call all probe and remove methods, for all devices
    (not just USB), with the parent lock already acquired.

    Although currently only the USB subsystem requires these changes, people
    have mentioned in prior discussion that the overhead of acquiring an
    extra semaphore in all the prove/remove sequences is not overly large.

    Up to now, the USB core has been using its own set of private
    semaphores. A followup patch will remove them, relying entirely on the
    device semaphores provided by the driver core.

    The code paths affected by this patch are:

    device_add and device_del: The USB core already holds the parent
    lock, so no actual change is needed.

    driver_register and driver_unregister: The driver core will now
    lock both the parent and the device before probing or removing.

    driver_bind and driver_unbind (in sysfs): These routines will
    now lock both the parent and the device before binding or
    unbinding.

    bus_rescan_devices: The helper routine will lock the parent
    before probing a device.

    I have not tested this patch for conflicts with other subsystems. As
    far as I can see, the only possibility of conflict would lie in the
    bus_rescan_devices pathway, and it seems pretty remote. Nevertheless,
    it would be good for this to get a lot of testing in -mm.

    Signed-off-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • Leave the overloaded "hotplug" word to susbsystems which are handling
    real devices. The driver core does not "plug" anything, it just exports
    the state to userspace and generates events.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

16 Dec, 2005

1 commit


24 Nov, 2005

1 commit

  • This patch (as603) makes a few small fixes to the driver core:

    Change spin_lock_irq for a klist lock to spin_lock;

    Fix reference count leaks;

    Minor spelling and formatting changes.

    Signed-off-by: Alan Stern
    Acked-by Patrick Mochel
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Linus Torvalds

    Alan Stern
     

14 Nov, 2005

1 commit


10 Nov, 2005

1 commit

  • Introduce struct platform_driver. This allows the platform device
    driver methods to be passed a platform_device structure instead of
    instead of a plain device structure, and therefore requiring casting
    in every platform driver.

    We introduce this in such a way that any existing platform drivers
    registered directly via driver_register continue to work as before,
    thereby allowing a gradual conversion to the new platform_driver
    methods.

    Signed-off-by: Russell King
    Acked-by: Greg Kroah-Hartman

    Russell King
     

07 Nov, 2005

1 commit

  • Fix more include file problems that surfaced since I submitted the previous
    fix-missing-includes.patch. This should now allow not to include sched.h
    from module.h, which is done by a followup patch.

    Signed-off-by: Tim Schmielau
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

06 Nov, 2005

1 commit

  • Re-jig the simple platform device support to allow private data
    to be attached to a platform device, as well as allowing the
    parent device to be set.

    Example usage:

    pdev = platform_device_alloc("mydev", id);
    if (pdev) {
    err = platform_device_add_resources(pdev, &resources,
    ARRAY_SIZE(resources));
    if (err == 0)
    err = platform_device_add_data(pdev, &platform_data,
    sizeof(platform_data));
    if (err == 0)
    err = platform_device_add(pdev);
    } else {
    err = -ENOMEM;
    }
    if (err)
    platform_device_put(pdev);

    Signed-off-by: Russell King
    Acked-by: Greg Kroah-Hartman

    Russell King