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

Re: [PATCH v3 3/3] xen/riscv: introduce identity mapping


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 20 Jul 2023 07:58:22 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3vL1z85zPLYEi37XUl/gthOpeiSSFb9tRVWv6syiwM4=; b=KS/Hk9WCr4jIBjy/Enl58yuGwipUmQv3GAyqjuD80IV63iHtjqNozIk3LjuW/Mc8Y+KqlSy15s2n7WCISSLu3DwdQtcKttGb4rVguMRg/WXznRANrlwONGXdMs+UE+yAt/xp/w9/3nezfqxuEzK7SGAFDBIu1SyjzqfC5OUQ3G6DLfkRcD3zy4vNZYvQJ3zqQymy6NkCegVp1MlFKo71Un2ZnDvkZVgA9tDQu7dQjZ/kbh0D0bAZY08l/cM21Z09yYBEz07h5j5Epohr2I8E4rERxDZ9pP72HYRd1Es1ML5T0dIlotkzkkbIPLlv3DoudzEfZCc9o9wnIKYzH9tz/Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L7bSMAke9mMOP5B8vhhvxtaOKRkKtL4n+4NW/ByXFTFoOCRssdeEpU3rALavFrQ0h5jPIADl9k81qPLKjRl5lRNUqgLVXM2xGjtkCZ6JReaiRv2O+8b7X2wUzCHHbnrDwA8WLIr1HRWHYiD3PQaKxPnFsDqDHrEh/zXsJTYGXYhcU39fF8p64T6gefw6a8yY45mPUhAUtNewSyYVl6PfAKC3ZLTJsGj5iecu5gmEJ1tjGg98wHZHd1fKlF+T0i7oEsA0xoIPBZwX4FwJE618ppnBlJC1hH2Cq1BzEG/bxLyYvkurkMVn00NIYMZoJjef0ytM48p7iqf9TRt1ojMKcg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 20 Jul 2023 05:58:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.07.2023 18:35, Oleksii wrote:
> On Tue, 2023-07-18 at 17:03 +0200, Jan Beulich wrote:
>>> +            unsigned long load_end = LINK_TO_LOAD(_end);
>>> +            unsigned long pt_level_size = XEN_PT_LEVEL_SIZE(i -
>>> 1);
>>> +            unsigned long xen_size = ROUNDUP(load_end -
>>> load_start, pt_level_size);
>>> +            unsigned long page_entries_num = xen_size /
>>> pt_level_size;
>>> +
>>> +            while ( page_entries_num-- )
>>> +                pgtbl[index++].pte = 0;
>>> +
>>> +            break;
>>
>> Unless there's a "not crossing a 2Mb boundary" guarantee somewhere
>> that I've missed, this "break" is still too early afaict.
> If I will add a '2 MB boundary check' for load_start and linker_start
> could it be an upstreamable solution?
> 
> Something like:
>     if ( !IS_ALIGNED(load_start, MB(2) )
>       printk("load_start should be 2Mb algined\n");
> and
>     ASSERT( !IS_ALIGNED(XEN_VIRT_START, MB(2) )
> in xen.lds.S.

Arranging for the linked address to be 2Mb-aligned is certainly
reasonable. Whether expecting the load address to also be depends
on whether that can be arranged for (which in turn depends on boot
loader behavior); it cannot be left to "luck".

> Then we will have completely different L0 tables for identity mapping
> and not identity and the code above will be correct.

As long as Xen won't grow beyond 2Mb total. Considering that at
some point you may want to use large page mappings for .text,
.data, and .rodata, that alone would grow Xen to 6 Mb (or really 8,
assuming .init goes separate as well). That's leaving aside the
realistic option of the mere sum of all sections being larger than
2. That said, even Arm64 with ACPI is still quite a bit below 2Mb.
x86 is nearing 2.5 though in even a somewhat limited config;
allyesconfig may well be beyond that already.

Of course you may legitimately leave dealing with that to the
future.

Jan



 


Rackspace

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