Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1772566rdg; Sat, 14 Oct 2023 17:55:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFB2t5oA2nWaiubMxp6Gjqg/3bIZoCvk8fZa1mTxCnjGllNJEmvThnGhUVyaflaZHDIlICc X-Received: by 2002:a05:6a20:4290:b0:162:ee29:d3c0 with SMTP id o16-20020a056a20429000b00162ee29d3c0mr38461039pzj.42.1697331353315; Sat, 14 Oct 2023 17:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697331353; cv=none; d=google.com; s=arc-20160816; b=sqcZsmDLW+qiqOB0dH9poDq2Ij6ab6hSFcRmzn356HgdXi3wD/IRxPqMjkku8/wKJI pI/8PsxSnubkbjCddqObBuZV7vhuOYvcqtnmTsGtiK8tNq+n6/Ne0Bqa16W22O4NlclS 5r5CFI89z8eud7UVCIneoAyCr/dWlSHK8ZWHMqHuzGnEd/0PXlT2qr+CD/+cJntLq0sx GiJOExwaiMTlG+qRx4c2273yWDNSnPxyYKwAkGQjf99l0kJPPQY/dsXc7P/2dcw2eE+J WbkgbtkMTbVNncJsPLWWYIAsMRLZ8t7rOswav6AFRIUk75Q+VxoGjrF3jM3o435E+RU1 PKKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=uAzEWPlAFbI+/fsmaBKX8Evs419Pr/qqscJnwH/iIs8=; fh=tdgJDcMEMk0ZJAcPsr5CWaTtgA3Ce8/hJz5lncKLUck=; b=PbeNlusyGlsHM3wUivz5tR+RG3iyaP9WgUG6EPY/myu86zH+gqrlubjMz6XsR4OdUQ djGpEa31eZng2Jow8xq3VbG842SJJrHKL5XWVjSkTvMv7pUyKb4ERhZdbwaT5vyoE5Nc HeWD+3lMLpwdoeh3NrC3pkpORRPg5XQoU+TQctZ/m4OsMaZHve+BIMtweGBkwiqmTQiF HFRcCctunDxgwCC2WxWsGz/cQf1XWgHsdHU4cSWI6uO+n51cayKpgkcFgYLwshwab3bT tNmG8LxiAGdaxrmV/5t/C4ZH2M43wY5vkEj7cPCr67A+ZdZsgF6E1g0SEGI1v5IDs0vp ryfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@infradead.org header.s=zeniv-20220401 header.b=d0woM+J5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x5-20020a654145000000b00578afd89ba6si7233623pgp.457.2023.10.14.17.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 17:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@infradead.org header.s=zeniv-20220401 header.b=d0woM+J5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id AE6B1804BC39; Sat, 14 Oct 2023 17:55:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232947AbjJOAz0 (ORCPT + 99 others); Sat, 14 Oct 2023 20:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbjJOAz0 (ORCPT ); Sat, 14 Oct 2023 20:55:26 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EE0CCC; Sat, 14 Oct 2023 17:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uAzEWPlAFbI+/fsmaBKX8Evs419Pr/qqscJnwH/iIs8=; b=d0woM+J55qDqjJ1yABgFrsVnsR 1VtkjUnmUIsUx9gOna03H0aiRUVr237NSfBV+2FSvxgDmGVi4bCvdXZkqFXoQElWDHjovK73UlLYl ZPpcKXrpU34AKeoQ4yly9TtviEdwKiisWqHRmM+9CpgVU25jng3t2fdRcZAIhTRjSndtpSQ1yhwzu bTx9nNLURWqATdLs5rQvPBrC8mSggNsSJ3iYOT9VlIb9iCj3zRw+t9Jg2w1ifOOwkWndmY1gE1MwJ QgcoD/Lrs5T94mVhFHTWQ0lTBIcrwqOo5NCBEjCXa7YewUAEiMltcf0M0RjTcgtmJP4wFPz48wGqI rmH/ztaw==; Received: from jlbec by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1qrpPT-001Key-1W; Sun, 15 Oct 2023 00:55:11 +0000 Date: Sat, 14 Oct 2023 17:55:08 -0700 From: Joel Becker To: Breno Leitao Cc: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, Eric Dumazet , hch@lst.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org Subject: Re: [PATCH net-next v4 3/4] netconsole: Attach cmdline target to dynamic target Message-ID: Mail-Followup-To: Breno Leitao , kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, Eric Dumazet , hch@lst.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org References: <20231012111401.333798-1-leitao@debian.org> <20231012111401.333798-4-leitao@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231012111401.333798-4-leitao@debian.org> X-Burt-Line: Trees are cool. X-Red-Smith: Ninety feet between bases is perhaps as close as man has ever come to perfection. Sender: Joel Becker X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 14 Oct 2023 17:55:51 -0700 (PDT) On Thu, Oct 12, 2023 at 04:14:00AM -0700, Breno Leitao wrote: > 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 Reviewed-by: Joel Becker > --- > drivers/net/netconsole.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c > index e153bce4dee4..6e14ba5e06c8 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_PREFIX, > + strlen(NETCONSOLE_PARAM_TARGET_PREFIX))) { > + nt = find_cmdline_target(name); > + if (nt) > + return &nt->item; > + } > + > nt = alloc_and_init(); > if (!nt) > return ERR_PTR(-ENOMEM); > -- > 2.34.1 > -- "Nobody loves me, Nobody seems to care. Troubles and worries, people, You know I've had my share." http://www.jlbec.org/ jlbec@evilplan.org