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 76798C25B78 for ; Mon, 13 May 2024 09:36:17 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.720778.1123692 (Exim 4.92) (envelope-from ) id 1s6S6B-00053m-CV; Mon, 13 May 2024 09:35:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 720778.1123692; Mon, 13 May 2024 09:35:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s6S6B-00053f-90; Mon, 13 May 2024 09:35:59 +0000 Received: by outflank-mailman (input) for mailman id 720778; Mon, 13 May 2024 09:35:57 +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 1s6S69-00053Z-G2 for xen-devel@lists.xenproject.org; Mon, 13 May 2024 09:35:57 +0000 Received: from smtp-fw-6001.amazon.com (smtp-fw-6001.amazon.com [52.95.48.154]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 319cf100-110c-11ef-b4bb-af5377834399; Mon, 13 May 2024 11:35:55 +0200 (CEST) Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.43.8.2]) by smtp-border-fw-6001.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 09:35:52 +0000 Received: from EX19MTAEUA001.ant.amazon.com [10.0.43.254:51335] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.3.195:2525] with esmtp (Farcaster) id f3d64704-d3dd-4a0e-82e9-75f995f45500; Mon, 13 May 2024 09:35:51 +0000 (UTC) Received: from EX19D018EUA002.ant.amazon.com (10.252.50.146) by EX19MTAEUA001.ant.amazon.com (10.252.50.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Mon, 13 May 2024 09:35:47 +0000 Received: from [10.95.164.111] (10.95.164.111) by EX19D018EUA002.ant.amazon.com (10.252.50.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Mon, 13 May 2024 09:35:43 +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" X-Inumbo-ID: 319cf100-110c-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1715592955; x=1747128955; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=FBRM1OdC9cKzr+j3pNvlhcc8bnkFfM6GEY8jvy5lak8=; b=ewEaTqah2jnVNhwHiR1vYQBtpuCqTL/iJ8/IhR8NwOLB9QV+JPv9QLR4 oe5jMj6FSGFBZ+DqGzV3bmJ1Wyq85iWTdqrhi3NBGdtqg3q2JVoO17XAC n702jxDbp+O0dRslGnConY4elW0HvPw4m1qCSjabDAHUX0nIJi1kzsoYD E=; X-IronPort-AV: E=Sophos;i="6.08,158,1712620800"; d="scan'208";a="396039285" X-Farcaster-Flow-ID: f3d64704-d3dd-4a0e-82e9-75f995f45500 Message-ID: Date: Mon, 13 May 2024 10:35:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 (resend) 12/27] x86/mapcache: Initialise the mapcache for the idle domain To: Jan Beulich CC: , , , Hongyan Xia , Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Wei Wang , Julien Grall , References: <20240116192611.41112-1-eliasely@amazon.com> <20240116192611.41112-13-eliasely@amazon.com> Content-Language: en-US From: Elias El Yandouzi In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.95.164.111] X-ClientProxiedBy: EX19D045UWA001.ant.amazon.com (10.13.139.83) To EX19D018EUA002.ant.amazon.com (10.252.50.146) On 20/02/2024 10:51, Jan Beulich wrote: > On 16.01.2024 20:25, Elias El Yandouzi wrote: >> --- a/xen/arch/x86/domain.c >> +++ b/xen/arch/x86/domain.c >> @@ -750,9 +750,16 @@ int arch_domain_create(struct domain *d, >> >> spin_lock_init(&d->arch.e820_lock); >> >> + if ( (rc = mapcache_domain_init(d)) != 0) >> + { >> + free_perdomain_mappings(d); >> + return rc; >> + } >> + >> /* Minimal initialisation for the idle domain. */ >> if ( unlikely(is_idle_domain(d)) ) >> { >> + struct page_info *pg = d->arch.perdomain_l3_pg; >> static const struct arch_csw idle_csw = { >> .from = paravirt_ctxt_switch_from, >> .to = paravirt_ctxt_switch_to, >> @@ -763,6 +770,9 @@ int arch_domain_create(struct domain *d, >> >> d->arch.cpu_policy = ZERO_BLOCK_PTR; /* Catch stray misuses. */ >> >> + idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)] = >> + l4e_from_page(pg, __PAGE_HYPERVISOR_RW); >> + >> return 0; >> } > > Why not add another call to mapcache_domain_init() right here, allowing > a more specific panic() to be invoked in case of failure (compared to > the BUG_ON() upon failure of creation of the idle domain as a whole)? > Then the other mapcache_domain_init() call doesn't need moving a 2nd > time in close succession. > To be honest, I don't really like the idea of having twice the same call just for the benefit of having a panic() call in case of failure for the idle domain. If you don't mind, I'd rather keep just a single call to mapcache_domain_init() as it is now. Elias