[gustavoars:testing/WFAMNAE-next20240223 1/1] mm/mmu_gather.c:23:39: warning: comparison of distinct pointer types ('struct mmu_gather_batch *' and 'struct mmu_gather_batch_hdr *')

From: kernel test robot
Date: Sun Feb 25 2024 - 07:27:40 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/WFAMNAE-next20240223
head: b23fc9e6ff31f4ef9e8de5580963cf53579ef0d4
commit: b23fc9e6ff31f4ef9e8de5580963cf53579ef0d4 [1/1] treewide: Address -Wflexible-array-member-not-at-end warnings
config: x86_64-randconfig-161-20240225 (https://download.01.org/0day-ci/archive/20240225/202402252018.GR2eyulM-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240225/202402252018.GR2eyulM-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402252018.GR2eyulM-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> mm/mmu_gather.c:23:39: warning: comparison of distinct pointer types ('struct mmu_gather_batch *' and 'struct mmu_gather_batch_hdr *') [-Wcompare-distinct-pointer-types]
23 | if (tlb->delayed_rmap && tlb->active != &tlb->local)
| ~~~~~~~~~~~ ^ ~~~~~~~~~~~
mm/mmu_gather.c:148:13: error: incompatible pointer types assigning to 'struct mmu_gather_batch *' from 'struct mmu_gather_batch_hdr *' [-Werror,-Wincompatible-pointer-types]
148 | for (batch = &tlb->local; batch && batch->nr; batch = batch->next)
| ^ ~~~~~~~~~~~
mm/mmu_gather.c:150:14: error: incompatible pointer types assigning to 'struct mmu_gather_batch *' from 'struct mmu_gather_batch_hdr *' [-Werror,-Wincompatible-pointer-types]
150 | tlb->active = &tlb->local;
| ^ ~~~~~~~~~~~
mm/mmu_gather.c:387:18: error: incompatible pointer types assigning to 'struct mmu_gather_batch *' from 'struct mmu_gather_batch_hdr *' [-Werror,-Wincompatible-pointer-types]
387 | tlb->active = &tlb->local;
| ^ ~~~~~~~~~~~
1 warning and 3 errors generated.


vim +23 mm/mmu_gather.c

952a31c9e6fa96 Martin Schwidefsky 2018-09-18 17
196d9d8bb71dea Peter Zijlstra 2018-09-03 18 static bool tlb_next_batch(struct mmu_gather *tlb)
196d9d8bb71dea Peter Zijlstra 2018-09-03 19 {
196d9d8bb71dea Peter Zijlstra 2018-09-03 20 struct mmu_gather_batch *batch;
196d9d8bb71dea Peter Zijlstra 2018-09-03 21
c47454823bd4e3 Linus Torvalds 2022-12-06 22 /* Limit batching if we have delayed rmaps pending */
c47454823bd4e3 Linus Torvalds 2022-12-06 @23 if (tlb->delayed_rmap && tlb->active != &tlb->local)
5df397dec7c4c0 Linus Torvalds 2022-11-09 24 return false;
5df397dec7c4c0 Linus Torvalds 2022-11-09 25
196d9d8bb71dea Peter Zijlstra 2018-09-03 26 batch = tlb->active;
196d9d8bb71dea Peter Zijlstra 2018-09-03 27 if (batch->next) {
196d9d8bb71dea Peter Zijlstra 2018-09-03 28 tlb->active = batch->next;
196d9d8bb71dea Peter Zijlstra 2018-09-03 29 return true;
196d9d8bb71dea Peter Zijlstra 2018-09-03 30 }
196d9d8bb71dea Peter Zijlstra 2018-09-03 31
196d9d8bb71dea Peter Zijlstra 2018-09-03 32 if (tlb->batch_count == MAX_GATHER_BATCH_COUNT)
196d9d8bb71dea Peter Zijlstra 2018-09-03 33 return false;
196d9d8bb71dea Peter Zijlstra 2018-09-03 34
dcc1be119071f0 Lorenzo Stoakes 2023-03-13 35 batch = (void *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
196d9d8bb71dea Peter Zijlstra 2018-09-03 36 if (!batch)
196d9d8bb71dea Peter Zijlstra 2018-09-03 37 return false;
196d9d8bb71dea Peter Zijlstra 2018-09-03 38
196d9d8bb71dea Peter Zijlstra 2018-09-03 39 tlb->batch_count++;
196d9d8bb71dea Peter Zijlstra 2018-09-03 40 batch->next = NULL;
196d9d8bb71dea Peter Zijlstra 2018-09-03 41 batch->nr = 0;
196d9d8bb71dea Peter Zijlstra 2018-09-03 42 batch->max = MAX_GATHER_BATCH;
196d9d8bb71dea Peter Zijlstra 2018-09-03 43
196d9d8bb71dea Peter Zijlstra 2018-09-03 44 tlb->active->next = batch;
196d9d8bb71dea Peter Zijlstra 2018-09-03 45 tlb->active = batch;
196d9d8bb71dea Peter Zijlstra 2018-09-03 46
196d9d8bb71dea Peter Zijlstra 2018-09-03 47 return true;
196d9d8bb71dea Peter Zijlstra 2018-09-03 48 }
196d9d8bb71dea Peter Zijlstra 2018-09-03 49

:::::: The code at line 23 was first introduced by commit
:::::: c47454823bd4e3ab34ed3f795afd4479ab938a3f mm: mmu_gather: allow more than one batch of delayed rmaps

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
:::::: CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki