Commit Graph

60218 Commits

Author SHA1 Message Date
Augustin Cavalier
44b903f97a rpmalloc: Disable ASLR for heap areas.
On 32-bit at least, our ASLR is too aggressive and fragments
the address space very quickly to the point where at 500MB (1/4)
usage, area insertion begins to fail.
2019-05-18 13:51:19 -04:00
Augustin Cavalier
fb683851b1 rpmalloc: Disable assert on failing to map memory.
We want applications to be able to handle out-of-memory
conditions gracefully, not just trigger an assert every time.
I disabled this before, looks like I missed it in the final
patch.
2019-05-17 16:35:58 -04:00
Augustin Cavalier
dd249016c2 USB: Check and set the Device object state appropriately.
The Device object gets an ID before it begins initializing, and
loses its ID after it fully finishes tearing down, so simply
verifying the Device object is non-NULL is not enough to verify
that we can use it. We need to call InitCheck() every time.

In Device itself, we should also unset fInitOK when beginning
teardown, so that anyone who still has a handle can no longer
use this Device object while teardown occurs (which, depending
on the number of pipes, pending transfers, etc. may take some
time.)

Fixes #14949 and almost certainly any other USB-related KDLs
in these codepaths.
2019-05-17 16:24:06 -04:00
Augustin Cavalier
f8fdf848d0 HTTPStreamer: Another build fix I forgot to commit.
Sorry for the noise...
2019-05-17 16:13:07 -04:00
Augustin Cavalier
5731cdeb5f media_client: Fix build after previous commit. 2019-05-17 16:03:35 -04:00
Augustin Cavalier
218a8c03cb Revert the Codec Kit.
All of Barrett's individual reverts have been squashed into this
one commit, save a few actual bugfixes.

Change-Id: Ib0a7d0a841d3ac40b1fca7372c58b7f9229bd1f0
2019-05-17 14:43:32 -04:00
Augustin Cavalier
086528f66a USB & XHCI: Refactor endpoint initialization to support SuperSpeed better.
SuperSpeed (USB3) devices have a "companion descriptor" along with the
endpoint descriptors that describes certain other attributes they have,
which are important for the controller to schedule transfers properly.
Previously we were just using USB2 values; now we are properly using USB3
ones.

Tested on an Intel Lynx Point controller. As far as I can tell, no
regressions, but #15000 is not fixed anyway.
2019-05-16 20:31:11 -04:00
Michael Lotz
c8836afc0a rpmalloc: Use create_area instead of mmap.
It has lower overhead and allows to name the areas so that they are
labeled as heap areas.

Note that we can still use munmap for releasing. It has the nicer
interface of using the base address and length which we already know
instead of needing the area id that would have to be queried with an
additional syscall.

Change-Id: I338c4043ecc2947b82b8fe9fd69a99ce3fa23138
2019-05-16 16:04:34 -04:00
Michael Lotz
8ccd1402bf rpmalloc: Port to native TLS.
The native TLS has just a little less overhead which quickly adds up in
heavy use.

Change-Id: I6223dfdc0f9298952fdde5eb47d5112bc7887653
2019-05-16 16:04:34 -04:00
Augustin Cavalier
7132b79eaf rpmalloc: Import and set as default.
Hoard, the LGPL-licensed locking thread-caching allocator that we have
used by default since libroot's introduction, is showing its age.
It is a "pseudo-sbrk-based" allocator (it predates our actual sbrk,
so instead it uses a single Be area), which has serious limitations:
as we cannot ever move the area, we can only resize it "in place",
and so once we hit the end of the ~1.5GB reserved part of the address
space for the heap, we are usually out of luck if we need more memory.

On 32-bit userspace has only 2GB of address space anyway, but on
64-bit where address space is not a resource worth worrying about,
this can be a serious problem for applications that want to use a
lot of RAM. As more and more large applications get ported to Haiku,
the time for a mmap-based allocator has come.

For posterity's sake, here are all the possible options there were,
and why this one was selected rather than one of them, beginning
with the immediate rejects:

 * nedmalloc. Unmaintained since 2014 and all benchmarks show it
   underperforming vs. virtually all other allocators.
 * bmalloc. Significantly worse-performing vs. other options on
   this list with no apparent advantages.
 * hoard3. Now GPL only, which is obviously not acceptable for
   use as a system library.
 * ptmalloc2. glibc's default allocator; underperforms vs.
   even most of the above-listeds.

