Commit Graph

67285 Commits

Author SHA1 Message Date
Augustin Cavalier
e7af1dd2e0 kernel/vm: Introduce VMCache::CanOvercommit().
Allows the Anonymous caches to report overcommitting status.
2024-12-13 14:25:40 -05:00
Augustin Cavalier
8308c16a5c kernel/vm: Add missing parentheses.
No functional change.
2024-12-13 14:20:48 -05:00
Augustin Cavalier
7aafc79ba4 kernel/debug: Minor style fix in the system_profiler. 2024-12-11 14:17:28 -05:00
Augustin Cavalier
12be2aa0b3 kernel/vm: Fix and reactivate VMAnonymousNoSwapCache::Merge.
It seems this method was never renamed when MergeStore was renamed
to Merge all the way back in hrev27179. However, that wound up
working out, because this method also didn't call the base class
implementation that actually merges the page trees properly, so
it wouldn't have worked anyway.
2024-12-11 14:17:14 -05:00
Augustin Cavalier
f8c3cc3459 kernel/vm: Skip acquiring the available memory lock if there's nothing to unreserve.
This can happen when deleting VMCaches that were overcommitted or
never had any reservation, or caches that had their commitments
merged.
2024-12-11 14:14:30 -05:00
Augustin Cavalier
be88b511d7 kernel/vm: Remove an unneeded and misplaced include.
VMArea.h is already included at the top of the file.
2024-12-11 14:13:36 -05:00
Augustin Cavalier
27e83b8be8 input: Adjust input_pointing_device_subtype enumeration and usages.
Follow input_device_type above: we don't have _TYPE or _SUBTYPE on
the end, but _POINTING in the middle, because these aren't in a global
"subtype" enumeration, but a B_POINTING_DEVICE-specific enumeration.

Also don't bother adding the UNKNOWN type to messages that have no
type; if it's not included, UNKNOWN is implied. Saves a few CPU cycles.

Change-Id: I9088b9fcee63bf001b43febbe1e3ac17eb1792b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8635
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-11 19:11:45 +00:00
Augustin Cavalier
254894210c LinkedLists: Rename MoveFrom method to TakeFrom.
"Move" now sounds like it has 'move' semantics (i.e. replaces this
structure's data with the other structure's data), while MoveFrom()
really had 'move+append' semantics (appends the other list's elements
to this list, and clears the other list.) To make this clearer, it's
here renamed to "TakeFrom".

This should reduce confusion with the other move-related APIs that
are starting to show up in the Haiku tree (e.g. "MoveFrom" in BRegion.)

Change-Id: Ib0a61a9c12fe8812020efd55a2a0818883883e2a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8634
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: X512 X512 <danger_mail@list.ru>
2024-12-11 19:09:25 +00:00
Augustin Cavalier
3fef105fae kernel/vm: Adjust committed sizes even for caches without sources.
This is now necessary after enabling delayed commitments for anonymous
mappings with PROT_NONE.

