Revert LinuxKPI: LINUXKPI_DEBUG changes to allow drm-kmod to build

It has been almost a week with an open pull-requests and a follow-up
identified merge from master drm-kmod, as well as a patch supplied
in a PR for the ports to fix the the current build breakage in drm-kmod
and as a result also in nvidia-drm-* ports.

The problem there is that instead of using the kmod.mk supplied
definitions for LINUXKPI and despite using kmod.mk for the build,
the external components have hand-rolled solutions which can get
out of synch with src.git.

This was not discovered early on given that building drm-kmod with
LOCAL_MODULES_DIR= from git sources will not fail as the kernel
build will have provided the new opt_linuxkpi.h file.  In addition
drm-kmod master already had the -include for kconfig.h which the
src tree has had since 2024.

Give the pkgbase/kmod builds and users over the weekend a chance
to produce drm-kmod packages as the number of affected poeple is
rising.
These changes will hopefully be brought back next week once
drm-kmod and nvidia-drm-* ports are fixed.

PR:			299334
Bring back after: 	3+ days

This reverts commit bbfd52dcbe.
This reverts commit 9820afb99e.
This commit is contained in:
Bjoern A. Zeeb committed 2026-10-17 09:23:23 +00:00
1 parent bdcfeac3e1
commit 6866177454
15 files changed
+15 -52

No files matched your search

