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

Re: [PATCH v1 5/8] xen/riscv: introduce identity mapping


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 12 Jun 2023 16:24:38 +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=qRdgItSLxmFEozSVykPJfbmQraTHh1XNL9zp8rKiiSQ=; b=L2GGg4LqLFIB5iH718Lqfxh7QLmyCD89TRjo5G/SmEyuavcqJ5j2uLi9VjdIisXgi2ns5TW2jefLJCXH3hluHpZNVWbnRR0YoVdsBT3SixvB79Ydms7EQx1hWFVMvG0Co+9wDr1PwoDrZ46UOFGg9dePyi3eeU2p+2rqg3Ge87VYT9WpUzqhCou4IkgVNqaQgVV+2ks//7+hN3rY1yLFUAaoAEKOaW/8Lk2YVNvTb9oY7c3b9h9dPDYxNj/x7xl9t7Lkh2iqGDuSbALn5UNdWOO22q38hrDFhZ3iS7EPlrW9hvi7jM8ZG/AOlNeidK+xPuLWtSqo+xNpN6cQYmUglA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=grnBGaZuIcRroEZXkR5Fkhjwtg0xXdsZwYgnntT1kutI7BlN4LbH13YNQadNA47e7v/Crf4prxplwoKi0m2ydlmt+UalZ8JQjqibDdY7YsF2H/O2kQC+MQ8TxBK28eHpF96Cl349utRRbTl0F2fZv+inbS3A6bz7BcV515Iajeo8GU4hPmHSmyOGfzePlSoUp6NvShdm8CEILx3Bo/9CXPJDUqILzxGX1Nazcfm3xb05DM5az29FeZxQSMbQ+VjMLCrCOupQTn8woS835UJuX3P0Ou4cArDSdBvOYjh8wiLKVqAlmAgOD7eGUGrkRQ9JC7hEKKBSC/jCIl0gK/6NBA==
  • 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: Mon, 12 Jun 2023 14:25:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.06.2023 15:48, Jan Beulich wrote:
> On 06.06.2023 21:55, Oleksii Kurochko wrote:
>> -void __init noreturn noinline enable_mmu()
>> +/*
>> + * enable_mmu() can't be __init because __init section isn't part of 
>> identity
>> + * mapping so it will cause an issue after MMU will be enabled.
>> + */
> 
> As hinted at above already - perhaps the identity mapping wants to be
> larger, up to covering the entire Xen image? Since it's temporary
> only anyway, you could even consider using a large page (and RWX
> permission). You already require no overlap of link and load addresses,
> so at least small page mappings ought to be possible for the entire
> image.

To expand on that: Assume a future change on this path results in a call
to memcpy() or memset() being introduced by the compiler (and then let's
further assume this only occurs for a specific compiler version). Right
now such a case would be noticed simply because we don't build those
library functions yet. But it'll likely be a perplexing crash once a full
hypervisor can be built, the more that exception handlers also aren't
mapped.

>> - mmu_is_enabled:
>>      /*
>> -     * Stack should be re-inited as:
>> -     * 1. Right now an address of the stack is relative to load time
>> -     *    addresses what will cause an issue in case of load start address
>> -     *    isn't equal to linker start address.
>> -     * 2. Addresses in stack are all load time relative which can be an
>> -     *    issue in case when load start address isn't equal to linker
>> -     *    start address.
>> -     *
>> -     * We can't return to the caller because the stack was reseted
>> -     * and it may have stash some variable on the stack.
>> -     * Jump to a brand new function as the stack was reseted
>> +     * id_addrs should be in sync with id mapping in
>> +     * setup_initial_pagetables()
> 
> What is "id" meant to stand for here? Also if things need keeping in
> sync, then a similar comment should exist on the other side.

I guess it's meant to stand for "identity mapping", but the common use
of "id" makes we wonder if the variable wouldn't better be ident_addrs[].

Jan



 


Rackspace

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