From nobody Fri Apr 14 14:00:54 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PydQG4fqKz45JMg; Fri, 14 Apr 2023 14:00:54 +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 4PydQG2zHlz3K0L; Fri, 14 Apr 2023 14:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681480854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HEBOpzShBo8yTP35n7SefImR94de8qnDYnxnni6twCg=; b=fm8gBiFaAy3WwYAlSNKQZlIiRkMjI+pUmEO+I8avxjQwvb7PYjOrkAPVFSNm3NBDCoI2Wl edmMRr6+DnCl+CzyLhN2oGh1xlFqQWdHaEUsJDi5EXWJ+3Br5SUuSvqR4WNvmRoCsoARAi dj2/LehPDQ3JPWHOk8rbZi7+LWNae7i3JQxz8GsNr2P9sDbq5y1goPemf5aJQjJa3EQKwF DJCRnJOecaENMJa27xHoVWYzqzO07ksuBBI0VUU0hkYdQ/GlURvqFnjoepO0VkAQ4XXhw+ lYJe0qxaJ48Dk+Fuo2HBGqfdxhwXf3jVjsWMNaMeTur9zUbmf7th/dtgNNZK1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681480854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HEBOpzShBo8yTP35n7SefImR94de8qnDYnxnni6twCg=; b=AEkagkWPdavJCqoMdGTf18AVHUSPIOJohRhW5nGqdCJgHGA0L36obG6y6CKockIm8MQ7ZV TiTAXo555Pic4EZn6mh9fZ88maOcExzrPrfBcRzj96gwmrS6RCZ+aK5SWpyOCYyz/1f5js /BzV3fzT3j8aMxZ8bhFdGnYPqYys6JiRgdMqwfDMkPLAiWFCRSrJ1l+Wg5JcuIDA1Mo3b8 K09nqW3Z2NGe3blITKAhz2LU1VN8HtJRTyWmb23EpmkwC15Q7R6g0qZmDa2eFl7UWKQkcc 2N8fxPDRdQC61s1GmRhD1nmhxNCd/pgol06YGENlR76bcl0yU+sNTJLR+QU9nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681480854; a=rsa-sha256; cv=none; b=oRiLLBE47/u5i4cDLuH7ygJIF3BgDKZscH7iAkABCNEJJa3KyiRvhBHsrfy4oOobJDcmbD ZO/4BgbbGDtu+oMa0/xqFygzt6jyk+Bkp7hhFof2bTmERFw4+nr2yD+ne0K2JlzIflrtzB uaiD06VH1fdIgKS7vT6Fnrv0/Pja5MHHPu/PLjrkp3SR1Kz0T8Ct0v3edrJRd/QjdwdOzQ WCudyoEWDErcp5S9vKQuKGkczZc/jx1Z+64ogEfvEy1M2208VDg0wPlPLmGknq7QZIY4u8 fdGod0lAWtEke1x+oFMyu6Z6IHbPWm0NIFpu8ezruMYFy8sxsNu/nJ8zug+gKA== 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 4PydQG1yWjzRgx; Fri, 14 Apr 2023 14:00:54 +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 33EE0sQC083722; Fri, 14 Apr 2023 14:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33EE0sMb083721; Fri, 14 Apr 2023 14:00:54 GMT (envelope-from git) Date: Fri, 14 Apr 2023 14:00:54 GMT Message-Id: <202304141400.33EE0sMb083721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Roger=20Pau=20Monn=C3=A9?= Subject: git: 09bd542d17c9 - main - xen/intr: rework xen_intr_alloc_isrc() call structure List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09bd542d17c938b236822d1dd09ef0bab8c1de04 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=09bd542d17c938b236822d1dd09ef0bab8c1de04 commit 09bd542d17c938b236822d1dd09ef0bab8c1de04 Author: Elliott Mitchell AuthorDate: 2021-05-11 19:05:03 +0000 Commit: Roger Pau Monné CommitDate: 2023-04-14 13:58:49 +0000 xen/intr: rework xen_intr_alloc_isrc() call structure The call structure around xen_intr_alloc_isrc() was rather awful. Notably finding a structure for reuse is part of allocation, but this was done outside xen_intr_alloc_isrc(). Move this into xen_intr_alloc_isrc() so the function handles all allocation steps. Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D30726 --- sys/x86/xen/xen_intr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index c1ca984bf6ef..6e4b1d9df1f8 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -318,6 +318,10 @@ xen_intr_alloc_isrc(enum evtchn_type type) int error; KASSERT(mtx_owned(&xen_intr_isrc_lock), ("Evtchn alloc lock not held")); + isrc = xen_intr_find_unused_isrc(type); + if (isrc != NULL) { + return (isrc); + } if (xen_intr_auto_vector_count >= NR_EVENT_CHANNELS) { if (!warned) { @@ -424,13 +428,10 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port, *port_handlep = NULL; mtx_lock(&xen_intr_isrc_lock); - isrc = xen_intr_find_unused_isrc(type); + isrc = xen_intr_alloc_isrc(type); if (isrc == NULL) { - isrc = xen_intr_alloc_isrc(type); - if (isrc == NULL) { - mtx_unlock(&xen_intr_isrc_lock); - return (ENOSPC); - } + mtx_unlock(&xen_intr_isrc_lock); + return (ENOSPC); } isrc->xi_port = local_port; isrc->xi_close = false;