And now on to the honorable mentions:

 * tcmalloc. This is Google's allocator; it's designed for server
   and other high-performance workloads. As a result, it almost
   never unmaps memory unless ordered to do so in a very explicit
   way, which obviously is unacceptable behavior for a general-purpose
   allocator.

 * jemalloc. This is FreeBSD and NetBSD's default allocator as well
   as finding use in Firefox and Rust. It is again designed for
   performance, with significantly higher memory overhead than
   other allocators, especially for small heaps; which is of course
   a problem for us, as we want to retain our light footprint.

Finally this brings us to rpmalloc. It's not as well-travelled as
tcmalloc or jemalloc, but by benchmarks done by itself [0] and
by developers of other allocators [1], it seems to typically hit
the "sweet spot" of very good performance with lower (if not the lowest)
memory use out of all the other allocators it's tested against;
even beating jemalloc in certain benchmarks for speed, too.

You can see a description of the allocator's design in its README [2].

[0]: https://github.com/rampantpixels/rpmalloc/blob/master/BENCHMARKS.md
[1]: https://github.com/ezrosent/allocators-rs/blob/master/info/elfmalloc-performance.md
[2]: https://github.com/rampantpixels/rpmalloc#rpmalloc---rampant-pixels-memory-allocator

In general testing thus far on Haiku, it appears to be a consistent
5-10% performance boost (1m28s real -> 1m23s real) when doing
the "HaikuDepot compile" benchmark. Memory usage by most apps
after a cold boot changed negligibly (launch_daemon: 444K -> 476K,
app_server: 15.86MB -> 15.49MB, Tracker: 6.19MB -> 4.49MB.)

The only adverse affect I have observed so far is that a certain few
WebKit double-frees cause crashes/asserts faster than they did before
(e.g. Google Maps crashes after less than a minute instead of a few
minutes.)

That being said, any new or strange behaviors, please report
immediately. Backing out this change should be as easy as
reverting the changes to the libroot/posix Jamfile. If nothing
else comes up in a few weeks, then I'll remove Hoard from
the repository.

Fixes #13554.

Change-Id: Id2871601b1e99dcf022fbef2c53008ee6c3f233b
2019-05-16 16:04:33 -04:00
Augustin Cavalier
c5f96e5b4a net80211: Merge a memory leak fix from FreeBSD. 2019-05-16 15:11:01 -04:00
Calvin Hill
6ee7bb4f7b cpu_type.h: Allow cpu_type functions to be accessible from C.
This allows cpu_type.h to be used in C-based software,
with the get_cpu_*() functions all accessible via C as well
as C++ code.

Tested changes with sysinfo, AboutHaiku and Pulse.

Change-Id: Ide87d8e3f2ba5f0f1890f385b1ac90c677bcc274
Reviewed-on: https://review.haiku-os.org/c/1453
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-16 17:07:38 +00:00
Augustin Cavalier
49f507c4b5 XHCI: Remove unused parameter to ConfigureEndpoint.
No functional change intended.
2019-05-15 18:11:13 -04:00
Augustin Cavalier
ec5b988026 packagefs: Use more descriptive error codes on failing activations. 2019-05-15 16:18:36 -04:00
Augustin Cavalier
f6f19105dc package_daemon: Actually return transaction errors instead of OK always.
This "fixes" #10959, though now the varying potential causes of that
will now print actual errors earlier instead of the error message
in that ticket.
2019-05-15 16:18:35 -04:00
Andrew Lindesay
f85e030047 HaikuDepot: Load Languages from HDS
The HaikuDepot application has, thus far had its
own hard-coded list of languages that the user is
able to choose when (a) creating a new account or
(b) creating a user-rating.  This change will mean
that those languages are loaded from the HDS
server dynamically and in this way the user can
choose from the full list.  There have also been
improvements to the way in which the languages are
displayed in the menu as well.

