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

Re: [PATCH v1 repost 1/4] arm/mmu: Move init_ttbr to a new section .data.idmap


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 17 Jan 2024 14:03:46 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=PvmzMgNPynODWXH71XdDoGarMfZmqo/9HFNbYaTXAz0=; b=j10y3IlSfrdLMccgzuHmx+UUNgko3Yt1glpvUN3vSCQQIRZjuOX9/d6kJGaKaqYEPvrbMXh9+wcuqVG5BHV+pce+88ix/zrB4WGgbVmoAdf779G+8UOfDnJFnUrE6Lh+d8cXQ1dlsfKNL/M7HkGeVVJ4nUse7H3rgBbcx9SgDOMTyVPXQVgj9QWuQmcr5jAENc3sK1Mw1GfmaO/lzndnI0Lq4tUJ3HkEOnQHLP56n6hqUNJeN5LZIwSR1IKNQ6rw1JjISDuhKQ8BeKJ5RgrS9ddMBVpf0vKskpPk2VcCM3q/yHjCvRAv0ZddyM8sF8hWYNRsgKwp0JEOIc1MwpQIZA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QGLqsawdNXI5rdCyfCLtzFNkbjKZj3kBfcaERC6JbZ+P1a7lbj6sTQN/+d6qFxFzYlYhMd3roEC8VlQprtHWJhWtY5+0jcCm98wlwclTEoZrbBz08uzZJuElRbSTNHWB4Q5VjwxNJC9M8BPyeBwIpuR6GwYZ1AoewvDuwbE8Q6F5BT4Qp7ecmPf4bwhXAXUfeazhtBFJumDXNIi9g3hHamfZyDKB/OyIbGlfA9RRmrWQpErTcRpduUnaJOagc6B9S1+U59iB+nDvgEyKLuWKbAzAoIYvCBQob8HjUXmFikTFGa4suZ/eZvJB96lJr0jInyS/mWVOhleEnpq4Z7lHrg==
  • Cc: <carlo.nonato@xxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 17 Jan 2024 13:04:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 17/01/2024 13:10, Julien Grall wrote:
> 
> 
> On 17/01/2024 08:30, Michal Orzel wrote:
>> Hi Julien,
> 
> Hi Michal,
> 
>> On 16/01/2024 15:37, Julien Grall wrote:
>>>
>>>
>>> From: Julien Grall <jgrall@xxxxxxxxxx>
>>>
>>> With the upcoming work to color Xen, the binary will not be anymore
>>> physically contiguous. This will be a problem during boot as the
>>> assembly code will need to work out where each piece of Xen reside.
>>>
>>> An easy way to solve the issue is to have all code/data accessed
>>> by the secondary CPUs while the MMU is off within a single page.
>>>
>>> Right now, init_ttbr is used by secondary CPUs to find there page-tables
>>> before the MMU is on. Yet it is currently in .data which is unlikely
>>> to be within the same page as the rest of the idmap.
>>>
>>> Create a new section .data.idmap that will be used for variables
>>> accessed by the early boot code. The first one is init_ttbr.
>>>
>>> The idmap is currently part of the text section and therefore will
>>> be mapped read-only executable. This means that we need to temporarily
>>> remap init_ttbr in order to update it.
>>>
>>> Introduce a new function set_init_ttbr() for this purpose so the code
>>> is not duplicated between arm64 and arm32.
>>>
>>> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
>> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
>>
>> with ...
>>
>>> ---
>>>   xen/arch/arm/mmu/smpboot.c | 34 +++++++++++++++++++++++++++++-----
>>>   xen/arch/arm/xen.lds.S     |  1 +
>>>   2 files changed, 30 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/xen/arch/arm/mmu/smpboot.c b/xen/arch/arm/mmu/smpboot.c
>>> index b6fc0aae07f1..f1cf9252710c 100644
>>> --- a/xen/arch/arm/mmu/smpboot.c
>>> +++ b/xen/arch/arm/mmu/smpboot.c
>>> @@ -9,6 +9,10 @@
>>>
>>>   #include <asm/setup.h>
>>>
>>> +/* Override macros from asm/page.h to make them work with mfn_t */
>>> +#undef virt_to_mfn
>>> +#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
>>> +
>>>   /*
>>>    * Static start-of-day pagetables that we use before the allocators
>>>    * are up. These are used by all CPUs during bringup before switching
>>> @@ -44,7 +48,7 @@ DEFINE_BOOT_PAGE_TABLE(boot_second);
>>>   DEFINE_BOOT_PAGE_TABLES(boot_third, XEN_NR_ENTRIES(2));
>>>
>>>   /* Non-boot CPUs use this to find the correct pagetables. */
>>> -uint64_t init_ttbr;
>>> +uint64_t __section(".data.idmap") init_ttbr;
>> Do we need to keep the declaration in mmu/mm.h? This variable is only used 
>> in this file
>> and in assembly, so maybe better to drop declaration and use asmlinkage 
>> instead?
> 
> I don't see the problem of keeping the declaration in mmu/mm.h. In any
> case, this seems to be unrelated to this patch.
This was just a question about the sense of a declaration that is not 
used/needed at all.
If you also thought so, it could be done in this patch given that it touches 
definition.
Since you don't, no problem whatsoever.

~Michal



 


Rackspace

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