Commit Graph

60209 Commits

Author SHA1 Message Date
Augustin Cavalier d5aa7f00a2 usb_audio: Stop before reallocating buffers and add more error checks.
Also print strerror() for SetGlobalFormat.
2019-07-14 16:31:02 -04:00
Augustin Cavalier 553ff67585 XHCI: Print errors when transfers have non-success completion codes. 2019-07-14 14:37:00 -04:00
Augustin Cavalier 9cd2907d68 XHCI: Trace an error when we receive command events for unknown commands.
This revealed that StopEndpoint commands on QEMU were returning ...
after the semaphore timeout was already hit. Now to figure out
why that is the case...
2019-07-14 14:31:07 -04:00
Augustin Cavalier 60f15f5aa2 XHCI: Turn failure to stop the endpoint into a TRACE_ERROR. 2019-07-14 14:28:24 -04:00
Augustin Cavalier c8375b0017 XHCI: Tweak priorities a bit more.
Put the EventThread as URGENT_PRIORITY and the downstream FinishThread
as URGENT - 1. Hopefully this will serve as a better hint to the
scheduler as to what we want to occur here.
2019-07-14 14:27:30 -04:00
Kacper Kasper 17c9e98743 TextView: add shortcuts for wordwise delete
Change-Id: Ie67f6255c3f5d9d8ccc6699ed42dd71ae593fa16
Reviewed-on: https://review.haiku-os.org/c/1573
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-14 14:14:39 +00:00
Augustin Cavalier b281541f9a usb_audio: Map the buffer area as B_READ_AREA/B_WRITE_AREA.
The calling userland process needs to be able to access it.
2019-07-13 23:43:14 -04:00
Augustin Cavalier 4a6a2fbfda XHCI: Increase priorities of the event and finish threads.
The "event" thread is what is woken up after interrupts, and
the "finish" thread handles the results of the "event" thread,
so prioritize them accordingly. Probably increases responsiveness
of USB input and disk devices visibly on heavily loaded systems.
2019-07-13 23:18:23 -04:00
Augustin Cavalier f1e99f1667 XHCI: Use PRI to appease GCC2. 2019-07-13 22:59:14 -04:00
Augustin Cavalier b3c896af1b multi_audio_test: Continue if getting buffers failed.
Don't try and read the buffers anyway, that'll lead to a page fault.
2019-07-13 22:34:54 -04:00
Augustin Cavalier d5a29ba97c listusb: Do not try to print the port speed.
The USB3 specification changed the meaning of this field, and
it means different things depending on whether a USB 2 or 3
device is attached, so just don't print it.

Fixes listusb saying "Fullspeed" for USB3 devices. The per-device
information already prints what USB version and protocol the
device is operating on, so this was redundant anyway.
2019-07-13 19:37:19 -04:00
Augustin Cavalier 1bccd6b2f7 XHCI: Always trace non-standard port speeds. 2019-07-13 19:37:19 -04:00
Augustin Cavalier 6e2bbbb162 USB: Rename USB_SPEED_SUPER to USB_SPEED_SUPERSPEED.
For consistency's sake with the others.
2019-07-13 19:37:19 -04:00
Augustin Cavalier b1ea5557ec USB: Remove USB_SPEED_WIRELESS.
It doesn't belong after SUPER, as it's really an extension of USB 2.0
(Linux puts it after HIGHSPEED indeed, as "USB 2.5".) If we eventually
want to support it, we can add it there.
2019-07-13 19:37:19 -04:00
Augustin Cavalier e06f640862 Installer: Ignore cache directories.
Fixes #15145.
2019-07-13 15:54:47 -04:00
Augustin Cavalier 39681c5c0f BootManager: Lock installation to "Intel" partition types only.
It seems no other OS calls these "Intel" partition types, but instead
MBR partition types. Perhaps we should change this, too?

At any rate, this solves #13260 by blocking installation on GPT
drives altogether.
2019-07-13 15:08:15 -04:00
Augustin Cavalier 14cbb958bd kernel/vfs: Unlock KPath buffers after copying them.
Otherwise we will call UnlockBuffer() when we potentially never
called LockBuffer().

Fixes #15157.
2019-07-13 13:46:19 -04:00
Augustin Cavalier 39665db167 kernel/vm: Inline the VMArea::name string.
B_OS_NAME_LENGTH is 32, char* is 8 (on x64), and this structure
has quite a lot of pointers in it so it is not like we really
needed to save those 24 bytes. Hitting malloc() in here is not
so great, especially because we usually have B_DONT_LOCK_KERNEL_SPACE
turned on, so just inline and avoid it.

Change-Id: I5c94955324cfda08972895826b61748c3b69096a
2019-07-13 13:42:49 -04:00
Adrien Destugues ca68cae76f PluginManager: remove unneeded buffering.
The plugin manager was attempting to buffer the IOs. However, the ffmpeg
plugin already handles this (it reads in 64K chunks, the same size as
the buffer here, so this buffering was effectively useless), and the
media extractor already runs the decoding in a separate thread thanks to
the chunk cache. So, we do not need an extra level of buffering here.

We should leave any extra buffering to the upper layers (BMediaTrack or
Media Extractor), if it's needed, as they would have much more control
on the creation of the data io object.

Change-Id: I65b67919da107c8b910dd08f8cdb8e3745af92c7
Reviewed-on: https://review.haiku-os.org/c/1588
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00:00
Adrien Destugues 727e49c611 Media Kit: remove MediaExtractor::Source
The idea was that the Media Extractor could wrap the original source
given by BMediaTrack, but all operations on the data go through
MediaExtractor anyway.
We could probably move ownership of the BDataIO completely into
MediaExtractor instead.

Change-Id: I846b34b543fb983e60f6adf86cb17e835303267b
Reviewed-on: https://review.haiku-os.org/c/1587
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00:00
Adrien Destugues 9b3aa126ba ffmpeg AVFormatReader: some cleanups.
- Stop using deprecated APIs
- Use BMediaFormat::Clear
- Remove hack for Protracker MOD as we have since got a MIME sniffing rule
- Clarify some comments and fix typos

Change-Id: Id495188cc44dc5af2820fe2a5236a983605b53c4
Reviewed-on: https://review.haiku-os.org/c/1586
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00:00
Augustin Cavalier e1b5172126 slab_private: Use malloc_etc/free_etc instead of the block allocator.
Under normal circumstances (slab allocator) this change is a no-op
because malloc_etc just calls block_alloc unconditionally. Under
the debug or guarded heap, this makes allocations go through that
instead.
2019-07-12 22:26:05 -04:00
PulkoMandy c90c06ef59 sparc: documentation about the boot process and useful commands
I didn't do anything with sparc for a few weeks (you don't want this
machine running when temperatures already are over 30°...), and I wastd
some time finding back some of the useful information, such as commands
to boot and debug, load and execution address of the bootloader program,
etc. So let's keep these in the documentation directory.

Change-Id: I293e0eea3063d410d66f9b2397c2cf0bdbfc6753
Reviewed-on: https://review.haiku-os.org/c/1581
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-13 01:29:05 +00:00
Adrien Destugues 076b19023f elf2aout: import from FreeBSD
The sparc openboot implementation can run executables in the a.out
format. We used to generate these using objcopy, but this does not work
anymore as binutils is deprecating a.out format support.

- Import elf2aout from FreeBSD
- Add some missing bits to our elf.h and have a copy of it in the build
  headers so it can be used to build elf2aout for the host platform
  (tested for Linux)
- Use it to generate the sparc haiku_loader
- Adjust the bootloader linker script to have two "program headers": one
  that is not loadable and contains the ELF headers, and the second one
  that is loadable and contains the actual code and data. Unlike
  objcopy, elf2aout relies only on the program headers to know what to
  put in its output file (sections are ignored), so this is required
  otherwise we end up with the ELF header nested inside the a.out file,
  and everything offset from the expected load address as a result.

Confirmed that this allows to build the loader and run it as far as
before, so I'm back to needing to implement some MMU support now.

FreeBSD commit: 7551d83c353e040b32c6ac205e577dbc5f2c8955

Change-Id: I90b48e578fa7f148aeddd8c5998fdddc5cfa73fa
Reviewed-on: https://review.haiku-os.org/c/1557
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-13 01:29:05 +00:00
Augustin Cavalier 19d1cffe33 FileTypes: Prevent a potential snprintf overflow. 2019-07-12 21:22:28 -04:00
Augustin Cavalier fa146526b6 kernel/system_info: Avoid malloc() in _user_get_cpu_info.
This is called 15-30 times per second (15 by Pulse, 30 by ActivityMonitor),
so we want to keep it as low-profile as is possible.
2019-07-12 21:22:09 -04:00
Augustin Cavalier 6d336fda4a block_cache: Compute the timeout dynamically based on write speeds.
We now record how long it takes to write a block (on average), and then
utilize this information to reduce the timeout write thread's timeout
(to 2 * block_count * average_block_time, so we don't completely
congest the drive.) Remove the "TODO" about the I/O scheduler;
this new logic will be just fine even under an I/O scheduler.

Note that this change goes both ways: while faster writes mean more
writes and quicker, slower writes will increase the timeout before
we do another one also. This then also guards against queueing
another write while one is already in progress, which was
not handled before.

Tested in KVM. Even on a SATA-backed spinning HDD, this reduces
the timeout to around *200ms* on average (!!), so a 10x improvement.
On a ramdisk, it reduces the timeout to *10-30ms* (!!!) on average,
so a 100-200x improvement, so this change will benefit everyone
but SSDs especially.

Since BFS inode and journal writes always go through the block_cache,
this very dramatically improves inode-related write performance.
The "stop and start" stutters when emptying or moving items to Trash
seem totally gone, among a lot of other things.

Change-Id: I41f46a6432ce1f50f896a853abdfe22dde0ba327
2019-07-12 21:19:47 -04:00
Augustin Cavalier 9d06690ede userland: Pass more sizes with ioctls where we can.
No "functional" change intended.
2019-07-11 23:41:52 -04:00
Augustin Cavalier 4c9e8f77e4 BootManager: Take explicit instead of implicit reference.
Passing a type& to a va-args turns it into a pointer as per
the Itanium ABI; but we shouldn't rely on such trickery.
Explicitly capture a reference to it instead.
2019-07-11 23:40:41 -04:00
Augustin Cavalier 1418cade55 file_systems: Pass size argument to ioctl in a lot more places. 2019-07-11 23:26:02 -04:00
Augustin Cavalier 394fba6684 unistd.h: POSIX_THREAD_ATTR_STACKADDR was implemented back in March. 2019-07-11 23:05:27 -04:00
Augustin Cavalier 42e3c6f978 KPath: Use an object_cache for the path buffers in the normal case.
This was (following the packagefs changes) the number-one (by call
count) consumer of malloc() during the boot -- 52866 calls, and 100%
of them either 1024 or 1025 bytes!

Virtually all of these are ephemeral (indeed, the object_cache
stats after a boot with this patch shows there is only a single slab
of 64 buffers allocated, and most of them unused), so this is
probably a significant performance boost.

Change-Id: I659f5707510cbfeafa735d35eea7b92732ead666
2019-07-11 22:52:10 -04:00
Simon South 9b72c3a089 kernel: Specify buffer size in certain ioctl calls.
In cases where scsi_periph checks the size of the buffer supplied to an
ioctl call (functionality added in commit ff4af513e1) this information
needs to be provided by the caller to avoid failure.

Fixes #15094.

Change-Id: I37f2776edbe977e9825ec1837fb763a3b2aa7220
Reviewed-on: https://review.haiku-os.org/c/1584
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-12 02:19:00 +00:00
Augustin Cavalier f4e3bb1cc6 kernel/team: Avoid allocating memory in _user_get_extended_team_info.
Terminal calls this multiple times a second per open tab, so it
was spamming up my malloc logs. I don't see any reason this 60-byte
structure needs to be on the heap; so, leave it on the stack instead.

Change-Id: I3f1ac14fe9bfec39cd0d5668c68f84467450b0c0
Reviewed-on: https://review.haiku-os.org/c/1580
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-12 02:00:47 +00:00
Augustin Cavalier 0e6ece91c8 block_cache: Use an object_cache for the cache_notifications.
cache_listeners are (following packagefs changes) the second-most
allocated object during the boot process, with 20799 on a
*minimum* image. Since they are used so extensively in BFS I/O,
making them object_cached for both performance and memory reasons
seems to make a lot of sense.

Change-Id: I6ef6c3e811c0c4189fea45ee7920131796c9e7c8
Reviewed-on: https://review.haiku-os.org/c/1577
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-12 02:00:27 +00:00
Augustin Cavalier 7a2f744859 block_cache: Free up blocks more aggressively on low memory conditions.
Only keep a single block when there is a "critical" low resource state.
Also don't bother doing anything if there are no unused blocks.

