From patchwork Thu Sep 26 09:46:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xia, Hongyan" X-Patchwork-Id: 11162173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C94513B1 for ; Thu, 26 Sep 2019 09:51:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DD4F2222C0 for ; Thu, 26 Sep 2019 09:51:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="a24FeU50" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD4F2222C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQPh-00085b-TP; Thu, 26 Sep 2019 09:50:17 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQPf-00081e-RK for xen-devel@lists.xenproject.org; Thu, 26 Sep 2019 09:50:15 +0000 X-Inumbo-ID: eb9d974f-e042-11e9-964c-12813bfff9fa Received: from smtp-fw-6002.amazon.com (unknown [52.95.49.90]) by localhost (Halon) with ESMTPS id eb9d974f-e042-11e9-964c-12813bfff9fa; Thu, 26 Sep 2019 09:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1569491363; x=1601027363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=13mM5dRGLSEYhfnX5pNRRWDPwuo7bv2jjXzInhU8Nh0=; b=a24FeU50khJGpV/1l4vjgYHfMVfpNyb3sVH7fbdZHa+sBsa4dahYW8Wo ECv3usDrUeBNazbg2O5Cb5QofgXTRFEmu1+LQ/OlIHKt6KOC411PY6P8v IHIFAutNHE48d52GHdSXfrkShBg7wEd4Wx+ETq7g06YHEGSyExRjq7clE o=; X-IronPort-AV: E=Sophos;i="5.64,551,1559520000"; d="scan'208";a="423750699" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1e-57e1d233.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 26 Sep 2019 09:49:23 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1e-57e1d233.us-east-1.amazon.com (Postfix) with ESMTPS id 497AC141773; Thu, 26 Sep 2019 09:49:21 +0000 (UTC) Received: from EX13D28EUB003.ant.amazon.com (10.43.166.124) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:49:03 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D28EUB003.ant.amazon.com (10.43.166.124) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:49:02 +0000 Received: from u9d785c4ba99158.ant.amazon.com (10.125.106.58) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 09:48:59 +0000 From: To: Date: Thu, 26 Sep 2019 10:46:27 +0100 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [RFC PATCH 64/84] mapcache: initialise the mapcache even for the idle domain. X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Hongyan Xia , George Dunlap , Andrew Cooper , Dario Faggioli , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Hongyan Xia In situations like in irqs or domain creation, PMAP cannot be used or the mapcache of that domain is simply not ready. We need to have a mapcache in the idle domain to map pages to deal with these. After this patch, map_domain_page() completely gets rid of the direct map. The assertions ensure mappings only happen within PMAP or MAPCACHE regions. As a result, map_xen_pagetable() gets rid of the direct map as well. Signed-off-by: Hongyan Xia --- xen/arch/x86/mm.c | 3 +++ xen/common/schedule.c | 1 + 2 files changed, 4 insertions(+) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 9619182f52..f30b5b3951 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5858,6 +5858,9 @@ int create_perdomain_mapping(struct domain *d, unsigned long va, l3tab = __map_domain_page(pg); clear_page(l3tab); d->arch.perdomain_l3_pg = pg; + if ( is_idle_domain(d) ) + idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)] = + l4e_from_page(pg, __PAGE_HYPERVISOR_RW); if ( !nr ) { unmap_domain_page(l3tab); diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 7b71581756..e687be33a3 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1814,6 +1814,7 @@ void __init scheduler_init(void) BUG_ON(nr_cpu_ids > ARRAY_SIZE(idle_vcpu)); idle_domain->vcpu = idle_vcpu; idle_domain->max_vcpus = nr_cpu_ids; + mapcache_domain_init(idle_domain); if ( vcpu_create(idle_domain, 0, 0) == NULL ) BUG(); this_cpu(schedule_data).sched_priv = sched_alloc_pdata(&ops, 0);