Re: [PATCH 3/3] mm: make pfn walker support ZONE_DEVICE

From: kbuild test robot
Date: Sat Nov 09 2019 - 12:10:42 EST


Hi Toshiki,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.4-rc6]
[cannot apply to next-20191108]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Toshiki-Fukasawa/make-pfn-walker-support-ZONE_DEVICE/20191110-000508
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0058b0a506e40d9a2c62015fe92eb64a44d78cd9
config: i386-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

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

All errors (new ones prefixed by >>):

fs/proc/page.c: In function 'kpage_common_read':
>> fs/proc/page.c:46:17: error: implicit declaration of function 'pfn_zone_device'; did you mean 'bus_find_device'? [-Werror=implicit-function-declaration]
if (!ppage && pfn_zone_device(pfn)) {
^~~~~~~~~~~~~~~
bus_find_device
cc1: some warnings being treated as errors

vim +46 fs/proc/page.c

25
26 /*
27 * This is general function to read various data on pages.
28 */
29 static ssize_t kpage_common_read(struct file *file, char __user *buf,
30 size_t count, loff_t *ppos, read_page_data_fn_t read_fn)
31 {
32 u64 __user *out = (u64 __user *)buf;
33 struct page *ppage;
34 unsigned long src = *ppos;
35 unsigned long pfn;
36 unsigned long valid_pages = 0;
37 ssize_t ret = 0;
38
39 pfn = src / KPMSIZE;
40 count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
41 if (src & KPMMASK || count & KPMMASK)
42 return -EINVAL;
43
44 while (count > 0) {
45 ppage = pfn_to_online_page(pfn);
> 46 if (!ppage && pfn_zone_device(pfn)) {
47 /*
48 * Skip to read first few uninitialized pages on
49 * ZONE_DEVICE. And count valid pages starting
50 * with the pfn so that minimize the number of
51 * calls to nr_valid_pages_zone_device().
52 */
53 if (!valid_pages)
54 valid_pages = nr_valid_pages_zone_device(pfn);
55 if (valid_pages) {
56 ppage = pfn_to_page(pfn);
57 valid_pages--;
58 }
59 } else if (valid_pages) {
60 /* ZONE_DEVICE has been hot removed */
61 valid_pages = 0;
62 }
63
64 if (put_user(read_fn(ppage), out)) {
65 ret = -EFAULT;
66 break;
67 }
68
69 pfn++;
70 out++;
71 count -= KPMSIZE;
72
73 cond_resched();
74 }
75
76 *ppos += (char __user *)out - buf;
77 if (!ret)
78 ret = (char __user *)out - buf;
79 return ret;
80 }
81

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip