Skip to content

Commit 89b9060

Browse files
Tetsuo Handamasahir0y
authored andcommitted
kconfig: Add yes2modconfig and mod2yesconfig targets.
Since kernel configs provided by syzbot are close to "make allyesconfig", it takes long time to rebuild. This is especially waste of time when we need to rebuild for many times (e.g. doing manual printk() inspection, bisect operations). We can save time if we can exclude modules which are irrelevant to each problem. But "make localmodconfig" cannot exclude modules which are built into vmlinux because /sbin/lsmod output is used as the source of modules. Therefore, this patch adds "make yes2modconfig" which converts from =y to =m if possible. After confirming that the interested problem is still reproducible, we can try "make localmodconfig" (and/or manually tune based on "Modules linked in:" line) in order to exclude modules which are irrelevant to the interested problem. While we are at it, this patch also adds "make mod2yesconfig" which converts from =m to =y in case someone wants to convert from =m to =y after "make localmodconfig". Signed-off-by: Tetsuo Handa <[email protected]> Cc: Dmitry Vyukov <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent c8138a5 commit 89b9060

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

scripts/kconfig/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ localyesconfig localmodconfig: $(obj)/conf
6767
# deprecated for external use
6868
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
6969
alldefconfig randconfig listnewconfig olddefconfig syncconfig \
70-
helpnewconfig
70+
helpnewconfig yes2modconfig mod2yesconfig
7171

7272
PHONY += $(simple-targets)
7373

@@ -135,6 +135,8 @@ help:
135135
@echo ' allmodconfig - New config selecting modules when possible'
136136
@echo ' alldefconfig - New config with all symbols set to default'
137137
@echo ' randconfig - New config with random answer to all options'
138+
@echo ' yes2modconfig - Change answers from yes to mod if possible'
139+
@echo ' mod2yesconfig - Change answers from mod to yes if possible'
138140
@echo ' listnewconfig - List new options'
139141
@echo ' helpnewconfig - List new options and help text'
140142
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their'

scripts/kconfig/conf.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ enum input_mode {
3434
listnewconfig,
3535
helpnewconfig,
3636
olddefconfig,
37+
yes2modconfig,
38+
mod2yesconfig,
3739
};
3840
static enum input_mode input_mode = oldaskconfig;
3941

@@ -467,6 +469,8 @@ static struct option long_opts[] = {
467469
{"listnewconfig", no_argument, NULL, listnewconfig},
468470
{"helpnewconfig", no_argument, NULL, helpnewconfig},
469471
{"olddefconfig", no_argument, NULL, olddefconfig},
472+
{"yes2modconfig", no_argument, NULL, yes2modconfig},
473+
{"mod2yesconfig", no_argument, NULL, mod2yesconfig},
470474
{NULL, 0, NULL, 0}
471475
};
472476

@@ -489,6 +493,8 @@ static void conf_usage(const char *progname)
489493
printf(" --allmodconfig New config where all options are answered with mod\n");
490494
printf(" --alldefconfig New config with all symbols set to default\n");
491495
printf(" --randconfig New config with random answer to all options\n");
496+
printf(" --yes2modconfig Change answers from yes to mod if possible\n");
497+
printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
492498
}
493499

494500
int main(int ac, char **av)
@@ -553,6 +559,8 @@ int main(int ac, char **av)
553559
case listnewconfig:
554560
case helpnewconfig:
555561
case olddefconfig:
562+
case yes2modconfig:
563+
case mod2yesconfig:
556564
break;
557565
case '?':
558566
conf_usage(progname);
@@ -587,6 +595,8 @@ int main(int ac, char **av)
587595
case listnewconfig:
588596
case helpnewconfig:
589597
case olddefconfig:
598+
case yes2modconfig:
599+
case mod2yesconfig:
590600
conf_read(NULL);
591601
break;
592602
case allnoconfig:
@@ -660,6 +670,12 @@ int main(int ac, char **av)
660670
break;
661671
case savedefconfig:
662672
break;
673+
case yes2modconfig:
674+
conf_rewrite_mod_or_yes(def_y2m);
675+
break;
676+
case mod2yesconfig:
677+
conf_rewrite_mod_or_yes(def_m2y);
678+
break;
663679
case oldaskconfig:
664680
rootEntry = &rootmenu;
665681
conf(&rootmenu);

scripts/kconfig/confdata.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,3 +1362,19 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)
13621362

13631363
return has_changed;
13641364
}
1365+
1366+
void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
1367+
{
1368+
struct symbol *sym;
1369+
int i;
1370+
tristate old_val = (mode == def_y2m) ? yes : mod;
1371+
tristate new_val = (mode == def_y2m) ? mod : yes;
1372+
1373+
for_all_symbols(i, sym) {
1374+
if (sym_get_type(sym) == S_TRISTATE &&
1375+
sym->def[S_DEF_USER].tri == old_val) {
1376+
sym->def[S_DEF_USER].tri = new_val;
1377+
sym_add_change_count(1);
1378+
}
1379+
}
1380+
}

scripts/kconfig/lkc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ enum conf_def_mode {
3434
def_default,
3535
def_yes,
3636
def_mod,
37+
def_y2m,
38+
def_m2y,
3739
def_no,
3840
def_random
3941
};
@@ -52,6 +54,7 @@ const char *conf_get_configname(void);
5254
void sym_set_change_count(int count);
5355
void sym_add_change_count(int count);
5456
bool conf_set_all_new_symbols(enum conf_def_mode mode);
57+
void conf_rewrite_mod_or_yes(enum conf_def_mode mode);
5558
void set_all_choice_values(struct symbol *csym);
5659

5760
/* confdata.c and expr.c */

0 commit comments

Comments
 (0)