[PATCH 2/4] i386: Fix lapic and ioapic for smp

2022-11-11 Thread Damien Zammit
--- i386/i386/apic.c | 85 + i386/i386/apic.h | 110 +-- i386/i386/smp.c | 89 +- i386/i386/smp.h | 7 +++ i386/i386at/ioapic.c | 103

[PATCH rumpkernel] pci-userspace: Add acpi lookup of irqs with fallback

2023-01-14 Thread Damien Zammit
This adds support for looking up IRQ numbers via hurd's acpi translator. It falls back to the existing IRQ number if acpi cannot provide it. --- debian/patches/acpi.diff | 76 debian/patches/series| 1 + 2 files changed, 77 insertions(+) create mode

[PATCH v2 rumpkernel] pci-userspace: Add acpi lookup of irqs with fallback

2023-01-17 Thread Damien Zammit
--- debian/patches/acpi.diff | 78 debian/patches/series| 1 + 2 files changed, 79 insertions(+) create mode 100644 debian/patches/acpi.diff diff --git a/debian/patches/acpi.diff b/debian/patches/acpi.diff new file mode 100644 index

[PATCH 4/4] Add cpu_number and cpuboot

2023-01-21 Thread Damien Zammit
--- i386/i386/cpu_number.c | 37 ++ i386/i386/cpuboot.S| 164 + 2 files changed, 201 insertions(+) create mode 100644 i386/i386/cpu_number.c create mode 100644 i386/i386/cpuboot.S diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c

[PATCH 3/4] i386: Fix lapic and ioapic for smp

2023-01-21 Thread Damien Zammit
--- i386/i386/apic.c | 87 ++ i386/i386/apic.h | 110 +-- i386/i386/smp.c | 89 +- i386/i386/smp.h | 7 +++ i386/i386at/ioapic.c | 103

[PATCH 2/4] i386: Add AP variants of descriptor tables

2023-01-21 Thread Damien Zammit
--- i386/i386/apic.c| 6 ++ i386/i386/gdt.c | 47 ++--- i386/i386/gdt.h | 1 + i386/i386/i386asm.sym | 1 + i386/i386/idt-gen.h | 4 ++-- i386/i386/idt.c | 25 -- i386/i386/ktss.c| 30

[PATCH 0/4] gnumach smp preparation

2023-01-21 Thread Damien Zammit
This patch series has been tested on each commit to not break PIC version without SMP, but refactors some of the SMP code to prepare for another patch series that will add SMP support. Damien

[PATCH 1/4] i386/apic: Add ifdefs for APIC for mask/unmask irqs

2023-01-21 Thread Damien Zammit
This prepares for --enable-ncpus=2 with --disable-apic option --- i386/i386/apic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i386/i386/apic.h b/i386/i386/apic.h index 10c83c01..0bb1bd73 100644 --- a/i386/i386/apic.h +++ b/i386/i386/apic.h @@ -207,6 +207,7 @@ extern volatile

[PATCH 00/12 gnumach] Progress on SMP with N cpus

2023-01-31 Thread Damien Zammit
This gets us closer to a working SMP kernel without breaking our non-SMP mode. What was tested? - kdb, apic, ncpus=8 with -smp 1 (boots slow) - kdb, apic, ncpus=8 with -smp 2 (hangs) - kdb, apic, ncpus=8 with -smp 4 (hangs) - kdb, apic, ncpus=8 with -smp 6 (hangs) - (no options) with -smp

[PATCH 01/12 gnumach] i386: Fix lapic and ioapic for smp

2023-01-31 Thread Damien Zammit
Also-by: Almudena Garcia --- i386/i386/apic.c | 87 ++--- i386/i386/apic.h | 114 --- i386/i386/smp.c | 89 - i386/i386/smp.h | 7 +++ i386/i386at/ioapic.c | 97

[PATCH 02/12 gnumach] Add cpu_number and cpuboot

2023-01-31 Thread Damien Zammit
I addressed most of the previous review. MSRs are easier to set in asm so I have left it in. --- i386/i386/cpu_number.c | 33 + i386/i386/cpuboot.S| 164 + 2 files changed, 197 insertions(+) create mode 100644 i386/i386/cpu_number.c create

[PATCH 04/12 gnumach] locore: Fix int stack check

2023-01-31 Thread Damien Zammit
TODO: Return kernel_id via lookup table, not apic_id --- i386/i386/cpu_number.h | 7 +++ i386/i386/locore.S | 15 +-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/i386/i386/cpu_number.h b/i386/i386/cpu_number.h index 9aef6370..a6dd47d6 100644 ---

[PATCH 03/12 gnumach] Print warning on bad cpu numbering and assume BSP

2023-01-31 Thread Damien Zammit
--- i386/i386/apic.c | 5 + i386/i386/cpu_number.c | 16 +--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/i386/i386/apic.c b/i386/i386/apic.c index e53d4749..891ce288 100644 --- a/i386/i386/apic.c +++ b/i386/i386/apic.c @@ -278,6 +278,11 @@

[PATCH 05/12 gnumach] interrupt: Send EOI before handling update interrupt

2023-01-31 Thread Damien Zammit
--- i386/i386at/interrupt.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i386/i386at/interrupt.S b/i386/i386at/interrupt.S index 9f1883ac..1103b1c8 100644 --- a/i386/i386at/interrupt.S +++ b/i386/i386at/interrupt.S @@ -122,8 +122,8 @@ _no_eoi: ret _call_single: +

[PATCH 07/12 gnumach] Always use directed EOI and disable focus

2023-01-31 Thread Damien Zammit
--- i386/i386/apic.c | 4 +++- i386/i386at/ioapic.c | 9 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/i386/i386/apic.c b/i386/i386/apic.c index 891ce288..ff7ba3e2 100644 --- a/i386/i386/apic.c +++ b/i386/i386/apic.c @@ -304,7 +304,9 @@ lapic_enable(void) /*

[PATCH 06/12 gnumach] linux: Skip updating jiffies on AP timer

2023-01-31 Thread Damien Zammit
--- linux/dev/kernel/sched.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux/dev/kernel/sched.c b/linux/dev/kernel/sched.c index 2a9eeb3f..f9c52d1e 100644 --- a/linux/dev/kernel/sched.c +++ b/linux/dev/kernel/sched.c @@ -616,6 +616,9 @@ int linux_timer_print = 0; void

[PATCH 09/12 gnumach] i386: Refactor int stacks for SMP - shared temp pmap

2023-01-31 Thread Damien Zammit
Also-by: Almudena Garcia --- i386/i386/cpu_number.h | 15 +- i386/i386/cswitch.S | 6 +- i386/i386/i386asm.sym| 3 + i386/i386/locore.S | 4 +- i386/i386/mp_desc.c | 227 ++- i386/i386/mp_desc.h

[PATCH 08/12 gnumach] smp: Deassert IPI 251 as part of sequence

2023-01-31 Thread Damien Zammit
--- i386/i386/smp.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/i386/i386/smp.c b/i386/i386/smp.c index c351efaa..acf69d21 100644 --- a/i386/i386/smp.c +++ b/i386/i386/smp.c @@ -60,7 +60,11 @@ void smp_pmap_update(unsigned apic_id) pause_memory; }

[PATCH 10/12 gnumach] Fix makefrags

2023-01-31 Thread Damien Zammit
--- i386/Makefrag.am | 5 +++-- i386/Makefrag_x86.am | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/i386/Makefrag.am b/i386/Makefrag.am index 68460c49..5881f9f3 100644 --- a/i386/Makefrag.am +++ b/i386/Makefrag.am @@ -30,6 +30,8 @@ if HOST_ix86 #

[PATCH 11/12 gnumach] smp: Serialise AP bringup

2023-01-31 Thread Damien Zammit
--- i386/i386/mp_desc.c | 26 +++--- i386/i386at/ioapic.c| 1 - i386/i386at/model_dep.c | 1 - i386/intel/pmap.c | 1 + kern/startup.c | 5 - 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/i386/i386/mp_desc.c

[PATCH 12/12 gnumach] Debug printf when sending TLB IPI

2023-01-31 Thread Damien Zammit
--- i386/i386/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i386/i386/smp.c b/i386/i386/smp.c index acf69d21..c6a62958 100644 --- a/i386/i386/smp.c +++ b/i386/i386/smp.c @@ -53,7 +53,7 @@ void smp_pmap_update(unsigned apic_id) cpu_intr_save(); -

[PATCH gnumach] Add timing info to MACH_LOCK_MON lock monitoring

2023-03-17 Thread Damien Zammit
Booting to beginning of bootstrap with different number of cpus and checking the lock statistics where TIME is in milliseconds: -smp 1 db{0}> show all slocks SUCCESS FAILMASKED STACK TIMELOCK/CALLER 1 0/0 1/100 0/0 8030/8030 0x323(c1196280) 30760 0/0 0/0

Re: Happy birthday, Richard Matthew Stallman!

2023-03-16 Thread Damien Zammit
Happy birthday, rms, Thank you - most of all - for the GPL; distilling the essential software freedoms down to 4, and giving everyone a way to defend their freedom. Have a fabulous day! On 16/3/23 19:39, Akib Azmain Turja wrote: > > Today, 16th March, is the birthday of Richard Matthew

[PATCH gnumach] ioapic: Timer calibrated in 10 mach ticks

2023-03-10 Thread Damien Zammit
hz variable is the number of mach ticks in 1 second. We want to know how many lapic ticks in 1 mach tick. Therefore, we set a timer for 10 mach ticks and divide the lapic stopwatch counter value by 10. --- i386/i386at/ioapic.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff

[PATCH gnumach] kd_mouse: Fix IBM mouse irq getting stuck and blocking console

2023-02-24 Thread Damien Zammit
TESTED: With and without apic/smp --- i386/i386at/kd_mouse.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c index c870cf5a..9bd001cb 100644 --- a/i386/i386at/kd_mouse.c +++ b/i386/i386at/kd_mouse.c @@ -106,6 +106,7 @@

[PATCH gnumach] lapic timer: Calibrate based on 10 PIT sleeps for 10ms

2023-02-25 Thread Damien Zammit
NB: This relies on a fix for QEMU as one-shot PIT mode is currently broken in qemu. --- i386/i386at/ioapic.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/i386/i386at/ioapic.c b/i386/i386at/ioapic.c index 24e04653..d2ea84ad 100644 ---

[PATCH gnumach] pit: Use corrected clock frequency

2023-02-25 Thread Damien Zammit
All PC compatibles operate the PIT at a clock rate of (105/88) MHz --- i386/i386/pit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i386/i386/pit.h b/i386/i386/pit.h index b14c4c84..49e1051b 100644 --- a/i386/i386/pit.h +++ b/i386/i386/pit.h @@ -86,7 +86,7 @@ WITH THE USE

[PATCH gnumach] pit: Fix shadowed hz variable && define modes correctly

2023-02-25 Thread Damien Zammit
--- i386/i386/pit.c | 14 +++--- i386/i386/pit.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/i386/i386/pit.c b/i386/i386/pit.c index 7373a38e..6c006a98 100644 --- a/i386/i386/pit.c +++ b/i386/i386/pit.c @@ -66,18 +66,18 @@ int pit0_mode =

Re: [PATCH gnumach] lapic timer: Calibrate based on 10 PIT sleeps for 10ms

2023-02-25 Thread Damien Zammit
On 26/2/23 12:31, Damien Zammit wrote: > NB: This relies on a fix for QEMU as one-shot PIT mode > is currently broken in qemu. Here is the corresponding qemu patch: https://lists.nongnu.org/archive/html/qemu-devel/2023-02/msg07549.html Damien

Re: [PATCH gnumach] lapic timer: Calibrate based on 10 PIT sleeps for 10ms

2023-02-26 Thread Damien Zammit
On 26/2/23 20:20, Samuel Thibault wrote: > Samuel Thibault, le dim. 26 févr. 2023 10:03:28 +0100, a ecrit: >> Damien Zammit, le dim. 26 févr. 2023 03:34:59 +, a ecrit: >>> On 26/2/23 12:31, Damien Zammit wrote: >>>> NB: This relies on a fix for QEMU as one-s

[PATCH gnumach] model_dep: Call acpi_apic_init if APIC defined

2023-02-18 Thread Damien Zammit
Fixes boot --enable-ncpus=1 with --enable-apic configuration albeit the keyboard is stuck and network cannot be accessed. Error messages: Timeout reached while wating for return value /bin/console: Could not receive return value from daemon process: Connection timed out ---

[PATCH gnumach] Unmask irq 12 - fixes stuck console with apic

2023-02-18 Thread Damien Zammit
--- i386/i386at/model_dep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index baff8da1..73b99f94 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -177,6 +177,8 @@ void machine_init(void) #warning FIXME: Rather

[PATCH gnumach] lapic timer: Calibrate via mach timer not PIT

2023-03-04 Thread Damien Zammit
Previously the lapic timer was calibrated by one-shot PIT timer2. This method can be buggy and generally unused in emulation environments. This patch reworks the timer calibration to use a mach timer based on regular PIT interrupts to remapped IOAPIC pin. This also changes the primary clock source

[PATCH v2 gnumach] lapic timer: Calibrate via mach timer not PIT

2023-03-05 Thread Damien Zammit
Previously the lapic timer was calibrated by one-shot PIT timer2. This method can be buggy and generally unused in emulation environments. This patch reworks the timer calibration to use a mach timer based on regular PIT interrupts to remapped IOAPIC pin. This also changes the primary clock source

[PATCH gnumach] kern: Fix MACH_LOCK_MON lock monitoring debug

2023-03-05 Thread Damien Zammit
TESTED: - by setting MACH_LOCK_MON to 1 in configfrag.ac and running "show all slocks" in kdb - does not break default configured kernel --- ddb/db_sym.h | 8 i386/i386/lock.h | 6 +++--- kern/lock.c | 4 kern/lock.h | 5 + kern/lock_mon.c | 8

[PATCH gnumach] trap: Fix Wformat issues

2023-02-15 Thread Damien Zammit
--- i386/i386/trap.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/i386/i386/trap.c b/i386/i386/trap.c index 9a35fb42..34ccb6a5 100644 --- a/i386/i386/trap.c +++ b/i386/i386/trap.c @@ -212,7 +212,7 @@ dump_ss(regs); if (trunc_page(subcode)

[PATCH v2 3/3 gnumach] i386: Refactor int stacks to be per cpu for SMP

2023-02-03 Thread Damien Zammit
This also serialises the AP bringup, so paging can be enabled per cpu one by one. Also-by: Almudena Garcia --- i386/i386/mp_desc.c | 226 i386/i386/mp_desc.h | 7 +- i386/i386at/boothdr.S | 18 +++- i386/i386at/ioapic.c| 5 +-

[PATCH v2 1/3 gnumach] pmap: Refactor temporary mapping functions

2023-02-03 Thread Damien Zammit
--- i386/i386at/model_dep.c | 73 +--- i386/intel/pmap.c | 93 + i386/intel/pmap.h | 6 +++ 3 files changed, 101 insertions(+), 71 deletions(-) diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index

[PATCH v2 2/3 gnumach] linux: Keep existing timer interrupt handler for APIC

2023-02-03 Thread Damien Zammit
--- linux/dev/arch/i386/kernel/irq.c | 2 +- linux/dev/init/main.c| 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/dev/arch/i386/kernel/irq.c b/linux/dev/arch/i386/kernel/irq.c index 67feea84..b48d1312 100644 --- a/linux/dev/arch/i386/kernel/irq.c +++

Re: [PATCH v3] i386: Refactor int stacks to be per cpu for SMP

2023-02-12 Thread Damien Zammit
Hi Almu, On 13/2/23 11:51, Almudena Garcia wrote: > :-) > > Thanks Damien!! I'm happy that you have rescued my work of latest year and > patched it to fix the problems. > > Now an evolution of my work is in upstream, thanks to your work. > > Great job!!. I'm grateful with you. \o/ You're

[PATCH 0/5 gnumach] More smp progress

2023-02-13 Thread Damien Zammit
This adds a few more things we need for smp. Per-cpu curr_ipl[] for example. With these changes compiled for smp and apic, the kernel fails to boot with -smp {2,4,6,8} due to the first task getting lost somewhere. If you boot with $(prompt-task-resume) in grub, it enters the debugger just before

[PATCH 1/5 gnumach] interrupt.S: Dont change ipl for pmap_update_interrupt

2023-02-13 Thread Damien Zammit
--- i386/i386at/interrupt.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i386/i386at/interrupt.S b/i386/i386at/interrupt.S index 1103b1c8..55f4fa0f 100644 --- a/i386/i386at/interrupt.S +++ b/i386/i386at/interrupt.S @@ -43,6 +43,9 @@ ENTRY(interrupt) cmpl

[PATCH 2/5 gnumach] pmap: Signal cpu for TLB update if kernel_pmap

2023-02-13 Thread Damien Zammit
--- i386/intel/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 0a805e4c..40ddcd6a 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -3013,7 +3013,7 @@ voidsignal_cpus( cpu_update_needed[which_cpu] =

[PATCH 3/5 gnumach] Make curr_ipl[] per cpu

2023-02-13 Thread Damien Zammit
--- i386/i386/cpu_number.h | 13 --- i386/i386/fpu.c | 4 ++-- i386/i386/ipl.h | 2 +- i386/i386/pic.c | 6 +++-- i386/i386/spl.S | 34 ++--- i386/i386at/ioapic.c

[PATCH 5/5 gnumach] x86_64: Fix broken int_stack_base

2023-02-13 Thread Damien Zammit
--- x86_64/cswitch.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86_64/cswitch.S b/x86_64/cswitch.S index 1a7471c3..015e884c 100644 --- a/x86_64/cswitch.S +++ b/x86_64/cswitch.S @@ -137,7 +137,7 @@ ud2 movqS_ARG2,%rsi /* get its argument */

[PATCH 4/5 gnumach] Remove verbose debug printfs

2023-02-13 Thread Damien Zammit
--- i386/i386/mp_desc.c | 1 - i386/i386/smp.c | 1 - i386/intel/pmap.c | 1 - 3 files changed, 3 deletions(-) diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c index 446fedb5..e6fcbf62 100644 --- a/i386/i386/mp_desc.c +++ b/i386/i386/mp_desc.c @@ -199,7 +199,6 @@ cpu_control(int cpu,

Re: [PATCH 2/5 gnumach] i386: Refactor int stacks to be per cpu for SMP

2023-02-03 Thread Damien Zammit
Hi Almu, On 3/2/23 02:56, Almudena Garcia wrote: > I already suggested move this to a function > > +#ifndef MACH_HYP > +    /* Turn paging on. > +     * TODO: Why does setting the WP bit here cause a crash? > +     */ > +    set_cr0(get_cr0() | CR0_PG /* | CR0_WP */); > +    set_cr0(get_cr0() &

[PATCH] cpu_number: Short circuit if smp init not done

2023-02-03 Thread Damien Zammit
This depends on serialised AP init patch. Fixes warnings spewing at boot with APIC and SMP --- i386/i386/cpu_number.c | 8 1 file changed, 8 insertions(+) diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c index ad4c4b01..eca95d7a 100644 --- a/i386/i386/cpu_number.c +++

[PATCH v3] i386: Refactor int stacks to be per cpu for SMP

2023-02-03 Thread Damien Zammit
This also serialises the AP bringup, so paging can be enabled per cpu one by one. Also-by: Almudena Garcia --- i386/i386/mp_desc.c | 230 i386/i386/mp_desc.h | 7 +- i386/i386at/boothdr.S | 18 +++- i386/i386at/ioapic.c| 5 +-

Re: [PATCH 2/5 gnumach] i386: Refactor int stacks to be per cpu for SMP

2023-02-03 Thread Damien Zammit
On 4/2/23 12:27, Almudena Garcia wrote: > But, added to interrupt stacks, the APs needs their own stacks once these are > running, to store data of the process which are executing. I thought this kind of stack is dynamically allocated by the thread manager (?) Damien

[PATCH v2 gnumach] cpu_number: Short circuit if smp init not done

2023-02-04 Thread Damien Zammit
This depends on serialised AP init patch. Fixes warnings spewing at boot with APIC and SMP --- i386/i386/cpu_number.c | 5 + i386/i386/mp_desc.h| 2 ++ 2 files changed, 7 insertions(+) diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c index 42aa6ea1..1d2fab3a 100644 ---

[PATCH gnumach] cpu_number: Fix missing return

2023-02-04 Thread Damien Zammit
--- i386/i386/cpu_number.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c index ad4c4b01..42aa6ea1 100644 --- a/i386/i386/cpu_number.c +++ b/i386/i386/cpu_number.c @@ -36,5 +36,7 @@ int cpu_number(void)

[PATCH 1/2 gnumach] Fix missing cpu_pause symbol

2023-02-15 Thread Damien Zammit
--- i386/i386/smp.c | 5 + i386/i386/smp.h | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/i386/i386/smp.c b/i386/i386/smp.c index c0149a3b..f493bdc0 100644 --- a/i386/i386/smp.c +++ b/i386/i386/smp.c @@ -45,6 +45,11 @@ static void smp_data_init(void) } +inline void

