[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210091141.cHaQEuCs-lkp@intel.com>
Date: Sun, 9 Oct 2022 12:00:41 +0800
From: kernel test robot <lkp@...el.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [djbw-nvdimm:libnvdimm-pending 14/20] drivers/dax/mapping.c:637:39:
sparse: sparse: incorrect type in argument 1 (different base types)
Hi Dan,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm.git libnvdimm-pending
head: 911d658201acc386472f976e5fd2d48b9e45fdce
commit: 13b7b0af2665d99f48a1888edb2636a222523f04 [14/20] devdax: Move address_space helpers to the DAX core
config: alpha-randconfig-s032-20221009
compiler: alpha-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm.git/commit/?id=13b7b0af2665d99f48a1888edb2636a222523f04
git remote add djbw-nvdimm https://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm.git
git fetch --no-tags djbw-nvdimm libnvdimm-pending
git checkout 13b7b0af2665d99f48a1888edb2636a222523f04
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/dax/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/dax/mapping.c:637:39: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long v @@ got restricted vm_fault_t @@
drivers/dax/mapping.c:637:39: sparse: expected unsigned long v
drivers/dax/mapping.c:637:39: sparse: got restricted vm_fault_t
drivers/dax/mapping.c:639:39: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long v @@ got restricted vm_fault_t @@
drivers/dax/mapping.c:639:39: sparse: expected unsigned long v
drivers/dax/mapping.c:639:39: sparse: got restricted vm_fault_t
drivers/dax/mapping.c:643:31: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long v @@ got restricted vm_fault_t @@
drivers/dax/mapping.c:643:31: sparse: expected unsigned long v
drivers/dax/mapping.c:643:31: sparse: got restricted vm_fault_t
>> drivers/dax/mapping.c:1031:55: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int result @@ got restricted vm_fault_t @@
drivers/dax/mapping.c:1031:55: sparse: expected int result
drivers/dax/mapping.c:1031:55: sparse: got restricted vm_fault_t
>> drivers/dax/mapping.c:1046:58: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int result @@ got restricted vm_fault_t [assigned] [usertype] ret @@
drivers/dax/mapping.c:1046:58: sparse: expected int result
drivers/dax/mapping.c:1046:58: sparse: got restricted vm_fault_t [assigned] [usertype] ret
drivers/dax/mapping.c:216:13: sparse: sparse: context imbalance in 'wait_entry_unlocked' - unexpected unlock
drivers/dax/mapping.c:953:9: sparse: sparse: context imbalance in 'dax_writeback_one' - unexpected unlock
vim +637 drivers/dax/mapping.c
530
531 /*
532 * Find page cache entry at given index. If it is a DAX entry, return it
533 * with the entry locked. If the page cache doesn't contain an entry at
534 * that index, add a locked empty entry.
535 *
536 * When requesting an entry with size DAX_PMD, dax_grab_mapping_entry() will
537 * either return that locked entry or will return VM_FAULT_FALLBACK.
538 * This will happen if there are any PTE entries within the PMD range
539 * that we are requesting.
540 *
541 * We always favor PTE entries over PMD entries. There isn't a flow where we
542 * evict PTE entries in order to 'upgrade' them to a PMD entry. A PMD
543 * insertion will fail if it finds any PTE entries already in the tree, and a
544 * PTE insertion will cause an existing PMD entry to be unmapped and
545 * downgraded to PTE entries. This happens for both PMD zero pages as
546 * well as PMD empty entries.
547 *
548 * The exception to this downgrade path is for PMD entries that have
549 * real storage backing them. We will leave these real PMD entries in
550 * the tree, and PTE writes will simply dirty the entire PMD entry.
551 *
552 * Note: Unlike filemap_fault() we don't honor FAULT_FLAG_RETRY flags. For
553 * persistent memory the benefit is doubtful. We can add that later if we can
554 * show it helps.
555 *
556 * On error, this function does not return an ERR_PTR. Instead it returns
557 * a VM_FAULT code, encoded as an xarray internal entry. The ERR_PTR values
558 * overlap with xarray value entries.
559 */
560 void *dax_grab_mapping_entry(struct xa_state *xas,
561 struct address_space *mapping, unsigned int order)
562 {
563 unsigned long index = xas->xa_index;
564 bool pmd_downgrade; /* splitting PMD entry into PTE entries? */
565 void *entry;
566
567 retry:
568 pmd_downgrade = false;
569 xas_lock_irq(xas);
570 entry = get_unlocked_entry(xas, order);
571
572 if (entry) {
573 if (dax_is_conflict(entry))
574 goto fallback;
575 if (!xa_is_value(entry)) {
576 xas_set_err(xas, -EIO);
577 goto out_unlock;
578 }
579
580 if (order == 0) {
581 if (dax_is_pmd_entry(entry) &&
582 (dax_is_zero_entry(entry) ||
583 dax_is_empty_entry(entry))) {
584 pmd_downgrade = true;
585 }
586 }
587 }
588
589 if (pmd_downgrade) {
590 /*
591 * Make sure 'entry' remains valid while we drop
592 * the i_pages lock.
593 */
594 dax_lock_entry(xas, entry);
595
596 /*
597 * Besides huge zero pages the only other thing that gets
598 * downgraded are empty entries which don't need to be
599 * unmapped.
600 */
601 if (dax_is_zero_entry(entry)) {
602 xas_unlock_irq(xas);
603 unmap_mapping_pages(mapping,
604 xas->xa_index & ~PG_PMD_COLOUR,
605 PG_PMD_NR, false);
606 xas_reset(xas);
607 xas_lock_irq(xas);
608 }
609
610 dax_disassociate_entry(entry, mapping, false);
611 xas_store(xas, NULL); /* undo the PMD join */
612 dax_wake_entry(xas, entry, WAKE_ALL);
613 mapping->nrpages -= PG_PMD_NR;
614 entry = NULL;
615 xas_set(xas, index);
616 }
617
618 if (entry) {
619 dax_lock_entry(xas, entry);
620 } else {
621 unsigned long flags = DAX_EMPTY;
622
623 if (order > 0)
624 flags |= DAX_PMD;
625 entry = dax_make_entry(pfn_to_pfn_t(0), flags);
626 dax_lock_entry(xas, entry);
627 if (xas_error(xas))
628 goto out_unlock;
629 mapping->nrpages += 1UL << order;
630 }
631
632 out_unlock:
633 xas_unlock_irq(xas);
634 if (xas_nomem(xas, mapping_gfp_mask(mapping) & ~__GFP_HIGHMEM))
635 goto retry;
636 if (xas->xa_node == XA_ERROR(-ENOMEM))
> 637 return xa_mk_internal(VM_FAULT_OOM);
638 if (xas_error(xas))
> 639 return xa_mk_internal(VM_FAULT_SIGBUS);
640 return entry;
641 fallback:
642 xas_unlock_irq(xas);
643 return xa_mk_internal(VM_FAULT_FALLBACK);
644 }
645
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (128804 bytes)
Powered by blists - more mailing lists