67492 Commits

Author SHA1 Message Date
John Scipione
13d645a0fe Tracker: Set read-only low color on ColumnResize()
Change-Id: I6344d7e3e6363da068b8b5ede818c01070c7484c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8998
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58654
2025-02-18 21:13:51 +00:00
John Scipione
046f27c114 Tracker: Prevent Add-ons from being rebuilt too fast, fixes #19426
Change-Id: I016aa63979c9e4b3a28d486538e98df8cd2e2fa9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9007
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58653
2025-02-18 21:13:40 +00:00
Augustin Cavalier
58436dc467 kernel/x86: Handle overflows in apic_timer_set_hardware_timer.
This is relatively harmless in all cases except where the lower 32 bits
are all zeroes, as in that case we would never get a timer interrupt.
In all other cases we would just time out too soon, and the timer
interrupt handler would reschedule.

We need to add clock divisor selection to this module so that we can
be sure that at least reasonably-sized timeouts (a few seconds, e.g.)
will not overflow 32 bits, though.

Change-Id: I62c829aa740bbd611aab788854d722cfa659a0d8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9001
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58652
2025-02-18 21:04:59 +00:00
Augustin Cavalier
4edec1770c kernel/x86: Use APIC timer frequency from hypervisor CPUID leaf, if present.
It is on VMware at least, and is faster and more accurate than measuring.

Change-Id: I42cd16869ca8531bb9710b148609d8218ff870e8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9000
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-02-18 21:04:59 +00:00
Augustin Cavalier
3d840c4289 kernel/x86: Determine the APIC frequency in the kernel instead of the bootloader.
We use the TSC to measure the APIC frequency, but the TSC frequency
is only fully initialized in the kernel (where it's read from CPUID
on recent hardware).

Furthermore, on some more recent systems, it seems there may only be
X2APIC and no MMIO APIC timer at all, and the bootloader does not
handle that case.

The method in the kernel uses spin() instead of a fixed instruction
count as well as system_time_nsecs() and a double for (hopefully)
more accurate calibration.

At least on VMware, this method seems more accurate: the APIC frequency
read from the hypervisor CPUID leaf is 66,000,000; the old method in
in the bootloader yielded values like "65,801,075" and "65,106,382",
while the new one yields values like "65,963,920" and "65,962,580"
(those pairs of values are from two consecutive boots.)

The difference was sometimes similar (but smaller as a percentage) in
QEMU with software emulation: e.g. "993,218,085" vs. "992,965,761". But
sometimes it wasn't: e.g "991,619,585" vs. "993,689,669". (QEMU in
software mode doesn't report a frequency via hypervisor CPUID leaf.)

Change-Id: I4fb8535d1d984f13867e2f84e7dfad1ceed42c13
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8999
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-02-18 21:04:59 +00:00
Augustin Cavalier
b801f14f55 pthread: Avoid syscalls in cond_signal if possible.
* If WAITING is not set, we don't need to call unblock().

 * When exiting wait() and there are no more waiters, zero out
   the lock entirely.

Helps with #18216 a bit.
hrev58651
2025-02-18 15:46:36 -05:00
Augustin Cavalier
e63683b2fb kernel/debug: Acquire the output mutex in the syslog sender and repeats checker.
This way we are less likely to encounter "Failed to acquire ... for
a long time", especially when onscreen debug output is enabled.

In the pending repeats checker, we wait at most 100ms to acquire the lock,
since this is run on the "kernel daemon" thread which we don't want
to block for too long.
hrev58650
2025-02-17 15:48:29 -05:00
Augustin Cavalier
05a7e7ba63 libroot/malloc: Avoid memset() of newly mapped memory in OpenBSD malloc.
Saves some time especially on large heap allocations.
hrev58649
2025-02-17 11:45:10 -05:00
Krutarth Patel
c8252422b8 Adding device node tree image to Haiku documentation
In the device driver architecture documentation there is a
TODO for adding an image representation of the device node
tree in Haiku.
This patch adds a .svg image for the same, removing the TODO
line.

Change-Id: If5d1e3ee5abe7d6e84245c837b5cb2f1f0cb670a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8983
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: nephele nephele <nep-git@packageloss.eu>
hrev58648
2025-02-16 21:17:56 +00:00
Augustin Cavalier
07f87734c5 BColumnListView: Don't invalidate if the row is below the visible rect.
Another significant invalidations optimization.
hrev58647
2025-02-15 21:49:31 -05:00
Augustin Cavalier
6f0caabcf7 HaikuDepot: Re-invalidate and re-derive labels in ItemCountView sporadically.
Instead of unconditionally calling _DeriveLabel() and Invalidate()
every time (both expensive operations), use a bool to track whether
we've already invalidated, and derive the label in Draw() if it
was set.

