From nobody Fri Apr 14 14:00:57 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 4PydQL3BXZz45JYH; Fri, 14 Apr 2023 14:00:58 +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 4PydQK5FTfz3K83; Fri, 14 Apr 2023 14:00:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681480857; 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=wPeS6QLjdiiWAYRw56h0cpNweQ0dlCts4GuaySWWvVc=; b=P2szy5fk66qRTUjYLbMATQsFW+Ia7byUNJo5zmwOVpNwxiUfnlb5B0iOZe68GAKebo5GG7 ySGvacW4EsFCDH1/neilv1eO7pVL9XAaHSLINeMLyGtSczFesLGWT+5m75cjSMthmVAGsZ wUSR/Wnal04NiwQJFrB7dFPwNjlpD3/8YUDDz/aM7tw5N4KBN+IwiA/G3IRrMN1EkiAZXK +N5j1ksZKKIqTA/Nh/TVXsC4foJ/hWMO1vk8WBuG7TJJCzAfUTDSgEsVJzTFcUnzxY/JS3 7fS7aodJ46dKblOCCz8ejTc/0D8W9FyLs1jF6g+mSQAZgET08cZo4n5NwRfKKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681480857; 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=wPeS6QLjdiiWAYRw56h0cpNweQ0dlCts4GuaySWWvVc=; b=F3uGZpapWaeRWMqng+xlYnoDxEVGgZncMqMkn852swL/y/ovXHr5LhpkUmhPJrU/gr3D7o hUT+zgMtJSKS8/K2zO8wCmnhtYmgYxAho2zLk+JRQp3ws0Bt34X2G9bHtKMOQatv9J8aG2 Otb6zmauuTIAq4L03+ZyXhZ/2DSqFF3du3JOw/T8cv1nnYWairfeAer1nLqYwxGxhYXAHJ Izkurf+f1HHNB335S+ZbNzkN0f7MVlFVLhiTH8wlWSqNXv89uaRWWJPxiOVaEJ3zQ5Vubs 4m39EwRcEXjyt6/c70YnCUNaU4tBzaVmxC1YGbzRVHVHmxgOXXgwJjlCa2W/pg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681480857; a=rsa-sha256; cv=none; b=et6wvOnHXN+LkTYXHx+UxHeLvlPKF7CTIhGbUOfOl+1I9TyQCRJeDOxT3zBljoOt2rc4O7 q3uab5OgN/mGEHZxcaemQ8jhLReb7UjOORxEUE6+sn/DwNrceFeDlzKzxS3CMp9/2wZ665 JCdPTptfDtVybdVcmZtVgYMj92xW7R9mYCr6tnlbbZl9Ig60p7/lWtHI2hUQUSv4upTWSl PoexzkymS3fFRKNZK7z+hBug6xS1iwoBwGGR5xk/ycdkldPm4HZy3gODCzOhp+5QdlGcLX SjpQSaCjj48qoSd+9eLsKS8l8OLRuv9Bf5+T/+fTbb1tQWB86P1knHGZGekMUQ== 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 4PydQK4MYyzRlk; Fri, 14 Apr 2023 14:00:57 +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 33EE0vGj083802; Fri, 14 Apr 2023 14:00:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33EE0vDU083801; Fri, 14 Apr 2023 14:00:57 GMT (envelope-from git) Date: Fri, 14 Apr 2023 14:00:57 GMT Message-Id: <202304141400.33EE0vDU083801@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: 2794893ebff0 - main - xen/intr: do full xenisrc initialization during binding 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: 2794893ebff0c0cab62692fdf07b8632bcfe4d35 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=2794893ebff0c0cab62692fdf07b8632bcfe4d35 commit 2794893ebff0c0cab62692fdf07b8632bcfe4d35 Author: Elliott Mitchell AuthorDate: 2021-05-14 04:36:02 +0000 Commit: Roger Pau Monné CommitDate: 2023-04-14 13:58:51 +0000 xen/intr: do full xenisrc initialization during binding Keeping released xenisrcs in a known state simplifies allocation, but forces the allocation function to maintain that state. This turns into a problem when trying to allow for interchangeable allocation functions. Fix this issue by ensuring xenisrcs are always *fully* initialized during binding. Reviewed by: royger --- sys/x86/xen/xen_intr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index b3996e6cf1aa..1bfe941bc67b 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -406,10 +406,6 @@ xen_intr_release_isrc(struct xenisrc *isrc) /* not reachable from xen_intr_port_to_isrc[], unlock */ mtx_unlock(&xen_intr_isrc_lock); - isrc->xi_cpu = 0; - isrc->xi_port = INVALID_EVTCHN; - isrc->xi_cookie = NULL; - mtx_lock(&xen_intr_x86_lock); isrc->xi_type = EVTCHN_TYPE_UNBOUND; mtx_unlock(&xen_intr_x86_lock); @@ -456,8 +452,11 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port, isrc = xen_intr_alloc_isrc(type); if (isrc == NULL) return (ENOSPC); + + isrc->xi_cookie = NULL; isrc->xi_port = local_port; isrc->xi_close = false; + isrc->xi_cpu = 0; refcount_init(&isrc->xi_refcount, 1); mtx_lock(&xen_intr_isrc_lock); xen_intr_port_to_isrc[isrc->xi_port] = isrc;