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 X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 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 26FF9C433B4 for ; Wed, 21 Apr 2021 13:40:00 +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 C3AD5613B6 for ; Wed, 21 Apr 2021 13:39:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3AD5613B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.114509.218239 (Exim 4.92) (envelope-from ) id 1lZD4q-0003ZH-8v; Wed, 21 Apr 2021 13:39:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114509.218239; Wed, 21 Apr 2021 13:39:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZD4q-0003ZA-5f; Wed, 21 Apr 2021 13:39:36 +0000 Received: by outflank-mailman (input) for mailman id 114509; Wed, 21 Apr 2021 13:39:34 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZD4o-0003Z5-Ll for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 13:39:34 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZD4l-0000HB-Vk; Wed, 21 Apr 2021 13:39:31 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=freeip.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lZD4l-0001Uw-CG; Wed, 21 Apr 2021 13:39:31 +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=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Mime-Version:Content-Type: References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID; bh=JN4E55cpVCbgAq+7oLvl1m6DdRXGpvZ9z88oDuBr/9s=; b=N7O3jzTqzr1JqDnEclX8fNWiRq +W6uwJmQrcFzNRqexaL5eiohwc8HaBV2mJrMfQoxRqbVGjkVbNL6nMsAgi1WKUSPWCz0n8vLdBQnh bM8Eb8VMVtHKwYKRq+rCsIdEP6GskYGTlyDwhHSwmoYqD1G1WzwOHDkmhTQkQfBi1+6o=; Message-ID: <66d5ed414d414629e04717560f2090345c0759ac.camel@xen.org> Subject: Re: [PATCH v9 10/13] x86/smpboot: switch clone_mapping() to new APIs From: Hongyan Xia To: Jan Beulich Cc: jgrall@amazon.com, Andrew Cooper , Roger Pau =?ISO-8859-1?Q?Monn=E9?= , Wei Liu , xen-devel@lists.xenproject.org Date: Wed, 21 Apr 2021 14:39:28 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit On Tue, 2021-04-20 at 14:32 +0200, Jan Beulich wrote: > On 06.04.2021 13:05, Hongyan Xia wrote: > > @@ -742,51 +742,58 @@ static int clone_mapping(const void *ptr, > > root_pgentry_t *rpt) > > } > > } > > > > + UNMAP_DOMAIN_PAGE(pl1e); > > + UNMAP_DOMAIN_PAGE(pl2e); > > + UNMAP_DOMAIN_PAGE(pl3e); > > Just one minor remark: A pedantic(?) compiler might warn about the > setting to NULL of pl3e here, when > > > if ( !(root_get_flags(rpt[root_table_offset(linear)]) & > > _PAGE_PRESENT) ) > > { > > - pl3e = alloc_xen_pagetable(); > > + mfn_t l3mfn; > > + > > + pl3e = alloc_map_clear_xen_pt(&l3mfn); > > rc = -ENOMEM; > > if ( !pl3e ) > > goto out; > > - clear_page(pl3e); > > l4e_write(&rpt[root_table_offset(linear)], > > - l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR)); > > + l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR)); > > } > > else > > - pl3e = l4e_to_l3e(rpt[root_table_offset(linear)]); > > + pl3e = map_l3t_from_l4e(rpt[root_table_offset(linear)]); > > ... it is guaranteed to get initialized again before any further > consumption. IOW strictly speaking the last of those three would > want to be unmap_domain_page(), just like you have ... > > > @@ -802,6 +809,9 @@ static int clone_mapping(const void *ptr, > > root_pgentry_t *rpt) > > > > rc = 0; > > out: > > + unmap_domain_page(pl1e); > > + unmap_domain_page(pl2e); > > + unmap_domain_page(pl3e); > > return rc; > > } > > ... here. True. I will switch to lower case for pl3e just in case. Hongyan