From patchwork Sat Dec 8 23:12:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Magnusson X-Patchwork-Id: 1853211 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9F5E1DF223 for ; Sat, 8 Dec 2012 23:12:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756153Ab2LHXM4 (ORCPT ); Sat, 8 Dec 2012 18:12:56 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:61636 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508Ab2LHXMz (ORCPT ); Sat, 8 Dec 2012 18:12:55 -0500 Received: by mail-we0-f174.google.com with SMTP id x10so692038wey.19 for ; Sat, 08 Dec 2012 15:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=TVVLEM/2yPnJZ4aacF7o9V3sfoosO2ZLh/mD5DAQOns=; b=Dj9hsW3TCgwXWJlTGFo3KgVBZFvTLLV37WQ2+nuHfZIDmMM6IHHK4cbRRGpQQtP4ap SjPRnn81E4BhX7A2YT1psfI6Fo2PLy1rUPdGR4MD5cPOzR26A95W/M7HvipHxFndTARM p0Rv7llRJLCohXriUatZGH+BvhDTFNMAb7fjJzrTSopzX/GcypORnAmHMWM/q8eylQ12 l2/Up6UbfyIrD2/6aMBNq7ZwDgosu9yLYwID5LCK9P4uYRxP1n3PCeKVQHs5YmTEJysN 9ZDSfdk7eeXRlujciICs1xqnRausDisJXnCIxAHxRH5hnh07FEypCPFWi1zRRIpJCfpP upKg== MIME-Version: 1.0 Received: by 10.216.89.3 with SMTP id b3mr659535wef.159.1355008374196; Sat, 08 Dec 2012 15:12:54 -0800 (PST) Received: by 10.217.1.80 with HTTP; Sat, 8 Dec 2012 15:12:54 -0800 (PST) In-Reply-To: References: Date: Sun, 9 Dec 2012 00:12:54 +0100 Message-ID: Subject: Re: kbuild: Invalid configuration generated for dependent choices by 'conf' but not by 'mconf', with reason From: Ulf Magnusson To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org On Thu, Dec 6, 2012 at 1:07 AM, Ulf Magnusson wrote: > Hi, > > Consider the following Kconfig file: > > config MODULES > def_bool y > > choice > tristate "C1" > config A > tristate "A" > config B > tristate "B" > endchoice > > choice > bool "C2" if A > config C > bool "C" > config D > bool "D" > endchoice > > When this Kconfig file is used with a configuration file containing > just "CONFIG_A=y", conf generates the following invalid configuration: > > CONFIG_MODULES=y > CONFIG_A=m > # CONFIG_B is not set > CONFIG_C=y > # CONFIG_D is not set > > mconf on the other hand generates the correct configuration: > > CONFIG_MODULES=y > CONFIG_A=y > # CONFIG_B is not set > CONFIG_C=y > # CONFIG_D is not set > > To see this, compare the .config files generated by the following commands: > > $ scripts/kconfig/conf --defconfig=bug_config bug_Kconfig > > $ cp bug_config .config > $ scripts/kconfig/mconf bug_Kconfig > > The root cause of the problem is the sym_calc_value(csym) call at the > end of conf_set_all_new_symbols(). Since the second 'choice' depends > on A, that call causes the value of A to be calculated. But this also > causes SYMBOL_VALID to be set on A, preventing it from being > reevaluated later when the configuration is written in conf_write(). > This reevaluation is required to get the correct value since only by > then will the choice have SYMBOL_DEF_USER set on it (set in > set_all_choice_values()). > > Some possible fixes: > (1) Add another sym_clear_all_valid() call at the end of > conf_set_all_new_symbols(). This is kinda wasteful. > (2) Just randomize_choice_values() seems to actually need the > sym_calc_value(csym). It could probably be moved into that function, > perhaps doing the additional sym_clear_all_valid() there unless > there's something neater you could do. > > It would probably be safer if someone more familiar with the > randomization stuff wrote the actual patch. > > Linux version is 3.7.0-rc4, though this bug has likely been around a while. > > /Ulf This bug causes an incorrect configuration to be generated for Blackfin with the following defconfigs by the way: CM-BF537U_defconfig BF548-EZKIT_defconfig BF527-EZKIT_defconfig BF527-EZKIT-V2_defconfig TCM-BF537_defconfig For example: $ make ARCH=blackfin CM-BF537U_defconfig $ cp .config ._config $ cp arch/blackfin/configs/CM-BF537U_defconfig .config $ make ARCH=blackfin menuconfig *save and exit* $ diff -u .config ._config The defconfig itself contains "CONFIG_USB_ETH=y", which 'conf' incorrectly truncates. I noticed the bug because it causes the only test suite failures in Kconfiglib (https://github.com/ulfalizer/Kconfiglib) with Linus' latest kernel, in the tests that compare output between Kconfiglib and the scripts/kconfig/*conf utilities. (I'm in the process of updating Kconfiglib. I have no intention to get it into the kernel - just a handy tool.) /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 --- .config 2012-12-08 08:46:07.598588422 +0100 +++ ._config 2012-12-08 08:44:03.566584623 +0100 @@ -997,9 +997,9 @@ # CONFIG_USB_MV_UDC is not set # CONFIG_USB_M66592 is not set # CONFIG_USB_NET2272 is not set -CONFIG_USB_LIBCOMPOSITE=y +CONFIG_USB_LIBCOMPOSITE=m # CONFIG_USB_ZERO is not set -CONFIG_USB_ETH=y +CONFIG_USB_ETH=m CONFIG_USB_ETH_RNDIS=y # CONFIG_USB_ETH_EEM is not set # CONFIG_USB_G_NCM is not set