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

Re: [PATCH 2/3] xen/ppc: Relocate kernel to physical address 0 on boot


  • To: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 1 Aug 2023 08:08:26 +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=MIfs5hKDkqyiT/bwRsOXNBcxi8l2PnB/lLqev8A8das=; b=U4XM2hwxeV9seoLA/iOOor4FHexbNmHR0Qf391u89RK0kmxvSwoY9CHij/79X0CnJB8hCWI/yk+OAV+Z6UdvtoSXOH7fpIR0ZM7MKKF/JWo390vANEwd8Lx9SfYzPC+6bZ4u4nR6vw3XGHdrFBHZYzhMz2aQtiqIlngdWpFTHtVU17wUYvBbkndH1zdAJQi1Nv57Q/jNijGrLIHQs+4WaNetywASsfkpFxIExbQkboE0jXU4BliTBfVZ3HshwfxUX4IWkQva9ib8AbvnuHrurggbsRQUxWm1N6Rt3RAIbpexWfwe2Z5DsTZVAi8mkeTf06TNS4k4ovhMIdRfBNnejA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gWrbfhe9GHv1x+iFTPRndnrpcADcqsf/5vjs5LaxYzHkolZNZcXasR7/bDy80lc8410KmY10KPmx9cWupWATHS6WWg5njYRRW9q1fRawTcU/PVzQEztNYXfZNi6RB0qGNHgINaDNW5jfnjhRik0F9mo57TxPb3C4ifwjfP4invisnoJV2Ca+i2BUhqnlWnO5dZUq382mg6VBZ73nCktODnfcsS2TCEfXtJwTve5N1Qp5uMgVdqzekAKsa1kttKDSXcLbqZRyOnL9sA14xXKGBEckIIrczDwUzawu53qE7QXBvLEcy41vwH/WW0lnyJ694bdWx7/IMcGKYrnvU/952g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 01 Aug 2023 06:09:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.08.2023 01:37, Shawn Anastasio wrote:
> On 7/31/23 10:46 AM, Jan Beulich wrote:
>> On 29.07.2023 00:21, Shawn Anastasio wrote:
>>> +    /* If we're at the correct address, skip copy */
>>> +    cmpld   %r1, %r12
>>> +    beq     .L_correct_address
>>
>> Can this ever be the case, especially with the MMU-off behavior you
>> describe in the comment above? Wouldn't you need to ignore the top
>> four bits in the comparison?
> 
> It will always be the case after the code jumps to XEN_VIRT_START after
> the copy takes place.

Well, of course.

> I could have it jump past the copy loop entirely,
> but then I'd need to duplicate the TOC setup.

I don't think I understand this part of your reply: .L_correct_address
_is_ past the copy loop.

>>> +    /* Copy bytes until _end */
>>> +    LOAD_REG_ADDR(%r11, _end)
>>> +    addi    %r1, %r1, -8
>>> +    li      %r13, -8
>>> +.L_copy_xen:
>>> +    ldu     %r10, 8(%r1)
>>> +    stdu    %r10, 8(%r13)
>>> +    cmpld   %r1, %r11
>>> +    blt     .L_copy_xen
>>> +
>>> +    /* Jump to XEN_VIRT_START */
>>> +    mtctr   %r12
>>> +    bctr
>>> +.L_correct_address:
>>
>> Can the two regions potentially overlap? Looking at the ELF header
>> it's not clear to me what guarantees there are that this can't
>> happen.
> 
> As I understand it, any bootloader that placed the kernel at a low
> enough address for this to be an issue wouldn't be able to boot Linux or
> FreeBSD, so in practice it's a safe bet that this won't be the case.

Fair enough then.

Jan



 


Rackspace

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