|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1 01/27] xen/riscv: Implement ARCH_PAGING_MEMPOOL
On 3/11/26 9:18 AM, Jan Beulich wrote: On 10.03.2026 18:08, Oleksii Kurochko wrote:The p2m_freelist is used to allocate pages for the P2M, but to initialize this list, domain_p2m_set_allocation() might be called. This function is invoked in construct_domU() within the common Dom0less code, and providing an implementation of domain_p2m_set_allocation() when CONFIG_ARCH_PAGING_MEMPOOL=y is appropriate for RISC-V.With this wording it is odd to see ... I missed if ARCH_PAGING_MEMPOOL=n then p2m.c, at least, will fail to compile so much more things would be needed to be #ifdef-ed. Just for simplicity then I will set CONFIG_ARCH_PAGING_MEMPOOL=y unconditionally and drop all the #ifdef-s related to this config I've added in this patch. --- a/xen/arch/riscv/p2m.c +++ b/xen/arch/riscv/p2m.c @@ -1568,3 +1568,34 @@ struct page_info *get_page_from_gfn(struct domain *d, unsigned long gfn,return page; It makes sense, I will apply that for RISC-V.Then for Arm and x86 could be done the same, I can send a separate patch for them. + spin_lock(&d->arch.paging.lock); + rc = p2m_set_allocation(d, pages, &preempted); + spin_unlock(&d->arch.paging.lock); + + ASSERT(preempted == (rc == -ERESTART));This actually suggests that (once again) Arm code perhaps shouldn't have been copied verbatim: There shouldn't be a need for the "preempted" state to be returned back in two distinct ways. Agree.The preempted argument of p2m_set_allocation() could be switched to a plain 'bool could_preempt', preemption would then be signaled solely via return -ERESTART, and the caller would just check rc, so no local bool preempted in this function and no ASSERT. I'm also thinking that the preempted argument could be dropped entirely, as it seems to exist only to conditionally enable the general_preempt_check() call inside the function. It is skipped only during domain_p2m_set_allocation(), which won't be a significant penalty if general_preempt_check() is called every time. All other callers pass a non-NULL preempted, so general_preempt_check() would always be executed regardless.
Yes, it could be used to be in sync with a code above. Thanks. ~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |