Commit graph

642 commits

Author SHA1 Message Date
Tomas Hruby
1f89845bb2 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.
2010-09-15 14:11:21 +00:00
Tomas Hruby
6513d20744 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
2010-09-15 14:11:12 +00:00
Tomas Hruby
06b6e5624a 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
2010-09-15 14:10:42 +00:00
Tomas Hruby
1e273f640e 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.
2010-09-15 14:10:33 +00:00
Tomas Hruby
62c666566e 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
2010-09-15 14:09:52 +00:00
Tomas Hruby
13a0d5fa5e SMP - Cpu local variables
- most global variables carry information which is specific to the
  local CPU and each CPU must have its own copy

- cpu local variable must be declared in cpulocal.h between
  DECLARE_CPULOCAL_START and DECLARE_CPULOCAL_END markers using
  DECLARE_CPULOCAL macro

- to access the cpu local data the provided macros must be used

	get_cpu_var(cpu, name)
	get_cpu_var_ptr(cpu, name)

	get_cpulocal_var(name)
	get_cpulocal_var_ptr(name)

- using this macros makes future changes in the implementation
  possible

- switching to ELF will make the declaration of cpu local data much
  simpler, e.g.

  CPULOCAL int blah;

  anywhere in the kernel source code
2010-09-15 14:09:46 +00:00
Ben Gras
467a01024e bump trunk version to 3.1.9
make issue.install not include version
2010-09-15 08:47:42 +00:00
Ben Gras
2065c9982b include - minor compile fixes (including <ansi.h> in files that use it)
workaround for kernel/debug.h that causes <ansi.h> to be included in mpx.S
indirectly.
2010-09-15 08:47:10 +00:00
David van Moolenbroek
354da24f5b make getsysinfo() a system-land call 2010-09-14 21:50:05 +00:00
David van Moolenbroek
d269f5fb90 ProcFS integration 2010-09-14 21:27:31 +00:00
David van Moolenbroek
2c5c5c06ea ProcFS server, by Alen Stojanov and David van Moolenbroek 2010-09-14 21:25:25 +00:00
David van Moolenbroek
3eb65448a6 VM: expose secondary cache size 2010-09-14 21:22:56 +00:00
Ben Gras
a5a8c57fe7 add EHOSTDOWN errno. 2010-09-14 11:51:41 +00:00
Tomas Hruby
ad5ecf906b asm.h not installed 2010-09-03 17:01:18 +00:00
Tomas Hruby
9560b6dea8 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
2010-09-02 15:44:04 +00:00
Tomas Hruby
43a4725423 pci_*.h headers moved from drivers/pci to include/machine 2010-09-02 15:43:59 +00:00
Tomas Hruby
2440ffae49 Kernel exports DSDP and apic_enabled in machine structure
- kernel exports DSDP (the root pointer where ACPI parsing starts) and
  apic_enabled in the machine structure.

- ACPI driver uses DSDP to locate ACPI in memory. acpi_enabled tell
  PCI driver to query ACPI for IRQ routing information.
2010-09-02 15:43:56 +00:00
Tomas Hruby
344e9221ec Kernel supports up to 64 IRQs
- enough for 2 io apics (usually with 24 pins)
2010-09-02 15:43:54 +00:00
Ben Gras
b1847ae244 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)
2010-08-31 14:33:31 +00:00
Erik van der Kouwe
1f2054c89c Shutdown changes for multiboot: CTRL-ALT-DEL resets, panic halts 2010-08-30 19:01:58 +00:00
Arun Thomas
36fb30dfef cdefs.h: Allow __CONCAT() macro to be nested 2010-08-30 14:34:58 +00:00
Thomas Veerman
2297e26660 Prepare headers to support file descriptor passing over UNIX Domain Sockets.
Contributed by Thomas Cort.
2010-08-30 13:41:22 +00:00
Ben Gras
5d6c2aae0a gcov support, based on work contributed by Anton Kuijsten. 2010-08-25 13:06:43 +00:00
Ben Gras
0f4eda33eb new base libaudiodriver out of -lcommon in drivers/audio.
- this lets the drivers that used that library be compiled easily with
   different compilers.
2010-08-25 11:03:53 +00:00
Ben Gras
1d0e0e217d <stddef.h> - alternative definition of offsetof for gcc using builtin 2010-08-25 07:25:32 +00:00
Erik van der Kouwe
3211be5d14 Avoid duplicate type definitions, especially wchar_t which was inconsstent and caused trouble in libarchive 2010-08-23 17:00:04 +00:00
Arun Thomas
de231a713e Move MIN() and MAX() macros to sys/params.h 2010-08-21 13:10:41 +00:00
Arun Thomas
60a71efca8 easprintf() and evasprintf() 2010-08-21 13:07:25 +00:00
Erik van der Kouwe
b337d3f8e5 move rrrrrrread_tsc from libsys to libc so anyone can use it 2010-08-20 18:43:56 +00:00
Arun Thomas
9a21d1a2fd Macros for symbols used in both ASM and C
-The macros take care of prepending the leading underscore when
 necessary.
2010-08-17 16:44:07 +00:00
Erik van der Kouwe
551374c228 Add ftello function 2010-08-16 17:07:40 +00:00
Erik van der Kouwe
a3e4dcafe0 Add fseeko function 2010-08-16 17:06:08 +00:00
David van Moolenbroek
484b2f43d6 at_wini/ahci: write cache ioctls 2010-08-12 14:09:34 +00:00
David van Moolenbroek
bee1f38e01 VTreeFS library 2010-08-10 20:05:51 +00:00
Tomas Hruby
d5482f6e75 Reverted __packed for ACK
- ack does not produce packed structures
2010-08-06 10:28:40 +00:00
Tomas Hruby
6e614336d6 __packed defined for ACK 2010-08-06 09:53:53 +00:00
Erik van der Kouwe
42a2c1a03a Increase max number of open files to 255 (more should be possible but does not seem necessary for now) 2010-08-04 13:35:19 +00:00
Erik van der Kouwe
a719ab7780 Auto-detect ext2 partitions in mount 2010-08-03 06:28:58 +00:00
Thomas Veerman
253b4b3fe5 - Add support for ST_NOTRUNC to struct statvfs.
- Let tests that test for long file names check for that flag, so that they can
  verify the results properly.
2010-08-02 11:16:32 +00:00
David van Moolenbroek
20eced94e7 libdriver: allow driver to break out of message loop 2010-08-01 22:07:46 +00:00
David van Moolenbroek
da597227ac put env_arg[cv] declaration in minix/sysutil.h 2010-07-29 21:16:23 +00:00
Tomas Hruby
170b420d07 driver.h - missing guardian 2010-07-29 10:53:50 +00:00
Ben Gras
49fe8e24b2 rename nameserv.h 2010-07-29 08:41:22 +00:00
Ben Gras
fb96391106 rename nemserv 2010-07-29 08:39:49 +00:00
Ben Gras
a022f412b5 extra includes to make porting cleaner 2010-07-28 16:32:45 +00:00
Ben Gras
05bbf81f93 new EPFNOSUPPORT errno 2010-07-28 16:32:21 +00:00
Arun Thomas
dafc8f1062 Add poll.h
Open Group requires this. Reported by Thomas Cort.
2010-07-27 09:21:56 +00:00
Arun Thomas
ee1cabf06c Import poll() from NetBSD's libnbcompat 2010-07-26 20:46:04 +00:00
Ben Gras
541b5c5c38 inet_pton(), patched by Thomas Cort. 2010-07-26 14:47:10 +00:00
Ben Gras
008cc7c1a7 stdio.h - define P_tmpdir 2010-07-26 14:46:35 +00:00