[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/4] public: Add page related definitions for accessing guests memory


  • To: Costin Lupu <costin.lupu@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 20 Aug 2021 08:52:10 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mym+fMmQfndhl+XUBQrpKVWUwx/9VGfl1IMhRZJc1Jw=; b=P03R0lzIKP0CaKr1zJIUovaiGnXp8Zb8YAkGE+D3K4QNX97W2cYQkpkR7oy6D7fOykeE8DwwmQLzj0YnYmUqINO+lJWvhAZKwiWK5TGB+7XKZ5zF/EGjsg3AgSf3vArKHtBIprmQlrgLYrFzA4XAmUnNKeuCOMcXiaHiKwhXmd5K1d+YNqvhKMLWMUo4qwe5bGANTnSpNi3GwNyiQruBJ3X4Ve3rwCHzhG581Yhyxfd6QuHinjXHpdnmUCBgEvruEnhpfMSFqK65EmuoUh8cpk/+B38GGdEdfQlZjTmNXUOKiv7v4viuwST7/LZ3jVqR1e2i7+f1YNFjepHJcDyi0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kiq/bE7IgnrGoSTcAYegdLAxG+KOepUIW0Vd592wyiuxelFwG1nIWZxF3KOSxQPMlU6OJ0VsDPLUr+L1y5r5+pjTbYvowg8iM4ocpND/8knqAMVxuRxu8WaAFfQcrpuy1bf3o2aElYscT/Qo0lKWV1+jU/R+80dD+0lhM58YOhTcToPyLz09qdXlgNZ07gVFKZZcMwKY7IDYkWpufRzLGgXDV6xeUIvj7PHo5mxP1hm9MvehX1Lu7zs0lw5EkHqvlV4D4facUqLjTutJ3dTQ7Lh0I422B5qgozsTbLSMCBkOjCOPlWfZF9zNp4lbE24j+PI2/ZpvQ1sxqlM5QZJCWA==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 20 Aug 2021 06:52:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.08.2021 19:50, Costin Lupu wrote:
> These changes introduce the page related definitions needed for mapping and
> accessing guests memory. These values are intended to be used by any toolstack
> component that needs to map guests memory. Until now, the values were defined
> by the xenctrl.h header, therefore whenever a component had to use them it 
> also
> had to add a dependency for the xenctrl library.
> 
> This patch also introduces xen_mk_long() macrodefinition for defining long
> constants both for C and assembler code.

I'm still missing justification for the addition of a new header, especially
as I don't see that header to gain much more contents down the road.

> --- /dev/null
> +++ b/xen/include/public/page.h
> @@ -0,0 +1,36 @@
> +/******************************************************************************
> + * page.h
> + *
> + * Page definitions for accessing guests memory
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> + * of this software and associated documentation files (the "Software"), to
> + * deal in the Software without restriction, including without limitation the
> + * rights to use, copy, modify, merge, publish, distribute, sublicense, 
> and/or
> + * sell copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
> THE
> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + * Copyright (c) 2021, Costin Lupu
> + */
> +
> +#ifndef __XEN_PUBLIC_PAGE_H__
> +#define __XEN_PUBLIC_PAGE_H__
> +
> +#include "xen.h"
> +
> +#define XEN_PAGE_SHIFT           12
> +#define XEN_PAGE_SIZE            (xen_mk_long(1) << XEN_PAGE_SHIFT)
> +#define XEN_PAGE_MASK            (~(XEN_PAGE_SIZE - 1))

You went too far here, I'm afraid: In reply to v1 I did say "The latter
two, being identical ..." - XEN_PAGE_SHIFT ought to continue to be a
per-arch constant, even if right now it is the same for Arm and x86.

Thinking of which - with exposing this as a stable ABI (not just the
abstraction, but the specific values and the fact that they're
invariable become part of the stable ABI this way), what is the plan
for supporting 64k(?) page size on Arm in the future? At that point
you _cannot_ simply remove or replace the #define you add here. As
the immediate need is by the tool stack, enclosing in 

#if defined(__XEN__) || defined(__XEN_TOOLS__)

might be an option, with the downside of having stable libraries
(foreignmemory and gnttab) depend on an unstable hypervisor interface
(again). I can't seem to be able to think of anything better ...

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.