Change-Id: Ibfcbd8cb0beb1446083ca83030ea8e81c59a9628
Reviewed-on: https://review.haiku-os.org/c/1576
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-12 02:00:27 +00:00
Murai Takashi c91c69752b bin/setdecor: Fix -Wformat=
Change-Id: I8c50ec470098817fb17c626964e6e8158323550e
Reviewed-on: https://review.haiku-os.org/c/1517
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-07-11 21:36:29 +00:00
Murai Takashi 103e774d46 media-add-ons/usb_webcam: Fix -Wformat=
Change-Id: I85734ac3b01beb6e6a69ebda5050715c1fa1342d
Reviewed-on: https://review.haiku-os.org/c/1562
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-11 21:32:52 +00:00
Augustin Cavalier d387d8c5f4 packagefs: Use an object_cache in the TwoKeyAVLTree also.
TwoKeyAVLTree in packagefs is used for indexing. On a stock nightly,
just after boot there are 3 TwoKeyAVLTrees with just over 28000 items
each. So, this is another significant load off the generic allocator.
2019-07-10 00:33:55 -04:00
Augustin Cavalier 86e43bdf58 kernel: Add missing error checks to MemoryManager::_AllocateChunks. 2019-07-09 22:43:25 -04:00
Augustin Cavalier d230b5fdd3 packagefs: Use object caches for the most used node classes.
Slab statistics from KDL show that on a stock nightly image
(i.e. no additional packages besides the standards installed)
there are 43848 *objects* (not bytes) in the PackageNodeAttribute
cache, and 25090 in the PackageFile cache, so this seems more than
worth it.

The last commit seems to reduce memory usage at boot by about 1%,
this commit seems to not affect it at all; but it is a significant
performance optimization and on systems with more packages installed
the effect may be very noticeable.

Change-Id: I676a642ed6003f82b14396e1f02684575d899362
2019-07-09 22:38:59 -04:00
Augustin Cavalier 71e255cd31 packagefs: Remove PackageDataV1 from PackageData.
Now that we never access V1 packages in here, we don't need this.
This saves *24* bytes off the size of the class, which is
extremely significant as not only every PackageFile instance
has an instance of this class, but every PackageNode does too;
so the savings from this change is probably in the MB.
2019-07-08 23:29:40 -04:00
Jérôme Duval ed9a502a9a console: allow one user at a time.
Fixes #15142.

Change-Id: I203cb62a6640fcd5f674eeaf4aa1145e1e831ca6
Reviewed-on: https://review.haiku-os.org/c/1566
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-08 22:01:44 +00:00
Augustin Cavalier 2f6dc2bb79 kernel: Commit missing change to team.h.
If the buildbots were working, I would have been informed of this
about an hour after I committed it last night. But it seems they aren't.
Maybe kallisti5 will have some more incentive to work on that?
2019-07-08 17:58:43 -04:00
Jérôme Duval d2e519391f Messenger: style fix.
Change-Id: I5b1b7e745de91bd1bedbbbe13faf848fdd284785
Reviewed-on: https://review.haiku-os.org/c/1565
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-07-08 18:53:48 +00:00
Augustin Cavalier 5c97129ce3 kernel/team: Remove team_get_team_struct, add team_geteuid.
Thanks to Axel for the review.
2019-07-07 22:51:09 -04:00
Augustin Cavalier 05901d8963 kernel/cpu: Only root can enable or disable CPUs. 2019-07-04 17:00:28 -04:00
Augustin Cavalier 6f0aa00c6b kernel/user_debugger: Add missing permissions checks.
Part of #14961.
2019-07-04 16:54:50 -04:00
Augustin Cavalier a90e9ba7b9 kernel/team: Create a team_get_team_struct() function and utilize it.
Cleans up some lock/get/unlock sequences, and makes it possible
for external consumers to get team structs (which will be necessary
for permissions checks.)
2019-07-04 16:54:33 -04:00
Augustin Cavalier 6f6cba7c16 kernel/system_profiler: Do not allow non-root users access.
The single-team profiler can still be used without root access.
Part of #14961.
2019-07-04 16:41:36 -04:00