From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31FBFC352BE for ; Fri, 17 Apr 2020 16:59:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2DDA2054F for ; Fri, 17 Apr 2020 16:59:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2DDA2054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8BDFE8E0039; Fri, 17 Apr 2020 12:59:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86E618E0023; Fri, 17 Apr 2020 12:59:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75CEA8E0039; Fri, 17 Apr 2020 12:59:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 5E9AD8E0023 for ; Fri, 17 Apr 2020 12:59:43 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 09AF7180ACEE4 for ; Fri, 17 Apr 2020 16:59:43 +0000 (UTC) X-FDA: 76717958646.16.yard50_71e3ea4c6f05b X-HE-Tag: yard50_71e3ea4c6f05b X-Filterd-Recvd-Size: 7728 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Apr 2020 16:59:42 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id y22so1185178pll.4 for ; Fri, 17 Apr 2020 09:59:42 -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=dC4k5ZLeGtiN4GIhih1iZ1bgexRzNsdtwNaiElYm8Sg=; b=IW1t/B02hsktWHNzK8t7CgWdY1SfPj1xQfPa4HIBnQcVXc2EwFD377A8A/Y7RwdSyw 4DLeqxF7zJfM5/RFwECA8KVETYSMPLChaNrnoNc2jK2FDFYdixwVo0NI5ERobUs8grFC EutQQ5uCTFO7aLUQyjEubLDxzjruPVnMADYH6VPk9XgjGqhT3uIgJ9oooAkiBUNX4eb8 u8kEgxtjul+DrwCS27MKf3A4xIDExyiUES1IOUSh/DLRbtKSrYknULX27EYElpKNh89+ tsUZsj8B8v6xTikYm9keT9EY6zpic0Itb3B277Niyq8pKw7lRa9RcWwKtTI7EQ5ka2/4 6YLA== X-Gm-Message-State: AGi0PuZcIbjK61uVAwzqu7xnaIXTFv0sX8Jz6GF6AmMh/UDICr4p06tS Mtj77Q3Ds+zvwqiFt78JgyE= X-Google-Smtp-Source: APiQypJyo3WoccLcwNNQ+fwOqBLD9a9lBfmZ6A/DqglFmkq5PqBPr0Do8rh+fLQLEgOYtRUFMM8msg== X-Received: by 2002:a17:902:7289:: with SMTP id d9mr4273322pll.49.1587142781497; Fri, 17 Apr 2020 09:59:41 -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 q187sm15490054pfb.131.2020.04.17.09.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 09:59:40 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 52C344028E; Fri, 17 Apr 2020 16:59:39 +0000 (UTC) Date: Fri, 17 Apr 2020 16:59:39 +0000 From: Luis Chamberlain To: Masami Hiramatsu Cc: Vlastimil Babka , Andrew Morton , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-mm@kvack.org, Ivan Teterevkov , Michal Hocko , David Rientjes , Matthew Wilcox , "Eric W . Biederman" , "Guilherme G . Piccoli" , Alexey Dobriyan , Thomas Gleixner , Greg Kroah-Hartman , Christian Brauner Subject: Re: [PATCH v2 1/3] kernel/sysctl: support setting sysctl parameters from kernel command line Message-ID: <20200417165939.GV11244@42.do-not-panic.com> References: <20200414113222.16959-1-vbabka@suse.cz> <20200414113222.16959-2-vbabka@suse.cz> <20200415180355.00bc828ea726c421638db871@kernel.org> <20200416012931.GE11244@42.do-not-panic.com> <20200416194955.3448c8526ea3f59e95c506da@kernel.org> <20200416155327.GT11244@42.do-not-panic.com> <20200417193442.b20394dcaac02d5aeef9b5ee@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200417193442.b20394dcaac02d5aeef9b5ee@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Apr 17, 2020 at 07:34:42PM +0900, Masami Hiramatsu wrote: > On Thu, 16 Apr 2020 15:53:27 +0000 > Luis Chamberlain wrote: > > > On Thu, Apr 16, 2020 at 07:49:55PM +0900, Masami Hiramatsu wrote: > > > Hi Luis, > > > > > > On Thu, 16 Apr 2020 01:29:31 +0000 > > > Luis Chamberlain wrote: > > > > > > > On Wed, Apr 15, 2020 at 06:03:55PM +0900, Masami Hiramatsu wrote: > > > > > On Tue, 14 Apr 2020 13:32:20 +0200 > > > > > Vlastimil Babka wrote: > > > > > > diff --git a/init/main.c b/init/main.c > > > > > > index a48617f2e5e5..7b43118215d6 100644 > > > > > > --- a/init/main.c > > > > > > +++ b/init/main.c > > > > > > @@ -1372,6 +1372,8 @@ static int __ref kernel_init(void *unused) > > > > > > > > > > > > rcu_end_inkernel_boot(); > > > > > > > > > > > > + do_sysctl_args(); > > > > > > + > > > > > > > > > > Ah, I see. Since the sysctl is designed to be called after all __init calls were > > > > > done, it shouldn't use bootconfig directly because bootconfig is full of __init > > > > > call. > > > > > > > > The idea is bootconfig would be useful in the sense of a library set of > > > > helpers which could be modified to remove __init, and then used to > > > > instrument the cmdline depending on certain debugging kconfig entries. > > > > > > Would you mean making bootconfig (parser and APIs) be more generic so that > > > other subsystem can reuse it with their data? > > > Or just make it available after boot? (I think this latter one will be > > > useful for module initialization) > > > > The later. First use case that comes to mind is debugging cmdline, so > > to see if what one adds is what ends up happening at run time after > > boot. > > Hmm, I think that's not so easy to debug command line after boot, because > the kernel command line is parsed (and handlers are executed) already in > boot time. We can not repeat it after boot. Unless you put into the command line everything you need to test on one boot. > > > > We currently have no way to purposely extend / break the cmdline for > > > > debugging purposes, so, bootconfig's parsers, since it already has a > > > > way to extend the cmdlineline, might make it much easier to do this > > > > later. > > > > > > > > Without bootconfig, if we wanted to add new kconfig to, for example, > > > > add new funny cmdline arguments to test they worked or not, we'd have > > > > to devise our own set of helpers now. ie, new functionality. bootconfig > > > > however already has existing functionality to tweak the cmdline, and so > > > > some code could be leveraged there for this purpose. > > > > > > Hmm, you can use the bootconfig as a "supplemental" kernel command line, > > > but not tweak (like modify/replace) it. Would you like to change the > > > kernel command line parameter on-line? > > > > It would be during boot. To augment it as if the user had used certain > > parameters on boot. But if only a new path is tested, and we can't > > reproduce as if the user had *not* used bootconfig, this idea would > > only be useful to test bootconfig parsing, nothing else. The hope was > > to do both. > > As you may know, the bootconfig already supports "additional" kernel > command line. All keys which starts "kernel" is copied into kernel > command line at early boot timing. So if you want to write a test > parameter in the bootconfig, you can do it. There are two bootparams paths now, the old way, and the new bootconfig path. Extending test coverage to test bootconfig seems rather easier to consider. However the hope was that there may be some existing code within bootconfig which would also allow one to test the old cmdline path, as if the cmdline had certain params present. It doesn't seem to be the case. > However, it is not a good idea to execute command line handlers > twice because it can be destructive or can append all parameters > (e.g. "console=" .) I see so bootconfig is mutually exclusive with the old cmdline? > For the new feature can natively use the bootconfig, for example > boot-time tracing (kernel/trace/trace_boot.c) is something like > this sysctl on boot, and natively uses the bootconfig because > the tracing parameter is too complex for kernel command line :) Neat. Luis