pc: enable SMP and softirq/tasklets in lx_emul

Enables symetric-multi-processor support in the Linux kernel configuration
used as base for the driver ports for PC. This is done to be compliant with
common usage of x86 drivers today.
Moreover, this commit uses the original kernel source for softirq/tasklet
implementation to get rid of the insufficient shadow implementation
in the lx_emul sources.

Ref genodelabs/genode#4562
This commit is contained in:
Stefan Kalkowski 2022-07-19 11:06:52 +02:00 committed by Christian Helmuth
parent ec1b060fc5
commit 596c20c199
35 changed files with 485 additions and 165 deletions

View File

@ -11,6 +11,7 @@
#undef call_on_stack
#undef ASM_CALL_ARG0
#undef do_softirq_own_stack
#define call_on_stack(stack, func, asm_call, argconstr...) \
{ \
@ -36,4 +37,9 @@
#define ASM_CALL_ARG0 \
"call *%P[__func] \n"
#define do_softirq_own_stack() \
{ \
__do_softirq(); \
}
#endif /* _LX_EMUL__SHADOW__ARCH__X89__INCLUDE__ASM__IRQ_STACK_H_ */

View File

@ -0,0 +1,21 @@
/**
* \brief Shadow copy of asm/percpu.h
* \author Stefan Kalkowski
* \date 2022-06-29
*/
#ifndef _LX_EMUL__SHADOW__ARCH__X86__INCLUDE__ASM__PERCPU_H_
#define _LX_EMUL__SHADOW__ARCH__X86__INCLUDE__ASM__PERCPU_H_
#include_next <asm/percpu.h>
/*
* The original implementation uses gs or fs register
* to hold an cpu offset, which is not set correctly in our use-case
* where we use one cpu only anyway.
*/
#undef __percpu_prefix
#define __percpu_prefix ""
#endif /* _LX_EMUL__SHADOW__ARCH__X86__INCLUDE__ASM__PERCPU_H_ */

View File

@ -0,0 +1,25 @@
/*
* \brief Replaces arch/x86/kernel/irq_32.c
* \author Stefan Kalkowski
* \date 2022-07-20
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#include <linux/interrupt.h>
void do_softirq_own_stack(void)
{
/*
* We have no IRQ stack to switch to anyway,
* so we stay here in contrast to the original
* implementation
*/
__do_softirq();
}

View File

