Page MenuHomeFreeBSD

kib (Konstantin Belousov)
User

Projects

User Details

User Since
May 16 2014, 7:35 PM (610 w, 1 d)

Recent Activity

Today

kib committed rG58580dc0c694: libc: document posix_spawnattr_getexecfd_np(3) (authored by kib).
libc: document posix_spawnattr_getexecfd_np(3)
Sun, Jan 25, 5:21 PM
kib committed rG3f0aea09689f: libc: add posix_spawnattr_{get,set}execfd_np(3) (authored by kib).
libc: add posix_spawnattr_{get,set}execfd_np(3)
Sun, Jan 25, 5:21 PM
kib closed D54862: Add posix_spawnattr_get/setexecfd_np(3).
Sun, Jan 25, 5:21 PM
kib updated the diff for D54246: powerpc64: only sync icache if we relocated in executable segment.

Remove nop loop.

Sun, Jan 25, 4:57 PM
kib updated the diff for D54246: powerpc64: only sync icache if we relocated in executable segment.

Fixes by adrian.

Sun, Jan 25, 4:37 PM
kib updated the diff for D54862: Add posix_spawnattr_get/setexecfd_np(3).

Man page fixes

Sun, Jan 25, 4:19 PM
kib added inline comments to D54862: Add posix_spawnattr_get/setexecfd_np(3).
Sun, Jan 25, 4:18 PM
kib committed rGe878df0d3b1e: Regen syscall tables after pdfork(2) and pdwait(2) additions (authored by kib).
Regen syscall tables after pdfork(2) and pdwait(2) additions
Sun, Jan 25, 3:58 PM
kib committed rGf7b56887cc07: Document pdrfork(2) and pdwait(2) (authored by kib).
Document pdrfork(2) and pdwait(2)
Sun, Jan 25, 3:58 PM
kib committed rG6c82bf1407d2: Regen for the fork and exit/wait exterror category addition (authored by kib).
Regen for the fork and exit/wait exterror category addition
Sun, Jan 25, 3:58 PM
kib committed rG2d555ec85a71: lib/libsys, lib/libc: export pdwait (authored by kib).
lib/libsys, lib/libc: export pdwait
Sun, Jan 25, 3:58 PM
kib committed rG4d707825bf62: Add pdwait(2) (authored by kib).
Add pdwait(2)
Sun, Jan 25, 3:58 PM
kib committed rG09984871d8ca: procdesc: postpone freeing the zombie' pid until procdesc is freed (authored by kib).
procdesc: postpone freeing the zombie' pid until procdesc is freed
Sun, Jan 25, 3:58 PM
kib committed rGaa72df78d799: sys: Add cap_pdwait_rights (authored by kib).
sys: Add cap_pdwait_rights
Sun, Jan 25, 3:58 PM
kib committed rGa560abedfb4f: audit: handle AUE_PDWAIT (authored by kib).
audit: handle AUE_PDWAIT
Sun, Jan 25, 3:58 PM
kib committed rG7fe33d58a826: kern/kern_exit.c: extract wait6_check_alive() helper (authored by kib).
kern/kern_exit.c: extract wait6_check_alive() helper
Sun, Jan 25, 3:58 PM
kib committed rG2b67cfa39d83: kern/kern_exit.c: extract some helpers from proc_to_reap() (authored by kib).
kern/kern_exit.c: extract some helpers from proc_to_reap()
Sun, Jan 25, 3:58 PM
kib committed rG109b9f48ec4e: kern/kern_exit.c: define the exterror category for exit/wait (authored by kib).
kern/kern_exit.c: define the exterror category for exit/wait
Sun, Jan 25, 3:57 PM
kib committed rGf10b4b6131d4: lib/libsys, lib/libc: export pdrfork(2) (authored by kib).
lib/libsys, lib/libc: export pdrfork(2)
Sun, Jan 25, 3:57 PM
kib committed rG5c2ee618d5ec: sys: add pdrfork(2) (authored by kib).
sys: add pdrfork(2)
Sun, Jan 25, 3:57 PM
kib committed rGd0d4b9b9df2a: sys: add AUE_PDRFORK (authored by kib).
sys: add AUE_PDRFORK
Sun, Jan 25, 3:57 PM
kib committed rG7211cd2cce74: kern/kern_fork.c: define the exterror category for fork (authored by kib).
kern/kern_fork.c: define the exterror category for fork
Sun, Jan 25, 3:57 PM
kib committed rG472c32a83b27: kern/kern_fork/exit.c: organize includes (authored by kib).
kern/kern_fork/exit.c: organize includes
Sun, Jan 25, 3:57 PM
kib committed rGf5acbacb28f9: kern/kern_exit.c: some style (authored by kib).
kern/kern_exit.c: some style
Sun, Jan 25, 3:57 PM
kib closed D54592: Add pdrfork(2) and pdwait(2).
Sun, Jan 25, 3:57 PM
kib committed rG6af3cf27ed00: freebsd32_rusage_out(): bzero the compat32 structure (authored by kib).
freebsd32_rusage_out(): bzero the compat32 structure
Sun, Jan 25, 3:57 PM
kib updated the diff for D54862: Add posix_spawnattr_get/setexecfd_np(3).

Some fixes, mostly to the man page typos.
Also accept that spawnattrs might be NULL.

Sun, Jan 25, 12:26 AM
kib committed rG4f004c7924af: lib/libthr: add pthread_tryjoin(3) test (authored by kib).
lib/libthr: add pthread_tryjoin(3) test
Sun, Jan 25, 12:25 AM
kib committed rGd1ac644ccc43: Document pthread_tryjoin_np(3) (authored by kib).
Document pthread_tryjoin_np(3)
Sun, Jan 25, 12:25 AM
kib committed rGc4522efca63f: libthr/thread/thr_join.c: deduplicate backout_join() helper (authored by kib).
libthr/thread/thr_join.c: deduplicate backout_join() helper
Sun, Jan 25, 12:25 AM
kib committed rGa8891c29d6a0: libthr: add pthread_tryjoin_np() (authored by kib).
libthr: add pthread_tryjoin_np()
Sun, Jan 25, 12:25 AM
kib committed rG21dd894a5e0f: sys: do not allow entering vm_fault() on boot until VM is initialized (authored by kib).
sys: do not allow entering vm_fault() on boot until VM is initialized
Sun, Jan 25, 12:25 AM
kib committed rG854e0e480378: x86 lapic: Dump LVTs from the ddb show lapic command (authored by kib).
x86 lapic: Dump LVTs from the ddb show lapic command
Sun, Jan 25, 12:25 AM
kib committed rG7d327e4ce6e0: x86/local_apic.c: Properly calculate the number of LVT entries (authored by kib).
x86/local_apic.c: Properly calculate the number of LVT entries
Sun, Jan 25, 12:25 AM
kib committed rG9286d8fe2873: x86/local_apic.c: add lapic_maxlvt() helper (authored by kib).
x86/local_apic.c: add lapic_maxlvt() helper
Sun, Jan 25, 12:25 AM
kib committed rG2079e5864f20: x86: mask all LAPIC vectors early, before BSP interrupts are enabled (authored by kib).
x86: mask all LAPIC vectors early, before BSP interrupts are enabled
Sun, Jan 25, 12:25 AM
kib committed rGdfd4c8759325: x88/local_apic.c: for each lvt element, add LVT register index (authored by kib).
x88/local_apic.c: for each lvt element, add LVT register index
Sun, Jan 25, 12:25 AM
kib committed rG7c59e09a0df4: x86/local_apic.c: convert lvts[] and elvts[] arrays to designated initializers (authored by kib).
x86/local_apic.c: convert lvts[] and elvts[] arrays to designated initializers
Sun, Jan 25, 12:25 AM

Yesterday

kib accepted D54591: devstat: Provide 32-bit compatibility.
Sat, Jan 24, 10:37 PM
kib requested review of D54862: Add posix_spawnattr_get/setexecfd_np(3).
Sat, Jan 24, 10:24 PM
kib accepted D54858: kqueue.2: Fix reference to unexisting kevent1().
Sat, Jan 24, 7:34 PM · manpages
kib updated the diff for D54831: Make ULE and 4BSD coexists.

One more #ifdef SMP in sched_ule.c
Add missed sys/sched.h include into powerpc/machdep.c.

Sat, Jan 24, 5:20 PM
kib added inline comments to D54858: kqueue.2: Fix reference to unexisting kevent1().
Sat, Jan 24, 4:21 PM · manpages
kib updated the diff for D54831: Make ULE and 4BSD coexists.

Deduplicate sched stats, sdt probes, and kdtrace hooks helper vars.
At least amd64 GENERIC and LINT build.

Sat, Jan 24, 6:25 AM
kib updated the diff for D54831: Make ULE and 4BSD coexists.

One more #ifdef KTR for 4bsd.

Sat, Jan 24, 2:10 AM
kib added a comment to D54831: Make ULE and 4BSD coexists.
Sat, Jan 24, 2:07 AM
kib updated the diff for D54831: Make ULE and 4BSD coexists.

Take the DEFINE_SHIM() proposal.
Fix inlined strcmp().
Also hopefully fix compilation issues, but I only started tinderbox.

Sat, Jan 24, 2:01 AM
kib committed rG95eec982c37a: vm/swap_pager.c: silence compiler warning (authored by kib).
vm/swap_pager.c: silence compiler warning
Sat, Jan 24, 12:33 AM
kib committed rG2a27aefcefe0: swap_pager_getpages(): some pages from ma[] might be bogus (authored by kib).
swap_pager_getpages(): some pages from ma[] might be bogus
Sat, Jan 24, 12:33 AM
kib committed rG102400e5d07a: swap_pager_getpages(): assert that bp->b_pages[] is accessed in bounds (authored by kib).
swap_pager_getpages(): assert that bp->b_pages[] is accessed in bounds
Sat, Jan 24, 12:33 AM
kib committed rGb3e6c8eb7eba: tuning.7: wording fixes (authored by kib).
tuning.7: wording fixes
Sat, Jan 24, 12:33 AM
kib committed rGa6cc48e22ba7: sendfile: remove calculation of unused bsize (authored by kib).
sendfile: remove calculation of unused bsize
Sat, Jan 24, 12:33 AM
kib committed rG9dbc47d79efe: vm_map_entry_delete(): fix the calculation of swap release (authored by kib).
vm_map_entry_delete(): fix the calculation of swap release
Sat, Jan 24, 12:33 AM
kib committed rG7768be681bed: tuning.7: use the correct word for collapsing (authored by Oliver Pinter <oliver.pntr+freebsd@gmail.com>).
tuning.7: use the correct word for collapsing
Sat, Jan 24, 12:33 AM
kib committed rG10af3b3b71a0: tuning.7: add more explanation about swap (over-)accounting (authored by kib).
tuning.7: add more explanation about swap (over-)accounting
Sat, Jan 24, 12:33 AM
kib committed rGa4123ac9f596: vm_object: remove the charge member (authored by kib).
vm_object: remove the charge member
Sat, Jan 24, 12:33 AM
kib committed rG0ab96c91676d: rfork(2): fix swap accounting in vmspace_unshare() (authored by kib).
rfork(2): fix swap accounting in vmspace_unshare()
Sat, Jan 24, 12:33 AM
kib committed rG1f6db7d73474: swap_release_by_cred*(): give some additional info on panics due to underflow (authored by kib).
swap_release_by_cred*(): give some additional info on panics due to underflow
Sat, Jan 24, 12:33 AM
kib committed rG249939298daf: vm_object_coalesce(): return swap reservation back if overcharged (authored by kib).
vm_object_coalesce(): return swap reservation back if overcharged
Sat, Jan 24, 12:33 AM
kib committed rG1e1727a7d7bd: vm_object_coalesce(): do not account holes twice (authored by kib).
vm_object_coalesce(): do not account holes twice
Sat, Jan 24, 12:33 AM
kib committed rG99fab30f7272: vm_object_coalesce(): simplify common expression (authored by kib).
vm_object_coalesce(): simplify common expression
Sat, Jan 24, 12:32 AM
kib committed rG84cab089ed77: vm_object_coalesce(): remove commented out code (authored by kib).
vm_object_coalesce(): remove commented out code
Sat, Jan 24, 12:32 AM

Fri, Jan 23

kib added a comment to D54850: fusefs: fix a vnode locking bug during VOP_READ.
In D54850#1253849, @kib wrote:

Is this the only place where the update of the cache under the shared vnode lock occurs?
Or even better, can you point me to the single entry point of the cache update code?

I'm auditing now to look for other cases. I think I've found one in fuse_internal_invalidate_inode (which is used by very few real-world FUSE file systems, but has coverage in the test suite).

That said, there is much better strategy to solve the issue than trying to upgrade the lock.
Add one more mutex (or sx, I am not sure about ops that are done for cache update), and lock it around the cache update code if the vnode lock is only share-locked.

I did not coded it myself because I wanted an easy experiment if the exclusive locking would solve the problem. Next, I do not know where the cache update code is.

I could do that. In terms of performance, how does mutex compare to the vnode lock?

Fri, Jan 23, 9:57 PM
kib updated the diff for D54831: Make ULE and 4BSD coexists.

Add function-pointers based workaround for risvc and arm.
Hopefully at least riscv would grow ifuncs in some time frame.

Fri, Jan 23, 9:51 PM
kib added a comment to D54850: fusefs: fix a vnode locking bug during VOP_READ.

Is this the only place where the update of the cache under the shared vnode lock occurs?
Or even better, can you point me to the single entry point of the cache update code?

Fri, Jan 23, 9:46 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.

