#
a387bd1b |
| 26-Jul-2022 |
Dimitry Andric <dim@FreeBSD.org> |
Adjust function definition in vfs_bio.c to avoid clang 15 warnings
With clang 15, the following -Werror warning is produced:
sys/kern/vfs_bio.c:3430:11: error: a function declaration without a
Adjust function definition in vfs_bio.c to avoid clang 15 warnings
With clang 15, the following -Werror warning is produced:
sys/kern/vfs_bio.c:3430:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] buf_daemon() ^ void
This is because buf_daemon() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration.
MFC after: 3 days
show more ...
|
#
c84c5e00 |
| 18-Jul-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
ddb: annotate some commands with DB_CMD_MEMSAFE
This is not completely exhaustive, but covers a large majority of commands in the tree.
Reviewed by: markj Sponsored by: Juniper Networks, Inc. Spons
ddb: annotate some commands with DB_CMD_MEMSAFE
This is not completely exhaustive, but covers a large majority of commands in the tree.
Reviewed by: markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35583
show more ...
|
#
5bd21cbb |
| 22-Jun-2022 |
Chuck Silvers <chs@FreeBSD.org> |
vfs: fix vfs_bio_clrbuf() for PAGE_SIZE > block size
Calculate the desired page valid mask using math that will not overflow the types used.
Sponsored by: Netflix
Reviewed by: mckusick, kib, markj
vfs: fix vfs_bio_clrbuf() for PAGE_SIZE > block size
Calculate the desired page valid mask using math that will not overflow the types used.
Sponsored by: Netflix
Reviewed by: mckusick, kib, markj Differential Revision: https://reviews.freebsd.org/D34837
show more ...
|
Revision tags: release/13.1.0 |
|
#
1fb00c8f |
| 16-Feb-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
buf_alloc(): Stop using LK_NOWAIT, use LK_NOWITNESS
Despite the buffer taken from cache or free list, it still can be locked, due to 'lockless lookup' in getblkx() potentially operating on the freed
buf_alloc(): Stop using LK_NOWAIT, use LK_NOWITNESS
Despite the buffer taken from cache or free list, it still can be locked, due to 'lockless lookup' in getblkx() potentially operating on the freed buffers. The lock is transient, but prevents the use of LK_NOWAIT there for the goal of neutralizing WITNESS.
Just use LK_NOWITNESS.
Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days
show more ...
|
#
5a8fceb3 |
| 22-Feb-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
boottrace: trace annotations for startup and shutdown
Add trace events for execution of SYSINITs (both static and dynamically loaded), and to the various steps in the shutdown/panic/reboot paths.
S
boottrace: trace annotations for startup and shutdown
Add trace events for execution of SYSINITs (both static and dynamically loaded), and to the various steps in the shutdown/panic/reboot paths.
Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #23 Differential Revision: https://reviews.freebsd.org/D30187
show more ...
|
#
c02780b7 |
| 28-Jan-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
Add GB_NOWITNESS flag
It prevents WITNESS from recording the lock order for the buffer lock acquired by getblkx().
Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeB
Add GB_NOWITNESS flag
It prevents WITNESS from recording the lock order for the buffer lock acquired by getblkx().
Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34073
show more ...
|
#
5875b94c |
| 18-Jan-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
buf_alloc(): lock the buffer with LK_NOWAIT
The buffer must not be accessed by any other thread, it is freshly allocated. As such, LK_NOWAIT should be nop but also it prevents recording the order b
buf_alloc(): lock the buffer with LK_NOWAIT
The buffer must not be accessed by any other thread, it is freshly allocated. As such, LK_NOWAIT should be nop but also it prevents recording the order between the buffer lock and any other locks we might own in the call to getnewbuf(). In particular, if we own FFS snap lock, it should avoid triggering false positive warning.
Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34072
show more ...
|
#
531f8cfe |
| 23-Jan-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
Use dedicated lock name for pbufs
Also remove a pointer to array variable, use array address directly.
Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1
Use dedicated lock name for pbufs
Also remove a pointer to array variable, use array address directly.
Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34072
show more ...
|
#
b7ff445f |
| 19-Jan-2022 |
Alexander Motin <mav@FreeBSD.org> |
Reduce bufdaemon/bufspacedaemon shutdown time.
Before this change bufdaemon and bufspacedaemon threads used kthread_shutdown() to stop activity on system shutdown. The problem is that kthread_shutd
Reduce bufdaemon/bufspacedaemon shutdown time.
Before this change bufdaemon and bufspacedaemon threads used kthread_shutdown() to stop activity on system shutdown. The problem is that kthread_shutdown() has no idea about the wait channel and lock used by specific thread to wake them up reliably. As result, up to 9 threads could consume up to 9 seconds to shutdown for no good reason.
This change introduces specific shutdown functions, knowing how to properly wake up specific threads, reducing wait for those threads on shutdown/reboot from average 4 seconds to effectively zero.
MFC after: 2 weeks Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D33936
show more ...
|
#
e76c0108 |
| 16-Jan-2022 |
Alexander Motin <mav@FreeBSD.org> |
Fix inverse sleep logic in buf_daemon().
Before commit 3cec5c77d617 buf_daemon() went to longer 1s sleep if numdirtybuffers <= lodirtybuffers. After that commit new condition !BIT_EMPTY(BUF_DOMAINS
Fix inverse sleep logic in buf_daemon().
Before commit 3cec5c77d617 buf_daemon() went to longer 1s sleep if numdirtybuffers <= lodirtybuffers. After that commit new condition !BIT_EMPTY(BUF_DOMAINS, &bdlodirty) got opposite -- true when one or more more domains is above lodirtybuffers. As result, on freshly booted system with no dirty buffers buf_daemon() wakes up 10 times per second and probably only 1 time per second when there is actual work to do.
MFC after: 1 week Reviewed by: kib, markj Tested by: pho Differential revision: https://reviews.freebsd.org/D33890
show more ...
|
Revision tags: release/12.3.0 |
|
#
a5c2d59e |
| 29-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Expand comment explaining reasons for automatic swapoff on shutdown
Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/
Expand comment explaining reasons for automatic swapoff on shutdown
Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33167
show more ...
|
#
b6f4818a |
| 30-Nov-2021 |
Gordon Bergling <gbe@FreeBSD.org> |
vfs: Fix a typo in a sysctl description
- s/dependecies/dependencies/
MFC after: 3 days
|
#
08bb51f8 |
| 28-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
shutdown: unmount filesystems after swapoff
Swap on file requires operational underlying mount, otherwise swapoff_all() is guaranteed to panic due to the default strategy VOP for reclaimed vnodes.
shutdown: unmount filesystems after swapoff
Swap on file requires operational underlying mount, otherwise swapoff_all() is guaranteed to panic due to the default strategy VOP for reclaimed vnodes.
Reported and tested by: peterj Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33147
show more ...
|
#
8587d752 |
| 17-Oct-2021 |
Wuyang Chung <wy-chung@outlook.com> |
Correct the name of the second parameter of biowait to wmesg
This parameter is passed directly to msleep, and the name of the msleep parameter is wmesg. Make them match.
Pull Request: https://githu
Correct the name of the second parameter of biowait to wmesg
This parameter is passed directly to msleep, and the name of the msleep parameter is wmesg. Make them match.
Pull Request: https://github.com/freebsd/freebsd-src/pull/557
show more ...
|
#
a7b4a54d |
| 01-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
getblk(): do not require devvp vnodes to be locked
Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebs
getblk(): do not require devvp vnodes to be locked
Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32761
show more ...
|
#
dfd704b7 |
| 23-Oct-2021 |
Kirk McKusick <mckusick@FreeBSD.org> |
Allow biodone() to be used as a completion routine.
An ordered series of BIO_READ and BIO_WRITE operations are typically done as:
while (work to do) { setup bp for I/O g_io_request(bp, consume
Allow biodone() to be used as a completion routine.
An ordered series of BIO_READ and BIO_WRITE operations are typically done as:
while (work to do) { setup bp for I/O g_io_request(bp, consumer); biowait(bp); }
Here you need to have biodone() called at the completion of the I/O to set the BIO_DONE flag and awaken the biowait(). The obvious way to do this would be to set bio_done = biodone, but biodone() will only take the desired action if bio_done == NULL. The relevant code at the end of biodone() is:
done = bp->bio_done; if (done == NULL) { mtxp = mtx_pool_find(mtxpool_sleep, bp); mtx_lock(mtxp); bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); } else done(bp);
This code would infinitely recurse if biodone() is specified as the routine to use at completion. So before this change, a wrapper done function had to be written:
static void g_io_done(struct bio *bp) {
bp->bio_done = NULL; biodone(bp); bp->bio_done = g_io_done; }
This commit changes
if (done == NULL)
to
if (done == NULL || done == biodone)
which eliminates the need for the wrapper function.
Reviewed by: kib Sponsored by: Netflix
show more ...
|
#
a4667e09 |
| 20-Oct-2021 |
Mark Johnston <markj@FreeBSD.org> |
Convert vm_page_alloc() callers to use vm_page_alloc_noobj().
Remove page zeroing code from consumers and stop specifying VM_ALLOC_NOOBJ. In a few places, also convert an allocation loop to simply
Convert vm_page_alloc() callers to use vm_page_alloc_noobj().
Remove page zeroing code from consumers and stop specifying VM_ALLOC_NOOBJ. In a few places, also convert an allocation loop to simply use VM_ALLOC_WAITOK.
Similarly, convert vm_page_alloc_domain() callers.
Note that callers are now responsible for assigning the pindex.
Reviewed by: alc, hselasky, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31986
show more ...
|
#
197a4f29 |
| 17-Sep-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
buffer pager: allow get_blksize method to return error
Reported and reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31
buffer pager: allow get_blksize method to return error
Reported and reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31998
show more ...
|
#
89786088 |
| 10-Aug-2021 |
Mark Johnston <markj@FreeBSD.org> |
amd64: Populate the KMSAN shadow maps and integrate with the VM
- During boot, allocate PDP pages for the shadow maps. The region above KERNBASE is currently not shadowed. - Create a dummy shadow
amd64: Populate the KMSAN shadow maps and integrate with the VM
- During boot, allocate PDP pages for the shadow maps. The region above KERNBASE is currently not shadowed. - Create a dummy shadow for the vm page array. For now, this array is not protected by the shadow map to help reduce kernel memory usage. - Grow shadows when growing the kernel map. - Increase the default kernel stack size when KMSAN is enabled. As with KASAN, sanitizer instrumentation appears to create stack frames large enough that the default value is not sufficient. - Disable UMA's use of the direct map when KMSAN is configured. KMSAN cannot validate the direct map. - Disable unmapped I/O when KMSAN configured. - Lower the limit on paging buffers when KMSAN is configured. Each buffer has a static MAXPHYS-sized allocation of KVA, which in turn eats 2*MAXPHYS of space in the shadow map.
Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31295
show more ...
|
#
6faf45b3 |
| 13-Apr-2021 |
Mark Johnston <markj@FreeBSD.org> |
amd64: Implement a KASAN shadow map
The idea behind KASAN is to use a region of memory to track the validity of buffers in the kernel map. This region is the shadow map. The compiler inserts calls
amd64: Implement a KASAN shadow map
The idea behind KASAN is to use a region of memory to track the validity of buffers in the kernel map. This region is the shadow map. The compiler inserts calls to the KASAN runtime for every emitted load and store, and the runtime uses the shadow map to decide whether the access is valid. Various kernel allocators call kasan_mark() to update the shadow map.
Since the shadow map tracks only accesses to the kernel map, accesses to other kernel maps are not validated by KASAN. UMA_MD_SMALL_ALLOC is disabled when KASAN is configured to reduce usage of the direct map. Currently we have no mechanism to completely eliminate uses of the direct map, so KASAN's coverage is not comprehensive.
The shadow map uses one byte per eight bytes in the kernel map. In pmap_bootstrap() we create an initial set of page tables for the kernel and preloaded data.
When pmap_growkernel() is called, we call kasan_shadow_map() to extend the shadow map. kasan_shadow_map() uses pmap_kasan_enter() to allocate memory for the shadow region and map it.
Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29417
show more ...
|
Revision tags: release/13.0.0 |
|
#
369706a6 |
| 25-Feb-2021 |
Mark Johnston <markj@FreeBSD.org> |
buf: Fix the dirtybufthresh check
dirtybufthresh is a watermark, slightly below the high watermark for dirty buffers. When a delayed write is issued, the dirtying thread will start flushing buffers
buf: Fix the dirtybufthresh check
dirtybufthresh is a watermark, slightly below the high watermark for dirty buffers. When a delayed write is issued, the dirtying thread will start flushing buffers if the dirtybufthresh watermark is reached. This helps ensure that the high watermark is not reached, otherwise performance will degrade as clustering and other optimizations are disabled (see buf_dirty_count_severe()).
When the buffer cache was partitioned into "domains", the dirtybufthresh threshold checks were not updated. Fix this.
Reported by: Shrikanth R Kamath <kshrikanth@juniper.net> Reviewed by: rlibby, mckusick, kib, bdrewery Sponsored by: Juniper Networks, Inc., Klara, Inc. Fixes: 3cec5c77d6 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28901
show more ...
|
#
bf0db193 |
| 30-Jan-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
buf SU hooks: track buf_start() calls with B_IOSTARTED flag
and only call buf_complete() if previously started. Some error paths, like CoW failire, might skip buf_start() and do bufdone(), which it
buf SU hooks: track buf_start() calls with B_IOSTARTED flag
and only call buf_complete() if previously started. Some error paths, like CoW failire, might skip buf_start() and do bufdone(), which itself call buf_complete().
Various SU handle_written_XXX() functions check that io was started and incomplete parts of the buffer data reverted before restoring them. This is a useful invariant that B_IO_STARTED on buffer layer allows to keep instead of changing check and panic into check and return.
Reported by: pho Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundations
show more ...
|
#
c926114f |
| 27-Jan-2021 |
Bryan Drewery <bdrewery@FreeBSD.org> |
Fix getblk() with GB_NOCREAT returning false-negatives.
It is possible for a buf to be reassigned between the dirty and clean lists while gbincore_unlocked() looks in each list. Avoid creating a bu
Fix getblk() with GB_NOCREAT returning false-negatives.
It is possible for a buf to be reassigned between the dirty and clean lists while gbincore_unlocked() looks in each list. Avoid creating a buffer in that case and fallback to a locked lookup.
This fixes a regression from r363482.
More discussion on potential improvements to the clean and dirty lists handling is in the review.
Reviewed by: cem, kib, markj, vangyzen, rlibby Reported by: Suraj.Raju at dell.com Submitted by: Suraj.Raju at dell.com, cem, [based on both] MFC after: 2 weeks Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D28375
show more ...
|
#
cd853791 |
| 28-Nov-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.
Make b_pag
Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.
Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value.
Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work.
Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav.
Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225
show more ...
|
Revision tags: release/12.2.0 |
|
#
44ca4575 |
| 21-Oct-2020 |
Brooks Davis <brooks@FreeBSD.org> |
vmapbuf: don't smuggle address or length in buf
Instead, add arguments to vmapbuf. Since this argument is always a pointer use a type of void * and cast to vm_offset_t in vmapbuf. (In CheriBSD we'
vmapbuf: don't smuggle address or length in buf
Instead, add arguments to vmapbuf. Since this argument is always a pointer use a type of void * and cast to vm_offset_t in vmapbuf. (In CheriBSD we've altered vm_fault_quick_hold_pages to take a pointer and check its bounds.)
In no other situtation does b_data contain a user pointer and vmapbuf replaces b_data with the actual mapping.
Suggested by: jhb Reviewed by: imp, jhb Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26784
show more ...
|