[PATCH 2/2 gnumach] Add missing init_fpu() for APs

2023-02-15 Thread Damien Zammit
--- i386/i386/mp_desc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c index 4b5a78ea..fa66aa44 100644 --- a/i386/i386/mp_desc.c +++ b/i386/i386/mp_desc.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include

[PATCH 3/5 gnumach] linux: No need to init PIT timer twice

2023-02-01 Thread Damien Zammit
--- linux/dev/arch/i386/kernel/irq.c | 12 ++-- linux/dev/init/main.c| 2 ++ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/linux/dev/arch/i386/kernel/irq.c b/linux/dev/arch/i386/kernel/irq.c index 67feea84..5f221da1 100644 ---

[PATCH 4/5 gnumach] kdb: Fix ON_INT_STACK() macro to be cpu_number aware

2023-02-01 Thread Damien Zammit
--- i386/i386/db_trace.c| 3 ++- i386/i386at/model_dep.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c index 99cb8c48..04c868af 100644 --- a/i386/i386/db_trace.c +++ b/i386/i386/db_trace.c @@ -37,6 +37,7 @@ #include

[PATCH 0/5 gnumach] Progress with SMP revisited

2023-02-01 Thread Damien Zammit
This has been rebased onto master and reworked to address review. Same tests applied as last time, same results as last time. However, with ncpus>1 and apic enabled, there are warnings spewed at beginning of gnumach regarding cpu_number, but doesnt prevent continuing to start of boot process.

