Commit Graph

5827 Commits

Author SHA1 Message Date
Pawel Dziepak
931ce674a9 scheduler: Fix core unassignment 2014-01-27 05:36:30 +01:00
Pawel Dziepak
7adce94d45 scheduler: Check team user time timers before entering scheduler
User timers may cause another thread to become ready in which case we would
like this to happen before scheduler_reschedule() chooses next thread to
be executed.
2014-01-27 05:36:30 +01:00
Pawel Dziepak
82bcd89b92 kernel: Add CPUSet::{Clear, Set}BitAtomic() functions 2014-01-24 13:59:58 +01:00
Pawel Dziepak
03451e4cc1 kernel: Fix deadlock with thread sending signal to itself
UserEvent can be fired from scheduler_reschedule() i.e. while holding current
thread scheduler_lock. If the current thread goes sleep and during reschedule
one of its timers sends a signel to it, then scheduler_enqueue_in_run_queue()
attempts to acquire again its scheduler_lock resulting in a deadlock.

There was also a minor issue with both scheduler_reschedule() and
scheduler_enqueue_in_run_queue() acquiring current CPU scheduler mode lock.
2014-01-24 13:59:58 +01:00
Stephan Aßmus
cb3dc4b2cf Uninitialized members CID 1162813 and 1162814 2014-01-22 17:41:51 +01:00
Pawel Dziepak
5d79095e44 scheduler: Do not update load of disabled cores 2014-01-22 03:04:01 +01:00
Pawel Dziepak
d01fa1ffe3 scheduler: Always update core load at thread reenqueue 2014-01-21 03:50:26 +01:00
Alexander von Gluck IV
fd78b6df3f ppc: Modernize atomic.S.
* Stub out atomic_get_and_set. This needs completed.
2014-01-19 23:39:19 -06:00
Alexander von Gluck IV
24f0b1e29e libroot: Drop volatile in syscall atomic functions
* Per 077c84eb27, atomics are no longer volatile.
* Was changed in SupportDefs.h, but no one told libroot
  that it was no-longer volatile.
2014-01-19 22:31:37 -06:00
Alexander von Gluck IV
749a60bf39 ppc: atomic is no longer volatile per 077c84eb27 2014-01-19 22:14:28 -06:00
Alexander von Gluck IV
14919567d1 kernel: Add more architecture code post-scheduler
* Fix incorrect cpu vendor name mapping
* Add additional CPU architectures
* Add additional CPU vendors
* Rework PowerPC arch_system_info passing
  PVR back for cpu model
