Tomas Hruby [Wed, 15 Sep 2010 14:10:07 +0000 (14:10 +0000)]
SMP - The slave CPUs turn paging on
- APs wait until BSP turns paging on, it is not possible to safely
execute any code on APs until we can turn paging on as well as it
must be done synchronously everywhere
Tomas Hruby [Wed, 15 Sep 2010 14:10:03 +0000 (14:10 +0000)]
SMP - Big kernel lock (BKL)
- to isolate execution inside kernel we use a big kernel lock
implemented as a spinlock
- the lock is acquired asap after entering kernel mode and released as
late as possible. Only one CPU as a time can execute the core kernel
code
- measurement son real hw show that the overhead of this lock is close
to 0% of kernel time for the currnet system
- the overhead of this lock may be as high as 45% of kernel time in
virtual machines depending on the ratio between physical CPUs
available and emulated CPUs. The performance degradation is
significant
Tomas Hruby [Wed, 15 Sep 2010 14:09:52 +0000 (14:09 +0000)]
SMP - We boot APs
- kernel detects CPUs by searching ACPI tables for local apic nodes
- each CPU has its own TSS that points to its own stack. All cpus boot
on the same boot stack (in sequence) but switch to its private stack
as soon as they can.
- final booting code in main() placed in bsp_finish_booting() which is
executed only after the BSP switches to its final stack
- apic functions to send startup interrupts
- assembler functions to handle CPU features not needed for single cpu
mode like memory barries, HT detection etc.
- new files kernel/smp.[ch], kernel/arch/i386/arch_smp.c and
kernel/arch/i386/include/arch_smp.h
- 16-bit trampoline code for the APs. It is executed by each AP after
receiving startup IPIs it brings up the CPUs to 32bit mode and let
them spin in an infinite loop so they don't do any damage.
- implementation of kernel spinlock
- CONFIG_SMP and CONFIG_MAX_CPUS set by the build system
Tomas Hruby [Tue, 7 Sep 2010 07:18:11 +0000 (07:18 +0000)]
APIC mode uses IO APICs
- kernel turns on IO APICs if no_apic is _not_ set or is equal 0
- pci driver must use the acpi driver to setup IRQ routing otherwise
the system cannot work correctly except systems like KVM that use
only legacy (E)ISA IRQs 0-15
Tomas Hruby [Thu, 2 Sep 2010 15:44:38 +0000 (15:44 +0000)]
PCI driver uses ACPI if APIC is used.
- PCI must query ACPI, if (IO)APIC is in use, for the routing
information and change the ILR (interrupt line register) of each
device accordingly so drivers use the right IRQ.
Tomas Hruby [Thu, 2 Sep 2010 15:44:04 +0000 (15:44 +0000)]
ACPI driver
- 99% of the code is Intel's ACPICA. The license is compliant with BSD
and GNU and virtually all systems that use ACPI use this code, For
instance it is part of the Linux kernel.
- The only minix specific files are
acpi.c
osminixxf.c
platform/acminix.h
and
include/minix/acpi.h
- At the moment the driver does not register interrupt hooks which I
believe is mainly for handling PnP, events like "battery level is
low" and power management. Should not be difficult to add it if need
be.
- The interface to the outside world is virtually non-existent except
a trivial message based service for PCI driver to query which device
is connected to what IRQ line. This will evolve as more components
start using this driver. VM, Scheduler and IOMMU are the possible
users right now.
- because of dependency on a native 64bit (long long, part of c99) it
is compiled only with a gnu-like compilers which in case of Minix
includes gcc llvm-gcc and clang
Ben Gras [Tue, 31 Aug 2010 16:42:44 +0000 (16:42 +0000)]
gcc compiles - add -fno-builtin so that gcc optimisations don't break things.
- kernel compile was broken with gcc as putchar() was added by gcc in
stacktrace.c
- add -fno-builtin everywhere to avoid such problems in the future
- -fno-builtin in kernel now redundant
Ben Gras [Tue, 31 Aug 2010 14:33:31 +0000 (14:33 +0000)]
make service look in /etc/system.conf.d/<progname> first for config file.
This makes it easier to
- have non-base system drivers (get clobbered by global system.conf)
- have drivers as packages (can't touch global system.conf)
- make configs part of the drivers/servers instead of in global file
(makes system parts more self-contained)
Thomas Veerman [Mon, 30 Aug 2010 13:46:44 +0000 (13:46 +0000)]
- Add support for file descriptor passing to PFS.
- For security reasons move some libc code to PFS.
- Fix a few bugs in PFS.
Contributed by Thomas Cort.
Thomas Veerman [Mon, 30 Aug 2010 13:44:07 +0000 (13:44 +0000)]
Prepare VFS to support back calls from PFS. For security reasons and to support
file descriptor passing, PFS does some back calls to VFS. For example, to
verify the validity of a path provided by a process and to tell VFS it must
copy file descriptors from one process to another.
AHCI driver: miscellaneous changes
- check the DF status flag after each command
- increase I/O timeout from 15 to 30 seconds
- share some code between ATA and ATAPI after all
- produce more accurate errors on DIOCEJECT
- rename AHCI_ID_SIZE to the more appropriate ATA_ID_SIZE
- rearrange ahci.h in a now more sensible way