arch/powerpc/mm/book3s64/hash_native.c:832:29: error: variable 'index' set but not used

From: kernel test robot
Date: Thu Nov 11 2021 - 15:25:00 EST


Hi Paul,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: debe436e77c72fcee804fb867f275e6d31aa999c
commit: 53d143fe08c24c2ce44ee329e41c2a6aad57ebb5 powerpc: Add Microwatt platform
date: 5 months ago
config: powerpc64-buildonly-randconfig-r002-20210929 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=53d143fe08c24c2ce44ee329e41c2a6aad57ebb5
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 53d143fe08c24c2ce44ee329e41c2a6aad57ebb5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/powerpc/mm/book3s64/hash_native.c: In function 'native_flush_hash_range':
>> arch/powerpc/mm/book3s64/hash_native.c:832:29: error: variable 'index' set but not used [-Werror=unused-but-set-variable]
832 | unsigned long hash, index, hidx, shift, slot;
| ^~~~~
cc1: all warnings being treated as errors


vim +/index +832 arch/powerpc/mm/book3s64/hash_native.c

f4c82d5132b059 arch/ppc64/mm/hash_native.c R Sharada 2005-06-25 824
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 825 /*
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 826 * Batched hash table flush, we batch the tlbie's to avoid taking/releasing
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 827 * the lock all the time
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 828 */
61b1a94254a215 arch/ppc64/mm/hash_native.c Benjamin Herrenschmidt 2005-09-20 829 static void native_flush_hash_range(unsigned long number, int local)
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 830 {
a5d4b5891c2f1f arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-03-23 831 unsigned long vpn = 0;
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 @832 unsigned long hash, index, hidx, shift, slot;
8e561e7eda0281 arch/powerpc/mm/hash_native_64.c David Gibson 2007-06-13 833 struct hash_pte *hptep;
96e2844999f998 arch/ppc64/mm/hash_native.c David Gibson 2005-07-13 834 unsigned long hpte_v;
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 835 unsigned long want_v;
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 836 unsigned long flags;
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 837 real_pte_t pte;
69111bac42f5ce arch/powerpc/mm/hash_native_64.c Christoph Lameter 2014-10-21 838 struct ppc64_tlb_batch *batch = this_cpu_ptr(&ppc64_tlb_batch);
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 839 unsigned long psize = batch->psize;
1189be6508d451 arch/powerpc/mm/hash_native_64.c Paul Mackerras 2007-10-11 840 int ssize = batch->ssize;
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 841 int i;
88b1bf7268f568 arch/powerpc/mm/hash_native_64.c Frederic Barrat 2017-03-29 842 unsigned int use_local;
88b1bf7268f568 arch/powerpc/mm/hash_native_64.c Frederic Barrat 2017-03-29 843
88b1bf7268f568 arch/powerpc/mm/hash_native_64.c Frederic Barrat 2017-03-29 844 use_local = local && mmu_has_feature(MMU_FTR_TLBIEL) &&
88b1bf7268f568 arch/powerpc/mm/hash_native_64.c Frederic Barrat 2017-03-29 845 mmu_psize_defs[psize].tlbiel && !cxl_ctx_in_use();
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 846
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 847 local_irq_save(flags);
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 848
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 849 for (i = 0; i < number; i++) {
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 850 vpn = batch->vpn[i];
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 851 pte = batch->pte[i];
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 852
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 853 pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) {
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 854 hash = hpt_hash(vpn, shift, ssize);
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 855 hidx = __rpte_to_hidx(pte, index);
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 856 if (hidx & _PTEIDX_SECONDARY)
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 857 hash = ~hash;
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 858 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 859 slot += hidx & _PTEIDX_GROUP_IX;
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 860 hptep = htab_address + slot;
74f227b22897e0 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2013-04-28 861 want_v = hpte_encode_avpn(vpn, psize, ssize);
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 862 hpte_v = hpte_get_old_v(hptep);
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 863
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 864 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 865 continue;
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 866 /* lock and try again */
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 867 native_lock_hpte(hptep);
a833280b4aeeb3 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 868 hpte_v = hpte_get_old_v(hptep);
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 869
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 870 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 871 native_unlock_hpte(hptep);
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 872 else
96e2844999f998 arch/ppc64/mm/hash_native.c David Gibson 2005-07-13 873 hptep->v = 0;
27d8959da71277 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-06-29 874
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 875 } pte_iterate_hashed_end();
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 876 }
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 877
88b1bf7268f568 arch/powerpc/mm/hash_native_64.c Frederic Barrat 2017-03-29 878 if (use_local) {
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 879 asm volatile("ptesync":::"memory");
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 880 for (i = 0; i < number; i++) {
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 881 vpn = batch->vpn[i];
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 882 pte = batch->pte[i];
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 883
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 884 pte_iterate_hashed_subpages(pte, psize,
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 885 vpn, index, shift) {
b1022fbd293564 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2013-04-28 886 __tlbiel(vpn, psize, psize, ssize);
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 887 } pte_iterate_hashed_end();
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 888 }
05504b42562066 arch/powerpc/mm/book3s64/hash_native.c Nicholas Piggin 2020-09-16 889 ppc_after_tlbiel_barrier();
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 890 } else {
44ae3ab3358e96 arch/powerpc/mm/hash_native_64.c Matt Evans 2011-04-06 891 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 892
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 893 if (lock_tlbie)
6b9c9b8a66f769 arch/powerpc/mm/hash_native_64.c Thomas Gleixner 2010-02-18 894 raw_spin_lock(&native_tlbie_lock);
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 895
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 896 asm volatile("ptesync":::"memory");
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 897 for (i = 0; i < number; i++) {
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 898 vpn = batch->vpn[i];
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 899 pte = batch->pte[i];
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 900
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 901 pte_iterate_hashed_subpages(pte, psize,
5524a27d39b687 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2012-09-10 902 vpn, index, shift) {
b1022fbd293564 arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2013-04-28 903 __tlbie(vpn, psize, psize, ssize);
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 904 } pte_iterate_hashed_end();
3c726f8dee6f55 arch/powerpc/mm/hash_native_64.c Benjamin Herrenschmidt 2005-11-07 905 }
a5d4b5891c2f1f arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-03-23 906 /*
a5d4b5891c2f1f arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-03-23 907 * Just do one more with the last used values.
a5d4b5891c2f1f arch/powerpc/mm/hash_native_64.c Aneesh Kumar K.V 2018-03-23 908 */
047e6575aec71d arch/powerpc/mm/book3s64/hash_native.c Aneesh Kumar K.V 2019-09-24 909 fixup_tlbie_vpn(vpn, psize, psize, ssize);
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 910 asm volatile("eieio; tlbsync; ptesync":::"memory");
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 911
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 912 if (lock_tlbie)
6b9c9b8a66f769 arch/powerpc/mm/hash_native_64.c Thomas Gleixner 2010-02-18 913 raw_spin_unlock(&native_tlbie_lock);
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 914 }
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 915
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 916 local_irq_restore(flags);
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 917 }
^1da177e4c3f41 arch/ppc64/mm/hash_native.c Linus Torvalds 2005-04-16 918

:::::: The code at line 832 was first introduced by commit
:::::: 5524a27d39b68770f203d8d42eb5a95dde4933bc powerpc/mm: Convert virtual address to vpn

:::::: TO: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
:::::: CC: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip