Thread (239 messages) flat view 239 messages, 19 authors, 2022-09-19

Re: [PATCH Part2 v5 21/45] KVM: SVM: Make AVIC backing, VMSA and VMCB memory allocation SNP safe

From: Brijesh Singh <hidden>
Date: 2021-09-23 20:44:36
Also in: kvm, linux-crypto, linux-mm, lkml

On 9/23/21 2:17 PM, Marc Orr wrote:
quoted
quoted
quoted
+
+struct page *snp_safe_alloc_page(struct kvm_vcpu *vcpu)
+{
+    unsigned long pfn;
+    struct page *p;
+
+    if (!cpu_feature_enabled(X86_FEATURE_SEV_SNP))
+            return alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
Continuing my other comment, above: if we introduce a
`snp_globally_enabled` var, we could use that here, rather than
`cpu_feature_enabled(X86_FEATURE_SEV_SNP)`.

Maybe I am missing something, what is wrong with
cpu_feature_enabled(...) check ? It's same as creating a global
variable. The feature enabled bit is not set if the said is not
enabled.  See the patch #3 [1] in this series.

[1]
https://lore.kernel.org/linux-mm/YUN+L0dlFMbC3bd4@zn.tnic/T/#m2ac1242b33abfcd0d9fb22a89f4c103eacf67ea7 (local)

thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help