Received: by 10.223.185.111 with SMTP id b44csp890701wrg; Fri, 9 Mar 2018 16:08:52 -0800 (PST) X-Google-Smtp-Source: AG47ELtzDl8zeBsPTc9AgvOZYuGbKhLOsJyJPHTKNlCAL0cZRTnnK1z2A5S/6Do1Pbzluf5YLl5v X-Received: by 10.99.109.198 with SMTP id i189mr250157pgc.328.1520640532732; Fri, 09 Mar 2018 16:08:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520640532; cv=none; d=google.com; s=arc-20160816; b=sx1CpNns0zYSwxQWNysKQ2L1A8KqMqKzV4ZP1S54yi8LCOcigbvjB51ev5xItQx2VG BC2uId+RjRsO1PIgh6tENnnrscriDaJFFe0AWOdPg6+UrxHuy+GuaX00sCC2db5LWdHE iJNrfwNicO8MqjFwJA19mJ2cSpUWLMuVwLK6tj4wUwEk8H7beQSh3iasU8Auz/HMxXh+ KO5/QX87eR9BO85UDQEOvWU8LW6fBObiN5p+yl7w3aHchiPblM8KqLz3FMT+xJxc6bIK 5A8VOcVVDY1kHX2eKy1MOGJLrCSTfvMfsF2lx9mG9bHnOg38W9Ng8RsP/Da9wdn/cujK AYTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature:arc-authentication-results; bh=eyxJaH1PHlwYlUgGf83JVXBiUHcCGPN/7wi0jEpOAp0=; b=DU6jBfpgKbjNnmDsHk5FESyugsJ3HIy9R4NGefFe9KItTDn1fEJMa0onb93xMvdOVb WTHMlHycWImARctX07UnVwHcS5u3mCnMssIX3iFOhOMm5iHyUKBC5OhJB9s+u1ABs+5X clP4ILrGll6fDAqtxMRGXEAOmlhz8dOrLeq00oSM+TGbdkRzpJgaUxgo8hsDuGON0N2q jAQe1JltqTfgDo3lNGEB5/jRTzNCBFFqm3buFveBLpHDQyP59UQDwksumtZUaeqw1BLJ IlhLrivCe2LfOlBfYePtVHlyaeBVbigQPmvw8nyBXXCeETXzLVd3FgY9zDqG1vo6L9ly vJwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ar/EqL+z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12-v6si1783594plr.308.2018.03.09.16.08.37; Fri, 09 Mar 2018 16:08:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ar/EqL+z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932781AbeCJAHe (ORCPT + 99 others); Fri, 9 Mar 2018 19:07:34 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38090 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751325AbeCJAHc (ORCPT ); Fri, 9 Mar 2018 19:07:32 -0500 Received: by mail-wm0-f68.google.com with SMTP id z9so6669718wmb.3; Fri, 09 Mar 2018 16:07:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eyxJaH1PHlwYlUgGf83JVXBiUHcCGPN/7wi0jEpOAp0=; b=Ar/EqL+zzPDy/O7/eY2WwFANdnm5oyY0PJT8GtUQ1Ro5ywaGdppKiWFkVyLIMmBqT3 RTdusCWgadqBAvu4HAcQxIcBklS8ScvfzfOfmh5+m77gU09VidNrvLsSsQHbTh2djvIt 8mw9hr4wfsP82yCHkhxPN8PI2UuNjSeFUTgf3vkcZE0mPa3iRhLPcfDyjxO8z2mNIPbY /AgVtwY4LSLMHdsqsdw2K2JhYV61WmtXEaAE/PqyvGEZT56HP7U95ZxDBb9sF9nnlU2N JrkAQOPt/FEVHO5lRbvZXqnNhGV5XmNdHDKAevmDzwyBU0DC8u+hfLqrv0B8fHGaKeax mPkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eyxJaH1PHlwYlUgGf83JVXBiUHcCGPN/7wi0jEpOAp0=; b=WCfMKkoEEZAQoi6TpYIH3WPrwf4qDGN6DjVN6rVSNzyBT8E9dbTT0VO6vQKXJ2nHDA 2L2/brQyk654T8UVQMgwgfSuXonmO8o2rFOZacytwjnmAh0i/PpCCIVaO3j/2GDSRCQP VwjGk5Hwo8K85QmaiYFCTdw8jcMr/7dxciaAtokNvGSddrQDorRvJKYQs0PI5hWRBpM6 ZmMs4mBxneiQzFZPBATiHGlO5EaUPFtpdY18U+S4sMzZBv2DeLJquW5wy5ylkEE1gaAq yV5f/LSmSHVIimtYRpJ/PFp4Q8dC5LxV3xe30scY/D5zgy47cKy2E4WvQob3Rw8Jt7af MOmg== X-Gm-Message-State: AElRT7ENFk8J22zWRQRs53+9s3f/DyWYbsmq6cBuLyDGkTqKiAgzR9Mc e5RHiSXTDa7cE6SQAhtbde0= X-Received: by 10.80.164.216 with SMTP id x24mr801303edb.19.1520640450548; Fri, 09 Mar 2018 16:07:30 -0800 (PST) Received: from example.com ([2a02:8108:91c0:4bcc:7917:3e51:f69e:f7c3]) by smtp.gmail.com with ESMTPSA id p26sm1313987edm.41.2018.03.09.16.07.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 16:07:29 -0800 (PST) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca Date: Sat, 10 Mar 2018 01:07:27 +0100 To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Sam Ravnborg , Michal Marek , Ulf Magnusson , Eugeniu Rosca , Randy Dunlap , Petr Vorel , Linus Torvalds , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] kconfig: make unmet dependency warnings readable Message-ID: <20180310000727.GA8881@example.com> References: <1520333499-31854-1-git-send-email-yamada.masahiro@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520333499-31854-1-git-send-email-yamada.masahiro@socionext.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masahiro, Thanks for constantly improving the user experience of Kconfig. Just one small remark below. On Tue, Mar 06, 2018 at 07:51:39PM +0900, Masahiro Yamada wrote: > Currently, the unmet dependency warnings end up with endlessly long > expressions, most of which are false positives. > > Here is test code to demonstrate how it currently works. > > [Test Case] > > config DEP1 > def_bool y > > config DEP2 > def_bool n > > config A > bool "A" > select E > > config B > bool "B" > depends on DEP2 > select E > > config C > bool "C" > depends on DEP1 && DEP2 > select E > > config D > def_bool n > select E > > config E > bool > depends on DEP1 && DEP2 > > [Result] > > $ make allyesconfig > scripts/kconfig/conf --allyesconfig Kconfig > warning: (A && B && D) selects E which has unmet direct > dependencies (DEP1 && DEP2) > > Here, I see some points to be improved. > > First, '(A || B || D)' would make more sense than '(A && B && D)'. > I am not sure if this is intentional, but expr_simplify_unmet_dep() > turns OR expressions into AND, like follows: > > case E_OR: > return expr_alloc_and( > > Second, we see false positives. 'A' is a real unmet dependency. > 'B' is false positive because 'DEP1' is fixed to 'y', and 'B' depends > on 'DEP2'. 'C' was correctly dropped by expr_simplify_unmet_dep(). > 'D' is also false positive because it has no chance to be enabled. > Current expr_simplify_unmet_dep() cannot avoid those false positives. > > After all, I decided to use the same helpers as used for printing > reverse dependencies in the help. > > With this commit, unreadable warnings in the real world: > > $ make ARCH=score allyesconfig > scripts/kconfig/conf --allyesconfig Kconfig > warning: (HWSPINLOCK_QCOM && AHCI_MTK && STMMAC_PLATFORM && DWMAC_IPQ806X > && DWMAC_LPC18XX && DWMAC_OXNAS && DWMAC_ROCKCHIP && DWMAC_SOCFPGA && DWMA > C_STI && TI_CPSW && PINCTRL_GEMINI && PINCTRL_OXNAS && PINCTRL_ROCKCHIP && > PINCTRL_DOVE && PINCTRL_ARMADA_37XX && PINCTRL_STM32 && S3C2410_WATCHDOG > && VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK && RTC_DRV_AT91SAM9 && LP > C18XX_DMAMUX && VIDEO_OMAP4 && COMMON_CLK_GEMINI && COMMON_CLK_ASPEED && C > OMMON_CLK_NXP && COMMON_CLK_OXNAS && COMMON_CLK_BOSTON && ATMEL_ST && QCOM > _ADSP_PIL && QCOM_Q6V5_PIL && QCOM_GSBI && ATMEL_EBI && ST_IRQCHIP && RESE > T_IMX7 && PHY_HI6220_USB && PHY_RALINK_USB && PHY_ROCKCHIP_PCIE && PHY_DA8 > XX_USB) selects MFD_SYSCON which has unmet direct dependencies (HAS_IOMEM) > warning: (PINCTRL_AT91 && PINCTRL_AT91PIO4 && PINCTRL_OXNAS && PINCTRL_PIS > TACHIO && PINCTRL_PIC32 && PINCTRL_MESON && PINCTRL_NOMADIK && PINCTRL_MTK > && PINCTRL_MT7622 && GPIO_TB10X) selects OF_GPIO which has unmet direct d > ependencies (GPIOLIB && OF && HAS_IOMEM) > warning: (FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && LOCKDEP) sele > cts FRAME_POINTER which has unmet direct dependencies (DEBUG_KERNEL && (CR > IS || M68K || FRV || UML || SUPERH || BLACKFIN || MN10300 || METAG) || ARC > H_WANT_FRAME_POINTERS) > > will be turned into: > > $ make ARCH=score allyesconfig > scripts/kconfig/conf --allyesconfig Kconfig > > WARNING: > Unmet direct dependencies detected for MFD_SYSCON > Depends on: > HAS_IOMEM [=n] > Selected by [y]: > - PINCTRL_STM32 [=y] && PINCTRL [=y] && (ARCH_STM32 || COMPILE_TEST [=y]) > && OF [=y] > - RTC_DRV_AT91SAM9 [=y] && RTC_CLASS [=y] && (ARCH_AT91 || COMPILE_TEST > [=y]) > - ATMEL_ST [=y] && GENERIC_CLOCKEVENTS [=y] > - RESET_IMX7 [=y] && RESET_CONTROLLER [=y] > - PHY_HI6220_USB [=y] && (ARCH_HISI && ARM64 || COMPILE_TEST [=y]) > - PHY_RALINK_USB [=y] && (RALINK || COMPILE_TEST [=y]) > - PHY_ROCKCHIP_PCIE [=y] && (ARCH_ROCKCHIP && OF [=y] || COMPILE_TEST > [=y]) > > WARNING: > Unmet direct dependencies detected for OF_GPIO > Depends on: > GPIOLIB [=y] && OF [=y] && HAS_IOMEM [=n] > Selected by [y]: > - PINCTRL_MTK [=y] && PINCTRL [=y] && (ARCH_MEDIATEK || COMPILE_TEST > [=y]) && OF [=y] > - PINCTRL_MT7622 [=y] && PINCTRL [=y] && (ARCH_MEDIATEK || COMPILE_TEST > [=y]) && OF [=y] && (ARM64 || COMPILE_TEST [=y]) > > WARNING: > Unmet direct dependencies detected for FRAME_POINTER > Depends on: > DEBUG_KERNEL [=y] && (CRIS || M68K || FRV || UML || SUPERH || BLACKFIN > || MN10300 || METAG) || ARCH_WANT_FRAME_POINTERS [=n] > Selected by [y]: > - LATENCYTOP [=y] && DEBUG_KERNEL [=y] && STACKTRACE_SUPPORT [=y] && > PROC_FS [=y] && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && > !ARC && !X86 > > Signed-off-by: Masahiro Yamada > --- > > Changes in v2: > - update test case > > scripts/kconfig/expr.c | 29 ----------------------------- > scripts/kconfig/expr.h | 1 - > scripts/kconfig/symbol.c | 33 +++++++++++++++++++++------------ > 3 files changed, 21 insertions(+), 42 deletions(-) > > diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c > index 49376e1..235e179 100644 > --- a/scripts/kconfig/expr.c > +++ b/scripts/kconfig/expr.c > @@ -1150,35 +1150,6 @@ expr_get_leftmost_symbol(const struct expr *e) > return expr_copy(e); > } > > -/* > - * Given expression `e1' and `e2', returns the leaf of the longest > - * sub-expression of `e1' not containing 'e2. > - */ > -struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2) > -{ > - struct expr *ret; > - > - switch (e1->type) { > - case E_OR: > - return expr_alloc_and( > - expr_simplify_unmet_dep(e1->left.expr, e2), > - expr_simplify_unmet_dep(e1->right.expr, e2)); > - case E_AND: { > - struct expr *e; > - e = expr_alloc_and(expr_copy(e1), expr_copy(e2)); > - e = expr_eliminate_dups(e); > - ret = (!expr_eq(e, e1)) ? e1 : NULL; > - expr_free(e); > - break; > - } > - default: > - ret = e1; > - break; > - } > - > - return expr_get_leftmost_symbol(ret); It looks like expr_get_leftmost_symbol() has no more callers left and could be removed with this patch? Thanks, Eugeniu.