Commit Graph

66384 Commits

Author SHA1 Message Date
Augustin Cavalier
0bbef5d79f configure: Remove support for HOST_CC_IS_LEGACY_GCC.
Add an error message if it's detected to be such, and
remove all the build machinery related to it.

Fixes #18935.
2024-07-24 21:33:57 -04:00
Jim906
9e11f4e9a5 FAT: Prevent Tracker deadlock when copying files
* Don't write-lock the node when opening or closing a file unless the
  node is actually being modified.
* Incidentally, move code from dosfs_close to dosfs_free_cookie. This
  is not necessary to avoid this deadlock, but it is more consistent
  with the approach of the BFS driver.
* When dragging and dropping a large file (e.g. 100 MB) in Tracker, it
  is possible for BPoseView::AttributeChanged() to open the file in the
  middle of the operation, which will deadlock with MoveItem() if
  opening involves a write lock.

Change-Id: Ifc430e1e583cacff2eeb7283100417e16e3f1f5b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7881
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-24 20:43:10 +00:00
Augustin Cavalier
872c9528c7 kernel/vm: Remove areas from the areas map all at once if possible.
This way we avoid lock contention if multiple threads are trying
to delete areas at once.

Same benchmark and "before" as previous commit:
real    0m14.522s
user    0m14.194s
sys     0m4.337s

after:
real    0m13.810s
user    0m14.145s
sys     0m4.155s
2024-07-24 16:31:28 -04:00
Augustin Cavalier
08c53ca964 kernel/vm: Use more than one object_cache for the page mappings.
Every time a page is mapped into an area on fault, we have to
allocate a mapping object for it. While the object_cache
does have per-CPU depots, these depots only store a limited
number of items, and once they run out the object_cache's lock
must be acquired.

So, to reduce lock contention on SMP systems, create a number
of object caches corresponding to the nearest power of 2
that is equal or smaller than the count of CPUs. (We already
allocate dozens of object caches for the block allocator
no matter how many CPUs there are, so a few more depending
on CPU count shouldn't impact memory use too much. Besides,
the object_caches are wired into the low_resource system.)

This significantly reduces lock contention on SMP systems.
Same benchmark setup as yesterday (compile mime_db and relink
HaikuDepot, VMware, -j4), before:
real    0m16.981s
user    0m14.357s
sys     0m6.060s

after:
real    0m14.522s
user    0m14.194s
sys     0m4.337s

