tools/testing/selftests/kvm/include/userfaultfd_util.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/include/userfaultfd_util.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/kvm/include/userfaultfd_util.h
Extension
.h
Size
1216 bytes
Lines
53
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct uffd_reader_args {
	int uffd_mode;
	int uffd;
	useconds_t delay;
	uffd_handler_t handler;
	/* Holds the read end of the pipe for killing the reader. */
	int pipe;
};

struct uffd_desc {
	int uffd;
	u64 num_readers;
	/* Holds the write ends of the pipes for killing the readers. */
	int *pipefds;
	pthread_t *readers;
	struct uffd_reader_args *reader_args;
};

struct uffd_desc *uffd_setup_demand_paging(int uffd_mode, useconds_t delay,
					   void *hva, u64 len,
					   u64 num_readers,
					   uffd_handler_t handler);

void uffd_stop_demand_paging(struct uffd_desc *uffd);

#ifdef PRINT_PER_PAGE_UPDATES
#define PER_PAGE_DEBUG(...) printf(__VA_ARGS__)
#else
#define PER_PAGE_DEBUG(...) _no_printf(__VA_ARGS__)
#endif

#ifdef PRINT_PER_VCPU_UPDATES
#define PER_VCPU_DEBUG(...) printf(__VA_ARGS__)
#else
#define PER_VCPU_DEBUG(...) _no_printf(__VA_ARGS__)
#endif

Annotation

Implementation Notes