All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: David Hildenbrand <david@redhat.com>
Cc: kbuild-all@lists.01.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-stable-rc:linux-4.19.y 7844/9999] fs/proc/page.c:49:11: note: in expansion of macro 'pfn_to_online_page'
Date: Thu, 26 Dec 2019 19:38:21 +0800	[thread overview]
Message-ID: <201912261916.jMQjPRjR%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 5430 bytes --]

Hi David,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
head:   672481c2deffb371d8a7dfdc009e44c09864a869
commit: 6ea856efef9f5c5a1a8e558ce67f72b37e2cd2a9 [7844/9999] fs/proc/page.c: don't access uninitialized memmaps in fs/proc/page.c
config: ia64-randconfig-a001-20191226 (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 6ea856efef9f5c5a1a8e558ce67f72b37e2cd2a9
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=ia64 

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

All warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/asm/ptrace.h:46:0,
                    from arch/ia64/include/asm/processor.h:20,
                    from arch/ia64/include/asm/thread_info.h:12,
                    from include/linux/thread_info.h:38,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/ia64/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:81,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/bootmem.h:8,
                    from fs/proc/page.c:2:
   fs/proc/page.c: In function 'kpagecount_read':
   arch/ia64/include/asm/page.h:118:36: error: 'max_mapnr' undeclared (first use in this function); did you mean 'dax_mapping'?
    # define pfn_valid(pfn)  (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
                                       ^
   include/linux/memory_hotplug.h:225:6: note: in expansion of macro 'pfn_valid'
     if (pfn_valid(pfn))   \
         ^~~~~~~~~
>> fs/proc/page.c:49:11: note: in expansion of macro 'pfn_to_online_page'
      ppage = pfn_to_online_page(pfn);
              ^~~~~~~~~~~~~~~~~~
   arch/ia64/include/asm/page.h:118:36: note: each undeclared identifier is reported only once for each function it appears in
    # define pfn_valid(pfn)  (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
                                       ^
   include/linux/memory_hotplug.h:225:6: note: in expansion of macro 'pfn_valid'
     if (pfn_valid(pfn))   \
         ^~~~~~~~~
>> fs/proc/page.c:49:11: note: in expansion of macro 'pfn_to_online_page'
      ppage = pfn_to_online_page(pfn);
              ^~~~~~~~~~~~~~~~~~
   fs/proc/page.c: In function 'kpageflags_read':
   arch/ia64/include/asm/page.h:118:36: error: 'max_mapnr' undeclared (first use in this function); did you mean 'dax_mapping'?
    # define pfn_valid(pfn)  (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
                                       ^
   include/linux/memory_hotplug.h:225:6: note: in expansion of macro 'pfn_valid'
     if (pfn_valid(pfn))   \
         ^~~~~~~~~
   fs/proc/page.c:225:11: note: in expansion of macro 'pfn_to_online_page'
      ppage = pfn_to_online_page(pfn);
              ^~~~~~~~~~~~~~~~~~

vim +/pfn_to_online_page +49 fs/proc/page.c

   > 2	#include <linux/bootmem.h>
     3	#include <linux/compiler.h>
     4	#include <linux/fs.h>
     5	#include <linux/init.h>
     6	#include <linux/ksm.h>
     7	#include <linux/mm.h>
     8	#include <linux/mmzone.h>
     9	#include <linux/huge_mm.h>
    10	#include <linux/proc_fs.h>
    11	#include <linux/seq_file.h>
    12	#include <linux/hugetlb.h>
    13	#include <linux/memcontrol.h>
    14	#include <linux/mmu_notifier.h>
    15	#include <linux/page_idle.h>
    16	#include <linux/kernel-page-flags.h>
    17	#include <linux/uaccess.h>
    18	#include "internal.h"
    19	
    20	#define KPMSIZE sizeof(u64)
    21	#define KPMMASK (KPMSIZE - 1)
    22	#define KPMBITS (KPMSIZE * BITS_PER_BYTE)
    23	
    24	/* /proc/kpagecount - an array exposing page counts
    25	 *
    26	 * Each entry is a u64 representing the corresponding
    27	 * physical page count.
    28	 */
    29	static ssize_t kpagecount_read(struct file *file, char __user *buf,
    30				     size_t count, loff_t *ppos)
    31	{
    32		u64 __user *out = (u64 __user *)buf;
    33		struct page *ppage;
    34		unsigned long src = *ppos;
    35		unsigned long pfn;
    36		ssize_t ret = 0;
    37		u64 pcount;
    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			/*
    46			 * TODO: ZONE_DEVICE support requires to identify
    47			 * memmaps that were actually initialized.
    48			 */
  > 49			ppage = pfn_to_online_page(pfn);
    50	
    51			if (!ppage || PageSlab(ppage))
    52				pcount = 0;
    53			else
    54				pcount = page_mapcount(ppage);
    55	
    56			if (put_user(pcount, out)) {
    57				ret = -EFAULT;
    58				break;
    59			}
    60	
    61			pfn++;
    62			out++;
    63			count -= KPMSIZE;
    64	
    65			cond_resched();
    66		}
    67	
    68		*ppos += (char __user *)out - buf;
    69		if (!ret)
    70			ret = (char __user *)out - buf;
    71		return ret;
    72	}
    73	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24046 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [linux-stable-rc:linux-4.19.y 7844/9999] fs/proc/page.c:49:11: note: in expansion of macro 'pfn_to_online_page'
Date: Thu, 26 Dec 2019 19:38:21 +0800	[thread overview]
Message-ID: <201912261916.jMQjPRjR%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 5572 bytes --]

Hi David,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
head:   672481c2deffb371d8a7dfdc009e44c09864a869
commit: 6ea856efef9f5c5a1a8e558ce67f72b37e2cd2a9 [7844/9999] fs/proc/page.c: don't access uninitialized memmaps in fs/proc/page.c
config: ia64-randconfig-a001-20191226 (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 6ea856efef9f5c5a1a8e558ce67f72b37e2cd2a9
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=ia64 

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

All warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/asm/ptrace.h:46:0,
                    from arch/ia64/include/asm/processor.h:20,
                    from arch/ia64/include/asm/thread_info.h:12,
                    from include/linux/thread_info.h:38,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/ia64/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:81,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/bootmem.h:8,
                    from fs/proc/page.c:2:
   fs/proc/page.c: In function 'kpagecount_read':
   arch/ia64/include/asm/page.h:118:36: error: 'max_mapnr' undeclared (first use in this function); did you mean 'dax_mapping'?
    # define pfn_valid(pfn)  (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
                                       ^
   include/linux/memory_hotplug.h:225:6: note: in expansion of macro 'pfn_valid'
     if (pfn_valid(pfn))   \
         ^~~~~~~~~
>> fs/proc/page.c:49:11: note: in expansion of macro 'pfn_to_online_page'
      ppage = pfn_to_online_page(pfn);
              ^~~~~~~~~~~~~~~~~~
   arch/ia64/include/asm/page.h:118:36: note: each undeclared identifier is reported only once for each function it appears in
    # define pfn_valid(pfn)  (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
                                       ^
   include/linux/memory_hotplug.h:225:6: note: in expansion of macro 'pfn_valid'
     if (pfn_valid(pfn))   \
         ^~~~~~~~~
>> fs/proc/page.c:49:11: note: in expansion of macro 'pfn_to_online_page'
      ppage = pfn_to_online_page(pfn);
              ^~~~~~~~~~~~~~~~~~
   fs/proc/page.c: In function 'kpageflags_read':
   arch/ia64/include/asm/page.h:118:36: error: 'max_mapnr' undeclared (first use in this function); did you mean 'dax_mapping'?
    # define pfn_valid(pfn)  (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
                                       ^
   include/linux/memory_hotplug.h:225:6: note: in expansion of macro 'pfn_valid'
     if (pfn_valid(pfn))   \
         ^~~~~~~~~
   fs/proc/page.c:225:11: note: in expansion of macro 'pfn_to_online_page'
      ppage = pfn_to_online_page(pfn);
              ^~~~~~~~~~~~~~~~~~

vim +/pfn_to_online_page +49 fs/proc/page.c

   > 2	#include <linux/bootmem.h>
     3	#include <linux/compiler.h>
     4	#include <linux/fs.h>
     5	#include <linux/init.h>
     6	#include <linux/ksm.h>
     7	#include <linux/mm.h>
     8	#include <linux/mmzone.h>
     9	#include <linux/huge_mm.h>
    10	#include <linux/proc_fs.h>
    11	#include <linux/seq_file.h>
    12	#include <linux/hugetlb.h>
    13	#include <linux/memcontrol.h>
    14	#include <linux/mmu_notifier.h>
    15	#include <linux/page_idle.h>
    16	#include <linux/kernel-page-flags.h>
    17	#include <linux/uaccess.h>
    18	#include "internal.h"
    19	
    20	#define KPMSIZE sizeof(u64)
    21	#define KPMMASK (KPMSIZE - 1)
    22	#define KPMBITS (KPMSIZE * BITS_PER_BYTE)
    23	
    24	/* /proc/kpagecount - an array exposing page counts
    25	 *
    26	 * Each entry is a u64 representing the corresponding
    27	 * physical page count.
    28	 */
    29	static ssize_t kpagecount_read(struct file *file, char __user *buf,
    30				     size_t count, loff_t *ppos)
    31	{
    32		u64 __user *out = (u64 __user *)buf;
    33		struct page *ppage;
    34		unsigned long src = *ppos;
    35		unsigned long pfn;
    36		ssize_t ret = 0;
    37		u64 pcount;
    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			/*
    46			 * TODO: ZONE_DEVICE support requires to identify
    47			 * memmaps that were actually initialized.
    48			 */
  > 49			ppage = pfn_to_online_page(pfn);
    50	
    51			if (!ppage || PageSlab(ppage))
    52				pcount = 0;
    53			else
    54				pcount = page_mapcount(ppage);
    55	
    56			if (put_user(pcount, out)) {
    57				ret = -EFAULT;
    58				break;
    59			}
    60	
    61			pfn++;
    62			out++;
    63			count -= KPMSIZE;
    64	
    65			cond_resched();
    66		}
    67	
    68		*ppos += (char __user *)out - buf;
    69		if (!ret)
    70			ret = (char __user *)out - buf;
    71		return ret;
    72	}
    73	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 24046 bytes --]

             reply	other threads:[~2019-12-26 11:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26 11:38 kbuild test robot [this message]
2019-12-26 11:38 ` [linux-stable-rc:linux-4.19.y 7844/9999] fs/proc/page.c:49:11: note: in expansion of macro 'pfn_to_online_page' kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201912261916.jMQjPRjR%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.