Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1645671 > unrolled thread
| Started by | Tycho Andersen <tycho@docker.com> |
|---|---|
| First post | 2017-05-19 17:10 +0200 |
| Last post | 2017-05-19 20:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] kconfig: always use user input symbols Tycho Andersen <tycho@docker.com> - 2017-05-19 17:10 +0200
Re: [PATCH] kconfig: always use user input symbols Geert Uytterhoeven <geert@linux-m68k.org> - 2017-05-19 19:30 +0200
Re: [PATCH] kconfig: always use user input symbols Tycho Andersen <tycho@docker.com> - 2017-05-19 20:20 +0200
| From | Tycho Andersen <tycho@docker.com> |
|---|---|
| Date | 2017-05-19 17:10 +0200 |
| Subject | [PATCH] kconfig: always use user input symbols |
| Message-ID | <tIRHr-3XA-13@gated-at.bofh.it> |
...regardless of visibility.
When a symbol that is not visible by default (e.g. PNFS_FLEXFILE_LAYOUT)
has a default value, it is impossible to set the value to something not the
default:
~/packages/linux render-symbol-inputs grep FLEXFILE .config
CONFIG_PNFS_FLEXFILE_LAYOUT=y
~/packages/linux render-symbol-inputs make oldconfig
scripts/kconfig/conf --oldconfig Kconfig
~/packages/linux render-symbol-inputs grep FLEXFILE .config
CONFIG_PNFS_FLEXFILE_LAYOUT=m
There are two reasons for this: the symbol's user input value is only
considered when it is visible (hunks 2 and 3), and the user values are
explicitly ignored (hunk 1) if the symbols are not visible.
It's not clear to me why hunk 1 exists. I'm sure it solve some problem, but
I'm not sure why we would ever want to discard user input values, and
causes a problem exactly as the comment describes.
Signed-off-by: Tycho Andersen <tycho@docker.com>
CC: Roman Zippel <zippel@linux-m68k.org>
---
I don't know much about how kconfig works, I just noticed this when trying
to do some automatic merging of configs. My main goal is to build a kernel
without modules, but after a merge and running `make oldconfig`, some
symbols always come back set as modules.
---
scripts/kconfig/confdata.c | 7 -------
scripts/kconfig/symbol.c | 32 ++++++++++++++++++--------------
2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 297b079..3537090 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -448,13 +448,6 @@ int conf_read(const char *name)
for_all_symbols(i, sym) {
if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
- /* Reset values of generates values, so they'll appear
- * as new, if they should become visible, but that
- * doesn't quite work if the Kconfig and the saved
- * configuration disagree.
- */
- if (sym->visible == no && !conf_unsaved)
- sym->flags &= ~SYMBOL_DEF_USER;
switch (sym->type) {
case S_STRING:
case S_INT:
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 20136ff..27fca39 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -386,17 +386,19 @@ void sym_calc_value(struct symbol *sym)
prop = sym_get_choice_prop(sym);
newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
} else {
- if (sym->visible != no) {
- /* if the symbol is visible use the user value
- * if available, otherwise try the default value
- */
+ /* If the user defined a value, let's not ignore it,
+ * even if the symbol is not visible.
+ */
+ if (sym_has_value(sym)) {
sym->flags |= SYMBOL_WRITE;
- if (sym_has_value(sym)) {
- newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
- sym->visible);
- goto calc_newval;
- }
+ newval.tri = sym->def[S_DEF_USER].tri;
+ goto calc_newval;
}
+
+ if (sym->visible != no)
+ sym->flags |= SYMBOL_WRITE;
+
+ /* otherwise, let's use the default */
if (sym->rev_dep.tri != no)
sym->flags |= SYMBOL_WRITE;
if (!sym_is_choice(sym)) {
@@ -433,13 +435,15 @@ void sym_calc_value(struct symbol *sym)
case S_STRING:
case S_HEX:
case S_INT:
- if (sym->visible != no) {
+ if (sym_has_value(sym)) {
sym->flags |= SYMBOL_WRITE;
- if (sym_has_value(sym)) {
- newval.val = sym->def[S_DEF_USER].val;
- break;
- }
+ newval.val = sym->def[S_DEF_USER].val;
+ goto calc_newval;
}
+
+ if (sym->visible != no)
+ sym->flags |= SYMBOL_WRITE;
+
prop = sym_get_default_prop(sym);
if (prop) {
struct symbol *ds = prop_get_symbol(prop);
--
2.9.3
[toc] | [next] | [standalone]
| From | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| Date | 2017-05-19 19:30 +0200 |
| Message-ID | <tITSW-5kd-1@gated-at.bofh.it> |
| In reply to | #1645671 |
Hi Tycho,
On Fri, May 19, 2017 at 5:08 PM, Tycho Andersen <tycho@docker.com> wrote:
> ...regardless of visibility.
>
> When a symbol that is not visible by default (e.g. PNFS_FLEXFILE_LAYOUT)
> has a default value, it is impossible to set the value to something not the
> default:
>
> ~/packages/linux render-symbol-inputs grep FLEXFILE .config
> CONFIG_PNFS_FLEXFILE_LAYOUT=y
> ~/packages/linux render-symbol-inputs make oldconfig
> scripts/kconfig/conf --oldconfig Kconfig
> ~/packages/linux render-symbol-inputs grep FLEXFILE .config
> CONFIG_PNFS_FLEXFILE_LAYOUT=m
>
> There are two reasons for this: the symbol's user input value is only
> considered when it is visible (hunks 2 and 3), and the user values are
> explicitly ignored (hunk 1) if the symbols are not visible.
>
> It's not clear to me why hunk 1 exists. I'm sure it solve some problem, but
> I'm not sure why we would ever want to discard user input values, and
> causes a problem exactly as the comment describes.
This is intentional. If a symbol is not visible, it's not meant to be changed
by the user, as doing so may break things (at build or runtime).
E.g. running "make oldconfig" after a kernel upgrade may retain the old
state of a variable, which is now invalid. Ignoring invisible symbols
avoids this.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
[toc] | [prev] | [next] | [standalone]
| From | Tycho Andersen <tycho@docker.com> |
|---|---|
| Date | 2017-05-19 20:20 +0200 |
| Message-ID | <tIUFk-5T5-23@gated-at.bofh.it> |
| In reply to | #1645780 |
Hi Geert, On Fri, May 19, 2017 at 07:29:05PM +0200, Geert Uytterhoeven wrote: > Hi Tycho, > > On Fri, May 19, 2017 at 5:08 PM, Tycho Andersen <tycho@docker.com> wrote: > > ...regardless of visibility. > > > > When a symbol that is not visible by default (e.g. PNFS_FLEXFILE_LAYOUT) > > has a default value, it is impossible to set the value to something not the > > default: > > > > ~/packages/linux render-symbol-inputs grep FLEXFILE .config > > CONFIG_PNFS_FLEXFILE_LAYOUT=y > > ~/packages/linux render-symbol-inputs make oldconfig > > scripts/kconfig/conf --oldconfig Kconfig > > ~/packages/linux render-symbol-inputs grep FLEXFILE .config > > CONFIG_PNFS_FLEXFILE_LAYOUT=m > > > > There are two reasons for this: the symbol's user input value is only > > considered when it is visible (hunks 2 and 3), and the user values are > > explicitly ignored (hunk 1) if the symbols are not visible. > > > > It's not clear to me why hunk 1 exists. I'm sure it solve some problem, but > > I'm not sure why we would ever want to discard user input values, and > > causes a problem exactly as the comment describes. > > This is intentional. If a symbol is not visible, it's not meant to be changed > by the user, as doing so may break things (at build or runtime). > > E.g. running "make oldconfig" after a kernel upgrade may retain the old > state of a variable, which is now invalid. Ignoring invisible symbols > avoids this. Makes sense. Thanks! Tycho
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web