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

Re: [PATCH] x86: fix early boot output


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Jul 2023 10:18:32 +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=TPNKuFMnJcAtiAwWAFPfnyhTPWJieqK9ZlbNC5TeTeE=; b=LVr6hxCFvZGtzO+TYwd3Z3diWomv55MHLxbeXmEtoo8xNZNelBmLCHY02cYQROHLKhGaFyv6sXwY6cUj++yvMQwyczxY5fAXx+/ju+ACTnbwX3EpjZjf/kOtopriw3aO5v3WvdmERwotv5eWg0Yq/xuHZSLeKA/JuJp5elExr5IVKIByos015Asx6QTSl7t5EfVAQNECcC2R5UyUP3HzVWxWc25PVZTYXyNI84YZOIdJUC1zkiHcGBG1hrfUo2vq/Aoj1YvoxzvNQH7yI7HaqonuvyPbkhkSkLsGq/i5+wh3/Hitne3QGPSufYrPMllAYHBn7HOaPf98RyYbYQbBBw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IsNNqcFN3BtSF7a9OBMndwv/hKzhtxrBTe63bg+x+6L4cOezFga+jy3/bSdxnWA28aWIwaP4+h9nwq2dN+W17KBU6g+WezfVX0I/F8ctFfp+jzIoVlDAEImtCdNzWcRBmtoE5tICwqOo2kA+neZO7yhaqDssEJcyYuTtchjiv+BxaTmkmtj/rzu/u4MXEUwG3CkvQeX4IuD8AETUK1iYxW3+Z6ErbPsTUVwsZPN1Reft1j2cxEAJdCpA2tyYIG5723HRQEsHlQDmLdEe1vPKEETT39GyoQlqIa+kFRj1iBnI3rYZQh0svW4W+J6MyzETtDeK0b+YLK72cbPhZMF0Ug==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 19 Jul 2023 08:18:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.07.2023 10:06, Andrew Cooper wrote:
> On 19/07/2023 8:38 am, Jan Beulich wrote:
>> Loading the VGA base address involves sym_esi(), i.e. %esi still needs
>> to hold the relocation base address. Therefore the address of the
>> message to output cannot be "passed" in %esi. Put the message offset in
>> %ecx instead, adding it into %esi _after_ its last use as base address.
>>
>> Fixes: b28044226e1c ("x86: make Xen early boot code relocatable")
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> When I was doing the label cleanup, I did wonder how this worked, given
> that it clobbered %esi.  I guess this is the answer...
> 
> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Thanks.

> Although it occurs to me that probably want to (optionally) use one of
> the IO-port/Hypercall protocols too to get these messages in PVH boot
> case too.

Probably.

>> --- a/xen/arch/x86/boot/head.S
>> +++ b/xen/arch/x86/boot/head.S
>> @@ -184,12 +184,15 @@ early_error: /* Here to improve the disa
>>           * Here we are on EFI IA-32 platform. Then reliable vga_text_buffer 
>> zap is
>>           * impossible in Multiboot2 scanning loop and we have to zero %edi 
>> below.
>>           */
>> -        add     $sym_offs(.Lbad_efi_msg), %esi
>> +        mov     $sym_offs(.Lbad_efi_msg), %ecx
>>          xor     %edi,%edi                       # No VGA text buffer
>>          jmp     .Lprint_err
>>  .Lget_vtb:
>>          mov     sym_esi(vga_text_buffer), %edi
>>  .Lprint_err:
>> +        add     %ecx, %esi     # Add string offset to relocation base.
>> +        # NOTE: No further use of sym_esi() till the end of the "function"!
> 
> Minor, but I'd phrase this as "Note: sym_esi() no longer useable".
> 
> It is obviously limited in scope, but "until the end of the function"
> gives an implication that it's fine thereafter which isn't really true.

It is very true. The use here is the first out of several dozen. It is
only not true for the code that immediately follows this function (for
an unrelated reason). If this really was the last use, I would have
taken the liberty of adding an #undef. That said, some re-ordering might
help the situation, but that's nothing I'd like to spend time on right
away.

Jan



 


Rackspace

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