On 02.09.2026 11:43, George Dunlap wrote: > From: Roger Pau Monné <[email protected]> > > We want to change per-domain mappings to be per-vCPU mappings. In > preparation for that, we want to arrange that > destroy_perdomain_mapping() work either with a single perdomain area, > or with a per-vCPU perdomain area. > > There are two calls made from domain-scoped contexts; both calls turn > out to be unnecessary: > > - destroy_perdomain_mapping() is not logically the undo of > create_perdomain_mapping(), as the name and its use in > hvm_domain_initialise() suggest. create_ allocates a per-domain L3, > but destroy_ tears down mappings without freeing it; and since the > call here passes nr == 0, it tears down nothing at all. The > per-domain L3 page is actually freed by free_perdomain_mappings(), > which hvm_domain_initialise()'s caller, arch_domain_create(), > already invokes on its failure path. > > - The call in pv_domain_destroy() is redundant: arch_domain_destroy() > unconditionally calls free_perdomain_mappings(), which tears down > the same entries and additionally frees the page-table structures.
pv_domain_destroy() has a 2nd call site (the error path of pv_domain_initialise()), but the situation is the same there: arch_domain_create()'s error path also calls free_perdomain_mappings(). > Signed-off-by: Roger Pau Monné <[email protected]> > Reviewed-by: Alejandro Vallejo <[email protected]> > Assisted-by: Claude Code:claude-fable-5 > Signed-off-by: George Dunlap <[email protected]> With the description amended: Reviewed-by: Jan Beulich <[email protected]> Jan
