Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFC8FC433DF for ; Wed, 15 Jul 2020 13:16:24 +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 C913D20657 for ; Wed, 15 Jul 2020 13:16:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C913D20657 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jvhGc-0000yw-KS; Wed, 15 Jul 2020 13:16:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jvhGc-0000yr-7a for xen-devel@lists.xenproject.org; Wed, 15 Jul 2020 13:16:10 +0000 X-Inumbo-ID: 58e2b88e-c69d-11ea-bb8b-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 58e2b88e-c69d-11ea-bb8b-bc764e2007e4; Wed, 15 Jul 2020 13:16:09 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0DD46B6F9; Wed, 15 Jul 2020 13:16:12 +0000 (UTC) Subject: Re: [PATCH v7 14/15] x86: switch to use domheap page for page tables To: Hongyan Xia References: <85808fae77da535b2997bede8965d22d5c80c5d3.1590750232.git.hongyxia@amazon.com> From: Jan Beulich Message-ID: <7f402905-adba-130f-b000-a98f7e607d2d@suse.com> Date: Wed, 15 Jul 2020 15:16:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <85808fae77da535b2997bede8965d22d5c80c5d3.1590750232.git.hongyxia@amazon.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: xen-devel@lists.xenproject.org, =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , julien@xen.org, Wei Liu , Andrew Cooper Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 29.05.2020 13:11, Hongyan Xia wrote: > From: Hongyan Xia > > Signed-off-by: Wei Liu > Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich with a sufficiently minor remark: > --- a/xen/arch/x86/mm.c > +++ b/xen/arch/x86/mm.c > @@ -4918,10 +4918,11 @@ mfn_t alloc_xen_pagetable_new(void) > { > if ( system_state != SYS_STATE_early_boot ) > { > - void *ptr = alloc_xenheap_page(); > > - BUG_ON(!hardware_domain && !ptr); > - return ptr ? virt_to_mfn(ptr) : INVALID_MFN; > + struct page_info *pg = alloc_domheap_page(NULL, 0); > + > + BUG_ON(!hardware_domain && !pg); > + return pg ? page_to_mfn(pg) : INVALID_MFN; pg doesn't even get de-referenced, let alone modified. Hence it would better be pointer-to-const, despite this possibly feeling a little odd to some of us given this is a freshly allocated page. Jan