Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
735f178
selftests: multikernel: reproduce stale and duplicate ACK completion
pro-utkarshM Sep 27, 2026
ccd11fe
multikernel: make pending message completion single-shot
pro-utkarshM Sep 27, 2026
c9533b7
multikernel: correlate resource and shutdown ACKs by request ID
pro-utkarshM Sep 27, 2026
985a53a
multikernel: keep PCI ACK resource keys unsigned
pro-utkarshM Sep 27, 2026
8de9d04
multikernel: decode resource and system payloads in aligned storage
pro-utkarshM Oct 4, 2026
5c4a958
multikernel: retain CPU ownership across uncertain handoffs
pro-utkarshM Oct 4, 2026
4bac9e7
multikernel: serialize controller image and resource operations
pro-utkarshM Oct 4, 2026
862d1a1
multikernel: order received CPU hotplug requests
pro-utkarshM Oct 4, 2026
4278cf3
multikernel: quiesce incoming hotplug work before requested shutdown
pro-utkarshM Oct 4, 2026
021d794
multikernel: fence controller workers and require confirmed stop befo…
pro-utkarshM Oct 4, 2026
f721070
x86/multikernel: confirm destination arrival before retiring a park area
pro-utkarshM Oct 4, 2026
6d65f17
multikernel: serialize callback registration and close cleanup admission
pro-utkarshM Oct 4, 2026
629c379
multikernel: order ring capacity release before slot reuse
pro-utkarshM Oct 4, 2026
14af387
multikernel: preserve the shared host receive ring across respawn
pro-utkarshM Oct 4, 2026
ec0fa03
selftests: multikernel: expand compact fixture statements
pro-utkarshM Oct 5, 2026
a80b359
multikernel: use raw locking for pending ACK completion from hard IPI
pro-utkarshM Oct 5, 2026
bab3aed
x86/multikernel: wake locally donated CPUs on the local pool slot
pro-utkarshM Oct 5, 2026
de9907e
x86/kexec: guard multikernel E820 setup in the bzImage loader
pro-utkarshM Oct 5, 2026
6f88735
tty: defer multikernel host receive wakeups out of hard IPI context
pro-utkarshM Oct 5, 2026
8263cb7
tty: defer multikernel spawn input delivery to preallocated work
pro-utkarshM Oct 5, 2026
dbe2700
tty: close multikernel receive initialization and session teardown gaps
pro-utkarshM Oct 5, 2026
aaa4f94
multikernel: serialize pool CPU set updates with x86 wake readers
pro-utkarshM Oct 5, 2026
86bdec0
test: format multikernel lifecycle fixtures
pro-utkarshM Oct 6, 2026
468b237
multikernel: reject execution before active halt settlement
pro-utkarshM Oct 6, 2026
ce39676
multikernel: drain native CPU hotplug before shutdown acknowledgment
pro-utkarshM Oct 6, 2026
049e998
x86/multikernel: qualify voluntary halt notifications before reuse
pro-utkarshM Oct 6, 2026
3b90b06
multikernel: serialize kernfs device-tree snapshots with resource wri…
pro-utkarshM Oct 6, 2026
7c3f71c
kexec: free command line on early file-load failure
pro-utkarshM Oct 6, 2026
f90212b
cpu/hotplug: withdraw presence before completing multikernel departure
pro-utkarshM Oct 7, 2026
c4cd652
cpu/hotplug: serialize multikernel handback and retain uncertain owne…
pro-utkarshM Oct 7, 2026
15e00c7
x86/multikernel: quarantine uncertain mailbox handoffs
pro-utkarshM Oct 7, 2026
e5287ca
multikernel: require CPU hotplug for lifecycle support
pro-utkarshM Oct 7, 2026
70d58bc
multikernel: preserve early PCI message handler registration
pro-utkarshM Oct 23, 2026
9a4ca35
selftests: multikernel: account for pool mapping retirement
pro-utkarshM Oct 23, 2026
9921b7f
multikernel: require boot Device Tree support for manifests
pro-utkarshM Oct 23, 2026
d83cf00
multikernel: retire admitted PCI requests before instance reuse
pro-utkarshM Oct 23, 2026
76fa2b1
multikernel: retain uncertain resource transfers and failed overlays
pro-utkarshM Oct 23, 2026
71b6b4b
multikernel: drain stopped-peer inbox requests before reuse
pro-utkarshM Oct 23, 2026
81f7ffb
multikernel: retain memory when pool unmapping fails
pro-utkarshM Oct 23, 2026
893d7e9
multikernel: allow the empty host memory record at first baseline
pro-utkarshM Oct 23, 2026
b2c404e
multikernel: preallocate one-shot requested shutdown work
pro-utkarshM Oct 24, 2026
2560b0e
multikernel: pin preallocated voluntary halt work through settlement
pro-utkarshM Oct 24, 2026
d5a6fdf
multikernel: assemble messages in the reserved IPI slot
pro-utkarshM Oct 24, 2026
248188a
multikernel: preallocate bounded resource request work
pro-utkarshM Oct 24, 2026
efffba4
multikernel: preallocate deferred PCI config requests
pro-utkarshM Oct 24, 2026
501cb24
vsock/multikernel: defer receive allocation out of raw IPI context
pro-utkarshM Oct 24, 2026
b7a6f1c
multikernel: reject local PCI hotplug without PCI support
pro-utkarshM Oct 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,9 @@ config ARCH_SUPPORTS_MULTIKERNEL
config ARCH_HAS_MK_HOST_PARK
def_bool X86_64

