- fixed a1.4 synchro error

This commit is contained in:
hamza 2025-05-13 14:25:14 +02:00
parent 290adb044b
commit f1d5ed18a9
4 changed files with 27 additions and 17 deletions

View File

@ -281,6 +281,7 @@ CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_LOCKDEP_SUPPORT=y CONFIG_LOCKDEP_SUPPORT=y
CONFIG_LOCKDEP=y
CONFIG_STACKTRACE_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y
CONFIG_MMU=y CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=28 CONFIG_ARCH_MMAP_RND_BITS_MIN=28
@ -644,6 +645,7 @@ CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y
CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y
CONFIG_HAVE_NMI=y CONFIG_HAVE_NMI=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_TRACE_IRQFLAGS=y
CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y
CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_HAVE_DMA_CONTIGUOUS=y
@ -4497,14 +4499,15 @@ CONFIG_DEBUG_PREEMPT=y
# Lock Debugging (spinlocks, mutexes, etc...) # Lock Debugging (spinlocks, mutexes, etc...)
# #
CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y
# CONFIG_PROVE_LOCKING is not set CONFIG_PROVE_LOCKING=y
CONFIG_PROVE_RCU=y
# CONFIG_LOCK_STAT is not set # CONFIG_LOCK_STAT is not set
# CONFIG_DEBUG_RT_MUTEXES is not set CONFIG_DEBUG_RT_MUTEXES=y
# CONFIG_DEBUG_SPINLOCK is not set CONFIG_DEBUG_SPINLOCK=y
# CONFIG_DEBUG_MUTEXES is not set CONFIG_DEBUG_MUTEXES=y
# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set # CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set
# CONFIG_DEBUG_RWSEMS is not set # CONFIG_DEBUG_RWSEMS is not set
# CONFIG_DEBUG_LOCK_ALLOC is not set CONFIG_DEBUG_LOCK_ALLOC=y
# CONFIG_DEBUG_ATOMIC_SLEEP is not set # CONFIG_DEBUG_ATOMIC_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_LOCK_TORTURE_TEST is not set
@ -4513,7 +4516,7 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y
# CONFIG_CSD_LOCK_WAIT_DEBUG is not set # CONFIG_CSD_LOCK_WAIT_DEBUG is not set
# end of Lock Debugging (spinlocks, mutexes, etc...) # end of Lock Debugging (spinlocks, mutexes, etc...)
# CONFIG_DEBUG_IRQFLAGS is not set CONFIG_DEBUG_IRQFLAGS=y
CONFIG_STACKTRACE=y CONFIG_STACKTRACE=y
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set # CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
# CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_KOBJECT is not set

2
a1.4.txt Normal file
View File

@ -0,0 +1,2 @@
1) hardirq_safe bedeutet dass eine prozess läuft in einem Kontext, der sicher für Hardware-Unterbrechungen ist. es halt keine kmalloc, spin_locks...
2) lockdep_assert_held()

View File

@ -4,3 +4,6 @@
# #
obj-$(CONFIG_SST) += sst_chrdev.o boundedbuffer.o sst_common.o obj-$(CONFIG_SST) += sst_chrdev.o boundedbuffer.o sst_common.o
CFLAGS_sst_chrdev.o := -DDEBUG
CFLAGS_sst_common.o := -DDEBUG
CFLAGS_boundedbuffer.o := -DDEBUG

View File

@ -1,4 +1,6 @@
#include "sst_internal.h" #include "sst_internal.h"
#include "../../include/linux/spinlock.h"
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/random.h> #include <linux/random.h>
@ -127,9 +129,9 @@ int sst_produce_question(sst_info_t *info, char *value) {
return -1; return -1;
} }
sst_debug("%s:info=%lx, questions=%lx\n", __func__, (uintptr_t)cur_sst_info, (uintptr_t)&info->questions); sst_debug("%s:info=%lx, questions=%lx\n", __func__, (uintptr_t)cur_sst_info, (uintptr_t)&info->questions);
spin_lock(&info->lock_questions); spin_lock_bh(&info->lock_questions);
err = produce(&info->questions, value); err = produce(&info->questions, value);
spin_unlock(&info->lock_questions); spin_unlock_bh(&info->lock_questions);
if (!err) { if (!err) {
wake_up_interruptible(&info->wait); wake_up_interruptible(&info->wait);
} }
@ -139,14 +141,14 @@ EXPORT_SYMBOL(sst_produce_question);
int sst_produce_answer(sst_info_t *info, char *value) { int sst_produce_answer(sst_info_t *info, char *value) {
int err = 0; int err = 0;
unsigned long flags;
if (!info) { if (!info) {
return -1; return -1;
} }
sst_debug("%s:info=%lx, answers=%lx\n", __func__, (uintptr_t)cur_sst_info, (uintptr_t)&info->answers); sst_debug("%s:info=%lx, answers=%lx\n", __func__, (uintptr_t)cur_sst_info, (uintptr_t)&info->answers);
spin_lock(&info->lock_answers); spin_lock_irqsave(&info->lock_answers, flags);
err = produce(&info->answers, value); err = produce(&info->answers, value);
spin_unlock(&info->lock_answers); spin_unlock_irqrestore(&info->lock_answers, flags);
up(&info->answers_rdy); up(&info->answers_rdy);
return err; return err;
} }
@ -154,21 +156,21 @@ EXPORT_SYMBOL(sst_produce_answer);
int sst_consume_question(sst_info_t *info, char **value) { int sst_consume_question(sst_info_t *info, char **value) {
int err = 0; int err = 0;
unsigned long flags;
if (!info) { if (!info) {
return -1; return -1;
} }
sst_debug("%s:info=%lx, questions=%lx\n", __func__, (uintptr_t)cur_sst_info, (uintptr_t)&info->questions); sst_debug("%s:info=%lx, questions=%lx\n", __func__, (uintptr_t)cur_sst_info, (uintptr_t)&info->questions);
spin_lock(&info->lock_questions); spin_lock_irqsave(&info->lock_questions, flags);
err = consume(&info->questions, value); err = consume(&info->questions, value);
spin_unlock(&info->lock_questions); spin_unlock_irqrestore(&info->lock_questions, flags);
return err; return err;
} }
EXPORT_SYMBOL(sst_consume_question); EXPORT_SYMBOL(sst_consume_question);
int sst_consume_answer(sst_info_t *info, char **value) { int sst_consume_answer(sst_info_t *info, char **value) {
int err = 0; int err = 0;
unsigned long flags;
if (!info) { if (!info) {
return -1; return -1;
} }
@ -177,9 +179,9 @@ int sst_consume_answer(sst_info_t *info, char **value) {
sst_debug("Sry. No answer for you!\n"); sst_debug("Sry. No answer for you!\n");
return -2; return -2;
} }
spin_lock(&info->lock_answers); spin_lock_irqsave(&info->lock_answers, flags);
err = consume(&info->answers, value); err = consume(&info->answers, value);
spin_unlock(&info->lock_answers); spin_unlock_irqrestore(&info->lock_answers, flags);
return err; return err;
} }
EXPORT_SYMBOL(sst_consume_answer); EXPORT_SYMBOL(sst_consume_answer);