]> Zhao Yanbai Git Server - minix.git/log
minix.git
13 years agostdio/fclose.c: reset _buf
Ben Gras [Tue, 2 Nov 2010 22:01:47 +0000 (22:01 +0000)]
stdio/fclose.c: reset _buf

  - if the stream gets freopen()ed, avoid buffer being seen as valid

13 years agokernel: limit stacktrace depth to 50.
Ben Gras [Tue, 2 Nov 2010 21:27:04 +0000 (21:27 +0000)]
kernel: limit stacktrace depth to 50.

  - Unlikely to discard useful information and avoids long
    system lockups on machines configured to print system output to serial.

13 years ago/proc/cpuinfo
Tomas Hruby [Tue, 26 Oct 2010 21:08:00 +0000 (21:08 +0000)]
/proc/cpuinfo

- when /proc/cpuinfo is read procfs retrievs information about cpus
  from the kernel, formats it and prints it

13 years agosys_getcpuinfo()
Tomas Hruby [Tue, 26 Oct 2010 21:07:50 +0000 (21:07 +0000)]
sys_getcpuinfo()

13 years agoKernel keeps information about each cpu
Tomas Hruby [Tue, 26 Oct 2010 21:07:27 +0000 (21:07 +0000)]
Kernel keeps information about each cpu

- kernel maintains a cpu_info array which contains various
  information about each cpu as filled when each cpu boots

- the information contains idetification, features etc.

13 years agoSMP - reduced TLB flushing
Tomas Hruby [Mon, 25 Oct 2010 16:21:23 +0000 (16:21 +0000)]
SMP - reduced TLB flushing

- flush TLB of processes only if the page tables has been changed and
  the page tables of this process are already loaded on this cpu which
  means that there might be stale entries in TLB. Until now SMP was
  always flushing TLB to make sure everything is consistent.

13 years agoFixed unixbench Run script
Tomas Hruby [Mon, 25 Oct 2010 08:32:14 +0000 (08:32 +0000)]
Fixed unixbench Run script

- perl path has changed

13 years agoif verbore=1 tell us who registers which irq handler
Tomas Hruby [Thu, 21 Oct 2010 17:07:12 +0000 (17:07 +0000)]
if verbore=1 tell us who registers which irq handler

- a useful piece of information when debugging

13 years agoACPI pci-to-pci bridges
Tomas Hruby [Thu, 21 Oct 2010 17:07:09 +0000 (17:07 +0000)]
ACPI pci-to-pci bridges

- every pci device which implements _PRT acpi method is considered to
  be a pci-to-pci bridge

- acpi driver constructs a hierarchy of pci-to-pci bridges

- when pci driver identifies a pci-to-pci bridge it tells acpi driver
  what is the primary and the secondary bus for this device

- when pci requests IRQ routing information from acpi, it passes the
  bus number too to be able to identify the device accurately

13 years agoZero no more hardwired as BSP apic id
Tomas Hruby [Thu, 21 Oct 2010 17:07:07 +0000 (17:07 +0000)]
Zero no more hardwired as BSP apic id

- the BSP apic id is written in the io apic redirection entries to
  deliver the interrupts to BSP

13 years agoVM implicitly aligns mappings to a page
Tomas Hruby [Thu, 21 Oct 2010 17:07:05 +0000 (17:07 +0000)]
VM implicitly aligns mappings to a page

- problem when a PCI BAR is not aligned

- together with  David v. Moolenboek

13 years agosingle shot timer interrupts fix
Tomas Hruby [Thu, 21 Oct 2010 17:07:01 +0000 (17:07 +0000)]
single shot timer interrupts fix

- accidentaly this wasn't part of the SMP merge and the implementation
  remained uncomplete with the timer keeping ticking periodically

- APIC timer is set for a signel shot and restarted everytime it
  expires. This way we can keep the AP's trully idle

- the timer is restarted a little later before leaving to userspace

- LAPIC_TIMER_ICR is written before LAPIC_LVTTR so the newest value is
  used

13 years agospurious and error interrupt apic handlers
Tomas Hruby [Tue, 19 Oct 2010 17:07:21 +0000 (17:07 +0000)]
spurious and error interrupt apic handlers

- fixed spurious and error interrupt handlers

- not to hog the system the warning isn't reported every time, just
  once every 100 times, similarly for the spurious PIC interrupts

13 years agoBSP apic id
Tomas Hruby [Tue, 19 Oct 2010 17:07:19 +0000 (17:07 +0000)]
BSP apic id

- BSP apic id used uninitialized causes problems

13 years agopanic in dummy apic handlers
Tomas Hruby [Tue, 19 Oct 2010 17:07:17 +0000 (17:07 +0000)]
panic in dummy apic handlers

- as panic can do the same as printf now, let's rather panic when a
  dummy apic interrupt vector handler is hit

13 years agoFixed BKL statistics
Tomas Hruby [Tue, 19 Oct 2010 17:07:11 +0000 (17:07 +0000)]
Fixed BKL statistics

13 years agoPCI driver debug output fix
Tomas Hruby [Tue, 19 Oct 2010 10:30:15 +0000 (10:30 +0000)]
PCI driver debug output fix

- bus number (busnr) must be used instead of internal busind

13 years agoA klib.S include fix
Tomas Hruby [Fri, 15 Oct 2010 22:21:01 +0000 (22:21 +0000)]
A klib.S include fix

- by Antoine Leca

13 years agoacpi driver Makefile fix
Tomas Hruby [Fri, 15 Oct 2010 22:20:01 +0000 (22:20 +0000)]
acpi driver Makefile fix

- by Antoine Leca

13 years ago<minix/hash.h>
Ben Gras [Fri, 15 Oct 2010 11:25:40 +0000 (11:25 +0000)]
<minix/hash.h>

13 years agovm - hash table for block cache
Ben Gras [Fri, 15 Oct 2010 09:10:14 +0000 (09:10 +0000)]
vm - hash table for block cache

13 years agovm - fix for not placing region outside requested mmap addr
Ben Gras [Fri, 15 Oct 2010 09:09:29 +0000 (09:09 +0000)]
vm - fix for not placing region outside requested mmap addr

13 years agoe1000: add 82574L ethernet adapter (thx Niek for your comments)
Erik van der Kouwe [Fri, 15 Oct 2010 08:53:22 +0000 (08:53 +0000)]
e1000: add 82574L ethernet adapter (thx Niek for your comments)

13 years agoprofile command - correct logic error
Ben Gras [Tue, 12 Oct 2010 11:26:47 +0000 (11:26 +0000)]
profile command - correct logic error

  - this caused profile to complain about frequency when
    no command (start, stop) was given.

13 years agomfs - no more WRITE_IMMED
Ben Gras [Mon, 11 Oct 2010 15:35:43 +0000 (15:35 +0000)]
mfs - no more WRITE_IMMED

13 years agochange SSIZE_MAX to INT_MAX instead of 32767.
Ben Gras [Sun, 10 Oct 2010 22:33:23 +0000 (22:33 +0000)]
change SSIZE_MAX to INT_MAX instead of 32767.

With this change, suggested by Gautam Tirumala, ports for pkgin and
pkg_install are cleaner and so easier to upstream.  Presumably other
ports will be smoother too.

There doesn't seem to be a reason SSIZE_MAX was so small to begin with.

13 years agoFix select-related bugs: missing cancellations led to potentially forgetting notifies...
Erik van der Kouwe [Fri, 8 Oct 2010 12:50:52 +0000 (12:50 +0000)]
Fix select-related bugs: missing cancellations led to potentially forgetting notifies, especially in the case of async drivers

13 years agoAdd libdriver support for async ioctl replies
Erik van der Kouwe [Fri, 8 Oct 2010 09:33:18 +0000 (09:33 +0000)]
Add libdriver support for async ioctl replies

13 years agovm optimisation - maintain hint for new virtual region position.
Ben Gras [Thu, 7 Oct 2010 10:04:05 +0000 (10:04 +0000)]
vm optimisation - maintain hint for new virtual region position.

13 years agoinclude <sys/cdefs.h> in <minix/sysutil> (clang fix)
Ben Gras [Wed, 6 Oct 2010 13:09:49 +0000 (13:09 +0000)]
include <sys/cdefs.h> in <minix/sysutil> (clang fix)

13 years agoFix warnings due to missing __dead attribute on exit
Erik van der Kouwe [Tue, 5 Oct 2010 07:25:47 +0000 (07:25 +0000)]
Fix warnings due to missing __dead attribute on exit

13 years agoFix warnings in libmthread
Erik van der Kouwe [Mon, 4 Oct 2010 20:19:40 +0000 (20:19 +0000)]
Fix warnings in libmthread

