X-Received: by 2002:a17:90b:1e12:b0:1b9:d1e7:22ba with SMTP id pg18-20020a17090b1e1200b001b9d1e722bamr12106294pjb.128.1645668658517; Wed, 23 Feb 2022 18:10:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645668658; cv=none; d=google.com; s=arc-20160816; b=GfgxYVTREtF2wHdGpdp7Ym0kstoj4legJkt9SlS6+bd7feC6a8mmN0fgvg4K+iSMo4 QyNBlUl1s6I18yjhWPmnqn5ZTbsZQt2SI/LZ1m/YazUQOnXdY+e6NMGCKxpLl68l74jQ 1bmiE9PVpeb0EoLJSCQVCW3wtzIXEnhCQg7HiQVjR1ujR7A6vlzsEVJ3vAXFhnLQR8yy ZB1VfRzUWRU84AiGPgTsWiwn0185EwYjP2uqm3N5/Gel+Fss087cWj4heJyovp28RQfZ PORLn/SMvIjPrvA9HpOFe4CREd1JYD3Wtlp2zW3Wq/8eizAHtVdlZSNc/mpJXemlBeEt 1pgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=S6k4SKuKvGu8qoAcQ7C+BL9NsjTm2YNSk4wkfP4DE50=; b=oeP1+u6S0Dd+9bMwB6o+UxDTY8SIjgLRGmDksFXfhy7HvTaMasXdWezPzuVbweGrNw RqMzjeujdQKciYNbZYp6YvYg1iww0IHkt+unGkJft07w5kWZ1p1CuL+JWMkrNlWWDFGC /FtvCOsfaXtNsWy2ZRRCy+xidAougdE7Y51pKnGJAKcjK8WcAxYrQKzrgJDtQ/v+pGwj 9u2OxgJWf+zI+qJy1+3/N+qdvv8sQxIAZ6pO3i/vTtDcoFkk0zwS7D5B9kREIAWpApNB 9vEFAB9FzVifmJqU7c2uDRC4h2cD/RXp3ru1lh1lWeEJZP7niEyHEgrGSvm4RaasVcfZ OwzA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 82si1318501pgd.156.2022.02.23.18.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 18:10:58 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 07357D19B7; Wed, 23 Feb 2022 17:43:53 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbiBXBoP (ORCPT + 99 others); Wed, 23 Feb 2022 20:44:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbiBXBoN (ORCPT ); Wed, 23 Feb 2022 20:44:13 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EBD1D19B7; Wed, 23 Feb 2022 17:43:43 -0800 (PST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4K3vmP4nwgzdfT6; Thu, 24 Feb 2022 09:03:33 +0800 (CST) Received: from dggpeml100012.china.huawei.com (7.185.36.121) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Feb 2022 09:04:46 +0800 Received: from [10.67.109.84] (10.67.109.84) by dggpeml100012.china.huawei.com (7.185.36.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Feb 2022 09:04:45 +0800 Message-ID: Date: Thu, 24 Feb 2022 09:04:45 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH sysctl-next] kernel/kexec_core: move kexec_core sysctls into its own file To: Baoquan He CC: , , , , , , , , , , , References: <20220223030318.213093-1-yingelin@huawei.com> From: yingelin In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.109.84] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml100012.china.huawei.com (7.185.36.121) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/2/23 16:30, Baoquan He 写道: > On 02/23/22 at 11:03am, yingelin wrote: >> This move the kernel/kexec_core.c respective sysctls to its own file. > Hmm, why is the move needed? > > With my understanding, sysctls are all put in kernel/sysctl.c, > why is kexec special? kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. This patch moves the kexec sysctls to the place where they actually belong to help with this maintenance. >> Signed-off-by: yingelin >> --- >> kernel/kexec_core.c | 20 ++++++++++++++++++++ >> kernel/sysctl.c | 13 ------------- >> 2 files changed, 20 insertions(+), 13 deletions(-) >> >> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c >> index 68480f731192..e57339d49439 100644 >> --- a/kernel/kexec_core.c >> +++ b/kernel/kexec_core.c >> @@ -936,6 +936,26 @@ int kimage_load_segment(struct kimage *image, >> struct kimage *kexec_image; >> struct kimage *kexec_crash_image; >> int kexec_load_disabled; >> +static struct ctl_table kexec_core_sysctls[] = { >> + { >> + .procname = "kexec_load_disabled", >> + .data = &kexec_load_disabled, >> + .maxlen = sizeof(int), >> + .mode = 0644, >> + /* only handle a transition from default "0" to "1" */ >> + .proc_handler = proc_dointvec_minmax, >> + .extra1 = SYSCTL_ONE, >> + .extra2 = SYSCTL_ONE, >> + }, >> + { } >> +}; >> + >> +static int __init kexec_core_sysctl_init(void) >> +{ >> + register_sysctl_init("kernel", kexec_core_sysctls); >> + return 0; >> +} >> +late_initcall(kexec_core_sysctl_init); >> >> /* >> * No panic_cpu check version of crash_kexec(). This function is called >> diff --git a/kernel/sysctl.c b/kernel/sysctl.c >> index ae5e59396b5d..00e97c6d6576 100644 >> --- a/kernel/sysctl.c >> +++ b/kernel/sysctl.c >> @@ -61,7 +61,6 @@ >> #include >> #include >> #include >> -#include >> #include >> #include >> #include >> @@ -1839,18 +1838,6 @@ static struct ctl_table kern_table[] = { >> .proc_handler = tracepoint_printk_sysctl, >> }, >> #endif >> -#ifdef CONFIG_KEXEC_CORE >> - { >> - .procname = "kexec_load_disabled", >> - .data = &kexec_load_disabled, >> - .maxlen = sizeof(int), >> - .mode = 0644, >> - /* only handle a transition from default "0" to "1" */ >> - .proc_handler = proc_dointvec_minmax, >> - .extra1 = SYSCTL_ONE, >> - .extra2 = SYSCTL_ONE, >> - }, >> -#endif >> #ifdef CONFIG_MODULES >> { >> .procname = "modprobe", >> -- >> 2.26.2 >> > .