On 2/22/24 04:50, Kirill A. Shutemov wrote:
On Wed, Feb 21, 2024 at 02:35:13PM -0600, Tom Lendacky wrote:
@@ -906,6 +917,206 @@ void snp_accept_memory(phys_addr_t start, phys_addr_t end)
        set_pages_state(vaddr, npages, SNP_PAGE_STATE_PRIVATE);
   }
+static inline bool pte_decrypted(pte_t pte)
+{
+       return cc_mkdec(pte_val(pte)) == pte_val(pte);
+}
+

This is duplicated in TDX code, arch/x86/coco/tdx/tdx.c, looks like
something that can go in a header file, maybe mem_encrypt.h.


I think <asm/pgtable.h> is a better fit.

+void snp_kexec_stop_conversion(bool crash)
+{
+       /* Stop new private<->shared conversions */
+       conversion_allowed = false;
+       crash_requested = crash;
+
+       /*
+        * Make sure conversion_allowed is cleared before checking
+        * conversions_in_progress.
+        */
+       barrier();

This should be smp_wmb().


Why?

IIUC, this is because conversions_in_progress can be set on another thread and so this needs an smp barrier. In this case, smp_wmb() just ends up being barrier(), but to me it is clearer this way. Just my opinion, though.

Thanks,
Tom




_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to