@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2020-2026 The FreeBSD Foundation
* Copyright (c) 2020 The FreeBSD Foundation
*
* This software was developed by Björn Zeeb under sponsorship from
* the FreeBSD Foundation.
@@ -31,33 +31,6 @@
#ifndef _LINUXKPI_LINUX_KCONFIG_H_
#define _LINUXKPI_LINUX_KCONFIG_H_
/* -------------------------------------------------------------------------- */
#include "opt_linuxkpi.h"
/*
* LinuxKPI internals are here as this file is globally included for everything
* compiled with LinuxKPI.
*/
/*
* Do not tell witness to ignore locks if debugging and witness are enabled.
* This helps debugging and hopefully also long-term code quality.
*/
#if defined(LINUXKPI_DEBUG) && defined(WITNESS)
#define _LKPI_MTX_NOWITNESS (0)
#define _LKPI_RW_NOWITNESS (0)
#define _LKPI_SX_NOWITNESS (0)
#define WITNESS_ALL /* Get better lock names. */
#else
#define _LKPI_MTX_NOWITNESS MTX_NOWITNESS
#define _LKPI_RW_NOWITNESS RW_NOWITNESS
#define _LKPI_SX_NOWITNESS SX_NOWITNESS
#endif
/* -------------------------------------------------------------------------- */
/*
* Checking if an option is defined would be easy if we could do CPP inside CPP.
* The defined case whether -Dxxx or -Dxxx=1 are easy to deal with. In either
@@ -30,8 +30,6 @@
#ifndef _LINUXKPI_LINUX_KERNEL_H_
#define _LINUXKPI_LINUX_KERNEL_H_
#include "opt_linuxkpi.h"
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/param.h>
@@ -178,9 +176,9 @@ scnprintf(char *buf, size_t size, const char *fmt, ...)
/*
* The "pr_debug()" and "pr_devel()" macros should produce zero code
* unless LINUXKPI_DEBUG is defined:
* unless DEBUG is defined:
*/
#ifdef LINUXKPI_DEBUG
#ifdef DEBUG
extern int linuxkpi_debug;
#define pr_debug(fmt, ...) \
do { \
@@ -109,10 +109,10 @@ mutex_trylock_recursive(struct mutex *lock)
}
#define mutex_init(_m) \
linux_mutex_init(_m, mutex_name(#_m), _LKPI_SX_NOWITNESS)
linux_mutex_init(_m, mutex_name(#_m), SX_NOWITNESS)
#define __mutex_init(_m, _n, _l) \
linux_mutex_init(_m, _n, _LKPI_SX_NOWITNESS)
linux_mutex_init(_m, _n, SX_NOWITNESS)
#define mutex_init_witness(_m) \
linux_mutex_init(_m, mutex_name(#_m), SX_DUPOK)
@@ -52,6 +52,6 @@ typedef struct rwlock rwlock_t;
do { read_unlock(lock); } while (0)
#define write_unlock_irqrestore(lock, flags) \
do { write_unlock(lock); } while (0)
#define rwlock_init(_l) rw_init_flags(_l, "lnxrw", _LKPI_RW_NOWITNESS | RW_NEW)
#define rwlock_init(_l) rw_init_flags(_l, "lnxrw", RW_NOWITNESS | RW_NEW)
#endif /* _LINUXKPI_LINUX_RWLOCK_H_ */
@@ -77,7 +77,7 @@ linux_init_rwsem(struct rw_semaphore *rw, const char *name)
{
memset(rw, 0, sizeof(*rw));
sx_init_flags(&rw->sx, name, _LKPI_SX_NOWITNESS);
sx_init_flags(&rw->sx, name, SX_NOWITNESS);
}
extern int linux_down_read_killable(struct rw_semaphore *);
@@ -119,7 +119,7 @@ seqlock_init(struct seqlock *seqlock)
* seqlock has been freed. There is no seqlock destructor exists so we
* can't expect automatic mtx_destroy() execution before free().
*/
mtx_init(&seqlock->seql_lock, "seqlock", NULL, MTX_DEF | _LKPI_MTX_NOWITNESS);
mtx_init(&seqlock->seql_lock, "seqlock", NULL, MTX_DEF|MTX_NOWITNESS);
seqcount_init(&seqlock->seql_count);
}
@@ -29,8 +29,6 @@
#ifndef _LINUXKPI_LINUX_SPINLOCK_H_
#define _LINUXKPI_LINUX_SPINLOCK_H_
#include "opt_linuxkpi.h"
#include <asm/atomic.h>
#include <sys/param.h>
#include <sys/kernel.h>
@@ -132,7 +130,7 @@ typedef struct mtx spinlock_t;
spin_unlock(_l); \
} while (0)
#if defined(LINUXKPI_DEBUG) && defined(WITNESS)
#ifdef WITNESS_ALL
/* NOTE: the maximum WITNESS name is 64 chars */
#define __spin_lock_name(name, file, line) \
(((const char *){file ":" #line "-" name}) + \
@@ -144,7 +142,7 @@ typedef struct mtx spinlock_t;
#define spin_lock_name(name) _spin_lock_name(name, __FILE__, __LINE__)
#define spin_lock_init(lock) mtx_init(lock, spin_lock_name("lnxspin"), \
NULL, MTX_DEF | _LKPI_MTX_NOWITNESS | MTX_NEW)
NULL, MTX_DEF | MTX_NOWITNESS | MTX_NEW)
#define spin_lock_destroy(_l) mtx_destroy(_l)
@@ -192,7 +190,7 @@ typedef struct raw_spinlock {
#define raw_spin_lock_init(rlock) \
mtx_init(&(rlock)->lock, spin_lock_name("lnxspin_raw"), \
NULL, MTX_DEF | _LKPI_MTX_NOWITNESS | MTX_NEW)
NULL, MTX_DEF | MTX_NOWITNESS | MTX_NEW)
#define raw_spin_lock(rl) spin_lock(&(rl)->lock)
#define raw_spin_trylock(rl) spin_trylock(&(rl)->lock)
@@ -115,7 +115,7 @@ long linux_wait_woken(wait_queue_t *wq, unsigned state, long timeout);
#define init_waitqueue_head(wqh) do { \
mtx_init(&(wqh)->lock, spin_lock_name("wqhead"), \
NULL, MTX_DEF | MTX_NEW | _LKPI_MTX_NOWITNESS); \
NULL, MTX_DEF | MTX_NEW | MTX_NOWITNESS); \
INIT_LIST_HEAD(&(wqh)->task_list); \
} while (0)
@@ -132,7 +132,7 @@ ww_acquire_init(struct ww_acquire_ctx *ctx, struct ww_class *ww_class)
static inline void
ww_mutex_init(struct ww_mutex *lock, struct ww_class *ww_class)
{
linux_mutex_init(&lock->base, ww_class->mutex_name, _LKPI_SX_NOWITNESS);
linux_mutex_init(&lock->base, ww_class->mutex_name, SX_NOWITNESS);
cv_init(&lock->condvar, "lkpi-ww");
}
@@ -101,7 +101,7 @@ linux_hrtimer_init(struct hrtimer *hrtimer)
memset(hrtimer, 0, sizeof(*hrtimer));
mtx_init(&hrtimer->mtx, "hrtimer", NULL,
MTX_DEF | MTX_RECURSE | _LKPI_MTX_NOWITNESS);
MTX_DEF | MTX_RECURSE | MTX_NOWITNESS);
callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0);
}
+1 -1
View File
@@ -706,7 +706,7 @@ linux_init_delayed_work(struct delayed_work *dwork, work_func_t func)
dwork->work.func = func;
TASK_INIT(&dwork->work.work_task, 0, linux_delayed_work_fn, dwork);
mtx_init(&dwork->timer.mtx, spin_lock_name("lkpi-dwork"), NULL,
MTX_DEF | _LKPI_MTX_NOWITNESS);
MTX_DEF | MTX_NOWITNESS);
callout_init_mtx(&dwork->timer.callout, &dwork->timer.mtx, 0);
}
-1
View File
@@ -103,7 +103,6 @@ LINUXKPI_GENSRCS+= \
pci_iov_if.h \
pcib_if.h \
vnode_if.h \
opt_linuxkpi.h \
opt_stack.h
.if ${MK_USB} != "no"
-3
View File
@@ -908,9 +908,6 @@ TDMA_TXRATE_QUARTER_DEFAULT opt_tdma.h
TDMA_TXRATE_11NA_DEFAULT opt_tdma.h
TDMA_TXRATE_11NG_DEFAULT opt_tdma.h
# LinuxKPI
LINUXKPI_DEBUG opt_linuxkpi.h
# VideoMode
PICKMODE_DEBUG opt_videomode.h
-1
View File
@@ -17,4 +17,3 @@ options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default
options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence
options KDTRACE_MIB_SDT # Add SDT probes to network counters
options TCP_HPTS_KTEST # Add KTEST support for HPTS
options LINUXKPI_DEBUG # Add LinuxKPI pr_debug/pr_devel support
-1
View File
@@ -17,7 +17,6 @@ nooptions MALLOC_DEBUG_MAXZONES
nooptions QUEUE_MACRO_DEBUG_TRASH
nooptions KDTRACE_MIB_SDT
nooptions TCP_HPTS_KTEST
nooptions LINUXKPI_DEBUG
# Net80211 debugging
nooptions IEEE80211_DEBUG