Page MenuHomeFreeBSD

mjg (Mateusz Guzik)
nice guy

Projects

User Details

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

Recent Activity

Yesterday

mjg closed D21626: vfs: scale foffset_lock.
Sun, May 24, 3:51 AM
mjg committed rS361429: vfs: scale foffset_lock by using atomics instead of serializing on mtx pool.
vfs: scale foffset_lock by using atomics instead of serializing on mtx pool
Sun, May 24, 3:51 AM

Sun, May 10

mjg accepted D24749: Deduplicate fsid comparisons.
Sun, May 10, 8:19 PM

Sat, May 9

mjg added inline comments to D24749: Deduplicate fsid comparisons.
Sat, May 9, 9:16 PM

Thu, May 7

mjg added inline comments to D24749: Deduplicate fsid comparisons.
Thu, May 7, 11:08 PM
mjg added inline comments to D24749: Deduplicate fsid comparisons.
Thu, May 7, 11:07 PM

Fri, May 1

mjg added a comment to D24255: Allow flock() on fifos.

Sorry for late reply, I'll look into it. In general, unless there is a reason not to, we should be feature-compatible with Linux so this (and perhaps more) is on the table.

Fri, May 1, 7:26 PM
mjg added a comment to D9649: ifconfig(8) and route(8) should be able to manage vnet configurations from prison0.

Adding this without plugging the problem lends itself towards introduction of more bugs, for example the new feature can be added to startup scripts and then the aforementioned attack vector is back on the table.

Fri, May 1, 12:50 AM · network

Mon, Apr 27

mjg added a comment to D9649: ifconfig(8) and route(8) should be able to manage vnet configurations from prison0.

It's not about host root but jailed root.

Mon, Apr 27, 5:46 PM · network
mjg requested changes to D9649: ifconfig(8) and route(8) should be able to manage vnet configurations from prison0.

See D12878 .

Mon, Apr 27, 5:10 PM · network
mjg committed rS360374: pwd: unbreak repeated calls to set_rootvnode.
pwd: unbreak repeated calls to set_rootvnode
Mon, Apr 27, 1:54 PM

Apr 17 2020

mjg added a comment to D24445: audit_canon_path_vp: don't panic if cdir == NULL.
diff --git a/sys/security/audit/audit_bsm_klib.c b/sys/security/audit/audit_bsm_klib.c
index 64b7a344a60..c8d602fb692 100644
--- a/sys/security/audit/audit_bsm_klib.c
+++ b/sys/security/audit/audit_bsm_klib.c
@@ -433,10 +433,15 @@ audit_canon_path_vp(struct thread *td, struct vnode *rdir, struct vnode *cdir,
            __func__,  __FILE__, __LINE__);
Apr 17 2020, 12:27 AM

Apr 16 2020

mjg accepted D24445: audit_canon_path_vp: don't panic if cdir == NULL.
Apr 16 2020, 7:16 PM
mjg requested changes to D24445: audit_canon_path_vp: don't panic if cdir == NULL.

I would prefer extending if-else on *path but I'm not going to insist.

Apr 16 2020, 7:16 PM
mjg accepted D24445: audit_canon_path_vp: don't panic if cdir == NULL.
Apr 16 2020, 7:07 PM

Apr 3 2020

mjg accepted D24283: mac_framework: Remove apparently-superfluous sxlock.
Apr 3 2020, 11:52 PM

Mar 30 2020

mjg added a comment to D23874: Make jemalloc(3) default to retain:true..

Maybe there is a difference depending on MALLOC_PRODUCTION? Either way, looks like a net win.

Mar 30 2020, 6:57 PM

Mar 25 2020

mjg added a comment to D23874: Make jemalloc(3) default to retain:true..

anything stopping this from going in?

Mar 25 2020, 12:16 AM

Mar 19 2020

mjg updated the diff for D24007: cred: distribute reference count per thread.
  • add missing lock to proc_set_cred
  • add some comments
Mar 19 2020, 7:39 PM
mjg added inline comments to D24007: cred: distribute reference count per thread.
Mar 19 2020, 3:12 AM
mjg accepted D24120: kern_dup(): Call filecaps_free_prep() in a write section..

The original capsicum code introduced a lot of bzeroing which can probably be eliminated.

Mar 19 2020, 3:07 AM

Mar 11 2020

mjg accepted D24022: fix for NFS mount hang on "mntref" caused by r353150.

pho reported a similar problem some time ago, also with nfs. I think the real fix would fold both statfs and root calls into mount so that the fs can handle it however it sees fit, but that's beyond the scope of this review.

Mar 11 2020, 5:16 AM

Mar 10 2020

mjg added a comment to D24010: Add SMR_LIST_* macros..

Semantics can be agreed upon as follows (this partially repeats itself to reinforce the point):

Mar 10 2020, 2:50 AM
mjg added inline comments to D24010: Add SMR_LIST_* macros..
Mar 10 2020, 2:37 AM
mjg added a comment to D24010: Add SMR_LIST_* macros..
In D24010#527936, @mjg wrote:

But my proposal does not loosen anything in terms of assertions, especially smr. In fact I explicitly noted they should be added.

To your own point, CK is queue.h + maybe some code reordering for smp + barriers in place. SMR would can be literally the same thing + SMR-specific assertions. As proposed, the code differs in how it uses fences and nobody provided a justification for said difference.

The effects of these fences leak in to consumers. So the semantics and guarantees of these macros need to be well understood and documented. The main purpose of the review is to nail down exactly what those semantics are.

Mar 10 2020, 2:32 AM
mjg added inline comments to D24010: Add SMR_LIST_* macros..
Mar 10 2020, 2:07 AM
mjg added a comment to D24010: Add SMR_LIST_* macros..

But my proposal does not loosen anything in terms of assertions, especially smr. In fact I explicitly noted they should be added.

Mar 10 2020, 1:03 AM
mjg updated the diff for D24007: cred: distribute reference count per thread.
  • introduce td_realucred. this fixes a bug against code which temporarily swaps td_ucred with something else
Mar 10 2020, 12:57 AM
mjg added a comment to D24010: Add SMR_LIST_* macros..
In D24010#527929, @mjg wrote:

Well that puts CK itself in a rather peculiar spot, what are the expectations of current CK users?

What do you mean? They can continue using CK unless they are converted to use the SMR KPIs. I think the existing code would benefit from some auditing and annotation to indicate exactly which accesses are protected by a given net epoch section.

Mar 10 2020, 12:50 AM
mjg added a comment to D24010: Add SMR_LIST_* macros..

Well that puts CK itself in a rather peculiar spot, what are the expectations of current CK users? Perhaps this would make an argument for replacing internal CK atomics with FreeBSD ones.

Mar 10 2020, 12:07 AM

Mar 9 2020

mjg added a comment to D24010: Add SMR_LIST_* macros..

CK_* macros are basically queue.sh + augmentation for SMP. They also happen to be a known quantity so to speak and preferably smr would just wrap them and add smr-specific asserts. I don't know if this will pose any problems due to type difference. Should wrapping not work out I think the most pragmatic take would be to steal said macros, s/CK/SMR/ and point at the original stating this renames and adds smr specific stuff but is otherwise equivalent.

Mar 9 2020, 11:52 PM
mjg abandoned D22811: Provide a wrapper structure around ucred.

Idea implemented in D24007

Mar 9 2020, 8:37 PM
mjg created D24007: cred: distribute reference count per thread.
Mar 9 2020, 8:35 PM
mjg added a comment to D22811: Provide a wrapper structure around ucred.

So I have a better idea which expands on this. Key insight is that if needed we can transfer the count to the "real" reference count in cred and there are few well defined places which affect td_ucred and p_ucred. Thus we can manage the counter per-thread and transfer it out to the actual struct only if we are changing creds to something else.

Mar 9 2020, 9:39 AM

Mar 8 2020

