lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Jan 2020 12:26:01 -0800
From:   Bobby Jones <rjones@...eworks.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Sunil Goutham <sgoutham@...vell.com>,
        Robert Richter <rrichter@...vell.com>,
        David Miller <davem@...emloft.net>,
        "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>, netdev@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Tim Harvey <tharvey@...eworks.com>
Subject: Re: [PATCH net] net: thunderx: workaround BGX TX Underflow issue

On Thu, Jan 30, 2020 at 9:10 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Wed, 29 Jan 2020 14:36:09 -0800, Robert Jones wrote:
> > From: Tim Harvey <tharvey@...eworks.com>
> >
> > While it is not yet understood why a TX underflow can easily occur
> > for SGMII interfaces resulting in a TX wedge. It has been found that
> > disabling/re-enabling the LMAC resolves the issue.
> >
> > Signed-off-by: Tim Harvey <tharvey@...eworks.com>
> > Reviewed-by: Robert Jones <rjones@...eworks.com>
>
> Sunil or Robert (i.e. one of the maintainers) will have to review this
> patch (as indicated by Dave by marking it with "Needs Review / ACK" in
> patchwork).
>
> At a quick look there are some things which jump out at me:
>
> > +static int bgx_register_intr(struct pci_dev *pdev)
> > +{
> > +     struct bgx *bgx = pci_get_drvdata(pdev);
> > +     struct device *dev = &pdev->dev;
> > +     int num_vec, ret;
> > +
> > +     /* Enable MSI-X */
> > +     num_vec = pci_msix_vec_count(pdev);
> > +     ret = pci_alloc_irq_vectors(pdev, num_vec, num_vec, PCI_IRQ_MSIX);
> > +     if (ret < 0) {
> > +             dev_err(dev, "Req for #%d msix vectors failed\n", num_vec);
> > +             return 1;
>
> Please propagate real error codes, or make this function void as the
> caller never actually checks the return value.
>
> > +     }
> > +     sprintf(bgx->irq_name, "BGX%d", bgx->bgx_id);
> > +     ret = request_irq(pci_irq_vector(pdev, GMPX_GMI_TX_INT),
>
> There is a alloc_irq and request_irq call added in this patch but there
> is never any freeing. Are you sure this is fine? Devices can be
> reprobed (unbound and bound to drivers via sysfs).

I agree there needs to be accompanying free calls. I'm referencing
drivers/net/ethernet/cavium/thunder/nic_main.c and see instances of
both pci_free_irq_vectors() and free_irq(). My initial thought was
that I should use pci_free_irq_vectors() in the error check
conditional of the above request irq and also in the bgx_remove()
function. Would that be appropriate in this case?

I'd also plan on using a conditional like this for the free calls:

if (bgx->irq_name)
    pci_free_irq_vectors(pdev);

I'm new to kernel development so suggestions are welcome.

>
> > +             bgx_intr_handler, 0, bgx->irq_name, bgx);
>
> Please align the continuation line with the opening bracket (checkpatch
> --strict should help catch this).
>
> > +     if (ret)
> > +             return 1;
> > +
> > +     return 0;
> > +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