From owner-dev-commits-src-all@freebsd.org Thu Jul 8 06:44:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0A8A663EDB; Thu, 8 Jul 2021 06:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GL6Gw6Jj1z3M0G; Thu, 8 Jul 2021 06:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0E421C2BA; Thu, 8 Jul 2021 06:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1686iufZ002782; Thu, 8 Jul 2021 06:44:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1686iu9c002781; Thu, 8 Jul 2021 06:44:56 GMT (envelope-from git) Date: Thu, 8 Jul 2021 06:44:56 GMT Message-Id: <202107080644.1686iu9c002781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: a49f208d94b8 - main - intrng: Releasing interrupt source should clear interrupt table full state. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a49f208d94b873b2187adbfe1d785b3bc8bdc598 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 06:44:57 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=a49f208d94b873b2187adbfe1d785b3bc8bdc598 commit a49f208d94b873b2187adbfe1d785b3bc8bdc598 Author: Michal Meloun AuthorDate: 2021-07-02 18:17:36 +0000 Commit: Michal Meloun CommitDate: 2021-07-08 06:16:46 +0000 intrng: Releasing interrupt source should clear interrupt table full state. The first release of an interrupt in a situation where the interrupt table is full should schedule a full table check the next time an interrupt is allocated. A full check is necessary to ensure maximum separation between the order of allocation and the order of release. Submitted by: ehem_freebsd@m5p.com (initial version) Discussed in: https://reviews.freebsd.org/D29310 MFC after: 4 weeks --- sys/kern/subr_intr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index df6bf9e63ba0..d4926b2e2364 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -447,6 +447,16 @@ isrc_free_irq(struct intr_irqsrc *isrc) irq_sources[isrc->isrc_irq] = NULL; isrc->isrc_irq = INTR_IRQ_INVALID; /* just to be safe */ + + /* + * If we are recovering from the state irq_sources table is full, + * then the following allocation should check the entire table. This + * will ensure maximum separation of allocation order from release + * order. + */ + if (irq_next_free >= intr_nirq) + irq_next_free = 0; + return (0); }