mjg committed rS358734: fd: use smr for managing struct pwd.
fd: use smr for managing struct pwd
Mar 8 2020, 12:23 AM
mjg closed D23889: fd: use SMR for managing struct pwd.
Mar 8 2020, 12:23 AM
mjg committed rS358733: seqc: tidy up.
seqc: tidy up
Mar 8 2020, 12:23 AM

Mar 7 2020

mjg added a comment to D23913: vfs: introduce basic smr-protected path lookup.

Tested by pho. He ran into a zfs hang which seems unrelated https://people.freebsd.org/~pho/stress/log/mjguzik026.txt (threads stuck waiting on i/o completion while the thread which should deliver it just sleeps in its main loop)

Mar 7 2020, 9:45 PM
mjg added inline comments to D23889: fd: use SMR for managing struct pwd.
Mar 7 2020, 9:43 PM
mjg updated the diff for D23889: fd: use SMR for managing struct pwd.
  • rebase
Mar 7 2020, 2:09 AM

Mar 6 2020

mjg abandoned D23912: smr: move accessors to sys/_smr.h.

D23988

Mar 6 2020, 6:04 PM
mjg accepted D23988: Move SMR pointer type definition and access macros to smr_types.h..
In D23988#527323, @mjg wrote:

Can you please add:

/*
 * Special case to handle headers which are partially shared with userspace.
 */
#define smr_kvm_load(p) ({                                              \
        (__typeof((p)->__ptr))atomic_load_ptr((uintptr_t *)&(p)->__ptr); \
})

or an equivalent. see the D23889 review for the use case.

Ok. Not sure why it needs to be an atomic load.

Mar 6 2020, 6:03 PM
mjg added a comment to D23988: Move SMR pointer type definition and access macros to smr_types.h..

Can you please add:

Mar 6 2020, 5:18 PM
mjg added inline comments to D23913: vfs: introduce basic smr-protected path lookup.
Mar 6 2020, 8:03 AM
mjg updated the diff for D23915: [WIP] vfs: fully smr-protected path lookup.
  • rebase on top of updated D23913
  • rename vfs_seqc to vn_seqc
  • add back tmpfs port
Mar 6 2020, 7:40 AM
mjg retitled D23913: vfs: introduce basic smr-protected path lookup from vfs: introduce smr-protected path lookup to vfs: introduce basic smr-protected path lookup.
Mar 6 2020, 7:33 AM
mjg updated the diff for D23913: vfs: introduce basic smr-protected path lookup.
  • hide vfs_smr behind macros
  • pretty print hold count flags
Mar 6 2020, 7:32 AM
mjg added a comment to D23915: [WIP] vfs: fully smr-protected path lookup.

that's fair, I'll rename. While here the question is if this should be "smr lookup" instead of "fast path lookup". Then in particular the mount point flag would be MNTK_SMRLOOKUP and so on.

Mar 6 2020, 6:35 AM
mjg updated the diff for D23915: [WIP] vfs: fully smr-protected path lookup.
  • convert some inlines to macros to get better assertion output
  • hide vfs_smr access behind dedicated vfs_* macros
  • assert smr in fplookup pre/post routines
  • misc comment fixes
Mar 6 2020, 6:27 AM

Mar 5 2020

mjg added inline comments to D23889: fd: use SMR for managing struct pwd.
Mar 5 2020, 8:49 PM
mjg updated the diff for D23889: fd: use SMR for managing struct pwd.
  • address feedback
Mar 5 2020, 8:35 PM
mjg added inline comments to D23889: fd: use SMR for managing struct pwd.
Mar 5 2020, 8:07 PM
mjg updated the diff for D23889: fd: use SMR for managing struct pwd.
  • rename loader_fs_mounted
  • add smr_kvm_load, will be committed separately
Mar 5 2020, 8:05 PM
mjg updated the diff for D23917: vfs: add support for WANTPARENT and LOCKPARENT to fast path lookup.
  • rebase
Mar 5 2020, 7:27 AM
mjg updated the diff for D23916: vfs: add support for !LOCKLEAF to fast path lookup.
  • rebase
Mar 5 2020, 7:26 AM
mjg updated the diff for D23915: [WIP] vfs: fully smr-protected path lookup.
  • assorted
Mar 5 2020, 7:26 AM
mjg updated the diff for D23917: vfs: add support for WANTPARENT and LOCKPARENT to fast path lookup.
  • rebase
Mar 5 2020, 3:44 AM
mjg updated the diff for D23915: [WIP] vfs: fully smr-protected path lookup.
  • assorted fixups
Mar 5 2020, 3:42 AM

Mar 4 2020

mjg added a comment to D23964: pipe: reduce atime precision.

Well I claimed the change only affects pipes for which it's not a problem and it avoids touching anything else. I also noted this matches Linux precision for pipe timestamps.

Mar 4 2020, 11:31 PM
mjg added a comment to D23964: pipe: reduce atime precision.
In D23964#526760, @kib wrote:

Wouldn't other vfs_timestamp() calls on similar systems have similar issues, e.g. on tmpfs or even on ufs with data blocks cached ?
Why wouldn't you simply change default vfs.timestamp_precision when virtualized ? Then user has the full control and can fix this stuff if he wants better precision.

Mar 4 2020, 11:03 PM
mjg added a comment to D23964: pipe: reduce atime precision.

This indeed covers all pipes, it's trivial to make it switchable on PIPE_NAMED.

Mar 4 2020, 10:51 PM
mjg created D23964: pipe: reduce atime precision.
Mar 4 2020, 10:12 PM
mjg committed rS358634: execve: use LOCKSHARED when looking up the interpreter.
execve: use LOCKSHARED when looking up the interpreter
Mar 4 2020, 7:53 PM
mjg closed D23956: execve: use LOCKSHARED when looking up the interpreter.
Mar 4 2020, 7:53 PM
mjg closed D23955: nullfs: don't pre lock exclusive in nullfs_root.
Mar 4 2020, 7:52 PM
mjg committed rS358633: nullfs: don't pre lock exclusive in nullfs_root.
nullfs: don't pre lock exclusive in nullfs_root
Mar 4 2020, 7:52 PM
mjg created D23956: execve: use LOCKSHARED when looking up the interpreter.
Mar 4 2020, 3:59 PM
mjg created D23955: nullfs: don't pre lock exclusive in nullfs_root.
Mar 4 2020, 3:43 PM
mjg updated the diff for D23917: vfs: add support for WANTPARENT and LOCKPARENT to fast path lookup.
  • rebase
Mar 4 2020, 12:10 AM
mjg updated the diff for D23916: vfs: add support for !LOCKLEAF to fast path lookup.
  • rebase
Mar 4 2020, 12:10 AM
mjg updated the diff for D23915: [WIP] vfs: fully smr-protected path lookup.
  • assorted bugfixes and cleanups
Mar 4 2020, 12:08 AM

Mar 3 2020

mjg added a comment to D23937: amd64 atomics: guard flag output operand use with feature test.

I think this is too much of an uglifier. Given this and the fact that the change is -CURRENT only (i.e., not going to be MFCed) I think looking out for older compilers is not worth it. I don't see a clear fix modulo copy-pasting the current routines and ifdefing around them.

Mar 3 2020, 7:29 AM

Mar 2 2020

mjg updated the summary of D23917: vfs: add support for WANTPARENT and LOCKPARENT to fast path lookup.
Mar 2 2020, 6:00 AM
mjg created D23917: vfs: add support for WANTPARENT and LOCKPARENT to fast path lookup.
Mar 2 2020, 5:59 AM
mjg created D23916: vfs: add support for !LOCKLEAF to fast path lookup.
Mar 2 2020, 5:57 AM
mjg updated the diff for D23915: [WIP] vfs: fully smr-protected path lookup.
  • fix fixups
  • handle SAVENAME
