Re: vfs_lockf changes (was: CVS commit: src)

2023-09-11 Thread Rin Okuyama
Hi ad@,

Good to see you again!

On Tue, Sep 12, 2023 at 12:29 AM Martin Husemann  wrote:
>
> On Sun, Sep 10, 2023 at 02:45:53PM +, Andrew Doran wrote:
> > Module Name:  src
> > Committed By: ad
> > Date: Sun Sep 10 14:45:53 UTC 2023
> >
> > Modified Files:
> >   src/common/lib/libc/gen: radixtree.c
> >   src/sys/kern: init_main.c kern_descrip.c kern_lwp.c kern_mutex_obj.c
> >   kern_resource.c kern_rwlock_obj.c kern_turnstile.c subr_kcpuset.c
> >   vfs_cwd.c vfs_init.c vfs_lockf.c
> >   src/sys/rump/librump/rumpkern: rump.c
> >   src/sys/rump/librump/rumpvfs: rump_vfs.c
> >   src/sys/sys: namei.src
> >   src/sys/uvm: uvm_init.c uvm_map.c uvm_readahead.c
> >
> > Log Message:
> > - Do away with separate pool_cache for some kernel objects that have no 
> > special
> >   requirements and use the general purpose allocator instead.  On one of my
> >   test systems this makes for a small (~1%) but repeatable reduction in 
> > system
> >   time during builds presumably because it decreases the kernel's cache /
> >   memory bandwidth footprint a little.
> > - vfs_lockf: cache a pointer to the uidinfo and put mutex in the data 
> > segment.
>
> Hi Andrew,
>
> most (all?) vfs_lockf tests are now crashing, e.g.
>
> https://netbsd.org/~martin/evbearmv7hf-atf/469_atf.html#failed-tcs-summary

Also:

(1) radix_tree_remove_node() calls kmem_free(9) in the softint context, by
which kernel crashes during install for anita:

https://releng.netbsd.org/b5reports/amd64/2023/2023.09.10.16.25.32/install.log

(2) tests in tests/net/altq fails (logs are not interesting, unfortunately):

https://netbsd.org/~martin/evbearmv7hf-atf/469_atf.html#net_altq_t_cbq_altq_cbq_basic_ipv4

I could reproduce (2) on other architectures as well.

Can you please take a look?

Thanks,
rin


vfs_lockf changes (was: CVS commit: src)

2023-09-11 Thread Martin Husemann
On Sun, Sep 10, 2023 at 02:45:53PM +, Andrew Doran wrote:
> Module Name:  src
> Committed By: ad
> Date: Sun Sep 10 14:45:53 UTC 2023
> 
> Modified Files:
>   src/common/lib/libc/gen: radixtree.c
>   src/sys/kern: init_main.c kern_descrip.c kern_lwp.c kern_mutex_obj.c
>   kern_resource.c kern_rwlock_obj.c kern_turnstile.c subr_kcpuset.c
>   vfs_cwd.c vfs_init.c vfs_lockf.c
>   src/sys/rump/librump/rumpkern: rump.c
>   src/sys/rump/librump/rumpvfs: rump_vfs.c
>   src/sys/sys: namei.src
>   src/sys/uvm: uvm_init.c uvm_map.c uvm_readahead.c
> 
> Log Message:
> - Do away with separate pool_cache for some kernel objects that have no 
> special
>   requirements and use the general purpose allocator instead.  On one of my
>   test systems this makes for a small (~1%) but repeatable reduction in system
>   time during builds presumably because it decreases the kernel's cache /
>   memory bandwidth footprint a little.
> - vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.

Hi Andrew, 

most (all?) vfs_lockf tests are now crashing, e.g.

https://netbsd.org/~martin/evbearmv7hf-atf/469_atf.html#failed-tcs-summary


Core was generated by `t_vnops'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  rumpuser_mutex_spin_p (mtx=0x0) at 
/work/src/lib/librumpuser/rumpuser_pth.c:166
[Current thread is 1 (process 18892)]
#0  rumpuser_mutex_spin_p (mtx=0x0) at 
/work/src/lib/librumpuser/rumpuser_pth.c:166
#1  0x71c672dc in mutex_enter (mtx=0x71d78fc0 ) at 
/work/src/lib/librump/../../sys/rump/librump/rumpkern/locks.c:164
#2  0x71d3dd58 in lf_advlock (ap=0x7ff897b8, head=0x6cdc7140, size=) at /work/src/lib/librumpvfs/../../sys/rump/../kern/vfs_lockf.c:896
#3  0x71d51bec in VOP_ADVLOCK (vp=0x6cde0600, id=, op=, fl=, flags=64) at 
/work/src/lib/librumpvfs/../../sys/rump/../kern/vnode_if.c:1867
#4  0x71be5f64 in do_fcntl_lock (fd=fd@entry=0, cmd=cmd@entry=8, 
fl=fl@entry=0x7ff89818) at 
/work/src/lib/librump/../../sys/rump/../kern/sys_descrip.c:285
#5  0x71be6154 in sys_fcntl (l=, uap=0x7ff898fc, 
retval=) at 
/work/src/lib/librump/../../sys/rump/../kern/sys_descrip.c:365
#6  0x71c70d9c in sy_call (rval=0x7ff898f4, uap=0x7ff898fc, l=0x6ce09c80, 
sy=0x71cbf6f0 ) at 
/work/src/lib/librump/../../sys/rump/../sys/syscallvar.h:65
#7  sy_invoke (code=0, rval=0x7ff898f4, uap=0x7ff898fc, l=0x6ce09c80, 
sy=0x71cbf6f0 ) at 
/work/src/lib/librump/../../sys/rump/../sys/syscallvar.h:94
#8  rump_syscall (num=0, num@entry=92, data=0x7ff898fc, data@entry=0x7ff898f4, 
dlen=dlen@entry=12, retval=0x7ff898f4, retval@entry=0x7ff898ec) at 
/work/src/lib/librump/../../sys/rump/librump/rumpkern/rump.c:782
#9  0x71c63e8c in rump___sysimpl_fcntl (fd=fd@entry=0, cmd=cmd@entry=8, 
arg=arg@entry=0x7ff899e8) at 
/work/src/lib/librump/../../sys/rump/librump/rumpkern/rump_syscalls.c:1322
#10 0x007f8120 in fcntl_getlock_pids (tc=0x855234 
, mp=0x8329c0 "/mnt") at 
/work/src/tests/fs/vfs/t_vnops.c:941
#11 0x00811134 in atfu_ext2fs_fcntl_getlock_pids_body (tc=0x855234 
) at /work/src/tests/fs/vfs/t_vnops.c:1085
#12 0x71ae8658 in atf_tc_run (tc=0x855234 , 
resfile=) at /work/src/external/bsd/atf/dist/atf-c/tc.c:1024
#13 0x71ae4f84 in run_tc (exitcode=, p=0x7ff8a840, 
tp=0x7ff8a83c) at /work/src/external/bsd/atf/dist/atf-c/detail/tp_main.c:510
#14 controlled_main (exitcode=, add_tcs_hook=0x7ff8a86c, 
argv=, argc=) at 
/work/src/external/bsd/atf/dist/atf-c/detail/tp_main.c:580
#15 atf_tp_main (argc=, argv=, 
add_tcs_hook=0x7ff8a86c) at 
/work/src/external/bsd/atf/dist/atf-c/detail/tp_main.c:610
#16 0x007e6aa4 in ___start ()

Martin