From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B31CCA5FD9 for ; Fri, 2 Oct 2026 08:06:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1438906.1657429 (Exim 4.92) (envelope-from ) id 1xCYHD-0006Fn-UN; Fri, 02 Oct 2026 08:05:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1438906.1657429; Fri, 02 Oct 2026 08:05:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xCYHD-0006Fg-QC; Fri, 02 Oct 2026 08:05:55 +0000 Received: by outflank-mailman (input) for mailman id 1438906; Fri, 02 Oct 2026 08:05:54 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xCYHC-0006FY-By for xen-devel@lists.xenproject.org; Fri, 02 Oct 2026 08:05:54 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.96) (envelope-from ) id 1xCYH8-00B2ct-1H; Fri, 02 Oct 2026 08:05:50 +0000 Received: from 224.pool85-54-217.dynamic.orange.es ([85.54.217.224] helo=localhost) by xenbits.xenproject.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xCYH8-009rtf-11; Fri, 02 Oct 2026 08:05:50 +0000 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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xenproject.org; s=20200302mail; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=XjP3S9sCRbit7vbPBcr7VXpFftowtgeo2CVPeq1A6lE=; b=x6CSNC7IBL5VAXIoNnDkxpvP04 vGNgCFR+0EgISxNG91kEA8CJk0QZIsk18fEQn9/MKxGJSWIgNgi0JVS+aObkKfIQgmBsry/tz+Lt1 DoL6Qo/a/8CaJlipQv2u0YGYaFAZyADb7f1rvPqmp+YSbkWSQKdGx7QOdWJENgAuVcgk=; Date: Fri, 2 Oct 2026 10:05:48 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Jan Beulich Cc: Grygorii Strashko , Andrew Cooper , Teddy Astie , xen-devel@lists.xenproject.org Subject: Re: [PATCH] x86/domain: restrict context switch hooks for the idle domain Message-ID: References: <20261001142757.98255-1-roger@xenproject.org> <4eb32155-1b04-4f04-ab9b-f30e584cb033@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4eb32155-1b04-4f04-ab9b-f30e584cb033@suse.com> On Fri, Oct 02, 2026 at 09:55:09AM +0200, Jan Beulich wrote: > On 02.10.2026 09:48, Roger Pau Monné wrote: > > On Fri, Oct 02, 2026 at 07:45:07AM +0200, Jan Beulich wrote: > >> On 01.10.2026 16:27, Roger Pau Monne wrote: > >>> --- a/xen/arch/x86/domain.c > >>> +++ b/xen/arch/x86/domain.c > >>> @@ -813,8 +813,6 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags) > >>> void __init arch_init_idle_domain(struct domain *d) > >>> { > >>> static const struct arch_csw idle_csw = { > >>> - .from = paravirt_ctxt_switch_from, > >>> - .to = paravirt_ctxt_switch_to, > >>> .tail = idle_loop, > >>> }; > >> > >> Leaving NULL pointers around isn't a good thing, though. May I suggest to > >> at least poison the pointers then? > > > > I don't mind doing so, but I don't think we usually do that for other > > hook structures, ie: hvm_function_table for example doesn't poison > > unset hooks (and it possibly can't, because there are .hook != NULL > > checks). > > > > TBH I'm missing a benefit of the poisoning here. Using NULL or a > > poisoned value will both trigger a page-fault, and NULL has the > > benefit of callers easily checking whether the hook is set. > > NULL in the context of a HVM vCPU will #PF. NULL in the context of a PV > one may not, depending on what the guest may have put there. It still feels a bit arbitrary to do here but not in other places, but never mind, I will adjust and send v2. Thanks, Roger.