Mar 2 2020, 5:54 AM
mjg updated the summary of D23915: [WIP] vfs: fully smr-protected path lookup.
Mar 2 2020, 2:51 AM
mjg added inline comments to D23915: [WIP] vfs: fully smr-protected path lookup.
Mar 2 2020, 2:42 AM
mjg updated the summary of D23915: [WIP] vfs: fully smr-protected path lookup.
Mar 2 2020, 2:37 AM
mjg updated the summary of D23915: [WIP] vfs: fully smr-protected path lookup.
Mar 2 2020, 2:36 AM
mjg updated the summary of D23915: [WIP] vfs: fully smr-protected path lookup.
Mar 2 2020, 2:34 AM
mjg created D23915: [WIP] vfs: fully smr-protected path lookup.
Mar 2 2020, 2:33 AM

Mar 1 2020

mjg updated the summary of D23913: vfs: introduce basic smr-protected path lookup.
Mar 1 2020, 11:56 PM
mjg created D23913: vfs: introduce basic smr-protected path lookup.
Mar 1 2020, 11:55 PM
mjg updated the diff for D23889: fd: use SMR for managing struct pwd.
  • use smr accessors. libprocstat will be patched later.
Mar 1 2020, 11:45 PM
mjg created D23912: smr: move accessors to sys/_smr.h.
Mar 1 2020, 11:44 PM
mjg closed D23885: (pwd 3/3) vfs: stop taking additional refs on root vnode during lookup.
Mar 1 2020, 9:54 PM
mjg committed rS358504: vfs: stop taking additional refs on root vnode during lookup.
vfs: stop taking additional refs on root vnode during lookup
Mar 1 2020, 9:54 PM
mjg committed rS358503: fd: move vnodes out of filedesc into a dedicated structure.
fd: move vnodes out of filedesc into a dedicated structure
Mar 1 2020, 9:54 PM
mjg closed D23884: (pwd 2/3) fd: move vnodes out of filedesc into a dedicated structure.
Mar 1 2020, 9:54 PM
mjg committed rS358502: fd: make fgetvp_rights work without the filedesc lock.
fd: make fgetvp_rights work without the filedesc lock
Mar 1 2020, 9:50 PM
mjg closed D23883: (pwd 1/3) fd: make fgetvp_rights work without the filedesc lock.
Mar 1 2020, 9:50 PM
mjg closed D23902: vm: add debug to uma_zone_set_smr.
Mar 1 2020, 9:49 PM
mjg committed rS358501: vm: add debug to uma_zone_set_smr.
vm: add debug to uma_zone_set_smr
Mar 1 2020, 9:49 PM

Feb 29 2020

mjg created D23902: vm: add debug to uma_zone_set_smr.
Feb 29 2020, 9:26 PM
mjg added inline comments to D23661: Implement a translation from FreeBSD atomic API to gcc intrinsics.
Feb 29 2020, 7:49 PM
mjg added a comment to D23661: Implement a translation from FreeBSD atomic API to gcc intrinsics.
In D23661#521387, @mjg wrote:

I think it's a fair worry that mixing hand-rolled atomics with compiler intrinsics may lead to trouble, but it's not hard to remedy.

Note the 2 mentioned missing testandclear and readandclear can be implemented without significant difficulty (the latter is a oneliner, the former worst case can be a cmpset loop. I grepped only 2 users.)

atomic_testandset/atomic_testandclear could be implemented with __atomic_fetch_or/__atomic_fetch_and, but we'd have to check that the intrinsics generate no worse code (currently we use bts/btr). We have more planned uses of these but were waiting on generic implementations of long variants in D22963 (which indeed uses a cmpset loop).

Feb 29 2020, 7:49 PM
mjg added inline comments to D23661: Implement a translation from FreeBSD atomic API to gcc intrinsics.
Feb 29 2020, 4:16 PM
mjg added a comment to D23869: amd64 atomic.h: minor codegen optimization in flag access.

How does this compare to using the __atomic compiler builtins?

I've changed CheriBSD RISCV to use them (https://github.com/CTSRD-CHERI/cheribsd/blob/master/sys/riscv/include/atomic.h) and am considering submitting a patch to use them for all architectures.

Feb 29 2020, 4:03 PM
mjg created D23889: fd: use SMR for managing struct pwd.
Feb 29 2020, 8:29 AM