tree:
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git locking/kcsan
head: ffed638b6a2180da8fd002a46632d746af72b299
commit: 7b364f0949ae2dd205d5e9afa4b82ee17030d928 [14/21] READ_ONCE: Drop pointer
qualifiers when reading from scalar types
config: powerpc-randconfig-s002-20200517 (attached as .config)
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-193-gb8fad4bc-dirty
git checkout 7b364f0949ae2dd205d5e9afa4b82ee17030d928
# save the attached .config to linux build tree
make C=1 ARCH=powerpc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> arch/powerpc/mm/pgtable.c:329:16: sparse: sparse: cast to
non-scalar
> arch/powerpc/mm/pgtable.c:329:16: sparse: sparse: cast from non-scalar
arch/powerpc/mm/pgtable.c:356:16: sparse: sparse: cast to non-scalar
arch/powerpc/mm/pgtable.c:356:16: sparse: sparse: cast from non-scalar
arch/powerpc/mm/pgtable.c:373:16: sparse: sparse: cast to non-scalar
arch/powerpc/mm/pgtable.c:373:16: sparse: sparse: cast from non-scalar
arch/powerpc/include/asm/book3s/64/pgtable.h:706:20: sparse: sparse: incorrect type in
initializer (different base types) @@ expected unsigned long long [usertype] mask @@
got nsigned long long [usertype] mask @@
arch/powerpc/include/asm/book3s/64/pgtable.h:706:20: sparse: expected unsigned long
long [usertype] mask
arch/powerpc/include/asm/book3s/64/pgtable.h:706:20: sparse: got restricted __be64
[usertype]
arch/powerpc/include/asm/book3s/64/pgtable.h:708:24: sparse: sparse: restricted __be64
degrades to integer
--
> arch/powerpc/mm/book3s64/hash_4k.c:34:29: sparse: sparse: cast to
non-scalar
> arch/powerpc/mm/book3s64/hash_4k.c:34:29: sparse: sparse: cast from non-scalar
--
> arch/powerpc/mm/book3s64/hash_hugepage.c:36:29: sparse: sparse:
cast to non-scalar
> arch/powerpc/mm/book3s64/hash_hugepage.c:36:29: sparse: sparse: cast from non-scalar
--
arch/powerpc/kvm/book3s_64_mmu_radix.c:345:6: sparse: sparse: symbol
'kvmppc_radix_set_pte_at' was not declared. Should it be static?
> arch/powerpc/kvm/book3s_64_mmu_radix.c:1295:23: sparse: sparse:
cast to non-scalar
> arch/powerpc/kvm/book3s_64_mmu_radix.c:1295:23: sparse: sparse: cast from non-scalar
arch/powerpc/kvm/book3s_64_mmu_radix.c:1302:23: sparse: sparse: cast to
non-scalar
arch/powerpc/kvm/book3s_64_mmu_radix.c:1302:23: sparse: sparse: cast from non-scalar
arch/powerpc/kvm/book3s_64_mmu_radix.c:1314:23: sparse: sparse: cast to non-scalar
arch/powerpc/kvm/book3s_64_mmu_radix.c:1314:23: sparse: sparse: cast from non-scalar
arch/powerpc/kvm/book3s_64_mmu_radix.c:1326:31: sparse: sparse: cast to non-scalar
arch/powerpc/kvm/book3s_64_mmu_radix.c:1326:31: sparse: sparse: cast from non-scalar
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __le64
--
> arch/powerpc/include/asm/kvm_book3s_64.h:428:27: sparse: sparse:
cast to non-scalar
> arch/powerpc/include/asm/kvm_book3s_64.h:428:27: sparse: sparse: cast from
non-scalar
> arch/powerpc/include/asm/kvm_book3s_64.h:428:27: sparse: sparse: cast to non-scalar
> arch/powerpc/include/asm/kvm_book3s_64.h:428:27: sparse: sparse: cast from non-scalar
--
> arch/powerpc/perf/callchain_64.c:52:15: sparse: sparse: cast to
non-scalar
> arch/powerpc/perf/callchain_64.c:52:15: sparse: sparse: cast from non-scalar
vim +329 arch/powerpc/mm/pgtable.c
0caed4de502c76 Christophe Leroy 2019-04-26 299
0caed4de502c76 Christophe Leroy 2019-04-26 300 /*
0caed4de502c76 Christophe Leroy 2019-04-26 301 * We have 4 cases for pgds and pmds:
0caed4de502c76 Christophe Leroy 2019-04-26 302 * (1) invalid (all zeroes)
0caed4de502c76 Christophe Leroy 2019-04-26 303 * (2) pointer to next table, as normal;
bottom 6 bits == 0
0caed4de502c76 Christophe Leroy 2019-04-26 304 * (3) leaf pte for huge page _PAGE_PTE
set
0caed4de502c76 Christophe Leroy 2019-04-26 305 * (4) hugepd pointer, _PAGE_PTE = 0 and
bits [2..6] indicate size of table
0caed4de502c76 Christophe Leroy 2019-04-26 306 *
0caed4de502c76 Christophe Leroy 2019-04-26 307 * So long as we atomically load page
table pointers we are safe against teardown,
0caed4de502c76 Christophe Leroy 2019-04-26 308 * we can follow the address down to the
the page and take a ref on it.
0caed4de502c76 Christophe Leroy 2019-04-26 309 * This function need to be called with
interrupts disabled. We use this variant
0caed4de502c76 Christophe Leroy 2019-04-26 310 * when we have MSR[EE] = 0 but the
paca->irq_soft_mask = IRQS_ENABLED
0caed4de502c76 Christophe Leroy 2019-04-26 311 */
0caed4de502c76 Christophe Leroy 2019-04-26 312 pte_t *__find_linux_pte(pgd_t *pgdir,
unsigned long ea,
0caed4de502c76 Christophe Leroy 2019-04-26 313 bool *is_thp, unsigned *hpage_shift)
0caed4de502c76 Christophe Leroy 2019-04-26 314 {
0caed4de502c76 Christophe Leroy 2019-04-26 315 pgd_t pgd, *pgdp;
0caed4de502c76 Christophe Leroy 2019-04-26 316 pud_t pud, *pudp;
0caed4de502c76 Christophe Leroy 2019-04-26 317 pmd_t pmd, *pmdp;
0caed4de502c76 Christophe Leroy 2019-04-26 318 pte_t *ret_pte;
0caed4de502c76 Christophe Leroy 2019-04-26 319 hugepd_t *hpdp = NULL;
0caed4de502c76 Christophe Leroy 2019-04-26 320 unsigned pdshift = PGDIR_SHIFT;
0caed4de502c76 Christophe Leroy 2019-04-26 321
0caed4de502c76 Christophe Leroy 2019-04-26 322 if (hpage_shift)
0caed4de502c76 Christophe Leroy 2019-04-26 323 *hpage_shift = 0;
0caed4de502c76 Christophe Leroy 2019-04-26 324
0caed4de502c76 Christophe Leroy 2019-04-26 325 if (is_thp)
0caed4de502c76 Christophe Leroy 2019-04-26 326 *is_thp = false;
0caed4de502c76 Christophe Leroy 2019-04-26 327
0caed4de502c76 Christophe Leroy 2019-04-26 328 pgdp = pgdir + pgd_index(ea);
0caed4de502c76 Christophe Leroy 2019-04-26 @329 pgd = READ_ONCE(*pgdp);
0caed4de502c76 Christophe Leroy 2019-04-26 330 /*
0caed4de502c76 Christophe Leroy 2019-04-26 331 * Always operate on the local stack
value. This make sure the
0caed4de502c76 Christophe Leroy 2019-04-26 332 * value don't get updated by a
parallel THP split/collapse,
0caed4de502c76 Christophe Leroy 2019-04-26 333 * page fault or a page unmap. The
return pte_t * is still not
0caed4de502c76 Christophe Leroy 2019-04-26 334 * stable. So should be checked there
for above conditions.
0caed4de502c76 Christophe Leroy 2019-04-26 335 */
0caed4de502c76 Christophe Leroy 2019-04-26 336 if (pgd_none(pgd))
0caed4de502c76 Christophe Leroy 2019-04-26 337 return NULL;
fab9a1165bcda9 Christophe Leroy 2019-04-26 338
d6eacedd1f0ebf Aneesh Kumar K.V 2019-05-14 339 if (pgd_is_leaf(pgd)) {
0caed4de502c76 Christophe Leroy 2019-04-26 340 ret_pte = (pte_t *)pgdp;
0caed4de502c76 Christophe Leroy 2019-04-26 341 goto out;
fab9a1165bcda9 Christophe Leroy 2019-04-26 342 }
d6eacedd1f0ebf Aneesh Kumar K.V 2019-05-14 343
fab9a1165bcda9 Christophe Leroy 2019-04-26 344 if (is_hugepd(__hugepd(pgd_val(pgd))))
{
0caed4de502c76 Christophe Leroy 2019-04-26 345 hpdp = (hugepd_t *)&pgd;
fab9a1165bcda9 Christophe Leroy 2019-04-26 346 goto out_huge;
fab9a1165bcda9 Christophe Leroy 2019-04-26 347 }
26e66b08c3376b Christophe Leroy 2019-04-26 348
0caed4de502c76 Christophe Leroy 2019-04-26 349 /*
0caed4de502c76 Christophe Leroy 2019-04-26 350 * Even if we end up with an unmap, the
pgtable will not
0caed4de502c76 Christophe Leroy 2019-04-26 351 * be freed, because we do an rcu free
and here we are
0caed4de502c76 Christophe Leroy 2019-04-26 352 * irq disabled
0caed4de502c76 Christophe Leroy 2019-04-26 353 */
0caed4de502c76 Christophe Leroy 2019-04-26 354 pdshift = PUD_SHIFT;
0caed4de502c76 Christophe Leroy 2019-04-26 355 pudp = pud_offset(&pgd, ea);
0caed4de502c76 Christophe Leroy 2019-04-26 356 pud = READ_ONCE(*pudp);
0caed4de502c76 Christophe Leroy 2019-04-26 357
0caed4de502c76 Christophe Leroy 2019-04-26 358 if (pud_none(pud))
0caed4de502c76 Christophe Leroy 2019-04-26 359 return NULL;
fab9a1165bcda9 Christophe Leroy 2019-04-26 360
d6eacedd1f0ebf Aneesh Kumar K.V 2019-05-14 361 if (pud_is_leaf(pud)) {
0caed4de502c76 Christophe Leroy 2019-04-26 362 ret_pte = (pte_t *)pudp;
0caed4de502c76 Christophe Leroy 2019-04-26 363 goto out;
fab9a1165bcda9 Christophe Leroy 2019-04-26 364 }
d6eacedd1f0ebf Aneesh Kumar K.V 2019-05-14 365
fab9a1165bcda9 Christophe Leroy 2019-04-26 366 if (is_hugepd(__hugepd(pud_val(pud))))
{
0caed4de502c76 Christophe Leroy 2019-04-26 367 hpdp = (hugepd_t *)&pud;
fab9a1165bcda9 Christophe Leroy 2019-04-26 368 goto out_huge;
fab9a1165bcda9 Christophe Leroy 2019-04-26 369 }
d6eacedd1f0ebf Aneesh Kumar K.V 2019-05-14 370
0caed4de502c76 Christophe Leroy 2019-04-26 371 pdshift = PMD_SHIFT;
0caed4de502c76 Christophe Leroy 2019-04-26 372 pmdp = pmd_offset(&pud, ea);
0caed4de502c76 Christophe Leroy 2019-04-26 373 pmd = READ_ONCE(*pmdp);
a00196a2721613 Nicholas Piggin 2019-06-07 374
0caed4de502c76 Christophe Leroy 2019-04-26 375 /*
a00196a2721613 Nicholas Piggin 2019-06-07 376 * A hugepage collapse is captured by
this condition, see
a00196a2721613 Nicholas Piggin 2019-06-07 377 * pmdp_collapse_flush.
0caed4de502c76 Christophe Leroy 2019-04-26 378 */
0caed4de502c76 Christophe Leroy 2019-04-26 379 if (pmd_none(pmd))
0caed4de502c76 Christophe Leroy 2019-04-26 380 return NULL;
0caed4de502c76 Christophe Leroy 2019-04-26 381
:::::: The code at line 329 was first introduced by commit
:::::: 0caed4de502c7699b7faeaea0a93b39e4f19e11a powerpc/mm: move __find_linux_pte() out of
hugetlbpage.c
:::::: TO: Christophe Leroy <christophe.leroy(a)c-s.fr>
:::::: CC: Michael Ellerman <mpe(a)ellerman.id.au>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org