drivers/gpu/drm/vmwgfx/vmwgfx_mksstat.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_mksstat.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_mksstat.h- Extension
.h- Size
- 7073 bytes
- Lines
- 147
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/page.hlinux/kconfig.h
Detected Declarations
struct mksstat_timer_t
Annotated Snippet
struct mksstat_timer_t {
/* mutable */ mksstat_kern_stats_t old_top;
const u64 t0;
const int slot;
};
#define MKS_STAT_TIME_DECL(kern_cntr) \
struct mksstat_timer_t _##kern_cntr = { \
.t0 = rdtsc(), \
.slot = vmw_mksstat_get_kern_slot(current->pid, dev_priv) \
}
#define MKS_STAT_TIME_PUSH(kern_cntr) \
do { \
if (_##kern_cntr.slot >= 0) { \
_##kern_cntr.old_top = dev_priv->mksstat_kern_top_timer[_##kern_cntr.slot]; \
dev_priv->mksstat_kern_top_timer[_##kern_cntr.slot] = kern_cntr; \
} \
} while (0)
#define MKS_STAT_TIME_POP(kern_cntr) \
do { \
if (_##kern_cntr.slot >= 0) { \
const pid_t pid = atomic_cmpxchg(&dev_priv->mksstat_kern_pids[_##kern_cntr.slot], current->pid, MKSSTAT_PID_RESERVED); \
dev_priv->mksstat_kern_top_timer[_##kern_cntr.slot] = _##kern_cntr.old_top; \
\
if (pid == current->pid) { \
const u64 dt = rdtsc() - _##kern_cntr.t0; \
MKSGuestStatCounterTime *pstat; \
\
BUG_ON(!dev_priv->mksstat_kern_pages[_##kern_cntr.slot]); \
\
pstat = vmw_mksstat_get_kern_pstat(page_address(dev_priv->mksstat_kern_pages[_##kern_cntr.slot])); \
\
atomic64_inc(&pstat[kern_cntr].counter.count); \
atomic64_add(dt, &pstat[kern_cntr].selfCycles); \
atomic64_add(dt, &pstat[kern_cntr].totalCycles); \
\
if (_##kern_cntr.old_top != MKSSTAT_KERN_COUNT) \
atomic64_sub(dt, &pstat[_##kern_cntr.old_top].selfCycles); \
\
atomic_set(&dev_priv->mksstat_kern_pids[_##kern_cntr.slot], current->pid); \
} \
} \
} while (0)
#else
#define MKS_STAT_TIME_DECL(kern_cntr)
#define MKS_STAT_TIME_PUSH(kern_cntr)
#define MKS_STAT_TIME_POP(kern_cntr)
#endif /* IS_ENABLED(CONFIG_DRM_VMWGFX_MKSSTATS */
#endif
Annotation
- Immediate include surface: `asm/page.h`, `linux/kconfig.h`.
- Detected declarations: `struct mksstat_timer_t`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.