Re: [RFC 02/14] x86/apic: Initialize Secure AVIC APIC backing page
From: Dave Hansen
Date: Wed Oct 09 2024 - 11:39:33 EST
On 9/13/24 04:36, Neeraj Upadhyay wrote:
> + sz = ALIGN(num_possible_cpus() * SZ_4K, SZ_2M);
> + backing_pages = kzalloc(sz, GFP_ATOMIC);
> + if (!backing_pages)
> + snp_abort();
Is this in an atomic context? If not, why the GFP_ATOMIC?
Second, this looks to be allocating a potentially large physically
contiguous chunk of memory, then handing it out 4k at a time. The loop is:
buf = alloc(NR_CPUS * PAGE_SIZE);
for (i = 0; i < NR_CPUS; i++)
foo[i] = buf + i * PAGE_SIZE;
but could be:
for (i = 0; i < NR_CPUS; i++)
foo[i] = alloc(PAGE_SIZE);
right?