Message ID | 20240604173606.998721-1-isaacmanjarres@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v4] fs: Improve eventpoll logging to stop indicting timerfd | expand |
Hi Isaac, kernel test robot noticed the following build warnings: [auto build test WARNING on rafael-pm/linux-next] [also build test WARNING on rafael-pm/bleeding-edge linus/master v6.10-rc2 next-20240604] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Isaac-J-Manjarres/fs-Improve-eventpoll-logging-to-stop-indicting-timerfd/20240605-013918 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20240604173606.998721-1-isaacmanjarres%40google.com patch subject: [PATCH v4] fs: Improve eventpoll logging to stop indicting timerfd config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20240605/202406050504.UvdlPAQ0-lkp@intel.com/config) compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240605/202406050504.UvdlPAQ0-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202406050504.UvdlPAQ0-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/base/power/wakeup.c: In function 'wakeup_source_register': >> drivers/base/power/wakeup.c:223:9: warning: function 'wakeup_source_register' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] 223 | vsnprintf(name, sizeof(name), fmt, args); | ^~~~~~~~~ vim +223 drivers/base/power/wakeup.c 208 209 /** 210 * wakeup_source_register - Create wakeup source and add it to the list. 211 * @dev: Device this wakeup source is associated with (or NULL if virtual). 212 * @fmt: format string for the wakeup source name 213 */ 214 struct wakeup_source *wakeup_source_register(struct device *dev, 215 const char *fmt, ...) 216 { 217 struct wakeup_source *ws; 218 int ret; 219 char name[128]; 220 va_list args; 221 222 va_start(args, fmt); > 223 vsnprintf(name, sizeof(name), fmt, args); 224 va_end(args); 225 226 ws = wakeup_source_create(name); 227 if (ws) { 228 if (!dev || device_is_registered(dev)) { 229 ret = wakeup_source_sysfs_add(dev, ws); 230 if (ret) { 231 wakeup_source_free(ws); 232 return NULL; 233 } 234 } 235 wakeup_source_add(ws); 236 } 237 return ws; 238 } 239 EXPORT_SYMBOL_GPL(wakeup_source_register); 240
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 752b417e8129..86276f904be8 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -209,13 +209,19 @@ EXPORT_SYMBOL_GPL(wakeup_source_remove); /** * wakeup_source_register - Create wakeup source and add it to the list. * @dev: Device this wakeup source is associated with (or NULL if virtual). - * @name: Name of the wakeup source to register. + * @fmt: format string for the wakeup source name */ struct wakeup_source *wakeup_source_register(struct device *dev, - const char *name) + const char *fmt, ...) { struct wakeup_source *ws; int ret; + char name[128]; + va_list args; + + va_start(args, fmt); + vsnprintf(name, sizeof(name), fmt, args); + va_end(args); ws = wakeup_source_create(name); if (ws) { diff --git a/fs/eventpoll.c b/fs/eventpoll.c index f53ca4f7fced..941df15208a4 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -338,6 +338,7 @@ static void __init epoll_sysctls_init(void) #define epoll_sysctls_init() do { } while (0) #endif /* CONFIG_SYSCTL */ +static atomic_t wakesource_create_id = ATOMIC_INIT(0); static const struct file_operations eventpoll_fops; static inline int is_file_epoll(struct file *f) @@ -1545,15 +1546,21 @@ static int ep_create_wakeup_source(struct epitem *epi) { struct name_snapshot n; struct wakeup_source *ws; + pid_t task_pid; + int id; + + task_pid = task_pid_nr(current); if (!epi->ep->ws) { - epi->ep->ws = wakeup_source_register(NULL, "eventpoll"); + id = atomic_inc_return(&wakesource_create_id); + epi->ep->ws = wakeup_source_register(NULL, "epoll:%d:%d", id, task_pid); if (!epi->ep->ws) return -ENOMEM; } + id = atomic_inc_return(&wakesource_create_id); take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry); - ws = wakeup_source_register(NULL, n.name.name); + ws = wakeup_source_register(NULL, "epollitem%d:%d.%s", id, task_pid, n.name.name); release_dentry_name_snapshot(&n); if (!ws) diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 76cd1f9f1365..40972ca262cc 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h @@ -100,7 +100,7 @@ extern void wakeup_source_destroy(struct wakeup_source *ws); extern void wakeup_source_add(struct wakeup_source *ws); extern void wakeup_source_remove(struct wakeup_source *ws); extern struct wakeup_source *wakeup_source_register(struct device *dev, - const char *name); + const char *fmt, ...); extern void wakeup_source_unregister(struct wakeup_source *ws); extern int wakeup_sources_read_lock(void); extern void wakeup_sources_read_unlock(int idx); @@ -141,7 +141,7 @@ static inline void wakeup_source_add(struct wakeup_source *ws) {} static inline void wakeup_source_remove(struct wakeup_source *ws) {} static inline struct wakeup_source *wakeup_source_register(struct device *dev, - const char *name) + const char *fmt, ...) { return NULL; }