tree: https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git hlp_vsie head: 71ab8aab641fbe4f12bdb55e2b41173ac9e40382 commit: 2eacb8048d2c0b0fed35dcd021d99966777f5867 [14/17] s390/mm: Add gmap shadowing for large pmds config: s390-allmodconfig (attached as .config) compiler: s390x-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 2eacb8048d2c0b0fed35dcd021d99966777f5867 # save the attached .config to linux build tree GCC_VERSION=7.2.0 make.cross ARCH=s390 Note: the kvms390/hlp_vsie HEAD 71ab8aab641fbe4f12bdb55e2b41173ac9e40382 builds fine. It only hurts bisectibility. All error/warnings (new ones prefixed by >>): In file included from include/linux/mmzone.h:8:0, from include/linux/gfp.h:6, from include/linux/mm.h:10, from arch/s390/mm/gmap.c:12: arch/s390/mm/gmap.c: In function 'gmap_shadow_page': >> arch/s390/mm/gmap.c:2451:46: error: 'GMAP_LOCK_SHADOW' undeclared (first use in this function); did you mean 'GMAP_NOTIFY_SHADOW'? spin_lock_nested(&sg->guest_table_lock, GMAP_LOCK_SHADOW); ^ include/linux/spinlock.h:218:30: note: in definition of macro 'raw_spin_lock_nested' _raw_spin_lock_nested(lock, subclass) ^~~~~~~~ >> arch/s390/mm/gmap.c:2451:6: note: in expansion of macro 'spin_lock_nested' spin_lock_nested(&sg->guest_table_lock, GMAP_LOCK_SHADOW); ^~~~~~~~~~~~~~~~ arch/s390/mm/gmap.c:2451:46: note: each undeclared identifier is reported only once for each function it appears in spin_lock_nested(&sg->guest_table_lock, GMAP_LOCK_SHADOW); ^ include/linux/spinlock.h:218:30: note: in definition of macro 'raw_spin_lock_nested' _raw_spin_lock_nested(lock, subclass) ^~~~~~~~ >> arch/s390/mm/gmap.c:2451:6: note: in expansion of macro 'spin_lock_nested' spin_lock_nested(&sg->guest_table_lock, GMAP_LOCK_SHADOW); ^~~~~~~~~~~~~~~~ vim +2451 arch/s390/mm/gmap.c 2394 2395 /** 2396 * gmap_shadow_page - create a shadow page mapping 2397 * @sg: pointer to the shadow guest address space structure 2398 * @saddr: faulting address in the shadow gmap 2399 * @pte: pte in parent gmap address space to get shadowed 2400 * 2401 * Returns 0 if successfully shadowed or already shadowed, -EAGAIN if the 2402 * shadow table structure is incomplete, -ENOMEM if out of memory and 2403 * -EFAULT if an address in the parent gmap could not be resolved. 2404 * 2405 * Called with sg->mm->mmap_sem in read. 2406 */ 2407 int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte) 2408 { 2409 struct gmap *parent; 2410 struct gmap_rmap *rmap; 2411 unsigned long vmaddr, paddr; 2412 spinlock_t *ptl_pmd = NULL, *ptl_pte = NULL; 2413 pmd_t *spmdp; 2414 pte_t *sptep, *tptep; 2415 int prot; 2416 int rc; 2417 2418 BUG_ON(!gmap_is_shadow(sg)); 2419 parent = sg->parent; 2420 prot = (pte_val(pte) & _PAGE_PROTECT) ? PROT_READ : PROT_WRITE; 2421 2422 rmap = kzalloc(sizeof(*rmap), GFP_KERNEL); 2423 if (!rmap) 2424 return -ENOMEM; 2425 rmap->raddr = (saddr & PAGE_MASK) | _SHADOW_RMAP_PGTABLE; 2426 2427 while (1) { 2428 paddr = pte_val(pte) & PAGE_MASK; 2429 vmaddr = __gmap_translate(parent, paddr); 2430 if (IS_ERR_VALUE(vmaddr)) { 2431 rc = vmaddr; 2432 break; 2433 } 2434 rc = radix_tree_preload(GFP_KERNEL); 2435 if (rc) 2436 break; 2437 rc = -EAGAIN; 2438 spmdp = gmap_pmd_op_walk(parent, paddr, vmaddr, &ptl_pmd); 2439 if (spmdp && !(pmd_val(*spmdp) & _SEGMENT_ENTRY_INVALID)) { 2440 /* Get page table pointer */ 2441 tptep = (pte_t *) gmap_table_walk(sg, saddr, 0); 2442 if (!tptep) { 2443 radix_tree_preload_end(); 2444 gmap_pmd_op_end(ptl_pmd); 2445 break; 2446 } 2447 2448 if (pmd_large(*spmdp)) { 2449 pte_t spte; 2450 if (!(pmd_val(*spmdp) & _SEGMENT_ENTRY_PROTECT)) { > 2451 spin_lock_nested(&sg->guest_table_lock, GMAP_LOCK_SHADOW); 2452 spte = __pte((pmd_val(*spmdp) & 2453 _SEGMENT_ENTRY_ORIGIN_LARGE) 2454 + (pte_index(paddr) << 12)); 2455 ptep_shadow_set(spte, tptep, pte); 2456 pmd_val(*spmdp) |= _SEGMENT_ENTRY_GMAP_VSIE; 2457 gmap_insert_rmap(sg, vmaddr, rmap); 2458 rmap = NULL; 2459 rc = 0; 2460 spin_unlock(&sg->guest_table_lock); 2461 } 2462 } else { 2463 sptep = gmap_pte_from_pmd(parent, spmdp, paddr, &ptl_pte); 2464 spin_lock_nested(&sg->guest_table_lock, GMAP_LOCK_SHADOW); 2465 if (sptep) { 2466 rc = ptep_shadow_pte(sg->mm, saddr, sptep, tptep, pte); 2467 if (rc > 0) { 2468 /* Success and a new mapping */ 2469 gmap_insert_rmap(sg, vmaddr, rmap); 2470 rmap = NULL; 2471 rc = 0; 2472 } 2473 spin_unlock(&sg->guest_table_lock); 2474 gmap_pte_op_end(ptl_pte); 2475 } 2476 } 2477 gmap_pmd_op_end(ptl_pmd); 2478 } 2479 radix_tree_preload_end(); 2480 if (!rc) 2481 break; 2482 rc = gmap_fixup(parent, paddr, vmaddr, prot); 2483 if (rc) 2484 break; 2485 } 2486 kfree(rmap); 2487 return rc; 2488 } 2489 EXPORT_SYMBOL_GPL(gmap_shadow_page); 2490 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip