Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1165636ybi; Wed, 3 Jul 2019 10:36:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyng9IKlX6Xi+4nO1oTfQe4Lt+piwQKAlW51K4MdfSBUNlP0fU3yalMkEJ6y0GKSVq0tDx+ X-Received: by 2002:a65:4841:: with SMTP id i1mr19608887pgs.316.1562175400204; Wed, 03 Jul 2019 10:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562175400; cv=none; d=google.com; s=arc-20160816; b=tUM/vJREhDkMUwSddxhFLwgU00jTmUxIci0ggkOYloEahBrvSr+WLhihc2RO85RiLA 13kg9NmRlfYjV90/p8+ptsR9G00kTdXWMqFUCALKEyEKw7e0vXVp8tELYgYj0jaiuSAB Pt6TzlB9XflCg4Z5Q1q9uNnq4AKxaGCAv21eUJjvN7miShcBWOPaC0r2SeXNQCI1xno1 oCW2kGZzWj4TbD7rjHzJd8lKl9UVswQ/3ir1HFinPf4r2m6p1uNYgbRVsOQJAC1jPflG K+gmEPRfSGEmUynfmKOZYdm4JQ5hf38Y//gP2Ix88bJ3IcKDswLsLBrVJe9M09M+Gb+F 5AoQ== 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:from:date; bh=wLs0B87VrRocDw8TqX6WgFmlXaTzPPe7N7Klaqcmn/c=; b=DEuJTie5d1lpn+IOz7P/JJ3V2v/4Pddkf/6pApr3VvZlJIYFT4LFsJYTbUSEEQB+8m Sdv2TFnFv0VTwf170nROt2yj1TA/S6ivlr7DONsiL821n/PX9hhleL33Eq3ArxvEedEK ra+tYQEINp6QPZcdeLxDTgZ0r579hPcd/rQ46Ji160gljoyVqWv1iIrvB/8TPhcMNLfb XzX965aD6XWJsCD4kB0L+K07U7N9Qlzd5xLCh1MoTv1i+253Sfyk8boJiugwEjTXYSim MtPI6efSkVwCXquHNzkqt/ZRrs6JfPGVd23NDGbgNeTUibTiGqwarwTLBPfeZQ1m8xGl mxQQ== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w186si2931914pgd.48.2019.07.03.10.36.24; Wed, 03 Jul 2019 10:36:40 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726986AbfGCRgA (ORCPT + 99 others); Wed, 3 Jul 2019 13:36:00 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:35680 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbfGCRf7 (ORCPT ); Wed, 3 Jul 2019 13:35:59 -0400 Received: by mail-pf1-f195.google.com with SMTP id u14so432231pfn.2; Wed, 03 Jul 2019 10:35:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wLs0B87VrRocDw8TqX6WgFmlXaTzPPe7N7Klaqcmn/c=; b=ZGcz/OgumTeJw/rL+GZEk4xMugOOSg3ZhFts87od6JEz2RLDflKa40wcSG9id/79iC XXdSbbIvAvya1i1dLbA7XV0k1DoQth8jgRQctKwuNf7qynOdA2eEbOSkaiGlFybjZ5YV teDq4vGLpFpzqaKM3DFstrTLO9IY8SNm/bkWykoFlQz6yEkxJQlwbopSTij7P3s+F4h3 QzTP0sfSixMMhodfLE8RXt78ECKkeYPLQq2UfJd94VGUfBzkVAbN9w6a4xDZqGrFCUk2 Ei85EHK4v9kw0lqS1Fm0Ek6/5dWfWGMPpWGtwlTn2GI0mSOQ48Oy5EzVuR6g68dX0R7g OEWA== X-Gm-Message-State: APjAAAXybSP6yticC3qxqtzDAZd/MZZh5OWswgXkHyTUEoe8FPTumm50 YziSL8sBojHQC3QcEMCukZA= X-Received: by 2002:a17:90a:9b08:: with SMTP id f8mr14210734pjp.103.1562175358483; Wed, 03 Jul 2019 10:35:58 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id u16sm2839751pjb.2.2019.07.03.10.35.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 10:35:56 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id E52C9402AC; Wed, 3 Jul 2019 17:35:55 +0000 (UTC) Date: Wed, 3 Jul 2019 17:35:55 +0000 From: Luis Chamberlain To: "Enrico Weigelt, metux IT consult" Cc: Christoph Hellwig , Brendan Higgins , Cristina Moraru , "vegard.nossum@gmail.com" , Valentin Rothberg , Hannes Reinecke , Sam Ravnborg , Michal Marek , "linux-kernel@vger.kernel.org" , Tom Gundersen , Kay Sievers , Rusty Russell , Andrew Morton , backports@vger.kernel.org, Guenter Roeck , Greg Kroah-Hartman , "rafael.j.wysocki" , Dmitry Torokhov , Takashi Iwai , Mauro Carvalho Chehab , Johannes Berg , Hauke Mehrtens , Paul Bolle , Paul Gortmaker , Alexey Khoroshilov , Sathya Prakash Veerichetty , "Martin K. Petersen" , Laurence Oberman , Johannes Thumshirn , Tejun Heo , Jej B , Theodore Ts'o , Daniel Jonsson , Andrzej Wasowski Subject: Re: [RFC PATCH 0/5] Add CONFIG symbol as module attribute Message-ID: <20190703173555.GW19023@42.do-not-panic.com> References: <1471462023-119645-1-git-send-email-cristina.moraru09@gmail.com> <20160818175505.GM3296@wotan.suse.de> <20160825074313.GC18622@lst.de> <20160825201919.GE3296@wotan.suse.de> <20190627045052.GA7594@lst.de> <40f70582-c16a-7de0-cfd6-c7d5ff9ead71@metux.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40f70582-c16a-7de0-cfd6-c7d5ff9ead71@metux.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 03, 2019 at 02:16:44PM +0200, Enrico Weigelt, metux IT consult wrote: > On 28.06.19 20:40, Luis Chamberlain wrote: > > Hi folks, > > > The solution puts forward a mechanism to add a kconfig_symb where > > we are 100% certain we have a direct module --> config mapping. > Okay, but IIRC this will add more boilerplate those modules. Just one module attribute. > And I wonder whether target binaries are the right place for those > things at all - IMHO that's something one wants to derive from the > source code / .config's. For the use cases mentioned for why the module attribute is being suggested it would help to not have to download kernel sources. The only question we want to answer is: for the hardware components present on this system, which configs options do I need to enable to support these components? > At least in the cases I'm imagining, I don't > even have an actual kernel running on the corresponding target yet. > (eg. in crosscompile situations) Right, so this is a different use case. A *running* kernel provides *more* information, specially if it had enabled on it modules which enable hardware. > OTOH, a more pressing problem for me is identifying the right drivers > and corresponding config options (usually plural, as certain subsystems > have to be enabled, too) by hardware information like DT, ACPI, DMI, > PCI, etc. Right, I'm familiar with the problem. At least for virtualization we decided to support at least these two to help: * make kvmconfig * make xenconfig I'm not suggesting we need a respective target per major component you have described. I'm mentioning these as examples of ways to also address similar problems. > For now, I have to do that manually, which is pretty time > consuming. Yes... Similar problem would be found if one wanted to find a desirable kernel config for a remote system. One should be able to somehow scrape some hardware information, dump that to a file, and then somehow generate a working config for that system. The module attribute being suggested would enable at least one way to gather some of the required config symbols: symbols for *hardware* and where one can run a modern kernel, with many features / hardware enabled already. Addressing the problem of obtaining a kernel config for a system where one cannot run any kernel should be possible, however this *is* a very different problem. However, folks producing embedded systems *do* / *should* have a lot of knowledge of their systems, and so the type of scheme you have devised seems sensible for it. > In embedded world, we often have scenarios where we want a really > minimal kernel, but need to enable/disable certain hi-level peripherals > in the middle of the project (eg. "oh, we also need ethernet, but we > wanna drop usb"). There we'll have to find out what actual chip is, > its corresponding driver, required subsystems, etc, and also kick off > everything we don't need anymore. Right. One *should* be able to tell some tool, hey, here is the list of my desirable .config options. Go and figure out what I need to make that work and give me a resulting .config. Its not easy. > I've thought about implementing some actual dependency tracking > (at least recording the auto-enabled symbols), but didn't expect that > to become practically usable anytime soon, The ability to easily ask the kernel to enable the components needed for a respective config option *is* very useful but indeed not easy. This is not the only space where this problem exists. Similar problem exists for distribution packages, and dependencies. Challenges have been made for proper research towards these problems, and such research has lead distributions to opt to enable some of these algorithms. This begs the question if we could learn from similar efforts on Linux for these sorts of questions. One possibility here is to evaluate the prospect of using a SAT solver with Minimally Unsatisfiable Subformulas (MUSes) support, which should be be able to address thir problem. This prospect is ongoing and currrent R&D is active, for details refer to: https://kernelnewbies.org/KernelProjects/kconfig-sat I'd recommend the mailing list, as that is where folks are following up on, and there seems to be a call scheduled next Wednesday at 8:30am PST about some new developments. > so I went for a different > approach: writing a little tool that allows modeling hilevel features > and corresponding (potentially board-specific) config syms, so the whole > .config for certain board and usecase can be autogenerated by just some > small meta-configuration: > > https://github.com/metux/kmct > > Maybe this could also help for your usecase ? It certainly can be useful for components, ie, not hardware. But for hardware a one-to-one mapping of one driver to one config would be of much more use. Based on a quick glance, I'd suggest that it would be great if could have something similar upstream on linux. It would be unclear yet how to structure this though. It would be wonderful if for instance kconfig supported a way to group a major set of components under *one* config symbol and then say: "I want this major component enabled" and then it'd go and enable all the defaults which would be required for it. Its not an easy problem, given though that there may be certain other symbols which may conflict with your target component. An example is if you wanted to enable PCI on a system which didn't support it. Because of this, it seems you'd want *all* desirable configs and let a piece of software figure out what you need / can enable. And.. this is precisely where the SAT solver with MUSes could help... Luis