Re: [PATCH v2 4/4] xen: add helpers to allocate unpopulated memory

kernel test robot
2020-07-24T15:46:41Z

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

Hi Roger,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on xen-tip/linux-next]
[also build test ERROR on linus/master v5.8-rc6 next-20200724]
[cannot apply to linux/master]
[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/Roger-Pau-Monne/xen-balloon-fixes-for-memory-hotplug/20200724-204452
base: https://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git linux-next
config: i386-debian-10.3 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=i386

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

All errors (new ones prefixed by >>):

drivers/gpu/drm/xen/xen_drm_front_gem.c: In function 'gem_create':
>> drivers/gpu/drm/xen/xen_drm_front_gem.c:102:9: error: implicit declaration of function 'xen_alloc_unpopulated_pages' [-Werror=implicit-function-declaration]
102 | ret = xen_alloc_unpopulated_pages(xen_obj->num_pages,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/xen/xen_drm_front_gem.c: In function 'xen_drm_front_gem_free_object_unlocked':
>> drivers/gpu/drm/xen/xen_drm_front_gem.c:155:5: error: implicit declaration of function 'xen_free_unpopulated_pages' [-Werror=implicit-function-declaration]
155 | xen_free_unpopulated_pages(xen_obj->num_pages,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/xen_alloc_unpopulated_pages +102 drivers/gpu/drm/xen/xen_drm_front_gem.c

77
78 static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size)
79 {
80 struct xen_drm_front_drm_info *drm_info = dev->dev_private;
81 struct xen_gem_object *xen_obj;
82 int ret;
83
84 size = round_up(size, PAGE_SIZE);
85 xen_obj = gem_create_obj(dev, size);
86 if (IS_ERR_OR_NULL(xen_obj))
87 return xen_obj;
88
89 if (drm_info->front_info->cfg.be_alloc) {
90 /*
91 * backend will allocate space for this buffer, so
92 * only allocate array of pointers to pages
93 */
94 ret = gem_alloc_pages_array(xen_obj, size);
95 if (ret < 0)
96 goto fail;
97
98 /*
99 * allocate ballooned pages which will be used to map
100 * grant references provided by the backend
101 */
> 102 ret = xen_alloc_unpopulated_pages(xen_obj->num_pages,
103 xen_obj->pages);
104 if (ret < 0) {
105 DRM_ERROR("Cannot allocate %zu ballooned pages: %d\n",
106 xen_obj->num_pages, ret);
107 gem_free_pages_array(xen_obj);
108 goto fail;
109 }
110
111 xen_obj->be_alloc = true;
112 return xen_obj;
113 }
114 /*
115 * need to allocate backing pages now, so we can share those
116 * with the backend
117 */
118 xen_obj->num_pages = DIV_ROUND_UP(size, PAGE_SIZE);
119 xen_obj->pages = drm_gem_get_pages(&xen_obj->base);
120 if (IS_ERR_OR_NULL(xen_obj->pages)) {
121 ret = PTR_ERR(xen_obj->pages);
122 xen_obj->pages = NULL;
123 goto fail;
124 }
125
126 return xen_obj;
127
128 fail:
129 DRM_ERROR("Failed to allocate buffer with size %zu\n", size);
130 return ERR_PTR(ret);
131 }
132
133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev,
134 size_t size)
135 {
136 struct xen_gem_object *xen_obj;
137
138 xen_obj = gem_create(dev, size);
139 if (IS_ERR_OR_NULL(xen_obj))
140 return ERR_CAST(xen_obj);
141
142 return &xen_obj->base;
143 }
144
145 void xen_drm_front_gem_free_object_unlocked(struct drm_gem_object *gem_obj)
146 {
147 struct xen_gem_object *xen_obj = to_xen_gem_obj(gem_obj);
148
149 if (xen_obj->base.import_attach) {
150 drm_prime_gem_destroy(&xen_obj->base, xen_obj->sgt_imported);
151 gem_free_pages_array(xen_obj);
152 } else {
153 if (xen_obj->pages) {
154 if (xen_obj->be_alloc) {
> 155 xen_free_unpopulated_pages(xen_obj->num_pages,
156 xen_obj->pages);
157 gem_free_pages_array(xen_obj);
158 } else {
159 drm_gem_put_pages(&xen_obj->base,
160 xen_obj->pages, true, false);
161 }
162 }
163 }
164 drm_gem_object_release(gem_obj);
165 kfree(xen_obj);
166 }
167

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

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