Message ID | 20180220150018.mjyjmdmao7xqyukr@huvuddator (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Feb 20, 2018 at 04:00:18PM +0100, Ulf Magnusson wrote: > On Tue, Feb 20, 2018 at 05:24:01PM +0900, Masahiro Yamada wrote: > > 2018-02-20 17:13 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: > > > > > > I do not like this implementation. > > > The code is super ugly, the diff-stat is too much than needed. > > > > > > Please rewrite the code within 20 lines. > > > > > > > For a hint, I cleaned up the code base. > > https://patchwork.kernel.org/patch/10229545/ > > > > which should be equivalent to yours: > > https://patchwork.kernel.org/patch/10226951/ > > > > > > No 'enum print_type', please. > > The reason I prefer them on separate lines consistently is to avoid stuff like the following: > > Selected by [y]: MV_XOR_V2 [=y] && DMADEVICES [=y] && ARM64 [=y] > Selected by [n]: > - AMCC_PPC440SPE_ADMA [=n] && DMADEVICES [=y] && (440SPe || ... > - FSL_RAID [=n] && DMADEVICES [=y] && FSL_SOC && ... > - INTEL_IOATDMA [=n] && DMADEVICES [=y] && PCI [=y] && X86_64 > > That looks confusing and unbalanced to me. I think nobody is disputing this. Masahiro's https://patchwork.kernel.org/patch/10229545/ is also showing every reverse dependency top level OR expression on a new row. > > There are some simple ways to trim down the size of this patchset > though. > > Eugeniu: > What do you think about the following refactoring of your 3/3 patch? > Maybe there's a way to have expr_print_revdep() take just a tristate > too, though it's not worth it if it just grows the code elsewhere. > Well, Masahiro requests not using 'enum print_type' and I still see it in your example. > (By the way, I noticed that expr_print_revdep() previously generated a > warning suggesting parentheses, which was my fault. If you saw that, > don't copy my mistakes. The build should be warning-free. :) I didn't notice any warnings using gcc 5.4.0. > > diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c > index 95dc058a236f..db9a89b9bede 100644 > --- a/scripts/kconfig/expr.c > +++ b/scripts/kconfig/expr.c > @@ -1186,10 +1186,9 @@ expr_print_revdep(struct expr *e, > int prevtoken, > enum print_type type) > { > - if (type == PRINT_REVDEP_ALL || > - type == PRINT_REVDEP_YES && expr_calc_value(e) == yes || > - type == PRINT_REVDEP_MOD && expr_calc_value(e) == mod || > - type == PRINT_REVDEP_NO && expr_calc_value(e) == no) { > + if ((type == PRINT_REVDEP_YES && expr_calc_value(e) == yes) || > + (type == PRINT_REVDEP_MOD && expr_calc_value(e) == mod) || > + (type == PRINT_REVDEP_NO && expr_calc_value(e) == no)) { > fn(data, NULL, "\n - "); > expr_print(e, fn, data, prevtoken); > } > @@ -1212,17 +1211,10 @@ __expr_print(struct expr *e, > switch (e->type) { > case E_SYMBOL: > if (e->left.sym->name) > - switch (type) { > - case PRINT_NORMAL: > + if (type == PRINT_NORMAL) > fn(data, e->left.sym, e->left.sym->name); > - break; > - case PRINT_REVDEP_ALL: > - case PRINT_REVDEP_YES: > - case PRINT_REVDEP_MOD: > - case PRINT_REVDEP_NO: > + else > expr_print_revdep(e, fn, data, E_OR, type); > - break; > - } > else > fn(data, NULL, "<choice>"); > break; > @@ -1271,18 +1263,12 @@ __expr_print(struct expr *e, > __expr_print(e->right.expr, fn, data, E_OR, type); > break; > case E_AND: > - switch (type) { > - case PRINT_NORMAL: > + if (type == PRINT_NORMAL) { > expr_print(e->left.expr, fn, data, E_AND); > fn(data, NULL, " && "); > expr_print(e->right.expr, fn, data, E_AND); > - break; > - case PRINT_REVDEP_ALL: > - case PRINT_REVDEP_YES: > - case PRINT_REVDEP_MOD: > - case PRINT_REVDEP_NO: > + } else { > expr_print_revdep(e, fn, data, E_OR, type); > - break; > } > break; > case E_LIST: > @@ -1370,27 +1356,14 @@ void expr_gstr_print(struct expr *e, struct gstr *gs) > */ > bool expr_revdep_contains(struct expr *e, tristate val) > { > - bool ret = false; > - > if (!e) > - return ret; > + return false; > > - switch (e->type) { > - case E_SYMBOL: > - case E_AND: > - if (expr_calc_value(e) == val) > - ret = true; > - break; > - case E_OR: > - if (expr_revdep_contains(e->left.expr, val)) > - ret = true; > - else if (expr_revdep_contains(e->right.expr, val)) > - ret = true; > - break; > - default: > - break; > - } > - return ret; > + if (e->type == E_OR) > + return expr_revdep_contains(e->left.expr, val) || > + expr_revdep_contains(e->right.expr, val); > + > + return expr_calc_value(e) == val; > } I really like how you've minimized the size of expr_revdep_contains(). Thanks for that. I will try to come up with something in the next days. > > /* > diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h > index d5b096725ca8..e5687b430c17 100644 > --- a/scripts/kconfig/expr.h > +++ b/scripts/kconfig/expr.h > @@ -36,7 +36,6 @@ enum expr_type { > > enum print_type { > PRINT_NORMAL, > - PRINT_REVDEP_ALL, > PRINT_REVDEP_YES, > PRINT_REVDEP_MOD, > PRINT_REVDEP_NO, Best regards, Eugeniu. -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Feb 20, 2018 at 8:52 PM, Eugeniu Rosca <erosca@de.adit-jv.com> wrote: > On Tue, Feb 20, 2018 at 04:00:18PM +0100, Ulf Magnusson wrote: >> On Tue, Feb 20, 2018 at 05:24:01PM +0900, Masahiro Yamada wrote: >> > 2018-02-20 17:13 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: >> > > >> > > I do not like this implementation. >> > > The code is super ugly, the diff-stat is too much than needed. >> > > >> > > Please rewrite the code within 20 lines. >> > > >> > >> > For a hint, I cleaned up the code base. >> > https://patchwork.kernel.org/patch/10229545/ >> > >> > which should be equivalent to yours: >> > https://patchwork.kernel.org/patch/10226951/ >> > >> > >> > No 'enum print_type', please. >> >> The reason I prefer them on separate lines consistently is to avoid stuff like the following: >> >> Selected by [y]: MV_XOR_V2 [=y] && DMADEVICES [=y] && ARM64 [=y] >> Selected by [n]: >> - AMCC_PPC440SPE_ADMA [=n] && DMADEVICES [=y] && (440SPe || ... >> - FSL_RAID [=n] && DMADEVICES [=y] && FSL_SOC && ... >> - INTEL_IOATDMA [=n] && DMADEVICES [=y] && PCI [=y] && X86_64 >> >> That looks confusing and unbalanced to me. > > I think nobody is disputing this. Masahiro's > https://patchwork.kernel.org/patch/10229545/ is also showing every > reverse dependency top level OR expression on a new row. Ohh... sorry, didn't read closely enough. Yeah, I agree that that looks like a nice and neat solution. > >> >> There are some simple ways to trim down the size of this patchset >> though. >> >> Eugeniu: >> What do you think about the following refactoring of your 3/3 patch? >> Maybe there's a way to have expr_print_revdep() take just a tristate >> too, though it's not worth it if it just grows the code elsewhere. >> > > Well, Masahiro requests not using 'enum print_type' and I still see it > in your example. One alternative would be to keep the 'revdep' flag and add an extra tristate parameter for the kinds of selects to print. I'm not a huge fan of having parameters that turn meaningless depending on the values of other parameters, but it might not be terrible there, if we must get rid of 'enum print_type'. I'm always open to other suggestions too. The whole expression printing code feels a bit twisty to me with all the mutual recursion and stuff going on, but that's outside the scope of this patchset. :) > >> (By the way, I noticed that expr_print_revdep() previously generated a >> warning suggesting parentheses, which was my fault. If you saw that, >> don't copy my mistakes. The build should be warning-free. :) > > I didn't notice any warnings using gcc 5.4.0. I'm on 7.2.0, so that's probably why. It was "just" a style warning anyway. :) Cheers, Ulf -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2018-02-21 5:09 GMT+09:00 Ulf Magnusson <ulfalizer@gmail.com>: > On Tue, Feb 20, 2018 at 8:52 PM, Eugeniu Rosca <erosca@de.adit-jv.com> wrote: >> On Tue, Feb 20, 2018 at 04:00:18PM +0100, Ulf Magnusson wrote: >>> On Tue, Feb 20, 2018 at 05:24:01PM +0900, Masahiro Yamada wrote: >>> > 2018-02-20 17:13 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: >>> > > >>> > > I do not like this implementation. >>> > > The code is super ugly, the diff-stat is too much than needed. >>> > > >>> > > Please rewrite the code within 20 lines. >>> > > >>> > >>> > For a hint, I cleaned up the code base. >>> > https://patchwork.kernel.org/patch/10229545/ >>> > >>> > which should be equivalent to yours: >>> > https://patchwork.kernel.org/patch/10226951/ >>> > >>> > >>> > No 'enum print_type', please. >>> >>> The reason I prefer them on separate lines consistently is to avoid stuff like the following: >>> >>> Selected by [y]: MV_XOR_V2 [=y] && DMADEVICES [=y] && ARM64 [=y] >>> Selected by [n]: >>> - AMCC_PPC440SPE_ADMA [=n] && DMADEVICES [=y] && (440SPe || ... >>> - FSL_RAID [=n] && DMADEVICES [=y] && FSL_SOC && ... >>> - INTEL_IOATDMA [=n] && DMADEVICES [=y] && PCI [=y] && X86_64 >>> >>> That looks confusing and unbalanced to me. >> >> I think nobody is disputing this. Masahiro's >> https://patchwork.kernel.org/patch/10229545/ is also showing every >> reverse dependency top level OR expression on a new row. > > Ohh... sorry, didn't read closely enough. > > Yeah, I agree that that looks like a nice and neat solution. > >> >>> >>> There are some simple ways to trim down the size of this patchset >>> though. >>> >>> Eugeniu: >>> What do you think about the following refactoring of your 3/3 patch? >>> Maybe there's a way to have expr_print_revdep() take just a tristate >>> too, though it's not worth it if it just grows the code elsewhere. >>> >> >> Well, Masahiro requests not using 'enum print_type' and I still see it >> in your example. > > One alternative would be to keep the 'revdep' flag and add an extra > tristate parameter for the kinds of selects to print. Using 'enum tristate' is what was in mind, but I do not like to mess up __expr_print() any more. I re-implemented this. https://patchwork.kernel.org/patch/10231295/ > I'm not a huge fan of having parameters that turn meaningless > depending on the values of other parameters, but it might not be > terrible there, if we must get rid of 'enum print_type'. I'm always > open to other suggestions too. > > The whole expression printing code feels a bit twisty to me with all > the mutual recursion and stuff going on, but that's outside the scope > of this patchset. :) > >> >>> (By the way, I noticed that expr_print_revdep() previously generated a >>> warning suggesting parentheses, which was my fault. If you saw that, >>> don't copy my mistakes. The build should be warning-free. :) >> >> I didn't notice any warnings using gcc 5.4.0. > > I'm on 7.2.0, so that's probably why. It was "just" a style warning anyway. :) > > Cheers, > Ulf > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Feb 21, 2018 at 02:48:45PM +0900, Masahiro Yamada wrote: > 2018-02-21 5:09 GMT+09:00 Ulf Magnusson <ulfalizer@gmail.com>: > > On Tue, Feb 20, 2018 at 8:52 PM, Eugeniu Rosca <erosca@de.adit-jv.com> wrote: > >> On Tue, Feb 20, 2018 at 04:00:18PM +0100, Ulf Magnusson wrote: > >>> On Tue, Feb 20, 2018 at 05:24:01PM +0900, Masahiro Yamada wrote: > >>> > 2018-02-20 17:13 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: > >>> > > > >>> > > I do not like this implementation. > >>> > > The code is super ugly, the diff-stat is too much than needed. > >>> > > > >>> > > Please rewrite the code within 20 lines. > >>> > > > >>> > > >>> > For a hint, I cleaned up the code base. > >>> > https://patchwork.kernel.org/patch/10229545/ > >>> > > >>> > which should be equivalent to yours: > >>> > https://patchwork.kernel.org/patch/10226951/ > >>> > > >>> > > >>> > No 'enum print_type', please. > >>> > >>> The reason I prefer them on separate lines consistently is to avoid stuff like the following: > >>> > >>> Selected by [y]: MV_XOR_V2 [=y] && DMADEVICES [=y] && ARM64 [=y] > >>> Selected by [n]: > >>> - AMCC_PPC440SPE_ADMA [=n] && DMADEVICES [=y] && (440SPe || ... > >>> - FSL_RAID [=n] && DMADEVICES [=y] && FSL_SOC && ... > >>> - INTEL_IOATDMA [=n] && DMADEVICES [=y] && PCI [=y] && X86_64 > >>> > >>> That looks confusing and unbalanced to me. > >> > >> I think nobody is disputing this. Masahiro's > >> https://patchwork.kernel.org/patch/10229545/ is also showing every > >> reverse dependency top level OR expression on a new row. > > > > Ohh... sorry, didn't read closely enough. > > > > Yeah, I agree that that looks like a nice and neat solution. > > > >> > >>> > >>> There are some simple ways to trim down the size of this patchset > >>> though. > >>> > >>> Eugeniu: > >>> What do you think about the following refactoring of your 3/3 patch? > >>> Maybe there's a way to have expr_print_revdep() take just a tristate > >>> too, though it's not worth it if it just grows the code elsewhere. > >>> > >> > >> Well, Masahiro requests not using 'enum print_type' and I still see it > >> in your example. > > > > One alternative would be to keep the 'revdep' flag and add an extra > > tristate parameter for the kinds of selects to print. > > Using 'enum tristate' is what was in mind, > but I do not like to mess up __expr_print() any more. > > I re-implemented this. > https://patchwork.kernel.org/patch/10231295/ > I've tested https://patchwork.kernel.org/patch/10229545/ and https://patchwork.kernel.org/patch/10231295/ and they work great for me. Thank you for this feature. > > > > > I'm not a huge fan of having parameters that turn meaningless > > depending on the values of other parameters, but it might not be > > terrible there, if we must get rid of 'enum print_type'. I'm always > > open to other suggestions too. > > > > The whole expression printing code feels a bit twisty to me with all > > the mutual recursion and stuff going on, but that's outside the scope > > of this patchset. :) > > > >> > >>> (By the way, I noticed that expr_print_revdep() previously generated a > >>> warning suggesting parentheses, which was my fault. If you saw that, > >>> don't copy my mistakes. The build should be warning-free. :) > >> > >> I didn't notice any warnings using gcc 5.4.0. > > > > I'm on 7.2.0, so that's probably why. It was "just" a style warning anyway. :) > > > > Cheers, > > Ulf > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > -- > Best Regards > Masahiro Yamada Best regards, Eugeniu. -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Eugeniu, 2018-02-21 15:10 GMT+09:00 Eugeniu Rosca <roscaeugeniu@gmail.com>: > > I've tested https://patchwork.kernel.org/patch/10229545/ and > https://patchwork.kernel.org/patch/10231295/ and they work great for me. > Thank you for this feature. > I will give you that code in the second one. Please fill the commit log with yours, and also fix the bugs pointed by Petr. Anyway, I will claim my contribution in the form of Signed-off-by when I pick it up. :)
Hi Masahiro, On Fri, Feb 23, 2018 at 09:10:37PM +0900, Masahiro Yamada wrote: > Eugeniu, > > > 2018-02-21 15:10 GMT+09:00 Eugeniu Rosca <roscaeugeniu@gmail.com>: > > > > > I've tested https://patchwork.kernel.org/patch/10229545/ and > > https://patchwork.kernel.org/patch/10231295/ and they work great for me. > > Thank you for this feature. > > > > I will give you that code in the second one. I appreciate that, although I am open minded who takes the authorship. This feature makes my life easier and that's the most important part. > > Please fill the commit log with yours, > and also fix the bugs pointed by Petr. Sure. Will do that. > Anyway, I will claim my contribution > in the form of Signed-off-by when I pick it up. :) I have one side question loosely related to this patch. Reverse dependencies are still not printed in zconfdump() (used in our kernel team for e.g. cross platform .config alignment/comparison). My gut feeling tells me this is mainly caused by the extremely unfriendly unreadable expressions which is how reverse dependencies used to be represented before commit 1ccb27143360 ("kconfig: make "Selected by:" and "Implied by:" readable"). Since this is now greatly improved, would you mind printing Selected/Implied-by in zconfdump? There are also other zconfdump fixes sitting in my local branch, like https://patchwork.kernel.org/patch/9253535/ . I would like to push them to you (they probably deserve a separate thread), if you think this is appropriate. Best regards, Eugeniu. -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Feb 23, 2018 at 3:04 PM, Eugeniu Rosca <erosca@de.adit-jv.com> wrote: > > Hi Masahiro, > > On Fri, Feb 23, 2018 at 09:10:37PM +0900, Masahiro Yamada wrote: >> Eugeniu, >> >> >> 2018-02-21 15:10 GMT+09:00 Eugeniu Rosca <roscaeugeniu@gmail.com>: >> >> > >> > I've tested https://patchwork.kernel.org/patch/10229545/ and >> > https://patchwork.kernel.org/patch/10231295/ and they work great for me. >> > Thank you for this feature. >> > >> >> I will give you that code in the second one. > > I appreciate that, although I am open minded who takes the authorship. > This feature makes my life easier and that's the most important part. > >> >> Please fill the commit log with yours, >> and also fix the bugs pointed by Petr. > > Sure. Will do that. > >> Anyway, I will claim my contribution >> in the form of Signed-off-by when I pick it up. :) > > I have one side question loosely related to this patch. > > Reverse dependencies are still not printed in zconfdump() (used in our kernel > team for e.g. cross platform .config alignment/comparison). My gut feeling > tells me this is mainly caused by the extremely unfriendly unreadable > expressions which is how reverse dependencies used to be represented before > commit 1ccb27143360 ("kconfig: make "Selected by:" and "Implied by:" > readable"). Since this is now greatly improved, would you mind printing > Selected/Implied-by in zconfdump? There are also other zconfdump fixes > sitting in my local branch, like https://patchwork.kernel.org/patch/9253535/ . > I would like to push them to you (they probably deserve a separate > thread), if you think this is appropriate. > > Best regards, > Eugeniu. Shameless plug: If you need to do any fancy Kconfig parsing and comparison, then Kconfiglib (https://github.com/ulfalizer/Kconfiglib) might be handy. It makes it easy to walk the menu tree, print and inspect symbols and expressions, etc. Cheers, Ulf -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Ulf, On Fri, Feb 23, 2018 at 11:18:17PM +0100, Ulf Magnusson wrote: > On Fri, Feb 23, 2018 at 3:04 PM, Eugeniu Rosca <erosca@de.adit-jv.com> wrote: > > > > Hi Masahiro, > > > > On Fri, Feb 23, 2018 at 09:10:37PM +0900, Masahiro Yamada wrote: > >> Eugeniu, > >> > >> > >> 2018-02-21 15:10 GMT+09:00 Eugeniu Rosca <roscaeugeniu@gmail.com>: > >> > >> > > >> > I've tested https://patchwork.kernel.org/patch/10229545/ and > >> > https://patchwork.kernel.org/patch/10231295/ and they work great for me. > >> > Thank you for this feature. > >> > > >> > >> I will give you that code in the second one. > > > > I appreciate that, although I am open minded who takes the authorship. > > This feature makes my life easier and that's the most important part. > > > >> > >> Please fill the commit log with yours, > >> and also fix the bugs pointed by Petr. > > > > Sure. Will do that. > > > >> Anyway, I will claim my contribution > >> in the form of Signed-off-by when I pick it up. :) > > > > I have one side question loosely related to this patch. > > > > Reverse dependencies are still not printed in zconfdump() (used in our kernel > > team for e.g. cross platform .config alignment/comparison). My gut feeling > > tells me this is mainly caused by the extremely unfriendly unreadable > > expressions which is how reverse dependencies used to be represented before > > commit 1ccb27143360 ("kconfig: make "Selected by:" and "Implied by:" > > readable"). Since this is now greatly improved, would you mind printing > > Selected/Implied-by in zconfdump? There are also other zconfdump fixes > > sitting in my local branch, like https://patchwork.kernel.org/patch/9253535/ . > > I would like to push them to you (they probably deserve a separate > > thread), if you think this is appropriate. > > > > Best regards, > > Eugeniu. > > Shameless plug: > > If you need to do any fancy Kconfig parsing and comparison, then > Kconfiglib (https://github.com/ulfalizer/Kconfiglib) might be handy. > It makes it easy to walk the menu tree, print and inspect symbols and > expressions, etc. Currently, when comparing kernel configurations of two platforms P1 and P2, our zconfdump parser generates reports like below. It helps us quite much during .config alignment. The report can be isolated to a specific menu entry (in this case, it is "General setup"). In this particular case, P1 is imx6 using v3.14 kernel and P2 is rcar3 using a v4.x kernel. If Kconfiglib is able to generate a similar diff report, I will happily embrace it. If not, we might have no choice but keep using zconfdump for a while. Unfortunately, I haven't found some time to put my hands on Kconfiglib yet and I don't know what it is (or would be) capable of. Bottomline, the motivation to fix and enrich vanilla zconfdump functionality originates from making such reports possible on our side. Boolean - - String Tristate - \ / - Hex config - \ || / - Integer menuconfig - \ |||| / \| ||||| Config Name Val MC TBSHI Cfg.Origin Comments P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 HAVE_KERNEL_GZIP y - C C B B sel-by - 01 - HAVE_KERNEL_LZMA y - C C B B sel-by - 02 - HAVE_KERNEL_XZ y - C C B B sel-by - 03 - HAVE_KERNEL_LZO y - C C B B sel-by - 04 - HAVE_KERNEL_LZ4 y - C C B B sel-by - 05 - HAVE_KERNEL_LZ77 y - C - B - sel-by - 06 - KERNEL_LZO y - C C B B defconfig - - - KTIME_SCALAR y - C - B - sel-by - 07 - GENERIC_CLOCKEVENTS_BUILD y - C - B - default - 08 - IKCONFIG m y C C T T defconfig defconfig - - MM_OWNER y - C - B - sel-by - 09 - PERF_USE_VMALLOC y - C C B B sel-by - 10 - HAVE_OPROFILE y - C C B B sel-by - 11 - UPROBES y n C C B B sel-by default 12 13 ARCH_USE_BUILTIN_BSWAP y - C C B B sel-by - 14 - HAVE_DMA_ATTRS y - C - B - sel-by - 15 - ARCH_WANT_IPC_PARSE_VERSION y - C C B B sel-by - 16 - MODULES_USE_ELF_REL y - C C B B sel-by - 17 - OLD_SIGACTION y - C C B B sel-by - 18 - TREE_PREEMPT_RCU y - C - B - sel-by-ch - 19 - RCU_FANOUT 32 64 C C I I default default 20 21 RESOURCE_COUNTERS y - C - B - defconfig - - - Comments: 01) selected by (ARM [=y]) 02) selected by (ARM [=y]) 03) selected by (ARM [=y]) 04) selected by (ARM [=y]) 05) selected by (ARM [=y]) 06) selected by (ARM [=y]) 07) selected by (ARM [=y]) 08) default y if GENERIC_CLOCKEVENTS [=y] 09) selected by (MEMCG [=y] && CGROUPS [=y] && RESOURCE_COUNTERS [=y]) 10) selected by (ARM [=y]) 11) selected by (ARM [=y] && HAVE_PERF_EVENTS [=y]) 12) selected by (UPROBE_EVENT [=y] && TRACING_SUPPORT [=y] && FTRACE [=y] && ARCH_SUPPORTS_UPROBES [=y] && MMU [=y] && PERF_EVENTS [=y]) 13) default n 14) selected by (ARM [=y]) 15) selected by (ARM [=y]) 16) selected by (ARM [=y]) 17) selected by (ARM [=y]) 18) selected by (ARM [=y]) 19) selected by choice "RCU Implementation" 20) default 32 if ((TREE_RCU || TREE_PREEMPT_RCU) && !64BIT) [=y] 21) default 64 if ((TREE_RCU || PREEMPT_RCU) && RCU_EXPERT && 64BIT) [=y] > Cheers, > Ulf Best regards, Eugeniu. -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, Feb 24, 2018 at 1:13 AM, Eugeniu Rosca <roscaeugeniu@gmail.com> wrote: > Hi Ulf, > > On Fri, Feb 23, 2018 at 11:18:17PM +0100, Ulf Magnusson wrote: >> On Fri, Feb 23, 2018 at 3:04 PM, Eugeniu Rosca <erosca@de.adit-jv.com> wrote: >> > >> > Hi Masahiro, >> > >> > On Fri, Feb 23, 2018 at 09:10:37PM +0900, Masahiro Yamada wrote: >> >> Eugeniu, >> >> >> >> >> >> 2018-02-21 15:10 GMT+09:00 Eugeniu Rosca <roscaeugeniu@gmail.com>: >> >> >> >> > >> >> > I've tested https://patchwork.kernel.org/patch/10229545/ and >> >> > https://patchwork.kernel.org/patch/10231295/ and they work great for me. >> >> > Thank you for this feature. >> >> > >> >> >> >> I will give you that code in the second one. >> > >> > I appreciate that, although I am open minded who takes the authorship. >> > This feature makes my life easier and that's the most important part. >> > >> >> >> >> Please fill the commit log with yours, >> >> and also fix the bugs pointed by Petr. >> > >> > Sure. Will do that. >> > >> >> Anyway, I will claim my contribution >> >> in the form of Signed-off-by when I pick it up. :) >> > >> > I have one side question loosely related to this patch. >> > >> > Reverse dependencies are still not printed in zconfdump() (used in our kernel >> > team for e.g. cross platform .config alignment/comparison). My gut feeling >> > tells me this is mainly caused by the extremely unfriendly unreadable >> > expressions which is how reverse dependencies used to be represented before >> > commit 1ccb27143360 ("kconfig: make "Selected by:" and "Implied by:" >> > readable"). Since this is now greatly improved, would you mind printing >> > Selected/Implied-by in zconfdump? There are also other zconfdump fixes >> > sitting in my local branch, like https://patchwork.kernel.org/patch/9253535/ . >> > I would like to push them to you (they probably deserve a separate >> > thread), if you think this is appropriate. >> > >> > Best regards, >> > Eugeniu. >> >> Shameless plug: >> >> If you need to do any fancy Kconfig parsing and comparison, then >> Kconfiglib (https://github.com/ulfalizer/Kconfiglib) might be handy. >> It makes it easy to walk the menu tree, print and inspect symbols and >> expressions, etc. > > Currently, when comparing kernel configurations of two platforms P1 and > P2, our zconfdump parser generates reports like below. It helps us quite > much during .config alignment. The report can be isolated to a specific menu > entry (in this case, it is "General setup"). In this particular case, P1 is > imx6 using v3.14 kernel and P2 is rcar3 using a v4.x kernel. If Kconfiglib > is able to generate a similar diff report, I will happily embrace it. > If not, we might have no choice but keep using zconfdump for a while. > > Unfortunately, I haven't found some time to put my hands on Kconfiglib > yet and I don't know what it is (or would be) capable of. Bottomline, > the motivation to fix and enrich vanilla zconfdump functionality > originates from making such reports possible on our side. > > Boolean - - String > Tristate - \ / - Hex > config - \ || / - Integer > menuconfig - \ |||| / > \| ||||| > Config Name Val MC TBSHI Cfg.Origin Comments > P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 > HAVE_KERNEL_GZIP y - C C B B sel-by - 01 - > HAVE_KERNEL_LZMA y - C C B B sel-by - 02 - > HAVE_KERNEL_XZ y - C C B B sel-by - 03 - > HAVE_KERNEL_LZO y - C C B B sel-by - 04 - > HAVE_KERNEL_LZ4 y - C C B B sel-by - 05 - > HAVE_KERNEL_LZ77 y - C - B - sel-by - 06 - > KERNEL_LZO y - C C B B defconfig - - - > KTIME_SCALAR y - C - B - sel-by - 07 - > GENERIC_CLOCKEVENTS_BUILD y - C - B - default - 08 - > IKCONFIG m y C C T T defconfig defconfig - - > MM_OWNER y - C - B - sel-by - 09 - > PERF_USE_VMALLOC y - C C B B sel-by - 10 - > HAVE_OPROFILE y - C C B B sel-by - 11 - > UPROBES y n C C B B sel-by default 12 13 > ARCH_USE_BUILTIN_BSWAP y - C C B B sel-by - 14 - > HAVE_DMA_ATTRS y - C - B - sel-by - 15 - > ARCH_WANT_IPC_PARSE_VERSION y - C C B B sel-by - 16 - > MODULES_USE_ELF_REL y - C C B B sel-by - 17 - > OLD_SIGACTION y - C C B B sel-by - 18 - > TREE_PREEMPT_RCU y - C - B - sel-by-ch - 19 - > RCU_FANOUT 32 64 C C I I default default 20 21 > RESOURCE_COUNTERS y - C - B - defconfig - - - > > Comments: > 01) selected by (ARM [=y]) > 02) selected by (ARM [=y]) > 03) selected by (ARM [=y]) > 04) selected by (ARM [=y]) > 05) selected by (ARM [=y]) > 06) selected by (ARM [=y]) > 07) selected by (ARM [=y]) > 08) default y if GENERIC_CLOCKEVENTS [=y] > 09) selected by (MEMCG [=y] && CGROUPS [=y] && RESOURCE_COUNTERS [=y]) > 10) selected by (ARM [=y]) > 11) selected by (ARM [=y] && HAVE_PERF_EVENTS [=y]) > 12) selected by (UPROBE_EVENT [=y] && TRACING_SUPPORT [=y] && FTRACE [=y] && > ARCH_SUPPORTS_UPROBES [=y] && MMU [=y] && PERF_EVENTS [=y]) > 13) default n > 14) selected by (ARM [=y]) > 15) selected by (ARM [=y]) > 16) selected by (ARM [=y]) > 17) selected by (ARM [=y]) > 18) selected by (ARM [=y]) > 19) selected by choice "RCU Implementation" > 20) default 32 if ((TREE_RCU || TREE_PREEMPT_RCU) && !64BIT) [=y] > 21) default 64 if ((TREE_RCU || PREEMPT_RCU) && RCU_EXPERT && 64BIT) [=y] Think it would be a good fit for that. There's a load_config() function for loading a .config, and after that you can inspect symbol values, properties, expressions, etc. The menu tree is exposed directly too, so you could look for a menu with a particular name and limit yourself to that. See e.g. https://github.com/ulfalizer/Kconfiglib/blob/master/examples/print_tree.py for how to walk the menu tree. Kconfiglib is kinda like an "open-internals" version of the C tools if you will, and pretty flexible. I'm starting to feel a bit dirty, so I guess we could move it to private mail or an issue on the GitHub page or something if you give it a try and have any questions. Think it would work well at least. :) Cheers, Ulf -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 95dc058a236f..db9a89b9bede 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -1186,10 +1186,9 @@ expr_print_revdep(struct expr *e, int prevtoken, enum print_type type) { - if (type == PRINT_REVDEP_ALL || - type == PRINT_REVDEP_YES && expr_calc_value(e) == yes || - type == PRINT_REVDEP_MOD && expr_calc_value(e) == mod || - type == PRINT_REVDEP_NO && expr_calc_value(e) == no) { + if ((type == PRINT_REVDEP_YES && expr_calc_value(e) == yes) || + (type == PRINT_REVDEP_MOD && expr_calc_value(e) == mod) || + (type == PRINT_REVDEP_NO && expr_calc_value(e) == no)) { fn(data, NULL, "\n - "); expr_print(e, fn, data, prevtoken); } @@ -1212,17 +1211,10 @@ __expr_print(struct expr *e, switch (e->type) { case E_SYMBOL: if (e->left.sym->name) - switch (type) { - case PRINT_NORMAL: + if (type == PRINT_NORMAL) fn(data, e->left.sym, e->left.sym->name); - break; - case PRINT_REVDEP_ALL: - case PRINT_REVDEP_YES: - case PRINT_REVDEP_MOD: - case PRINT_REVDEP_NO: + else expr_print_revdep(e, fn, data, E_OR, type); - break; - } else fn(data, NULL, "<choice>"); break; @@ -1271,18 +1263,12 @@ __expr_print(struct expr *e, __expr_print(e->right.expr, fn, data, E_OR, type); break; case E_AND: - switch (type) { - case PRINT_NORMAL: + if (type == PRINT_NORMAL) { expr_print(e->left.expr, fn, data, E_AND); fn(data, NULL, " && "); expr_print(e->right.expr, fn, data, E_AND); - break; - case PRINT_REVDEP_ALL: - case PRINT_REVDEP_YES: - case PRINT_REVDEP_MOD: - case PRINT_REVDEP_NO: + } else { expr_print_revdep(e, fn, data, E_OR, type); - break; } break; case E_LIST: @@ -1370,27 +1356,14 @@ void expr_gstr_print(struct expr *e, struct gstr *gs) */ bool expr_revdep_contains(struct expr *e, tristate val) { - bool ret = false; - if (!e) - return ret; + return false; - switch (e->type) { - case E_SYMBOL: - case E_AND: - if (expr_calc_value(e) == val) - ret = true; - break; - case E_OR: - if (expr_revdep_contains(e->left.expr, val)) - ret = true; - else if (expr_revdep_contains(e->right.expr, val)) - ret = true; - break; - default: - break; - } - return ret; + if (e->type == E_OR) + return expr_revdep_contains(e->left.expr, val) || + expr_revdep_contains(e->right.expr, val); + + return expr_calc_value(e) == val; } /* diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index d5b096725ca8..e5687b430c17 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -36,7 +36,6 @@ enum expr_type { enum print_type { PRINT_NORMAL, - PRINT_REVDEP_ALL, PRINT_REVDEP_YES, PRINT_REVDEP_MOD, PRINT_REVDEP_NO,