On 11/5/26 17:07, Duan, Zhenzhong wrote:
Hi Clement,

Good finding!

It looks not easy to refactor all these as
vtd_switch_address_space() is called in many callsites,
not only fast path.

I see in vtd_switch_address_space() vtd_as_pt_enabled()
is called twice, that's obviously unnecessary.

I'm not sure if it's possible to cache CE and PE before
all vtd_switch_address_space() so it only needs to check
cache for PT.

I had considered it as well during reviewing the prior patches. It might
be worth thinking about caching both CE and PE in the AddressSpace and
gating their life circle by the CC/PC invalidation request from guest.
In other paths, we can just refer to the cached CE and PE. But this
means we rely on guest flushes cache timely when there is CE/PE
modification. This is spec defined behavior, so might be fine?

Regards,
Yi Liu

Reply via email to