Page MenuHomeFreeBSD

mjg (Mateusz Guzik)
nice guy

Projects

User Details

User Since
Jun 4 2014, 10:38 AM (592 w, 4 d)

Recent Activity

Mon, Oct 6

mjg committed rG0ecbc335daa8: nullfs: fix up build with INVARIANTS after previous (authored by mjg).
nullfs: fix up build with INVARIANTS after previous
Mon, Oct 6, 7:23 PM
mjg committed rG84f981ba57e7: nullfs: shrink null_node to 32 bytes (authored by mjg).
nullfs: shrink null_node to 32 bytes
Mon, Oct 6, 6:23 PM
mjg committed rGe0b571d77364: mtx: rename MTX_CONTESTED to MTX_WAITERS (authored by mjg).
mtx: rename MTX_CONTESTED to MTX_WAITERS
Mon, Oct 6, 2:22 AM

Sun, Oct 5

mjg committed rGb1de02c415de: vfs offset: fix assertion failure in face of racing ffofset and setfl locking (authored by mjg).
vfs offset: fix assertion failure in face of racing ffofset and setfl locking
Sun, Oct 5, 9:22 PM
mjg committed rGf16178e0bba8: vfs foffset: drop weird commentary about offset protection (authored by mjg).
vfs foffset: drop weird commentary about offset protection
Sun, Oct 5, 9:22 PM
mjg closed D52915: fix file_v_unlock.
Sun, Oct 5, 9:22 PM
mjg updated the summary of D52915: fix file_v_unlock.
Sun, Oct 5, 5:25 PM
mjg requested review of D52915: fix file_v_unlock.
Sun, Oct 5, 5:23 PM
mjg committed rGccb600906f15: mtx: retire _mtx_release_lock_quick (authored by mjg).
mtx: retire _mtx_release_lock_quick
Sun, Oct 5, 3:54 PM
mjg committed rGd0a35ec01c31: pipe: consistently use PIPE_LOCK_ASSERT (authored by mjg).
pipe: consistently use PIPE_LOCK_ASSERT
Sun, Oct 5, 3:54 PM

Sat, Oct 4

mjg committed rG6cc493c79d9b: mtx: remove stale commentary about inlined spinlock ops (authored by mjg).
mtx: remove stale commentary about inlined spinlock ops
Sat, Oct 4, 2:23 AM

Fri, Oct 3

mjg closed D52819: nullfs: smr-protected hash lookup and locking.

landed

Fri, Oct 3, 9:14 PM
mjg committed rG249ec85352b5: nullfs: smr-protected hash lookup (authored by mjg).
nullfs: smr-protected hash lookup
Fri, Oct 3, 7:23 PM
mjg committed rG641a58239520: nullfs: avoid the interlock in null_lock with smr (authored by mjg).
nullfs: avoid the interlock in null_lock with smr
Fri, Oct 3, 7:23 PM
mjg committed rG72347d73464c: nullfs: assert the vnode is not doomed in null_hashget_locked (authored by mjg).
nullfs: assert the vnode is not doomed in null_hashget_locked
Fri, Oct 3, 7:22 PM
mjg committed rG94aae0513896: nullfs: remove the vhold/vdrop cycle around unlock (authored by mjg).
nullfs: remove the vhold/vdrop cycle around unlock
Fri, Oct 3, 7:22 PM
mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
  • remove goto labels
Fri, Oct 3, 6:52 PM
mjg added inline comments to D52819: nullfs: smr-protected hash lookup and locking.
Fri, Oct 3, 4:27 PM
mjg updated the test plan for D52819: nullfs: smr-protected hash lookup and locking.
Fri, Oct 3, 2:09 PM
mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
  • sort includes
  • fix a bug found by pho@ in the lock smr patch: after the lock is acquired, doomed handling has to be the same as with the interlock-protected routine
Fri, Oct 3, 2:08 PM

Wed, Oct 1

mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
  • patch up commentary
  • remove a debug tunable
Wed, Oct 1, 2:18 PM
mjg added inline comments to D52819: nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 1:55 PM
mjg added a comment to D52819: nullfs: smr-protected hash lookup and locking.
In D52819#1207028, @kib wrote:

This is not a complete patch, I think? The other bits except smr lock are missing.

Wed, Oct 1, 1:51 PM
mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
  • upload the entire thing
Wed, Oct 1, 1:51 PM
mjg added inline comments to D52819: nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 11:15 AM
mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
  • also drop ref drip around unlock
Wed, Oct 1, 11:15 AM
mjg added inline comments to D52819: nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 10:49 AM
mjg retitled D52819: nullfs: smr-protected hash lookup and locking from nullfs: smr-protected hash lookup to nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 10:45 AM
mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 10:45 AM
mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 10:43 AM
mjg updated the diff for D52819: nullfs: smr-protected hash lookup and locking.
  • doomed asserts
  • cosmetic fixups to null_hashget_locked
  • null_lock using smr
Wed, Oct 1, 10:41 AM
mjg committed rG1bbc898dbf72: zfs: annotate arc_buf_is_shared with __maybe_unused (authored by mjg).
zfs: annotate arc_buf_is_shared with __maybe_unused
Wed, Oct 1, 10:19 AM
mjg updated the summary of D52819: nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 9:28 AM
mjg requested review of D52819: nullfs: smr-protected hash lookup and locking.
Wed, Oct 1, 9:28 AM
mjg committed rG5b63afc09a86: watchdog: ifdef wd_ioctl_patpat on COMPAT_FREEBSD14 (authored by mjg).
watchdog: ifdef wd_ioctl_patpat on COMPAT_FREEBSD14
Wed, Oct 1, 7:42 AM
mjg committed rG4e0997d1d492: zfs: retire zfs_zstd_compress_wrap (authored by mjg).
zfs: retire zfs_zstd_compress_wrap
Wed, Oct 1, 7:12 AM

Tue, Sep 30

mjg added a comment to D52795: ddb show lockedvnods: avoid trap for ufs vnode under construction.

I think this is turning into a bikeshed, so just do what you feel.

Tue, Sep 30, 5:25 PM
mjg added a comment to D52795: ddb show lockedvnods: avoid trap for ufs vnode under construction.

The above may be true and the pointer may be populated depending on when you got the the inode. I would just add something like "->i_din2 is NULL, some information omitted" or compatible.

Tue, Sep 30, 4:36 PM
mjg committed rG2bdc89535a88: amd64: bump sleepq hash size to 2048 (authored by mjg).
amd64: bump sleepq hash size to 2048
Tue, Sep 30, 4:15 PM
mjg added a comment to D52795: ddb show lockedvnods: avoid trap for ufs vnode under construction.

maybe print that the pointer is NULL?

Tue, Sep 30, 11:03 AM

Mon, Sep 29

mjg committed rG6cb542e31bef: iflib: ifdef iflib_simple_transmit and iflib_simple_select_queue on ALTQ (authored by mjg).
iflib: ifdef iflib_simple_transmit and iflib_simple_select_queue on ALTQ
Mon, Sep 29, 3:14 PM

Sun, Sep 28

mjg added a comment to D52757: vfs cache: Add vn_fullpath_jail(), factor out common code.

I don't have an opinion on the functionality, but the implementation looks avoidably slow.

Sun, Sep 28, 6:43 PM

Sat, Sep 27

mjg committed rG5e395c34402d: vfs: stop using SDT_PROBES_ENABLED in inlined ops (authored by mjg).
vfs: stop using SDT_PROBES_ENABLED in inlined ops
Sat, Sep 27, 4:02 AM
mjg committed rG7e4c451c12ae: vfs: retire the VREF macro (authored by mjg).
vfs: retire the VREF macro
Sat, Sep 27, 4:02 AM
mjg committed rG01c8e2e33df8: vfs: retire the NULLVP macro (authored by mjg).
vfs: retire the NULLVP macro
Sat, Sep 27, 4:02 AM
mjg committed rG08f06aa1b4fb: vfs: retire the VCALL macro (authored by mjg).
vfs: retire the VCALL macro
Sat, Sep 27, 4:02 AM
mjg committed rG5c0e5f418d9f: BUF_ISLOCKED.9: drop a reference to lockstatus(9) (authored by mjg).
BUF_ISLOCKED.9: drop a reference to lockstatus(9)
Sat, Sep 27, 4:02 AM

Thu, Sep 25

mjg committed rGa15f2c5cc58f: proc: perform P_CONTROLT check on fork without SESS_LOCK (authored by mjg).
proc: perform P_CONTROLT check on fork without SESS_LOCK
Thu, Sep 25, 11:51 AM

Wed, Sep 24

mjg planned changes to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Wed, Sep 24, 9:49 AM
mjg added inline comments to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Wed, Sep 24, 9:14 AM
mjg committed rG21d42c8d9022: vfs: let the compiler catch unhandled vgetstate values in vget_abort (authored by mjg).
vfs: let the compiler catch unhandled vgetstate values in vget_abort
Wed, Sep 24, 9:02 AM
mjg committed rG185c2c3dab36: vfs: reduce indentation in vput_final (authored by mjg).
vfs: reduce indentation in vput_final
Wed, Sep 24, 8:24 AM
mjg added inline comments to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Wed, Sep 24, 8:11 AM

Tue, Sep 23

mjg updated the diff for D52628: vfs: fix races between vdrop and VOP_UNLOCK.
  • patch up some comments
  • add the missing acq fence
Tue, Sep 23, 8:41 PM

Mon, Sep 22

mjg added inline comments to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Mon, Sep 22, 6:51 PM
mjg added inline comments to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Mon, Sep 22, 5:24 PM
mjg added inline comments to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Mon, Sep 22, 5:23 PM
mjg added inline comments to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Mon, Sep 22, 5:08 PM
mjg added a comment to D52628: vfs: fix races between vdrop and VOP_UNLOCK.

vput et al are the primary consumers of vdrop.

Mon, Sep 22, 5:06 PM
mjg added a comment to D52628: vfs: fix races between vdrop and VOP_UNLOCK.

Huh, so happens vtryrecycle unlocks and then vdrops, so it happens to not run into the problem after all. General remark stands though.

Mon, Sep 22, 4:19 PM
mjg added a comment to D52628: vfs: fix races between vdrop and VOP_UNLOCK.
In D52628#1203128, @mjg wrote:

For a non-doomed vnode new users can pop up and disappear.

You're repeating yourself, and I repeat: Not in a way that is relevant. If I'm wrong, fine, please show me a case that you think is relevant and is not covered by handling this in vput_final(). And, anyway, deferral does not need to occur at all for non-doomed vnode.

Mon, Sep 22, 3:55 PM
mjg added a comment to D52628: vfs: fix races between vdrop and VOP_UNLOCK.

Why not put the defer action into vput_final() (and possibly use the already existing deferred inactive mechanism)?

Mon, Sep 22, 3:14 PM
mjg updated the diff for D52628: vfs: fix races between vdrop and VOP_UNLOCK.
  • make new fields static
  • expand commentary
Mon, Sep 22, 2:37 PM
mjg updated the diff for D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Mon, Sep 22, 2:19 PM
mjg added a comment to D52628: vfs: fix races between vdrop and VOP_UNLOCK.

This is finished, it just has extra parts to trigger defered drop + a printf that it happened. I'll upload a cleaned up variant shortly.

Mon, Sep 22, 2:18 PM
mjg committed rGff6abfec807e: pipe: sort out ino commentary on failed pipe creation (authored by mjg).
pipe: sort out ino commentary on failed pipe creation
Mon, Sep 22, 8:45 AM

Fri, Sep 19

mjg added a comment to D52628: vfs: fix races between vdrop and VOP_UNLOCK.

If your idea boils down to adding some form of lock drain to iput_final, it's not going to work.

