Re: [PATCH 06/16] dyndbg: fix a BUG_ON in ddebug_describe_flags

From: kbuild test robot
Date: Mon Dec 02 2019 - 12:37:36 EST


Hi Jim,

I love your patch! Yet something to improve:

[auto build test ERROR on jeyu/modules-next]
[also build test ERROR on v5.4 next-20191202]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Jim-Cromie/dynamic-debug-cleanups-2-new-features/20191128-023731
base: https://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
config: x86_64-rhel-7.6 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-1) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

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

Note: the linux-review/Jim-Cromie/dynamic-debug-cleanups-2-new-features/20191128-023731 HEAD 89f783b27d95e352559b645885086a41e514b5eb builds fine.
It only hurts bisectibility.

All errors (new ones prefixed by >>):

lib/dynamic_debug.c: In function 'ddebug_change':
>> lib/dynamic_debug.c:151:18: error: 'flags' redeclared as different kind of symbol
struct flagsbuf flags;
^~~~~
lib/dynamic_debug.c:145:17: note: previous definition of 'flags' was here
unsigned int flags, unsigned int mask)
^~~~~
>> lib/dynamic_debug.c:194:34: error: invalid operands to binary | (have 'unsigned int' and 'struct flagsbuf')
newflags = (dp->flags & mask) | flags;
~~~~~~~~~~~~~~~~~~ ^
>> lib/dynamic_debug.c:199:17: error: invalid operands to binary & (have 'struct flagsbuf' and 'int')
if (!(flags & _DPRINTK_FLAGS_PRINT))
^
lib/dynamic_debug.c:201:21: error: invalid operands to binary & (have 'struct flagsbuf' and 'int')
} else if (flags & _DPRINTK_FLAGS_PRINT)
^

vim +/flags +151 lib/dynamic_debug.c

137
138 /*
139 * Search the tables for _ddebug's which match the given `query' and
140 * apply the `flags' and `mask' to them. Returns number of matching
141 * callsites, normally the same as number of changes. If verbose,
142 * logs the changes. Takes ddebug_lock.
143 */
144 static int ddebug_change(const struct ddebug_query *query,
145 unsigned int flags, unsigned int mask)
146 {
147 int i;
148 struct ddebug_table *dt;
149 unsigned int newflags;
150 unsigned int nfound = 0;
> 151 struct flagsbuf flags;
152
153 /* search for matching ddebugs */
154 mutex_lock(&ddebug_lock);
155 list_for_each_entry(dt, &ddebug_tables, link) {
156
157 /* match against the module name */
158 if (query->module &&
159 !match_wildcard(query->module, dt->mod_name))
160 continue;
161
162 for (i = 0; i < dt->num_ddebugs; i++) {
163 struct _ddebug *dp = &dt->ddebugs[i];
164
165 /* match against the source filename */
166 if (query->filename &&
167 !match_wildcard(query->filename, dp->filename) &&
168 !match_wildcard(query->filename,
169 kbasename(dp->filename)) &&
170 !match_wildcard(query->filename,
171 trim_prefix(dp->filename)))
172 continue;
173
174 /* match against the function */
175 if (query->function &&
176 !match_wildcard(query->function, dp->function))
177 continue;
178
179 /* match against the format */
180 if (query->format &&
181 !strstr(dp->format, query->format))
182 continue;
183
184 /* match against the line number range */
185 if (query->first_lineno &&
186 dp->lineno < query->first_lineno)
187 continue;
188 if (query->last_lineno &&
189 dp->lineno > query->last_lineno)
190 continue;
191
192 nfound++;
193
> 194 newflags = (dp->flags & mask) | flags;
195 if (newflags == dp->flags)
196 continue;
197 #ifdef CONFIG_JUMP_LABEL
198 if (dp->flags & _DPRINTK_FLAGS_PRINT) {
> 199 if (!(flags & _DPRINTK_FLAGS_PRINT))
200 static_branch_disable(&dp->key.dd_key_true);
201 } else if (flags & _DPRINTK_FLAGS_PRINT)
202 static_branch_enable(&dp->key.dd_key_true);
203 #endif
204 dp->flags = newflags;
205 vpr_info("changed %s:%d [%s]%s =%s\n",
206 trim_prefix(dp->filename), dp->lineno,
207 dt->mod_name, dp->function,
208 ddebug_describe_flags(dp->flags, &flags));
209 }
210 }
211 mutex_unlock(&ddebug_lock);
212
213 if (!nfound && verbose)
214 pr_info("no matches for query\n");
215
216 return nfound;
217 }
218

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

Attachment: .config.gz
Description: application/gzip