Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Linux 3.10 #257

Closed
wants to merge 4 commits into from
Closed

Linux 3.10 #257

wants to merge 4 commits into from

Conversation

ryao
Copy link
Contributor

@ryao ryao commented Jul 4, 2013

@yshui's 3.10 compatibility patches worked, but a few of them addressed the Linux kernel's move to make struct proc_dir_entry a private interface by duplicating the definition. @behlendorf pointed out that is prone to break, so I wrote a patch to implement his suggestion to "rework the __kstat_install/__kstat_delete handlers to only pass around the opaque handle". I also fixed the merge conflict in one of yshui's other patches that replacing his proc_dir_entry patches caused.

This is complemented by openzfs/zfs#1494. It contains an autotools check that is slightly better than the one @yshui proposed in openzfs/zfs#1458.

yshui added 3 commits July 3, 2013 20:22
torvalds/linux@d9dda78b

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>

Conflicts:
	config/spl-build.m4
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
@behlendorf behlendorf mentioned this pull request Jul 4, 2013

static spinlock_t kstat_lock;
static kmutex_t kstat_lock;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an additional note, the critical sections protected by kstat_lock involve allocations where KM_SLEEP is used. I switched from spinlock_t to kmutex_t to avoid the possibility of holding a spin lock while allocating memory with KM_SLEEP.

torvalds/linux#59d8053f moved the definition of struct proc_dir_entry
from include/linux/proc_fs.h to fs/proc/internal.h. The SPL relied on
that to map Solaris' kstat to entries in /proc/spl/kstat. Brian
Belendorf suggested reworking "the __kstat_install/__kstat_delete
handlers to only pass around the opaque handle", which is what we do.

Signed-off-by: Richard Yao <ryao@gentoo.org>
@ryao
Copy link
Contributor Author

ryao commented Jul 5, 2013

I have refreshed the pull request with most of the suggested changes. The only one that I did not make was splitting kstat_add_module from __kstat_install because the __kstat_install function should by definition do that. Also, this did not forget to test an older kernel to ensure that I was not relying on 3.10-specific functions. I am not setup to test a wide variety of kernels, so my testing was rather limited in comparison to what is done at LLNL. In specific, I tested against 3.9.8 and 3.10.0.

@behlendorf
Copy link
Contributor

Observed on kernels prior to 3.9, exactly which ones I have run down yet. This was for a RHEL6 2.6.32 based kernel.

Pid: 21103, comm: rmmod Tainted: P           ---------------    2.6.32-279.5.2.el6.x86_64 #1 Bochs Bochs
RIP: 0010:[<ffffffff811e6e4c>]  [<ffffffff811e6e4c>] remove_proc_entry+0x8c/0x260
Process rmmod (pid: 21103, threadinfo ffff8800ccde4000, task ffff8800ccc9a080)
Stack:
 ffff8800ccde5d38 00000000000002e0 ffff880118cbf1c0 ffffffffa0496ca0
<d> ffff8800ccde5f18 0000000000000000 ffff8800ccde5d58 ffffffff810e5dc6
<d> ffff8800ccde5dc8 ffff88003782c2cc ffff88003782c370 ffff88003782c290
Call Trace:
 [<ffffffffa0496ca0>] ? splat_mutex_test1+0x0/0x890 [splat]
 [<ffffffff810e5dc6>] ? ftrace_test_stop_func+0x16/0x20
 [<ffffffffa044dff3>] kstat_delete_module+0x53/0xc0 [spl]
 [<ffffffffa044e22d>] __kstat_delete+0x1cd/0x1e0 [spl]
 [<ffffffffa058715a>] fm_fini+0x1da/0x2a0 [zfs]
 [<ffffffffa05a9ae5>] spa_fini+0x45/0x1e0 [zfs]
 [<ffffffffa05dbe35>] ? zfsctl_fini+0x15/0x20 [zfs]
 [<ffffffffa05f482f>] ? zfs_fini+0x1f/0x30 [zfs]
 [<ffffffffa05e4e2d>] _fini+0xbd/0x160 [zfs]
 [<ffffffffa05e4ee3>] spl__fini+0x13/0x40 [zfs]
 [<ffffffff810ae054>] sys_delete_module+0x194/0x260
 [<ffffffff815034ee>] ? do_page_fault+0x3e/0xa0
 [<ffffffff8100b0f2>] system_call_fastpath+0x16/0x1b

behlendorf pushed a commit that referenced this pull request Jul 9, 2013
Linux kernel commmit torvalds/linux@db3808c1 moved the
vmalloc_info structure from a private to a public header.
Now that it's available for kernel modules use it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
behlendorf pushed a commit that referenced this pull request Jul 9, 2013
Linux kernel commit torvalds/linux@d9dda78b renamed PDE() to
PDE_DATA().  To handle this detect the prefered interface
and define a PDE_DATA() wrapper for consistency.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
behlendorf pushed a commit that referenced this pull request Jul 9, 2013
Linux kernel commit torvalds/linux@0d01ff2 changes some
includes we were depending on through linux/proc_fs.h.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
behlendorf pushed a commit that referenced this pull request Jul 9, 2013
Linux kernel commit torvalds/linux#59d8053f moved the definition of
struct proc_dir_entry from include/linux/proc_fs.h to the private
header fs/proc/internal.h. The SPL relied on that to map Solaris'
kstat to entries in /proc/spl/kstat.

Since the proc_dir_entry structure is now private the only safe
thing to do is wrap the opaque proc handle with our own structure.
This actually ends up simplify the code and is good because it
moves us away from depending on implementation details of /proc.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
@behlendorf behlendorf closed this in 5bc941f Jul 9, 2013
behlendorf added a commit that referenced this pull request Jan 7, 2014
Related to issue #257 which added Linux 3.10 compatibility.  For
ARM and Sparc architectures we must explicitly include the
<linux/vmalloc.h> header to ensure the vmalloc_info structure
is always defined when available.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
Closes #291
ryao pushed a commit to ryao/spl that referenced this pull request Apr 10, 2014
Related to issue openzfs#257 which added Linux 3.10 compatibility.  For
ARM and Sparc architectures we must explicitly include the
<linux/vmalloc.h> header to ensure the vmalloc_info structure
is always defined when available.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#257
Closes openzfs#291
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants