Re: [PATCH v10 4/8] KVM: mmu: Improve handling of non-refcounted pfns

From: Paolo Bonzini
Date: Fri Feb 23 2024 - 04:51:42 EST


On 2/21/24 08:25, David Stevens wrote:
+ /*
+ * TODO: Remove the first branch once all callers have been
+ * taught to play nice with non-refcounted struct pages.
+ */
+ if (page && !kfp->refcounted_page &&
+ !kfp->allow_non_refcounted_struct_page) {
+ r = -EFAULT;

Is the TODO practical, considering that 32-bit AMD as well as all non-TDP x86 do not support non-refcounted pages?

If the field is not going to go away, it's better to point out (in the definition of the struct) that some architectures may not have enough free space in the PTEs for the required tracking; and then drop the TODO.

+ } else if (!kfp->refcounted_page &&
+ !kfp->guarded_by_mmu_notifier &&
+ !allow_unsafe_mappings) {
+ r = -EFAULT;

Why is allow_unsafe_mappings desirable at all?

None of this is worth a respin, it can be fixed when applying.

Paolo