summaryrefslogtreecommitdiff
path: root/open_issues/smp.mdwn
blob: ce2c2ce238364655e7ff04bb490cdbbf6fc70690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
[[!meta copyright="Copyright © 2012, 2013 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

[[!meta title="SMP"]]

[[!tag open_issue_glibc open_issue_gnumach open_issue_hurd]]

<!-- This paragraph is parapharisg the wikipedia page
https://en.wikipedia.org/wiki/Symmetric_multiprocessing#Advantages/Disadvantages
-->

SMP stands for Symmetric multiprocessing, which is a computer that has numerous
identical processors connected to a single shared main memory.  All processors
are controlled by one single operating system, and each processor can access all
devices.  Operating systems with SMP can provide more performance, but it is not
trivial to do so.  It is a little like having a packed board meeting.  More
people in the room potentially means more can get done, but only one person can
speak at a time.  Scheduling everyone to speak can be quite an involved task.



     NOTE: Many of the veteran Hurd developers consider this task too large for a Google summer of code project.

<!--
This svg is cc attribute
https://en.wikipedia.org/wiki/File:SMP_-_Symmetric_Multiprocessor_System.svg -->

[[!img images/smp.svg size="700x"]]

<!-- most of this page is taken from https://gitlab.com/snippets/1756024#solution -->

# Current Status

As of September 2024, the SMP support is implemented for i386 with
working internet, because it boots with only one cpu in the default
processor set.  The slave processors are temporarily disabled until
they can be safely used per task.  We are unable to turn on the full
set at boot time due to race bugs.  Debian Hurd provides SMP enabled
GNU Mach kernels.

# How to test the current SMP support

The easiest way to test the SMP support, is via the [[qemu
guide|https://www.gnu.org/software/hurd/hurd/running/qemu.html]].
Once you have the Hurd running you can build an SMP enabled GNU Mach.

	$ git clone git://git.savannah.gnu.org/hurd/gnumach.git
	$ cd gnumach
	$ autoreconf -i
	$ mkdir build
	$ cd build
	$ ../configure --enable-ncpus=4 --enable-kdb
	$ make gnumach.gz
	$ su
    # mv /boot/gnumach-1.8-486.gz /boot/gnumach-1.8-486.gz.bak
    # cp gnumach.gz /boot/gnumach-1.8-486.gz

You may optionally update `/boot/grub/grub.cfg` change `hd0` to `wd0`
and add `console=com0`

	/boot/gnumach-1.8-486.gz root=part:2:device:wd0 console=com0

update `/etc/fstab` and update `wd0` instead of `hd0`.

    /dev/wd0s2      /               ext2    defaults        0       1
    /dev/wd0s1      none            swap    sw              0       0

You can shutdown via `/sbin/poweroff`.

start qemu with `-smp 4` and add `-nographic` if you want to use `com0`.

	$ qemu-system-i386 -M q35,accel=kvm -smp 4 -m 2G -net  \
	user,hostfwd=tcp::2223-:22 -net nic -hda debian-hurd-VERSION.img \
	-nographic

To test smp:

	$ sudo /path/to/smp /bin/bash
	$ stress -c 7

smp.c source can be found
[[here|https://lists.gnu.org/archive/html/bug-hurd/2024-02/msg00088.html]].

## References
- [Comments about the project bug-hurd
maillist](https://lists.gnu.org/archive/html/bug-hurd/2018-08/msg00048.html)
- [Initial thread in bug-hurd
maillist](https://lists.gnu.org/archive/html/bug-hurd/2018-06/msg00048.html)
- [SMP in GNU/Hurd FAQ](https://www.gnu.org/software/hurd/faq/smp.html)
- [GNU Mach git repository](https://git.savannah.gnu.org/cgit/hurd/gnumach.git)
- [GNU Mach reference manual](https://www.gnu.org/software/hurd/gnumach-doc/)
- [**MultiProcessor Specification**](https://pdos.csail.mit.edu/6.828/2011/readings/ia32/MPspec.pdf)
- [**ACPI Specification**](http://www.uefi.org/sites/default/files/resources/ACPI%206_2_A_Sept29.pdf)
- [Mach boot trace](https://www.gnu.org/software/hurd/microkernel/mach/gnumach/boot_trace.html)
- [SPL man page](https://man.openbsd.org/spl)
- [Book: The Mach System](http://codex.cs.yale.edu/avi/os-book/OS9/appendices-dir/b.pdf)
- [Book: Mach3 Mysteries](http://www.nv50.0fees.net/Doc/Mach3Mysteries.pdf)
- [X15 operating system](https://www.sceen.net/x15)
- [Symmetric Multiprocessing - OSDev Wiki](https://wiki.osdev.org/Symmetric_Multiprocessing)
- [**Intel® 64 and IA-32 Architectures Software Developer’s Manuals**](https://software.intel.com/sites/default/files/managed/39/c5/325462-sdm-vol-1-2abcd-3abcd.pdf)
- [**Intel Developer Guide, Volume 3: System Programming Guide**](https://software.intel.com/sites/default/files/managed/a4/60/325384-sdm-vol-3abcd.pdf)


See also the [[FAQ entry|faq/smp]].