Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1424833ybb; Thu, 9 Apr 2020 01:42:11 -0700 (PDT) X-Google-Smtp-Source: APiQypL5Rvowt7xx3tku902PtaJ6VFbeOHBmIB1j/7k53RWmq6Lmn//5BCR2iCYinh7Uv3ZuwU4O X-Received: by 2002:a05:6830:148d:: with SMTP id s13mr8692054otq.342.1586421731101; Thu, 09 Apr 2020 01:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586421731; cv=none; d=google.com; s=arc-20160816; b=tR3xI/Pa6BTAZCFWJUZcMuGvqobb+Ta+uPYIZanGvLUfNuZ69HhGF+jqS9p0O0EWgP ezRq33wOZaa5G3CH6UKf5zsTq9QYhyByoJ1DhL6Ux2j9I1jRZKr3bnVGbCWMrDL/pTxO YbuveopGPMFnLhJWftbXhlrPf7x/P5Vsdk7JOuNxhq3Tukm4DWqFipBVXYGtLmdGGZWY ttcFA+kLd3vHYi/bpNsxjkoOinh73r8yXbyWwRBoizo2wsZ/58JW97yIJag3CrliRc4m xmSCbLqKZfEOYWnPzMk/EK2+X0Ov6HJmElt5sal4Wz0PWNcvhEUmaMH+S8BhjRVAiVzr FsQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=xJK47NnlJeAw+jwikf6QMD074W0+oIPW79MSFJM2H2k=; b=zrJuoyaKv/c4nxPRW4VPjXsCeJlRfpH37ohc2yzhuIGDMpZlMdFNpPORWgCtfLATvY dD6bmQIGH8KLyetXS9OWKEoD3WCpjTnMbUhGBNnlRAI8hxY0LYISAWUd2RHMCW49W1bU lUt2KcehwSZKysl+QFuOm3aOXxqilpEss2yYclGhDCNX0KPt0TmFdmlC3Jim5p2B2jr9 RVr99GentkVdqd2UeKxIn+cGqDDqco+VqE/LbvRcV/RffD9rRQEkLBV76IQhDUSoL8+m nfal/lXFL+zj+PTVxJri+wzUe7jf9EIbBIdvHAPu1QeciHzzGSZX4DEE2O7dJvb3pSAm hxKw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7si3786128otd.115.2020.04.09.01.41.54; Thu, 09 Apr 2020 01:42:11 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbgDIIlR (ORCPT + 99 others); Thu, 9 Apr 2020 04:41:17 -0400 Received: from mga12.intel.com ([192.55.52.136]:18402 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbgDIIlR (ORCPT ); Thu, 9 Apr 2020 04:41:17 -0400 IronPort-SDR: BUIQ9jcktPupZ+KATaEXNsjE+VZy0p1LUdJ/Iw+Y9pv6HQmpgINhXybTeZMmuUImrNcRqCA2b+ G0JRF0BpApQA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 01:41:17 -0700 IronPort-SDR: VRkD0xl0Hi3Ldvuf0kEfJ8F4gCAOL43B4AsAFq3BlZ1Jho9cZYh4n5YVd8dXC/Z9fBC7Vpc3HU VNRFRnBMmHYQ== X-IronPort-AV: E=Sophos;i="5.72,362,1580803200"; d="scan'208";a="425437262" Received: from ashakhno-mobl.ccr.corp.intel.com (HELO localhost) ([10.252.61.38]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 01:41:10 -0700 From: Jani Nikula To: Jason Gunthorpe , Arnd Bergmann Cc: Jernej Skrabec , Leon Romanovsky , Neil Armstrong , David Airlie , Networking , Masahiro Yamada , Nicolas Pitre , Saeed Mahameed , "linux-kernel\@vger.kernel.org" , dri-devel , Linux-Renesas , Andrzej Hajda , Jonas Karlman , Kieran Bingham , Laurent Pinchart , "David S. Miller" , linux-rdma Subject: Re: [RFC 0/6] Regressions for "imply" behavior change In-Reply-To: <20200408224224.GD11886@ziepe.ca> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200408202711.1198966-1-arnd@arndb.de> <20200408224224.GD11886@ziepe.ca> Date: Thu, 09 Apr 2020 11:41:08 +0300 Message-ID: <87k12pgifv.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 08 Apr 2020, Jason Gunthorpe wrote: > On Wed, Apr 08, 2020 at 10:49:48PM +0200, Arnd Bergmann wrote: >> On Wed, Apr 8, 2020 at 10:38 PM Nicolas Pitre wrote: >> > On Wed, 8 Apr 2020, Arnd Bergmann wrote: >> > > I have created workarounds for the Kconfig files, which now stop using >> > > imply and do something else in each case. I don't know whether there was >> > > a bug in the kconfig changes that has led to allowing configurations that >> > > were not meant to be legal even with the new semantics, or if the Kconfig >> > > files have simply become incorrect now and the tool works as expected. >> > >> > In most cases it is the code that has to be fixed. It typically does: >> > >> > if (IS_ENABLED(CONFIG_FOO)) >> > foo_init(); >> > >> > Where it should rather do: >> > >> > if (IS_REACHABLE(CONFIG_FOO)) >> > foo_init(); >> > >> > A couple of such patches have been produced and queued in their >> > respective trees already. >> >> I try to use IS_REACHABLE() only as a last resort, as it tends to >> confuse users when a subsystem is built as a module and already >> loaded but something relying on that subsystem does not use it. >> >> In the six patches I made, I had to use IS_REACHABLE() once, >> for the others I tended to use a Kconfig dependency like >> >> 'depends on FOO || FOO=n' > > It is unfortunate kconfig doesn't have a language feature for this > idiom, as the above is confounding without a lot of kconfig knowledge > >> I did come up with the IS_REACHABLE() macro originally, but that >> doesn't mean I think it's a good idea to use it liberally ;-) > > It would be nice to have some uniform policy here > > I also don't like the IS_REACHABLE solution, it makes this more > complicated, not less.. Just chiming "me too" here. IS_REACHABLE() is not a solution, it's a hack to hide a dependency link problem under the carpet, in a way that is difficult for the user to debug and figure out. The user thinks they've enabled a feature, but it doesn't get used anyway, because a builtin depends on something that is a module and therefore not reachable. Can someone please give me an example where that kind of behaviour is desirable? AFAICT IS_REACHABLE() is becoming more and more common in the kernel, but arguably it's just making more undesirable configurations possible. Configurations that should simply be blocked by using suitable dependencies on the Kconfig level. For example, you have two graphics drivers, one builtin and another module. Then you have backlight as a module. Using IS_REACHABLE(), backlight would work in one driver, but not the other. I'm sure there is the oddball person who finds this desirable, but the overwhelming majority would just make the deps such that either you make all of them modules, or also require backlight to be builtin. BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center