@ -21,12 +21,32 @@
#include <lx_emul/task.h>
#ifndef CONFIG_INLINE_SPIN_LOCK
void __lockfunc _raw_spin_lock(raw_spinlock_t * lock)
{
arch_spin_lock(&lock->raw_lock);
}
#endif
#ifndef CONFIG_INLINE_SPIN_LOCK_BH
void __lockfunc _raw_spin_lock_bh(raw_spinlock_t * lock)
{
__local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
_raw_spin_lock(lock);
}
#endif
#ifndef CONFIG_INLINE_SPIN_LOCK_IRQ
void __lockfunc _raw_spin_lock_irq(raw_spinlock_t * lock)
{
_raw_spin_lock_irqsave(lock);
}
#endif
#ifndef CONFIG_INLINE_SPIN_LOCK_IRQSAVE
unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t * lock)
{
unsigned long flags;
@ -34,49 +54,131 @@ unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t * lock)
_raw_spin_lock(lock);
return flags;
}
#endif
#ifndef CONFIG_INLINE_SPIN_TRYLOCK
int __lockfunc _raw_spin_trylock(raw_spinlock_t * lock)
{
return arch_spin_trylock(&lock->raw_lock);
}
#endif
#ifdef CONFIG_UNINLINE_SPIN_UNLOCK
void __lockfunc _raw_spin_unlock(raw_spinlock_t * lock)
{
arch_spin_unlock(&lock->raw_lock);
}
#endif
#ifndef CONFIG_INLINE_SPIN_UNLOCK_BH
void __lockfunc _raw_spin_unlock_bh(raw_spinlock_t * lock)
{
_raw_spin_unlock(lock);
__local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
}
#endif
#ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQ
void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t * lock)
{
_raw_spin_unlock_irqrestore(lock, 0);
}
#endif
#ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE
void __lockfunc _raw_spin_unlock_irqrestore(raw_spinlock_t * lock,
unsigned long flags)
{
_raw_spin_unlock(lock);
local_irq_restore(flags);
}
#endif
void __lockfunc _raw_spin_lock_irq(raw_spinlock_t * lock)
#ifndef CONFIG_INLINE_READ_LOCK
void __lockfunc _raw_read_lock(rwlock_t * lock)
{
_raw_spin_lock_irqsave(lock);
lx_emul_trace_and_stop(__func__);
}
#endif
int __lockfunc _raw_spin_trylock(raw_spinlock_t * lock)
#ifndef CONFIG_INLINE_READ_LOCK_IRQSAVE
unsigned long __lockfunc _raw_read_lock_irqsave(rwlock_t * lock)
{
return arch_spin_trylock(&lock->raw_lock);
unsigned long flags;
local_irq_save(flags);
arch_read_lock(&(lock)->raw_lock);
return flags;
}
#endif
#ifndef CONFIG_INLINE_WRITE_UNLOCK_BH
void __lockfunc _raw_write_unlock_bh(rwlock_t * lock)
{
arch_write_unlock(&(lock)->raw_lock);
}
#endif
#ifndef CONFIG_INLINE_READ_UNLOCK_BH
void __lockfunc _raw_read_unlock_bh(rwlock_t * lock)
{
arch_read_unlock(&(lock)->raw_lock);
}
#endif
#ifndef CONFIG_INLINE_WRITE_LOCK
void __lockfunc _raw_write_lock(rwlock_t * lock)
{
arch_write_lock(&(lock)->raw_lock);
}
#endif
#ifndef CONFIG_X86
void __lockfunc __raw_spin_unlock(raw_spinlock_t * lock)
{
arch_spin_unlock(&lock->raw_lock);
}
void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t * lock)
{
_raw_spin_unlock_irqrestore(lock, 0);
}
#ifndef CONFIG_INLINE_WRITE_UNLOCK
void __lockfunc _raw_write_unlock(rwlock_t * lock)
{
arch_write_unlock(&(lock)->raw_lock);
}
#endif
#ifndef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE
void __lockfunc _raw_read_unlock_irqrestore(rwlock_t * lock,unsigned long flags)
{
arch_read_unlock(&(lock)->raw_lock);
local_irq_restore(flags);
}
#endif
#ifndef CONFIG_INLINE_WRITE_LOCK_BH
void __lockfunc _raw_write_lock_bh(rwlock_t * lock)
{
arch_write_lock(&(lock)->raw_lock);
}
#endif
#ifndef CONFIG_INLINE_WRITE_LOCK_IRQ
void __lockfunc _raw_write_lock_irq(rwlock_t * lock)
{
arch_write_lock(&(lock)->raw_lock);
}
#endif
#ifndef CONFIG_INLINE_READ_LOCK_BH
void __lockfunc _raw_read_lock_bh(rwlock_t * lock)
{
arch_read_lock(&(lock)->raw_lock);
}
#endif

View File

@ -21,8 +21,10 @@ 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
@ -45,7 +47,6 @@ SRC_C += lx_emul/mapping.c
SRC_C += lx_emul/page_alloc.c
SRC_C += lx_emul/sched_core.c
SRC_C += lx_emul/slab_common.c
SRC_C += lx_emul/softirq.c
SRC_C += lx_emul/vmalloc.c
SRC_C += lx_emul/delay.c

View File

@ -3,3 +3,4 @@ include $(REP_DIR)/lib/mk/wifi.inc
REQUIRES += 32bit
SRC_C += lx_emul/spec/x86_32/atomic64_32.c
SRC_C += lx_emul/shadow/arch/x86/kernel/irq_32.c

View File

@ -40,7 +40,6 @@ CC_C_OPT += -DCONFIG_RFKILL_INPUT
#CC_OPT += -DCONFIG_IWLWIFI_DEBUG
SRC_C += lx_emul/shadow/kernel/softirq.c
SRC_C += lx_emul/shadow/lib/kobject_uevent.c
vpath %.c $(REP_DIR)/src/lib/pc
vpath %.cc $(REP_DIR)/src/lib/pc

View File

@ -141,7 +141,10 @@ LX_FILES += arch/x86/include/asm/boot.h \
arch/x86/include/asm/pgtable_64.h \
arch/x86/include/asm/pgtable-invert.h \
arch/x86/include/asm/pkru.h \
arch/x86/include/asm/qrwlock.h \
arch/x86/include/asm/qspinlock.h \
arch/x86/include/asm/sigframe.h \
arch/x86/include/asm/spinlock.h \
arch/x86/include/asm/suspend.h \
arch/x86/include/asm/suspend_32.h \
arch/x86/include/asm/suspend_64.h \
@ -159,6 +162,7 @@ LX_FILES += arch/x86/include/asm/boot.h \
include/asm-generic/pgtable_uffd.h \
include/asm-generic/pgtable-nopmd.h \
include/asm-generic/pgtable-nopud.h \
include/asm-generic/qrwlock.h \
include/asm-generic/qspinlock.h \
include/linux/arm-smccc.h \
include/linux/arm_sdei.h \

View File

@ -40,7 +40,6 @@ const guid_t pci_acpi_dsm_guid =
void register_syscore_ops(struct syscore_ops * ops)
{
wait_bit_init();
lx_emul_trace(__func__);
}
@ -551,3 +550,23 @@ bool irq_work_needs_cpu(void)
{
return false;
}
#include <asm/smp.h>
struct smp_ops smp_ops = { };
EXPORT_SYMBOL_GPL(smp_ops);
#include <linux/prandom.h>
u32 prandom_u32(void)
{
lx_emul_trace_and_stop(__func__);
}
int wbinvd_on_all_cpus(void)
{
lx_emul_trace(__func__);
}

View File

