From nobody Mon Dec 8 01:39:48 2025 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=1622829713; cv=none; d=zohomail.com; s=zohoarc; b=bemsh5Z1hK2tHTjfzQV1kIrqssEcp9E64cUSFNR6VROGws8Ktxe0UeyfBb6O5htDv7CCZX+lLpnUW2nyCTGIzOiLzNZYAk7/7AE7RF9riiztvsSe0JWlhKfuGWM8nLSqbZJFO8JQOcCiWWEGz09RRXswyhzmtP0xRecGetWDKVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622829713; 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=qRHU2/1OI1b1V3LwMYPjJgI2aUkDUXO2+jz2Zd3DWhs=; b=UXn3tAsKwmqOlVru7qD+M+25DtuiRAotw2PNLmOpl7aLbDzeUEHb9lA4ZQdXhsr/lwamz9+UEWzHohdcOKu+wPAQveDkuUSQezbD8o2fd1RHVXv8F01q8LLZkeeg3DS0A0lsN7jn/FTzqAYbh7FeHMIqVDMJJRuQTjU9/wY3SdY= 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 162282971375868.97287581053138; Fri, 4 Jun 2021 11:01:53 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 60B2C1061B4F; Fri, 4 Jun 2021 18:01:50 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id DBABC1061B42 for ; Fri, 4 Jun 2021 18:01:36 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mailout01.t-online.de (Postfix) with SMTP id 7C0906680F; Fri, 4 Jun 2021 20:01:36 +0200 (CEST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1lpE8J-0gQCnY0; Fri, 4 Jun 2021 20:01:23 +0200 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id C2A07200461; Fri, 4 Jun 2021 20:01:20 +0200 (CEST) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Kevin O'Connor Date: Fri, 4 Jun 2021 20:01:20 +0200 Message-Id: <20210604180120.10458-2-vr_qemu@t-online.de> In-Reply-To: References: MIME-Version: 1.0 X-ID: TWtlJMZ6rhqDvXs-9YsNEvvyw774xQdfrRjzGe4qHGR9rWiNMTICQkUMNoLfePfZl3 X-TOI-EXPURGATEID: 150726::1622829683-00016BF9-607DE329/0/0 CLEAN NORMAL X-TOI-MSGID: 9ee92c25-227e-4efc-941c-72bd8a32d278 Message-ID-Hash: W4DQ3OQFRKAEXGVNMHOV74NA4TY2KDDE X-Message-ID-Hash: W4DQ3OQFRKAEXGVNMHOV74NA4TY2KDDE 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 v4 2/2] 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 df32325..4c8e5df 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -629,12 +629,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