[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>, Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Thu, 2 Mar 2023 20:34:35 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=kQVR/gTP1cWhqzu6hztWnHZMNSx1NWYJ3DiH5sCIhP4=; b=BSZEyMrGQ+CvHVNhkHzknqAniVbFii/QM+Jt3LLvy8ooHu51xrLZs84sG+hcYiO901cOeaVvEbjjFF7XJIy+szvOwnjms/IW/zgDtN1x4+GnJjXiqkL+/qJ24AwhevfeyjnXh0i95WxrwA/XcUYIllpyOItOA+vNmcr/mD5AJ1OA+9E6VwI/nI+PhA5FO03CA6e1vMouYnfWGUVs/emq7yt+wOfWkXmZ7iarPMy6eicsPj4k8hof+NjIRB1npCBgXnsb3X5hSvo+hM4EonxT6Mo9Cv2fOgBz1+8SpZrXfaw7632dD19QqDdYGZQyZbOBi8tErEvdeK5+tOk33Rq5wg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=asM/wfElQ7Sby99vuItBFmwpxa5WDU+eNvcJfHCh4lH0QTL5KF9PSnQSDXhtFxEmXc9ZnI0EtHH5PrQYDdB9PZy0ncCcat3DCodSEBVNg83jMJlrI3I5pgbKrBcYG764isIGdWBpGWII32asTcEgGxFhtzjU34s/ofBpg+CN8sx37I2mNn+T9iEvbbMWQ4v3BITe2vbKsks2KRW7G8anhKq0CXYLPKAnsM/YoQ/4ODFAQAOC8Vtgydk4vcaRgYtBjsm0lPj8JA8ZYf0rygdxDrxIECvdXDPo54dLZIspPmk04JqjqM8cGwiz9STf+tKDuZQDLRswhVFxMxGxiW9fIA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: 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 20:35:17 +0000
- Ironport-data: A9a23:fvaXH6DTVZqpTxVW/5ziw5YqxClBgxIJ4kV8jS/XYbTApG8n1zVRy TMbDzyEPP7fNmSjLd10bonk/BwDusPUy4JgQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFu8pvlDs15K6p4GhA5ARlDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIwy8NaG0IR7 Mckd3NVdxqSg73vkKCAc7w57igjBJGD0II3nFhFlW2cIdN4BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTK/uxruAA/zyQouFTpGPPTdsaHWoN+mUGAq 3id12/4HgsbJJqUzj/tHneE37eWw3yiB9xOfFG+3t8wr1mv2EMaNDEXaHS7+LqdiXCCeusKf iT4/QJr98De7neDSd3wXAa5oTiHowQbUNpTFMU17QiMzuzf5APxLmoOQyNFadcmnNQrXjFs3 ViM9/vyHiBmurCRTXOb95+XoCm0NCxTKnUNDQcLTAID58ToqakpjwzIVddlG+i+ididMTv3y TqboTM+g7gWhMgj2KCy/FSBiDWpzrDASg8u+gzWRCSr9Ap/b4++T5Ok4h7Q6vMoBI2eSF+Gv nQNhcmFxO8LBJCJ0ieKRY0lDLyvovqILjDYqVpuBIU6sSSg/Wa5eoJd6y04I11mWvvoYhfsa U7X/A9UuplaOSP2abctO97qTcM30aLnCNLpEOjOacZDaYRwcwnB+zxyYUmX3Cbml01EfbwDB Kp3uP2EVR4yYZmLBhLvLwvB+dfHHhwD+F4=
- Ironport-hdrordr: A9a23:I/sMXKNoY94v+sBcTgWjsMiBIKoaSvp037BK7S1MoH1uA6mlfq WV9sjzuiWatN98Yh8dcLO7Scu9qBHnlaKdiLN5VduftWHd01dAR7sSjrcKrQeAJ8X/nNQtr5 uJccJFeaDN5Y4Rt7eH3OG6eexQv+Vu6MqT9IPjJ+8Gd3ATV0lnhT0JbTqzIwlNayRtI4E2L5 aY7tovnUvaRZxGBv7LYEXsRoL41qT2qK4=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 02/03/2023 3:55 pm, 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.
Well - to be deleted when the first real bss user appears, but yes -
that will probably be the pagetable series.
>
> 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
>
> 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.
A one-line delete in a C file deletion is most obviously-safe of the 3
options to be performed at some later date, when we've started
forgetting the specific details in this patch.
>> Also are this and ...
>>
>>> +clear_bss:
>>> + REG_S zero, (a3)
>>> + add a3, a3, RISCV_SZPTR
>>> + blt a3, a4, clear_bss
>> ... this branch actually the correct ones? I'd expect the unsigned
>> flavors to be used when comparing addresses. It may not matter here
>> and/or right now, but it'll set a bad precedent unless you expect
>> to only ever work on addresses which have the sign bit clear.
> I'll change blt to bltu.
This should indeed an unsigned compare. It doesn't explode in practice
because paging is disabled and RISC-V's MAXPHYADDR is 56 bits so doesn't
set the sign bit.
~Andrew
|