Fri, Sep 19, 8:56 PM
mjg added a comment to D52608: vnode: Rework vput() to avoid holding the vnode lock after decrementing.

See the patch I posted in D52628 .

Fri, Sep 19, 8:25 PM
mjg updated the diff for D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Fri, Sep 19, 8:17 PM
mjg requested review of D52628: vfs: fix races between vdrop and VOP_UNLOCK.
Fri, Sep 19, 7:59 PM
mjg added a comment to D52608: vnode: Rework vput() to avoid holding the vnode lock after decrementing.

So I think the patch proposed here is just a minor loss in perf and only fixes some of the problem.

Fri, Sep 19, 5:05 PM
mjg added a comment to D52608: vnode: Rework vput() to avoid holding the vnode lock after decrementing.

Suppose the vnode is doomed, v_usecount is 2, v_holdcnt is 1 and both usecount holders are issuing vput.
Suppose both are read-locking it.

Fri, Sep 19, 5:01 PM
mjg added a comment to D52608: vnode: Rework vput() to avoid holding the vnode lock after decrementing.

So here is the situation as I understand it:

Fri, Sep 19, 1:23 PM
mjg added a comment to D52608: vnode: Rework vput() to avoid holding the vnode lock after decrementing.

note vnodes were not freeable at all and that holding the lock to maintain liveness is probably highly entrenched in the layer

Fri, Sep 19, 1:16 AM

Thu, Sep 18

mjg added a comment to D52245: vnode: Assert that VOP_LOCK succeeds in freevnode().

Maybe I missed something in the previous comments.

Thu, Sep 18, 8:06 PM
mjg added a comment to D52245: vnode: Assert that VOP_LOCK succeeds in freevnode().
In D52245#1201325, @mjg wrote:

Note I proposed a fix to the panic which is orthogonal to the vput change.

So I slept on it. Per my previous remark about possible extra locking *and* not completely taking care of the issue anyway due to vunref, I don't think there is any benefit of this going in (and there is a visible loss)

What about something like the following (ignoring vunref() for a moment)?

if (refcount_release_if_last(&vp->v_usecount))
Thu, Sep 18, 7:46 PM
mjg added a comment to D52245: vnode: Assert that VOP_LOCK succeeds in freevnode().

Note I proposed a fix to the panic which is orthogonal to the vput change.

Thu, Sep 18, 7:05 AM

Wed, Sep 17

mjg committed rGea1652bc01c4: vfs: remove a stale comment about unlock + unref relationship in vput (authored by mjg).
vfs: remove a stale comment about unlock + unref relationship in vput
Wed, Sep 17, 10:44 PM
mjg added a comment to D52245: vnode: Assert that VOP_LOCK succeeds in freevnode().

This boots: https://people.freebsd.org/~mjg/vnode_unlock_unref.diff

Wed, Sep 17, 10:35 PM
mjg added a comment to D52245: vnode: Assert that VOP_LOCK succeeds in freevnode().

The code can go back to doing unlock followed by unref. The crux of the race was a half-constructed vnode hanging out in the hash and being unexpectedly used by someone else.

Wed, Sep 17, 9:09 PM

Sat, Sep 13

mjg added a comment to D51474: vm_fault: try to only sbusy valid page that is not writeable.

fwiw I can confirm offcpu time is gone, instead almost all of it spent contending on pmap pv locks.

Sat, Sep 13, 10:32 AM
mjg committed rG63bd2416ccd9: vfs: denote a bug when dooming vnodes with custom locking primitives (authored by mjg).
vfs: denote a bug when dooming vnodes with custom locking primitives
Sat, Sep 13, 7:17 AM
mjg committed rGb98124e1c937: vfs cache: update commentary, no code changes (authored by mjg).
vfs cache: update commentary, no code changes
Sat, Sep 13, 6:20 AM

Jul 23 2025

mjg added a comment to D24217: amd64 pmap: fine-grained pv list locking.

I also note I have been hogging the few ok zoo machines for way too long. All of it is pretty old now, but flix1 is still very much usable even for this particular work. I'm happy to free up the box provided it will be put into good use. It has some crap set up there for my own tests, but all of that can be rm -rf'ed no problem.

