STRUCT DMA_DEBUG_ENTRY(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct dma_debug_entry(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so this is struct dma_debug_entry, and it lives in the Kernel API Manual. iykyk. its whole entire job? it tracks a dma_map* or dma_alloc_coherent mapping πŸ’… like that's literally the assignment and it ate.


✨ SYNOPSIS ✨

here's the shape of it, no cap, copy it exactly:

struct dma_debug_entry {
    struct list_head list;
    struct device    *dev;
    u64 dev_addr;
    u64 size;
    int type;
    int direction;
    int sg_call_ents;
    int sg_mapped_ents;
    phys_addr_t paddr;
    enum map_err_types map_err_type;
    unsigned long    attrs;
  #ifdef CONFIG_STACKTRACE;
    unsigned int    stack_len;
    unsigned long   stack_entries[DMA_DEBUG_STACKTRACE_ENTRIES];
  #endif;
 };

🌸 Members 🌸

breaking it down field by field because every single one of these matters, bestie:

  • list β€” this is the node on the pre-allocated free_entries list πŸ¦‹ it's giving backstage pass.
  • dev β€” the device. that's it, that's the field πŸ’œ
  • dev_addr β€” the dma address ✨
  • size β€” the length of the mapping, aka how much we're working with πŸ’…
  • type β€” one of single, page, sg, coherent β€” pick your fighter πŸŽ€
  • direction β€” an enum dma_data_direction, obviously πŸ™ˆ
  • sg_call_ents β€” sg call entries, it's right there in the name πŸ’€
  • sg_mapped_ents β€” sg mapped entries, same vibe, different field 🌈
  • paddr β€” physical start address of the mapping, lowkey important ⭐
  • map_err_type β€” this one tracks whether dma_mapping_error was checked πŸ‘€ yes it's keeping receipts, that's the whole point πŸ“
  • attrs β€” dma attributes πŸ’–
  • stack_len β€” the number of backtrace entries in stack_entries 🧚
  • stack_entries β€” the stack of backtrace history, like a little scrapbook of where you've been 😭πŸ”₯
real talk: stack_len and stack_entries are tucked inside #ifdef CONFIG_STACKTRACE, so if that's not on, these two are simply not invited to the function 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./kernel/dma/debug.c β€” go read it, it's the main character πŸ’€

k that's the whole page, you're welcome πŸ’œ

sign-off time: this iconic lil doc comes from ./kernel/dma, dated October 2026, and it's filed under struct dma_debug_entry(9). slay, go map some dma safely, and remember to check your errors. periodt. 🌸✨

πŸ“¦ where this page comes from