Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Oct 2013 10:05:18 -0600
From:      Scott Long <scott4long@yahoo.com>
To:        sbruno@freebsd.org
Cc:        "FreeBSD-scsi@freebsd.org" <FreeBSD-scsi@freebsd.org>
Subject:   Re: pci_alloc_msi is always called, is this bad?
Message-ID:  <94C7BB39-A287-44D4-9992-E8DAE83CE6D4@yahoo.com>
In-Reply-To: <1380902209.2621.11.camel@localhost>
References:  <CAFMmRNzWwxe=YVJcC7Lkjqru5eugciwzEQHjgE-Bh-ctOykVNQ@mail.gmail.com> <20131003194704.GG41229@kib.kiev.ua> <1380902209.2621.11.camel@localhost>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
It used to be that gcc would generate code that would conditionally =
execute the second clause only if the first clause were true.  If that's =
not longer the case (with gcc and/or clang), then I bet that UDF will =
break due to this:

       /*
         * Check to see if the fid is fragmented. The first test
         * ensures that we don't wander off the end of the buffer
         * looking for the l_iu and l_fi fields.
         */
        if (ds->off + UDF_FID_SIZE > ds->size ||
            ds->off + le16toh(fid->l_iu) + fid->l_fi + UDF_FID_SIZE > =
ds->size){

=20
Scott

On Oct 4, 2013, at 9:56 AM, Sean Bruno <sean_bruno@yahoo.com> wrote:

> I was looking at the recent thread on -stable about mfi(4) and I noted
> that it appears, if I'm not mistaken, mfi_pci.c::pci_alloc_msi() is
> *always* invoked regardless of the mfi_msi tuneable.  We just ignore =
the
> allocated MSI by not setting sc->mfi_irq_rid.  Is that harmful?
>=20
> =
------------------------------------------------------------------------
> 240         /* Allocate IRQ resource. */
> 241         sc->mfi_irq_rid =3D 0;
> 242         count =3D 1;
> 243         if (mfi_msi && pci_alloc_msi(sc->mfi_dev, &count) =3D=3D =
0) {
> 244                 device_printf(sc->mfi_dev, "Using MSI\n");
> 245                 sc->mfi_irq_rid =3D 1;
> 246         }
>=20
>=20
> =
------------------------------------------------------------------------
> I would have thought that this would be more correct, avoid calling
> pci_alloc_msi() if mfi_msi isn't set in the first place.
> =
------------------------------------------------------------------------
> 	sc->mfi_irq_ird =3D 0;
> 	count =3D 1;
> 	ret =3D 0
> 	if(mfi_msi)
> 		ret =3D pci_alloc_msi(sc->mfi_dev, &count);
>=20
> 	if (!ret) {
> 		device_printf(sc->mfi_dev, "Using MSI\n");
> 		sc->mfi_irq_rid =3D 1;
> 	}
> =
------------------------------------------------------------------------
>=20
> Sean




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?94C7BB39-A287-44D4-9992-E8DAE83CE6D4>