Significantly decreases the invalidations done on full-list rebuilds.
hrev58646
2025-02-15 21:22:55 -05:00
Augustin Cavalier
341d251a45 BScrollBar: Avoid unnecessary invalidations when changing properties.
* _UpdateThumbFrame() calls Invalidate() already, don't call it again
   in SetRange unnecessarily.

 * If the new and old thumb frames are the same, skip invalidation.

Saves a lot of Invalidate() calls in HaikuDepot on building the
"all packages" list especially.
2025-02-15 21:12:30 -05:00
Augustin Cavalier
fbb27923df HaikuDepot: Use more optimal string operations in searching.
* package->Name() is always lowercase, don't bother using lowercase
   operations on it.

 * Use IFindFirst rather than transforming the string; this uses
   strcasestr internally which operates per-character.

Loosely based on a patch by oco in #19421.
2025-02-15 21:10:00 -05:00
Autocomitter
ab36abde53 Update translations from Pootle hrev58645 2025-02-15 08:07:47 +00:00
Jérôme Duval
64a0bc243c pthread_key: when calling destructors, iterates over keys again
when a non-null value is found, up to PTHREAD_DESTRUCTOR_ITERATIONS (4).
* fixes LLVM unit test SanitizerCommon.PthreadDestructorIterations.
Change-Id: I1f9f4d3e8723261326e6e22b0f0d23907dccb59f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8979
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58644
2025-02-14 18:27:12 +00:00
Augustin Cavalier
97a87f98c6 BFS: Avoid putting and re-getting the same block again in CachedBlock.
This case happens now and again, including a few dozen times in the
bootloader, hundreds of times on boot, and thousands of times
when running "git status" on larger repositories.

It reduces block_cache contention in "git status buildtools" specifically
from ~10m1s wait time to ~9m13s, and overall time from ~36.2s to ~33.5s
(in a 4-core VM.)
hrev58643
2025-02-14 13:23:14 -05:00
Augustin Cavalier
15acd461ea kernel/vm: Don't use VMArea before NULL-checking it.
Fixes #19417.
hrev58642
2025-02-14 09:17:22 -05:00
Augustin Cavalier
a75fe7d4fd kernel/vm: Handle "less" in FindClosestArea correctly when encountering reserved areas.
This only matters when the area exactly at the address is a reserved one,
which probably does not happen so often (this case is only used from
AreaRangeIterator at the moment.)
2025-02-14 09:13:38 -05:00
Jérôme Duval
74b5b25f77 virtio_pci: accept any pci revision for modern devices
as in the specification.

Change-Id: I74d667daea386d3189095542d8f515fc3711a910
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8978
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58641
2025-02-14 12:59:38 +00:00
Jérôme Duval
12b22e8e48 strace: mapping type handler for _kern_map_file()
Change-Id: I1f315c285668221fb9ff15165c81dfcd753d7df8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8977
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-02-14 12:59:38 +00:00
Autocomitter
083e763302 Update translations from Pootle hrev58640 2025-02-14 07:15:20 +00:00
Augustin Cavalier
19f1423287 libroot/os: Re-enable "was not actually locked!" assertion.
It was disabled because hoard2 triggered it far too often.
But now that we're using OpenBSD malloc with different glue,
this isn't an issue anymore.

Closes #18451.

Change-Id: I9a3b1190edbbe0ae3cedfe4df2993441d1f2d629
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8975
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>
hrev58639
2025-02-13 22:43:57 +00:00
Augustin Cavalier
9cd1e917ef libroot/posix: Enable OpenBSD malloc by default.
jam HaikuDepot with nothing to do, best of many runs:

hoard2
real    0m3.519s
user    0m3.348s
sys     0m0.159s

openbsd
real    0m3.481s
user    0m3.327s
sys     0m0.147s

time printf "continue\nsave-report\nquit\nk\n" | Debugger -c Debugger -s 1000

hoard2
real    0m2.295s
user    0m2.505s
sys     0m0.128s

openbsd
real    0m2.896s
user    0m2.809s
sys     0m0.579s

The performance difference in Debugger is due to OpenBSD malloc
actually decommitting memory. If we disable decommit, then
OpenBSD malloc is faster than hoard2 in this case also.

In some particular cases this is a huge speedup. For example, the link
of the "lto-dump" program in GCC seems to hit a pathological case in
hoard2 and our glue code for it; with hoard2 it takes around 23 seconds,
but with this allocator it takes only 2 seconds (!). Overall the
performance difference is much more modest, though.

