From nobody Thu Jun 11 23:56:35 2026 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 4gc0150mPvz6gwvy for ; Thu, 11 Jun 2026 23:56:41 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gc0146Glwz46n6 for ; Thu, 11 Jun 2026 23:56:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781222200; 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=Wg4sGvqK39QH+4HB3+KDqvxVME35lps/QpyaN4fpy2o=; b=TaFmCKEojr8vOslOwqkSJ5gh15xbCrGC32A6MmjzI+HzsG4dRT+ZxQIpAjhlFPCwQqktjg LuPrLMwXujS5gi3Q+njSTad7xWfliWfzbz5top8ehfPrh72Vtph4yi2sCk1qczcPwa5x2T 7Bb4DzLTf1JrMl5KzO3sEOnFIC0Viqi6B02fViKjANVitwJtFFHFzeU6PoMvsQ01CfntNa 8vFj21eLoX9r/Kd1+uz7N1uZSfUM1WdcsYzwyE1L9tGKvf7ABvTFsvRq04aH+eXqXgSYRc nTXRvJ+6tlhdGhroPE7fi4TdfjdspIvg9ydPXlLV/KOe2sIr7oznRKBT96MbeA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781222200; a=rsa-sha256; cv=none; b=TuogB/FgPG0yMsHQ9aVRotgXlc7CICtaDTyKHOvx3/QX3t7prryz8dvK1bLe1lygjaXorD 1mHo5h4O6+F9WBn4XYPMim43j65ZLDEDJVgaLFyyVpmcac5c/4jOE+o53bzJPK2UKf2Cc3 I+QHHkFUpQ0QwLmE0CQIomNmVTgXCqlnrMtnul/WyFKm8/mOsoUQyoJ2LdTZo6e1M6/NTX HWxL1QH9Qed38xgqqPXAVhjMKhjIIrRScZ/CjFrmqDVXItbgbm5yaWWZYY9WCiVpG9FSbh yCHaiiR5Li3Yaf8RTbhO52V5U3e+mrReLG5W3kIasDAoe3DZ/2B0rb8ffFyYug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781222200; 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=Wg4sGvqK39QH+4HB3+KDqvxVME35lps/QpyaN4fpy2o=; b=NdtK1HiFqg/h2AG3ysAd5/PUsWmXCvvZApQXwvJ/40n4bhdEifzDbv5l1BWo9lTs/+XP9g jjRT02dWaXPpuAFiJrzi4KamL/4aMkes0i+kOZLxqiGNtiwyo2erPkollsiNTq4mcmWnFD 878frTrYJOmzCwPiOBBbVLtR+vFHLTdzCEnAC4sRiD54XmmTHTvkgeWYegGWJEd7NVt3HF xmFhWwSiPEngv8qyFTdPdR3pbcl597tF12enpLTYIXAnfYQ68VrP3T3W/AhDqGbkRXWxX2 3FKkmelpSzzPmoG0YPtWTzK0PhjzjbqWXfrCDmnTL6YrE24tWnGZ+E8uv8ZGWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gc0145Fl7z1Bt0 for ; Thu, 11 Jun 2026 23:56:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f198 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 11 Jun 2026 23:56:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aleksandr Rybalko Subject: git: 1f68ca5802db - main - vt: Do not lock request comming from terminal 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ray X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f68ca5802db91bd9725bcdbf55932e104dbe95d Auto-Submitted: auto-generated Date: Thu, 11 Jun 2026 23:56:35 +0000 Message-Id: <6a2b4b33.3f198.77e2d1ed@gitrepo.freebsd.org> The branch main has been updated by ray: URL: https://cgit.FreeBSD.org/src/commit/?id=1f68ca5802db91bd9725bcdbf55932e104dbe95d commit 1f68ca5802db91bd9725bcdbf55932e104dbe95d Author: Aleksandr Rybalko AuthorDate: 2026-06-11 13:33:49 +0000 Commit: Aleksandr Rybalko CommitDate: 2026-06-11 23:56:03 +0000 vt: Do not lock request comming from terminal only those originated by mouse. Because the terminal surrounds requests to vt(4) with locking. Reported by: bz, adrian Reviewed by: adrian, glebius Approved by: glebius (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57442 --- sys/dev/vt/vt_buf.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c index 9b65a7cb889c..ec08967232f4 100644 --- a/sys/dev/vt/vt_buf.c +++ b/sys/dev/vt/vt_buf.c @@ -45,6 +45,7 @@ static MALLOC_DEFINE(M_VTBUF, "vtbuf", "vt buffer"); #define VTBUF_LOCK(vb) mtx_lock_spin(&(vb)->vb_lock) #define VTBUF_UNLOCK(vb) mtx_unlock_spin(&(vb)->vb_lock) +#define VTBUF_LOCK_OWNED(vb) mtx_owned(&(vb)->vb_lock) #define POS_INDEX(c, r) (((r) << 12) + (c)) #define POS_COPY(d, s) do { \ @@ -740,9 +741,19 @@ vtbuf_flush_mark(struct vt_buf *vb) area.tr_end.tp_col = vb->vb_scr_size.tp_col; area.tr_end.tp_row = MAX(s, e) + 1; - VTBUF_LOCK(vb); - vtbuf_dirty(vb, &area); - VTBUF_UNLOCK(vb); + /* + * If the request originates from a keyboard, the vtbuf is + * locked by teken for the entire duration of the request. + * For all other sources, we avoid holding the spinlock for + * extended periods. + */ + if (VTBUF_LOCK_OWNED(vb)) { + vtbuf_dirty(vb, &area); + } else { + VTBUF_LOCK(vb); + vtbuf_dirty(vb, &area); + VTBUF_UNLOCK(vb); + } } }