Change-Id: If7cb7b87f348ca59d503d276a22444e72d0e6168
Reviewed-on: https://review.haiku-os.org/c/1425
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-05-15 19:03:48 +00:00
Augustin Cavalier
9fe74faa61 HaikuPorts: Bump python, openssh, git for ncurses6. 2019-05-15 13:31:45 -04:00
Augustin Cavalier
f7072b7d5a hardlink_packages: Fix arguments check.
Thanks Jessica for the review!
2019-05-15 13:19:34 -04:00
Augustin Cavalier
8e05933bc8 HaikuPorts: Add libopenmpt_x86 on x86_gcc2. 2019-05-14 22:43:57 -04:00
Augustin Cavalier
4bca5362cd hardlink_packages: Use subprocess instead of os to check for package_repo. 2019-05-14 22:43:25 -04:00
Alexander von Gluck IV
aefa412c98 ppc: Minor tweaks to move PowerPC build towards working
Change-Id: Id9a4e0fd483d2a0c05cf2a8475d3689a13bcc5f6
2019-05-14 21:13:58 -05:00
Augustin Cavalier
0f916d6641 tools/hardlink_packages: Check that the package_repo command exists. 2019-05-14 22:04:56 -04:00
Augustin Cavalier
54e53dabfc HaikuPorts: Add openmpt for x86_64. 2019-05-14 21:42:42 -04:00
Augustin Cavalier
fc985c6121 HaikuPorts: Add llvm7_x86_libs for x86_gcc2. 2019-05-14 21:39:08 -04:00
Augustin Cavalier
92ca8543cd kernel/lib: Add another new file for zstd. 2019-05-14 20:47:20 -04:00
Augustin Cavalier
0feba5ebec kernel/lib: Add new file for zstd. 2019-05-14 20:19:29 -04:00
Augustin Cavalier
77d551c2f1 Jamfile: gutenprint -> gutenprint8. 2019-05-14 19:32:29 -04:00
Jérôme Duval
89f1fd6512 Bump gutenprint version.
needs gutenprint8 packages to be uploaded.

