Commit Graph

66355 Commits

Author SHA1 Message Date
Alexander von Gluck
4c62171e88 usb_serial: Add missing FTDI uarts USBID's
* Witnessed at linux drivers/usb/serial/ftdi_sio_ids.h
* I have a 0403:6010 in hand, validated functional
* Looking at the linux code, there aren't any special
  cases for these alternate FTDI devices.
* There are a bunch of clones we could add per the above
  reference, but lets just support the "official" ones for now.

Change-Id: I4c1aa162b94753431d7497a65f646faec5cccfad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7902
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>
2024-07-30 13:41:47 +00:00
Ilmari "ilzu" Siiteri
78d0ecbbf5 Tracker: Allow organizing of Tracker's New templates to sub-menus
* Fixes #18595
* Organizes templates to the menu in following order: sub-menus,
  directories and files

* Sub-menus are directories with boolean attribute _trk/_template_submenu
  set to true

* For now it doesn't change the behaviour of template folders to allow
  folders to have content to be copied as I suggested in the ticket, I'll
  add that as a separate submission. I also intend to change the behaviour
  of copying the templates to happen asynchronously, as if one uses a large
  template with current implementation it will cause tracker to be
  unresponsive while copying.

Change-Id: I20ea5e3ede0c32df0eacb12df93ae6051654c050
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7832
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2024-07-30 13:35:22 +00:00
Fabio Tomat
4cff206204 Friulian keymap: Add missing character.
"Ç" was missing.

Fixes #18961.

Change-Id: I2ca18d0fa337c2566dbc092d8415f9796c587343
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7910
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-30 13:23:21 +00:00
Augustin Cavalier
a57635112e openbsd_network: If dmamem allocation fails, don't leak the local tag. 2024-07-29 18:04:12 -04:00
Augustin Cavalier
b390890110 freebsd_network: Allocate only as large a bounce buffer as is actually needed.
Otherwise we will waste a lot of pages.
May help with #18957.
2024-07-29 18:03:50 -04:00
Augustin Cavalier
3c1f9a126b kernel/heap: Increase the guarded heap 'initial' & 'grow' sizes.
With the standard defaults it wastes too much memory and didn't boot.
With these it successfully boots to desktop, for me at least.
2024-07-29 17:52:54 -04:00
Máximo Castañeda
caed67a8cb Input server: add mouse-specific API for button map and click speed
Convert users of those and other parameters to the new API.
Fix mouse preferences "Default" button not changing button map.

Change-Id: I9184011fd3067fd0b229e1db6376c1b41f06dab9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7878
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-29 17:30:39 +00:00
Máximo Castañeda
df803c0f3f input_server: handle empty-named mouse settings requests
When reading data, return it from one of the connected devices, or from
defaults if there's none. When changing data, do it for all connected
devices.

Fixes: #16617
Change-Id: I36e0f9929c833905d146d19b02be136a3588026a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7837
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-29 17:30:39 +00:00
Máximo Castañeda
85e84ddefb Input server and preferences: clean up
Remove compatibility with legacy settings format.
The preferences app doesn't need to read and save the settings file:
devices are enumerated and their properties retrieved from the
input_server. When something changes, the input_server updates the data.

Change-Id: Id1ea6f2532a1c8a173e9ba9818dd911fd6f4aa10
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7877
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-29 17:30:39 +00:00
Jérôme Duval
f00e314e57 kernel: Vector: fix warning
template-id not allowed for constructor in C++20

Change-Id: I562856908ab2deb9fdbf6bf24eedb58e5ebf6c9f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7908
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2024-07-29 08:11:40 +00:00
Jérôme Duval
7ffd2c9e59 kernel: LegacyDevice: SetHooks() needs a non-null fDeviceModule
fix gcc analyzer warning

