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] [day] [month] [year] [list]
Date:	Tue, 14 Jan 2014 10:31:46 -0700
From:	Bjorn Helgaas <bhelgaas@...gle.com>
To:	Alexander Gordeev <agordeev@...hat.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Tejun Heo <tj@...nel.org>,
	"linux-ide@...r.kernel.org" <linux-ide@...r.kernel.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>
Subject: Re: [PATCH 3/7] ahci: Use new interfaces for MSI/MSI-X enablement

On Tue, Jan 14, 2014 at 1:50 AM, Alexander Gordeev <agordeev@...hat.com> wrote:
> On Mon, Jan 13, 2014 at 12:12:20PM -0700, Bjorn Helgaas wrote:
>> > -   nvec = rc;
>> > -   rc = pci_enable_msi_block(pdev, nvec);
>> > -   if (rc)
>> > +   if (pci_enable_msi_range(pdev, nvec, nvec) < 0)
>> >             goto intx;
>> >
>> >     return nvec;
>> >
>> >  single_msi:
>> > -   rc = pci_enable_msi(pdev);
>> > -   if (rc)
>> > +   if (pci_enable_msi_range(pdev, 1, 1) < 0)
>>
>> This part doesn't seem like an improvement.  There are a hundred or so
>> callers of pci_enable_msi() that only want a single MSI.  Is there any
>> benefit in changing them to use pci_enable_msi_range()?
>
> In this particular case it reads better to me as one sees on the screen
> pci_enable_msi_range(pdev, nvec, nvec) and pci_enable_msi_range(pdev, 1, 1)
> calls. That allows to avoid switching in mind between negative-or-positive
> return in the former call and negative-or-zero return from pci_enable_msi()
> if we had it.
>
> But in most cases when single MSI is enabled we do cause complication
> with the patterns below (which I expect I am going be hated for ;) ):

I don't want to touch those hundred pci_enable_msi() callers at all.
So I think we should have something like this:

    /* Return 0 for success (one MSI enabled) or negative errno */
    static inline int pci_enable_msi(struct pci_dev *dev)
    {
        int rc;

        rc = pci_enable_msi_range(pdev, 1, 1);
        if (rc == 1)
            return 0;
        return rc;
    }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