From: cheloha Date: Tue, 4 Jul 2023 17:29:32 +0000 (+0000) Subject: amd64: cpu_info: rearrange members, keep ci_mds_tmp 32-byte aligned X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a8972bbdccfe12ff7cd06e6c7b306bd7d7b7c727;p=openbsd amd64: cpu_info: rearrange members, keep ci_mds_tmp 32-byte aligned ci_mds_tmp needs to be 32-byte aligned, otherwise we trip a CTASSERT in amd64/cpu.c and break kernel compilation. However, ci_mds_tmp's 32-byte alignment is at risk: the size of schedstate_percpu is about to change. Move ci_curproc and ci_schedstate up just after ci_mds_buf. This puts ci_mds_tmp at page offset 64 with no structs ahead of it in cpu_info. With this arrangement it should remain 32-byte aligned without much effort. With input from guenther@. ok guenther@ --- diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index eea800a78ff..d9980176657 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.154 2022/11/29 21:41:39 guenther Exp $ */ +/* $OpenBSD: cpu.h,v 1.155 2023/07/04 17:29:32 cheloha Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -112,10 +112,8 @@ struct cpu_info { #define ci_PAGEALIGN ci_dev struct device *ci_dev; /* [I] */ struct cpu_info *ci_self; /* [I] */ - struct schedstate_percpu ci_schedstate; /* scheduler state */ struct cpu_info *ci_next; /* [I] */ - struct proc *ci_curproc; /* [o] */ u_int ci_cpuid; /* [I] */ u_int ci_apicid; /* [I] */ u_int ci_acpi_proc_id; /* [I] */ @@ -129,6 +127,9 @@ struct cpu_info { char ci_mds_tmp[32]; /* [o] 32byte aligned */ void *ci_mds_buf; /* [I] */ + struct proc *ci_curproc; /* [o] */ + struct schedstate_percpu ci_schedstate; /* scheduler state */ + struct pmap *ci_proc_pmap; /* last userspace pmap */ struct pcb *ci_curpcb; /* [o] */ struct pcb *ci_idle_pcb; /* [o] */