[PATCH 5/5 gnumach] linux: Skip probing IDE when 255 phys heads detected

2023-02-01 Thread Damien Zammit
This allows qemu -M q35 to boot without 30 second timeout failing on hd0, when disk is actually attached via ahci. I very much doubt a disk exists with 255 physical heads. --- linux/src/drivers/block/ide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 1/5 gnumach] pmap: Debug printf when pmap_update_interrupt runs

2023-02-01 Thread Damien Zammit
--- i386/intel/pmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 84a4cef5..0505cfa2 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -2928,6 +2928,7 @@ void pmap_update_interrupt(void) int s; my_cpu =

[PATCH 2/5 gnumach] i386: Refactor int stacks to be per cpu for SMP

2023-02-01 Thread Damien Zammit
This is a rather large commit, but difficult to break it up. This also serialises the AP bringup, so paging can be enabled per cpu one by one. Also-by: Almudena Garcia --- i386/i386/cpu_number.h | 2 + i386/i386/mp_desc.c | 226

Re: [PATCH 0/5 gnumach] Progress with SMP revisited

2023-02-01 Thread Damien Zammit
ittle refactors) will be add the APs to > scheduler, using `slave_main()` function. > After this, the AP will be available to the scheduler, which can assign > process (or threads) to these. > > El mié, 1 feb 2023 a las 11:27, Damien Zammit () > escribió: > >> T

Re: [PATCH 0/5 gnumach] Progress with SMP revisited

2023-02-01 Thread Damien Zammit
Original Message On 1 Feb 2023, 10:35 pm, Almudena Garcia < liberamenso10...@gmail.com> wrote: Ok. Now I understand better. Maybe it's the same problem which I found in my first implementation: the AP was stuck, and the scheduler was sending all threads to the BSP. Try to debug

[PATCH v3 hurd] rumpusbdisk: Add USB mass storage translator

2023-07-03 Thread Damien Zammit
This adds a second binary target to compile in the rump USB stack instead of SATA/IDE using conditional ifdefs to mostly share the code between the two translators. This can be tested by running qemu with a USB3 controller as follows: -drive

Re: [PATCH v6 1/2 hurd] libirqhelp: Add library

2023-07-10 Thread Damien Zammit
Hi, On 11/7/23 05:47, Samuel Thibault wrote: > Damien Zammit, le lun. 10 juil. 2023 09:02:10 +, a ecrit: >> +void >> +irqhelp_wait_init(struct irq *irq) >> +{ >> + if (!irq) >> +{ >> + log_error("cannot wait o

Re: [PATCH rust] Add new target for GNU/Hurd

2023-07-10 Thread Damien Zammit
Hi, On 11/7/23 05:53, Samuel Thibault wrote: > Sergey Bugaev, le lun. 10 juil. 2023 12:22:21 +0300, a ecrit: >> I don't think that's correct. For one thing, dev_t is __UWORD_TYPE >> (like Rust usize) since glibc commit >> 0ec48e3337506fcd33abdd86b5ab9e331564b65c, and it was u32 before that. > >

[PATCH v5 1/2 hurd] libirqhelp: Add library

2023-07-08 Thread Damien Zammit
--- Makefile | 1 + libirqhelp/Makefile | 28 libirqhelp/irqhelp.c | 355 +++ libirqhelp/irqhelp.h | 34 + 4 files changed, 418 insertions(+) create mode 100644 libirqhelp/Makefile create mode 100644 libirqhelp/irqhelp.c create

[PATCH v5 2/2 hurd] ddekit: Use libirqhelp for interrupt registration

2023-07-08 Thread Damien Zammit
--- libddekit/Makefile| 2 +- libddekit/interrupt.c | 205 +- 2 files changed, 23 insertions(+), 184 deletions(-) diff --git a/libddekit/Makefile b/libddekit/Makefile index 88a0c8909..c74ec1128 100644 --- a/libddekit/Makefile +++ b/libddekit/Makefile

[PATCH v5 0/2 hurd] irqhelp + simplify ddekit

2023-07-08 Thread Damien Zammit
This adds an irqhelp library for simplified user irq registration. The second patch implements the use case for ddekit (netdde). TESTED: Copied 17 files totalling 11GB inbound. ... sent 10,932,485,258 bytes received 3,563,749 bytes 1,473,960.38 bytes/sec total size is 11,194,873,873

[PATCH rust-libc] i386-gnu: Add GNU/Hurd os

2023-07-09 Thread Damien Zammit
Autogenerated mod.rs in 2021 with: bindgen input.h -- --sysroot=./hurd-headers -I./hurd-headers/include \ -I./hurd-headers/include/i386-gnu -target i386-gnu > mod.rs Hand cherry-picked some required rust code and tweaked to make libc compile. The remaining work is tweaking libstd and

[PATCH rust] Add new target for GNU/Hurd

2023-07-09 Thread Damien Zammit
This is not quite right for library/std, but applies clean to a 2021 tree of rust on hash 25ea6be13e3 and allows up to the following stage1 build until libstd breaks on hurd, (with the other patch for rust-libc). ./x.py build --target x86_64-unknown-linux-gnu \ --target

[WIP PATCH 0/2 rust/rust-libc] GNU/Hurd support

2023-07-09 Thread Damien Zammit
Hi, I had another go at porting rust to hurd this weekend. This is based on my previous attempt from 2021. It needs to be rebased onto latest rust, and missing bits fixed. I got closer to cross-compiling the stage1 i686-unknown-hurd-gnu target but failed on libstd with 219 compilation errors.

Re: [PATCH v6 1/2 hurd] libirqhelp: Add library

2023-07-11 Thread Damien Zammit
Hi, On 11/7/23 05:47, Samuel Thibault wrote: > Damien Zammit, le lun. 10 juil. 2023 09:02:10 +, a ecrit: >> +void >> +irqhelp_wait_init(struct irq *irq) >> +{ >> + if (!irq) >> +{ >> + log_error("cannot wait o

[PATCH v6 2/2 hurd] ddekit: Use libirqhelp for interrupt registration

2023-07-10 Thread Damien Zammit
--- libddekit/Makefile| 2 +- libddekit/interrupt.c | 206 +- 2 files changed, 24 insertions(+), 184 deletions(-) diff --git a/libddekit/Makefile b/libddekit/Makefile index 88a0c8909..c74ec1128 100644 --- a/libddekit/Makefile +++ b/libddekit/Makefile

[PATCH v6 1/2 hurd] libirqhelp: Add library

2023-07-10 Thread Damien Zammit
--- Makefile | 1 + libirqhelp/Makefile | 28 libirqhelp/irqhelp.c | 378 +++ libirqhelp/irqhelp.h | 52 ++ 4 files changed, 459 insertions(+) create mode 100644 libirqhelp/Makefile create mode 100644 libirqhelp/irqhelp.c create

[PATCH v6 0/2 hurd] irqhelp + simplify ddekit

2023-07-10 Thread Damien Zammit
Addressed all the review points from v5. This adds an irqhelp library for simplified user irq registration. The second patch implements the use case for ddekit (netdde). TESTED: Recompiled netdde.static and copied a 2GB file inbound at 1.8MB/sec. Also tried ifdown and ifup a few times, works as

[PATCH v2 grub] hurdhelper: Add helper for loading GNU/Hurd multiboot modules

2023-07-16 Thread Damien Zammit
ce:wd0 noide grub> hurdmodules pci-arbiter acpi rumpdisk ext2fs exec grub> boot This could, for example, allow hurd to be booted from the grub shell manually without remembering and typing dozens of commands. Signed-off-by: Damien Zammit --- grub-core/Makefile.core.def | 8 ++ grub

[PATCH hurd] libdiskfs: Support --next-task for filesystems

2023-07-16 Thread Damien Zammit
This standardises the format of the boot parameters so that they all use the same parameter --next-task to specify the next task in the boot order. It does assume the next task is always exec, however. This may not be a problem. --- libdiskfs/opts-std-startup.c | 6 +- 1 file changed, 5

Re: [PATCH hurd] libdiskfs: Support --next-task for filesystems

2023-07-16 Thread Damien Zammit
Hi Sergey, On 16/7/23 21:29, Sergey Bugaev wrote: > I'd be happy to share more details about the grand plan if you're > interested — and actually it'd be great to discuss this with you since > I don't know much about device drivers etc. and you might point out > some important shortcomings in my

[PATCH v2 hurd] pci: Add RPCs for taking and freeing io ports by BAR

2023-07-20 Thread Damien Zammit
This would allow pci-arbiter to control which io ports are accessed and pave the way to having granular access to io ports based on pci cards exposing their IO BARs. libpciaccess has convenient api for this kind of access, it allows opening and registering io ports by BAR. Therefore, we can

Re: [PATCH v2 hurd] pci: Add RPCs for taking and freeing io ports by BAR

2023-07-20 Thread Damien Zammit
Hi Joan, On 21/7/23 06:38, Joan Lledó wrote: > I think your design is not compatible with nested arbiters. Actually it is, I have also written a patch for libpciaccess. Basically we need to reduce the number of io ports we are requesting down to just the minimum required to access a device, then

Re: [PATCH v2 hurd] pci: Add RPCs for taking and freeing io ports by BAR

2023-07-20 Thread Damien Zammit
Hi, On 21/7/23 03:44, Samuel Thibault wrote: > Damien Zammit, le jeu. 20 juil. 2023 10:13:10 +, a ecrit: >> + e = master->po->np->nn->ln; >> + if (strncmp (e->name, FILE_CONFIG_NAME, NAME_SIZE)) >> +/* This operation may only be addressed to the

[RFC PATCH v4 1/2 hurd] libirqhelp: Add library

2023-07-05 Thread Damien Zammit
--- Makefile | 1 + libirqhelp/Makefile | 28 libirqhelp/irqhelp.c | 345 +++ libirqhelp/irqhelp.h | 33 + 4 files changed, 407 insertions(+) create mode 100644 libirqhelp/Makefile create mode 100644 libirqhelp/irqhelp.c create

[RFC PATCH v4 0/2 hurd] irqhelp + ddekit

2023-07-05 Thread Damien Zammit
Hi all, I refactored v3 of this series to be a cleaner API. However when I recompiled netdde.static using these libs, the network device hangs on ifup /dev/eth0 Can anyone see anything obviously wrong with this patchset? Thanks, Damien

[RFC PATCH v4 2/2 hurd] ddekit: Use libirqhelp for interrupt registration

2023-07-05 Thread Damien Zammit
--- libddekit/Makefile| 2 +- libddekit/interrupt.c | 231 -- 2 files changed, 19 insertions(+), 214 deletions(-) diff --git a/libddekit/Makefile b/libddekit/Makefile index 88a0c8909..c74ec1128 100644 --- a/libddekit/Makefile +++ b/libddekit/Makefile

Re: [RFC PATCH v4 1/2 hurd] libirqhelp: Add library

2023-07-07 Thread Damien Zammit
the handler and kicking off the server loop, to continue executing the main thread. On 5/7/23 17:59, Damien Zammit wrote: > +static struct irq * > +interrupt_register(int gsi, > +int bus, > +int dev, > +int fun, > +

[RFC PATCH hurd] pci: Add RPCs for taking and freeing io ports by BAR

2023-07-15 Thread Damien Zammit
The rationale behind this change is that IO ports should not be mapped as regions, because you are not supposed to access them as a byte stream, they are accessed in certain widths depending on what hardware is backing them. This would allow pci-arbiter to control which io ports are accessed and

[PATCH v3 hurd] pci: Add RPCs for taking and freeing io ports by region

2023-07-21 Thread Damien Zammit
This would allow pci-arbiter to control which io ports are accessed and pave the way to having granular access to io ports based on pci cards exposing their IO BARs. libpciaccess has convenient api for this kind of access, it allows opening and registering io ports by BAR. Therefore, we can

[PATCH v2 gnumach] Add timing info to MACH_LOCK_MON lock monitoring

2023-07-21 Thread Damien Zammit
Booting to beginning of bootstrap with different number of cpus and checking the lock statistics where TIME is in milliseconds: Set MACH_LOCK_MON to 1 in configfrag.ac, then Configure options --enable-ncpus=8 --enable-kdb --enable-apic --disable-linux-groups -smp 1 db{0}> show all slocks

[PATCH gnumach] db_interface: Don't call db_on if MACH_KDB is off

2023-07-21 Thread Damien Zammit
Allows building of gnumach with --disable-kdb and --enable-ncpus > 1 --- i386/i386/db_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c index 5a4ace9f..06cbd5e0 100644 --- a/i386/i386/db_interface.c +++

[PATCH v4 hurd] pci: Add RPC for grabbing io ports by region

2023-07-22 Thread Damien Zammit
This would allow pci-arbiter to control which io ports are accessed and pave the way to having granular access to io ports based on pci cards exposing their IO BARs. libpciaccess has convenient api for this kind of access, it allows opening and registering io ports by BAR. Therefore, we can

Re: [PATCH v3 hurd] pci: Add RPCs for taking and freeing io ports by region

2023-07-22 Thread Damien Zammit
Hi, On 22/7/23 21:17, Joan Lledó wrote: > Correct me if I'm wrong: nested arbiters would fail here, right? An > arbiter launched from a user (non-root) having permissions over the IO > file should be able to get the port and handle it to it's clients. Then > we need the fallback mechanism to RPC

[PATCH 3/3 gnumach] i386/x86_64: Add remote AST via IPI mechanism

2023-08-11 Thread Damien Zammit
--- i386/i386/ast_check.c | 4 i386/i386/i386asm.sym | 1 + i386/i386/locore.S | 1 + i386/i386/smp.c | 16 +--- i386/i386/smp.h | 1 + i386/i386at/idt.h | 3 +++ i386/i386at/int_init.c | 4 i386/i386at/interrupt.S | 8

[PATCH 2/3 gnumach] kern/sched_prim: Cause ast on cpu coming out of idle

2023-08-11 Thread Damien Zammit
--- kern/sched_prim.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/kern/sched_prim.c b/kern/sched_prim.c index dd0f492b..f7557124 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -1266,6 +1266,8 @@ void thread_setrun( processor->state =

[PATCH 1/3 gnumach] apic: Use cpuid to read the apic id for speed

2023-08-11 Thread Damien Zammit
--- i386/i386/apic.c | 11 +-- i386/i386/cpu_number.h | 20 +++- i386/i386/locore.S | 2 +- i386/i386/mp_desc.c| 3 +-- x86_64/locore.S| 10 +- 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/i386/i386/apic.c

[PATCH 0/3 gnumach] - SMP speedup

2023-08-11 Thread Damien Zammit
Hi, This patchset speeds up smp a lot, but I still can't get a shell. I get random hangs during bootup, or maybe they are just a sporadic slowness. There are still problems with the scheduler, I think. Damien

Re: [PATCH 1/3 gnumach] apic: Use cpuid to read the apic id for speed

2023-08-11 Thread Damien Zammit
Hi, On 12/8/23 04:27, Luca wrote: > How much faster is this? did you measure also on hw? I would use RDTSC > to do it, I don't know if there are better ways. So, ~8 microseconds was reduced to ~60 nanoseconds, so roughly 100 times faster. I don't know how to do it with rdtsc. > Interestingly,

[PATCH gnumach] ast: Implement cause_ast_check() by switching cpus

2023-08-05 Thread Damien Zammit
If the current processor is not the one we want to run an ast on, we can bind the current thread to the processor we want, and force a thread switch to that one, then run the ast_check() on the right cpu. --- i386/i386/ast_check.c | 13 +++-- 1 file changed, 11 insertions(+), 2

[PATCH gnumach] interrupt.S: No nested interrupts during IPIs && more x86_64 smp support

2023-08-05 Thread Damien Zammit
--- i386/i386at/interrupt.S | 1 + x86_64/interrupt.S | 10 ++ 2 files changed, 11 insertions(+) diff --git a/i386/i386at/interrupt.S b/i386/i386at/interrupt.S index 55f4fa0f..1f661f8d 100644 --- a/i386/i386at/interrupt.S +++ b/i386/i386at/interrupt.S @@ -123,6 +123,7 @@ _no_eoi:

[PATCH gnumach] kern/thread: Only loop over cpus that exist

2023-08-05 Thread Damien Zammit
--- kern/thread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kern/thread.c b/kern/thread.c index a324eed7..9bbe8342 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -2570,7

[PATCH gnumach] pmap: Fix out of bounds mapwindow when using full NCPUS

2023-08-05 Thread Damien Zammit
There are only two slots per cpu. Use only one of two per cpu. --- i386/intel/pmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 0bb1a490..9bcbc279 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -1020,10 +1020,10

<    1   2   3   4   5   6   7   >