From owner-svn-src-all@freebsd.org Thu Apr 19 15:59:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9F45F88475 for ; Thu, 19 Apr 2018 15:59:33 +0000 (UTC) (envelope-from erj@erj.cc) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6136D750D5 for ; Thu, 19 Apr 2018 15:59:33 +0000 (UTC) (envelope-from erj@erj.cc) Received: by mail-io0-x230.google.com with SMTP id f22-v6so5078860ioc.11 for ; Thu, 19 Apr 2018 08:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=erj.cc; s=ericroxx; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Nh5svpCAyWQDLvkL7pTrP/KQ3+iUeRxam0pCOv61b4E=; b=MYi2H4Uu1ukQScIQ7Xhvf0BgRhAKOQL+JltjtWlQXRk9jQv+FXiYUNIjADvjF3kV48 L5WnFgfmWqXi1cV6dqH0JqQj/i72/ikMmm6Q8UgfwK/YD84vJ7Z1zmaU9STqZBdv3SLt 4kbYnRy0J24pkilQsoulonhaAk9exfDAWzvNU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Nh5svpCAyWQDLvkL7pTrP/KQ3+iUeRxam0pCOv61b4E=; b=nu0HeE6VQiZAr+e1NgscGvwOphD2WpX1s4PshfgeLAneFxbtqbTgDPjqz4iAGtWn5H k/u2/cuxzUxHseHzoziEYoKDuuj4Onky0HjMGkoXQDScrzVok40IgeYG7nr/RJ5lWCFM voBaRSOGe0evY75YFzkjaLxH656oFHfkeELXYZXcecWCbiJiHdMDyso+E9w1TE1K9RAE XNPqZZE8WvhLhbUl6n5MNrI0N6vStg3UGxXK1Nf2VX1luNVPpkAyJv1i7wCpnPkZcNuD 68adMdQyw/rEcqbHUlj6rKqHhPEe84+CMXDedqD7V6F0quElWJ5lJkt1SLflD55Wap3A 4a5Q== X-Gm-Message-State: ALQs6tDTU5kVVwSUoWaRz3eWGX1wDCHWpPM2wwXhb9pWIjIQSQ+5a9oO hZJV3WP34KIGoK4puHLEdnxvJL2xKwr75h9cRPgc0g== X-Google-Smtp-Source: AB8JxZrdHB4vQ/0hm5neqLiko1suvJQtaHBcCVUvYJ06AplFg76SDGGV6m4xPwYL+t8uwoE2tkcewlDXfv5FUqjkbE0= X-Received: by 2002:a6b:8d55:: with SMTP id p82-v6mr6811427iod.57.1524153572686; Thu, 19 Apr 2018 08:59:32 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:8386:0:0:0:0:0 with HTTP; Thu, 19 Apr 2018 08:59:32 -0700 (PDT) In-Reply-To: <201804181845.w3IIjYdt037258@repo.freebsd.org> References: <201804181845.w3IIjYdt037258@repo.freebsd.org> From: Eric Joyner Date: Thu, 19 Apr 2018 08:59:32 -0700 Message-ID: Subject: Re: svn commit: r332735 - head/sys/x86/x86 To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2018 15:59:34 -0000 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 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); > } > >