From af1438a26ac6cbdb10b9e780c1bc69c459963b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Fabian=20Silva=20Delgado?= Date: Thu, 15 Nov 2012 22:02:32 -0200 Subject: linux-libre-lts-rt-3.0.51_rt75-1: updating version --- kernels/linux-libre-lts-rt/PKGBUILD | 25 ++++--- kernels/linux-libre-lts-rt/ext4-options.patch | 2 +- .../linux-libre-lts-rt/linux-libre-lts-rt.install | 2 +- .../linux-libre-lts-rt/module-init-wait-3.0.patch | 77 ++++++++++++++++++++++ .../module-symbol-waiting-3.0.patch | 66 +++++++++++++++++++ 5 files changed, 162 insertions(+), 10 deletions(-) create mode 100644 kernels/linux-libre-lts-rt/module-init-wait-3.0.patch create mode 100644 kernels/linux-libre-lts-rt/module-symbol-waiting-3.0.patch (limited to 'kernels/linux-libre-lts-rt') diff --git a/kernels/linux-libre-lts-rt/PKGBUILD b/kernels/linux-libre-lts-rt/PKGBUILD index daf2d1c16..976b2995c 100755 --- a/kernels/linux-libre-lts-rt/PKGBUILD +++ b/kernels/linux-libre-lts-rt/PKGBUILD @@ -11,12 +11,12 @@ pkgbase=linux-libre-lts-rt # Build stock -LIBRE-LTS-RT kernel #pkgbase=linux-libre-custom # Build kernel with a different name _basekernel=3.0 -_releasever=43 -_rtpatchver=rt65 +_releasever=51 +_rtpatchver=rt75 _pkgver=${_basekernel}.${_releasever} pkgver=${_basekernel}.${_releasever}_${_rtpatchver} pkgrel=1 -_lxopkgver=${_basekernel}.43 # nearly always the same as pkgver +_lxopkgver=${_basekernel}.50 # nearly always the same as pkgver arch=('i686' 'x86_64' 'mips64el') url="http://linux-libre.fsfla.org/" license=('GPL2') @@ -35,10 +35,12 @@ source=("http://linux-libre.fsfla.org/pub/linux-libre/releases/${_basekernel}-gn 'change-default-console-loglevel.patch' 'i915-fix-ghost-tv-output.patch' 'ext4-options.patch' + 'module-symbol-waiting-3.0.patch' + 'module-init-wait-3.0.patch' "http://www.linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense/pool/debuginfo/linux-patches-${_lxopkgver}-gnu_0loongsonlibre_mipsel.tar.bz2") md5sums=('5f64180fe7df4e574dac5911b78f5067' - 'c4b4e6d908e70fc6f991a1789a3ac620' - 'bcca49907b1c1e74f6ff6afced5ff959' + 'fb3c742b1f8b01131534a22348cfa712' + '904669e437a0bb19e95022964430ad4a' '7266f5e7af09cc6e4b15d7a952e3b350' '5387f0cf51652c071190789569adf9c7' '85f04a9555bdc295f7c387a6564f0c81' @@ -47,8 +49,10 @@ md5sums=('5f64180fe7df4e574dac5911b78f5067' '04b21c79df0a952c22d681dd4f4562df' '9d3c56a4b999c8bfbd4018089a62f662' '263725f20c0b9eb9c353040792d644e5' - 'c8299cf750a84e12d60b372c8ca7e1e8' - '2c4870ef22f87ef885f3be392d1aaa90') + 'f36222e7ce20c8e4dc27376f9be60f6c' + '670931649c60fcb3ef2e0119ed532bd4' + '8a71abc4224f575008f974a099b5cf6f' + 'e2cc9f33fb26b254b6b65f8981aebf13') if [ "$CARCH" != "mips64el" ]; then # Don't use the Loongson-specific patches on non-mips64el arches. unset source[${#source[@]}-1] @@ -90,6 +94,11 @@ build() { # https://bugs.archlinux.org/task/28653 patch -Np1 -i "${srcdir}/ext4-options.patch" + # fix module initialisation + # https://bugs.archlinux.org/task/32122 + patch -Np1 -i "${srcdir}/module-symbol-waiting-3.0.patch" + patch -Np1 -i "${srcdir}/module-init-wait-3.0.patch" + if [ "$CARCH" == "mips64el" ]; then sed -i "s|^EXTRAVERSION.*|EXTRAVERSION =-libre-lts-rt|" Makefile sed -r "s|^( SUBLEVEL = ).*|\1$_sublevel|" \ @@ -102,7 +111,7 @@ build() { # https://git.kernel.org/?p=linux/hotplug/udev.git;a=blob_plain;f=README # and make USB storage support builtin (e.g. for booting from USB # disks without slowly loading an initramfs) - sed -ri -e "s|CONFIG_MIPS32_N32=.*|CONFIG_MIPS32_N32=y|g" \ + sed -ri \ -e "s|CONFIG_MIPS32_N32=.*|CONFIG_MIPS32_N32=y|g" \ -e "s|CONFIG_UEVENT_HELPER_PATH=.*|CONFIG_UEVENT_HELPER_PATH=\"\"|g" \ -e "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_localversionname}\"|g" \ diff --git a/kernels/linux-libre-lts-rt/ext4-options.patch b/kernels/linux-libre-lts-rt/ext4-options.patch index 812b05f04..ef1b2417d 100755 --- a/kernels/linux-libre-lts-rt/ext4-options.patch +++ b/kernels/linux-libre-lts-rt/ext4-options.patch @@ -46,4 +46,4 @@ index 502c61f..30de9cd 100644 +#endif default: ext4_msg(sb, KERN_ERR, - "Unrecognized mount option \"%s\" " \ No newline at end of file + "Unrecognized mount option \"%s\" " diff --git a/kernels/linux-libre-lts-rt/linux-libre-lts-rt.install b/kernels/linux-libre-lts-rt/linux-libre-lts-rt.install index d2f0ae05a..5f31cc3d4 100755 --- a/kernels/linux-libre-lts-rt/linux-libre-lts-rt.install +++ b/kernels/linux-libre-lts-rt/linux-libre-lts-rt.install @@ -2,7 +2,7 @@ # arg 2: the old package version KERNEL_NAME=-lts-rt -KERNEL_VERSION=3.0.43-1-rt65-LIBRE-LTS-RT +KERNEL_VERSION=3.0.51-1-rt75-LIBRE-LTS-RT # set a sane PATH to ensure that critical utils like depmod will be found export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' diff --git a/kernels/linux-libre-lts-rt/module-init-wait-3.0.patch b/kernels/linux-libre-lts-rt/module-init-wait-3.0.patch new file mode 100644 index 000000000..1bcfd2491 --- /dev/null +++ b/kernels/linux-libre-lts-rt/module-init-wait-3.0.patch @@ -0,0 +1,77 @@ +From: Rusty Russell +Date: Fri, 28 Sep 2012 05:01:03 +0000 (+0930) +Subject: module: wait when loading a module which is currently initializing. +X-Git-Tag: v3.7-rc1~2^2~32 +X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=9bb9c3be568346538 + +module: wait when loading a module which is currently initializing. + +The original module-init-tools module loader used a fnctl lock on the +.ko file to avoid attempts to simultaneously load a module. +Unfortunately, you can't get an exclusive fcntl lock on a read-only +fd, making this not work for read-only mounted filesystems. +module-init-tools has a hacky sleep-and-loop for this now. + +It's not that hard to wait in the kernel, and only return -EEXIST once +the first module has finished loading (or continue loading the module +if the first one failed to initialize for some reason). It's also +consistent with what we do for dependent modules which are still loading. + +Suggested-by: Lucas De Marchi +Signed-off-by: Rusty Russell +--- + +diff --git a/kernel/module.c b/kernel/module.c +index 63cf6e7..74bc195 100644 +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -2845,6 +2845,20 @@ static int post_relocation(struct module *mod, const struct load_info *info) + return module_finalize(info->hdr, info->sechdrs, mod); + } + ++/* Is this module of this name done loading? No locks held. */ ++static bool finished_loading(const char *name) ++{ ++ struct module *mod; ++ bool ret; ++ ++ mutex_lock(&module_mutex); ++ mod = find_module(name); ++ ret = !mod || mod->state != MODULE_STATE_COMING; ++ mutex_unlock(&module_mutex); ++ ++ return ret; ++} ++ + /* Allocate and load the module: note that size of section 0 is always + zero, and we rely on this for optional sections. */ + static struct module *load_module(void __user *umod, +@@ -2852,7 +2866,7 @@ static struct module *load_module(void __user *umod, + const char __user *uargs) + { + struct load_info info = { NULL, }; +- struct module *mod; ++ struct module *mod, *old; + long err; + + pr_debug("load_module: umod=%p, len=%lu, uargs=%p\n", +@@ -2918,8 +2932,18 @@ static struct module *load_module(void __user *umod, + * function to insert in a way safe to concurrent readers. + * The mutex protects against concurrent writers. + */ ++again: + mutex_lock(&module_mutex); +- if (find_module(mod->name)) { ++ if ((old = find_module(mod->name)) != NULL) { ++ if (old->state == MODULE_STATE_COMING) { ++ /* Wait in case it fails to load. */ ++ mutex_unlock(&module_mutex); ++ err = wait_event_interruptible(module_wq, ++ finished_loading(mod->name)); ++ if (err) ++ goto free_arch_cleanup; ++ goto again; ++ } + err = -EEXIST; + goto unlock; + } diff --git a/kernels/linux-libre-lts-rt/module-symbol-waiting-3.0.patch b/kernels/linux-libre-lts-rt/module-symbol-waiting-3.0.patch new file mode 100644 index 000000000..b87a38ff5 --- /dev/null +++ b/kernels/linux-libre-lts-rt/module-symbol-waiting-3.0.patch @@ -0,0 +1,66 @@ +From: Rusty Russell +Date: Fri, 28 Sep 2012 05:01:03 +0000 (+0930) +Subject: module: fix symbol waiting when module fails before init +X-Git-Tag: v3.7-rc1~2^2~33 +X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=6f13909f4fe9652f1 + +module: fix symbol waiting when module fails before init + +We use resolve_symbol_wait(), which blocks if the module containing +the symbol is still loading. However: + +1) The module_wq we use is only woken after calling the modules' init + function, but there are other failure paths after the module is + placed in the linked list where we need to do the same thing. + +2) wake_up() only wakes one waiter, and our waitqueue is shared by all + modules, so we need to wake them all. + +3) wake_up_all() doesn't imply a memory barrier: I feel happier calling + it after we've grabbed and dropped the module_mutex, not just after + the state assignment. + +Signed-off-by: Rusty Russell +--- + +diff --git a/kernel/module.c b/kernel/module.c +index 7f2ee45f..63cf6e7 100644 +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -2959,7 +2959,7 @@ static struct module *load_module(void __user *umod, + /* Unlink carefully: kallsyms could be walking list. */ + list_del_rcu(&mod->list); + module_bug_cleanup(mod); +- ++ wake_up_all(&module_wq); + ddebug: + dynamic_debug_remove(info.debug); + unlock: +@@ -3034,7 +3034,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod, + blocking_notifier_call_chain(&module_notify_list, + MODULE_STATE_GOING, mod); + free_module(mod); +- wake_up(&module_wq); ++ wake_up_all(&module_wq); + return ret; + } + if (ret > 0) { +@@ -3046,9 +3046,8 @@ SYSCALL_DEFINE3(init_module, void __user *, umod, + dump_stack(); + } + +- /* Now it's a first class citizen! Wake up anyone waiting for it. */ ++ /* Now it's a first class citizen! */ + mod->state = MODULE_STATE_LIVE; +- wake_up(&module_wq); + blocking_notifier_call_chain(&module_notify_list, + MODULE_STATE_LIVE, mod); + +@@ -3071,6 +3070,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod, + mod->init_ro_size = 0; + mod->init_text_size = 0; + mutex_unlock(&module_mutex); ++ wake_up_all(&module_wq); + + return 0; + } -- cgit v1.2.3-2-g168b