On 10/06/2022 08:26, Jan Beulich wrote: > While PGT_pae_xen_l2 will be zapped once the type refcount of an L2 page > reaches zero, it'll be retained as long as the type refcount is non- > zero. Hence any checking against the requested type needs to either zap > the bit from the type or include it in the used mask. > > Fixes: 9186e96b199e ("x86/pv: Clean up _get_page_type()") > Signed-off-by: Jan Beulich <jbeul...@suse.com>
pae_xen_l2 being outside of the typemask is deeply confusing to work with. It also renders all of the comments trying to explain the structure of this logic wrong. I'm a little concerned with type usage in the non-coherent path too. It's safe, but is (along side the IOMMU path) a misleading example to surrounding code. Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com> I can't think of anything better to do in the short term. > --- > The check around the TLB flush which was moved for XSA-401 also looks to > needlessly trigger a flush when "type" has the bit set (while "x" > wouldn't). That's no different from original behavior, but still looks > inefficient. It's not the only inefficiency here. Still plenty of improvements to be had in _get_page_type(). ~Andrew