From: Alistair Popple <apopple@nvidia.com>
To: kernel test robot <lkp@intel.com>
Cc: "kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Christoph Hellwig <hch@lst.de>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [linux-next:master 5116/5396] mm/memory.c:710:25: sparse: sparse: cast to non-scalar
Date: Wed, 16 Jun 2021 16:41:19 +1000 [thread overview]
Message-ID: <3772450.SNKsl09b0z@nvdebian> (raw)
In-Reply-To: <202105262107.LkxpsZsV-lkp@intel.com>
On Wednesday, 26 May 2021 11:56:13 PM AEST kernel test robot wrote:
> sparse warnings: (new ones prefixed by >>)
> >> mm/memory.c:710:25: sparse: sparse: cast to non-scalar
> >> mm/memory.c:710:25: sparse: sparse: cast from non-scalar
These warnings seem strange to me - sparse is warning about the following:
struct test test1 = { .x = 0 }, test2;
test2 = (struct test) test1;
But I don't see what the issue is. Obviously you wouldn't normally write code
like this but this is the result of macro expansion. The reason this warning
occurs only for Alpha is READ_ONCE has a different implementation there. At
this stage I don't think there is a problem with this patch though - it is
either an issue with sparse or with the Alpha READ_ONCE implementation. I did
have a go at fixing the Alpha implementation but couldn't come up with a way
to make sparse happy.
It's also worth noting a x86 build encounters the same pair of warnings in
other analogous situations.
- Alistair
> mm/memory.c:1024:17: sparse: sparse: context imbalance in 'copy_pte_range' - different lock contexts for basic block
> mm/memory.c:1721:16: sparse: sparse: context imbalance in '__get_locked_pte' - different lock contexts for basic block
> mm/memory.c:1770:9: sparse: sparse: context imbalance in 'insert_page' - different lock contexts for basic block
> mm/memory.c:2272:17: sparse: sparse: context imbalance in 'remap_pte_range' - different lock contexts for basic block
> mm/memory.c:2528:17: sparse: sparse: context imbalance in 'apply_to_pte_range' - unexpected unlock
> mm/memory.c:2816:17: sparse: sparse: context imbalance in 'wp_page_copy' - unexpected unlock
> mm/memory.c:3162:17: sparse: sparse: context imbalance in 'wp_pfn_shared' - unexpected unlock
> mm/memory.c:3225:19: sparse: sparse: context imbalance in 'do_wp_page' - different lock contexts for basic block
> mm/memory.c: note: in included file (through include/linux/mm.h, arch/alpha/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
> include/linux/pgtable.h:257:16: sparse: sparse: cast to non-scalar
> include/linux/pgtable.h:257:16: sparse: sparse: cast from non-scalar
> mm/memory.c:4823:5: sparse: sparse: context imbalance in 'follow_invalidate_pte' - different lock contexts for basic block
> mm/memory.c:4944:9: sparse: sparse: context imbalance in 'follow_pfn' - unexpected unlock
>
> vim +710 mm/memory.c
>
> 702
> 703 static void restore_exclusive_pte(struct vm_area_struct *vma,
> 704 struct page *page, unsigned long address,
> 705 pte_t *ptep)
> 706 {
> 707 pte_t pte;
> 708 swp_entry_t entry;
> 709
> > 710 pte = pte_mkold(mk_pte(page, READ_ONCE(vma->vm_page_prot)));
> 711 if (pte_swp_soft_dirty(*ptep))
> 712 pte = pte_mksoft_dirty(pte);
> 713
> 714 entry = pte_to_swp_entry(*ptep);
> 715 if (pte_swp_uffd_wp(*ptep))
> 716 pte = pte_mkuffd_wp(pte);
> 717 else if (is_writable_device_exclusive_entry(entry))
> 718 pte = maybe_mkwrite(pte_mkdirty(pte), vma);
> 719
> 720 set_pte_at(vma->vm_mm, address, ptep, pte);
> 721
> 722 /*
> 723 * No need to take a page reference as one was already
> 724 * created when the swap entry was made.
> 725 */
> 726 if (PageAnon(page))
> 727 page_add_anon_rmap(page, vma, address, false);
> 728 else
> 729 /*
> 730 * Currently device exclusive access only supports anonymous
> 731 * memory so the entry shouldn't point to a filebacked page.
> 732 */
> 733 WARN_ON_ONCE(!PageAnon(page));
> 734
> 735 if (vma->vm_flags & VM_LOCKED)
> 736 mlock_vma_page(page);
> 737
> 738 /*
> 739 * No need to invalidate - it was non-present before. However
> 740 * secondary CPUs may have mappings that need invalidating.
> 741 */
> 742 update_mmu_cache(vma, address, ptep);
> 743 }
> 744
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
prev parent reply other threads:[~2021-06-16 6:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 13:56 kernel test robot
2021-06-16 6:41 ` Alistair Popple [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3772450.SNKsl09b0z@nvdebian \
--to=apopple@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox