Message ID | 20241213162815.9196-9-carlo.nonato@minervasys.tech (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Arm cache coloring | expand |
On 13.12.2024 17:28, Carlo Nonato wrote: > PGC_static and PGC_extra need to be preserved when assigning a page. > Define a new macro that groups those flags and use it instead of or'ing > every time. > > Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech> Reviewed-by: Jan Beulich <jbeulich@suse.com> Aiui this is independent of 1-7 and hence could go in ahead of time? Jan
Hi Jan, On Mon, Dec 16, 2024 at 1:42 PM Jan Beulich <jbeulich@suse.com> wrote: > > On 13.12.2024 17:28, Carlo Nonato wrote: > > PGC_static and PGC_extra need to be preserved when assigning a page. > > Define a new macro that groups those flags and use it instead of or'ing > > every time. > > > > Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech> > > Reviewed-by: Jan Beulich <jbeulich@suse.com> > > Aiui this is independent of 1-7 and hence could go in ahead of time? Yes. > Jan Thanks. - Carlo
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 55d561e93c..7735c8b436 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -161,6 +161,10 @@ #endif #define PGC_no_buddy_merge PGC_static +/* + * Flags that are preserved in assign_pages() (and only there) + */ +#define PGC_preserved (PGC_extra | PGC_static) #ifndef PGT_TYPE_INFO_INITIALIZER #define PGT_TYPE_INFO_INITIALIZER 0 @@ -2382,7 +2386,7 @@ int assign_pages( for ( i = 0; i < nr; i++ ) { - ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static))); + ASSERT(!(pg[i].count_info & ~PGC_preserved)); if ( pg[i].count_info & PGC_extra ) extra_pages++; } @@ -2442,7 +2446,7 @@ int assign_pages( page_set_owner(&pg[i], d); smp_wmb(); /* Domain pointer must be visible before updating refcnt. */ pg[i].count_info = - (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated | 1; + (pg[i].count_info & PGC_preserved) | PGC_allocated | 1; page_list_add_tail(&pg[i], page_to_list(d, &pg[i])); }
PGC_static and PGC_extra need to be preserved when assigning a page. Define a new macro that groups those flags and use it instead of or'ing every time. Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech> --- v12: - fixed wrong patch sent in v11 - added comment on PGC_preserved v11: - removed PGC_broken from PGC_preserved - removed PGC preservation from mark_page_free() v10: - fixed commit message v9: - add PGC_broken to PGC_preserved - clear PGC_extra in alloc_domheap_pages() only if MEMF_no_refcount is set v8: - fixed PGC_extra ASSERT fail in alloc_domheap_pages() by removing PGC_extra before freeing v7: - PGC_preserved used also in mark_page_free() v6: - preserved_flags renamed to PGC_preserved - PGC_preserved is used only in assign_pages() v5: - new patch --- xen/common/page_alloc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)