History log of /freebsd-current/sys/sys/kassert.h
Revision Date Author Comments
# 36de8bb2 20-Mar-2024 Mitchell Horne <mhorne@FreeBSD.org>

kassert.h: update MPASS definition commentary

We now have a detailed man page describing both MPASS and KASSERT. Give
a warning that careless use of MPASS can result in inadequate assertion
messages, and point to the MPASS(9) page which describes this.

While here add a comment above the KASSERT definitions pointing to the
man page.

Suggested by: bz
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44438


# cd0c52e5 18-Jan-2024 Olivier Certner <olce@FreeBSD.org>

SCHEDULER_STOPPED(): Move it (back) to 'systm.h'

It's not an assertion, so doesn't logically belong to 'kassert.h'.
Moreover, a subsequent commit will make it rely on a variable whose
declaration also belongs to 'systm.h'.

Approved by: markj (mentor)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43571


# eaed922e 18-Jan-2024 Olivier Certner <olce@FreeBSD.org>

panic()/KERNEL_PANICKED(): Move back to using 'panicstr' as a flag

Currently, no performance-critical path tests for a panic. Moreover, we
today have KERNEL_PANICKED() which wraps the test into
__predict_false(), already catering to those (potential) use cases.
Also, in practice we don't support 64-bit architectures without caches,
so reading an 'int' instead of a pointer doesn't (directly) save any
memory access. Finally, 'panicked' is redundant with 'panicstr' (and
wastes a tiny amount of memory).

Consequently:
1. Use again 'panicstr' as a flag indicating that the system is
panicking. To this end:
- Modify panic() so that it ensures this pointer is set to some
non-NULL value even if the caller didn't pass any panic string.
- Modify KERNEL_PANICKED() to test for 'panicstr'.
- Remove 'panicked'.
2. Annotate 'panicstr' with '__read_mostly' (instead of using
'__read_frequently' as for 'panicked'). This may have to be changed if,
in the future, some performance-intensive path needs to test it.
3. Convert a few more direct tests of 'panicstr' to using
KERNEL_PANICKED().

Reviewed by: kib, markj, emaste
Approved by: markj (mentor)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43569


# e1e84737 28-Nov-2023 Mateusz Guzik <mjg@FreeBSD.org>

Add DEBUG_POISON_POINTER

If you have a pointer which you know points to stale data, you can
fill it with junk so that dereference later will trap

Reviewed by: kib
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40946


# 61ae7a35 29-Jun-2022 Konstantin Belousov <kib@FreeBSD.org>

Add MPASSERT() and MPPASS() macros

Suggested by: mjg
Reviewed by: imp, mjg
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35652


# 54d34bfb 28-Jan-2022 Konstantin Belousov <kib@FreeBSD.org>

Introduce sys/kassert.h

It contains assert-related definitions previously provided by
sys/systm.h. The new header is leaner than whole systm.h.
Include kassert.h from systm.h for compatibility.

The copyright assignment to Eivind Eklund was suggested by Kirk McKusick
and is based in the commit 5526d2d920eb17b1507499f35b275b486f7fe8d0.

Suggested by: jhb
Reviewed by: alc, imp, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34089