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=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 55CC7C433F5 for ; Tue, 7 Sep 2021 21:34:53 +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 097EC610E9 for ; Tue, 7 Sep 2021 21:34:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 097EC610E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.181364.328439 (Exim 4.92) (envelope-from ) id 1mNijn-0004l9-CY; Tue, 07 Sep 2021 21:34:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 181364.328439; Tue, 07 Sep 2021 21:34:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNijn-0004l2-9d; Tue, 07 Sep 2021 21:34:39 +0000 Received: by outflank-mailman (input) for mailman id 181364; Tue, 07 Sep 2021 21:34:38 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNijl-0004kw-To for xen-devel@lists.xenproject.org; Tue, 07 Sep 2021 21:34:37 +0000 Received: from mail-lj1-x231.google.com (unknown [2a00:1450:4864:20::231]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c141cd11-d8c8-4d3a-adaf-8e5ec596e468; Tue, 07 Sep 2021 21:34:36 +0000 (UTC) Received: by mail-lj1-x231.google.com with SMTP id y6so848208lje.2 for ; Tue, 07 Sep 2021 14:34:36 -0700 (PDT) Received: from [192.168.1.7] ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id g10sm11246lfb.87.2021.09.07.14.34.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Sep 2021 14:34:35 -0700 (PDT) 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: c141cd11-d8c8-4d3a-adaf-8e5ec596e468 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=X3YkShdpCjM0j8ZJigoaLHyM/keq1t8ObtbGWzImwWs=; b=V7Z2S2HGFliTqXR5z+T5SKrmTBIfsYQA/s7U71bLMtmcWh0w18IZXZzNwo0ebUiRxk XgeZNNf7lFV4m1cCZ/zo691i89CXPU2ELG1qlRtwHVUiud+rMuibDSUsqAjZqehzC3ig xg2cGzo1yAwq6NGWwO4LNWEkdgpoGsvw3OD0ymhb5vWvbTNWNStnTV2YTG/B0Xpv/uce hjqiQ3nzhxNnTKBpK83GrNZoXscSZ5Qq/iBj/8BQZcF7C+urcDpxVhMidzOlZfvDOFev vilsdOgVU8a0ZZHFFbMr3TJCjSLm//rtDFpNLMQxHwOQV03o36fUR+uvESynoOvKfGQi 47lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=X3YkShdpCjM0j8ZJigoaLHyM/keq1t8ObtbGWzImwWs=; b=Zm7P3cK00zBmm1b5ilRBP24oFY8ONANMJzbg3njQ3dMx0BozKnODTUTLz6PQ0YqJwq cZJ3YQDBwuouLq3RcMQo2IX72Qc1SfZbA0WoCK3JNL4wdHhGAm3jCkgk8td7vnhfiLc7 E9TqWVVFDeBwFO/r7FGj2EYxhe9yyivmQkKyG7DmXZHeX8BmgO8t9E/TA3IesHVgWzAo jm/XdpmOrq10jlBbuOgU+rU96HyUbmzn6SKsxBiW3oTOKj5C7a6DEFUTQnZsDTywh3Ba YqHZ+OmKXA7I5VK8xfajHxfM2GJr/ljtSf39LM9G6uPA32P+w+I46sDeWBMxC/Iglt/O Q2Gw== X-Gm-Message-State: AOAM532o0Lcqv+Hzf7XhTB587SLSbpGC+wc6By2WOtNYvM442W8WnFXI 21AxJ6LEvZeiDYJmrodZGd8= X-Google-Smtp-Source: ABdhPJwLmj7DVmaZk+g6qRV0XlrRzgLrUEGqmkKXpjdOLi1nQnMrPUtIUmK6+j1KR5qFqcM9O4F1uA== X-Received: by 2002:a2e:90ca:: with SMTP id o10mr232555ljg.67.1631050475852; Tue, 07 Sep 2021 14:34:35 -0700 (PDT) Subject: Re: [RFC PATCH] xen/memory: Introduce a hypercall to provide unallocated space To: Henry Wang Cc: "xen-devel@lists.xenproject.org" , Oleksandr Tyshchenko , Daniel De Graaf , "Daniel P. Smith" , Ian Jackson , Wei Liu , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Volodymyr Babchuk , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Bertrand Marquis , Wei Chen References: <1627489110-25633-1-git-send-email-olekstysh@gmail.com> From: Oleksandr Message-ID: Date: Wed, 8 Sep 2021 00:34:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US On 07.09.21 11:53, Henry Wang wrote: > Hi Oleksandr, Hi Henry > >> -----Original Message----- >> From: Xen-devel On Behalf Of >> Oleksandr Tyshchenko >> Sent: Thursday, July 29, 2021 12:19 AM >> To: xen-devel@lists.xenproject.org >> Cc: Oleksandr Tyshchenko ; Daniel De >> Graaf ; Daniel P. Smith >> ; Ian Jackson ; Wei >> Liu ; Andrew Cooper ; George >> Dunlap ; Jan Beulich ; >> Julien Grall ; Stefano Stabellini ; >> Volodymyr Babchuk ; Roger Pau Monné >> ; Bertrand Marquis ; >> Wei Chen >> Subject: [RFC PATCH] xen/memory: Introduce a hypercall to provide >> unallocated space >> >> From: Oleksandr Tyshchenko >> >> Add XENMEM_get_unallocated_space hypercall which purpose is to >> query hypervisor to find regions of guest physical address space >> which are unused and can be used to create grant/foreign mappings >> instead of wasting real pages from the domain memory for >> establishing these mappings. The problem with the current Linux >> on Xen on Arm behaviour is if we want to map some guest memory >> regions in advance or to perform cache mappings in the backend >> we might run out of memory in the host (see XSA-300). >> This of course, depends on the both host and guest memory sizes. >> >> The "unallocated space" can't be figured out precisely by >> the domain on Arm without hypervisor involvement: >> - not all device I/O regions are known by the time domain starts >> creating grant/foreign mappings >> - the Dom0 is not aware of memory regions used for the identity >> mappings needed for the PV drivers to work >> In both cases we might end up re-using these regions by >> a mistake. So, the hypervisor which maintains the P2M for the domain >> is in the best position to provide "unallocated space". >> >> The arch code is in charge of finding these regions and filling >> in corresponding array in new helper arch_get_unallocated_space(). >> >> This patch implements common and Arm parts, the x86 specific bits >> are left uniplemented for now. >> >> Signed-off-by: Oleksandr Tyshchenko > Tested-by: Henry Wang Thank you! Please note, I have pushed new version (which is notably different) based on the discussion in current thread: https://lore.kernel.org/xen-devel/1631034578-12598-1-git-send-email-olekstysh@gmail.com/ > > Kind regards, > > Henry > -- Regards, Oleksandr Tyshchenko