13 years agokernel: fix idle time accounting.
Ben Gras [Mon, 4 Oct 2010 19:12:55 +0000 (19:12 +0000)]
kernel: fix idle time accounting.

13 years agomake system server vprintf check for NULL
Erik van der Kouwe [Mon, 4 Oct 2010 17:53:18 +0000 (17:53 +0000)]
make system server vprintf check for NULL

13 years agofflush is neither needed nor allowed in system srvers, which is where SEF is used
Erik van der Kouwe [Mon, 4 Oct 2010 17:38:53 +0000 (17:38 +0000)]
fflush is neither needed nor allowed in system srvers, which is where SEF is used

13 years agoAdd include/memory.h
Arun Thomas [Mon, 4 Oct 2010 13:37:46 +0000 (13:37 +0000)]
Add include/memory.h

Some ports expect that it exists.

13 years agodis386 - a disassembler for ack
Ben Gras [Mon, 4 Oct 2010 13:26:53 +0000 (13:26 +0000)]
dis386 - a disassembler for ack

  - it can disassemble object files (dis386o) and executables
    (dis386a)
  - only useful for as long as we still have ack

13 years agovm: optimisation: avl tree for virtual regions
Ben Gras [Mon, 4 Oct 2010 11:41:10 +0000 (11:41 +0000)]
vm: optimisation: avl tree for virtual regions

  - regions were preivous stored in a linked list, as 'normally'
    there are just 2 or 3 (text, data, stack), but that's slow
    if lots of regions are made with mmap()

  - measurable performance improvement with gcc and clang

13 years agovm: don't check the range of memory during sanity checking
Ben Gras [Mon, 4 Oct 2010 11:38:33 +0000 (11:38 +0000)]
vm: don't check the range of memory during sanity checking

  - too many false positives due to memory that is mapped in
    legitimately (acpi, i/o devices)

13 years agoRemove urlget
Arun Thomas [Sat, 2 Oct 2010 18:24:53 +0000 (18:24 +0000)]
Remove urlget

This patch gets rid of urlget. It's not used for anything now, since pkgin
uses fetch.

Arun

13 years agomake the asynsend table size NPROCS-dependent.
Ben Gras [Fri, 1 Oct 2010 14:39:04 +0000 (14:39 +0000)]
make the asynsend table size NPROCS-dependent.

this is a fix for e.g. the situation where lots of processes die
instantly, and PM has to send an asyn msg for each one to VFS, and
panics if there are too many. there are likely more situations in
which this table should be dependent on the no. of processes.

reported by pikpik on #minix3.

13 years agoRevamp the mthread library and update test59
Thomas Veerman [Thu, 30 Sep 2010 13:44:13 +0000 (13:44 +0000)]
Revamp the mthread library and update test59

Before, the 'main thread' of a process was never taken into account anywhere in
the library, causing mutexes not to work properly (and consequently, neither
did the condition variables). For example, if the 'main thread' (that is, the
thread which is started at the beginning of a process; not a spawned thread by
the library) would lock a mutex, it wasn't actually locked.

13 years agohgfs: do not return negative file sizes in stat (reported by Antoine Leca)
David van Moolenbroek [Mon, 27 Sep 2010 13:19:25 +0000 (13:19 +0000)]
hgfs: do not return negative file sizes in stat (reported by Antoine Leca)

14 years agoWatchdog and kernel profiling for AMD
Tomas Hruby [Thu, 23 Sep 2010 14:42:30 +0000 (14:42 +0000)]
Watchdog and kernel profiling for AMD

- a different set of MSRs and performance counters is used on AMD

- when initializing NMI watchdog the test for Intel architecture
  performance counters feature only applies to Intel now

- NMI is enabled if the CPU belongs to a family which has the
  performance counters that we use

14 years agoneg64() makes a 64bit integer negative
Tomas Hruby [Thu, 23 Sep 2010 14:42:26 +0000 (14:42 +0000)]
neg64() makes a 64bit integer negative

- neg64(a) == -a

- although we only support 64 bit unsigned arithmetics sometimes it's good to
  have a 2-complement negative number

14 years agoCPU type detection
Tomas Hruby [Thu, 23 Sep 2010 14:42:19 +0000 (14:42 +0000)]
CPU type detection

- sometimes the system needs to know precisely on what type of cpu is
  running. The cpu type id detected during arch specific
  initialization and kept in the machine structure for later use.

- as a side-effect the information is exported to userland

14 years agocprofalyze - perl path fix.
Ben Gras [Thu, 23 Sep 2010 13:49:52 +0000 (13:49 +0000)]
cprofalyze - perl path fix.

14 years agoLong (32 char) symbol names in sprofalyze
Tomas Hruby [Thu, 23 Sep 2010 10:49:58 +0000 (10:49 +0000)]
Long (32 char) symbol names in sprofalyze

14 years agosprofalyze only warns when executables don't exist
Tomas Hruby [Thu, 23 Sep 2010 10:49:57 +0000 (10:49 +0000)]
sprofalyze only warns when  executables don't exist

- e.g. when acpi is not compiled, now we can include it

- the script still fails if a symbol from a non existent binary is
  found in the profile log

14 years agosprofalyze detects what nm to use
Tomas Hruby [Thu, 23 Sep 2010 10:49:55 +0000 (10:49 +0000)]
sprofalyze detects what nm to use

14 years agoBusy idle loop when profiling
Tomas Hruby [Thu, 23 Sep 2010 10:49:52 +0000 (10:49 +0000)]
Busy idle loop when profiling

- the Intel architecture cycle counter (performance counter) does not
  count when the CPU is idle therefore we use busy loop instead of
  halting the cpu when there is nothing to schedule

- the downside is that handling interrupts may be accounted as idle
  time if a sample is taken before we get out of the nested trap and
  pick a new process

14 years agosprofile exports kernel sample entries
Tomas Hruby [Thu, 23 Sep 2010 10:49:50 +0000 (10:49 +0000)]
sprofile exports kernel sample entries

- in case of kernel hit while proc_ptr is IDLE, account for idle time
  instead of taking kernel sample

14 years agoInternal 64M buffer for profiling
Tomas Hruby [Thu, 23 Sep 2010 10:49:48 +0000 (10:49 +0000)]
Internal 64M buffer for profiling

- when profiling is compiled in kernel includes a 64M buffer for
  sample

- 64M is the default used by profile tool as its buffer

- when using nmi profiling it is not possible to always copy sample
  stright to userland as the nmi may (and does) happen in bad moments

- reduces sampling overhead as samples are copied out only when
  profiling stops

14 years agoNMI sampling
Tomas Hruby [Thu, 23 Sep 2010 10:49:45 +0000 (10:49 +0000)]
NMI sampling

- if profile --nmi kernel uses NMI watchdog based sampling based on
  Intel architecture performance counters

- using NMI makes kernel profiling possible

- watchdog kernel lockup detection is disabled while sampling as we
  may get unpredictable interrupts in kernel and thus possibly many
  false positives

- if watchdog is not enabled at boot time, profiling enables it and
  turns it of again when done

14 years agoThe profile utility can set the sprofiling mode
Tomas Hruby [Thu, 23 Sep 2010 10:49:42 +0000 (10:49 +0000)]
The profile utility can set the sprofiling mode

- profile --nmi | --rtc sets the profiling mode

- --rtc is default, uses BIOS RTC, cannot profile kernel the presetted
  frequency values apply

- --nmi is only available in APIC mode as it uses the NMI watchdog, -f
  allows any frequency in Hz

- both modes use compatible data structures

14 years agoNew profile protocol
Tomas Hruby [Thu, 23 Sep 2010 10:49:39 +0000 (10:49 +0000)]
New profile protocol

- when kernel profiles a process for the first time it saves an entry
  describing the process [endpoint|name]

- every profile sample is only [endpoint|pc]

- profile utility creates a table of endpoint <-> name relations and
  translates endpoints of samples into names and writing out the
  results to comply with the processing tools

- "task" endpoints like KERNEL are negative thus we must cast it to
  unsigned when hashing

14 years ago32bit process flags
Tomas Hruby [Thu, 23 Sep 2010 10:49:36 +0000 (10:49 +0000)]
32bit process flags

- we are running out of space in 16bit flags

14 years agolibsys: tsc_to_micros support for large TSC delta values
David van Moolenbroek [Thu, 23 Sep 2010 09:26:42 +0000 (09:26 +0000)]
libsys: tsc_to_micros support for large TSC delta values

14 years agoGet rid of erroneous define
Thomas Veerman [Thu, 23 Sep 2010 08:52:49 +0000 (08:52 +0000)]
Get rid of erroneous define

