diff options
author | Richard Yao <ryao@gentoo.org> | 2013-01-14 21:07:59 +0000 |
---|---|---|
committer | Richard Yao <ryao@gentoo.org> | 2013-01-14 21:07:59 +0000 |
commit | a10c8d4ff3bb55d7960e92656143a39b7fd3c5e2 (patch) | |
tree | 796b22afcc74ed6761c48e111f3dd9d262528a7a /sys-kernel/spl | |
parent | Add 13.0 release directory referring to eapi-5-files (diff) | |
download | gentoo-2-a10c8d4ff3bb55d7960e92656143a39b7fd3c5e2.tar.gz gentoo-2-a10c8d4ff3bb55d7960e92656143a39b7fd3c5e2.tar.bz2 gentoo-2-a10c8d4ff3bb55d7960e92656143a39b7fd3c5e2.zip |
Fix autotools issue detected on ~arm, fix soft lockup regression, add Linux 3.8 support
(Portage version: 2.1.11.31/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'sys-kernel/spl')
-rw-r--r-- | sys-kernel/spl/ChangeLog | 13 | ||||
-rw-r--r-- | sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch | 46 | ||||
-rw-r--r-- | sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch | 179 | ||||
-rw-r--r-- | sys-kernel/spl/spl-0.6.0_rc11-r2.ebuild | 13 | ||||
-rw-r--r-- | sys-kernel/spl/spl-0.6.0_rc13-r1.ebuild | 99 |
5 files changed, 343 insertions, 7 deletions
diff --git a/sys-kernel/spl/ChangeLog b/sys-kernel/spl/ChangeLog index d350cf28fc32..0ab0bcd74306 100644 --- a/sys-kernel/spl/ChangeLog +++ b/sys-kernel/spl/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-kernel/spl -# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/ChangeLog,v 1.37 2012/12/29 17:01:12 ryao Exp $ +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/ChangeLog,v 1.38 2013/01/14 21:07:59 ryao Exp $ + +*spl-0.6.0_rc13-r1 (14 Jan 2013) + + 14 Jan 2013; Richard Yao <ryao@gentoo.org> + +files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch, + +files/spl-0.6.0_rc13-fix-soft-lockup.patch, +spl-0.6.0_rc13-r1.ebuild, + spl-0.6.0_rc11-r2.ebuild: + Fix autotools issue detected on ~arm, fix soft lockup regression, add Linux + 3.8 support 29 Dec 2012; Richard Yao <ryao@gentoo.org> spl-0.6.0_rc10.ebuild, spl-0.6.0_rc11-r2.ebuild, spl-0.6.0_rc11.ebuild, spl-0.6.0_rc12-r1.ebuild, diff --git a/sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch new file mode 100644 index 000000000000..e8eaa385c642 --- /dev/null +++ b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-on_each_cpu-autotools-check.patch @@ -0,0 +1,46 @@ +From 050cd84e628e5d827a0b345cda12b97253fccd37 Mon Sep 17 00:00:00 2001 +From: Brian Behlendorf <behlendorf1@llnl.gov> +Date: Mon, 7 Jan 2013 14:09:09 -0800 +Subject: [PATCH] Linux compat 3.7.1, on_each_cpu() + +Some kernels require that we include the 'linux/irqflags.h' +header for the SPL_AC_3ARGS_ON_EACH_CPU check. Otherwise, +the functions local_irq_enable()/local_irq_disable() will not +be defined and the prototype will be misdetected as the four +argument version. + +This change actually include 'linux/interrupt.h' which in turn +includes 'linux/irqflags.h' to be as generic as possible. + +Additionally, passing NULL as the function can result in a +gcc error because the on_each_cpu() macro executes it +unconditionally. To make the test more robust we pass the +dummy function on_each_cpu_func(). + +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #204 +--- + config/spl-build.m4 | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/config/spl-build.m4 b/config/spl-build.m4 +index f710d8e..6e4afed 100644 +--- a/config/spl-build.m4 ++++ b/config/spl-build.m4 +@@ -1312,9 +1312,12 @@ dnl # + AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [ + AC_MSG_CHECKING([whether on_each_cpu() wants 3 args]) + SPL_LINUX_TRY_COMPILE([ ++ #include <linux/interrupt.h> + #include <linux/smp.h> ++ ++ void on_each_cpu_func(void *data) { return; } + ],[ +- on_each_cpu(NULL, NULL, 0); ++ on_each_cpu(on_each_cpu_func, NULL, 0); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1, +-- +1.7.10 + diff --git a/sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch new file mode 100644 index 000000000000..99227feb04a2 --- /dev/null +++ b/sys-kernel/spl/files/spl-0.6.0_rc13-fix-soft-lockup.patch @@ -0,0 +1,179 @@ +From d4899f4747fd03be748fd1a589b9db5786fa1375 Mon Sep 17 00:00:00 2001 +From: Brian Behlendorf <behlendorf1@llnl.gov> +Date: Fri, 11 Jan 2013 14:29:32 -0800 +Subject: [PATCH] kmem-cache: Fix slab ageing soft lockup + +Commit a10287e00d13c4c4dbbff14f42b00b03da363fcb slightly reworked +the slab ageing code such that it is no longer dependent on the +Linux delayed work queue interfaces. + +This was good for portability and performance, but it requires us +to use the on_each_cpu() function to execute the spl_magazine_age() +function. That means that the function is now executing in interrupt +context whereas before it was scheduled in normal process context. +And that means we need to be slightly more careful about the locking +in the interrupt handler. + +With the reworked code it's possible that we'll be holding the +skc->skc_lock and be interrupted to handle the spl_magazine_age() +IRQ. This will result in a deadlock and soft lockup errors unless +we're careful to detect the contention and avoid taking the lock in +the interupt handler. So that's what this patch does. + +Alternately, (and slightly more conventionally) we could have used +spin_lock_irqsave() to prevent this race entirely but I'd perfer to +avoid disabling interrupts as much as possible due to performance +concerns. There is absolutely no penalty for us not aging objects +out of the magazine due to contention. + +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Signed-off-by: Prakash Surya <surya1@llnl.gov> +Closes zfsonlinux/zfs#1193 +--- + module/spl/spl-kmem.c | 94 +++++++++++++++++++++++++++---------------------- + 1 file changed, 51 insertions(+), 43 deletions(-) + +diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c +index bc08a55..cc5961e 100644 +--- a/module/spl/spl-kmem.c ++++ b/module/spl/spl-kmem.c +@@ -827,8 +827,7 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap) + struct rw_semaphore spl_kmem_cache_sem; /* Cache list lock */ + taskq_t *spl_kmem_cache_taskq; /* Task queue for ageing / reclaim */ + +-static int spl_cache_flush(spl_kmem_cache_t *skc, +- spl_kmem_magazine_t *skm, int flush); ++static void spl_cache_shrink(spl_kmem_cache_t *skc, void *obj); + + SPL_SHRINKER_CALLBACK_FWD_DECLARE(spl_kmem_cache_generic_shrinker); + SPL_SHRINKER_DECLARE(spl_kmem_cache_shrinker, +@@ -1244,6 +1243,38 @@ static int spl_cache_flush(spl_kmem_cache_t *skc, + SRETURN(0); + } + ++/* ++ * Release objects from the per-cpu magazine back to their slab. The flush ++ * argument contains the max number of entries to remove from the magazine. ++ */ ++static void ++__spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) ++{ ++ int i, count = MIN(flush, skm->skm_avail); ++ SENTRY; ++ ++ ASSERT(skc->skc_magic == SKC_MAGIC); ++ ASSERT(skm->skm_magic == SKM_MAGIC); ++ ASSERT(spin_is_locked(&skc->skc_lock)); ++ ++ for (i = 0; i < count; i++) ++ spl_cache_shrink(skc, skm->skm_objs[i]); ++ ++ skm->skm_avail -= count; ++ memmove(skm->skm_objs, &(skm->skm_objs[count]), ++ sizeof(void *) * skm->skm_avail); ++ ++ SEXIT; ++} ++ ++static void ++spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) ++{ ++ spin_lock(&skc->skc_lock); ++ __spl_cache_flush(skc, skm, flush); ++ spin_unlock(&skc->skc_lock); ++} ++ + static void + spl_magazine_age(void *data) + { +@@ -1252,10 +1283,23 @@ static int spl_cache_flush(spl_kmem_cache_t *skc, + + ASSERT(skm->skm_magic == SKM_MAGIC); + ASSERT(skm->skm_cpu == smp_processor_id()); ++ ASSERT(irqs_disabled()); ++ ++ /* There are no available objects or they are too young to age out */ ++ if ((skm->skm_avail == 0) || ++ time_before(jiffies, skm->skm_age + skc->skc_delay * HZ)) ++ return; + +- if (skm->skm_avail > 0) +- if (time_after(jiffies, skm->skm_age + skc->skc_delay * HZ)) +- (void) spl_cache_flush(skc, skm, skm->skm_refill); ++ /* ++ * Because we're executing in interrupt context we may have ++ * interrupted the holder of this lock. To avoid a potential ++ * deadlock return if the lock is contended. ++ */ ++ if (!spin_trylock(&skc->skc_lock)) ++ return; ++ ++ __spl_cache_flush(skc, skm, skm->skm_refill); ++ spin_unlock(&skc->skc_lock); + } + + /* +@@ -1451,7 +1495,7 @@ static int spl_cache_flush(spl_kmem_cache_t *skc, + + for_each_online_cpu(i) { + skm = skc->skc_mag[i]; +- (void)spl_cache_flush(skc, skm, skm->skm_avail); ++ spl_cache_flush(skc, skm, skm->skm_avail); + spl_magazine_free(skm); + } + +@@ -1932,42 +1976,6 @@ static int spl_cache_flush(spl_kmem_cache_t *skc, + } + + /* +- * Release a batch of objects from a per-cpu magazine back to their +- * respective slabs. This occurs when we exceed the magazine size, +- * are under memory pressure, when the cache is idle, or during +- * cache cleanup. The flush argument contains the number of entries +- * to remove from the magazine. +- */ +-static int +-spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) +-{ +- int i, count = MIN(flush, skm->skm_avail); +- SENTRY; +- +- ASSERT(skc->skc_magic == SKC_MAGIC); +- ASSERT(skm->skm_magic == SKM_MAGIC); +- +- /* +- * XXX: Currently we simply return objects from the magazine to +- * the slabs in fifo order. The ideal thing to do from a memory +- * fragmentation standpoint is to cheaply determine the set of +- * objects in the magazine which will result in the largest +- * number of free slabs if released from the magazine. +- */ +- spin_lock(&skc->skc_lock); +- for (i = 0; i < count; i++) +- spl_cache_shrink(skc, skm->skm_objs[i]); +- +- skm->skm_avail -= count; +- memmove(skm->skm_objs, &(skm->skm_objs[count]), +- sizeof(void *) * skm->skm_avail); +- +- spin_unlock(&skc->skc_lock); +- +- SRETURN(count); +-} +- +-/* + * Allocate an object from the per-cpu magazine, or if the magazine + * is empty directly allocate from a slab and repopulate the magazine. + */ +@@ -2053,7 +2061,7 @@ static int spl_cache_flush(spl_kmem_cache_t *skc, + + /* Per-CPU cache full, flush it to make space */ + if (unlikely(skm->skm_avail >= skm->skm_size)) +- (void)spl_cache_flush(skc, skm, skm->skm_refill); ++ spl_cache_flush(skc, skm, skm->skm_refill); + + /* Available space in cache, use it */ + skm->skm_objs[skm->skm_avail++] = obj; +-- +1.7.10 + diff --git a/sys-kernel/spl/spl-0.6.0_rc11-r2.ebuild b/sys-kernel/spl/spl-0.6.0_rc11-r2.ebuild index 08149c706ee0..9d5bfe751060 100644 --- a/sys-kernel/spl/spl-0.6.0_rc11-r2.ebuild +++ b/sys-kernel/spl/spl-0.6.0_rc11-r2.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-0.6.0_rc11-r2.ebuild,v 1.4 2012/12/29 17:01:12 ryao Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-0.6.0_rc11-r2.ebuild,v 1.5 2013/01/14 21:07:59 ryao Exp $ EAPI="4" AUTOTOOLS_AUTORECONF="1" @@ -54,9 +54,12 @@ src_prepare() { # Workaround for hard coded path sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die - # Linux 3.6 Support - epatch "${FILESDIR}/${P}-linux-3.6-compat.patch" - epatch "${FILESDIR}/${PN}-0.6.0_rc12-fix-3.6-compat-regression.patch" + if [ ${PV} != "9999" ] + then + # Linux 3.6 Support + epatch "${FILESDIR}/${P}-linux-3.6-compat.patch" + epatch "${FILESDIR}/${PN}-0.6.0_rc12-fix-3.6-compat-regression.patch" + fi autotools-utils_src_prepare } diff --git a/sys-kernel/spl/spl-0.6.0_rc13-r1.ebuild b/sys-kernel/spl/spl-0.6.0_rc13-r1.ebuild new file mode 100644 index 000000000000..b607f02a9992 --- /dev/null +++ b/sys-kernel/spl/spl-0.6.0_rc13-r1.ebuild @@ -0,0 +1,99 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-0.6.0_rc13-r1.ebuild,v 1.1 2013/01/14 21:07:59 ryao Exp $ + +EAPI="4" +AUTOTOOLS_AUTORECONF="1" + +inherit flag-o-matic linux-mod autotools-utils + +if [[ ${PV} == "9999" ]] ; then + inherit git-2 + EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git" +else + inherit eutils versionator + MY_PV=$(replace_version_separator 3 '-') + SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz" + S="${WORKDIR}/${PN}-${PN}-${MY_PV}" + KEYWORDS="~amd64" +fi + +DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs" +HOMEPAGE="http://zfsonlinux.org/" + +LICENSE="GPL-2" +SLOT="0" +IUSE="custom-cflags debug debug-log" +RESTRICT="test" + +RDEPEND="!sys-devel/spl" + +AT_M4DIR="config" +AUTOTOOLS_IN_SOURCE_BUILD="1" + +pkg_setup() { + CONFIG_CHECK=" + !DEBUG_LOCK_ALLOC + !GRKERNSEC_HIDESYM + MODULES + KALLSYMS + !PAX_KERNEXEC_PLUGIN_METHOD_OR + ZLIB_DEFLATE + ZLIB_INFLATE + " + + kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required" + + [ ${PV} != "9999" ] && \ + { kernel_is le 3 8 || die "Linux 3.8 is the latest supported version."; } + + check_extra_config +} + +src_prepare() { + # Workaround for hard coded path + sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die + + if [ ${PV} != "9999" ] + then + # Fix on_each_cpu autotools to work correctly + epatch "${FILESDIR}/${P}-fix-on_each_cpu-autotools-check.patch" + + # Fix soft lockup regression + epatch "${FILESDIR}/${P}-fix-soft-lockup.patch" + fi + + autotools-utils_src_prepare +} + +src_configure() { + use custom-cflags || strip-flags + set_arch_to_kernel + local myeconfargs=( + --bindir="${EPREFIX}/bin" + --sbindir="${EPREFIX}/sbin" + --with-config=all + --with-linux="${KV_DIR}" + --with-linux-obj="${KV_OUT_DIR}" + $(use_enable debug) + $(use_enable debug-log) + ) + autotools-utils_src_configure +} + +src_test() { + if [[ ! -e /proc/modules ]] + then + die "Missing /proc/modules" + elif [[ $UID -ne 0 ]] + then + ewarn "Cannot run make check tests with FEATURES=userpriv." + ewarn "Skipping make check tests." + elif grep -q '^spl ' /proc/modules + then + ewarn "Cannot run make check tests with module spl loaded." + ewarn "Skipping make check tests." + else + autotools-utils_src_test + fi +} |