Re: [PATCH v5 10/14] mm: x86: Invoke hypercall when page encryption status is changed

From: kbuild test robot
Date: Sun Mar 29 2020 - 22:38:04 EST


Hi Ashish,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/x86/mm]
[also build test ERROR on v5.6]
[cannot apply to kvm/linux-next tip/x86/core next-20200327]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Ashish-Kalra/Add-AMD-SEV-guest-live-migration-support/20200330-094122
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git aa61ee7b9ee3cb84c0d3a842b0d17937bf024c46
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/x86/mm/pat/set_memory.c: In function '__set_memory_enc_dec':
>> arch/x86/mm/pat/set_memory.c:1995:2: error: implicit declaration of function 'page_encryption_changed'; did you mean 'sme_encrypt_kernel'? [-Werror=implicit-function-declaration]
page_encryption_changed(addr, numpages, enc);
^~~~~~~~~~~~~~~~~~~~~~~
sme_encrypt_kernel
cc1: some warnings being treated as errors

vim +1995 arch/x86/mm/pat/set_memory.c

1950
1951 static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)
1952 {
1953 struct cpa_data cpa;
1954 int ret;
1955
1956 /* Nothing to do if memory encryption is not active */
1957 if (!mem_encrypt_active())
1958 return 0;
1959
1960 /* Should not be working on unaligned addresses */
1961 if (WARN_ONCE(addr & ~PAGE_MASK, "misaligned address: %#lx\n", addr))
1962 addr &= PAGE_MASK;
1963
1964 memset(&cpa, 0, sizeof(cpa));
1965 cpa.vaddr = &addr;
1966 cpa.numpages = numpages;
1967 cpa.mask_set = enc ? __pgprot(_PAGE_ENC) : __pgprot(0);
1968 cpa.mask_clr = enc ? __pgprot(0) : __pgprot(_PAGE_ENC);
1969 cpa.pgd = init_mm.pgd;
1970
1971 /* Must avoid aliasing mappings in the highmem code */
1972 kmap_flush_unused();
1973 vm_unmap_aliases();
1974
1975 /*
1976 * Before changing the encryption attribute, we need to flush caches.
1977 */
1978 cpa_flush(&cpa, 1);
1979
1980 ret = __change_page_attr_set_clr(&cpa, 1);
1981
1982 /*
1983 * After changing the encryption attribute, we need to flush TLBs again
1984 * in case any speculative TLB caching occurred (but no need to flush
1985 * caches again). We could just use cpa_flush_all(), but in case TLB
1986 * flushing gets optimized in the cpa_flush() path use the same logic
1987 * as above.
1988 */
1989 cpa_flush(&cpa, 0);
1990
1991 /* Notify hypervisor that a given memory range is mapped encrypted
1992 * or decrypted. The hypervisor will use this information during the
1993 * VM migration.
1994 */
> 1995 page_encryption_changed(addr, numpages, enc);
1996
1997 return ret;
1998 }
1999

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip