From patchwork Wed Jul 29 20:09:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 6896191 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7DC3B9F358 for ; Wed, 29 Jul 2015 20:09:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B69220622 for ; Wed, 29 Jul 2015 20:09:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0EAA0205BC for ; Wed, 29 Jul 2015 20:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753243AbbG2UJY (ORCPT ); Wed, 29 Jul 2015 16:09:24 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:34924 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751309AbbG2UJX (ORCPT ); Wed, 29 Jul 2015 16:09:23 -0400 Received: by pabkd10 with SMTP id kd10so10779743pab.2; Wed, 29 Jul 2015 13:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=3P2VYQ/yRU2oP9Wkt7E3ZKI8dzZEUNgpFN3Mn0iWJhg=; b=sCRVnmSmFIDOvnOAbA2kMGBMOo14rnJvwUq3/7oJ4mrJNflbwVZqPeaw4QdAgytLkU 2MYIKT8O9zb/fab2shupiaO5Vgap5WzQ1K5JmOOMuZljq0yOz1Hs1Ny5nVsQiAcO5rc4 UBFJT5lWKIkLFx598f2UV9iWP999kCm4Ua5c2f8Dsrg5Z8gkIQ3/PpSlkS7ABmmxu61X Z7NxbEQw+l5KGZ6oLLEjk3IlnGemi+tBV0JEf/cGp05/HM+eZJmTvUJmQhfj6n1hca/Z KCbJjAalep5HexGQSNdkvldS+VQ0Qj6FFUt+VWgqk1rlDVM2kZFOBLvEHFio0woSgBpQ DZKg== X-Received: by 10.66.100.162 with SMTP id ez2mr97872927pab.10.1438200562792; Wed, 29 Jul 2015 13:09:22 -0700 (PDT) Received: from mcgrof@gmail.com ([2601:646:200:bc5b:ca60:ff:feda:57a7]) by smtp.gmail.com with ESMTPSA id ti10sm42487630pab.20.2015.07.29.13.09.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 29 Jul 2015 13:09:20 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Wed, 29 Jul 2015 13:09:17 -0700 From: "Luis R. Rodriguez" To: mmarek@suse.com Cc: josh@joshtriplett.org, jbottomley@odin.com, geert@linux-m68k.org, pebolle@tiscali.nl, herbert@gondor.apana.org.au, tiwai@suse.de, yann.morin.1998@free.fr, corbet@lwn.net, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, roberto@dicosmo.org, zack@upsilon.cc, "Luis R. Rodriguez" Subject: [PATCH] kbuild: document recursive dependency limitation / resolution Date: Wed, 29 Jul 2015 13:09:16 -0700 Message-Id: <1438200556-13842-1-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Luis R. Rodriguez" Recursive dependency issues with kconfig are unavoidable due to some limitations with kconfig, since these issues are recurring provide a hint to the user how they can resolve these dependency issues and also document why such limitation exists. Cc: Geert Uytterhoeven Cc: James Bottomley Cc: Josh Triplett Cc: Paul Bolle Cc: Herbert Xu Cc: Takashi Iwai Cc: "Yann E. MORIN" Cc: Michal Marek Cc: Jonathan Corbet Cc: linux-kbuild@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Luis R. Rodriguez --- I've cc'd Roberto and Stefano as I think we might be able to in the long term use some of their work on package dependency and solvers for this problem [0] [1] [2]. This last part -- just consider it long term focused. [0] https://upsilon.cc/~zack/research/publications/splc2010-fd-deps.pdf [1] https://ocaml.org/meetings/ocaml/2014/preferences-2014-09-05-slides.pdf [2] https://www.youtube.com/watch?v=GSOcRQvZg8w Documentation/kbuild/kconfig-language.txt | 22 ++++++++++++++++++++++ scripts/kconfig/symbol.c | 2 ++ 2 files changed, 24 insertions(+) diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index 350f733bf2c7..7e0510d1cef7 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt @@ -393,3 +393,25 @@ config FOO depends on BAR && m limits FOO to module (=m) or disabled (=n). + +Kconfig recursive dependency limitations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you've hit the Kconfig error: "recursive dependency detected" you've run +into a recursive dependency issue with Kconfig. Kconfig does not do recursive +dependency resolution, this has a few implications for Kconfig file writers. In +practice it means that for instance if a driver A selects a few kconfig symbols +another driver B which selects any of these symbols cannot negate any of the +symbols the driver A selected. Because of this current limitation developers +who run into this type of recursive dependency issue have two diverging +options: + + a) Either swap all "select FOO" to "depends on FOO" or, + b) Change the offending "depends on FOO" to "select FOO" + +Kconfig's limitations can be addressed by implementing a SAT solver for it, +but until then, Kconfig is limitted to require developers to use one of +the above two mechanisms to address recursive dependency issues. For more +details you can refer to this thread and discussion: + +http://lkml.kernel.org/r/1432241149-8762-1-git-send-email-mcgrof@do-not-panic.com diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 70c5ee189dce..4d61b7490dad 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -1117,6 +1117,8 @@ static void sym_check_print_recursive(struct symbol *last_sym) if (stack->sym == last_sym) fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", prop->file->name, prop->lineno); + fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n"); + fprintf(stderr, "section \"Kconfig recursive dependency limitations\"\n"); if (stack->expr) { fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", prop->file->name, prop->lineno,