From nobody Wed Dec 15 04:00:24 2021 X-Original-To: dev-commits-src-branches@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 1E7C118DA698; Wed, 15 Dec 2021 04:00:26 +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 4JDM3F13B3z4t1M; Wed, 15 Dec 2021 04:00:25 +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 BC52A15530; Wed, 15 Dec 2021 04:00:24 +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 1BF40O8f002943; Wed, 15 Dec 2021 04:00:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BF40Ox5002942; Wed, 15 Dec 2021 04:00:24 GMT (envelope-from git) Date: Wed, 15 Dec 2021 04:00:24 GMT Message-Id: <202112150400.1BF40Ox5002942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 98a6200ee248 - stable/13 - mca: Switch to using taskqueue_enqueue_timeout_sbt(). List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 98a6200ee2482f2f3c73d6d8b8814db2447f7e33 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639540825; 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=ZetNeA0PSW7X9fWv75zNCGkW9AtH567qC1xkbhRKhwQ=; b=ESypdnyT0vsyC9YAyeZh4E740EEruG7LfQp/d05UFWnM3+B/k/IX9p9ac649rb5ZpXIUjl WHrznV8VadhwE1uQXkyYNTKBiywZ5ly4bWEYVeeD16zWbpbVzCzoSqzJb0bw04EMV0kHcW e4FA1WJQWEkP4MZed+asezLqaCisHiwwdy//gQ7nC3XHmUHG42gk5wIuWy825AWKA7cLMy V0/bZwMWqnE0x/it3Ut+k3/YXTlzS2c/8iwBs+dYpy5dPUE88SG5MGm7L07U/MuG3Oq1ZQ 8jLxoqRNnO1WmapuchI5cPGje5ADTOuFP4CYEV46vG+vQKSXidSfz3qaPaGPeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639540825; a=rsa-sha256; cv=none; b=CwC4jZGcLxMQhKaeyMrfdydzMf+yzURtnk+v+T1g7n7/s4r0QMBbp1TMLt/XsKXxgZzwHm dheDB16ZnI6vfks2nE6NOM3yvhE0LqrwT0T3frFJwPeKvqzMFSS0lhqYePZf1Ulen/ZNL1 6HWpDyU34rKrdr40Y9cld+4vhEfAe5Htr2vC9S24cMHfpCPis98887+nV+/c1fd3JtpwZa L0fgEWvyCvQhuGieAckjcsLd9hhR6kL8F6jJew7jJ/SabD8PBw9awoRr/QQ7RC5kTng6DR spZY/xu+l6/tqakcBY8g1yWlYP2qbndHA11ffzB/wXBp1jbKmmWSNKZVPJ+/6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=98a6200ee2482f2f3c73d6d8b8814db2447f7e33 commit 98a6200ee2482f2f3c73d6d8b8814db2447f7e33 Author: Alexander Motin AuthorDate: 2021-12-08 17:29:15 +0000 Commit: Alexander Motin CommitDate: 2021-12-15 04:00:17 +0000 mca: Switch to using taskqueue_enqueue_timeout_sbt(). Previously it was not allowed on fast taskqueues. It was fixed in 4730a8972b1f. This should make no functional change, just a bit cleaner and efficient code. MFC after: 1 week (cherry picked from commit 9a128e1678d1d22a2d4855784b511c0cb370189e) --- sys/x86/x86/mca.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c index 2f4fca0ca062..c3befa46615b 100644 --- a/sys/x86/x86/mca.c +++ b/sys/x86/x86/mca.c @@ -126,10 +126,10 @@ static STAILQ_HEAD(, mca_internal) mca_freelist; static int mca_freecount; static STAILQ_HEAD(, mca_internal) mca_records; static STAILQ_HEAD(, mca_internal) mca_pending; -static struct callout mca_timer; static int mca_ticks = 3600; /* Check hourly by default. */ static struct taskqueue *mca_tq; -static struct task mca_resize_task, mca_scan_task; +static struct task mca_resize_task; +static struct timeout_task mca_scan_task; static struct mtx mca_lock; static unsigned int @@ -978,14 +978,8 @@ mca_scan_cpus(void *context, int pending) thread_unlock(td); if (count != 0) mca_process_records(POLLED); -} - -static void -mca_periodic_scan(void *arg) -{ - - taskqueue_enqueue(mca_tq, &mca_scan_task); - callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL); + taskqueue_enqueue_timeout_sbt(mca_tq, &mca_scan_task, + mca_ticks * SBT_1S, 0, C_PREL(1)); } static int @@ -998,7 +992,8 @@ sysctl_mca_scan(SYSCTL_HANDLER_ARGS) if (error) return (error); if (i) - taskqueue_enqueue(mca_tq, &mca_scan_task); + taskqueue_enqueue_timeout_sbt(mca_tq, &mca_scan_task, + 0, 0, 0); return (0); } @@ -1032,28 +1027,18 @@ sysctl_mca_maxcount(SYSCTL_HANDLER_ARGS) } static void -mca_createtq(void *dummy) +mca_startup(void *dummy) { + if (mca_banks <= 0) return; - mca_tq = taskqueue_create_fast("mca", M_WAITOK, - taskqueue_thread_enqueue, &mca_tq); - taskqueue_start_threads(&mca_tq, 1, PI_SWI(SWI_TQ), "mca taskq"); - /* CMCIs during boot may have claimed items from the freelist. */ mca_resize_freelist(); -} -SYSINIT(mca_createtq, SI_SUB_CONFIGURE, SI_ORDER_ANY, mca_createtq, NULL); - -static void -mca_startup(void *dummy) -{ - if (mca_banks <= 0) - return; - - callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL); + taskqueue_start_threads(&mca_tq, 1, PI_SWI(SWI_TQ), "mca taskq"); + taskqueue_enqueue_timeout_sbt(mca_tq, &mca_scan_task, + mca_ticks * SBT_1S, 0, C_PREL(1)); } #ifdef EARLY_AP_STARTUP SYSINIT(mca_startup, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, mca_startup, NULL); @@ -1112,8 +1097,9 @@ mca_setup(uint64_t mcg_cap) mtx_init(&mca_lock, "mca", NULL, MTX_SPIN); STAILQ_INIT(&mca_records); STAILQ_INIT(&mca_pending); - TASK_INIT(&mca_scan_task, 0, mca_scan_cpus, NULL); - callout_init(&mca_timer, 1); + mca_tq = taskqueue_create_fast("mca", M_WAITOK, + taskqueue_thread_enqueue, &mca_tq); + TIMEOUT_TASK_INIT(mca_tq, &mca_scan_task, 0, mca_scan_cpus, NULL); STAILQ_INIT(&mca_freelist); TASK_INIT(&mca_resize_task, 0, mca_resize, NULL); mca_resize_freelist();