From f1d5ed18a99927cbb4797146abae451be1e3a89e Mon Sep 17 00:00:00 2001 From: hamza Date: Tue, 13 May 2025 14:25:14 +0200 Subject: [PATCH] - fixed a1.4 synchro error --- a1.4.config | 15 +++++++++------ a1.4.txt | 2 ++ drivers/sst/Makefile | 3 +++ drivers/sst/sst_common.c | 24 +++++++++++++----------- 4 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 a1.4.txt diff --git a/a1.4.config b/a1.4.config index 61b08c30f258..3839d32f51d3 100644 --- a/a1.4.config +++ b/a1.4.config @@ -281,6 +281,7 @@ CONFIG_X86=y CONFIG_INSTRUCTION_DECODER=y CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_LOCKDEP_SUPPORT=y +CONFIG_LOCKDEP=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_MMU=y 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_NMI=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_TRACE_IRQFLAGS=y CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_DMA_CONTIGUOUS=y @@ -4497,14 +4499,15 @@ CONFIG_DEBUG_PREEMPT=y # Lock Debugging (spinlocks, mutexes, etc...) # 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_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set +CONFIG_DEBUG_RT_MUTEXES=y +CONFIG_DEBUG_SPINLOCK=y +CONFIG_DEBUG_MUTEXES=y # CONFIG_DEBUG_WW_MUTEX_SLOWPATH 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_LOCKING_API_SELFTESTS 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 # end of Lock Debugging (spinlocks, mutexes, etc...) -# CONFIG_DEBUG_IRQFLAGS is not set +CONFIG_DEBUG_IRQFLAGS=y CONFIG_STACKTRACE=y # CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set # CONFIG_DEBUG_KOBJECT is not set diff --git a/a1.4.txt b/a1.4.txt new file mode 100644 index 000000000000..d3ae75ff355a --- /dev/null +++ b/a1.4.txt @@ -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() \ No newline at end of file diff --git a/drivers/sst/Makefile b/drivers/sst/Makefile index 446c0c70371f..9695302c1faa 100644 --- a/drivers/sst/Makefile +++ b/drivers/sst/Makefile @@ -4,3 +4,6 @@ # 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 \ No newline at end of file diff --git a/drivers/sst/sst_common.c b/drivers/sst/sst_common.c index a0e49af00d4f..77048067d98a 100644 --- a/drivers/sst/sst_common.c +++ b/drivers/sst/sst_common.c @@ -1,4 +1,6 @@ #include "sst_internal.h" +#include "../../include/linux/spinlock.h" + #include #include #include @@ -127,9 +129,9 @@ int sst_produce_question(sst_info_t *info, char *value) { return -1; } 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); - spin_unlock(&info->lock_questions); + spin_unlock_bh(&info->lock_questions); if (!err) { 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 err = 0; - + unsigned long flags; if (!info) { return -1; } 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); - spin_unlock(&info->lock_answers); + spin_unlock_irqrestore(&info->lock_answers, flags); up(&info->answers_rdy); return err; } @@ -154,21 +156,21 @@ EXPORT_SYMBOL(sst_produce_answer); int sst_consume_question(sst_info_t *info, char **value) { int err = 0; - + unsigned long flags; if (!info) { return -1; } 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); - spin_unlock(&info->lock_questions); + spin_unlock_irqrestore(&info->lock_questions, flags); return err; } EXPORT_SYMBOL(sst_consume_question); int sst_consume_answer(sst_info_t *info, char **value) { int err = 0; - + unsigned long flags; if (!info) { return -1; } @@ -177,9 +179,9 @@ int sst_consume_answer(sst_info_t *info, char **value) { sst_debug("Sry. No answer for you!\n"); return -2; } - spin_lock(&info->lock_answers); + spin_lock_irqsave(&info->lock_answers, flags); err = consume(&info->answers, value); - spin_unlock(&info->lock_answers); + spin_unlock_irqrestore(&info->lock_answers, flags); return err; } EXPORT_SYMBOL(sst_consume_answer);