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

Re: [PATCH v2 2/3] xen/riscv: initialize .bss section


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 2 Mar 2023 17:01:15 +0100
  • 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=R+vAtvL1J92EepVf+YxfR4F1Mn1QbHYpNgohoNWXeBo=; b=H7fb2XnrhyuaPD3E8qkbDHUztYxHtZBRJT3izAVzt3yH1sxR222wxnlwpsv9DEZvWI/Bh8WFZgNIHk1QoSeJWtyUENtkVUFfYkjgRg7m13iXcvEaqbShyc4oLQBxCbFMaf1hCBSf+YhPYv3HG+wlwaVNXJiLiGjg1O6KXFQ/IJzuFyLFcUqU2u5GNf/sfveD8q/OdF2k7AudA3uNdyzi6pKHsPoUwvK0xj7pVeA7oAjXbali3sdPIworx7u4jS+jUh8FDWHoBC+kCgNpb6/ZEnab8qIT8kuu4/SSeNNiDm8xtnltvV72I5tt9s4bjS2HpVnzKmOBzdLMbE/rKOMM9g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WC29pK2wSF7fWNy3dNIwgB9Zvq1x9OXQszcfexxioy33pBtIcViBc59IV7IN9IXLdXwhLcZavCYhHE4F/LH3UpkcnCr11KKCBQDVV30T+qqSkC3W7ei+0Kq0mpJyW016ruH64wFBKB7DGl1rGnocddwHqGZTIYF3VkMfM5axwZefxartRjVMuS/GBq3RGCxhA4pRPbi3rRbnwxsbvOAm/CfOWDprKKFm/jyggKus3GiC0zvAHC89NIqWVBL7rG1N6qUUs3L6J1GTtRo5KruXz913YsJAGZv2A6eCdg1NflQt47B8QjU9sOu/NTA+0HQYcwQD69HA6hXZgZWrsSdMog==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 02 Mar 2023 16:01:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02.03.2023 16:55, Oleksii wrote:
> On Thu, 2023-03-02 at 15:22 +0100, Jan Beulich wrote:
>> On 02.03.2023 14:23, Oleksii Kurochko wrote:
>>> --- a/xen/arch/riscv/riscv64/head.S
>>> +++ b/xen/arch/riscv/riscv64/head.S
>>> @@ -13,6 +13,15 @@ ENTRY(start)
>>>          lla     a6, _dtb_base
>>>          REG_S   a1, (a6)
>>>  
>>> +        la      a3, __bss_start
>>> +        la      a4, __bss_end
>>> +        ble     a4, a3, clear_bss_done
>>
>> While it may be that .bss is indeed empty right now, even short term
>> it won't be, and never will. I'd drop this conditional (and in
>> particular the label), inserting a transient item into .bss for the
>> time being. As soon as your patch introducing page tables has landed,
>> there will be multiple pages worth of .bss.
> If I understand you correctly you suggested declare some variable:
>    int dummy_bss __attribute__((unused));
> 
> Then .bss won't be zero:
>    $ riscv64-linux-gnu-objdump -x xen/xen-syms | grep -i dummy_bss    
>    0000000080205000 g     O .bss   0000000000000004 .hidden dummy_bss
> 
> And when page tables will be ready it will be needed to remove
> dummy_bss.
> 
> Another one option is to update linker script ( looks better then
> previous one ):
> --- a/xen/arch/riscv/xen.lds.S
> +++ b/xen/arch/riscv/xen.lds.S
> @@ -140,6 +140,7 @@ SECTIONS
>          . = ALIGN(SMP_CACHE_BYTES);
>          __per_cpu_data_end = .;
>          *(.bss .bss.*)
> +        . = . + 1;
>          . = ALIGN(POINTER_ALIGN);
>          __bss_end = .;
>      } :text

Right, I did think of this as an alternative solution as well. Either
is fine with me.

> If one of the options is fine then to be honest I am not sure that I
> understand why it is better than have 3 instructions which will be
> unnecessary when first bss variable will be introduced. And actually
> the same will be with item in bss, it will become unnecessary when
> something from bss will be introduced.
> 
> I am OK with one of the mentioned above options but still would like
> to understand what are advantages.

You could also remove the branch and the label once .bss is no longer
empty. It'll just raise needless questions if that's left in long
term. Plus - I'm not a maintainer, I'm only voicing suggestions ...

Jan



 


Rackspace

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