config ARCH_HAS_MK_FORCE_STOP
def_bool X86_64

config ARCH_SUPPORTS_CRASH_DUMP
def_bool X86_64 || (X86_32 && HIGHMEM)

Expand Down
21 changes: 14 additions & 7 deletions arch/x86/include/asm/multikernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
#define MK_SPAWN_F_SECONDARY BIT(0) /* Secondary CPU joining existing kernel */
#define MK_SPAWN_F_REPARK BIT(1) /* Move the CPU to another park slot */

/* Shared C/assembly protocol. All participating kernels must use it. */
#define MK_SLOT_IDLE 0
#define MK_SLOT_PENDING 1
#define MK_SLOT_BUSY 2
#define MK_SLOT_ACK 3
#define MK_SLOT_QUARANTINED 4

#ifndef __ASSEMBLY__

#include <linux/build_bug.h>
Expand Down Expand Up @@ -126,7 +133,7 @@ struct mk_spawn_context {
unsigned long ctrl_size; /* park page, page tables. Spawn must not reuse it */
u32 target_apic_id; /* Target CPU's APIC ID */
u32 flags; /* MK_SPAWN_F_* flags */
u32 ready; /* Signal flag */
u32 ready; /* MK_SLOT_* state, not a boolean */
u32 reserved; /* Padding for alignment */
/* Keep all existing context offsets unchanged. */
struct boot_params bp; /* Standard x86 boot params */
Expand Down Expand Up @@ -184,12 +191,12 @@ struct mk_spawn_context *mk_alloc_spawn_context(struct mk_instance *instance,
struct boot_params *mk_spawn_context_boot_params(struct mk_spawn_context *ctx);

/* Set up spawn context for kernel boot */
void mk_set_spawn_context(struct mk_spawn_context *ctx,
unsigned long identity_cr3,
unsigned long kernel_entry,
unsigned long trampoline_virt,
unsigned long trampoline_phys,
unsigned long park_phys);
int mk_set_spawn_context(struct mk_spawn_context *ctx,
unsigned long identity_cr3,
unsigned long kernel_entry,
unsigned long trampoline_virt,
unsigned long trampoline_phys,
unsigned long park_phys);

/* Trigger spawn on a pool CPU */
int mk_spawn_cpu(struct mk_instance *instance, int cpu,
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/kernel/kexec-bzimage64.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,12 +752,14 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
goto out_free_params;

/* For multikernel, setup custom e820 map */
#ifdef CONFIG_MULTIKERNEL
if (image->type == KEXEC_TYPE_MULTIKERNEL) {
image->arch.mk_boot_params = bootparam_load_addr;
ret = mk_e820_fill(image->mk_instance, params);
if (ret)
goto out_free_params;
}
#endif

/* Allocate loader specific data */
ldata = kzalloc_obj(struct bzimage64_data);
Expand Down
43 changes: 30 additions & 13 deletions arch/x86/multikernel/direct_boot.S
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ SYM_CODE_START_LOCAL_NOALIGN(mk_park_identity)

.Lpark_wait:
movl MK_CTX_ready(%r12), %eax
cmpl $1, %eax
cmpl $MK_SLOT_PENDING, %eax
je .Lpark_pending

testq %r15, %r15
Expand All @@ -334,7 +334,7 @@ SYM_CODE_START_LOCAL_NOALIGN(mk_park_identity)
xorl %edx, %edx
monitor
movl MK_CTX_ready(%r12), %eax
cmpl $1, %eax
cmpl $MK_SLOT_PENDING, %eax
je .Lpark_pending
xorl %eax, %eax
xorl %ecx, %ecx
Expand All @@ -346,17 +346,24 @@ SYM_CODE_START_LOCAL_NOALIGN(mk_park_identity)
jmp .Lpark_wait

.Lpark_pending:
/* Wakeup published; is it for us? */
/* Advisory filter only; recheck after claiming the current publication. */
movl MK_CTX_target_apic_id(%r12), %eax
cmpl %r13d, %eax
jne .Lpark_relax

/*
* Copy the publication into registers BEFORE claiming: once the
* claim clears ready, the publisher may reuse the slot for the
* next CPU. The claim (lock cmpxchg) makes exactly one of
* waker-revoke and us win; on loss the staged values are dropped.
* Claim before authoritative reads. A reader delayed across slot reuse
* can claim a newer publication, but then must re-read its target and
* every dispatch field. BUSY prevents writes while registers are staged.
*/
movl $MK_SLOT_PENDING, %eax
movl $MK_SLOT_BUSY, %ebp
lock cmpxchgl %ebp, MK_CTX_ready(%r12)
jnz .Lpark_wait
movl MK_CTX_target_apic_id(%r12), %eax
cmpl %r13d, %eax
jne .Lpark_wrong_target

movl MK_CTX_flags(%r12), %r11d
testl $MK_SPAWN_F_REPARK, %r11d
jnz .Lpark_repark
Expand All @@ -375,8 +382,8 @@ SYM_CODE_START_LOCAL_NOALIGN(mk_park_identity)
addq $MK_CTX_bp, %rsi
movq MK_CTX_kernel_entry(%r12), %rdx
movq MK_CTX_trampoline_phys(%r12), %r8
movl $1, %eax
xorl %ebp, %ebp
movl $MK_SLOT_BUSY, %eax
movl $MK_SLOT_ACK, %ebp
lock cmpxchgl %ebp, MK_CTX_ready(%r12)
jnz .Lpark_wait
movq %r8, %rcx
Expand All @@ -395,8 +402,8 @@ SYM_CODE_START_LOCAL_NOALIGN(mk_park_identity)
movq MK_CTX_stack(%r12), %rcx
movq MK_CTX_secondary_trampoline_phys(%r12), %r8
movq MK_CTX_spawn_cr3(%r12), %r9
movl $1, %eax
xorl %ebp, %ebp
movl $MK_SLOT_BUSY, %eax
movl $MK_SLOT_ACK, %ebp
lock cmpxchgl %ebp, MK_CTX_ready(%r12)
jnz .Lpark_wait
ANNOTATE_RETPOLINE_SAFE
Expand All @@ -414,12 +421,15 @@ SYM_CODE_START_LOCAL_NOALIGN(mk_park_identity)
* The repark_* dispatch fields are separate from the park_phys/
* park_cr3/self_phys anchor so that publishing a repark on a live
* instance context never corrupts the context's own park identity.
* ACK below proves only staged dispatch. Before retiring this page or
* its page table the publisher must obtain a second claim from the
* destination loop, which cannot run until the jump below completes.
*/
movq MK_CTX_repark_park_cr3(%r12), %r14
movq MK_CTX_repark_park_phys(%r12), %rcx
movq MK_CTX_repark_slot_phys(%r12), %r10
movl $1, %eax
xorl %ebp, %ebp
movl $MK_SLOT_BUSY, %eax
movl $MK_SLOT_ACK, %ebp
lock cmpxchgl %ebp, MK_CTX_ready(%r12)
jnz .Lpark_wait
movq %r10, %r12
Expand All @@ -430,6 +440,13 @@ SYM_CODE_START_LOCAL_NOALIGN(mk_park_identity)
addq $mk_park_identity - mk_pool_park, %rcx
ANNOTATE_RETPOLINE_SAFE
jmp *%rcx

.Lpark_wrong_target:
/* A newer request belongs to another CPU; never undo quarantine. */
movl $MK_SLOT_BUSY, %eax
movl $MK_SLOT_PENDING, %ebp
lock cmpxchgl %ebp, MK_CTX_ready(%r12)
jmp .Lpark_wait
SYM_CODE_END(mk_park_identity)

/*
Expand Down
Loading