armv7 and riscv64 are tier 2, breaking them is not permitted. I have an idea for how to make them work though, without being too invasive.

Fri, Jan 23, 8:53 PM
kib accepted D54840: sys: Use __is_aligned and __align_down for some kstack alignment operations.
Fri, Jan 23, 6:50 PM
kib updated the diff for D54831: Make ULE and 4BSD coexists.

Rename sched_instance_name variable to sched_name.

Fri, Jan 23, 6:31 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.
In D54831#1253606, @kib wrote:

I am not sure what do you mean by kern.sched.instance_name, I cannot find such thing.

Indeed, I meant kern.sched.sched_instance_name. Could you rename it to simply kern.sched.name?

Fri, Jan 23, 6:30 PM
kib updated the diff for D54831: Make ULE and 4BSD coexists.

Add sched_instance_select() call to all arches.
Rename the tunable to kern.sched.name.
Automatically fall back to some scheduler if the named one is not found, and there is one.

Fri, Jan 23, 5:28 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.
In D54831#1253559, @kib wrote:

Make kern.sched sysctls working when 4BSD is selected:

I do not see any new change related to that (compared to the previous diff)?

Fri, Jan 23, 5:26 PM
kib added inline comments to D54831: Make ULE and 4BSD coexists.
Fri, Jan 23, 4:37 PM
kib updated the diff for D54831: Make ULE and 4BSD coexists.

Handle all arches for cpu_switch.S.

Fri, Jan 23, 4:17 PM
kib updated the diff for D54831: Make ULE and 4BSD coexists.

Make kern.sched sysctls working when 4BSD is selected:
sysctl kern.sched.ule.topology_spec: allow to run if ULE is not initialized
sched_shim: restore kern.ccpu sysctl

It is apparently should be considered part of the ABI, and is used by
the base top(1).  But do not declare the ccpu variable in headers, it is
needed only by 4bsd. So put the variable definition into sched_shim.c to
make the kernel buildable without SCHED_4BSD.
Fri, Jan 23, 3:20 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.
In D54831#1253408, @kib wrote:

I'd like also that we investigate why the loop on the blocked lock was elided for 4BSD.

Simply because threads are never blocked because there is only one global scheduler lock on 4BSD instead of per-runq lock on ULE. So on ULE you are not guaranteed that the sched_switch() finished with removing the thread from CPU while cpu_switch() already tries to switch to the new context. The blocked state makes this race closed without the need to somehow lock several runqs. On 4BSD it is impossible (global lock).

I well know what it is used for in ULE. Was not sure for 4BSD as it uses the block lock as well. After a check, that is just to release sleepqueues et alter's locks earlier (as ULE also does), and indeed the new selected thread cannot have the block lock.

Fri, Jan 23, 3:19 PM

Thu, Jan 22

kib added inline comments to D54831: Make ULE and 4BSD coexists.
Thu, Jan 22, 10:43 PM
kib updated subscribers of D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.
Thu, Jan 22, 10:40 PM
kib added a comment to D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.
In D54816#1253431, @kib wrote:

So I went ahead and implemented the third (?) approach. IMO it is the only safe option there.

We cannot convert ktrace_mtx to a spinlock?

Thu, Jan 22, 10:40 PM
kib added inline comments to D54831: Make ULE and 4BSD coexists.
Thu, Jan 22, 10:02 PM
kib updated the diff for D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.

Remove comment.
Add __ktrace_used to 'tv' decls,

Thu, Jan 22, 10:00 PM
kib updated the diff for D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.

Upload the right diff.

Thu, Jan 22, 9:53 PM
kib updated the diff for D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.

So I went ahead and implemented the third (?) approach. IMO it is the only safe option there.

Thu, Jan 22, 9:52 PM
kib added a comment to D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.

If you really dislike this approach, I think a workable solution that also works for msleep_spin() is the following.

Thu, Jan 22, 9:29 PM
kib updated the diff for D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.

Actually commit the comment before diffing.

Thu, Jan 22, 9:23 PM
kib added a comment to D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.
In D54816#1253403, @kib wrote:

The issue is that for ktrcsw() we lock the ktrace_mtx mutex while owning the interlock from a subsystem that called msleep().

Would another solution be to modify _sleep() to release the spinlock later, effectively copying what msleep_spin_sbt() does?

I do not quite follow, sorry? We either own the interlock, or we own the spinlock. ktrcsw() cannot be called under spinlock at all.

msleep_spin_sbt() drops the sleepqueue spinlock in order to call ktrcsw(). So, it is not susceptible to the problem fixed by this diff. Can we use the same strategy elsewhere instead of adding a new field to struct thread?