Overall, system memory usage seems to be up about ~5% (318 MB -> 334 MB
just after boot), and that seems to mostly be due to the allocator
filling its initial caches faster when allocations occur, rather than
lazily allocating.

Change-Id: I071d8f76fbbfa11547bd6da6bf649d111414e780
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8974
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2025-02-13 22:43:57 +00:00
Augustin Cavalier
69cb8e25ff libroot/posix: Add glue code, global caching logic, and integrate OpenBSD malloc.
* PagesAllocator: A process-global caching strategy for the allocator.
   It deals with allocating virtual addresses and memory, and gives us
   back some of the performance that's lost by having an actual
   decommitment strategy (which the hoard2 glue code doesn't.)

   It uses two SplayTrees to manage free lists, and resizes areas
   on allocate if they aren't next to a free chunk (which saves a lot of
   time for large reallocations.)

   There's still room for improvement here, see inline TODOs. But overall
   we get pretty good performance with it.

 * Add a TLS slot for the allocator glue to use. Right now it just puts
   integers in there (since thread IDs are not evenly distributed),
   but we could put a data structure pointer in there as well, potentially.

Change-Id: I56ddb0b022a468dc04275075ed7e174b339c8ca4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8335
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2025-02-13 22:43:57 +00:00
Augustin Cavalier
b4508f498f libroot/posix: Import OpenBSD malloc source.
Exactly as-is. Modifications and integration will come in
the next commit.

Change-Id: I685483992d7f593fc46154ddea85a91798044faa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8973
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2025-02-13 22:43:57 +00:00
John Scipione
759dfd5ae3 Tracker: invert inactive select color so it is how it was
Change-Id: I5d79fc733496746bceb7003cb7d8a70555d87732
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8972
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58638
2025-02-13 02:02:59 +00:00
Augustin Cavalier
bf13ecf7cf registrar: Avoid cloning buffers when delivering messages in most cases.
If we succeed in sending the message on the first try, then we don't
need to allocate anything at all.

This two allocations and a memcpy in the fast path (which is
hit the vast majority of the time, it appears.)
hrev58637
2025-02-12 16:42:00 -05:00
Augustin Cavalier
ff808e1b64 registrar: Use BStackOrHeapArray in MessageDeliverer for flattened messages.
Saves unnecessary allocations (and reallocations).
2025-02-12 16:36:33 -05:00
Augustin Cavalier
0f4bfb43ed registrar: Style cleanup to MessageDeliverer.
No functional change.
2025-02-12 16:27:44 -05:00
Augustin Cavalier
0d23e179a6 BMessage: Allocate more temporary data on the stack if possible.
Some methods already did, but used a very large size of 16KB.
Reduce that to 4KB, do it in more places, and use BStackOrHeapArray
where possible.

Change-Id: Ia2d64582e76da6c1850e502107c07cb10bcd8226
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8969
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58636
2025-02-12 20:46:50 +00:00
Augustin Cavalier
dfdffe1ac6 BList: Allocate lazily.
Rather than allocating a block in the constructor, just wait to
do it until we actually need to add items to the list. This saves
over 200,000 allocations when running "pkgman search" alone.

Change-Id: Ia6a21b963efded2bb4973edc2ba22ff026e01737
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8630
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-02-12 20:46:50 +00:00
Augustin Cavalier
31343db0d3 tests/kernel/vm: Add checks for the end of the reservation to resize_area_tests. hrev58635 2025-02-11 18:57:36 -05:00
Augustin Cavalier
7ff241033f kernel/vm: Implement more cases of resizing with reservations.
* Handle resizing areas past a reservation, fixing a longstanding TODO.
   (The kernel address space implemenation still has the same TODO however.)

 * Handle resizing areas past or inside more than one reservation at once.

 * When an area shrinks, and it's touching/inside a reservation, expand
   the reservation downwards at least to its original size.

