tools/testing/selftests/kvm/x86/xen_shinfo_test.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/x86/xen_shinfo_test.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/kvm/x86/xen_shinfo_test.c- Extension
.c- Size
- 33295 bytes
- Lines
- 1146
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_util.hkvm_util.hprocessor.hstdint.htime.hsched.hsignal.hpthread.hsys/eventfd.h
Detected Declarations
struct evtchn_sendstruct sched_pollstruct pvclock_vcpu_time_infostruct pvclock_wall_clockstruct vcpu_runstate_infostruct compat_vcpu_runstate_infostruct arch_vcpu_infostruct vcpu_infostruct shared_infofunction evtchn_handlerfunction guest_wait_for_irqfunction guest_codefunction handle_alrmfunction main
Annotated Snippet
struct evtchn_send {
u32 port;
};
struct sched_poll {
u32 *ports;
unsigned int nr_ports;
u64 timeout;
};
struct pvclock_vcpu_time_info {
u32 version;
u32 pad0;
u64 tsc_timestamp;
u64 system_time;
u32 tsc_to_system_mul;
s8 tsc_shift;
u8 flags;
u8 pad[2];
} __attribute__((__packed__)); /* 32 bytes */
struct pvclock_wall_clock {
u32 version;
u32 sec;
u32 nsec;
} __attribute__((__packed__));
struct vcpu_runstate_info {
u32 state;
u64 state_entry_time;
u64 time[5]; /* Extra field for overrun check */
};
struct compat_vcpu_runstate_info {
u32 state;
u64 state_entry_time;
u64 time[5];
} __attribute__((__packed__));
struct arch_vcpu_info {
unsigned long cr2;
unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
};
struct vcpu_info {
u8 evtchn_upcall_pending;
u8 evtchn_upcall_mask;
unsigned long evtchn_pending_sel;
struct arch_vcpu_info arch;
struct pvclock_vcpu_time_info time;
}; /* 64 bytes (x86) */
struct shared_info {
struct vcpu_info vcpu_info[32];
unsigned long evtchn_pending[64];
unsigned long evtchn_mask[64];
struct pvclock_wall_clock wc;
u32 wc_sec_hi;
/* arch_shared_info here */
};
#define RUNSTATE_running 0
#define RUNSTATE_runnable 1
#define RUNSTATE_blocked 2
#define RUNSTATE_offline 3
static const char *runstate_names[] = {
"running",
"runnable",
"blocked",
"offline"
};
struct {
struct kvm_irq_routing info;
struct kvm_irq_routing_entry entries[2];
} irq_routes;
static volatile bool guest_saw_irq;
static void evtchn_handler(struct ex_regs *regs)
{
struct vcpu_info *vi = (void *)VCPU_INFO_VADDR;
vcpu_arch_put_guest(vi->evtchn_upcall_pending, 0);
vcpu_arch_put_guest(vi->evtchn_pending_sel, 0);
guest_saw_irq = true;
GUEST_SYNC(TEST_GUEST_SAW_IRQ);
}
Annotation
- Immediate include surface: `test_util.h`, `kvm_util.h`, `processor.h`, `stdint.h`, `time.h`, `sched.h`, `signal.h`, `pthread.h`.
- Detected declarations: `struct evtchn_send`, `struct sched_poll`, `struct pvclock_vcpu_time_info`, `struct pvclock_wall_clock`, `struct vcpu_runstate_info`, `struct compat_vcpu_runstate_info`, `struct arch_vcpu_info`, `struct vcpu_info`, `struct shared_info`, `function evtchn_handler`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.