Re: [PATCH v6 2/3] fs/proc/task_mmu: Implement IOCTL to get and/or the clear info about PTEs

Muhammad Usama Anjum
2022-11-11T17:53:44Z

I've fixed these build failure for the next patch iteration. Please comment
and review on the patch. I'll wait for a few days before sending next version.

On 11/11/22 10:13 PM, kernel test robot wrote:
> Hi Muhammad,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on next-20221109]
> [also build test ERROR on v6.1-rc4]
> [cannot apply to shuah-kselftest/next shuah-kselftest/fixes linus/master v6.1-rc4 v6.1-rc3 v6.1-rc2]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Muhammad-Usama-Anjum/Implement-IOCTL-to-get-and-or-the-clear-info-about-PTEs/20221109-182618
> patch link: https://lore.kernel.org/r/20221109102303.851281-3-usama.anjum%40collabora.com
> patch subject: [PATCH v6 2/3] fs/proc/task_mmu: Implement IOCTL to get and/or the clear info about PTEs
> config: arm-buildonly-randconfig-r006-20221111
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 463da45892e2d2a262277b91b96f5f8c05dc25d0)
> 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
> # install arm cross compiling tool for clang build
> # apt-get install binutils-arm-linux-gnueabi
> # https://github.com/intel-lab-lkp/linux/commit/b329378abd03a741ff7250ec1b60292c893476da
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Muhammad-Usama-Anjum/Implement-IOCTL-to-get-and-or-the-clear-info-about-PTEs/20221109-182618
> git checkout b329378abd03a741ff7250ec1b60292c893476da
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash fs/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>>> fs/proc/task_mmu.c:1882:41: error: use of undeclared identifier 'HPAGE_SIZE'
> if ((IS_CLEAR_OP(p) && (end - addr < HPAGE_SIZE))) {
> ^
> 1 error generated.
>
>
> vim +/HPAGE_SIZE +1882 fs/proc/task_mmu.c
>
> 1856
> 1857 static int pagemap_scan_pmd_entry(pmd_t *pmd, unsigned long addr,
> 1858 unsigned long end, struct mm_walk *walk)
> 1859 {
> 1860 struct pagemap_scan_private *p = walk->private;
> 1861 struct vm_area_struct *vma = walk->vma;
> 1862 unsigned int len;
> 1863 spinlock_t *ptl;
> 1864 int ret = 0;
> 1865 pte_t *pte;
> 1866 bool dirty_vma = (p->flags & PAGEMAP_NO_REUSED_REGIONS) ?
> 1867 (false) : (vma->vm_flags & VM_SOFTDIRTY);
> 1868
> 1869 if ((walk->vma->vm_end < addr) || (p->max_pages && p->found_pages == p->max_pages))
> 1870 return 0;
> 1871
> 1872 end = min(end, walk->vma->vm_end);
> 1873
> 1874 ptl = pmd_trans_huge_lock(pmd, vma);
> 1875 if (ptl) {
> 1876 if (dirty_vma || check_soft_dirty_pmd(vma, addr, pmd, false)) {
> 1877 /*
> 1878 * Break huge page into small pages if operation needs to be performed is
> 1879 * on a portion of the huge page or the return buffer cannot store complete
> 1880 * data.
> 1881 */
>> 1882 if ((IS_CLEAR_OP(p) && (end - addr < HPAGE_SIZE))) {
> 1883 spin_unlock(ptl);
> 1884 split_huge_pmd(vma, pmd, addr);
> 1885 goto process_smaller_pages;
> 1886 }
> 1887
> 1888 if (IS_GET_OP(p)) {
> 1889 len = (end - addr)/PAGE_SIZE;
> 1890 if (p->max_pages && p->found_pages + len > p->max_pages)
> 1891 len = p->max_pages - p->found_pages;
> 1892
> 1893 ret = add_to_out(dirty_vma ||
> 1894 check_soft_dirty_pmd(vma, addr, pmd, false),
> 1895 vma->vm_file, pmd_present(*pmd), is_swap_pmd(*pmd),
> 1896 p, addr, len);
> 1897 }
> 1898 if (!ret && IS_CLEAR_OP(p))
> 1899 check_soft_dirty_pmd(vma, addr, pmd, true);
> 1900 }
> 1901 spin_unlock(ptl);
> 1902 return 0;
> 1903 }
> 1904
> 1905 process_smaller_pages:
> 1906 if (pmd_trans_unstable(pmd))
> 1907 return 0;
> 1908
> 1909 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
> 1910 for (; addr < end && !ret && (!p->max_pages || (p->found_pages < p->max_pages))
> 1911 ; pte++, addr += PAGE_SIZE) {
> 1912 if (IS_GET_OP(p))
> 1913 ret = add_to_out(dirty_vma || check_soft_dirty(vma, addr, pte, false),
> 1914 vma->vm_file, pte_present(*pte),
> 1915 is_swap_pte(*pte), p, addr, 1);
> 1916 if (!ret && IS_CLEAR_OP(p))
> 1917 check_soft_dirty(vma, addr, pte, true);
> 1918 }
> 1919 pte_unmap_unlock(pte - 1, ptl);
> 1920 cond_resched();
> 1921
> 1922 return 0;
> 1923 }
> 1924
>

--
BR,
Muhammad Usama Anjum