Message ID | 20211011185924.374213-3-tony.luck@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Basic recovery for machine checks inside SGX | expand |
Hi Tony, I love your patch! Yet something to improve: [auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on hnaz-mm/master tip/x86/sgx v5.15-rc6 next-20211021] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Tony-Luck/x86-sgx-Add-new-sgx_epc_page-flag-bit-to-mark-in-use-pages/20211012-035926 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next config: x86_64-randconfig-a011-20211011 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/9c7bd2907252bfbf4948be9855e3535319e1e9e4 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Tony-Luck/x86-sgx-Add-new-sgx_epc_page-flag-bit-to-mark-in-use-pages/20211012-035926 git checkout 9c7bd2907252bfbf4948be9855e3535319e1e9e4 # save the attached .config to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): ld: arch/x86/kernel/cpu/sgx/main.o: in function `sgx_setup_epc_section': >> arch/x86/kernel/cpu/sgx/main.c:654: undefined reference to `xa_store_range' vim +654 arch/x86/kernel/cpu/sgx/main.c 635 636 static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size, 637 unsigned long index, 638 struct sgx_epc_section *section) 639 { 640 unsigned long nr_pages = size >> PAGE_SHIFT; 641 unsigned long i; 642 643 section->virt_addr = memremap(phys_addr, size, MEMREMAP_WB); 644 if (!section->virt_addr) 645 return false; 646 647 section->pages = vmalloc(nr_pages * sizeof(struct sgx_epc_page)); 648 if (!section->pages) { 649 memunmap(section->virt_addr); 650 return false; 651 } 652 653 section->phys_addr = phys_addr; > 654 xa_store_range(&sgx_epc_address_space, section->phys_addr, 655 phys_addr + size - 1, section, GFP_KERNEL); 656 657 for (i = 0; i < nr_pages; i++) { 658 section->pages[i].section = index; 659 section->pages[i].flags = SGX_EPC_PAGE_IN_USE; 660 section->pages[i].owner = NULL; 661 list_add_tail(§ion->pages[i].list, &sgx_dirty_page_list); 662 } 663 664 return true; 665 } 666 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index d18988a46c13..09fa42690ff2 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -20,6 +20,7 @@ struct sgx_epc_section sgx_epc_sections[SGX_MAX_EPC_SECTIONS]; static int sgx_nr_epc_sections; static struct task_struct *ksgxd_tsk; static DECLARE_WAIT_QUEUE_HEAD(ksgxd_waitq); +static DEFINE_XARRAY(sgx_epc_address_space); /* * These variables are part of the state of the reclaimer, and must be accessed @@ -650,6 +651,8 @@ static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size, } section->phys_addr = phys_addr; + xa_store_range(&sgx_epc_address_space, section->phys_addr, + phys_addr + size - 1, section, GFP_KERNEL); for (i = 0; i < nr_pages; i++) { section->pages[i].section = index; @@ -661,6 +664,12 @@ static bool __init sgx_setup_epc_section(u64 phys_addr, u64 size, return true; } +bool arch_is_platform_page(u64 paddr) +{ + return !!xa_load(&sgx_epc_address_space, paddr); +} +EXPORT_SYMBOL_GPL(arch_is_platform_page); + /** * A section metric is concatenated in a way that @low bits 12-31 define the * bits 12-31 of the metric and @high bits 0-19 define the bits 32-51 of the