Re: [PATCH] xen/balloon: rename alloc/free_xenballooned_pages

2021-10-30 Thread kernel test robot
Hi Juergen,

I love your patch! Yet something to improve:

[auto build test ERROR on xen-tip/linux-next]
[also build test ERROR on linux/master linus/master v5.15-rc7 next-20211029]
[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]

url:
https://github.com/0day-ci/linux/commits/Juergen-Gross/xen-balloon-rename-alloc-free_xenballooned_pages/20211029-222901
base:   https://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git linux-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-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://github.com/0day-ci/linux/commit/4db6d782d7d5ef16ced6f4e54161bd8f1148d39b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Juergen-Gross/xen-balloon-rename-alloc-free_xenballooned_pages/20211029-222901
git checkout 4db6d782d7d5ef16ced6f4e54161bd8f1148d39b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross 
ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/xen/balloon.c:612:5: error: conflicting types for 
>> 'xen_alloc_unpopulated_pages'; have 'int(int,  struct page **)'
 612 | int xen_alloc_unpopulated_pages(int nr_pages, struct page **pages)
 | ^~~
   In file included from drivers/xen/balloon.c:68:
   include/xen/xen.h:55:5: note: previous declaration of 
'xen_alloc_unpopulated_pages' with type 'int(unsigned int,  struct page **)'
  55 | int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page 
**pages);
 | ^~~
   In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/node.h:18,
from include/linux/cpu.h:17,
from drivers/xen/balloon.c:41:
   drivers/xen/balloon.c:658:15: error: conflicting types for 
'xen_alloc_unpopulated_pages'; have 'int(int,  struct page **)'
 658 | EXPORT_SYMBOL(xen_alloc_unpopulated_pages);
 |   ^~~
   include/linux/export.h:98:28: note: in definition of macro '___EXPORT_SYMBOL'
  98 | extern typeof(sym) sym;  
   \
 |^~~
   include/linux/export.h:160:41: note: in expansion of macro '__EXPORT_SYMBOL'
 160 | #define _EXPORT_SYMBOL(sym, sec)__EXPORT_SYMBOL(sym, sec, "")
 | ^~~
   include/linux/export.h:163:41: note: in expansion of macro '_EXPORT_SYMBOL'
 163 | #define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
 | ^~
   drivers/xen/balloon.c:658:1: note: in expansion of macro 'EXPORT_SYMBOL'
 658 | EXPORT_SYMBOL(xen_alloc_unpopulated_pages);
 | ^
   In file included from drivers/xen/balloon.c:68:
   include/xen/xen.h:55:5: note: previous declaration of 
'xen_alloc_unpopulated_pages' with type 'int(unsigned int,  struct page **)'
  55 | int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page 
**pages);
 | ^~~
>> drivers/xen/balloon.c:665:6: error: conflicting types for 
>> 'xen_free_unpopulated_pages'; have 'void(int,  struct page **)'
 665 | void xen_free_unpopulated_pages(int nr_pages, struct page **pages)
 |  ^~
   In file included from drivers/xen/balloon.c:68:
   include/xen/xen.h:56:6: note: previous declaration of 
'xen_free_unpopulated_pages' with type 'void(unsigned int,  struct page **)'
  56 | void xen_free_unpopulated_pages(unsigned int nr_pages, struct page 
**pages);
 |  ^~
   In file included from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,

[PATCH] xen/balloon: rename alloc/free_xenballooned_pages

2021-10-29 Thread Juergen Gross
alloc_xenballooned_pages() and free_xenballooned_pages() are used as
direct replacements of xen_alloc_unpopulated_pages() and
xen_free_unpopulated_pages() in case CONFIG_XEN_UNPOPULATED_ALLOC isn't
defined.

Guard both functions with !CONFIG_XEN_UNPOPULATED_ALLOC and rename them
to the xen_*() variants they are replacing. This allows to remove some
ifdeffery from the xen.h header file.

Signed-off-by: Juergen Gross 
---
 drivers/xen/balloon.c | 18 ++
 include/xen/balloon.h |  3 ---
 include/xen/xen.h |  6 --
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 98fae43d4cec..35fac7fb513a 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -575,6 +575,7 @@ void balloon_set_new_target(unsigned long target)
 }
 EXPORT_SYMBOL_GPL(balloon_set_new_target);
 
+#ifndef CONFIG_XEN_UNPOPULATED_ALLOC
 static int add_ballooned_pages(int nr_pages)
 {
enum bp_state st;
@@ -603,12 +604,12 @@ static int add_ballooned_pages(int nr_pages)
 }
 
 /**
- * alloc_xenballooned_pages - get pages that have been ballooned out
+ * xen_alloc_unpopulated_pages - get pages that have been ballooned out
  * @nr_pages: Number of pages to get
  * @pages: pages returned
  * @return 0 on success, error otherwise
  */
-int alloc_xenballooned_pages(int nr_pages, struct page **pages)
+int xen_alloc_unpopulated_pages(int nr_pages, struct page **pages)
 {
int pgno = 0;
struct page *page;
@@ -645,7 +646,7 @@ int alloc_xenballooned_pages(int nr_pages, struct page 
**pages)
return 0;
  out_undo:
mutex_unlock(_mutex);
-   free_xenballooned_pages(pgno, pages);
+   xen_free_unpopulated_pages(pgno, pages);
/*
 * NB: free_xenballooned_pages will only subtract pgno pages, but since
 * target_unpopulated is incremented with nr_pages at the start we need
@@ -654,14 +655,14 @@ int alloc_xenballooned_pages(int nr_pages, struct page 
**pages)
balloon_stats.target_unpopulated -= nr_pages - pgno;
return ret;
 }
-EXPORT_SYMBOL(alloc_xenballooned_pages);
+EXPORT_SYMBOL(xen_alloc_unpopulated_pages);
 
 /**
- * free_xenballooned_pages - return pages retrieved with get_ballooned_pages
+ * xen_free_unpopulated_pages - return pages retrieved with get_ballooned_pages
  * @nr_pages: Number of pages
  * @pages: pages to return
  */
-void free_xenballooned_pages(int nr_pages, struct page **pages)
+void xen_free_unpopulated_pages(int nr_pages, struct page **pages)
 {
int i;
 
@@ -680,9 +681,9 @@ void free_xenballooned_pages(int nr_pages, struct page 
**pages)
 
mutex_unlock(_mutex);
 }
-EXPORT_SYMBOL(free_xenballooned_pages);
+EXPORT_SYMBOL(xen_free_unpopulated_pages);
 
-#if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC)
+#if defined(CONFIG_XEN_PV)
 static void __init balloon_add_region(unsigned long start_pfn,
  unsigned long pages)
 {
@@ -705,6 +706,7 @@ static void __init balloon_add_region(unsigned long 
start_pfn,
balloon_stats.total_pages += extra_pfn_end - start_pfn;
 }
 #endif
+#endif
 
 static int __init balloon_init(void)
 {
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
index 95a4187f263b..d6ee920fafa4 100644
--- a/include/xen/balloon.h
+++ b/include/xen/balloon.h
@@ -27,9 +27,6 @@ extern struct balloon_stats balloon_stats;
 
 void balloon_set_new_target(unsigned long target);
 
-int alloc_xenballooned_pages(int nr_pages, struct page **pages);
-void free_xenballooned_pages(int nr_pages, struct page **pages);
-
 #ifdef CONFIG_XEN_BALLOON
 void xen_balloon_init(void);
 #else
diff --git a/include/xen/xen.h b/include/xen/xen.h
index 43efba045acc..9f031b5faa54 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -52,13 +52,7 @@ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
 extern u64 xen_saved_max_mem_size;
 #endif
 
-#ifdef CONFIG_XEN_UNPOPULATED_ALLOC
 int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages);
 void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);
-#else
-#define xen_alloc_unpopulated_pages alloc_xenballooned_pages
-#define xen_free_unpopulated_pages free_xenballooned_pages
-#include 
-#endif
 
 #endif /* _XEN_XEN_H */
-- 
2.26.2