Re: [PATCH] Enable -Wmissing-prototypes.

2023-01-29 Thread Samuel Thibault
Applied, thanks!

Flavio Cruz, le dim. 29 janv. 2023 01:09:00 -0500, a ecrit:
> * Makefile.am: enable -Wmissing-prototypes
> * ddb/db_inout.h: Prototype kdb_kintr for entering into DDB.
> * ddb/db_mp.c Include ddb/db_input.h to get kdb_kintr.
> * i386/i386at/kd.h: Include ddb/input.h to get kdb_kintr.
> * linux/Makefrag.am: Disable some of the new warnings for linux drivers,
>   otherwise we will get more and more noise.
> ---
>  Makefile.am   | 2 +-
>  ddb/db_input.h| 3 +++
>  ddb/db_mp.c   | 1 +
>  i386/i386at/kd.h  | 2 +-
>  linux/Makefrag.am | 4 
>  5 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index c52241e9..10d030b8 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -61,7 +61,7 @@ AM_CCASFLAGS += \
>  # Yes, this makes the eyes hurt.  But perhaps someone will finally take care 
> of
>  # all that scruffy Mach code...  Also see 
> .
>  AM_CFLAGS += \
> - -Wall -Wstrict-prototypes -Wold-style-definition
> + -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
>  
>  # We need the GNU-style inline
>  AM_CFLAGS += \
> diff --git a/ddb/db_input.h b/ddb/db_input.h
> index 77f07bb6..352f035e 100644
> --- a/ddb/db_input.h
> +++ b/ddb/db_input.h
> @@ -23,6 +23,9 @@
>  
>  #include 
>  
> +/* Needs to be implemented by each arch. */
> +extern void kdb_kintr(void);
> +
>  extern int db_readline (char *lstart, int lsize);
>  
>  extern void db_check_interrupt(void);
> diff --git a/ddb/db_mp.c b/ddb/db_mp.c
> index 7c0f6f26..f4e5fa3e 100644
> --- a/ddb/db_mp.c
> +++ b/ddb/db_mp.c
> @@ -38,6 +38,7 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/i386/i386at/kd.h b/i386/i386at/kd.h
> index 53fbce51..3ee707b5 100644
> --- a/i386/i386at/kd.h
> +++ b/i386/i386at/kd.h
> @@ -692,7 +692,7 @@ extern void kd_slmscd (void *from, void *to, int count);
>  extern void kdintr(int vec);
>  
>  #if MACH_KDB
> -extern void kdb_kintr(void);
> +#include 
>  #endif /* MACH_KDB */
>  
>  extern int kdopen(dev_t dev, int flag, io_req_t ior);
> diff --git a/linux/Makefrag.am b/linux/Makefrag.am
> index 38718a3f..23384523 100644
> --- a/linux/Makefrag.am
> +++ b/linux/Makefrag.am
> @@ -37,6 +37,10 @@ liblinux_a_CPPFLAGS = $(AM_CPPFLAGS) \
>  # corresponding text segment definitions, we must always optimize.
>  liblinux_a_CFLAGS = -O2 $(AM_CFLAGS)
>  
> +# Disable warnings that are applied to the core Mach code.
> +liblinux_a_CFLAGS += -Wno-missing-prototypes -Wno-strict-prototypes \
> + -Wno-old-style-definition
> +
>  # See .
>  liblinux_a_CFLAGS += \
>   -fno-strict-aliasing
> -- 
> 2.39.0
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



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

2023-01-29 Thread Samuel Thibault
Applied, thanks!

Damien Zammit, le sam. 21 janv. 2023 08:04:44 +, a ecrit:
> 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 ApicLocalUnit* lapic;
> 
>  #ifndef __ASSEMBLER__
> 
> +#ifdef APIC
>  static inline void mask_irq (unsigned int irq_nr) {
>  ioapic_toggle(irq_nr, IOAPIC_MASK_DISABLED);
>  }
> @@ -214,6 +215,7 @@ static inline void mask_irq (unsigned int irq_nr) {
>  static inline void unmask_irq (unsigned int irq_nr) {
>  ioapic_toggle(irq_nr, IOAPIC_MASK_ENABLED);
>  }
> +#endif
> 
>  #endif  /* !__ASSEMBLER__ */
> 
> --
> 2.34.1
> 
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



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

2023-01-29 Thread Samuel Thibault
It seems most of my comments didn't get applied. To be able to progress
at all, I commited this along with the changes I requested.

Samuel

Damien Zammit, le sam. 21 janv. 2023 08:04:52 +, a ecrit:
> ---
>  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 +++---
>  i386/i386/ktss.h|  1 +
>  i386/i386/ldt.c | 31 ---
>  i386/i386/ldt.h |  9 
>  i386/i386/locore.S  |  4 
>  i386/i386/mp_desc.h |  2 ++
>  i386/i386at/idt.h   |  4 
>  i386/i386at/int_init.c  | 39 +-
>  i386/i386at/int_init.h  |  1 +
>  i386/i386at/interrupt.S |  8 +++
>  i386/i386at/ioapic.c|  6 --
>  17 files changed, 163 insertions(+), 56 deletions(-)
> 
> diff --git a/i386/i386/apic.c b/i386/i386/apic.c
> index 2e0c1776..d30084e2 100644
> --- a/i386/i386/apic.c
> +++ b/i386/i386/apic.c
> @@ -234,3 +234,9 @@ void apic_print_info(void)
>  }
>  }
>  }
> +
> +void
> +lapic_eoi(void)
> +{
> +lapic->eoi.r = 0;
> +}
> diff --git a/i386/i386/gdt.c b/i386/i386/gdt.c
> index fb18360e..ddda603b 100644
> --- a/i386/i386/gdt.c
> +++ b/i386/i386/gdt.c
> @@ -39,6 +39,7 @@
>  #include "vm_param.h"
>  #include "seg.h"
>  #include "gdt.h"
> +#include "mp_desc.h"
> 
>  #ifdef   MACH_PV_DESCRIPTORS
>  /* It is actually defined in xen_boothdr.S */
> @@ -46,28 +47,28 @@ extern
>  #endif   /* MACH_PV_DESCRIPTORS */
>  struct real_descriptor gdt[GDTSZ];
> 
> -void
> -gdt_init(void)
> +static void
> +gdt_fill(struct real_descriptor *mygdt)
>  {
>   /* Initialize the kernel code and data segment descriptors.  */
>  #ifdef __x86_64__
>   assert(LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS == 0);
> - fill_gdt_descriptor(KERNEL_CS, 0, 0, ACC_PL_K|ACC_CODE_R, SZ_64);
> - fill_gdt_descriptor(KERNEL_DS, 0, 0, ACC_PL_K|ACC_DATA_W, SZ_64);
> + _fill_gdt_descriptor(mygdt, KERNEL_CS, 0, 0, ACC_PL_K|ACC_CODE_R, 
> SZ_64);
> + _fill_gdt_descriptor(mygdt, KERNEL_DS, 0, 0, ACC_PL_K|ACC_DATA_W, 
> SZ_64);
>  #ifndef  MACH_PV_DESCRIPTORS
> - fill_gdt_descriptor(LINEAR_DS, 0, 0, ACC_PL_K|ACC_DATA_W, SZ_64);
> + _fill_gdt_descriptor(mygdt, LINEAR_DS, 0, 0, ACC_PL_K|ACC_DATA_W, 
> SZ_64);
>  #endif   /* MACH_PV_DESCRIPTORS */
>  #else
> - fill_gdt_descriptor(KERNEL_CS,
> + _fill_gdt_descriptor(mygdt, KERNEL_CS,
>   LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS,
>   LINEAR_MAX_KERNEL_ADDRESS - 
> (LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) - 1,
>   ACC_PL_K|ACC_CODE_R, SZ_32);
> - fill_gdt_descriptor(KERNEL_DS,
> + _fill_gdt_descriptor(mygdt, KERNEL_DS,
>   LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS,
>   LINEAR_MAX_KERNEL_ADDRESS - 
> (LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) - 1,
>   ACC_PL_K|ACC_DATA_W, SZ_32);
>  #ifndef  MACH_PV_DESCRIPTORS
> - fill_gdt_descriptor(LINEAR_DS,
> + _fill_gdt_descriptor(mygdt, LINEAR_DS,
>   0,
>   0x,
>   ACC_PL_K|ACC_DATA_W, SZ_32);
> @@ -75,8 +76,8 @@ gdt_init(void)
>  #endif
> 
>  #ifdef   MACH_PV_DESCRIPTORS
> - unsigned long frame = kv_to_mfn(gdt);
> - pmap_set_page_readonly(gdt);
> + unsigned long frame = kv_to_mfn(mygdt);
> + pmap_set_page_readonly(mygdt);
>   if (hyp_set_gdt(kv_to_la(&frame), GDTSZ))
>   panic("couldn't set gdt\n");
>  #endif
> @@ -94,12 +95,16 @@ gdt_init(void)
>   {
>   struct pseudo_descriptor pdesc;
> 
> - pdesc.limit = sizeof(gdt)-1;
> - pdesc.linear_base = kvtolin(&gdt);
> + pdesc.limit = (GDTSZ * sizeof(struct real_descriptor))-1;
> + pdesc.linear_base = kvtolin(mygdt);
>   lgdt(&pdesc);
>   }
>  #endif   /* MACH_PV_DESCRIPTORS */
> +}
> 
> +static void
> +reload_segs(void)
> +{
>   /* Reload all the segment registers from the new GDT.
>  We must load ds and es with 0 before loading them with KERNEL_DS
>  because some processors will "optimize out" the loads
> @@ -117,6 +122,15 @@ gdt_init(void)
>"movw  %w1,%%ss\n"
>: : "i" (KERNEL_CS), "r" (KERNEL_DS), "r" (0));
>  #endif
> +}
> +
> +void
> +gdt_init(void)
> +{
> + gdt_fill(gdt);
> +
> + reload_segs();
> +
>  #ifdef   MACH_PV_PAGETABLES
>  #if VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS
>   /* things now get shifted */
> @@ -128,3 +142,12 @@ gdt_init(void)
>  #endif   /* MACH_PV_PAGETABLES */
>  }
> 
> +#if NCPUS > 1
> +void
> +a

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

2023-01-29 Thread Samuel Thibault
Hello,

Damien Zammit, le sam. 21 janv. 2023 08:04:59 +, a ecrit:
> ---
>  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 
>  5 files changed, 308 insertions(+), 88 deletions(-)
> 
> diff --git a/i386/i386/apic.c b/i386/i386/apic.c
> index d30084e2..78a2d006 100644
> --- a/i386/i386/apic.c
> +++ b/i386/i386/apic.c
> @@ -1,5 +1,5 @@
>  /* apic.c - APIC controller management for Mach.
> -   Copyright (C) 2020 Free Software Foundation, Inc.
> +   Copyright (C) 2021 Free Software Foundation, Inc.
> Written by Almudena Garcia Jurado-Centurion
> 
> This file is part of GNU Mach.

? That really was committed in 2020.

> @@ -116,11 +118,29 @@ uint16_t
>  apic_get_cpu_apic_id(int kernel_id)
>  {
>  if (kernel_id >= NCPUS)
> -return -1;
> +return 0;
> 
>  return apic_data.cpu_lapic_list[kernel_id];
>  }
> 
> +
> +/*
> + * apic_get_cpu_kernel_id: returns the kernel_id of a cpu.
> + * Receives as input the APIC ID of a CPU.
> + */
> +int
> +apic_get_cpu_kernel_id(uint16_t apic_id)
> +{
> +int i;
> +
> +for (i = 0; i < apic_data.ncpus; i++) {
> +if (apic_data.cpu_lapic_list[i] == apic_id)
> +return i;
> +}
> +
> +return 0;

As already mentioned, we do want to have a different value (here, -1)
when unexpected things happen. Yes, it means the caller has to cope with
such case. We do want to catch such cases otherwise we'll get bitten by
bugs whenever they happen.

Samuel



Re: [PATCH 4/4] Add cpu_number and cpuboot

2023-01-29 Thread Samuel Thibault
See my previous review on this, you haven't addressed by comments.

Damien Zammit, le sam. 21 janv. 2023 08:05:06 +, a ecrit:
> ---
>  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
> new file mode 100644
> index ..d4621669
> --- /dev/null
> +++ b/i386/i386/cpu_number.c
> @@ -0,0 +1,37 @@
> +/*
> + * Copyright (c) 2022 Free Software Foundation, Inc.
> + *
> + * This program is free software: you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation, either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see .
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#if NCPUS > 1
> +int cpu_number(void)
> +{
> + int kernel_id;
> + unsigned long flags;
> +
> + cpu_intr_save(&flags);
> +
> + kernel_id = apic_get_cpu_kernel_id(apic_get_current_cpu());
> +
> + cpu_intr_restore(flags);
> +
> + return kernel_id;
> +}
> +#endif
> diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S
> new file mode 100644
> index ..4a5823be
> --- /dev/null
> +++ b/i386/i386/cpuboot.S
> @@ -0,0 +1,164 @@
> +/*
> + * Copyright (c) 2022 Free Software Foundation, Inc.
> + *
> + * This program is free software: you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation, either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see .
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define AP_BOOT_ADDR 0x7000
> +#define M(addr)  (addr - apboot + AP_BOOT_ADDR)
> +#define CR0_CLEAR_FLAGS_CACHE_ENABLE (CR0_CD | CR0_NW)
> +#define CR0_SET_FLAGS(CR0_CLEAR_FLAGS_CACHE_ENABLE | CR0_PE)
> +#define CR0_CLEAR_FLAGS (CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_TS | CR0_EM 
> | CR0_MP)
> +#define BOOT_CS  0x8
> +#define BOOT_DS  0x10
> +
> +.text
> +
> +.align 16
> +apboot_idt_ptr:
> + .long 0
> +.align 16
> + .word 0
> +apboot_gdt_descr:
> + .word 3*8+7
> + .long apboot_gdt - KERNELBASE
> +.align 16
> +apboot_gdt:
> + /* NULL segment */
> + .quad 0
> + /* KERNEL_CS */
> + .word 0x /* Segment limit first 0-15 bits*/
> + .word (-KERNELBASE) & 0x /*Base first 0-15 bits*/
> + .byte ((-KERNELBASE) >> 16) & 0xff /*Base 16-23 bits */
> + .byte (ACC_P | ACC_CODE_R) /*Access byte */
> + .byte 0xcf /* High 4 bits */
> + .byte ((-KERNELBASE) >> 24) & 0xff /*Base 24-31 bits */
> + /* KERNEL_DS */
> + .word 0x /*Segment limit */
> + .word (-KERNELBASE) & 0x /*Base first 0-15 bits*/
> + .byte ((-KERNELBASE) >> 16) & 0xff
> + .byte (ACC_P | ACC_DATA_W) /*Access byte*/
> + .byte 0xcf /* High 4 bits */
> + .byte ((-KERNELBASE) >> 24) & 0xff /*Base 24-31 bits */
> +
> +.globl apboot, apbootend
> +.align 16
> +.code16
> +
> +apboot:
> +_apboot:
> + cli
> + xorl%eax, %eax
> + movl%eax, %cr3
> + mov %ax, %ds
> + mov %ax, %es
> + mov %ax, %fs
> + mov %ax, %gs
> + mov %ax, %ss
> +
> + lgdtM(gdt_descr_tmp)
> +
> + movl%cr0, %eax
> + andl$~CR0_CLEAR_FLAGS, %eax
> + orl $CR0_SET_FLAGS, %eax
> + movl%eax, %cr0
> +
> + ljmp$BOOT_CS, $M(0f)
> +0:
> + .code32
> + movw$BOOT_DS, %ax
> + movw%ax, %ds
> + movw%ax, %es
> + movw%ax, %ss
> +
> + lgdtl   apboot_gdt_descr - KERNELBASE
> + ljmpl   $KERNEL_CS, $1f
> +1:
> + xorl%eax, %eax
> + movw%ax, %ds
> + movw%ax, %es
> + movw%ax, %fs
> + movw%ax, %gs
> + movw$KERNEL_DS, %ax
> + movw%ax, %ds
> + movw%ax, %es
> + movw%ax, %fs
> + movw%ax, %gs
> + movw%ax, %ss
> +
> + /* Load null 

Re: [RFC PATCH 2/3] hurd: Implement O_TMPFILE

2023-01-29 Thread Samuel Thibault
Hello,

Sergey Bugaev, le lun. 12 déc. 2022 14:46:35 +0300, a ecrit:
> diff --git a/sysdeps/mach/hurd/bits/fcntl.h b/sysdeps/mach/hurd/bits/fcntl.h
> index 17dcb384..b898a0c5 100644
> --- a/sysdeps/mach/hurd/bits/fcntl.h
> +++ b/sysdeps/mach/hurd/bits/fcntl.h
> @@ -123,6 +123,11 @@
>  # define O_CLOEXEC   0x0040 /* Set FD_CLOEXEC.  */
>  #endif
>  
> +#ifdef __USE_GNU
> +# define __O_TMPFILE 0x0080 /* Make a new unnamed file.  */
> +# define O_TMPFILE   (__O_TMPFILE | O_DIRECTORY)
> +#endif

I don't think we need the __O_TMPFILE variant, only the O_TMPFILE one?

Linux uses __ variants just because it has per-arch definitions.

Samuel



Re: [RFC PATCH 0/3] O_TMPFILE and SHM_ANON for the Hurd

2023-01-29 Thread Samuel Thibault
Hello,

Sergey Bugaev, le lun. 12 déc. 2022 14:46:33 +0300, a ecrit:
> Then, Linux also has memfd_create (), which makes a temp file without touching
> any fs at all. This API is widely used in the Wayland ecosystem as the
> recommended way to create shared memory.  But such an approach would not work
> as-is on the Hurd: in order for there to be an fd, there has to be a server
> somewhere, servicing that fd.

Can't glibc itself serve it?

The drawback is that it'd only keep working while the creator is
running.

> We can't just make an fd out of "pure memory" -- it may be an fd to
> /hurd/tmpfs, but that /hurd/tmpfs needs to exist and be accessible. So
> being usable in an empty chroot is not going to happen anyway, unless
> we start spawning our own instances of /hurd/tmpfs for each memfd,
> which sounds like a terrible idea.

For a really-working memfd, it'd have to be so anyway.

> And so in that light, the FreeBSD alternative to memfd_create () -- namely
> SHM_ANON -- sounds much more approachable to me, while being, well, a bit less
> widely supported in the Wayland ecosystem than memfd, but still quite popular.
> We already implement shm by creating files under /dev/shm/

That has the benefit of factorizing the server part, indeed.

> As for the implementation: basically all of the SHM_ANON implementation, 
> except
> the very definition, ended up in the generic / POSIX version of shm_open () 
> and
> __shm_get_name (), predicated on defined (SHM_ANON) && defined (O_TMPFILE).
> This sounds problematic: while there is indeed nothing Hurd-specific about the
> implementation, and any port that supports O_TMPFILE and wants to support
> SHM_ANON could use these code paths, what if another port wants to implement
> SHM_ANON differently? Should I make a separate copy of shm_open.c in
> sysdeps/mach/hurd instead of modifying the generic version?

I would say that we can afford not foreseeing this, and wait for the
case to happen to see how to refactor things?

Thanks for this! We'll be able to commit things after the 2.37 release.
Samuel



Re: [PATCH 0/12 - gnumach] SMP almost working!

2023-01-29 Thread Samuel Thibault
Bleh, I missed adding your name to these commits.

Sorry, there's way too much in my mbox plate not to make mistakes :/

Samuel

Almudena Garcia, le mar. 25 oct. 2022 12:03:06 +, a ecrit:
> Btw. Samuel, when you will apply these patches, could you add my name 
> together the Damien's name as commit's author? 
> 
> In patches  2, 4, 8, 9, 10 and 12.  These are based in my previous work. 
> 
> El martes 25 de octubre de 2022, Damien Zammit escribió:
> > This patch series is based on Almu's work on SMP,
> > with additional work by me and refactored for upstream.
> > 
> > My goal is to have --enable-ncpus=X and --{enable/disable}-apic
> > working with X >= 1.  That means PIC should still work with SMP on i386.
> > 
> > With --enable-ncpus=1 and --disable-apic
> > it still works as before.
> > 
> > With --enable-ncpus=2 and --disable-apic
> > it hangs at boot with -smp 1 (timer routing issue?)
> > 
> > With --enable-ncpus=2 and --enable-apic
> > it general protection faults with -smp 1 or 2 (nested interrupts?)
> > 
> > The first 6 patches are independent from each other
> > and quite small:
> > [PATCH 01/12] kdb: Fix TODO for multiprocessor
> > [PATCH 02/12] kern/startup: Disable interrupts before starting APs
> > [PATCH 03/12] bios32: Use phystokv() on low bios addresses
> > [PATCH 04/12] acpi: Add lapic_addr
> > [PATCH 05/12] linux: Reduce worst case wait to 10 seconds for disks
> > [PATCH 06/12] linux drivers: Don't depend on curr_pic_mask for APIC
> > 
> > The rest of the patches are to be reviewed in order of increasing
> > difficulty:
> > [PATCH 07/12] i386/pit: Tune delays
> > [PATCH 08/12] i386: Add AP variants of descriptor tables
> > [PATCH 09/12] i386: Fix lapic and ioapic for smp
> > [PATCH 10/12] Add cpu_number and cpuboot
> > [PATCH 11/12] i386: Fix race in multiprocessor ktss
> > 
> > The last commit is difficult to split up and includes changes in locore.S:
> > [PATCH 12/12] i386: Refactor int stacks to be per cpu for SMP



Re: [PATCH 0/12 - gnumach] SMP almost working!

2023-01-29 Thread Samuel Thibault
Damien, please do fix your git commit logs, to make sure Almudena's name
get credited.

Samuel

Samuel Thibault, le lun. 30 janv. 2023 00:33:46 +0100, a ecrit:
> Bleh, I missed adding your name to these commits.
> 
> Sorry, there's way too much in my mbox plate not to make mistakes :/
> 
> Samuel
> 
> Almudena Garcia, le mar. 25 oct. 2022 12:03:06 +, a ecrit:
> > Btw. Samuel, when you will apply these patches, could you add my name 
> > together the Damien's name as commit's author? 
> > 
> > In patches  2, 4, 8, 9, 10 and 12.  These are based in my previous work. 
> > 
> > El martes 25 de octubre de 2022, Damien Zammit escribió:
> > > This patch series is based on Almu's work on SMP,
> > > with additional work by me and refactored for upstream.
> > > 
> > > My goal is to have --enable-ncpus=X and --{enable/disable}-apic
> > > working with X >= 1.  That means PIC should still work with SMP on i386.
> > > 
> > > With --enable-ncpus=1 and --disable-apic
> > > it still works as before.
> > > 
> > > With --enable-ncpus=2 and --disable-apic
> > > it hangs at boot with -smp 1 (timer routing issue?)
> > > 
> > > With --enable-ncpus=2 and --enable-apic
> > > it general protection faults with -smp 1 or 2 (nested interrupts?)
> > > 
> > > The first 6 patches are independent from each other
> > > and quite small:
> > > [PATCH 01/12] kdb: Fix TODO for multiprocessor
> > > [PATCH 02/12] kern/startup: Disable interrupts before starting APs
> > > [PATCH 03/12] bios32: Use phystokv() on low bios addresses
> > > [PATCH 04/12] acpi: Add lapic_addr
> > > [PATCH 05/12] linux: Reduce worst case wait to 10 seconds for disks
> > > [PATCH 06/12] linux drivers: Don't depend on curr_pic_mask for APIC
> > > 
> > > The rest of the patches are to be reviewed in order of increasing
> > > difficulty:
> > > [PATCH 07/12] i386/pit: Tune delays
> > > [PATCH 08/12] i386: Add AP variants of descriptor tables
> > > [PATCH 09/12] i386: Fix lapic and ioapic for smp
> > > [PATCH 10/12] Add cpu_number and cpuboot
> > > [PATCH 11/12] i386: Fix race in multiprocessor ktss
> > > 
> > > The last commit is difficult to split up and includes changes in locore.S:
> > > [PATCH 12/12] i386: Refactor int stacks to be per cpu for SMP




[PATCH] Remove support setting custom demuxers during signal handling.

2023-01-29 Thread Flavio Cruz
We seem to call only into the exception and message server routines.
---
 hurd/msgportdemux.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/hurd/msgportdemux.c b/hurd/msgportdemux.c
index 7587beda43..676e2e5008 100644
--- a/hurd/msgportdemux.c
+++ b/hurd/msgportdemux.c
@@ -20,18 +20,6 @@
 #include 
 #include 
 
-struct demux
-  {
-struct demux *next;
-boolean_t (*demux) (mach_msg_header_t *inp,
-   mach_msg_header_t *outp);
-  };
-
-struct demux *_hurd_msgport_demuxers = NULL;
-
-extern boolean_t __msg_server (mach_msg_header_t *inp,
-  mach_msg_header_t *outp);
-
 static boolean_t
 msgport_server (mach_msg_header_t *inp,
mach_msg_header_t *outp)
@@ -40,11 +28,6 @@ msgport_server (mach_msg_header_t *inp,
  mach_msg_header_t *outp);
   extern boolean_t _S_exc_server (mach_msg_header_t *inp,
  mach_msg_header_t *outp);
-  struct demux *d;
-
-  for (d = _hurd_msgport_demuxers; d != NULL; d = d->next)
-if ((*d->demux) (inp, outp))
-  return 1;
 
   return (_S_exc_server (inp, outp)
  || _S_msg_server (inp, outp));
-- 
2.39.0




[PATCH] Include i386asm.h using i386/i386/i386.asm.h

2023-01-29 Thread Flavio Cruz
If we 1) build for x86_64 and 2) build in a separate directory, we will not have
-Ii386 (-Ix86_64 instead) hence this file won't be found since it is 
autogenerated.
---
 i386/i386at/int_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/i386/i386at/int_init.c b/i386/i386at/int_init.c
index 964ce1bb..1d264004 100644
--- a/i386/i386at/int_init.c
+++ b/i386/i386at/int_init.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 /* defined in locore.S */
 extern vm_offset_t int_entry_table[];
-- 
2.39.0




[PATCH] Use $(CC) instead of gcc to avoid relying on the host gcc.

2023-01-29 Thread Flavio Cruz
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 10d030b8..e31a875d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,7 +41,7 @@ AM_LDFLAGS =
 # Compilation flags
 #
 
-GCC_INSTALL = $(shell LANG=C gcc -print-search-dirs | sed -n -e 's/install: 
\(.*\)/\1/p')
+GCC_INSTALL = $(shell LANG=C $(CC) -print-search-dirs | sed -n -e 's/install: 
\(.*\)/\1/p')
 AM_CPPFLAGS += \
-imacros config.h -I $(GCC_INSTALL)/include
 
-- 
2.39.0