mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
lx_emul: consolidate SMP + NO_HZ_IDLE
* Move common SMP and NO_HZ_IDLE variables and functions into generic lx_emul shadow implementations, and integrate them into the common lx_emul import rules * Enable SMP and NO_HZ_IDLE within virt_linux kernel configuration * Adapt pc drivers and wireguard accordingly * Use original Linux softirq implementation in wireguard * Remove erroneous softirq shadow implementation Ref genodelabs/genode#4540 Ref genodelabs/genode#4562
This commit is contained in:
committed by
Christian Helmuth
parent
48eacb6f79
commit
89f9e7a3ee
@@ -21,10 +21,6 @@ SRC_CC += lx_emul/irq.cc
|
||||
SRC_CC += lx_emul/random.cc
|
||||
SRC_C += lx_emul/shadow/kernel/dma/mapping.c
|
||||
SRC_C += lx_emul/shadow/kernel/irq/spurious.c
|
||||
SRC_C += lx_emul/shadow/kernel/locking/spinlock.c
|
||||
SRC_C += lx_emul/shadow/kernel/rcu/tree.c
|
||||
SRC_C += lx_emul/shadow/kernel/sched/sched.c
|
||||
SRC_C += lx_emul/shadow/kernel/stop_machine.c
|
||||
SRC_C += lx_emul/shadow/lib/devres.c
|
||||
SRC_C += lx_emul/shadow/lib/smp_processor_id.c
|
||||
SRC_C += lx_emul/shadow/mm/memblock.c
|
||||
@@ -51,7 +47,6 @@ SRC_C += lx_emul/vmalloc.c
|
||||
SRC_C += lx_emul/delay.c
|
||||
|
||||
SRC_C += lx_emul/shadow/fs/libfs.c
|
||||
SRC_C += lx_emul/shadow/kernel/rcu/tiny.c
|
||||
SRC_C += lx_emul/shadow/lib/logic_iomem.c
|
||||
|
||||
SRC_C += lx_emul/shadow/drivers/char/random.c
|
||||
|
||||
@@ -528,30 +528,6 @@ void intel_dsb_commit(const struct intel_crtc_state *crtc_state)
|
||||
}
|
||||
|
||||
|
||||
void calc_load_nohz_start(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void calc_load_nohz_stop(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void account_idle_ticks(unsigned long ticks)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
bool irq_work_needs_cpu(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#include <asm/smp.h>
|
||||
|
||||
struct smp_ops smp_ops = { };
|
||||
|
||||
@@ -84,30 +84,6 @@ int __printk_ratelimit(const char * func)
|
||||
}
|
||||
|
||||
|
||||
void calc_load_nohz_start(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void calc_load_nohz_stop(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void account_idle_ticks(unsigned long ticks)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
bool irq_work_needs_cpu(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#include <linux/prandom.h>
|
||||
|
||||
u32 prandom_u32(void)
|
||||
|
||||
@@ -43,11 +43,6 @@ const struct trace_print_flags vmaflag_names[] = { {0,NULL}};
|
||||
const struct trace_print_flags pageflag_names[] = { {0,NULL}};
|
||||
|
||||
|
||||
#include <linux/kernel_stat.h>
|
||||
|
||||
struct kernel_stat kstat;
|
||||
|
||||
|
||||
#include <asm/processor.h>
|
||||
|
||||
/*
|
||||
@@ -371,13 +366,6 @@ bool pat_enabled(void)
|
||||
}
|
||||
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
atomic_t __num_online_cpus = ATOMIC_INIT(1);
|
||||
|
||||
unsigned long __per_cpu_offset[NR_CPUS] = { 0UL };
|
||||
|
||||
|
||||
struct srcu_struct;
|
||||
extern int __srcu_read_lock(struct srcu_struct * ssp);
|
||||
int __srcu_read_lock(struct srcu_struct * ssp)
|
||||
@@ -402,78 +390,6 @@ void cpu_hotplug_enable(void)
|
||||
}
|
||||
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
unsigned int cpumask_next(int n,const struct cpumask * srcp)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
return n + 1;
|
||||
}
|
||||
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
int cpumask_next_and(int n,const struct cpumask * src1p,const struct cpumask * src2p)
|
||||
{
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
|
||||
|
||||
#include <linux/sched.h>
|
||||
|
||||
void do_set_cpus_allowed(struct task_struct * p,const struct cpumask * new_mask)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
#include <linux/sched/isolation.h>
|
||||
|
||||
const struct cpumask * housekeeping_cpumask(enum hk_flags flags)
|
||||
{
|
||||
static struct cpumask ret;
|
||||
lx_emul_trace(__func__);
|
||||
return &ret;
|
||||
}
|
||||
|
||||
|
||||
#include <linux/sched/isolation.h>
|
||||
|
||||
bool housekeeping_enabled(enum hk_flags flags)
|
||||
{
|
||||
lx_emul_trace_and_stop(__func__);
|
||||
}
|
||||
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
unsigned int nr_cpu_ids = 1;
|
||||
|
||||
|
||||
#include <linux/rcutree.h>
|
||||
|
||||
noinstr void rcu_irq_enter(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
#include <linux/rcutree.h>
|
||||
|
||||
void noinstr rcu_irq_exit(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
#include <linux/rcutree.h>
|
||||
|
||||
void rcu_softirq_qs(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
extern void synchronize_srcu(struct srcu_struct * ssp);
|
||||
void synchronize_srcu(struct srcu_struct * ssp)
|
||||
{
|
||||
@@ -481,64 +397,15 @@ void synchronize_srcu(struct srcu_struct * ssp)
|
||||
}
|
||||
|
||||
|
||||
int cpu_number = 0;
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
DEFINE_PER_CPU(void *, hardirq_stack_ptr);
|
||||
#endif
|
||||
DEFINE_PER_CPU(bool, hardirq_stack_inuse);
|
||||
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
|
||||
EXPORT_PER_CPU_SYMBOL(irq_stat);
|
||||
|
||||
|
||||
extern void rcu_read_unlock_strict(void);
|
||||
void rcu_read_unlock_strict(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
DEFINE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off) = 0;
|
||||
EXPORT_PER_CPU_SYMBOL(this_cpu_off);
|
||||
|
||||
|
||||
#include <asm/processor.h>
|
||||
|
||||
DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
|
||||
EXPORT_PER_CPU_SYMBOL(cpu_info);
|
||||
|
||||
|
||||
#include <linux/sched/nohz.h>
|
||||
|
||||
void wake_up_nohz_cpu(int cpu)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
#include <linux/sched/nohz.h>
|
||||
|
||||
void nohz_balance_enter_idle(int cpu)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
#include <linux/vmstat.h>
|
||||
|
||||
void quiet_vmstat(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
extern int idle_cpu(int cpu);
|
||||
int idle_cpu(int cpu)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ arch/x86/include/asm/cmpxchg.h
|
||||
arch/x86/include/asm/compat.h
|
||||
arch/x86/include/asm/cpu_entry_area.h
|
||||
arch/x86/include/asm/cpufeatures.h
|
||||
arch/x86/include/asm/cpu.h
|
||||
arch/x86/include/asm/cpumask.h
|
||||
arch/x86/include/asm/delay.h
|
||||
arch/x86/include/asm/desc.h
|
||||
@@ -239,6 +240,7 @@ include/linux/atomic.h
|
||||
include/linux/audit.h
|
||||
include/linux/auxvec.h
|
||||
include/linux/backing-dev-defs.h
|
||||
include/linux/bcd.h
|
||||
include/linux/binfmts.h
|
||||
include/linux/bio.h
|
||||
include/linux/bit_spinlock.h
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* \brief Replaces kernel/rcu/tiny.c
|
||||
* \author Josef Soentgen
|
||||
* \date 2022-04-05
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/mm.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
void call_rcu(struct rcu_head * head,rcu_callback_t func)
|
||||
{
|
||||
/*
|
||||
* In case func is a small offset kvfree should be
|
||||
* called directly, see 'rcu_reclaim_tiny'.
|
||||
*/
|
||||
enum { KVFREE_RCU_OFFSET = 4096, };
|
||||
if (func < (rcu_callback_t)KVFREE_RCU_OFFSET) {
|
||||
kvfree((void*)head - (unsigned long)func);
|
||||
return;
|
||||
}
|
||||
|
||||
func(head);
|
||||
}
|
||||
@@ -296,30 +296,6 @@ int net_ratelimit(void)
|
||||
}
|
||||
|
||||
|
||||
void calc_load_nohz_start(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void calc_load_nohz_stop(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void account_idle_ticks(unsigned long ticks)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
bool irq_work_needs_cpu(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#include <asm/smp.h>
|
||||
|
||||
struct smp_ops smp_ops = { };
|
||||
|
||||
@@ -29,31 +29,6 @@
|
||||
#include <linux/timekeeper_internal.h>
|
||||
|
||||
|
||||
void calc_load_nohz_start(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void calc_load_nohz_stop(void)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
void account_idle_ticks(unsigned long ticks)
|
||||
{
|
||||
lx_emul_trace(__func__);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool irq_work_needs_cpu(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int ___ratelimit(struct ratelimit_state * rs, const char * func)
|
||||
{
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user