Add tests for all these behaviors (they're passing.)
hrev58634
2025-02-11 16:08:17 -05:00
Augustin Cavalier
8ff99b6ed7 kernel/vm: Drop check for RESERVED_AREA_ID in area_for.
These are actually not returned from VMAddressSpace, it seems.
2025-02-11 16:00:55 -05:00
Augustin Cavalier
7c2bd6bfcd docs/develop: Delete "How to Merge Patches from NetBSD Trunk".
This is now obsolete as the preferred merge strategy is just to
copy the whole directories and then reinstate the __HAIKU__
directives, same as for the FreeBSD network drivers and other
such code.
hrev58633
2025-02-11 00:30:49 -05:00
John Scipione
c78383f720 Tracker: Populate Tracker add-ons into main menu bar
This is used by some Tracker add-ons including TrackRunner and TrackGit.

Fixes #19386

Change-Id: I329eb9f1f8b2abf2872593d8f4417fa82de0b521
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8911
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
hrev58632
2025-02-11 03:59:26 +00:00
Jérôme Duval
74e01ea162 BMenuField: SetLabel(): do nothing if current and new label are NULL
Change-Id: Ia4bb6f99d3b633a23a43624208e16cb7e4ae0399
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8940
Reviewed-by: X512 X512 <danger_mail@list.ru>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: John Scipione <jscipione@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
hrev58631
2025-02-10 21:53:08 +00:00
Augustin Cavalier
218230135f XHCI: Adjust SMI disabling and only do it if the LEGSUP capability was found.
Otherwise we'll try to write to some random register at or past the end.

Adjust the bitmasks: rename XHCI_LEGCTLSTS_DISABLE_SMI to RESERVED_BITS
and define it in hex. Also add the "read-only" bits as a separate
declaration, and don't touch those either; then remove the setting
of the "events SMI" bits.
hrev58630
2025-02-10 15:30:04 -05:00
Augustin Cavalier
53fc5edad8 XHCI: Bail if we get all-1s from an EEC read.
It probably means it's invalid. OpenBSD does the same.
May help with #19407.
2025-02-10 15:30:04 -05:00
Augustin Cavalier
72a67f8d8a ACPI: Always use the loader-reported root pointer.
We always did under EFI but not under BIOS. Now, the BIOS loader
reports the root pointer as well, so we don't need to find it again.

Change-Id: Ie83adb53f098d44f2688a1a327c084f94afa2673
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8941
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58629
2025-02-10 20:18:51 +00:00
Jérôme Duval
46dd344bdd strace: Add tracing for rlimit syscalls.
Change-Id: I1e99622027f04fb93d00ebd94b45e05f7142fbec
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8965
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58628
2025-02-10 20:17:28 +00:00
John Scipione
3953c0e7cd Tracker: Fix list icon click regression, Fixes #19414
Change-Id: I96d8995087bf8621ff580ad3b4ed54ae59786e32
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8964
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>
hrev58627
2025-02-10 20:16:08 +00:00
Augustin Cavalier
7c77e55210 runtime_loader: Invoke call_atexit_hooks_for_range for all regions.
This is necessary when the TEXT section is split.

At this point it may make more sense for libroot to register such
atexit hooks with runtime_loader rather than allocating them itself,
in line with the above comment's suggestion, but that can be investigated
some other time.
hrev58626
2025-02-10 12:27:40 -05:00
Augustin Cavalier
cd98a7e751 runtime_loader: Use find_loaded_image_by_address in another case. 2025-02-10 12:26:29 -05:00
Pascal Abresch
e911918d38 HaikuControlLook: Fix ArrowShape color for Scrollbar buttons
Previously this would simply tint the passed in background color.
After hrev58595 this was changed to pass the proper Foreground color instead.

The codepath to disable/enable the color was missed in an oversight,
this puts back the original tint color for the foreground aswell.

Fixes: #19406

Change-Id: I6f75d24316e8ca3ecdb78f11fc8dede88f082780
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8958
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>
hrev58625
2025-02-10 16:51:27 +00:00
Pascal Abresch
b6987eac0c kits/tracker: TFilePanel:SwitchDirectory abort if file does not exist
Change-Id: Ie8c66f50b025d788c23e2c0f8837da66244fc4e4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8960
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
hrev58624
2025-02-10 16:51:05 +00:00
Jérôme Duval
146617c29b runtime_loader: dlsym(RTLD_NEXT) searches all regions for the caller address
clang/lld can put code in multiple regions.

Change-Id: I495e3f12105ef2e894809da7e4a91bac08a12fd6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8961
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
hrev58623
2025-02-10 07:37:47 +00:00
John Scipione
7d6ff0554b Tracker: Fix one more artifact drawing issue
... related to Pose and TextWidget not exactly matching.

Change-Id: Ic9c3f2ecc9a9dc4af4c200bc5a16b9f46d72f9b1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8954
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58622
2025-02-09 03:02:07 +00:00
John Scipione
c368793cd4 Tracker: Fixup drop context move to enabled status
regression from hrev58560.

Change-Id: Ic62292c2eb38e486cf18f0e4e9535ff6154b0c87
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8953
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-02-09 03:02:07 +00:00
John Scipione
2cf974a04e Tracker: Do not create symbolic link on same folder
Fixes #19403

Change-Id: Ib590822308b819d60715139c536d60e4e14c510f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8950
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58621
2025-02-08 22:37:07 +00:00