Jul 23 2025, 9:49 AM
mjg added a comment to D24217: amd64 pmap: fine-grained pv list locking.
In D24217#1175350, @kib wrote:

vmpfw means that there are threads trying to fault on the same page. Either the page is not valid, and then the contention is unavoidable, or the page is valid (soft-fault), and then there are two cases: the contending threads faulted at the same virtual address, or not. Do you know which case is the most popular?

Jul 23 2025, 9:42 AM
mjg added a comment to D24217: amd64 pmap: fine-grained pv list locking.

I looked into this in the meantime(tm).

Jul 23 2025, 9:14 AM

Jul 16 2025

mjg committed rG31d1c080ab7b: vfs cache: drop SDT_PROBES_ENABLED usage (authored by mjg).
vfs cache: drop SDT_PROBES_ENABLED usage
Jul 16 2025, 8:52 AM

Mar 28 2025

mjg added a comment to D49562: cred: fix struct credbatch to use long for refcount.

Per my above comment the first crash does not look like it is cred-related -- something is going haywire with socket handling instead.

Mar 28 2025, 11:20 PM
mjg added a comment to D49562: cred: fix struct credbatch to use long for refcount.

I agree this is unlikely to be related to the panic reported in PR, given the first stacktrace I think something is going wrong in the network stack and after that all bets are off. I would probably start with checking what's the crash site code-wise. The 'Mar 7 09:38:18 pf-cam2 kernel: freeing uidinfo: uid = 884, sbsize = 115664' suggests something is not properly torn down.

Mar 28 2025, 10:42 PM
mjg accepted D49562: cred: fix struct credbatch to use long for refcount.
Mar 28 2025, 9:00 PM

Mar 23 2025

mjg added a comment to D49440: copy_file_range: Fix file offset handling.

can you instead sort the files and require the ordering that smaller is addr is locked first? a dedicated routine could do it

Mar 23 2025, 1:34 PM

Mar 19 2025

mjg added a comment to D49412: ifnet: Remove a redundant check for flag IFF_DYING from ifunit_ref().

Looking at if_unlink_ifnet:

Mar 19 2025, 11:41 AM

Mar 18 2025

mjg committed rGd0105578f05f: inet6: add the missing lock acquire to nd6_get_llentry (authored by mjg).
inet6: add the missing lock acquire to nd6_get_llentry
Mar 18 2025, 2:39 PM
mjg committed rG00f1ccf959a6: inet6: add the missing lock acquire to nd6_get_llentry (authored by mjg).
inet6: add the missing lock acquire to nd6_get_llentry
Mar 18 2025, 2:32 PM

Mar 6 2025

mjg committed rG234683726708: devclass: make devclass_alloc_unit use M_NOWAIT (authored by mjg).
devclass: make devclass_alloc_unit use M_NOWAIT
Mar 6 2025, 11:03 AM

Feb 10 2025

mjg committed rGefd368784eeb: mroute: serialize parallel teardown of the same vnet (authored by mjg).
mroute: serialize parallel teardown of the same vnet
Feb 10 2025, 2:48 PM
mjg committed rG0fd31cf69032: mroute: fix a sysctl vs teardown race (authored by mjg).
mroute: fix a sysctl vs teardown race
Feb 10 2025, 2:48 PM
mjg committed rGd6138a65405f: inet6: add the missing lock acquire to nd6_get_llentry (authored by mjg).
inet6: add the missing lock acquire to nd6_get_llentry
Feb 10 2025, 2:32 PM

Sep 14 2024

mjg added a comment to D46619: RLIMIT_PIPE.

keeping some % of reserve for root would be good,, equivalent to _falloc_noinstall

Sep 14 2024, 2:42 PM
mjg added a comment to D46649: pf: merge pf_test() and pf_test6().

this can __assert_unreachable which will in production kernels will tell the compiler the 2 options are the only valid ones

Sep 14 2024, 4:54 AM