From nobody Mon Sep 16 19:34:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org ARC-Seal: i=1; a=rsa-sha256; t=1622574519; cv=none; d=zohomail.com; s=zohoarc; b=CCv6dTFFUfjRAx2VK4eaStjSOLXZ/BR1Igul2zFADZNtcsNktwzkKd8OnurcdwHw8gEt0nFm8zLZUTFw/xZqJvFUzdzlSMHrg2O3YSaxOOsIqDQyqc9QoXLwINsdsNFp6Loy1b+bLogxXDhJfLLFi/dfvPo1BHMfCfSncBrc95w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622574519; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=bKCahNXXHzHqkWbh3lU9Oads/EArlQ9ffffPUdt184c=; b=cwdCJja1a/9oA10eQ4GaU+8HKQHd0WsD6kFU2Rf7eL6wbOd/yIGe2bOpctWtjdg3RKMcrdbd9tNIHenvnbbbGEAwCQRVCfGNQkncqk4aGY3nXNUR7yDjn14ldbly6JKs7jDtiLN780wG48yUEWhqbQhjRMQvzf1Oaammk+qFrHQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1622574519139582.2575397036835; Tue, 1 Jun 2021 12:08:39 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 76D8310619E9; Tue, 1 Jun 2021 19:08:21 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id EB17110619E2 for ; Tue, 1 Jun 2021 19:08:08 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mailout05.t-online.de (Postfix) with SMTP id C2BB767BC6; Tue, 1 Jun 2021 21:07:05 +0200 (CEST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1lo9jB-1H4w1A0; Tue, 1 Jun 2021 21:07:01 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 3D4FB200607; Tue, 1 Jun 2021 21:06:56 +0200 (CEST) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Kevin O'Connor Date: Tue, 1 Jun 2021 21:06:56 +0200 Message-Id: <20210601190656.7162-3-vr_qemu@t-online.de> In-Reply-To: <6bff0709-f229-c180-e91f-52c7c3fea5ac@t-online.de> References: <6bff0709-f229-c180-e91f-52c7c3fea5ac@t-online.de> MIME-Version: 1.0 X-ID: XLMOu8ZZghM3O0nvdrBijuBoJzV+Blu7MTDGEbKe0usScV43S+yP8Sqi0b94nLIZ8y X-TOI-EXPURGATEID: 150726::1622574421-0000B607-E8999779/0/0 CLEAN NORMAL X-TOI-MSGID: 0c145804-2a07-4882-b45f-789406413d42 Message-ID-Hash: VBZZLE6TH2EIO4E7TH3ENGENNJ7DXX3N X-Message-ID-Hash: VBZZLE6TH2EIO4E7TH3ENGENNJ7DXX3N X-MailFrom: volker.ruemelin@t-online.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: seabios@seabios.org X-Mailman-Version: 3.3.4 Precedence: list Subject: [SeaBIOS] [PATCH v3 3/3] stacks: call check_irqs() after switch_next() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: --- In function run_thread() the function check_irqs() gets called after the thread switch for atomic handoff reasons. In yield() it's the other way round. If check_irqs() is called after run_thread() and check_irqs() is called before switch_next() in yield(), it can happen in a constructed case that a background thread runs twice without a check_irqs() call in between. Call check_irqs() after switch_next() in yield() to prevent this. Signed-off-by: Volker R=C3=BCmelin --- src/stacks.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stacks.c b/src/stacks.c index 58c0317..e090919 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -630,12 +630,11 @@ yield(void) return; } struct thread_info *cur =3D getCurThread(); + // Switch to the next thread + switch_next(cur); if (cur =3D=3D &MainThread) // Permit irqs to fire check_irqs(); - - // Switch to the next thread - switch_next(cur); } =20 void VISIBLE16 --=20 2.26.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org