Change-Id: I33b76f9d9f6a1d560793e523b74e9ac9fd7a4f62
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8676
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-11 06:25:23 +00:00
Augustin Cavalier
3cd8a6719d kernel/vm: Make privately-mapped anonymous regions avoid committing memory too.
This was already the case for non-anonymous regions (i.e. mmap'ed files),
but wasn't the case for anonymous ones (fd < 0). Now it is.
2024-12-10 22:34:16 -05:00
X512
5b2ecc7859 app_server: remove UpdateQueue
- It is a dead code that was not enabled for a long time.

- Asynchrous back to front framebuffer copying breaks update session
logic and introduce flickering artefacts.

Change-Id: Ifefd711e8dcd900443ba976f5efe128744fef2ca
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8617
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-12-10 21:32:33 +00:00
X512
03f77fd7d9 app_server: drop legacy 2D hardware acceleration
- It is not enabled for a long time and is actually a dead code.

- It was tested before that it is actually slower on < 15 year old
  hardware so it have no any benefits. Modern CPUs have no problems
  with simple memory filling/copying operations. More complex
  acceleration operations are not supported in current accelerant driver
  API.

- It breaks double buffering and reintroduce flickering artefacts.

- It is incompatible with antialiased CPU drawing because GPU
  framebuffer memory reading is deadly slow and reading is required for
  alpha blending operation. So rendering buffer must be in CPU memory,
  offscreen GPU buffer can't be used.

- Hardware 2D acceleration for modern hardware is usually implemented
  using generic GPU rendering APIs such as OpenGL or Vulkan.

Change-Id: Ifb93c80cca4fc5f072e3166b29fc63b643ddb437
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8616
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-10 21:32:33 +00:00
Augustin Cavalier
c4a59a7a5f file_systems/QueryParser: Don't try to read the key size of invalid indexes.
Fixes a rare corner case.
2024-12-10 16:28:28 -05:00
Augustin Cavalier
f63a4a17ea kernel/fs: Unlock the unused-vnodes lock before continue'ing.
Otherwise we'll unlock in the wrong order and trigger an "interrupts
disabled" assertion in this case.
2024-12-10 13:53:06 -05:00
Augustin Cavalier
81f187cbd9 stdlib.h: Remove *rand48_r methods.
These were declared in this header on BeOS, so we need to keep
them around for ABI compatibility, but they are nonstandard
and no other C library besides glibc appears to provide them
at all (not even musl, and none of the BSDs.)
2024-12-10 13:15:06 -05:00
Augustin Cavalier
7f7ff2884f freebsd_wlan: Enable -fvisibility=hidden.
Reduces the size of WiFi drivers by a bit (and reduces the number
of symbols the kernel has to resolve within the binaries.)

Tested with realtekwifi, still works.
2024-12-10 13:00:49 -05:00
Andrew Lindesay
cb3ddd18bb HaikuDepot: Faster Open State Change
This will signal the package state change to
"pending" more quickly when the package is
being installed.

Change-Id: Ic0bbb0dbbe938f73348cb184aa1c3b83db90acd5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8588
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Andrew Lindesay <apl@lindesay.co.nz>
2024-12-09 09:56:06 +00:00
Augustin Cavalier
4a87c95e0a kernel/fs: Handle O_RDONLY | O_TRUNC in the VFS rather than filesystems.
The POSIX specification says that the behavior of specifying O_TRUNC
with O_RDONLY is "undefined", but the Linux manpages ominously state
"On many systems the file is actually truncated." I tested this,
and indeed on Linux the file is actually truncated.

This doesn't seem like a very sensible behavior, so in this commit
it's changed to return B_NOT_ALLOWED (EPERM) if those flags are
specified together. The FAT driver already did this, but most other
filesystem drivers just checked write access permissions and
truncated the file anyway; so this is indeed a behavioral change.

Change-Id: If2e76782743ee91d934dc7e0c2f306f37b159a0f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8625
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2024-12-09 01:00:33 +00:00
PulkoMandy
5941862c92 Cortex LoggingConsumer: log more details about media buffers
Change-Id: I24d175ae8a414d10fa6c4f49aa2f86ee9b939c4f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8585
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-12-08 09:36:40 +00:00
Autocomitter
8ada0c0e7c Update translations from Pootle 2024-12-07 08:08:39 +00:00
Augustin Cavalier
6690c6cc72 kernel/vm: Don't allow mapping areas larger than the source cache's size.
And also return an error if the offset of an mmap() request isn't
page-aligned, rather than silently aligning it. libroot already
did this for mmap() itself, so this only affects things that invoke
the operation or syscall directly.

Fixes #19155.

Change-Id: I081dd1492d06f56536c1dbb5d4028345f95c4460
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8622
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-06 22:15:03 +00:00
Augustin Cavalier
ae6629023f tests/kernel/vm: Add mmap_invalid_tests.
Move one test from map_cut_tests, otherwise the other tests are new.
Includes a test for the cause of #19155.

Change-Id: I15abbf11f2c6db7385754825abbcc159414f6fd8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8631
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-06 22:15:03 +00:00
Augustin Cavalier
79ebd4147e BList: Slight code and parameter name cleanup.
* Clarify the fResizeThreshold logic and remove the comment.

 * Rename "count" constructor argument to "blockSize", as this is
   what it actually does.

No functional change intended.

Change-Id: I993bf0e695f47da181e9fb50b9a964edfd4a0adc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8629
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-06 19:52:05 +00:00
Andrew Lindesay
ddd374f0fe HaikuDepot: Implement core info model
Breaks out some of the core data about a
package into a sub-model to later support
immutable models.

Change-Id: Ib75ba24c6848829c835199130fe58b0f2d6ebcde
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8587
Reviewed-by: Andrew Lindesay <apl@lindesay.co.nz>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-12-06 08:09:03 +00:00
Augustin Cavalier
edf7c7749c tests/kernel: Move a bunch of VM-related tests to the "vm" subdirectory.
There's still a number of tests in the root that should be moved
to other subdirectories, but this at least gets the VM-related ones
into a subdirectory (and removes a stale entry in the VM Jamfile.)
2024-12-05 23:25:36 -05:00
Augustin Cavalier
6193a477b8 realtekwifi & net80211: Synchronize with FreeBSD.
As of upstream fcb5e8d0c19ac21515ab3047d39a76b32d835cec.
2024-12-05 23:18:45 -05:00
Augustin Cavalier
cd730cbd7c kernel/vm: Drop an actually obsolete comment.
This was introduced in hrev27179 to refer to the member "merge_swap",
which is now gone. The "busy_writing" field isn't used in Merge().
2024-12-05 17:13:26 -05:00
Augustin Cavalier
5cf7633a39 Revert "kernel/vm: Remove an obsolete comment."
This reverts commit 1db0961121.

It turns out the comment is not obsolete; what it refers to isn't
PAE systems but true 32-bit ones. I'm not sure we should use
64-bit cache offsets even there, but that's a decision for another
time.
2024-12-05 17:05:44 -05:00
Augustin Cavalier
319bd18c13 kernel/vm: Use KERNEL_TOP in place of (KERNEL_BASE + (KERNEL_SIZE - 1)).
No functional change.
2024-12-05 17:05:44 -05:00
Niklas Poslovski
5d5dabc2dd Backgrounds: Accept color drop only if color picker is enabled.
Fixes #19264

Change-Id: I90084ae15de4797e6184860af50128ea75dedebc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8656
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-12-05 20:12:35 +00:00
Augustin Cavalier
2d6c8a8481 kernel/vm: Minor coding style cleanups. 2024-12-04 16:43:12 -05:00
Augustin Cavalier
245133b2c1 kernel/vm: Check for overflows in VMUserAddressSpace::CanResizeArea().
It can happen if a very large size is specified.
2024-12-04 16:42:57 -05:00
Augustin Cavalier
6bf630c684 tests/posix: Add symlink_create_test.
Combines the testcases from #19062 and #18355.
2024-12-04 14:09:41 -05:00
Augustin Cavalier
053116301e DebugAnalyzer: Increase the size of the buffer to print pointer values.
We need at least 19 characters on 64-bit architectures:
2 for "0x", 16 for the pointer, and 1 for the \0. So just
use a round 20.

Fixes cut-off pointer values in the display.
2024-12-04 13:38:14 -05:00
Augustin Cavalier
5434ba8dff kernel/debug: Report dummy names for THREAD_BLOCK_TYPE_OTHER_OBJECT.
So that DebugAnalyzer can display them properly.
2024-12-04 13:37:32 -05:00
Augustin Cavalier
149182f6ac kernel/fs: Don't report the leaf node in vnode_path_to_vnode unless it's last.
That is, if we have a path like "/nonexistent-1/nonexistent-2/file",
we shouldn't report "nonexistent-1" as the "leaf" node, but rather
nothing at all. Otherwise, create_vnode() that expects the result to be a
directory vnode plus a nonexistent file will get confused and try
to create a file "/nonexistent-1" rather than just bailing out.

This fixes #19062. The reproducer in that ticket caused a scenario
much like the above; and since rootfs doesn't support regular files,
it returned "EINVAL" when attempting to create the "/nonexistent" file.
After this change, we get ENOENT as expected.

Change-Id: Ifcaaa858403fb747858800afbf644051bb9913ad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8621
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-04 17:06:59 +00:00
Augustin Cavalier
4c98a54842 kernel/fs: Minor cleanup to vnode_path_to_vnode and related methods.
No functional change intended.

Change-Id: Ie198854ef6bc434db87d362ebc31fd08ab44c176
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8620
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-04 17:06:59 +00:00
Augustin Cavalier
bef7e1c1b1 kernel/device_manager: Adjust assertion in IOBuffer::GetNextVirtualVec.
cookie->mapped_area may be < 0 but not -1 because map_physical_memory_vecs
previously failed.

Fixes #19273.
2024-12-03 15:50:37 -05:00
Augustin Cavalier
23b34b6c0e kernel/fs: Clean up code in synchronous_io.
Minor functional changes: slightly different log message,
error return of GetNextVirtualVec is actually reported properly.
2024-12-03 15:49:53 -05:00
Augustin Cavalier
20f109414c kernel/vm: Write adjacent pages in the page_writer, if possible.
This is an optimization in two ways: first, it allows us to avoid
unlocking the cache or needing the "unreferenced" store-ref acquisition
if we can write the next page in the same cache; and second, the
I/O will be much more tightly combined, as PageWriteTransfer will
be able to merge the iovecs more often and do less I/O (and on
spinning disks, we'll write adjacent regions more often, too.)

Based on some basic logging, this happens very often. I saw adjacent
writes numbers of e.g. 203, 255 (kNumPages), 139, 15, 99, etc. There
were a fair number of 0s, but that case shouldn't add too much overhead
since we bail out very rapidly.

In the case of things like "dd if=/dev/zero of=file ...", this is a
major optimization, since it massively reduces lock contention between
the dd thread and the page_writer thread.

A compile benchmark seems relatively similar, maybe slightly faster.
2024-12-03 13:59:35 -05:00
Augustin Cavalier
487d75717a kernel/disk_device_manager: Invoke base class in KFileDiskDevice::Unset().
Otherwise, the FD won't be closed, and then the underlying vnode
won't ever be released, leading to files whose space can't be reclaimed
without rebooting and running checkfs.
2024-12-03 13:18:07 -05:00
Augustin Cavalier
896f7fdb75 kernel/disk_device_manager: Cleanup code style, fix some minor TODOs. 2024-12-03 12:31:20 -05:00
Jim906
1a98f27639 Tracker: handle case-insensitive move target error
* Do not call entry_cache_add_missing from the FAT driver, because it
  can lead the VFS to believe a filename is missing when it is
  actually present (in a different case).
* Remove CopyFile code that was added to handle a race condition when
  dragging multiple files to a FAT volume.  The race condition only
  occurred in the first place because of the above driver bug.
* Ensure the FAT driver can fail gracefully if dosfs_read_vnode is
  called with an inode number that is not present in the FAT vcache.
  Without any 'missing' entries in the entry cache, there is an
  increased chance that multiple (non-missing) entries representing
  the same file will be added to the entry cache, which can result in
  the VFS calling the FS get_vnode hook on a file after it has been
  unlinked.
* Follows up on https://review.haiku-os.org/c/haiku/+/7623.

Change-Id: I5667119d8149954e0c8a5829617a7d93a6fc7aae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8595
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-03 16:09:11 +00:00
Augustin Cavalier
1fd15efda9 BTimedEventQueue: Use mutex_init to appease GCC2. 2024-12-02 14:06:14 -05:00
Augustin Cavalier
0ffb72029d BTimedEventQueue: Flush events on destruction, other minor cleanup.
* The Be Book specifies that events will be flushed on destruction.
   The previous implementation of this class didn't do that, but
   we ought to. Unless the queued events have attached buffers or
   a cleanup hook, this is a no-op anyway.

 * Use a mutex rather than a BLocker for the allocation lock. This
   saves a semaphore per queue.

 * Put the queue_entry in an anonymous namespace. It shouldn't have
   any global symbols anyway, but it doesn't hurt.
2024-12-02 13:57:03 -05:00
Jérôme Duval
d866277547 virtio_pci: in setup_queue(), only check queue number on v1 devices
* fix #18962
* bus->queue_count wasn't initialized yet so the check could succeed
or not, depending on the init value for memory: on release, 0 mostly,
on nightly, a non-zero value.

Change-Id: Id745932e8171abe3b8b78a3e9b2f2058c9507f7a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8618
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-01 19:32:25 +00:00
Autocomitter
b6190d29d6 Update translations from Pootle 2024-11-30 08:07:48 +00:00
Augustin Cavalier
4055af5143 BTimedEventQueue: Rewrite from scratch, avoiding malloc().
The previous implementation allocated and freed event objects
on every insertion and removal using malloc()/free(). It was also
licensed under a "distributions in binary form must reproduce ...
in the binary" license, which is more restrictive than the MIT license
that we prefer.

So, this is a rewrite from scratch. It uses the standard
DoublyLinkedList<> rather than rolling its own, and manages
a free list of event queue objects rather than hitting malloc()
all the time. It only frees chunks on destruction, though,
but that hopefully won't be an issue anyway.

All tests from the TimedEventQueueTest still pass, and media playback
still works as before.

Change-Id: Ia940b6176f8051ae4823b75acd305ded8783d1e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8594
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-28 17:48:23 +00:00
Oscar Lesta
2d54103521 mount_server: Tweak the scoring values to avoid (some) false positives.
Before this, having partitions with the same fsName, blocksize, and capacity,
was enough to be considered a match for `initialMountRestore` mode.

That is too prone to false positives.

Now we require those three values, plus either deviceName, or volumeName
(or both) to match, before considering a partition as a valid match for
auto-mounting.

Fixes #19253.

Modifications by waddlesplash: put the score in an enum, and use
bitwise operations in checking the score.

Change-Id: Ifae63cd8e51fe5c8a38130130343a7209bff6d0a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8565
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-26 20:35:36 +00:00
Augustin Cavalier
bb1f240594 file_systems: Invert query equation scoring values.
Previously, lower was better, and higher was worse. But really we want
the scores to be based primarily around the index sizes, which can
grow to be very large, so a maximum score is hard to determine.

Instead, start with the index size, and then divide to make it smaller
based on how "useful" the equation terms will be in searching it.

Improves the performance of queries like those in #19080; according
to humdinger's testing, the query with the most expensive term first
went from ~2.0s execution time down to ~0.7s, same as the query with
the least expensive term first.

Change-Id: Id71fa21c95cfe3d8d0019ff356bdf4935446411f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8593
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-26 17:13:29 +00:00