arch/arm64/kvm/hyp/nvhe/list_debug.c

Source file repositories/reference/linux-study-clean/arch/arm64/kvm/hyp/nvhe/list_debug.c

File Facts

System
Linux kernel
Corpus path
arch/arm64/kvm/hyp/nvhe/list_debug.c
Extension
.c
Size
1398 bytes
Lines
57
Domain
Architecture Layer
Bucket
arch/arm64
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (corruption) {					 \
			if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
				BUG();				 	 \
			} else						 \
				WARN_ON(1);				 \
		}							 \
		corruption;						 \
	}))

/* The predicates checked here are taken from lib/list_debug.c. */

__list_valid_slowpath
bool __list_add_valid_or_report(struct list_head *new, struct list_head *prev,
				struct list_head *next)
{
	if (NVHE_CHECK_DATA_CORRUPTION(next->prev != prev) ||
	    NVHE_CHECK_DATA_CORRUPTION(prev->next != next) ||
	    NVHE_CHECK_DATA_CORRUPTION(new == prev || new == next))
		return false;

	return true;
}

__list_valid_slowpath
bool __list_del_entry_valid_or_report(struct list_head *entry)
{
	struct list_head *prev, *next;

	prev = entry->prev;
	next = entry->next;

	if (NVHE_CHECK_DATA_CORRUPTION(next == LIST_POISON1) ||
	    NVHE_CHECK_DATA_CORRUPTION(prev == LIST_POISON2) ||
	    NVHE_CHECK_DATA_CORRUPTION(prev->next != entry) ||
	    NVHE_CHECK_DATA_CORRUPTION(next->prev != entry))
		return false;

	return true;
}

Annotation

Implementation Notes