<feed xmlns='http://www.w3.org/2005/Atom'>
<title>netbsd/sys/kern/vfs_vnode.c, branch trunk</title>
<subtitle>NetBSD fork for lockdoc analysis</subtitle>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/'/>
<entry>
<title>kern: Eliminate most __HAVE_ATOMIC_AS_MEMBAR conditionals.</title>
<updated>2023-02-24T11:02:27+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2023-02-24T11:02:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=e9b81bf09faef4f635f647ef2b068ce33dc1f445'/>
<id>e9b81bf09faef4f635f647ef2b068ce33dc1f445</id>
<content type='text'>
I'm leaving in the conditional around the legacy membar_enters
(store-before-load, store-before-store) in kern_mutex.c and in
kern_lock.c because they may still matter: store-before-load barriers
tend to be the most expensive kind, so eliding them is probably
worthwhile on x86.  (It also may not matter; I just don't care to do
measurements right now, and it's a single valid and potentially
justifiable use case in the whole tree.)

However, membar_release/acquire can be mere instruction barriers on
all TSO platforms including x86, so there's no need to go out of our
way with a bad API to conditionalize them.  If the procedure call
overhead is measurable we just could change them to be macros on x86
that expand into __insn_barrier.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I'm leaving in the conditional around the legacy membar_enters
(store-before-load, store-before-store) in kern_mutex.c and in
kern_lock.c because they may still matter: store-before-load barriers
tend to be the most expensive kind, so eliding them is probably
worthwhile on x86.  (It also may not matter; I just don't care to do
measurements right now, and it's a single valid and potentially
justifiable use case in the whole tree.)

However, membar_release/acquire can be mere instruction barriers on
all TSO platforms including x86, so there's no need to go out of our
way with a bad API to conditionalize them.  If the procedure call
overhead is measurable we just could change them to be macros on x86
that expand into __insn_barrier.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html</pre>
</div>
</content>
</entry>
<entry>
<title>_vstate_assert: Use atomic_load/store_relaxed.  Omit membar_enter.</title>
<updated>2023-02-22T21:44:21+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2023-02-22T21:44:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=5078ad531c0efa0c04beab6983dbe1f6226ead91'/>
<id>5078ad531c0efa0c04beab6983dbe1f6226ead91</id>
<content type='text'>
Can't find anything this is supposed to pair with.  Pretty sure this
is just an optimistic unlocked test, not actually reliant on memory
ordering.  But as it is unlocked, it needs to be coordinated with
atomic_load/store_relaxed, not ordinary loads or stores, if for no
other reason than to pacify sanitizers.

No need in vnalloc_marker or vcache_alloc because these still have
exclusive access to the vnode at that point.

XXX Should deduplicate the logic in vstate_assert_change and
vstate_change.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Can't find anything this is supposed to pair with.  Pretty sure this
is just an optimistic unlocked test, not actually reliant on memory
ordering.  But as it is unlocked, it needs to be coordinated with
atomic_load/store_relaxed, not ordinary loads or stores, if for no
other reason than to pacify sanitizers.

No need in vnalloc_marker or vcache_alloc because these still have
exclusive access to the vnode at that point.

XXX Should deduplicate the logic in vstate_assert_change and
vstate_change.</pre>
</div>
</content>
</entry>
<entry>
<title>miscfs/specfs/specdev.h: New home for extern spec_vnodeop_opv_desc.</title>
<updated>2022-10-26T23:40:08+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2022-10-26T23:40:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=cac4b9eb124809a822b6ea61c0ccbdce50db3b74'/>
<id>cac4b9eb124809a822b6ea61c0ccbdce50db3b74</id>
<content type='text'>
Also use it for extern spec_vnodeop_p, which is already there.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also use it for extern spec_vnodeop_p, which is already there.</pre>
</div>
</content>
</entry>
<entry>
<title>miscfs/deadfs/deadfs.h: New home for deadfs-related externs.</title>
<updated>2022-10-26T23:39:43+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2022-10-26T23:39:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=2c1e1b65ab520eafa06eab4626958a73523ca8b3'/>
<id>2c1e1b65ab520eafa06eab4626958a73523ca8b3</id>
<content type='text'>
XXX regen sys/kern/vnode_if.c and the others</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
XXX regen sys/kern/vnode_if.c and the others</pre>
</div>
</content>
</entry>
<entry>
<title>In vcache_reclaim(), post NOTE_REVOKE immediately after changing the</title>
<updated>2022-08-05T05:20:39+00:00</updated>
<author>
<name>thorpej</name>
<email>thorpej@NetBSD.org</email>
</author>
<published>2022-08-05T05:20:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=80c847fb084fa65c7d4e85f583d37db62ed4f75d'/>
<id>80c847fb084fa65c7d4e85f583d37db62ed4f75d</id>
<content type='text'>
vnode state to VS_RECLAIMING, before we actually call VOP_RECLAIM(),
which will release the reference on the lower node of a stacked FS
vnode, which is likely to free the upper node's v_klist backing store.

