From patchwork Tue Oct 10 09:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13415104 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A690C171DE for ; Tue, 10 Oct 2023 09:38:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1FBA7; Tue, 10 Oct 2023 02:38:10 -0700 (PDT) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-9b64b98656bso917775666b.0; Tue, 10 Oct 2023 02:38:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696930688; x=1697535488; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M90K/d3r5eUqR7rkir6gs7Lk0yYzS3hpFs7OoQ1iJbU=; b=iXHqKlHVWl+cC2CLWN3WzQmCBfBLE2sBWgRfhTtDBQf8X3IsSaniHvwSsaG/SXSdWu g5gb/z1RVd1pxJAsN3Na2Xl/Dye4etorV+nFkTR+YFuZbpQ9zIa2nhdbBc8fXu5CMUOZ 3s9Lh6vbRj390z+ai/AXNJ+oNscciAR87qPhhFHJRUH62zKAuJThharGUAY7H8GlQZ8j pmocfvaJbVrC+I+6PiXYQXyfNo5kFEcMJKw2oce+QJnVTpywBarNRHXb5PLnhqAxk6lD nyQFC33kvbIxa018+5nhMYoq+NkknoSTvG1nG3cMFny+xhpFXYeS6N9jwaBvCsu+d4YA sb0A== X-Gm-Message-State: AOJu0YzYtO/vHiPFeJgQq8KthIsL5a9pGV5Y0hwpq6+o5k9DuC7TykD+ +r3+JVvj3/flWMSWSXZHqe0= X-Google-Smtp-Source: AGHT+IHl+5BjCBDzgSSxHqHQ+6ZcSzI7hb/S5Ath/BoScpDKMJlmMZDOLiHOXiGnQkHxuJfAx1PaRA== X-Received: by 2002:a17:906:2d1:b0:9b2:b765:8802 with SMTP id 17-20020a17090602d100b009b2b7658802mr17226383ejk.40.1696930688532; Tue, 10 Oct 2023 02:38:08 -0700 (PDT) Received: from localhost (fwdproxy-cln-002.fbsv.net. [2a03:2880:31ff:2::face:b00c]) by smtp.gmail.com with ESMTPSA id jp20-20020a170906f75400b009a1c05bd672sm8008483ejb.127.2023.10.10.02.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:38:06 -0700 (PDT) From: Breno Leitao To: jlbec@evilplan.org, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, Eric Dumazet Cc: hch@lst.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org Subject: [PATCH net-next v3 1/4] netconsole: move init/cleanup functions lower Date: Tue, 10 Oct 2023 02:37:48 -0700 Message-Id: <20231010093751.3878229-2-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010093751.3878229-1-leitao@debian.org> References: <20231010093751.3878229-1-leitao@debian.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Move alloc_param_target() and its counterpart (free_param_target()) to the bottom of the file. These functions are called mostly at initialization/cleanup of the module, and they should be just above the callers, at the bottom of the file. From a practical perspective, having alloc_param_target() at the bottom of the file will avoid forward declaration later (in the following patch). Nothing changed other than the functions location. Suggested-by: Jakub Kicinski Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 104 +++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 3111e1648592..d609fb59cf99 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -192,58 +192,6 @@ static struct netconsole_target *alloc_and_init(void) return nt; } -/* Allocate new target (from boot/module param) and setup netpoll for it */ -static struct netconsole_target *alloc_param_target(char *target_config) -{ - struct netconsole_target *nt; - int err; - - nt = alloc_and_init(); - if (!nt) { - err = -ENOMEM; - goto fail; - } - - if (*target_config == '+') { - nt->extended = true; - target_config++; - } - - if (*target_config == 'r') { - if (!nt->extended) { - pr_err("Netconsole configuration error. Release feature requires extended log message"); - err = -EINVAL; - goto fail; - } - nt->release = true; - target_config++; - } - - /* Parse parameters and setup netpoll */ - err = netpoll_parse_options(&nt->np, target_config); - if (err) - goto fail; - - err = netpoll_setup(&nt->np); - if (err) - goto fail; - - nt->enabled = true; - - return nt; - -fail: - kfree(nt); - return ERR_PTR(err); -} - -/* Cleanup netpoll for given target (from boot/module param) and free it */ -static void free_param_target(struct netconsole_target *nt) -{ - netpoll_cleanup(&nt->np); - kfree(nt); -} - #ifdef CONFIG_NETCONSOLE_DYNAMIC /* @@ -938,6 +886,58 @@ static void write_msg(struct console *con, const char *msg, unsigned int len) spin_unlock_irqrestore(&target_list_lock, flags); } +/* Allocate new target (from boot/module param) and setup netpoll for it */ +static struct netconsole_target *alloc_param_target(char *target_config) +{ + struct netconsole_target *nt; + int err; + + nt = alloc_and_init(); + if (!nt) { + err = -ENOMEM; + goto fail; + } + + if (*target_config == '+') { + nt->extended = true; + target_config++; + } + + if (*target_config == 'r') { + if (!nt->extended) { + pr_err("Netconsole configuration error. Release feature requires extended log message"); + err = -EINVAL; + goto fail; + } + nt->release = true; + target_config++; + } + + /* Parse parameters and setup netpoll */ + err = netpoll_parse_options(&nt->np, target_config); + if (err) + goto fail; + + err = netpoll_setup(&nt->np); + if (err) + goto fail; + + nt->enabled = true; + + return nt; + +fail: + kfree(nt); + return ERR_PTR(err); +} + +/* Cleanup netpoll for given target (from boot/module param) and free it */ +static void free_param_target(struct netconsole_target *nt) +{ + netpoll_cleanup(&nt->np); + kfree(nt); +} + static struct console netconsole_ext = { .name = "netcon_ext", .flags = CON_ENABLED | CON_EXTENDED, From patchwork Tue Oct 10 09:37:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13415105 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57F00168DC for ; Tue, 10 Oct 2023 09:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D31D8; Tue, 10 Oct 2023 02:38:18 -0700 (PDT) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso987500666b.1; Tue, 10 Oct 2023 02:38:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696930697; x=1697535497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S+S7MtfjpOsax/1um4lfOdbgQCVIBHweerFRoRDaRZc=; b=L2ljgAJuNsDtfv8/4jK7p77KoaGKfxL14qbbnyke/D0CSr/Bg5/JfwB9bEW7RFaS0o IsjHct8GCgNSdBKa/jaUmrkJh+OAOcsUpVcLUtilzb2MQ0y/ifqhAwuT63bw7t3XS/+r xLw8WCkDSNz775pUXPKGGfklKehn4CeveyqRcNmqtfBdETu5DZSs00M6sA9xCs00Qv4m SrFW1V8ZARYfnRbsq2oXs0aZh/O3sFCBMcft0ILlWXeXOIpQ+Cw6DS4vmZ3c+d9AiYjt ZV1RLGsOXhQ7vRQMQXCyKC5ZPZ17KFi//GjB9JWSlitn+NldpQuFf9SAk0fPXSSDsQ11 sq9w== X-Gm-Message-State: AOJu0YxQYi39PTs+GOkaMgeiIff3PcOs8/QFcpOOJb5Jj6SPt6nnwmxW 94hvOxFcXemrPVsUb54u3qcJKhAo880= X-Google-Smtp-Source: AGHT+IGhAAUNp2LGsH2fW5ztAMg1kJZ+KajaPgdjM08JddOZltyuWt/okhcCeHUBtSVPpyJntjb13Q== X-Received: by 2002:a17:906:31d6:b0:99b:ed44:1a79 with SMTP id f22-20020a17090631d600b0099bed441a79mr15617355ejf.3.1696930696669; Tue, 10 Oct 2023 02:38:16 -0700 (PDT) Received: from localhost (fwdproxy-cln-011.fbsv.net. [2a03:2880:31ff:b::face:b00c]) by smtp.gmail.com with ESMTPSA id a6-20020a170906468600b009a5f7fb51dcsm8074699ejr.42.2023.10.10.02.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:38:10 -0700 (PDT) From: Breno Leitao To: jlbec@evilplan.org, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, Eric Dumazet Cc: hch@lst.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org Subject: [PATCH net-next v3 2/4] netconsole: Initialize configfs_item for default targets Date: Tue, 10 Oct 2023 02:37:49 -0700 Message-Id: <20231010093751.3878229-3-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010093751.3878229-1-leitao@debian.org> References: <20231010093751.3878229-1-leitao@debian.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org For netconsole targets allocated during the boot time (passing netconsole=... argument), netconsole_target->item is not initialized. That is not a problem because it is not used inside configfs. An upcoming patch will be using it, thus, initialize the targets with the name 'cmdline' plus a counter starting from 0. This name will match entries in the configfs later. Suggested-by: Joel Becker Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index d609fb59cf99..3d7002af505d 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -53,6 +53,8 @@ static bool oops_only = false; module_param(oops_only, bool, 0600); MODULE_PARM_DESC(oops_only, "Only log oops messages"); +#define NETCONSOLE_PARAM_TARGET_NAME "cmdline" + #ifndef MODULE static int __init option_setup(char *opt) { @@ -165,6 +167,10 @@ static void netconsole_target_put(struct netconsole_target *nt) { } +static void populate_configfs_item(struct netconsole_target *nt, + int cmdline_count) +{ +} #endif /* CONFIG_NETCONSOLE_DYNAMIC */ /* Allocate and initialize with defaults. @@ -688,6 +694,17 @@ static struct configfs_subsystem netconsole_subsys = { }, }; +static void populate_configfs_item(struct netconsole_target *nt, + int cmdline_count) +{ + char target_name[16]; + + snprintf(target_name, sizeof(target_name), "%s%d", + NETCONSOLE_PARAM_TARGET_NAME, cmdline_count); + config_item_init_type_name(&nt->item, target_name, + &netconsole_target_type); +} + #endif /* CONFIG_NETCONSOLE_DYNAMIC */ /* Handle network interface device notifications */ @@ -887,7 +904,8 @@ static void write_msg(struct console *con, const char *msg, unsigned int len) } /* Allocate new target (from boot/module param) and setup netpoll for it */ -static struct netconsole_target *alloc_param_target(char *target_config) +static struct netconsole_target *alloc_param_target(char *target_config, + int cmdline_count) { struct netconsole_target *nt; int err; @@ -922,6 +940,7 @@ static struct netconsole_target *alloc_param_target(char *target_config) if (err) goto fail; + populate_configfs_item(nt, cmdline_count); nt->enabled = true; return nt; @@ -954,6 +973,7 @@ static int __init init_netconsole(void) { int err; struct netconsole_target *nt, *tmp; + unsigned int count = 0; bool extended = false; unsigned long flags; char *target_config; @@ -961,7 +981,7 @@ static int __init init_netconsole(void) if (strnlen(input, MAX_PARAM_LENGTH)) { while ((target_config = strsep(&input, ";"))) { - nt = alloc_param_target(target_config); + nt = alloc_param_target(target_config, count); if (IS_ERR(nt)) { err = PTR_ERR(nt); goto fail; @@ -977,6 +997,7 @@ static int __init init_netconsole(void) spin_lock_irqsave(&target_list_lock, flags); list_add(&nt->list, &target_list); spin_unlock_irqrestore(&target_list_lock, flags); + count++; } } From patchwork Tue Oct 10 09:37:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13415107 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A53517733 for ; Tue, 10 Oct 2023 09:38:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79141CC; Tue, 10 Oct 2023 02:38:21 -0700 (PDT) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-53639fb0ba4so9219393a12.0; Tue, 10 Oct 2023 02:38:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696930700; x=1697535500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=afOI7n0O0xBXNXt45jFmttLB+IlVWLekbDfMghG+2eE=; b=c4Jcnsvvrd8xtqkIEHF0/TQQTLPxZ3FE3ruYgs5+n28oijPVTdNW9pXRojOdqYFaUF oACIutyPz2nYYLIrLydh7ejTf2oJv8cEpJwLUe9DOs81GPT5J0scn/f0hwT+tmGYShNF MDehCPgBfE4TBox7vUPJyrW0bhQrQrPBUh71nDlgZIoCLXoa/t8hqGVabQaoIZmgI+B8 hQSiRi/2KnKBvefcGrmpvwCROmMP52uLopAQWbPkulwTqCWsQwicxfexY8HDf3a2IEBV gR5hKVl1aOh01eXZcEN7dG1QbcpRuQUeXCDfIcUO9aZCK40ZXvaGGDPZoEIRcQzTfnti 9ODw== X-Gm-Message-State: AOJu0Yy3tSd3EMwh3YQrIxr4ZGf8qDyd/W5pGOXutPv4ui+mf59pmUWk ea95t6CI1KVTe/9lragLabw= X-Google-Smtp-Source: AGHT+IHPF+oZSd3W1X9NGPYTSkvLFuiu1FqauSDYZLA3nNztHC0NnNrCQn6K/4bb6Mdt9O1OlnuXHQ== X-Received: by 2002:a05:6402:3c1:b0:533:2449:7a59 with SMTP id t1-20020a05640203c100b0053324497a59mr16174945edw.11.1696930699688; Tue, 10 Oct 2023 02:38:19 -0700 (PDT) Received: from localhost (fwdproxy-cln-005.fbsv.net. [2a03:2880:31ff:5::face:b00c]) by smtp.gmail.com with ESMTPSA id v4-20020aa7d9c4000000b0052284228e3bsm7404542eds.8.2023.10.10.02.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:38:17 -0700 (PDT) From: Breno Leitao To: jlbec@evilplan.org, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, Eric Dumazet Cc: hch@lst.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org Subject: [PATCH net-next v3 3/4] netconsole: Attach cmdline target to dynamic target Date: Tue, 10 Oct 2023 02:37:50 -0700 Message-Id: <20231010093751.3878229-4-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010093751.3878229-1-leitao@debian.org> References: <20231010093751.3878229-1-leitao@debian.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Enable the attachment of a dynamic target to the target created during boot time. The boot-time targets are named as "cmdline\d", where "\d" is a number starting at 0. If the user creates a dynamic target named "cmdline0", it will attach to the first target created at boot time (as defined in the `netconsole=...` command line argument). `cmdline1` will attach to the second target and so forth. If there is no netconsole target created at boot time, then, the target name could be reused. Relevant design discussion: https://lore.kernel.org/all/ZRWRal5bW93px4km@gmail.com/ Suggested-by: Joel Becker Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 3d7002af505d..519f4d065921 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -629,6 +629,23 @@ static const struct config_item_type netconsole_target_type = { .ct_owner = THIS_MODULE, }; +static struct netconsole_target *find_cmdline_target(const char *name) +{ + struct netconsole_target *nt, *ret = NULL; + unsigned long flags; + + spin_lock_irqsave(&target_list_lock, flags); + list_for_each_entry(nt, &target_list, list) { + if (!strcmp(nt->item.ci_name, name)) { + ret = nt; + break; + } + } + spin_unlock_irqrestore(&target_list_lock, flags); + + return ret; +} + /* * Group operations and type for netconsole_subsys. */ @@ -639,6 +656,17 @@ static struct config_item *make_netconsole_target(struct config_group *group, struct netconsole_target *nt; unsigned long flags; + /* Checking if a target by this name was created at boot time. If so, + * attach a configfs entry to that target. This enables dynamic + * control. + */ + if (!strncmp(name, NETCONSOLE_PARAM_TARGET_NAME, + strlen(NETCONSOLE_PARAM_TARGET_NAME))) { + nt = find_cmdline_target(name); + if (nt) + return &nt->item; + } + nt = alloc_and_init(); if (!nt) return ERR_PTR(-ENOMEM); From patchwork Tue Oct 10 09:37:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13415108 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A40417750 for ; Tue, 10 Oct 2023 09:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB5E7B8; Tue, 10 Oct 2023 02:38:25 -0700 (PDT) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-9b95622c620so992068666b.0; Tue, 10 Oct 2023 02:38:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696930704; x=1697535504; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g1QRKkBNjznWASHX/P+4TGpYOnsgJ03ZF7D0qhU3Ymk=; b=plJUJYze8Ih4iB48eMtqqe4my0y81wE5SEl4pF1dkXVJavmbK0ltMypXu0wW9//2Ix 2/RjxF0QTb7hjaRIcCeILvEBAfV/dAgr9tKEIZgSWuNbaHsn18JbP8lZaJ1K0kw6Tfs6 9rAFSTbbk2S1T7Lr2PF/6t61yTyBRADKPJDNp6SUsf4eduOgE5ZecBbv2kLjIkmJqBzH 5y/CtmU9NnLAQ/jhZHXt/zxt9K9qmRNpsMvwV1OCVnxsY29Fw5V8iSMIRtC4rwJOzHzW Mr2SVSYEVli6KtRtVJQj3nV4BrqINod4Bz82bLmRz0Kqyt9SiwQMO5AEF2ESdMAYl0hC 1rSw== X-Gm-Message-State: AOJu0Yz1MqY//ZZr8WpfZABb1VrEDaMUwzmOWXQPv5v/xM3PJpnuFtQW LY80TVumlIBik8zyRuejhrI= X-Google-Smtp-Source: AGHT+IFxRq/KbS+SGcIHLC7lal1Yfk5k7Q0MeGQRouF0Zb3IAP2QclWw80a3UunY6/3pJJTMrUhwQw== X-Received: by 2002:a17:906:768e:b0:9b2:f38d:c44b with SMTP id o14-20020a170906768e00b009b2f38dc44bmr15198573ejm.24.1696930704086; Tue, 10 Oct 2023 02:38:24 -0700 (PDT) Received: from localhost (fwdproxy-cln-003.fbsv.net. [2a03:2880:31ff:3::face:b00c]) by smtp.gmail.com with ESMTPSA id a11-20020a17090640cb00b00977eec7b7e8sm8193626ejk.68.2023.10.10.02.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:38:21 -0700 (PDT) From: Breno Leitao To: jlbec@evilplan.org, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, Eric Dumazet , Jonathan Corbet Cc: hch@lst.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org, linux-doc@vger.kernel.org (open list:DOCUMENTATION) Subject: [PATCH net-next v3 4/4] Documentation: netconsole: add support for cmdline targets Date: Tue, 10 Oct 2023 02:37:51 -0700 Message-Id: <20231010093751.3878229-5-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010093751.3878229-1-leitao@debian.org> References: <20231010093751.3878229-1-leitao@debian.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org With the previous patches, there is no more limitation at modifying the targets created at boot time (or module load time). Document the way on how to create the configfs directories to be able to modify these netconsole targets. The design discussion about this topic could be found at: https://lore.kernel.org/all/ZRWRal5bW93px4km@gmail.com/ Signed-off-by: Breno Leitao --- Documentation/networking/netconsole.rst | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/netconsole.rst b/Documentation/networking/netconsole.rst index 7a9de0568e84..390730a74332 100644 --- a/Documentation/networking/netconsole.rst +++ b/Documentation/networking/netconsole.rst @@ -99,9 +99,6 @@ Dynamic reconfiguration: Dynamic reconfigurability is a useful addition to netconsole that enables remote logging targets to be dynamically added, removed, or have their parameters reconfigured at runtime from a configfs-based userspace interface. -[ Note that the parameters of netconsole targets that were specified/created -from the boot/module option are not exposed via this interface, and hence -cannot be modified dynamically. ] To include this feature, select CONFIG_NETCONSOLE_DYNAMIC when building the netconsole module (or kernel, if netconsole is built-in). @@ -155,6 +152,25 @@ You can also update the local interface dynamically. This is especially useful if you want to use interfaces that have newly come up (and may not have existed when netconsole was loaded / initialized). +Netconsole targets defined at boot time (or module load time) with the +`netconsole=` param are assigned the name `cmdline`. For example, the +first target in the parameter is named `cmdline0`. You can control and modify +these targets by creating configfs directories with the matching name. + +Let's suppose you have two netconsole targets defined at boot time:: + + netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc;4444@10.0.0.1/eth1,9353@10.0.0.3/12:34:56:78:9a:bc + +You can modify these targets in runtime by creating the following targets:: + + mkdir cmdline0 + cat cmdline0/remote_ip + 10.0.0.2 + + mkdir cmdline1 + cat cmdline1/remote_ip + 10.0.0.3 + Extended console: =================