14 years agoincludes - minor compile fixes.
Ben Gras [Wed, 22 Sep 2010 14:31:51 +0000 (14:31 +0000)]
includes - minor compile fixes.

14 years agoenable_fpu_exception() - only write cr0 if bit isn't already on.
Ben Gras [Wed, 22 Sep 2010 14:31:06 +0000 (14:31 +0000)]
enable_fpu_exception() - only write cr0 if bit isn't already on.

(NMI profiling results indicate this both is relatively expensive and
happens a lot unnecessarily if the fpu is in use.)

14 years agoNo need to scan devices in PIC mode
Tomas Hruby [Wed, 22 Sep 2010 08:01:43 +0000 (08:01 +0000)]
No need to scan devices in PIC mode

14 years agoRemove unnecessary TLB flushes
Tomas Hruby [Wed, 22 Sep 2010 08:01:36 +0000 (08:01 +0000)]
Remove unnecessary TLB flushes

- this should be only for SMP

14 years agoUPDATING - warning about /usr/gnu/lib
Ben Gras [Tue, 21 Sep 2010 12:46:55 +0000 (12:46 +0000)]
UPDATING - warning about /usr/gnu/lib

14 years agoAdd libmthread and test59 to test the implementation
Thomas Veerman [Tue, 21 Sep 2010 12:22:38 +0000 (12:22 +0000)]
Add libmthread and test59 to test the implementation

14 years agoinclude minix 'all' package.
Ben Gras [Mon, 20 Sep 2010 15:09:32 +0000 (15:09 +0000)]
include minix 'all' package.

14 years agolib/libsys/gcov.c - fix gcc warning
Ben Gras [Mon, 20 Sep 2010 11:36:41 +0000 (11:36 +0000)]
lib/libsys/gcov.c - fix gcc warning

14 years ago . forget obsolete /usr/local/bin in $PATH
Ben Gras [Mon, 20 Sep 2010 11:07:53 +0000 (11:07 +0000)]
  . forget obsolete /usr/local/bin in $PATH
  . update release.sh's notion of where packages are
  . update release.sh's notion of how many files are on root
    as -xdev won't work anymore to separate /usr from /

14 years agoFixed comments in watchdog
Tomas Hruby [Sun, 19 Sep 2010 23:23:44 +0000 (23:23 +0000)]
Fixed comments in watchdog

14 years agofix - forgotten debug print
Tomas Hruby [Sun, 19 Sep 2010 15:54:31 +0000 (15:54 +0000)]
fix - forgotten debug print

14 years agoUserspace scheduling - exporting stats
Tomas Hruby [Sun, 19 Sep 2010 15:52:12 +0000 (15:52 +0000)]
Userspace scheduling - exporting stats

- contributed by Bjorn Swift

- adds process accounting, for example counting the number of messages
  sent, how often the process was preemted and how much time it spent
  in the run queue. These statistics, along with the current cpu load,
  are sent back to the user-space scheduler in the Out Of Quantum
  message.

- the user-space scheduler may choose to make use of these statistics
  when making scheduling decisions. For isntance the cpu load becomes
  especially useful when scheduling on multiple cores.

14 years agopkgsrc: save binary packages in arch- and osversion dependent dir.
Ben Gras [Fri, 17 Sep 2010 14:31:54 +0000 (14:31 +0000)]
pkgsrc: save binary packages in arch- and osversion dependent dir.

14 years agoFix failing unmount attempt at shutdown after running test58
Thomas Veerman [Fri, 17 Sep 2010 09:34:36 +0000 (09:34 +0000)]
Fix failing unmount attempt at shutdown after running test58

14 years agoanother sprofalyze.pl update
David van Moolenbroek [Fri, 17 Sep 2010 09:25:10 +0000 (09:25 +0000)]
another sprofalyze.pl update

14 years agosprofalyze.pl update
Tomas Hruby [Fri, 17 Sep 2010 08:09:04 +0000 (08:09 +0000)]
sprofalyze.pl update

14 years agoFixed FPU for single cpu
Tomas Hruby [Thu, 16 Sep 2010 09:51:45 +0000 (09:51 +0000)]
Fixed FPU for single cpu

14 years agoapic_timer_x
Tomas Hruby [Thu, 16 Sep 2010 07:18:47 +0000 (07:18 +0000)]
apic_timer_x

- set the apic_timer_x factor variable to slowdown apic timer in
  virtual machines

14 years agoFixed unintentionally removed world target in Makefile
Tomas Hruby [Wed, 15 Sep 2010 14:18:39 +0000 (14:18 +0000)]
Fixed unintentionally removed world target in Makefile

14 years agoSMP - all process have pagetables
Tomas Hruby [Wed, 15 Sep 2010 14:11:30 +0000 (14:11 +0000)]
SMP - all process have pagetables

- all processes have private pagetables if CONFIG_SMP is set

- this make possible to safely schedule PM, RS, VFS anywhere

14 years agoSMP - lazy FPU
Tomas Hruby [Wed, 15 Sep 2010 14:11:25 +0000 (14:11 +0000)]
SMP - lazy FPU

- when a process is migrated to a different CPU it may have an active
  FPU context in the processor registers. We must save it and migrate
  it together with the process.

14 years agoSMP - can boot even if some cpus fail to boot
Tomas Hruby [Wed, 15 Sep 2010 14:11:21 +0000 (14:11 +0000)]
SMP - can boot even if some cpus fail to boot

- EBADCPU is returned is scheduler tries to run a process on a CPU
  that either does not exist or isn't booted

- this change was originally meant to deal with stupid cpuid
  instruction which provides totally useless information about
  hyper-threading and MPS which does not deal with ht at all. ACPI
  provides correct information. If ht is turned off it looks like some
  CPUs failed to boot.  Nevertheless this patch may be handy for
  testing/benchmarking in the future.

14 years agoSMP - Make sure that VM does not change pt of a process while kernel copies
Tomas Hruby [Wed, 15 Sep 2010 14:11:19 +0000 (14:11 +0000)]
SMP - Make sure that VM does not change pt of a process while kernel copies

14 years agoSMP - Force TLB flush before scheduling a process
Tomas Hruby [Wed, 15 Sep 2010 14:11:17 +0000 (14:11 +0000)]
SMP - Force TLB flush before scheduling a process

- this makes sure that each process always run with updated TLB

- this is the simplest way how to achieve the consistency. As it means
  significant performace degradation when not require, this is nto the
  final solution and will be refined

14 years agoSMP - Process is stopped when VM modifies the page tables
Tomas Hruby [Wed, 15 Sep 2010 14:11:12 +0000 (14:11 +0000)]
SMP - Process is stopped when VM modifies the page tables

- RTS_VMINHIBIT flag is used to stop process while VM is fiddling with
  its pagetables

- more generic way of sending synchronous scheduling events among cpus

- do the x-cpu smp sched calls only if the target process is runnable.
  If it is not, it cannot be running and it cannot become runnable
  this CPU holds the BKL

14 years agoSMP - runctl() can stop across cpus
Tomas Hruby [Wed, 15 Sep 2010 14:11:09 +0000 (14:11 +0000)]
SMP - runctl() can stop across cpus

- if stopping a process that runs on a different CPU we tell the
  remote cpu to do that

14 years agoSMP - Single shot local timer
Tomas Hruby [Wed, 15 Sep 2010 14:11:06 +0000 (14:11 +0000)]
SMP - Single shot local timer

- APIC timer always reprogrammed if expired

- timer tick never happens when in kernel => never immediate return
  from userspace to kernel because of a buffered interrupt

- renamed argument to lapic_set_timer_one_shot()

- removed arch_ prefix from timer functions

14 years agoSMP - Compiles for both single and multi processor again
Tomas Hruby [Wed, 15 Sep 2010 14:11:03 +0000 (14:11 +0000)]
SMP - Compiles for both single and multi processor again

- this patch adds various fixes as some of the previous patches break
  compilations without CONFIG_SMP being set

14 years agoSMP - Print cpu of the process
Tomas Hruby [Wed, 15 Sep 2010 14:11:01 +0000 (14:11 +0000)]
SMP - Print cpu of the process

- adds '4' to print processes assigned to each cpu without printing
  the process it is blocked on (a lightweight '1')

14 years agoSMP - trully idle APs
Tomas Hruby [Wed, 15 Sep 2010 14:10:57 +0000 (14:10 +0000)]
SMP - trully idle APs

- any cpu can use smp_schedule() to tell another cpu to reschedule

- if an AP is idle, it turns off timer as there is nothing to
  preempt, no need to wakeup just to go back to sleep again

- if a cpu makes a process runnable on an idle cpu, it must wake it up
  to reschedule

14 years agoSMP - BSP halts APs before shutting down
Tomas Hruby [Wed, 15 Sep 2010 14:10:54 +0000 (14:10 +0000)]
SMP - BSP halts APs before shutting down

14 years agoSMP - Balancing run queues for SMP
Tomas Hruby [Wed, 15 Sep 2010 14:10:51 +0000 (14:10 +0000)]
SMP - Balancing run queues for SMP

- it preempts running processes though :( this is not the final
  solution

14 years agoSMP - Changed prototype of sys_schedule()
Tomas Hruby [Wed, 15 Sep 2010 14:10:42 +0000 (14:10 +0000)]
SMP - Changed prototype of sys_schedule()

- sys_schedule can change only selected values, -1 means that the
  current value should be kept unchanged. For instance we mostly want
  to change the scheduling quantum and priority but we want to keep
  the process at the current cpu

- RS can hand off its processes to scheduler

- service can read the destination cpu from system.conf

- RS can pass the information farther

14 years agoSMP - BKL statistics
Tomas Hruby [Wed, 15 Sep 2010 14:10:37 +0000 (14:10 +0000)]
SMP - BKL statistics

- pressing 'B' on the serial cnsole prints statistics for BKL per cpu.

- 'b' resets the counters

- it presents number of cycles each CPU spends in kernel, how many
  cycyles it spends spinning while waiting for the BKL

- it shows optimistic estimation in how many cases we get the lock
  immediately without spinning. As the test is not atomic the lock may
  be already held by some other cpu before we actually try to acquire
  it.

14 years agoSMP - Free PDE slots are split among CPU
Tomas Hruby [Wed, 15 Sep 2010 14:10:36 +0000 (14:10 +0000)]
SMP - Free PDE slots are split among CPU

- cross-address space copies use these slots to map user memory for
  kernel. This avoid any collisions between CPUs

- well, we only have a single CPU running at a time, this is just to
  be safe for the future

14 years agoSMP - Scheduler can assign process to a cpu
Tomas Hruby [Wed, 15 Sep 2010 14:10:33 +0000 (14:10 +0000)]
SMP - Scheduler can assign process to a cpu

- machine information contains the number of cpus and the bsp id

- a dummy SMP scheduler which keeps all system processes on BSP and
  all other process on APs. The scheduler remembers how many processes
  are assigned to each CPU and always picks the one with the least
  processes for a new process.

14 years agoSMP - APs are fully enabled
Tomas Hruby [Wed, 15 Sep 2010 14:10:30 +0000 (14:10 +0000)]
SMP - APs are fully enabled

- apic_send_ipi() to send inter-processor interrupts (IPIs)

- APIC IPI schedule and halt handlers to signal x-cpu that a cpu shold
  reschedule or halt

- various little changes to let APs run

- no processes are scheduled at the APs and therefore they are idle
  except being interrupted by a timer time to time

14 years agoSMP - CPU local cycles accounting
Tomas Hruby [Wed, 15 Sep 2010 14:10:27 +0000 (14:10 +0000)]
SMP - CPU local cycles accounting

- tsc_ctr_switch is made cpu local

- although an x86 specific variable it must be declared globaly as the
  cpulocal implementation does not allow otherwise

14 years agoSMP - proc_ptr and bill_ptr initialization
Tomas Hruby [Wed, 15 Sep 2010 14:10:24 +0000 (14:10 +0000)]
SMP - proc_ptr and bill_ptr initialization

- they should point somewhere

14 years agoSMP - CPU local idle stub
Tomas Hruby [Wed, 15 Sep 2010 14:10:21 +0000 (14:10 +0000)]
SMP - CPU local idle stub

- each CPU has its own pseudo idle process and its structure

- idle cycles accounting is agregated when exporting to userspace

14 years agoSMP - CPU local run queues
Tomas Hruby [Wed, 15 Sep 2010 14:10:18 +0000 (14:10 +0000)]
SMP - CPU local run queues

- each CPU has its own runqueues

- processes on BSP are put on the runqueues later after a switch to
  the final stack when cpuid works to avoid special cases

- enqueue() and dequeue() use the run queues of the cpu the process is
  assigned to

- pick_proc() uses the local run queues

- printing of per-CPU run queues ('2') on serial console