2014-01-19 21:53:56 -06:00
Pawel Dziepak
59b9b52aaf scheduler: system_time() may be unreliable
On multisocket systems as well as under virtual machines logical CPUs
may use separate TSC. We could attempt to synchronize them what probably
would solve problems on multisocket systems. Unfortunately, when running
under hypervisor there is still a chance that TSC will get out of sync
again (e.g. cpufreq enabled on host when there is no invariant TSC). As
long as we use RDTSC as our main time source the scheduler must accept the
fact that time may go backwards (what isn't really a serious problem).
2014-01-20 03:22:04 +01:00
Pawel Dziepak
73db12ab31 kernel: Align user_thread objects to CACHE_LINE_SIZE 2014-01-20 03:22:04 +01:00
Alexander von Gluck IV
88c54b5485 kernel: Rework ppc (and m68k) atomic functions post-scheduler
* Make atomic function more like current x86
* Remove fake fallback atomic code for ppc as hardware spinlocks exist
2014-01-19 19:33:21 -06:00
Pawel Dziepak
cf87df8ba3 libroot: Fix gcc2 build 2014-01-20 00:54:52 +01:00
Pawel Dziepak
25dcdbc2b5 libroot: Avoid conflicts with legacy CPU and platform enums 2014-01-20 00:32:57 +01:00
Pawel Dziepak
9d80738d95 kernel: Fix NULL dereference in has_permission_to_signal 2014-01-19 19:35:13 +01:00
Ingo Weinhold
8540ec2446 Save previous session's debug syslog during boot
Add boot loader debug menu option "Save syslog from previous session
during boot". If enabled (defaults to true), the previous session's
debug syslog data is copy to a separate buffer and passed to the
kernel, which writes it back to the file /var/log/previous_syslog.
As long as Haiku still boots, this should now be the most convenient way
to retrieve the output from a kernel crash.
2014-01-19 10:46:00 +01:00
Pawel Dziepak
955e4cff94 scheduler: Weaken time slept assertion 2014-01-17 18:07:47 +01:00
Pawel Dziepak
d0f2d8282f Merge branch 'scheduler'
Conflicts:
	build/jam/packages/Haiku
	headers/os/kernel/OS.h
	headers/os/opengl/GLRenderer.h
	headers/private/shared/cpu_type.h
	src/add-ons/kernel/drivers/power/acpi_battery/acpi_battery.h
	src/bin/sysinfo.cpp
	src/bin/top.c
	src/system/kernel/arch/x86/arch_system_info.cpp
	src/system/kernel/port.cpp
2014-01-17 04:06:15 +01:00
Pawel Dziepak
0269dd284e Revert "scheduler: SCHEDULER_EXIT_FUNCTION() is not needed"
This reverts commit 667617ad043a4587d8d366d5192d9ad291cfa37a.

Scheduler profiler uses CPU local data to store function information, hence
arch_thread_context_switch() usually is not a problem. However, when
we switch to a new thread we end up scheduler_new_thread_entry() instead
of scheduler_reschedule() what may corrupt data collected by the profiler.
2014-01-17 01:55:42 +01:00
Pawel Dziepak
3dce49af0e scheduler: Cache quantum length 2014-01-17 01:55:42 +01:00
Pawel Dziepak
4835c216f7 scheduler: low_latency: Try to keep all cores busy 2014-01-17 01:55:42 +01:00
Pawel Dziepak
0d27a57cf1 scheduler: Fix divide by zero on CPU disable 2014-01-16 23:26:10 +01:00
Pawel Dziepak
f978518a52 scheudler: Cache ThreadData::IsCPUBound() result 2014-01-16 23:26:10 +01:00
Pawel Dziepak
b7d404c2df scheduler: Add ThreadData::{GetPriority, IsIdle, IsRealTime}() 2014-01-16 23:26:09 +01:00
Pawel Dziepak
093c220267 scheduler: Improve latencies 2014-01-16 23:26:09 +01:00
Pawel Dziepak
7f212f45c3 scheduler: Update used time when thread yields or sleeps 2014-01-16 23:26:09 +01:00
Pawel Dziepak
dd8a866adc libroot/x86: Fix indirect jump 2014-01-16 20:18:22 +01:00
Pawel Dziepak
79c9b824e4 libroot: sync() should not return any value 2014-01-16 20:18:22 +01:00
Jonathan Schleifer
9fc69d1b00 runtime_loader: Add __dso_handle.
The symbol is needed for global objects. Usually, GCC also requires
this, but for some reason, the linking error only occurs when using
Clang.

Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2014-01-13 19:35:34 +01:00
Jonathan Schleifer
d1c7f766fd glibc: Remove a ++ that was accidentally added.
Thanks to PulkoMandy for noticing!

Work towards bug #10396
2014-01-11 17:33:42 -06:00
Alexander von Gluck IV
4f357bc071 sysinfo: Improve x86 CPU information
* Displays standard CPUID, and shows what the
  internal CPUID used by OS.h *should* be.
* Should help out in identifying new CPU's
  as all end users have to do is run sysinfo
  to get the CPU info + value for OS.h
2014-01-11 16:14:22 -06:00
Jonathan Schleifer
38fee4c388 glibc: Remove nested function.
Nested functions are a (again, broken) GNU extension which is not
supported by Clang. It has been replaced by a bunch of gotos and a
variable that works as a return address.
2014-01-10 22:32:05 +01:00
Jonathan Schleifer
4683fcc35c glibc: Correctly create weak symbols. 2014-01-10 22:31:58 +01:00
Pawel Dziepak
082d3c1015 scheduler: Increase thread penalty at fork 2014-01-09 03:50:54 +01:00
Pawel Dziepak
a2634874ed scheduler: Estimate the load thread is able to produce
Previous implementation based on the actual load of each core and share
each thread has in that load turned up to be very problematic when
balancing load on very heavily loaded systems (i.e. more threads
consuming all available CPU time than there is logical CPUs).

The new approach is to estimate how much load would a thread produce
if it had all CPU time only for itself. Summing such load estimations
of each thread assigned to a given core we get a rank that contains
much more information than just simple actual core load.
2014-01-09 03:50:54 +01:00
Pawel Dziepak
772331c7cd scheduler: Introduce strong and weak priority penalties 2014-01-08 07:16:19 +01:00
Pawel Dziepak
d36098e043 scheduler: Keep track of the number of the ready threads 2014-01-08 05:05:25 +01:00
Pawel Dziepak
9c465cc83b scheduler: Improve recognition of CPU bound threads 2014-01-08 05:05:25 +01:00
Alexander von Gluck IV
aa4b5749d6 runtime_loader: Detect and trigger on PE binaries
* Previously PE binaries would trigger the "incorrectly
  executable" dialog. Now we get a special message for
  B_LEGACY_EXECUTABLE and B_UNKNOWN_EXECUTABLE
* Legacy at the moment is a R3 x86 PE binary. This could
  be extended to gcc2 binaries someday far, far, down the
  road though
* The check for legacy is based on a PE flag I see
  set on every R3 binary (that isn't set on dos ones)
* Unknown is something we know *is* an executable, but
  can't do anything with (such as an MSDOS or Windows
  application)
* No performance drops as we do the PE scan last
* Tested on x86 and x86_gcc2
2014-01-07 19:38:07 -06:00
Pawel Dziepak
c2a02dee65 kernel: Relax cpu_ent::interrupt_time locking
The value isn't accessed by the other CPUs and all writes and reads are
done with interrupts disabled.
2014-01-07 02:12:39 +01:00
Pawel Dziepak
c37c2aa45f scheduler: Improve should_rebalance 2014-01-07 01:11:42 +01:00
Pawel Dziepak
4ca31ac964 kernel: Fix ABA problem in try_acquire_read_spinlock() 2014-01-06 21:03:42 +01:00
Pawel Dziepak
bae6d7196a scheduler: Fix SchedulerModeLocker 2014-01-06 09:08:53 +01:00
Pawel Dziepak
a5f45afa6c scheduler: Remove unnecessary check against disabled CPU 2014-01-06 09:08:53 +01:00
Pawel Dziepak
8cf8e53774 kernel/x86: Inline atomic functions and memory barriers 2014-01-06 09:08:53 +01:00
Pawel Dziepak
8235bbc996 scheduler: Improve thread creation performance 2014-01-06 01:22:53 +01:00
Pawel Dziepak
cb66faef24 scheduler: Work around GCC2 limitations in function inlining
GCC2 won't inline a function if it is used before its definition.
2014-01-06 01:22:53 +01:00
Pawel Dziepak
9e99bf6085 scheduler: SCHEDULER_EXIT_FUNCTION() is not needed 2014-01-03 20:15:13 +01:00