From: Serge Semin <fancer.lancer@gmail.com>
To: Logan Gunthorpe <lsgunthorpe@gmail.com>
Cc: linux-ntb <linux-ntb@googlegroups.com>
Subject: Re: [PATCH v4] NTB: Add IDT 89HPESxNTx PCIe-switches support
Date: Tue, 7 Mar 2017 18:09:26 +0300 [thread overview]
Message-ID: <20170307150926.GA7149@mobilestation> (raw)
In-Reply-To: <26e320d1-392c-ee60-440c-e293d7dc86bc@gmail.com>
On Mon, Mar 06, 2017 at 08:27:49PM -0700, Logan Gunthorpe <lsgunthorpe@gmail.com> wrote:
>
>
> On 06/03/17 06:57 PM, Serge Semin wrote:
> > Agreed. Replaced with traditional dev_*() methods.
>
> You should also be printing using the ntb's device and not the parent
> device. ie use:
>
> ndev->ntb.dev
>
> instead of
>
> ndev->ntb.pdev->dev
>
No I shouldn't. The thing is, that NTB API has two levels of drivers: client
and hardware drivers. IDT NTB driver you are reviewing is hardware driver, it
refers to the actual PCIe-device and is responsible for communications with it.
The client drivers use NTB API abstraction and common facilities it exposes to
implement some user-available functionality. They communicate with NTB devices
registered by the hardware drivers. So to speak the client drivers work with
ndev->ntb.dev, but the hardware drivers - with ndev->ntb.pdev->dev. That's why
it is necessary to separate the logs of these two levels.
>
> > It's obvious, to prevent a race condition of access to the Mapping table, which
> > is implemented by Address and Data registers set.
> > For the same reason the driver have spin lock to protect an access to the
> > Global Switch registers using GASA-ADDR and GASA-DATA.
>
> Ah, I see. Perhaps these should be in their own function in the same way
> as the gasa functions? It would probably be a bit clearer.
>
I would rather leave it as is. It's just two lines of code, which are present
just at one place of the driver.
> > Kind of funny. You've sent some comments about devres methods usage, but
> > suspected a memory leak at the moment where it's actually used. So take a look
> > at the place of "ndev" structure allocation, and you'll find an answer.
>
> Ah sorry, I missed that. Usually I expect to see the structure free'd by
> the release function on the device. But NTB is a little odd in that regard.
>
It's not NTB, but in general devres isn't that wide spread in the kernel drivers,
since the technology is pretty new. Most of drivers developers are just used to
do allocations/enables and deallocations/disables/releases manually in the code.
Although it's really handy to get being familiar with devres methods.
> Also, per section 8 of the Linux style guide[1], IMO this code is pretty
> over commented.
>
> Logan
>
>
> [1] https://static.lwn.net/kerneldoc/process/coding-style.html#commenting
-Sergey
next prev parent reply other threads:[~2017-03-07 15:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 21:37 [PATCH] NTB: Add IDT 89HPESxNTx PCIe-switches support Serge Semin
2017-02-02 18:10 ` Allen Hubbe
2017-02-20 21:33 ` [PATCH v2] " Serge Semin
2017-02-21 22:42 ` Allen Hubbe
2017-02-22 11:01 ` Serge Semin
2017-02-24 10:49 ` [PATCH v3] " Serge Semin
2017-02-24 16:01 ` Allen Hubbe
2017-02-27 9:22 ` [PATCH v4] " Serge Semin
2017-03-01 16:30 ` Jon Mason
2017-03-03 6:38 ` lsgunthorpe
2017-03-07 1:57 ` Serge Semin
2017-03-07 3:27 ` Logan Gunthorpe
2017-03-07 15:09 ` Serge Semin [this message]
2017-03-07 17:00 ` Logan Gunthorpe
2017-03-07 2:02 ` [PATCH v5] " Serge Semin
2017-03-08 18:01 ` Jon Mason
2017-03-08 20:29 ` [PATCH v6] " Serge Semin
2017-04-12 12:44 ` [PATCH v7] " Serge Semin
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=20170307150926.GA7149@mobilestation \
--to=fancer.lancer@gmail.com \
--cc=linux-ntb@googlegroups.com \
--cc=lsgunthorpe@gmail.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