msc_buffer_alloc(9)
π msc_buffer_alloc(9) β like, the actual manual page
okay bestie so this is the page for msc_buffer_alloc from the Kernel API Manual (section 9, kernel-space era π) and likeβ¦ it does exactly what it says on the tin: it allocates a buffer for MSC. slay. let's get into it π
β¨ NAME β¨
msc_buffer_alloc β allocate a buffer for MSC π¦
πΈ SYNOPSIS πΈ
int msc_buffer_alloc (struct msc *msc , unsigned long *nr_pages ,
unsigned int nr_wins );
it's giving "three arguments, one job". iconic honestly.
π ARGUMENTS π
mscβ the MSC device itself, the main character of this whole function πnr_pagesβ how many pages each window gets β¨nr_winsβ how many windows we're doing π₯
π¦ DESCRIPTION π¦
so basically this allocates a storage buffer for MSC, and the way it does that depends entirely on msc::mode, no cap:
- if we're in
SINGLEoperation mode, it happens throughmsc_buffer_contig_allocβ - if we're in multiblock operation, it goes through
msc_buffer_win_allocπ§
and here's the thing about the multiblock path: msc_buffer_win_alloc only allocates one window per invocation, bestie. so if you're in multiblock mode and you want multiple windows, you literally have to call this thing multiple times for the same MSC. that's just how it is π
also, super important heads up: this function modifies msc::win_list and msc::base, and messing with those requires msc::buf_mutex to serialize. so the caller is expected to already be holding it. not optional, not a suggestion β the page says "expected to hold it" and you should respect that fr fr π
π RETURN π
0on success π-errnootherwise π
π SEE ALSO π
okay this is a whole friend group, buckle up π:
Kernel file ./drivers/hwtracing/intel_th/msu.c, struct msc_window(9), struct msc_iter(9), struct msc(9), struct msu_buffer_entry(9), msc_is_last_win(9), msc_next_window(9), msc_find_window(9), msc_oldest_window(9), msc_win_oldest_sg(9), msc_buffer_iterate(9), msc_buffer_clear_hw_header(9), msc_configure(9), msc_disable(9), msc_buffer_contig_alloc(9), msc_buffer_contig_free(9), msc_buffer_contig_get_page(9), msc_buffer_win_alloc(9), msc_buffer_win_free(9), msc_buffer_relink(9), msc_buffer_free(9), msc_buffer_unlocked_free_unless_used(9), msc_buffer_free_unless_used(9), msc_buffer_get_page(9), struct msc_win_to_user_struct(9), msc_win_to_user(9), intel_th_msc_window_unlock(9)
lowkey a whole syllabus of reading material. read them all if you wanna be the main character of the intel_th subsystem π
and that's the page, bestie!! π this one lives under ./drivers/hwtracing/intel_th and it's dated October 2026 β so like, future vibes but make it kernel. mwah π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms