From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Jonathan Cameron" <Jonathan.Cameron@Huawei.com>,
"Konstantin Aladyshev" <aladyshev22@gmail.com>
Cc: "Tomer Maimon" <tmaimon77@gmail.com>,
"Corey Minyard" <minyard@acm.org>,
"Patrick Venture" <venture@google.com>,
openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
"Tali Perry" <tali.perry1@gmail.com>,
"Avi Fishman" <avifishman70@gmail.com>,
"Eric Dumazet" <edumazet@google.com>,
netdev <netdev@vger.kernel.org>,
linux-aspeed@lists.ozlabs.org, "Joel Stanley" <joel@jms.id.au>,
"Jakub Kicinski" <kuba@kernel.org>,
"Jeremy Kerr" <jk@codeconstruct.com.au>,
"Matt Johnston" <matt@codeconstruct.com.au>,
"Paolo Abeni" <pabeni@redhat.com>,
openipmi-developer@lists.sourceforge.net,
"David Miller" <davem@davemloft.net>,
linux-arm-kernel@lists.infradead.org,
"Benjamin Fair" <benjaminfair@google.com>
Subject: Re: [PATCH 3/3] mctp: Add MCTP-over-KCS transport binding
Date: Tue, 03 Oct 2023 17:52:33 +1030 [thread overview]
Message-ID: <1fd97872-446e-42f3-84ad-6e490d63e12d@app.fastmail.com> (raw)
In-Reply-To: <20230929120835.0000108e@Huawei.com>
Hi Jonathan,
On Fri, 29 Sep 2023, at 20:38, Jonathan Cameron wrote:
> On Thu, 28 Sep 2023 15:30:09 +0300
> Konstantin Aladyshev <aladyshev22@gmail.com> wrote:
>
>> This change adds a MCTP KCS transport binding, as defined by the DMTF
>> specificiation DSP0254 - "MCTP KCS Transport Binding".
>> A MCTP protocol network device is created for each KCS channel found in
>> the system.
>> The interrupt code for the KCS state machine is based on the current
>> IPMI KCS driver.
>>
>> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
>
> Drive by review as I was curious and might as well comment whilst reading.
> Some comments seem to equally apply to other kcs drivers so maybe I'm
> missing something...
>
I doubt you're missing anything. I reworked the KCS stuff a while back to make it a bit more general. Prior to Konstantin's work here the subsystem lived in its own little dark corner and might have benefitted from broader review. Some of the concerns with Konstantin's work are likely concerns with what I'd done, which he probably used as a guide. For reference the rework series is here:
https://lore.kernel.org/all/20210608104757.582199-1-andrew@aj.id.au/
>> +
>> +static DEFINE_SPINLOCK(kcs_bmc_mctp_instances_lock);
>> +static LIST_HEAD(kcs_bmc_mctp_instances);
> As mentioned below, this seems to be only used to find some data again
> in remove. Lots of cleaner ways to do that than a list in the driver.
> I'd explore the alternatives.
Yeah, it's a little clumsy. I'll look into better ways to address the problem.
>
>> + if (!ndev) {
>> + dev_err(kcs_bmc->dev,
>> + "alloc_netdev failed for KCS channel %d\n",
>> + kcs_bmc->channel);
> No idea if the kcs subsystem handles deferred probing right, but in general
> anything called just in 'probe' routines can use dev_err_probe() to pretty
> print errors and also register any deferred cases with the logging stuff that
> lets you find out why they were deferred.
Let me see if there's work to do in the KCS subsystem to deal with deferred probing. I expect that there is.
>
>
>> + if (rc)
>> + goto free_netdev;
>> +
>> + spin_lock_irq(&kcs_bmc_mctp_instances_lock);
>> + list_add(&mkcs->entry, &kcs_bmc_mctp_instances);
>
> Add a callback and devm_add_action_or_reset() to unwind this as well.
I'll check the other KCS users as well.
>
>
>
>> + devm_kfree(kcs_bmc->dev, mkcs->data_in);
>> + devm_kfree(kcs_bmc->dev, mkcs->data_out);
>
> Alarm bells occur whenever an explicit devm_kfree turns up in
> except in complex corner cases. Please look at how devm based
> resource management works. These should not be here.
Ah, I think this was an oversight in how I reworked the drivers a while back. I changed the arrangement of the structures but retained the devm_* approach to resource management. Let me page the KCS stuff back in so I can clean that up.
>
> Also, remove_device should either do things in the opposite order
> to add_device, or it should have comments saying why not!
+1
>
>
>> + return 0;
>> +}
>> +
>> +static const struct kcs_bmc_driver_ops kcs_bmc_mctp_driver_ops = {
>> + .add_device = kcs_bmc_mctp_add_device,
>> + .remove_device = kcs_bmc_mctp_remove_device,
>> +};
>> +
>> +static struct kcs_bmc_driver kcs_bmc_mctp_driver = {
>> + .ops = &kcs_bmc_mctp_driver_ops,
>> +};
>> +
>> +static int __init mctp_kcs_init(void)
>> +{
>> + kcs_bmc_register_driver(&kcs_bmc_mctp_driver);
>> + return 0;
>> +}
>> +
>> +static void __exit mctp_kcs_exit(void)
>> +{
>> + kcs_bmc_unregister_driver(&kcs_bmc_mctp_driver);
>> +}
>
> Hmm. So kcs is a very small subsystem hence no one has done the usual
> module_kcs_driver() wrapper (see something like module_i2c_driver)
> for an example.
I'll probably deal with this in the course of the rest of the poking around.
Thanks for the drive-by comments!
Andrew
next prev parent reply other threads:[~2023-10-03 7:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 12:30 [PATCH 0/3] " Konstantin Aladyshev
2023-09-28 12:30 ` [PATCH 1/3] ipmi: Move KCS headers to common include folder Konstantin Aladyshev
2023-09-28 12:30 ` [PATCH 2/3] ipmi: Create header with KCS interface defines Konstantin Aladyshev
2023-09-28 12:30 ` [PATCH 3/3] mctp: Add MCTP-over-KCS transport binding Konstantin Aladyshev
2023-09-28 22:58 ` kernel test robot
2023-09-29 11:08 ` Jonathan Cameron
2023-10-02 14:41 ` Konstantin Aladyshev
2023-10-03 16:17 ` Jonathan Cameron
2023-10-03 7:22 ` Andrew Jeffery [this message]
2023-10-03 16:21 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1fd97872-446e-42f3-84ad-6e490d63e12d@app.fastmail.com \
--to=andrew@aj.id.au \
--cc=Jonathan.Cameron@Huawei.com \
--cc=aladyshev22@gmail.com \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jk@codeconstruct.com.au \
--cc=joel@jms.id.au \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeconstruct.com.au \
--cc=minyard@acm.org \
--cc=netdev@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=pabeni@redhat.com \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®