[Bug 287501] Observing witness warning w.r.t rcu_read_lock() API
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 287501] Observing witness warning w.r.t rcu_read_lock() API"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 287501] Observing witness warning w.r.t rcu_read_lock() API"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 287501] Fix witness warning w.r.t rcu_read_lock() API"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 287501] Fix witness warning w.r.t rcu_read_lock() API"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Jun 2025 11:59:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287501
Bug ID: 287501
Summary: Observing witness warning w.r.t rcu_read_lock() API
Product: Base System
Version: 15.0-CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: sreekanth.reddy@broadcom.com
Created attachment 261234
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=261234&action=edit
patch which fixes the witness warning related rcu_read_lock()
Observing below witness calltrace while running KTLS enabled traffic.
uma_zalloc_debug: zone "lkpicurr" with the following non-sleepable locks held:
exclusive rw tcpinp (tcpinp) r = 0 (0xfffff809e6146020) locked @
/usr/srreddy/freebsd-src/sys/kern/uipc_ktls.c:195
stack backtrace:
#0 0xffffffff80bee42c at witness_debugger+0x6c
#1 0xffffffff80bef640 at witness_warn+0x430
#2 0xffffffff80f34044 at uma_zalloc_debug+0x34
#3 0xffffffff80f33b97 at uma_zalloc_arg+0x27
#4 0xffffffff80e2a029 at linux_alloc_current+0x69
#5 0xffffffff80e370a3 at linux_rcu_read_lock+0x183
#6 0xffffffff82f4ad55 at bnxt_tls_snd_tag_free+0xe5
#7 0xffffffff80b4bec0 at m_snd_tag_destroy+0x10
#8 0xffffffff80c19e77 at ktls_destroy+0x2e7
#9 0xffffffff80c1d18f at ktls_work_thread+0xf0f
According to rcu_read_lock() definition this API should be a NON-Preemptable,
but I see that uma_zalloc_arg is called without M_NOWAIT flag set and it leads
to above witness warning.
I have made below kernel changes which fixed this witness warnings. So please
review it.
diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h
b/sys/compat/linuxkpi/common/include/linux/sched.h
index 3ad2f8e4ce8b..30a61a9e806c 100644
--- a/sys/compat/linuxkpi/common/include/linux/sched.h
+++ b/sys/compat/linuxkpi/common/include/linux/sched.h
@@ -98,6 +98,12 @@ struct task_struct {
((struct task_struct *)__td->td_lkpi_task); \
})
+#define current_nowait ({ \
+ struct thread *__td = curthread; \
+ linux_set_current_flags(__td, M_NOWAIT); \
+ ((struct task_struct *)__td->td_lkpi_task); \
+})
+
#define task_pid_group_leader(task) (task)->task_thread->td_proc->p_pid
#define task_pid(task) ((task)->pid)
#define task_pid_nr(task) ((task)->pid)
diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c
b/sys/compat/linuxkpi/common/src/linux_rcu.c
index c0b864d269b3..cd6db8e47b91 100644
--- a/sys/compat/linuxkpi/common/src/linux_rcu.c
+++ b/sys/compat/linuxkpi/common/src/linux_rcu.c
@@ -188,7 +188,7 @@ linux_rcu_read_lock(unsigned type)
if (RCU_SKIP())
return;
- ts = current;
+ ts = current_nowait;
/* assert valid refcount */
MPASS(ts->rcu_recurse[type] != INT_MAX);
@@ -226,11 +226,11 @@ linux_rcu_read_unlock(unsigned type)
if (RCU_SKIP())
return;
- ts = current;
+ ts = current_nowait;
/* assert valid refcount */
MPASS(ts->rcu_recurse[type] > 0);
-
+
if (--(ts->rcu_recurse[type]) != 0)
return;
Thanks,
Sreekanth
--
You are receiving this mail because:
You are the assignee for the bug.