Re: [PATCH 01/10] mm/oom_debug: Add Debug base code

kbuild test robot
2019-08-27T13:29:05Z

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

Hi Edward,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190827]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Edward-Chron/mm-oom_debug-Add-Debug-base-code/20190827-183210
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sh

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

All error/warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from mm/oom_kill_debug.c:135:
>> mm/oom_kill_debug.c:261:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
subsys_initcall(oom_debug_init)
^
include/linux/init.h:197:50: note: in definition of macro '___define_initcall'
__attribute__((__section__(#__sec ".init"))) = fn;
^~
include/linux/init.h:224:30: note: in expansion of macro '__define_initcall'
#define subsys_initcall(fn) __define_initcall(fn, 4)
^~~~~~~~~~~~~~~~~
>> mm/oom_kill_debug.c:261:1: note: in expansion of macro 'subsys_initcall'
subsys_initcall(oom_debug_init)
^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +261 mm/oom_kill_debug.c

> 135 #include <linux/debugfs.h>
136 #include <linux/fs.h>
137 #include <linux/init.h>
138 #include <linux/kernel.h>
139 #include <linux/kobject.h>
140 #include <linux/oom.h>
141 #include <linux/printk.h>
142 #include <linux/slab.h>
143 #include <linux/string.h>
144 #include <linux/sysfs.h>
145 #include "oom_kill_debug.h"
146
147 #define OOMD_MAX_FNAME 48
148 #define OOMD_MAX_OPTNAME 32
149
150 #define K(x) ((x) << (PAGE_SHIFT-10))
151
152 static const char oom_debug_path[] = "/sys/kernel/debug/oom";
153
154 static const char od_root_name[] = "oom";
155 static struct dentry *od_root_dir;
156 static u32 oom_kill_debug_oom_events;
157
158 /* One oom_debug_option entry per debug option */
159 struct oom_debug_option {
160 const char *option_name;
161 umode_t mode;
162 struct dentry *dir_dentry;
163 struct dentry *enabled_dentry;
164 struct dentry *tenthpercent_dentry;
165 bool enabled;
166 u16 tenthpercent;
167 bool support_tpercent;
168 };
169
170 /* Table of oom debug options, new options need to be added here */
171 static struct oom_debug_option oom_debug_options_table[] = {
172 {}
173 };
174
175 /* Option index by name for order one-lookup, add new options entry here */
176 enum oom_debug_options_index {
177 OUT_OF_BOUNDS
178 };
179
180 bool oom_kill_debug_enabled(u16 index)
181 {
182 return oom_debug_options_table[index].enabled;
183 }
184
185 u16 oom_kill_debug_tenthpercent(u16 index)
186 {
187 return oom_debug_options_table[index].tenthpercent;
188 }
189
190 static void filename_gen(char *pdest, const char *optname, const char *fname)
191 {
192 size_t len;
193 char *pmsg;
194
195 sprintf(pdest, "%s", optname);
196 len = strnlen(pdest, OOMD_MAX_OPTNAME);
197 pmsg = pdest + len;
198 sprintf(pmsg, "%s", fname);
199 }
200
201 static void enabled_file_gen(struct oom_debug_option *entry)
202 {
203 char filename[OOMD_MAX_FNAME];
204
205 filename_gen(filename, entry->option_name, "enabled");
206 debugfs_create_bool(filename, 0644, entry->dir_dentry,
207 &entry->enabled);
208 entry->enabled = OOM_KILL_DEBUG_DEFAULT_ENABLED;
209 }
210
211 static void tpercent_file_gen(struct oom_debug_option *entry)
212 {
213 char filename[OOMD_MAX_FNAME];
214
215 filename_gen(filename, entry->option_name, "tenthpercent");
216 debugfs_create_u16(filename, 0644, entry->dir_dentry,
217 &entry->tenthpercent);
218 entry->tenthpercent = OOM_KILL_DEBUG_DEFAULT_TENTHPERCENT;
219 }
220
221 static void oom_debugfs_init(void)
222 {
223 struct oom_debug_option *table, *entry;
224
225 od_root_dir = debugfs_create_dir(od_root_name, NULL);
226
227 table = oom_debug_options_table;
228 for (entry = table; entry->option_name; entry++) {
229 entry->dir_dentry = od_root_dir;
230 enabled_file_gen(entry);
231 if (entry->support_tpercent)
232 tpercent_file_gen(entry);
233 }
234 }
235
236 static void oom_debug_common_cleanup(void)
237 {
238 /* Cleanup for oom root directory */
239 debugfs_remove(od_root_dir);
240 }
241
242 u32 oom_kill_debug_oom_event(void)
243 {
244 return oom_kill_debug_oom_events;
245 }
246
247 u32 oom_kill_debug_oom_event_is(void)
248 {
249 ++oom_kill_debug_oom_events;
250
251 return oom_kill_debug_oom_events;
252 }
253
254 static void __init oom_debug_init(void)
255 {
256 /* Ensure we have a debugfs oom root directory */
257 od_root_dir = debugfs_lookup(od_root_name, NULL);
258 if (!od_root_dir)
259 oom_debugfs_init();
260 }
> 261 subsys_initcall(oom_debug_init)
262

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

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