Date: Thu, 19 Apr 2018 08:59:32 -0700 From: Eric Joyner <erj@erj.cc> To: John Baldwin <jhb@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332735 - head/sys/x86/x86 Message-ID: <CAKdFRZgd9Tqn7BhkK_F5PuCKpOiPBJgJ89vbCZd15eqjp1nPsA@mail.gmail.com> In-Reply-To: <201804181845.w3IIjYdt037258@repo.freebsd.org> References: <201804181845.w3IIjYdt037258@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Is the limit going to be increased at some point? Is there a true limit somewhere? On Wed, Apr 18, 2018 at 11:45 AM, John Baldwin <jhb@freebsd.org> wrote: > Author: jhb > Date: Wed Apr 18 18:45:34 2018 > New Revision: 332735 > URL: https://svnweb.freebsd.org/changeset/base/332735 > > Log: > Fix two off-by-one errors when allocating MSI and MSI-X interrupts. > > x86 enforces an (arbitray) limit on the number of available MSI and > MSI-X interrupts to simplify code (in particular, interrupt_source[] > is statically sized). This means that an attempt to allocate an MSI > vector needs to fail if it would go beyond the limit, but the checks > for exceeding the limit had an off-by-one error. In the case of MSI-X > which allocates interrupts one at a time this meant that IRQ 768 kept > getting handed out multiple times for msix_alloc() instead of failing > because all MSI IRQs were in use. > > Tested by: lidl > MFC after: 1 week > > Modified: > head/sys/x86/x86/msi.c > > Modified: head/sys/x86/x86/msi.c > ============================================================ > ================== > --- head/sys/x86/x86/msi.c Wed Apr 18 18:45:04 2018 (r332734) > +++ head/sys/x86/x86/msi.c Wed Apr 18 18:45:34 2018 (r332735) > @@ -404,7 +404,7 @@ again: > /* Do we need to create some new sources? */ > if (cnt < count) { > /* If we would exceed the max, give up. */ > - if (i + (count - cnt) > FIRST_MSI_INT + NUM_MSI_INTS) { > + if (i + (count - cnt) >= FIRST_MSI_INT + NUM_MSI_INTS) { > mtx_unlock(&msi_lock); > free(mirqs, M_MSI); > return (ENXIO); > @@ -645,7 +645,7 @@ again: > /* Do we need to create a new source? */ > if (msi == NULL) { > /* If we would exceed the max, give up. */ > - if (i + 1 > FIRST_MSI_INT + NUM_MSI_INTS) { > + if (i + 1 >= FIRST_MSI_INT + NUM_MSI_INTS) { > mtx_unlock(&msi_lock); > return (ENXIO); > } > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKdFRZgd9Tqn7BhkK_F5PuCKpOiPBJgJ89vbCZd15eqjp1nPsA>