Thu, Jan 22, 9:22 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.
In D54831#1253408, @kib wrote:

I'd like also that we investigate why the loop on the blocked lock was elided for 4BSD.

Simply because threads are never blocked because there is only one global scheduler lock on 4BSD instead of per-runq lock on ULE. So on ULE you are not guaranteed that the sched_switch() finished with removing the thread from CPU while cpu_switch() already tries to switch to the new context. The blocked state makes this race closed without the need to somehow lock several runqs. On 4BSD it is impossible (global lock).

Checking the blocked state on 4BSD would give 4 instructions overhead which I dismiss with prejudice.

Thu, Jan 22, 9:16 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.

I'd like also that we investigate why the loop on the blocked lock was elided for 4BSD.

Thu, Jan 22, 9:15 PM
kib updated the diff for D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.

Rename to ktrace_mtx_unlock(), add explanation.

Thu, Jan 22, 9:11 PM
kib added a comment to D54816: ktrcsw(): should not be called when the thread is owning interlock or on sleepq.

The issue is that for ktrcsw() we lock the ktrace_mtx mutex while owning the interlock from a subsystem that called msleep().

Would another solution be to modify _sleep() to release the spinlock later, effectively copying what msleep_spin_sbt() does?

Thu, Jan 22, 9:11 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.
In D54831#1253386, @kib wrote:

@olce and I are working for the same goal but with different approach. Instead of putting them both in kernel binary, our approach is to make sched_4bsd as a kernel module which overrides sched_ule's weak symbol on boot. This gives us two advantages:

  1. Kernel binary size stays the same (but letting them coexisting won't have significant impact on kernel size so this is not a huge advantage)
  2. We can let users to create third-party scheduler as kernel modules. This way, they can run their own scheduler by just building their kernel module without buildkernel and installworld .

The first step of this approach is D54830 which I opened a few hours ago.

Weak symbols do not work exactly this way generally, and esp. in kernel. Anyway, you would not get what you want without significantly hacking either very early linker or even the loader.
I am slightly curious how far this would lead you.

I think I was trying to tackle that idea without deeper understanding in kernel linker. I'll do more research on this. But at least I want hear opinions on loading scheduler as kernel module.

Thu, Jan 22, 9:08 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.

@olce and I are working for the same goal but with different approach. Instead of putting them both in kernel binary, our approach is to make sched_4bsd as a kernel module which overrides sched_ule's weak symbol on boot. This gives us two advantages:

  1. Kernel binary size stays the same (but letting them coexisting won't have significant impact on kernel size so this is not a huge advantage)
  2. We can let users to create third-party scheduler as kernel modules. This way, they can run their own scheduler by just building their kernel module without buildkernel and installworld .

The first step of this approach is D54830 which I opened a few hours ago.

Thu, Jan 22, 8:32 PM
kib added a comment to D54831: Make ULE and 4BSD coexists.

I only tried to boot into ULE so far.
There are two MD places that need to be handled for each arch, but I only did that for amd64 right now:

  • cpu_switch() made unconditionally wait for blocked thread lock unblock
  • sched_instance_select() must be called before ifuncs are resolved.
Thu, Jan 22, 7:17 PM
kib requested review of D54831: Make ULE and 4BSD coexists.
Thu, Jan 22, 7:13 PM
kib committed rGdfc4186c6dcf: x86 lapic: Dump LVTs from the ddb show lapic command (authored by kib).
x86 lapic: Dump LVTs from the ddb show lapic command
Thu, Jan 22, 7:10 PM
kib committed rG2b1db07bec92: x86: add machine/ifunc.h (authored by kib).
x86: add machine/ifunc.h
Thu, Jan 22, 7:10 PM
kib added a comment to D54820: sendfile(2): document that EINTR never happens on non-blocking socket.

Ok, my reluctance to this documentation change is because such promise, of never returning specific error code, is very hard to fulfill. For instance, on intr NFS mount, VOP_GETATTR() can return EINTR, and so on.

Thu, Jan 22, 4:06 PM
kib accepted D54785: witness: Provide facility to print detailed lock tree.
Thu, Jan 22, 3:49 PM
kib accepted D54825: xdr_string: don't leak strings with xdr_free.
Thu, Jan 22, 2:28 PM
kib accepted D54824: rpc/xdr.h: make xdrproc_t always take two arguments.
Thu, Jan 22, 2:26 PM
kib added a comment to D54824: rpc/xdr.h: make xdrproc_t always take two arguments.

In summary: defined in the comments as a function tWo arguments I believe.

Thu, Jan 22, 2:25 PM