Acquire the vnode interlock when checking for kevent interest now,
because the vp-&gt;v_klist pointer is now volatile.

PR kern/56950</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
vnode state to VS_RECLAIMING, before we actually call VOP_RECLAIM(),
which will release the reference on the lower node of a stacked FS
vnode, which is likely to free the upper node's v_klist backing store.

Acquire the vnode interlock when checking for kevent interest now,
because the vp-&gt;v_klist pointer is now volatile.

PR kern/56950</pre>
</div>
</content>
</entry>
<entry>
<title>Make kqueue event status for vnodes shareable, and for stacked file systems</title>
<updated>2022-07-18T04:30:30+00:00</updated>
<author>
<name>thorpej</name>
<email>thorpej@NetBSD.org</email>
</author>
<published>2022-07-18T04:30:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=939afc6be598616bc96b8c94b9d95767c289681b'/>
<id>939afc6be598616bc96b8c94b9d95767c289681b</id>
<content type='text'>
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.</pre>
</div>
</content>
</entry>
<entry>
<title>vfs(9): Add XXX comment about unclear membar_enter.</title>
<updated>2022-04-09T23:45:45+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2022-04-09T23:45:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=08dc4e50bba4cdc1136b5f1df5e36a53bb927e07'/>
<id>08dc4e50bba4cdc1136b5f1df5e36a53bb927e07</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>sys: Use membar_release/acquire around reference drop.</title>
<updated>2022-04-09T23:38:31+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2022-04-09T23:38:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=1e11a48f28e95996681facbeddec6f993a79e81f'/>
<id>1e11a48f28e95996681facbeddec6f993a79e81f</id>
<content type='text'>
This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.</pre>
</div>
</content>
</entry>
<entry>
<title>specfs: Remove specnode from hash table in spec_node_revoke.</title>
<updated>2022-03-28T12:37:56+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2022-03-28T12:37:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=4d22eca21f272a1eae7325221859077815b2c6d9'/>
<id>4d22eca21f272a1eae7325221859077815b2c6d9</id>
<content type='text'>
Previously, it was possible for spec_node_lookup_by_dev to handle a
speconde that a concurrent spec_node_destroy is about to remove from
the hash table and then free, as soon as spec_node_lookup_by_dev
releases device_lock.

Now, the ordering is:

1. Remove specnode from hash table in spec_node_revoke.  At this
   point, no _new_ vnode references are possible (other than possibly
   one acquired by vcache_vget under v_interlock), but there may be
   existing ones.

2. Mark vnode reclaimed so vcache_vget will fail.

3. The last vrele (or equivalent logic in vcache_vget) will then free
   the specnode in spec_node_destroy.

This way, _if_ a thread in spec_node_lookup_by_dev finds a specnode
in the hash table under device_lock/v_interlock, _then_ it will not
be freed until the thread completes vcache_vget.

This change requires calling spec_node_revoke unconditionally for
device special nodes, not just for active ones.  Might introduce
slightly more contention on device_lock but not much because we
already have to take it in this path anyway a little later in
spec_node_destroy.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, it was possible for spec_node_lookup_by_dev to handle a
speconde that a concurrent spec_node_destroy is about to remove from
the hash table and then free, as soon as spec_node_lookup_by_dev
releases device_lock.

Now, the ordering is:

1. Remove specnode from hash table in spec_node_revoke.  At this
   point, no _new_ vnode references are possible (other than possibly
   one acquired by vcache_vget under v_interlock), but there may be
   existing ones.

2. Mark vnode reclaimed so vcache_vget will fail.

3. The last vrele (or equivalent logic in vcache_vget) will then free
   the specnode in spec_node_destroy.

This way, _if_ a thread in spec_node_lookup_by_dev finds a specnode
in the hash table under device_lock/v_interlock, _then_ it will not
be freed until the thread completes vcache_vget.

This change requires calling spec_node_revoke unconditionally for
device special nodes, not just for active ones.  Might introduce
slightly more contention on device_lock but not much because we
already have to take it in this path anyway a little later in
spec_node_destroy.</pre>
</div>
</content>
</entry>
<entry>
<title>specfs: Let spec_node_lookup_by_dev wait for reclaim to finish.</title>
<updated>2022-03-28T12:37:46+00:00</updated>
<author>
<name>riastradh</name>
<email>riastradh@NetBSD.org</email>
</author>
<published>2022-03-28T12:37:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.infra.scholz.ruhr/netbsd/commit/?id=ac1ff696fed599d7938cbf6d5851aa9798be27e7'/>
<id>ac1ff696fed599d7938cbf6d5851aa9798be27e7</id>
<content type='text'>
vdevgone relies on this to ensure that if there is a concurrent
revoke in progress, it will wait for that revoke to finish -- that
way, it can guarantee all I/O operations have completed and the
device is closed.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
vdevgone relies on this to ensure that if there is a concurrent
revoke in progress, it will wait for that revoke to finish -- that
way, it can guarantee all I/O operations have completed and the
device is closed.</pre>
</div>
</content>
</entry>
</feed>
