Re: [PATCH v2] dmabuf: Add the capability to expose DMA-BUF stats in sysfs

From: kernel test robot
Date: Tue Jan 26 2021 - 09:56:56 EST


Hi Hridya,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.11-rc5]
[cannot apply to next-20210125]
[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/Hridya-Valsaraju/dmabuf-Add-the-capability-to-expose-DMA-BUF-stats-in-sysfs/20210120-172216
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 45dfb8a5659ad286c28fa59008271dbc4e5e3f2d
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/1ce52d5b375d9055a8ca6a7d78f7f1c256680190
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Hridya-Valsaraju/dmabuf-Add-the-capability-to-expose-DMA-BUF-stats-in-sysfs/20210120-172216
git checkout 1ce52d5b375d9055a8ca6a7d78f7f1c256680190
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

>> drivers/dma-buf/dma-buf-sysfs-stats.c:144:6: warning: no previous prototype for 'dma_buf_attach_stats_teardown' [-Wmissing-prototypes]
144 | void dma_buf_attach_stats_teardown(struct dma_buf_attachment *attach)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/dma-buf/dma-buf-sysfs-stats.c:158:5: warning: no previous prototype for 'dma_buf_attach_stats_setup' [-Wmissing-prototypes]
158 | int dma_buf_attach_stats_setup(struct dma_buf_attachment *attach,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/dma-buf/dma-buf-sysfs-stats.c:199:6: warning: no previous prototype for 'dma_buf_stats_teardown' [-Wmissing-prototypes]
199 | void dma_buf_stats_teardown(struct dma_buf *dmabuf)
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/dma-buf/dma-buf-sysfs-stats.c:214:5: warning: no previous prototype for 'dma_buf_init_sysfs_statistics' [-Wmissing-prototypes]
214 | int dma_buf_init_sysfs_statistics(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/dma-buf/dma-buf-sysfs-stats.c:230:6: warning: no previous prototype for 'dma_buf_uninit_sysfs_statistics' [-Wmissing-prototypes]
230 | void dma_buf_uninit_sysfs_statistics(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/dma-buf/dma-buf-sysfs-stats.c:236:5: warning: no previous prototype for 'dma_buf_stats_setup' [-Wmissing-prototypes]
236 | int dma_buf_stats_setup(struct dma_buf *dmabuf)
| ^~~~~~~~~~~~~~~~~~~


vim +/dma_buf_attach_stats_teardown +144 drivers/dma-buf/dma-buf-sysfs-stats.c

143
> 144 void dma_buf_attach_stats_teardown(struct dma_buf_attachment *attach)
145 {
146 struct dma_buf_attach_sysfs_entry *sysfs_entry;
147
148 sysfs_entry = attach->sysfs_entry;
149 if (!sysfs_entry)
150 return;
151
152 sysfs_delete_link(&sysfs_entry->kobj, &attach->dev->kobj, "device");
153
154 kobject_del(&sysfs_entry->kobj);
155 kobject_put(&sysfs_entry->kobj);
156 }
157
> 158 int dma_buf_attach_stats_setup(struct dma_buf_attachment *attach,
159 unsigned int uid)
160 {
161 struct dma_buf_attach_sysfs_entry *sysfs_entry;
162 int ret;
163 struct dma_buf *dmabuf;
164
165 if (!attach)
166 return -EINVAL;
167
168 dmabuf = attach->dmabuf;
169
170 sysfs_entry = kzalloc(sizeof(struct dma_buf_attach_sysfs_entry),
171 GFP_KERNEL);
172 if (!sysfs_entry)
173 return -ENOMEM;
174
175 sysfs_entry->kobj.kset = dmabuf->sysfs_entry->attach_stats_kset;
176
177 attach->sysfs_entry = sysfs_entry;
178
179 ret = kobject_init_and_add(&sysfs_entry->kobj, &dma_buf_attach_ktype,
180 NULL, "%u", uid);
181 if (ret)
182 goto kobj_err;
183
184 ret = sysfs_create_link(&sysfs_entry->kobj, &attach->dev->kobj,
185 "device");
186 if (ret)
187 goto link_err;
188
189 return 0;
190
191 link_err:
192 kobject_del(&sysfs_entry->kobj);
193 kobj_err:
194 kobject_put(&sysfs_entry->kobj);
195 attach->sysfs_entry = NULL;
196
197 return ret;
198 }
> 199 void dma_buf_stats_teardown(struct dma_buf *dmabuf)
200 {
201 struct dma_buf_sysfs_entry *sysfs_entry;
202
203 sysfs_entry = dmabuf->sysfs_entry;
204 if (!sysfs_entry)
205 return;
206
207 kset_unregister(sysfs_entry->attach_stats_kset);
208 kobject_del(&sysfs_entry->kobj);
209 kobject_put(&sysfs_entry->kobj);
210 }
211
212 static struct kset *dma_buf_stats_kset;
213 static struct kset *dma_buf_per_buffer_stats_kset;
> 214 int dma_buf_init_sysfs_statistics(void)
215 {
216 dma_buf_stats_kset = kset_create_and_add("dmabuf", NULL, kernel_kobj);
217 if (!dma_buf_stats_kset)
218 return -ENOMEM;
219
220 dma_buf_per_buffer_stats_kset = kset_create_and_add("buffers", NULL,
221 &dma_buf_stats_kset->kobj);
222 if (!dma_buf_per_buffer_stats_kset) {
223 kset_unregister(dma_buf_stats_kset);
224 return -ENOMEM;
225 }
226
227 return 0;
228 }
229
> 230 void dma_buf_uninit_sysfs_statistics(void)
231 {
232 kset_unregister(dma_buf_per_buffer_stats_kset);
233 kset_unregister(dma_buf_stats_kset);
234 }
235
> 236 int dma_buf_stats_setup(struct dma_buf *dmabuf)

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

Attachment: .config.gz
Description: application/gzip