And the page_mappings object_cache locks went from having 200,000+ waits
and ~14 seconds waiting time (across all threads) down to ~900 (yes,
that's not a typo) and ~0.05s wait time (though these numbers were captured
in conjunction with the following commit.)
2024-07-24 16:31:20 -04:00
Augustin Cavalier
f44ebcb614 kernel/vm: Pre-map only 10MB worth of pages at most.
The same as we do for prefetch. Otherwise very large areas
will spend an inordinate amount of time in premapping,
rather than just letting the fault handler do its job.
2024-07-24 16:00:34 -04:00
Augustin Cavalier
0ccab46493 kernel/fs: Print usage information for "vnode" command with "--help".
The other KDL commands in this file do the same, so this is consistent.
2024-07-24 15:57:58 -04:00
Augustin Cavalier
328d836b1a kernel/riscv64: Remove now-unneeded logging function.
OK'd by X512. The list_page() function in the VM does
basically the same (though it's for KDL only.)
2024-07-24 15:57:22 -04:00
Augustin Cavalier
acc926946c kernel/vm: Check page->accessed as well as page->usage_count in pre_map.
usage_count is set by the page_daemon, and as such isn't often
updated. In order to check whether new or "hot" pages are in-use,
we need to check their "accessed" flag directly.

This is a significant speed improvement, especially in heavily-contended
mapped files (e.g. shared libraries in a compile job.)

Same benchmark (compile the mime_db and relink HaikuDepot):
before (same as previous commit's "after"):
real    0m18.789s
user    0m14.880s
sys     0m8.779s

after:
real    0m16.615s
user    0m13.919s
sys     0m5.972s
2024-07-24 00:34:07 -04:00
Augustin Cavalier
fb594524ff kernel/vm: Skip prefetch if the cache already has many pages in it.
If there are already more pages in the cache then we would be
prefetching, don't even call cache_prefetch_vnode(). This
cuts down on lock contention and avoids having to look up
whether the pages already exist (an operation that can take
hundreds of microseconds if we have thousands of pages.)

Time to rebuild the mime_db and relink HaikuDepot, best of
multiple runs (on VMware with -j4):

before:
real    0m19.005s
user    0m14.820s
sys     0m9.118s

after:
real    0m18.789s
user    0m14.880s
sys     0m8.779s
2024-07-24 00:26:07 -04:00
Augustin Cavalier
4f872a6f75 kernel/vm: Actually initialize all members of the vm_page bitfield.
If we do, the compiler should merge the stores and avoid loading
and masking, saving some instructions.
2024-07-24 00:23:13 -04:00
Augustin Cavalier
002264052d kernel/file_cache: Rename a variable for clarity's sake.
No functional change intended.
2024-07-24 00:17:00 -04:00
Augustin Cavalier
804615d5eb kernel/vm: vm_page::unused was really an unused field.
i.e. not an indicator of whether the page is unused. Rename it
as such and then remove the one usage of it (a KDL pretty-printer.)
2024-07-24 00:16:11 -04:00
Augustin Cavalier
5868d23d10 kernel/user_debugger: Use the timer->hook filed to indicate if the timer is set.
It seems there is presently a race between debugger state teardown
and canceling the profiling timer, which can lead to timers being
double-added in some circumstances (which hangs the system.)

Obviously that should be fixed, but for now adjust things
so that we catch this in an ASSERT.
2024-07-24 00:14:14 -04:00
Augustin Cavalier
6c418101c4 kernel & runtime_loader: Adopt the optimized version of the elf_hash routine.
Taken from FreeBSD but musl has the same. Does improve loading time.

Change-Id: I41c1f37e8948169a50d8989cc465998282fadaf8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7898
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-23 23:24:36 +00:00
Augustin Cavalier
ffc1a5219d runtime_loader: Add support for DT_GNU_HASH.
This is an alternative to DT_HASH (SystemV/SVR4 hash tables.) Notably,
it uses a Bloom filter to allow an entire image to be skipped
at once rather than searching the actual symbol hash.

We don't currently build anything with DT_GNU_HASH support.
You can test this by adding -Wl,--hash-style=both to HAIKU_LINKFLAGS.
(It seems to increase image sizes by not too much: libroot goes
from 1347139 to 1367691 bytes (20.55 KB) in my build.)

Change-Id: I4a91276490fcd136db175833ee48b36e06ceed47
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7855
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-23 23:24:36 +00:00
Augustin Cavalier
90a0982dcb runtime_loader: Refactor find_symbol somewhat.
* Move the symbol testing out into its own method.

 * Check the symbol name after the type (as that's a cheaper check.)

 * Move some functions around to closer to where they are actually used.

Change-Id: I99c25eac6b03b0cb7e5a3edee80b222bc0325d4d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7854
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-23 23:24:36 +00:00
Augustin Cavalier
b02996d1a8 runtime_loader: Drop the first version of the SymbolLookupInfo constructor.
Nothing uses it, and it just allowed for mistakes like the one
corrected in the last commit to go unnoticed.

Change-Id: I5a64b45eb6f1f9abc9f98be14c9ff6d04c2814fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7853
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-23 23:24:36 +00:00
Augustin Cavalier
ac702ffd21 Revert "runtime_loader: allow the ABI version symbol to be local."
This reverts commit 61987fe7a2.

The original commit had a typo in it preventing this logic from
working (the "true" should be after the first ")".) It ultimately
doesn't seem to be needed, and just complicates the ELF lookup logic.

Change-Id: I23df8c86ad61cac4db45af2ae4ab69635a9e4a33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7852
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-23 23:24:36 +00:00
Augustin Cavalier
3d2ea73c7b kernel/fs: Implement readv/writev for sockets.
This is important for datagram sockets as we need to preserve
message boundaries. For stream sockets it's merely an optimization.
2024-07-23 17:28:55 -04:00
Augustin Cavalier
058f45b3c7 kernel/fs: Fix DEBUG build after removal of descriptor->type. 2024-07-23 17:27:15 -04:00
Augustin Cavalier
c76d9ae6fc kernel/fs: Use the new fd_readv/fd_writev hooks in common_vector_io.
And move the file_readv/file_writev implementation to the VFS.
2024-07-23 17:26:56 -04:00
Augustin Cavalier
22b7491d3c kernel/fs: Reorder fd_ops and add readv/writev hooks.
* Put close/free at the beginning since all FDs must implement that.
   (Most of the function declarations inline were already in this order.)

 * Add readv/writev hooks. Not used yet, but this will allow for
   more than just files to implement them. All declarations updated
   to have NULL for the hooks for the moment.
2024-07-23 16:55:30 -04:00
X512
65a86bce72 kernel/fd: use function table to identify file descriptor type
It allows introducing new file descriptor types without editing enumeration every time. Anonymous FDs will be needed for Mesa
OpenGL/Vulkan drivers to reference GPU memory buffers and other driver objects that can be referenced as FDs from userland.

This change breaks private VFS API compatibility.
No behavior changes intended.

Change-Id: Iac109aad420b0b6aae704b38619436e01dcf4969
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7838
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-23 20:23:19 +00:00
Augustin Cavalier
e33e65b36e kernel: Adjust documentation and revert reporting of all image deletions.
This only happens on team exit and exec. In the exec case, we can
just document that this implies all images are removed from the team.
It appears all consumers of the debugger API handle this correctly as-is.
2024-07-23 16:21:56 -04:00
X512
372509626a kernel/riscv64/arch_debug: port from x86 version
Change-Id: I917d7d81c83098d3b42551190338c73f221450d2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7897
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-23 17:29:16 +00:00
Augustin Cavalier
80d5c28e2a kernel/x86: Don't skip the first address when fetching user stack traces.
Let the loop handle the iframe instead of processing it up front,
so that it doesn't call get_next_frame_no_debugger the first time around.

Fixes the profiler skipping the first function when profiling user
space only.
2024-07-23 13:23:13 -04:00
Augustin Cavalier
bda66ab7c7 libroot: Synchronize glibc regex with upstream 2.28. 2024-07-22 19:56:48 -04:00
Augustin Cavalier
d3f63a3e4c libroot: Synchronize glibc regex with upstream 2.20.
More recent versions require more changes to adapt.
2024-07-22 19:56:48 -04:00
Augustin Cavalier
708ea40201 libroot_stubs: Synchronize stubs.
PulkoMandy just manually added getentropy(), this change
uses the generator script to recreate from the current libroot.
2024-07-22 18:09:51 -04:00
Augustin Cavalier
4ce11e24ed libroot_stubs: Update stubs for x86_gcc2. 2024-07-22 17:43:52 -04:00
Andrew Lindesay
363fc60bf3 HaikuDepot: Factor out Filters from Model
Non-functional change to factor the package filters
from the main model for the application.

Change-Id: I58f741c4491baba8afd5dd6e32bb0f7cdf64938f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7896
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-22 16:57:28 +00:00
PulkoMandy
2d24dd2184 Synchronize PowerPC HaikuPortsCross repo definition with actual repository state 2024-07-20 23:30:04 +02:00
PulkoMandy
9d09763865 Create source packages during bootstrap
This used to be the default in haikuporter, but it isn't anymore. This
resulted in source packages (which are needed for bootstrap) not being
generated.
2024-07-20 23:27:50 +02:00
Adrien Destugues
87d1e18fc0 libroot_stubs: missing stubs for getentropy() 2024-07-19 17:33:36 +02:00
Andrew Lindesay
3dbcc10023 HaikuDepot: Unified Rating Star Drawing
The drawing code in the package list view is now
unified with other places where the rating stars are
being displayed.

Change-Id: I6a8fef51a6ddc57d10cd62a98a26a65de9cd91c6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7879
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2024-07-19 12:35:21 +00:00
Augustin Cavalier
d72befae1e kernel/fd: Create the SyscallRestartWrapper before calling common_vector_io.
Otherwise, it seems compiler will optimize the assign operation into
a call of the first constructor, meaning the thread's syscall flag
won't be set properly.

Fixes #18951.
2024-07-18 21:50:19 -04:00
Augustin Cavalier
bc19d91fb6 kernel/user_debugger: Clean up scheduling of flushes a bit.
Instead of doing the checks in profiling_do_sample, we now do them
in profiling_event. This allows some comments to be consolidated
and make the logic clearer (but it should be functionally the same.)

Also add a check that profiling is still happening at the end
of profiling_flush.
2024-07-18 21:25:00 -04:00
Augustin Cavalier
c5a499a74b kernel/timer: Only reset the hardware timer if we canceled the first one.
Otherwise we don't need to reset it.
2024-07-18 21:21:54 -04:00
Augustin Cavalier
6baf6183d0 kernel/user_debugger: Rework profiler flush mechanism.
Instead of taking the sample inside the timer callback
or the flush callback depending, always take it in the timer
callback, for consistency's sake. This should always work
because we try to flush the buffer when it's only 70% full;
in testing I can't recall seeing any dropped ticks.

Also add a flush call in the post_syscall hook, in case
we hit the flush threshhold while profiling in the kernel
and couldn't trigger the flush then.

Seems to significantly reduce "missed" ticks overall,
but there are still wildly inconsistent results and
lots of missing time.

Change-Id: I43a5e9c050a50309329da39f8a2386c3e2b3c0dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7851
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-18 16:40:20 +00:00
Andrew Lindesay
05bd1a31dc HaikuDepot: Resize Shutdown Window
The shutting down window should scale with the
layout manager.

Closes #17916

Change-Id: I3ec86af91d13de9fb7feae338dfcb35c2ae119ca
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7880
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-07-18 15:00:12 +00:00
Andrew Lindesay
2060f156e8 HaikuDepot: UI ScrollView Scaling
Fixes #7844

Change-Id: I70d1e4980bbcc10f68e264d35c5dc77bff981200
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7876
Reviewed-by: nephele nephele <nep-git@packageloss.eu>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-07-18 09:24:49 +00:00
Oscar Lesta
3761b2f420 etc/profile: locale settings might have changed since SetupEnvironment.
Before this, changing the locale settings via Locale preflet required
a reboot in order for the changes to get picked up by programs running
on Terminal.

Fixes: #18734

Change-Id: I149931c511020f9eb881e71f79d1fd6c647477e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7792
Reviewed-by: nephele nephele <nep-git@packageloss.eu>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-07-18 09:23:27 +00:00
Andrew Lindesay
c3cad23617 HaikuDepot: UI Scaling
Fix aspects of HaikuDepot's UI that do not scale when
the font size changes to accommodate a high resolution
monitor.

Change-Id: I105ebfe5a8f501cd7ffc22822438147ba07382a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7844
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-07-17 22:32:57 +00:00
Jérôme Duval
987a1436b3 udis86: remove
switch credits in AboutSystem from udis86 to zydis

Change-Id: I03a7965a272c50714df9726e53c7d4067d8f1925
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7850
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-17 19:11:50 +00:00
Jérôme Duval
34b59fca80 Debugger: switch to zydis for x86 and x86_64
Change-Id: Iec6d21bc989c3d532c175fd78a2339fede3df1dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7849
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-17 19:11:50 +00:00
Jérôme Duval
06b1eff6ec zydis: build static lib
* for GCC2 build with a modern GCC as suggested by waddlesplash
* make the headers compatible with GCC2

Change-Id: Ice74eeddbe10bc8f9cf9ae90baa833a46bb3c676
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7848
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-17 19:11:50 +00:00
Jérôme Duval
cb130a72e8 disasm: switch to zydis on x86/x86_64
Change-Id: I72a006cb217e14228fce0f5e0b8aa8470c1bfba9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7839
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-07-17 19:11:50 +00:00
Jérôme Duval
1003e004e6 Import Zydis 4.1.0
* udis86 isn't updated since 2014. New SIMD opcodes are missing.
Thus replaces udis86 with Zydis, which is actively developed and used in
Webkit, SpiderMonkey. It is under MIT license.
* encoder code is removed

Change-Id: Ieae7e829e186ce7d4a6df640c62561ad220858fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7847
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-17 19:11:50 +00:00
Augustin Cavalier
911f99e2d6 kernel/timer: Rename "last" to "previous".
It points to the previous list item, not the last (final) one.
No functional change intended, but improves code readability.
2024-07-17 13:41:04 -04:00
Augustin Cavalier
2b916f6121 kernel/image: Report image removals on team destruction or exec.
We can't call user_debug_image_deleted with the lock held, so clear
the list and remove all images before unlocking and looping again.
This also means we free() without the lock held, which should
reduce contention.
2024-07-17 13:40:16 -04:00