On 14.10.2022 11:28, Henry Wang wrote: >> -----Original Message----- >> From: Jan Beulich <jbeul...@suse.com> >> >> On 14.10.2022 10:09, Henry Wang wrote: >>> @@ -1736,6 +1736,17 @@ void p2m_final_teardown(struct domain *d) >>> if ( !p2m->domain ) >>> return; >>> >>> + if ( !page_list_empty(&p2m->pages) ) >>> + p2m_teardown(d, false); >>> + >>> + if ( d->arch.paging.p2m_total_pages != 0 ) >>> + { >>> + spin_lock(&d->arch.paging.lock); >>> + p2m_set_allocation(d, 0, NULL); >>> + spin_unlock(&d->arch.paging.lock); >>> + ASSERT(d->arch.paging.p2m_total_pages == 0); >>> + } >> >> Is it intentional to largely open-code p2m_teardown_allocation() here? > > Yes, AFAICT p2m_teardown_allocation() is preemptible and we don't want > any preemption here.
Well, this can be dealt with by adding a parameter to the function, or by looping over it until it returns other than -ERESTART. Both would seem better to me than this duplication of functionality (but I'm not a maintainer of this code, as you know). Jan