From nobody Mon Feb 9 16:18:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1702302545; cv=none; d=zohomail.com; s=zohoarc; b=EtnjiqRi+/9c1PokCqLqCErOFrdXRfKSeEpP29zFiCNhwKJiYa2k9qPHe0s2en2YsswXfm0e7zZdeg8UsC620vLWrP/B5EBOyavxZEhn4UjwaXJz2uKTlXnRu+986CLIIrwA0og7wPgrGJ5jz1f0DY0vRU8BL0zFEXf9DD68S1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702302545; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mptyI+2MUmEUOVgsCKUKUDyQ+zkn0mcu28+VmTFAif0=; b=B4AnflWwOhphcKpksQedqM9wN28ehF741O7/V/MF/fz2V1TAtoY3Vh6QEVQLsGYx1mYLfraU26mnDHd2matPNT+tAS2hdvsGWEgrhVnAfRvTNZHD6M3qtxx/yr1sPtS1h+y/DKhBgX66wF/Qew/qWARdFjRfxwsL089up0IfySw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1702302545075126.87143213957643; Mon, 11 Dec 2023 05:49:05 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.651889.1017747 (Exim 4.92) (envelope-from ) id 1rCgeM-0004cB-F8; Mon, 11 Dec 2023 13:48:46 +0000 Received: by outflank-mailman (output) from mailman id 651889.1017747; Mon, 11 Dec 2023 13:48:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rCgeM-0004c4-CD; Mon, 11 Dec 2023 13:48:46 +0000 Received: by outflank-mailman (input) for mailman id 651889; Mon, 11 Dec 2023 13:48:45 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rCgeL-0003yP-79 for xen-devel@lists.xenproject.org; Mon, 11 Dec 2023 13:48:45 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [2a07:de40:b251:101:10:150:64:1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fe5c72c7-982b-11ee-9b0f-b553b5be7939; Mon, 11 Dec 2023 14:48:41 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 15DB3223E4; Mon, 11 Dec 2023 13:48:41 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id DFE44138FF; Mon, 11 Dec 2023 13:48:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id vD5/NTgTd2WGXAAAn2gu4w (envelope-from ); Mon, 11 Dec 2023 13:48:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fe5c72c7-982b-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1702302521; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mptyI+2MUmEUOVgsCKUKUDyQ+zkn0mcu28+VmTFAif0=; b=Uf4SIDrL22ohW4Mkmsi4Ikkh3CzK5tb4BCBkjt1devyV/GC9K/gWaJiBQPRzyiqOIn5pDI tl3dckYrZRG2pe+4zQggVq0ehIgKqXSildsiEqFetSqDQgl79rKfpN0YmoZqfFpiLLKZyt 9xw0xfTxARtzV0ufGg0VGc7q6RnAUFk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1702302521; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mptyI+2MUmEUOVgsCKUKUDyQ+zkn0mcu28+VmTFAif0=; b=Uf4SIDrL22ohW4Mkmsi4Ikkh3CzK5tb4BCBkjt1devyV/GC9K/gWaJiBQPRzyiqOIn5pDI tl3dckYrZRG2pe+4zQggVq0ehIgKqXSildsiEqFetSqDQgl79rKfpN0YmoZqfFpiLLKZyt 9xw0xfTxARtzV0ufGg0VGc7q6RnAUFk= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH 2/3] Mini-OS: drop in_callback variable Date: Mon, 11 Dec 2023 14:48:26 +0100 Message-Id: <20231211134827.7130-3-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231211134827.7130-1-jgross@suse.com> References: <20231211134827.7130-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: *************** X-Spam-Flag: YES X-Spam-Score: 15.00 X-Spam-Level: X-Spamd-Bar: / Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=Uf4SIDrL; dmarc=pass (policy=quarantine) header.from=suse.com; spf=fail (smtp-out1.suse.de: domain of jgross@suse.com does not designate 2a07:de40:b281:104:10:150:64:98 as permitted sender) smtp.mailfrom=jgross@suse.com X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [0.99 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; DMARC_POLICY_ALLOW(0.00)[suse.com,quarantine]; NEURAL_HAM_SHORT(-0.20)[-1.000]; DMARC_POLICY_ALLOW_WITH_FAILURES(-0.50)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; R_SPF_FAIL(0.00)[-all]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; SPAM_FLAG(5.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; WHITELIST_DMARC(-7.00)[suse.com:D:+]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim,suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: 0.99 X-Rspamd-Queue-Id: 15DB3223E4 X-Spam-Flag: NO X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1702302545802100003 Content-Type: text/plain; charset="utf-8" Now that do_hypervisor_callback() is always called with interrupts off the in_callback variable meant to handle recursive calls of do_hypervisor_callback() can be dropped. As a precaution add a test to do_hypervisor_callback() that interrupts are really disabled and crash in case this is not true. Signed-off-by: Juergen Gross Reviewed-by: Samuel Thibault --- hypervisor.c | 6 ------ include/hypervisor.h | 2 -- sched.c | 11 ----------- 3 files changed, 19 deletions(-) diff --git a/hypervisor.c b/hypervisor.c index 5309daa3..6facce3e 100644 --- a/hypervisor.c +++ b/hypervisor.c @@ -37,8 +37,6 @@ EXPORT_SYMBOL(hypercall_page); ((sh)->evtchn_pending[idx] & \ ~(sh)->evtchn_mask[idx]) =20 -int in_callback; - #ifndef CONFIG_PARAVIRT extern shared_info_t shared_info; =20 @@ -104,8 +102,6 @@ void do_hypervisor_callback(struct pt_regs *regs) =20 BUG_ON(!irqs_disabled()); =20 - in_callback =3D 1; - =20 vcpu_info->evtchn_upcall_pending =3D 0; /* NB x86. No need for a barrier here -- XCHG is a barrier on x86. */ #if !defined(__i386__) && !defined(__x86_64__) @@ -127,8 +123,6 @@ void do_hypervisor_callback(struct pt_regs *regs) do_event(port, regs); } } - - in_callback =3D 0; } =20 void force_evtchn_callback(void) diff --git a/include/hypervisor.h b/include/hypervisor.h index 1d092719..b852a42a 100644 --- a/include/hypervisor.h +++ b/include/hypervisor.h @@ -50,6 +50,4 @@ void mask_evtchn(uint32_t port); void unmask_evtchn(uint32_t port); void clear_evtchn(uint32_t port); =20 -extern int in_callback; - #endif /* __HYPERVISOR_H__ */ diff --git a/sched.c b/sched.c index e162cb60..3335efa0 100644 --- a/sched.c +++ b/sched.c @@ -76,11 +76,6 @@ void schedule(void) prev =3D current; local_irq_save(flags);=20 =20 - if (in_callback) { - printk("Must not call schedule() from a callback\n"); - BUG(); - } - do { /* Examine all threads. Find a runnable thread, but also wake up expired ones and find = the @@ -151,15 +146,12 @@ struct thread* create_thread(char *name, void (*funct= ion)(void *), void *data) EXPORT_SYMBOL(create_thread); =20 #ifdef HAVE_LIBC -static struct _reent callback_reent; struct _reent *__getreent(void) { struct _reent *_reent; =20 if (!threads_started) _reent =3D _impure_ptr; - else if (in_callback) - _reent =3D &callback_reent; else _reent =3D &get_current()->reent; =20 @@ -246,9 +238,6 @@ void init_sched(void) { printk("Initialising scheduler\n"); =20 -#ifdef HAVE_LIBC - _REENT_INIT_PTR((&callback_reent)) -#endif idle_thread =3D create_thread("Idle", idle_thread_fn, NULL); } =20 --=20 2.35.3