The patch titled drivers: wait for threaded probes between initcall levels has been removed from the -mm tree. Its filename was drivers-wait-for-threaded-probes-between-initcall-levels.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: drivers: wait for threaded probes between initcall levels From: Andrew Morton <akpm@xxxxxxxx> The multithreaded-probing code has a problem: after one initcall level (eg, core_initcall) has been processed, we will then start processing the next level (postcore_initcall) while the kernel threads which are handling core_initcall are still executing. This breaks the guarantees which the layered initcalls previously gave us. IOW, we want to be multithreaded _within_ an initcall level, but not between different levels. Fix that up by causing the probing code to wait for all outstanding probes at one level to complete before we start processing the next level. Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/base/dd.c | 31 +++++++++++++++++++++++++++- include/asm-generic/vmlinux.lds.h | 9 +++++++- include/linux/init.h | 28 +++++++++++++++++-------- 3 files changed, 57 insertions(+), 11 deletions(-) diff -puN drivers/base/dd.c~drivers-wait-for-threaded-probes-between-initcall-levels drivers/base/dd.c --- a/drivers/base/dd.c~drivers-wait-for-threaded-probes-between-initcall-levels +++ a/drivers/base/dd.c @@ -18,13 +18,13 @@ #include <linux/device.h> #include <linux/module.h> #include <linux/kthread.h> +#include <linux/wait.h> #include "base.h" #include "power/power.h" #define to_drv(node) container_of(node, struct device_driver, kobj.entry) - static void driver_bound(struct device *dev) { if (klist_node_attached(&dev->knode_driver)) { @@ -94,6 +94,8 @@ int device_bind_driver(struct device *de } static atomic_t probe_count = ATOMIC_INIT(0); +static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue); + static int really_probe(struct device *dev, struct device_driver *drv) { int ret = 0; @@ -142,6 +144,7 @@ probe_failed: ret = 0; done: atomic_dec(&probe_count); + wake_up(&probe_waitqueue); return ret; } @@ -376,6 +379,32 @@ void driver_detach(struct device_driver } } +#ifdef CONFIG_PCI_MULTITHREAD_PROBE +static int __init wait_for_probes(void) +{ + DEFINE_WAIT(wait); + + printk(KERN_INFO "%s: waiting for %d threads\n", __FUNCTION__, + atomic_read(&probe_count)); + if (!atomic_read(&probe_count)) + return 0; + while (atomic_read(&probe_count)) { + prepare_to_wait(&probe_waitqueue, &wait, TASK_UNINTERRUPTIBLE); + if (atomic_read(&probe_count)) + schedule(); + } + finish_wait(&probe_waitqueue, &wait); + return 0; +} + +core_initcall_sync(wait_for_probes); +postcore_initcall_sync(wait_for_probes); +arch_initcall_sync(wait_for_probes); +subsys_initcall_sync(wait_for_probes); +fs_initcall_sync(wait_for_probes); +device_initcall_sync(wait_for_probes); +late_initcall_sync(wait_for_probes); +#endif EXPORT_SYMBOL_GPL(device_bind_driver); EXPORT_SYMBOL_GPL(device_release_driver); diff -puN include/asm-generic/vmlinux.lds.h~drivers-wait-for-threaded-probes-between-initcall-levels include/asm-generic/vmlinux.lds.h --- a/include/asm-generic/vmlinux.lds.h~drivers-wait-for-threaded-probes-between-initcall-levels +++ a/include/asm-generic/vmlinux.lds.h @@ -216,10 +216,17 @@ #define INITCALLS \ *(.initcall1.init) \ + *(.initcall1s.init) \ *(.initcall2.init) \ + *(.initcall2s.init) \ *(.initcall3.init) \ + *(.initcall3s.init) \ *(.initcall4.init) \ + *(.initcall4s.init) \ *(.initcall5.init) \ + *(.initcall5s.init) \ *(.initcall6.init) \ - *(.initcall7.init) + *(.initcall6s.init) \ + *(.initcall7.init) \ + *(.initcall7s.init) diff -puN include/linux/init.h~drivers-wait-for-threaded-probes-between-initcall-levels include/linux/init.h --- a/include/linux/init.h~drivers-wait-for-threaded-probes-between-initcall-levels +++ a/include/linux/init.h @@ -84,19 +84,29 @@ extern void setup_arch(char **); * by link order. * For backwards compatibility, initcall() puts the call in * the device init subsection. + * + * The `id' arg to __define_initcall() is needed so that multiple initcalls + * can point at the same handler without causing duplicate-symbol build errors. */ -#define __define_initcall(level,fn) \ - static initcall_t __initcall_##fn __attribute_used__ \ +#define __define_initcall(level,fn,id) \ + static initcall_t __initcall_##fn##id __attribute_used__ \ __attribute__((__section__(".initcall" level ".init"))) = fn -#define core_initcall(fn) __define_initcall("1",fn) -#define postcore_initcall(fn) __define_initcall("2",fn) -#define arch_initcall(fn) __define_initcall("3",fn) -#define subsys_initcall(fn) __define_initcall("4",fn) -#define fs_initcall(fn) __define_initcall("5",fn) -#define device_initcall(fn) __define_initcall("6",fn) -#define late_initcall(fn) __define_initcall("7",fn) +#define core_initcall(fn) __define_initcall("1",fn,1) +#define core_initcall_sync(fn) __define_initcall("1s",fn,1s) +#define postcore_initcall(fn) __define_initcall("2",fn,2) +#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s) +#define arch_initcall(fn) __define_initcall("3",fn,3) +#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s) +#define subsys_initcall(fn) __define_initcall("4",fn,4) +#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s) +#define fs_initcall(fn) __define_initcall("5",fn,5) +#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s) +#define device_initcall(fn) __define_initcall("6",fn,6) +#define device_initcall_sync(fn) __define_initcall("6s",fn,6s) +#define late_initcall(fn) __define_initcall("7",fn,7) +#define late_initcall_sync(fn) __define_initcall("7s",fn,7s) #define __initcall(fn) device_initcall(fn) _ Patches currently in -mm which might be from akpm@xxxxxxxx are origin.patch revert-pci-quirk-for-ibm-dock-ii-cardbus-controllers.patch vmscan-fix-temp_priority-race-comments.patch vmscan-fix-temp_priority-in-__zone-reclaim.patch revert-generic_file_buffered_write-handle-zero-length-iovec-segments.patch revert-generic_file_buffered_write-deadlock-on-vectored-write.patch generic_file_buffered_write-cleanup.patch mm-fix-pagecache-write-deadlocks.patch fs-prepare_write-fixes-fuse-fix.patch fs-prepare_write-fixes-fat-fix.patch git-acpi.patch git-acpi-cpufreq-fix.patch git-acpi-cpufreq-fix-2.patch acpi-asus-s3-resume-fix.patch sony_apci-resume.patch git-cpufreq-prep.patch git-cpufreq.patch nozomi-warning-fixes.patch nozomi-irq-flags-fixes.patch git-dvb-broke.patch git-dvb-still-broke.patch git-ia64.patch git-input-fixup.patch git-libata-all.patch git-mtd.patch git-netdev-all.patch libphy-dont-do-that.patch git-net-configh-got-removed.patch update-smc91x-driver-with-arm-versatile-board-info.patch netxen-build-fix.patch drivers-net-ns83820c-add-paramter-to-disable-auto.patch ioat-warning-fix.patch git-pcmcia.patch revert-scsi-ips-soft-lockup-during-reset-initialization.patch scsi-ips-soft-lockup-during-reset-initialization-2.patch git-scsi-target-fixup.patch git-scsi-target-vs-git-block.patch git-watchdog-configh-got-removed.patch prep-for-paravirt-be-careful-about-touching-bios-warning-fix.patch prep-for-paravirt-desch-clearer-parameter-names-fix.patch xfs-rename-uio_read.patch touchkit-ps-2-touchscreen-driver.patch get-rid-of-zone_table.patch new-scheme-to-preempt-swap-token-tidy.patch balance_pdgat-cleanup.patch vmalloc-optimization-cleanup-bugfixes-tweak.patch radix-tree-rcu-lockless-readside.patch acx1xx-wireless-driver.patch swsusp-add-resume_offset-command-line-parameter-rev-2.patch add-include-linux-freezerh-and-move-definitions-from-ueagle-fix.patch deprecate-smbfs-in-favour-of-cifs.patch edac-new-opteron-athlon64-memory-controller-driver.patch kbuild-dont-put-temp-files-in-the-source-tree.patch lockdep-annotate-nfs-nfsd-in-kernel-sockets-tidy.patch drivers-add-lcd-support-3-Kconfig-fix.patch setup_irq-better-mismatch-debugging.patch probe_kernel_address-needs-to-do-set_fs.patch slab-use-probe_kernel_address.patch pktcdvd-bio-write-congestion-using-blk_congestion_wait-fix.patch bug-test-1.patch fsstack-introduce-fsstack_copy_attrinode_-tidy.patch log2-implement-a-general-integer-log2-facility-in-the-kernel-fix.patch log2-implement-a-general-integer-log2-facility-in-the-kernel-vs-git-cryptodev.patch add-process_session-helper-routine-deprecate-old-field-tidy.patch add-process_session-helper-routine-deprecate-old-field-fix-warnings.patch add-process_session-helper-routine-deprecate-old-field-fix-warnings-2.patch fs-cache-provide-a-filesystem-specific-syncable-page-bit-ext4.patch fs-cache-make-kafs-use-fs-cache-fix.patch fs-cache-make-kafs-use-fs-cache-vs-streamline-generic_file_-interfaces-and-filemap.patch nfs-use-local-caching-12-fix.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-log2-fix.patch mxser-session-warning-fix.patch tty-switch-to-ktermios-and-new-framework-warning-fix.patch tty-switch-to-ktermios-bluetooth-fix.patch drivers-isdn-handcrafted-min-max-macro-removal-fix.patch swap_prefetch-vs-zoned-counters.patch add-include-linux-freezerh-and-move-definitions-from-prefetch.patch readahead-sysctl-parameters.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch resier4-add-include-linux-freezerh-and-move-definitions-from.patch make-kmem_cache_destroy-return-void-reiser4.patch reiser4-hardirq-include-fix.patch reiser4-run-truncate_inode_pages-in-reiser4_delete_inode.patch reiser4-get_sb_dev-fix.patch reiser4-vs-zoned-allocator.patch hpt3xx-rework-rate-filtering-tidy.patch statistics-infrastructure-fix-buffer-overflow-in-histogram-with-linear-tidy.patch gtod-persistent-clock-support-i386.patch hrtimers-state-tracking.patch clockevents-drivers-for-i386.patch gtod-mark-tsc-unusable-for-highres-timers.patch round_jiffies-infrastructure-fix.patch kevent-core-files-fix.patch kevent-core-files-s390-hack.patch kevent-socket-notifications-fix-2.patch kevent-socket-notifications-fix-4.patch kevent-timer-notifications-fix.patch nr_blockdev_pages-in_interrupt-warning.patch device-suspend-debug.patch mutex-subsystem-synchro-test-module-fix.patch slab-leaks3-default-y.patch x86-kmap_atomic-debugging.patch restore-rogue-readahead-printk.patch put_bh-debug.patch acpi_format_exception-debug.patch jmicron-warning-fix.patch squash-ipc-warnings.patch squash-udf-warnings.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html