Change-Id: I1204ff8b1bb85cc0eb615082b205280daabbc290
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2019-05-14 19:11:41 -04:00
Augustin Cavalier
f95a6bc18a HaikuPorts: Synchronize packages; add libpsl and gutenprint8. 2019-05-14 19:03:02 -04:00
Augustin Cavalier
e661fdd17d repositories: Move the README into the appropriate docs/develop directory. 2019-05-14 19:00:18 -04:00
Jérôme Duval
df0ba1eca1 vfs: _user_ioctl: any buffer value is allowed for some ops.
some ops want an integer value instead of a pointer as arg parameter ( #15058 ).

http://pubs.opengroup.org/onlinepubs/9699919799/functions/ioctl.html clearly specifies that:
"The type of arg depends upon the particular control request, but it shall be either an
integer or a pointer to a device-specific data structure."

add a test for functions which should return ENOTTY as errno.

Change-Id: I4a98af73b17c79c3460123d3794ee866f8719898
Reviewed-on: https://review.haiku-os.org/c/1447
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-14 16:12:31 +00:00
Augustin Cavalier
32cbf55317 freebsd_network: Fix logic inversion introduced in the last change.
Thanks to Stephan for noticing!
2019-05-14 12:03:00 -04:00
Jeroen Oortwijn
72f7f7d976 USB_hid.h: Add Report Type constants
From "Device Class Definition for Human Interface Devices (HID)
Ver. 1.11", par. 7.2.1, page 51.

Change-Id: I4628f8ca940758aaf4a09290e9fa407d30374e7a
Reviewed-on: https://review.haiku-os.org/c/1450
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-14 07:24:09 +00:00
Jeroen Oortwijn
419190fdc2 usb_hid: Use In Range data instead of state
According to the HID Usage Tables document (Hut1_12.pdf), the In Range
usage is a Momentary Control (MC) (par. 16.3.1). A MC has a Logical
Minimum of 0 and a Logical Maximum of 1 (par. 3.4.1.3).

As the In Range usage is a bit quantity, the value can't be outside
the Logical Minimum and Maximum and therefore can't be in an invalid
state.

Now the inRange boolean value properly changes.
The pointer still moves to the upper left corner when the pen is out
of range, though. Maybe the input_server add-on doesn't use this value?

Change-Id: Idf511ac237158e90eb2e8f01422757655a7eea3a
Reviewed-on: https://review.haiku-os.org/c/1449
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-05-14 07:24:09 +00:00
Jeroen Oortwijn
7625dca0e9 input_server/tablet: Only send event messages when pen is in range.
When the pen is moved out of range, the Wacom tablet sends one last
message with all values set to 0 and the In Range value set to false.
Don't send mouse event messages in this case.

Change-Id: I419d57cede47a6ef40a160322f3025ef372ecaa3
Reviewed-on: https://review.haiku-os.org/c/1448
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-05-14 07:24:09 +00:00
Augustin Cavalier
45c3eb3a3c pkgman: Split "interactive" and "show progress" logic.
Previously we didn't show progress in non-interactive mode. Now
we do, so long as stdout is a TTY.

Fixes #14603.
2019-05-13 19:32:30 -04:00
Augustin Cavalier
7115cef989 Jamrules: Include the UserBuildConfig before processing repositories.
Repository processing triggers HAIKU_REVISION computation, and it
is intended that the UserBuildConfig can override or set HAIKU_REVISION.

Fixes #14834.
2019-05-13 19:21:48 -04:00
François Revol
733f097b97 Appearance: Add a ControlLook MenuField
Change-Id: If815fa6a864d2a916eb1ae878400d342f666e3d2
Reviewed-on: https://review.haiku-os.org/c/1434
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-13 22:15:30 +00:00
François Revol
e88c3d58bd Add setcontrollook minimal CLI tool
Just does what the name says

Change-Id: I6cf23f997ce544df83d4ef2f73a3b130dea8825c
Reviewed-on: https://review.haiku-os.org/c/1432
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-05-13 22:15:30 +00:00
François Revol
26b5a18eb0 Add a BeControlLook addon
Very simple for now, just reuses the Haiku one with some gradients
removed.

Add it to the haiku_extras package.

Change-Id: I41729ed65b147fed72bf56e7c5c89367b75563bb
Reviewed-on: https://review.haiku-os.org/c/1431
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-13 22:15:30 +00:00
François Revol
629397f222 Add basic support for loading ControlLook add-ons
app_server just passes the add-on path around.

Maybe we should make sure the add-on can be loaded when setting it.

Change-Id: I3acd3299782a22c1666bd5435dbf3d8053e359fa
Reviewed-on: https://review.haiku-os.org/c/1430
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-13 22:15:30 +00:00
Augustin Cavalier
da452ce2bc strace: Print syscall names without the "_kern_".
This makes the output much easier to read (e.g. "write(...)" vs.
"_kern_write(...)") and similar to strace/dtrace/etc. output
on other platforms.

Change-Id: Iac8e32aae0dcf3731a348c6192203f8d5b54da7a
Reviewed-on: https://review.haiku-os.org/c/1451
Reviewed-by: Bruno Albuquerque <bga@bug-br.org.br>
2019-05-13 22:11:33 +00:00
Bruno Albuquerque
9888752db1 freebsd_network: Style fixes pointed out by Korli.
- Did not see his comments before pushing my previous change.
- clear owning flag when passed value is NULL.

Change-Id: I493973aff2b107785c3734847c85a52f0f9da360
Reviewed-on: https://review.haiku-os.org/c/1443
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-13 18:58:04 +00:00
Jérôme Duval
858e5775ab vfs: fail only truncate on file descriptors opened read-only.
chmod is allowed.

Change-Id: Idcac38bdd7f0d614538421a41dfd30066a0c316f
Reviewed-on: https://review.haiku-os.org/c/1444
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2019-05-12 07:23:16 +00:00
PulkoMandy
00b283c042 Fix long double support for ARM.
Fixes #15056.

Change-Id: I48c00b955346971aa88b731ccad1953a4044983d
Reviewed-on: https://review.haiku-os.org/c/1442
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2019-05-08 20:14:25 +00:00
Bruno Albuquerque
7f6254d1e9 Prevent a double softc free.
- Keep track if the softc was allocated externally or not.
- Only try to deallocate it if it was allocated internally.

Do not try to free the softc if we were not the ones allocating it.

- Avoid a double free on consecutive calls to device_set_softc.

Change-Id: Ibb38e54e9dfd2a80dbb53920970bead626da8ba1
Reviewed-on: https://review.haiku-os.org/c/1441
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-05-08 15:31:31 +00:00
Les De Ridder
1712a3c957 btrfs: add initial disk system add-on
Change-Id: I8f26a78770e679527a99b49a04557c1aa4334b53
Reviewed-on: https://review.haiku-os.org/c/1396
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-05-08 10:20:53 +00:00
François Revol
25de7c1b12 loader: VESA: make nvidia scaling fixup a driver setting
Since not everyone likes the default, make it an option in the vesa
settings file. Note setting a mode with the Screen prefs overwrites
the file so it will discard the option.

Also move the code to get_mode_from_settings() since we can't load driver
settings as early as vesa_init().

Change-Id: I93080bd1fbc064dab053624ad37935268b1ed17d
2019-05-08 04:42:33 +02:00
François Revol
0bed4dedc9 haiku utils rdef: bump Copyright year and fix indentation
Change-Id: Ib33df34029d0ab0189754024dd07beef3a2864bc
2019-05-08 02:00:04 +02:00
Murai Takashi
0ecfc6f3e3 Added some support for GCC 9.
Change-Id: I6b6cd53e00601592b44e1f2aa2804c8c9c9593d9
Reviewed-on: https://review.haiku-os.org/c/1438
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-05-07 23:07:17 +00:00