tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 387ac6229ecf6e012649d4fc409c5352655a4cf0 commit: 7e532cd71e830a9f7d5312a97ada25042da80a6d [2161/2297] mm: remove vm_insert_mixed() config: x86_64-randconfig-s1-09051441 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: git checkout 7e532cd71e830a9f7d5312a97ada25042da80a6d # save the attached .config to linux build tree make ARCH=x86_64 Note: the linux-next/master HEAD 387ac6229ecf6e012649d4fc409c5352655a4cf0 builds fine. It may have been fixed somewhere. All errors (new ones prefixed by >>): fs//cramfs/inode.c: In function 'cramfs_physmem_mmap': >> fs//cramfs/inode.c:423:10: error: implicit declaration of function 'vm_insert_mixed' [-Werror=implicit-function-declaration] ret = vm_insert_mixed(vma, vma->vm_start + off, pfn); ^~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/vm_insert_mixed +423 fs//cramfs/inode.c eddcd976 Nicolas Pitre 2017-10-12 352 eddcd976 Nicolas Pitre 2017-10-12 353 static int cramfs_physmem_mmap(struct file *file, struct vm_area_struct *vma) eddcd976 Nicolas Pitre 2017-10-12 354 { eddcd976 Nicolas Pitre 2017-10-12 355 struct inode *inode = file_inode(file); eddcd976 Nicolas Pitre 2017-10-12 356 struct cramfs_sb_info *sbi = CRAMFS_SB(inode->i_sb); eddcd976 Nicolas Pitre 2017-10-12 357 unsigned int pages, max_pages, offset; eddcd976 Nicolas Pitre 2017-10-12 358 unsigned long address, pgoff = vma->vm_pgoff; eddcd976 Nicolas Pitre 2017-10-12 359 char *bailout_reason; eddcd976 Nicolas Pitre 2017-10-12 360 int ret; eddcd976 Nicolas Pitre 2017-10-12 361 eddcd976 Nicolas Pitre 2017-10-12 362 ret = generic_file_readonly_mmap(file, vma); eddcd976 Nicolas Pitre 2017-10-12 363 if (ret) eddcd976 Nicolas Pitre 2017-10-12 364 return ret; eddcd976 Nicolas Pitre 2017-10-12 365 eddcd976 Nicolas Pitre 2017-10-12 366 /* eddcd976 Nicolas Pitre 2017-10-12 367 * Now try to pre-populate ptes for this vma with a direct eddcd976 Nicolas Pitre 2017-10-12 368 * mapping avoiding memory allocation when possible. eddcd976 Nicolas Pitre 2017-10-12 369 */ eddcd976 Nicolas Pitre 2017-10-12 370 eddcd976 Nicolas Pitre 2017-10-12 371 /* Could COW work here? */ eddcd976 Nicolas Pitre 2017-10-12 372 bailout_reason = "vma is writable"; eddcd976 Nicolas Pitre 2017-10-12 373 if (vma->vm_flags & VM_WRITE) eddcd976 Nicolas Pitre 2017-10-12 374 goto bailout; eddcd976 Nicolas Pitre 2017-10-12 375 eddcd976 Nicolas Pitre 2017-10-12 376 max_pages = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT; eddcd976 Nicolas Pitre 2017-10-12 377 bailout_reason = "beyond file limit"; eddcd976 Nicolas Pitre 2017-10-12 378 if (pgoff >= max_pages) eddcd976 Nicolas Pitre 2017-10-12 379 goto bailout; eddcd976 Nicolas Pitre 2017-10-12 380 pages = min(vma_pages(vma), max_pages - pgoff); eddcd976 Nicolas Pitre 2017-10-12 381 eddcd976 Nicolas Pitre 2017-10-12 382 offset = cramfs_get_block_range(inode, pgoff, &pages); eddcd976 Nicolas Pitre 2017-10-12 383 bailout_reason = "unsuitable block layout"; eddcd976 Nicolas Pitre 2017-10-12 384 if (!offset) eddcd976 Nicolas Pitre 2017-10-12 385 goto bailout; eddcd976 Nicolas Pitre 2017-10-12 386 address = sbi->linear_phys_addr + offset; eddcd976 Nicolas Pitre 2017-10-12 387 bailout_reason = "data is not page aligned"; eddcd976 Nicolas Pitre 2017-10-12 388 if (!PAGE_ALIGNED(address)) eddcd976 Nicolas Pitre 2017-10-12 389 goto bailout; eddcd976 Nicolas Pitre 2017-10-12 390 eddcd976 Nicolas Pitre 2017-10-12 391 /* Don't map the last page if it contains some other data */ eddcd976 Nicolas Pitre 2017-10-12 392 if (pgoff + pages == max_pages && cramfs_last_page_is_shared(inode)) { eddcd976 Nicolas Pitre 2017-10-12 393 pr_debug("mmap: %s: last page is shared\n", eddcd976 Nicolas Pitre 2017-10-12 394 file_dentry(file)->d_name.name); eddcd976 Nicolas Pitre 2017-10-12 395 pages--; eddcd976 Nicolas Pitre 2017-10-12 396 } eddcd976 Nicolas Pitre 2017-10-12 397 eddcd976 Nicolas Pitre 2017-10-12 398 if (!pages) { eddcd976 Nicolas Pitre 2017-10-12 399 bailout_reason = "no suitable block remaining"; eddcd976 Nicolas Pitre 2017-10-12 400 goto bailout; eddcd976 Nicolas Pitre 2017-10-12 401 } eddcd976 Nicolas Pitre 2017-10-12 402 eddcd976 Nicolas Pitre 2017-10-12 403 if (pages == vma_pages(vma)) { eddcd976 Nicolas Pitre 2017-10-12 404 /* eddcd976 Nicolas Pitre 2017-10-12 405 * The entire vma is mappable. remap_pfn_range() will eddcd976 Nicolas Pitre 2017-10-12 406 * make it distinguishable from a non-direct mapping eddcd976 Nicolas Pitre 2017-10-12 407 * in /proc/<pid>/maps by substituting the file offset eddcd976 Nicolas Pitre 2017-10-12 408 * with the actual physical address. eddcd976 Nicolas Pitre 2017-10-12 409 */ eddcd976 Nicolas Pitre 2017-10-12 410 ret = remap_pfn_range(vma, vma->vm_start, address >> PAGE_SHIFT, eddcd976 Nicolas Pitre 2017-10-12 411 pages * PAGE_SIZE, vma->vm_page_prot); eddcd976 Nicolas Pitre 2017-10-12 412 } else { eddcd976 Nicolas Pitre 2017-10-12 413 /* eddcd976 Nicolas Pitre 2017-10-12 414 * Let's create a mixed map if we can't map it all. eddcd976 Nicolas Pitre 2017-10-12 415 * The normal paging machinery will take care of the eddcd976 Nicolas Pitre 2017-10-12 416 * unpopulated ptes via cramfs_readpage(). eddcd976 Nicolas Pitre 2017-10-12 417 */ eddcd976 Nicolas Pitre 2017-10-12 418 int i; eddcd976 Nicolas Pitre 2017-10-12 419 vma->vm_flags |= VM_MIXEDMAP; eddcd976 Nicolas Pitre 2017-10-12 420 for (i = 0; i < pages && !ret; i++) { eddcd976 Nicolas Pitre 2017-10-12 421 unsigned long off = i * PAGE_SIZE; eddcd976 Nicolas Pitre 2017-10-12 422 pfn_t pfn = phys_to_pfn_t(address + off, PFN_DEV); eddcd976 Nicolas Pitre 2017-10-12 @423 ret = vm_insert_mixed(vma, vma->vm_start + off, pfn); eddcd976 Nicolas Pitre 2017-10-12 424 } eddcd976 Nicolas Pitre 2017-10-12 425 } eddcd976 Nicolas Pitre 2017-10-12 426 eddcd976 Nicolas Pitre 2017-10-12 427 if (!ret) eddcd976 Nicolas Pitre 2017-10-12 428 pr_debug("mapped %s[%lu] at 0x%08lx (%u/%lu pages) " eddcd976 Nicolas Pitre 2017-10-12 429 "to vma 0x%08lx, page_prot 0x%llx\n", eddcd976 Nicolas Pitre 2017-10-12 430 file_dentry(file)->d_name.name, pgoff, eddcd976 Nicolas Pitre 2017-10-12 431 address, pages, vma_pages(vma), vma->vm_start, eddcd976 Nicolas Pitre 2017-10-12 432 (unsigned long long)pgprot_val(vma->vm_page_prot)); eddcd976 Nicolas Pitre 2017-10-12 433 return ret; eddcd976 Nicolas Pitre 2017-10-12 434 eddcd976 Nicolas Pitre 2017-10-12 435 bailout: eddcd976 Nicolas Pitre 2017-10-12 436 pr_debug("%s[%lu]: direct mmap impossible: %s\n", eddcd976 Nicolas Pitre 2017-10-12 437 file_dentry(file)->d_name.name, pgoff, bailout_reason); eddcd976 Nicolas Pitre 2017-10-12 438 /* Didn't manage any direct map, but normal paging is still possible */ eddcd976 Nicolas Pitre 2017-10-12 439 return 0; eddcd976 Nicolas Pitre 2017-10-12 440 } eddcd976 Nicolas Pitre 2017-10-12 441 :::::: The code at line 423 was first introduced by commit :::::: eddcd97659e31f59fc99c6c3ca3dcce403585f7e cramfs: add mmap support :::::: TO: Nicolas Pitre <nicolas.pitre@xxxxxxxxxx> :::::: CC: Al Viro <viro@xxxxxxxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip