From nobody Tue Oct 04 14:50:18 2022 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 4Mhgbt2BVYz4f24V; Tue, 4 Oct 2022 14:50:18 +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 4Mhgbt1jFsz3pnt; Tue, 4 Oct 2022 14:50:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664895018; 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=Jz56W9rgpblvfOH1/WI2fsfcOGpHTXjPnBJzNjoDVjQ=; b=Ey8VX6TYrStsuhDYWd6SL0fEf5EsesLEbq/HnIm0AeA8KhD9l3u207jzvU8NjJH5exmdwe UWQ1cINEA/zwff8+AmDAANdnEwj5NbBt4rsdiImJaMrszkEaCL2HNBo382GZ9sHREkGYdo qc/aZwa6JtOfI+ltZ9XUtwbliaObT2rmyhpLpQZMABTcpzaspulaKlhdEmZPC5JdjtjFnF haRjspP6yT2F0B/LVQB2r+2kfh1s6jfC6seOpZDHq5dH5R3AKUr/oLt5gKENtImTZ3UB5y boxeIjQQdbHzlvxLHCx2bKgFdaQtiXyRfG58qgiGosx1ZM5PlCs/t8NwUpM9Aw== 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 4Mhgbt0nC0zbMb; Tue, 4 Oct 2022 14:50:18 +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 294EoI03029240; Tue, 4 Oct 2022 14:50:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 294EoIGw029237; Tue, 4 Oct 2022 14:50:18 GMT (envelope-from git) Date: Tue, 4 Oct 2022 14:50:18 GMT Message-Id: <202210041450.294EoIGw029237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1bac84980682 - stable/13 - vt(4): Make sure vt_switch_timer() has a sleepable context. 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: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1bac849806827cda0872318c1b6a340b9ab14fa5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664895018; 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=Jz56W9rgpblvfOH1/WI2fsfcOGpHTXjPnBJzNjoDVjQ=; b=SCarjbhaZF8Paq3SAc28cWEkIVp+iTa2IgjXw3WbQx3Z/VIalJFGp92zIJyQXE+60p7+o8 e9V4rBfGJV/4cIo9EjviTtENHyjNniMTMPw2Paxx9phbw/m4PJuST0oLCYXz6zhCiIqr2Z Yz9/hPxWNymfo9N6FRpTV29nQNY4z6nymObUawgToYzKp7+XTrDQfvKhAXV+EkIN/9yn10 Nsp8+y2SNbD1a8s91Z7j5HglJgVIBuXYT7YgFaKyn2HezE5kUUsgy262d2SDQb7OnOQqs4 UQSpqJNTNcpgjAKD3Bu79aqV7RAS0UlL4/PsaptSIfv5MJjTlXF1HizUQpzH6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664895018; a=rsa-sha256; cv=none; b=WqeVsAi4voNI/RXgX35Z9138jPD4wk0FY+WimEjaWTYepGgKt7YSdmtn/9s8J3/kYmX5Cw Ht29ydRjXQsOZfW5wSO4NmOKQFes21iB7MFg7MpJ10IzdLldWpqaXRTeTFwcYgO2znQ9g3 cu/ALLQ5faKaLxW5SYqW+P+A5lNFs9WoRuSKuBuXV8AfSITkoln25UMcYqEeJ/APKdnKmo dpcng1oHITQn8kKuz40syAy10gux5hTsdQAPCHogaZv+bn/siN4DuLRsUe1J/NJjVgMaOp FrfvvzK3+wtZO5FbSWX03hrE7iYXo9rb4Y5iCcZp+0QdUoeGMhnmLORwIFiBfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1bac849806827cda0872318c1b6a340b9ab14fa5 commit 1bac849806827cda0872318c1b6a340b9ab14fa5 Author: Hans Petter Selasky AuthorDate: 2022-09-26 15:10:50 +0000 Commit: Hans Petter Selasky CommitDate: 2022-10-04 14:40:46 +0000 vt(4): Make sure vt_switch_timer() has a sleepable context. Fixes the following panic backtrace: panic() usbhid_sync_xfer() usbhid_set_report() hid_set_report() hidbus_write() hid_write() hkbd_set_leds() hkbd_ioctl_locked() hkbd_ioctl_locked() hkbd_ioctl() kbdmux_ioctl() vt_window_switch() vt_switch_timer() Differential Revision: https://reviews.freebsd.org/D36715 Sponsored by: NVIDIA Networking (cherry picked from commit 2cce9aa0785c438fa8b66bd230824f7460df14ac) --- sys/dev/vt/vt.h | 3 ++- sys/dev/vt/vt_core.c | 13 ++++++------- sys/dev/vt/vt_cpulogos.c | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index b4361f77317c..7305727804cf 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -48,6 +48,7 @@ #include #include #include +#include #include "opt_syscons.h" #include "opt_splash.h" @@ -306,7 +307,7 @@ struct vt_window { pid_t vw_pid; /* Terminal holding process */ struct proc *vw_proc; struct vt_mode vw_smode; /* switch mode */ - struct callout vw_proc_dead_timer; + struct timeout_task vw_timeout_task_dead; struct vt_window *vw_switch_to; int vw_bell_pitch; /* (?) Bell pitch */ sbintime_t vw_bell_duration; /* (?) Bell duration */ diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 85ab3d4cd73e..6c2039f22406 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -338,7 +338,7 @@ vt_suspend_flush_timer(struct vt_device *vd) } static void -vt_switch_timer(void *arg) +vt_switch_timer(void *arg, int pending) { (void)vt_late_window_switch((struct vt_window *)arg); @@ -442,8 +442,7 @@ vt_window_preswitch(struct vt_window *vw, struct vt_window *curvw) DPRINTF(40, "%s\n", __func__); curvw->vw_switch_to = vw; /* Set timer to allow switch in case when process hang. */ - callout_reset(&vw->vw_proc_dead_timer, hz * vt_deadtimer, - vt_switch_timer, (void *)vw); + taskqueue_enqueue_timeout(taskqueue_thread, &vw->vw_timeout_task_dead, hz * vt_deadtimer); /* Notify process about vt switch attempt. */ DPRINTF(30, "%s: Notify process.\n", __func__); signal_vt_rel(curvw); @@ -466,7 +465,7 @@ vt_late_window_switch(struct vt_window *vw) struct vt_window *curvw; int ret; - callout_stop(&vw->vw_proc_dead_timer); + taskqueue_cancel_timeout(taskqueue_thread, &vw->vw_timeout_task_dead, NULL); ret = vt_window_switch(vw); if (ret != 0) { @@ -2045,7 +2044,7 @@ finish_vt_rel(struct vt_window *vw, int release, int *s) if (vw->vw_flags & VWF_SWWAIT_REL) { vw->vw_flags &= ~VWF_SWWAIT_REL; if (release) { - callout_drain(&vw->vw_proc_dead_timer); + taskqueue_drain_timeout(taskqueue_thread, &vw->vw_timeout_task_dead); (void)vt_late_window_switch(vw->vw_switch_to); } return (0); @@ -2928,7 +2927,7 @@ vt_allocate_window(struct vt_device *vd, unsigned int window) terminal_set_winsize(tm, &wsz); vd->vd_windows[window] = vw; - callout_init(&vw->vw_proc_dead_timer, 1); + TIMEOUT_TASK_INIT(taskqueue_thread, &vw->vw_timeout_task_dead, 0, &vt_switch_timer, vw); return (vw); } @@ -2952,7 +2951,7 @@ vt_upgrade(struct vt_device *vd) vw = vt_allocate_window(vd, i); } if (!(vw->vw_flags & VWF_READY)) { - callout_init(&vw->vw_proc_dead_timer, 1); + TIMEOUT_TASK_INIT(taskqueue_thread, &vw->vw_timeout_task_dead, 0, &vt_switch_timer, vw); terminal_maketty(vw->vw_terminal, "v%r", VT_UNIT(vw)); vw->vw_flags |= VWF_READY; if (vw->vw_flags & VWF_CONSOLE) { diff --git a/sys/dev/vt/vt_cpulogos.c b/sys/dev/vt/vt_cpulogos.c index 7e0be12b3adb..4337c31e0054 100644 --- a/sys/dev/vt/vt_cpulogos.c +++ b/sys/dev/vt/vt_cpulogos.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include