@ -1509,6 +1509,14 @@ void kmsg_dump(enum kmsg_dump_reason reason)
}
#include <linux/rcutree.h>
void kvfree_call_rcu(struct rcu_head * head,rcu_callback_t func)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/swap.h>
void mark_page_accessed(struct page * page)
@ -1897,14 +1905,6 @@ int smp_call_function_single(int cpu,void (* func)(void * info),void * info,int
}
#include <linux/srcutiny.h>
void srcu_drive_gp(struct work_struct * wp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/jump_label.h>
bool static_key_initialized;
@ -1931,14 +1931,6 @@ void synchronize_rcu(void)
}
#include <linux/srcutiny.h>
void synchronize_srcu(struct srcu_struct * ssp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/task_work.h>
int task_work_add(struct task_struct * task,struct callback_head * work,enum task_work_notify_mode notify)
@ -2024,4 +2016,3 @@ void wake_q_add_safe(struct wake_q_head * head,struct task_struct * task)
{
lx_emul_trace_and_stop(__func__);
}

View File

@ -36,7 +36,6 @@ int acpi_disabled = 0;
void intel_wopcm_init_early(struct intel_wopcm * wopcm)
{
wait_bit_init();
lx_emul_trace(__func__);
}

View File

@ -222,11 +222,13 @@ kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c
kernel/time/jiffies.c
kernel/time/ntp.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-oneshot.c
kernel/time/tick-sched.c

View File

@ -2,3 +2,4 @@ include $(REP_DIR)/src/drivers/framebuffer/intel/pc/target.inc
REQUIRES += 32bit
SRC_C += lx_emul/spec/x86_32/atomic64_32.c
SRC_C += lx_emul/shadow/arch/x86/kernel/irq_32.c

View File

@ -225,6 +225,7 @@ kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c

View File

@ -21,7 +21,6 @@ SRC_C += lx_user.c
SRC_C += gem.c
SRC_C += lx_emul/common_dummies.c
SRC_C += lx_emul/spec/x86/pci.c
SRC_C += lx_emul/shadow/kernel/softirq.c
SRC_C += lx_emul/shadow/mm/page_alloc.c
vpath %.c $(REL_PRG_DIR)

View File

@ -106,3 +106,11 @@ bool irq_work_needs_cpu(void)
{
return false;
}
#include <linux/prandom.h>
u32 prandom_u32(void)
{
lx_emul_trace_and_stop(__func__);
}

View File

@ -517,14 +517,6 @@ int smp_call_function_single(int cpu,void (* func)(void * info),void * info,int
}
#include <linux/srcutiny.h>
void srcu_drive_gp(struct work_struct * wp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/jump_label.h>
bool static_key_initialized;
@ -538,14 +530,6 @@ int string_escape_mem(const char * src,size_t isz,char * dst,size_t osz,unsigned
}
#include <linux/srcutiny.h>
void synchronize_srcu(struct srcu_struct * ssp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/task_work.h>
int task_work_add(struct task_struct * task,struct callback_head * work,enum task_work_notify_mode notify)
@ -588,4 +572,3 @@ void wake_q_add_safe(struct wake_q_head * head,struct task_struct * task)
{
lx_emul_trace_and_stop(__func__);
}

View File

@ -62,6 +62,7 @@ kernel/irq/chip.c
kernel/irq/devres.c
kernel/irq/handle.c
kernel/irq/irqdesc.c
kernel/irq/irqdomain.c
kernel/irq/manage.c
kernel/irq/resend.c
kernel/kthread.c
@ -75,12 +76,15 @@ kernel/sched/clock.c
kernel/sched/completion.c
kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c
kernel/time/jiffies.c
kernel/time/ntp.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-oneshot.c
kernel/time/tick-sched.c

View File

@ -3,3 +3,4 @@ include $(REP_DIR)/src/drivers/usb_host/pc/target.inc
REQUIRES += 32bit
SRC_C += lx_emul/spec/x86_32/atomic64_32.c
SRC_C += lx_emul/shadow/arch/x86/kernel/irq_32.c

View File

@ -76,7 +76,9 @@ kernel/sched/clock.c
kernel/sched/completion.c
kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c

View File

@ -16,8 +16,6 @@ SRC_C += $(notdir $(wildcard $(REL_PRG_DIR)/generated_dummies.c))
SRC_C += common_dummies.c
SRC_C += lx_emul/spec/x86/pci.c
SRC_C += lx_emul/usb.c
SRC_C += lx_emul/shadow/kernel/softirq.c
SRC_C += lx_emul/shadow/lib/kobject_uevent.c
vpath %.c $(REP_DIR)/src/lib/pc
vpath %.cc $(REP_DIR)/src/lib/pc

View File

@ -369,3 +369,176 @@ bool pat_enabled(void)
lx_emul_trace(__func__);
return true;
}
#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)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/cpu.h>
void cpu_hotplug_disable(void)
{
lx_emul_trace(__func__);
}
#include <linux/cpu.h>
void cpu_hotplug_enable(void)
{
lx_emul_trace(__func__);
}
#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)
{
lx_emul_trace_and_stop(__func__);
}
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;
}

View File

@ -1,6 +1,7 @@
arch/x86/include/asm/acenv.h
arch/x86/include/asm/acpi.h
arch/x86/include/asm/alternative.h
arch/x86/include/asm/apic.h
arch/x86/include/asm/apicdef.h
arch/x86/include/asm/arch_hweight.h
arch/x86/include/asm/asm.h
@ -39,6 +40,7 @@ arch/x86/include/asm/hw_irq.h
arch/x86/include/asm/intel_ds.h
arch/x86/include/asm/invpcid.h
arch/x86/include/asm/irq.h
arch/x86/include/asm/irq_stack.h
arch/x86/include/asm/irq_vectors.h
arch/x86/include/asm/irq_work.h
arch/x86/include/asm/irqdomain.h
@ -91,6 +93,8 @@ arch/x86/include/asm/shmparam.h
arch/x86/include/asm/signal.h
arch/x86/include/asm/smap.h
arch/x86/include/asm/smp.h
arch/x86/include/asm/softirq_stack.h
arch/x86/include/asm/spinlock_types.h
arch/x86/include/asm/stacktrace.h
arch/x86/include/asm/static_call.h
arch/x86/include/asm/string.h
@ -140,6 +144,7 @@ arch/x86/include/uapi/asm/signal.h
arch/x86/include/uapi/asm/stat.h
arch/x86/include/uapi/asm/swab.h
arch/x86/include/uapi/asm/unistd.h
arch/x86/include/uapi/asm/vsyscall.h
drivers/base/base.h
drivers/base/power/power.h
drivers/base/trace.h
@ -186,6 +191,7 @@ include/asm-generic/bug.h
include/asm-generic/cacheflush.h
include/asm-generic/compat.h
include/asm-generic/delay.h
include/asm-generic/div64.h
include/asm-generic/early_ioremap.h
include/asm-generic/error-injection.h
include/asm-generic/fixmap.h
@ -207,10 +213,13 @@ include/asm-generic/pci.h
include/asm-generic/pci_iomap.h
include/asm-generic/percpu.h
include/asm-generic/pgtable-nop4d.h
include/asm-generic/qrwlock_types.h
include/asm-generic/qspinlock_types.h
include/asm-generic/resource.h
include/asm-generic/rwonce.h
include/asm-generic/sections.h
include/asm-generic/set_memory.h
include/asm-generic/softirq_stack.h
include/asm-generic/termios.h
include/asm-generic/tlb.h
include/asm-generic/topology.h
@ -560,6 +569,7 @@ include/linux/ratelimit_types.h
include/linux/rbtree.h
include/linux/rbtree_augmented.h
include/linux/rbtree_latch.h
include/linux/rcu_node_tree.h
include/linux/rcu_segcblist.h
include/linux/rcu_sync.h
include/linux/rculist.h
@ -567,7 +577,7 @@ include/linux/rculist_bl.h
include/linux/rculist_nulls.h
include/linux/rcupdate.h
include/linux/rcupdate_wait.h
include/linux/rcutiny.h
include/linux/rcutree.h
include/linux/rcuwait.h
include/linux/reboot.h
include/linux/refcount.h
@ -579,6 +589,7 @@ include/linux/ring_buffer.h
include/linux/rtc.h
include/linux/rtnetlink.h
include/linux/rwlock.h
include/linux/rwlock_api_smp.h
include/linux/rwlock_types.h
include/linux/rwsem.h
include/linux/sbitmap.h
@ -602,6 +613,7 @@ include/linux/sched/nohz.h
include/linux/sched/numa_balancing.h
include/linux/sched/prio.h
include/linux/sched/rt.h
include/linux/sched/sd_flags.h
include/linux/sched/signal.h
include/linux/sched/smt.h
include/linux/sched/stat.h
@ -640,13 +652,11 @@ include/linux/socket.h
include/linux/sockptr.h
include/linux/sort.h
include/linux/spinlock.h
include/linux/spinlock_api_up.h
include/linux/spinlock_api_smp.h
include/linux/spinlock_types.h
include/linux/spinlock_types_up.h
include/linux/spinlock_up.h
include/linux/splice.h
include/linux/srcu.h
include/linux/srcutiny.h
include/linux/srcutree.h
include/linux/stackdepot.h
include/linux/stacktrace.h
include/linux/stat.h

View File

@ -12,6 +12,7 @@
*/
#include <linux/mm.h>
#include <linux/rcupdate.h>
void call_rcu(struct rcu_head * head,rcu_callback_t func)

View File

@ -1,40 +0,0 @@
/*
* \brief Supplement for emulation of kernel/softirq.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/interrupt.h>
void tasklet_setup(struct tasklet_struct * t,
void (* callback)(struct tasklet_struct *))
{
t->next = NULL;
t->state = 0;
atomic_set(&t->count, 0);
t->callback = callback;
t->use_callback = true;
t->data = 0;
}
void __tasklet_schedule(struct tasklet_struct * t)
{
if (test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
t->callback(t);
}
void __tasklet_hi_schedule(struct tasklet_struct * t)
{
if (test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
t->callback(t);
}

View File

@ -318,3 +318,15 @@ bool irq_work_needs_cpu(void)
{
return false;
}
#include <asm/smp.h>
struct smp_ops smp_ops = { };
EXPORT_SYMBOL_GPL(smp_ops);
void synchronize_rcu_expedited(void)
{
lx_emul_trace(__func__);
}

View File

@ -283,14 +283,6 @@ int dev_ioctl(struct net * net,unsigned int cmd,struct ifreq * ifr,bool * need_c
}
#include <linux/interrupt.h>
asmlinkage __visible void do_softirq(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <net/dst.h>
void dst_release(struct dst_entry * dst)
@ -655,6 +647,22 @@ unsigned long long memparse(const char * ptr,char ** retptr)
}
#include <linux/preempt.h>
void migrate_disable(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/preempt.h>
void migrate_enable(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <net/neighbour.h>
const struct nla_policy nda_policy[] = {};
@ -1110,17 +1118,17 @@ int smp_call_function_single(int cpu,void (* func)(void * info),void * info,int
}
#include <linux/sock_diag.h>
#include <linux/smp.h>
void sock_diag_broadcast_destroy(struct sock * sk)
int smp_call_function_single_async(int cpu,struct __call_single_data * csd)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/srcutiny.h>
#include <linux/sock_diag.h>
void srcu_drive_gp(struct work_struct * wp)
void sock_diag_broadcast_destroy(struct sock * sk)
{
lx_emul_trace_and_stop(__func__);
}
@ -1152,14 +1160,6 @@ int string_escape_mem(const char * src,size_t isz,char * dst,size_t osz,unsigned
int suppress_printk;
#include <linux/srcutiny.h>
void synchronize_srcu(struct srcu_struct * ssp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/sysfs.h>
int sysfs_rename_dir_ns(struct kobject * kobj,const char * new_name,const void * new_ns)
@ -1184,14 +1184,6 @@ struct callback_head * task_work_cancel(struct task_struct * task,task_work_func
}
#include <linux/interrupt.h>
void tasklet_kill(struct tasklet_struct * t)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/vt_kern.h>
void unblank_screen(void)

View File

@ -302,14 +302,6 @@ int task_work_add(struct task_struct * task,struct callback_head * work,enum tas
}
#include <linux/interrupt.h>
void __raise_softirq_irqoff(unsigned int nr)
{
raise_softirq(nr);
}
#include <linux/slab.h>
void kfree_sensitive(const void *p)
@ -566,3 +558,19 @@ void rfkill_init(void)
rfkill_task_struct_ptr = find_task_by_pid_ns(pid, NULL);
}
#ifdef CONFIG_X86_32
s64 arch_atomic64_add_return(s64 i, atomic64_t *v)
{
v->counter += i;
return v->counter;
}
#endif
void kvfree_call_rcu(struct rcu_head * head,rcu_callback_t func)
{
void *ptr = (void *) head - (unsigned long) func;
kvfree(ptr);
}

View File

@ -148,12 +148,15 @@ kernel/sched/clock.c
kernel/sched/completion.c
kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c
kernel/time/jiffies.c
kernel/time/ntp.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-oneshot.c
kernel/time/tick-sched.c

View File

@ -148,7 +148,9 @@ kernel/sched/clock.c
kernel/sched/completion.c
kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c

View File

@ -3,7 +3,7 @@
#
# kernel fundamentals
LX_ENABLE += TTY SERIAL_EARLYCON SERIAL_OF_PLATFORM PRINTK HAS_IOMEM
LX_ENABLE += TTY SERIAL_EARLYCON SERIAL_OF_PLATFORM PRINTK HAS_IOMEM SMP
# support disabling ticking during idle
LX_ENABLE += NO_HZ_IDLE

View File

@ -69,3 +69,11 @@ void register_syscore_ops(struct syscore_ops * ops)
{
lx_emul_trace(__func__);
}
#include <linux/prandom.h>
u32 prandom_u32(void)
{
lx_emul_trace_and_stop(__func__);
}

View File

@ -23,6 +23,14 @@ const char * __clk_get_name(const struct clk * clk)
}
#include <linux/srcu.h>
void __srcu_read_unlock(struct srcu_struct * ssp,int idx)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/printk.h>
int printk_deferred(const char * fmt,...)
@ -86,22 +94,6 @@ int kobject_synth_uevent(struct kobject * kobj,const char * buf,size_t count)
}
#include <linux/srcutiny.h>
void synchronize_srcu(struct srcu_struct * ssp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/srcu.h>
void __srcu_read_unlock(struct srcu_struct * ssp,int idx)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/kobject.h>
int add_uevent_var(struct kobj_uevent_env * env,const char * format,...)
@ -205,14 +197,6 @@ int smp_call_function_single(int cpu,void (* func)(void * info),void * info,int
}
#include <linux/srcutiny.h>
void srcu_drive_gp(struct work_struct * wp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/uaccess.h>
unsigned long _copy_to_user(void __user * to,const void * from,unsigned long n)

View File

@ -29,6 +29,7 @@ kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c

View File

@ -11,7 +11,6 @@ SRC_C += generated_dummies.c
SRC_C += lx_emul/common_dummies.c
SRC_C += lx_emul/shadow/lib/kobject_uevent.c
SRC_C += lx_emul/shadow/drivers/char/random.c
SRC_C += lx_emul/shadow/kernel/softirq.c
vpath %.c $(REP_DIR)/src/lib/pc
vpath %.cc $(REP_DIR)/src/lib/pc