Change-Id: Ic2aaeebb516f680ba40c343c01d5be1a9232d46d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7907
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-29 08:11:40 +00:00
Augustin Cavalier
b017b23b34 Package Kit: Add another include path to appease GCC2. 2024-07-27 23:58:45 -04:00
Augustin Cavalier
bc2428853f Switch to using the vendored libsolv.
Package dependency resolution seems to still be working OK.
2024-07-27 16:57:40 -04:00
Augustin Cavalier
f491972ca9 libsolv: Import 0.3.0_haiku_2014_12_22.
As discussed in #18339, it seems to make sense to vendor libsolv,
given how closely tied it is to the package kit, the difficulties
of upgrading it without breaking anything (even when using SOVERSION
to avoid conflicts), and other concerns.

We already vendor libraries much larger than this (e.g. Zydis),
so vendoring libsolv seems fine.
2024-07-27 16:54:41 -04:00
Augustin Cavalier
ef7e9ceb69 kernel/fs: Create a macro to fetch the net_socket from file_descriptor.
As discussed on the mailing list. Makes the code a bit easier to read.
2024-07-27 15:47:12 -04:00
Augustin Cavalier
3114a405f5 kernel/arch: Apply same fix to stack trace printing as on x86.
At least to the architectures that have stack trace printing code
clearly based on the current x86 one.

Change-Id: I6f28a10234a80ecd464fc640ac1ac26199aa2912
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7906
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: X512 X512 <danger_mail@list.ru>
2024-07-27 19:28:09 +00:00
Augustin Cavalier
cbf37c1ac3 kernel/x86: Correct frame pointers in print_stack_frame.
A stack frame consists of two addreses: a return address,
and a pointer to the preceding frame. The stack trace loop
keeps track of two frame pointers: one to the "current"
and one "next" (next to be printed, really the "preceding" frame.)

However, inside print_stack_frame, the frame we are printing
is not the "current" frame (as the stack_trace method terms it)
but rather the "next" frame: because we are printing the function
which is specified by the "current" frame's return address,
and its stack frame is the one "preceding" with respect to "current".

In other words, what the stack_trace method calls "next" is in fact
the stack frame that print_stack_frame is supposed to be printing.
This was apparent from the fact that print_demangled_call was passed
"nextBp + sizeof(stack_frame)", as otherwise we would fetch the
arguments for the wrong function.

Thus we rename "bp" to "calleeBp", as it's the frame pointer of
the function that was called by the function we are printing, and
"nextBp" just to "bp".

Additionally, while at it, fix the kernel/user space switch check.
As the stack grows downwards on x86, we can just check that the
"current" frame is at a lower address than the to-be-printed frame.

This fixes stack trace address printing on x86. Before this commit,
the addresses column in KDL stack traces was "off by one" (most
obvious in that the first userland stack frame address was still
a kernel stack frame address.)

Spotted by X512.

Change-Id: I111bec4b9dd7aa83fb3f5d528b6a53a48de7db72
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7905
Reviewed-by: X512 X512 <danger_mail@list.ru>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-27 19:28:09 +00:00
Jérôme Duval
9d18e52191 kernel: newGroups was allocated with malloc, deallocate with free()
fix gcc analyzer warning

Change-Id: I0427a3d9b288e081055242fff59f2e15e478dac6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7904
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-07-26 16:14:04 +00:00
Jérôme Duval
e21d313387 kernel: use nothrow for ThreadSignalEvent::Create()
fix gcc analyzer warning

Change-Id: Iaa8eb238dd0efd5315613e8afa932da4853ffc92
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7903
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-26 16:14:04 +00:00
Augustin Cavalier
37df18e183 kernel/scheduler: Properly handle thread masks not being set.
There was a missing case in reschedule(). Also fix a copy/paste
error in the power_saving logic.

This also slightly optimizes things by having an unset CPU mask
turn into a boolean and be processed separately, avoiding
loops and masks entirely in that case.

Have CPU masks be unset by default for new threads, while at it.

Change-Id: Ic5d000a72839448a2d025cfc99de1ed49c841852
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7900
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-25 21:29:52 +00:00
X512
05c46731b8 GLInfo: fix double free
BView and BColumn are owned by its parent objects and deleted automatically.

Fix crash on exit.
Fixes #14535
Fixes #18331

Change-Id: If4bc4268542d4975b60f8f42c2868ec8a1a0a83f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7901
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alexander von Gluck <alex@terarocket.io>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-07-25 17:34:19 +00:00
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