From: Jan Beulich <jbeulich@suse.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>,
"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v2 2/6] x86/boot: Only jump into low trampoline code for real-mode boot
Date: Tue, 27 Aug 2019 10:43:13 +0200 [thread overview]
Message-ID: <06e872c8-15f5-4b23-15ef-f4cb21e61a7c@suse.com> (raw)
In-Reply-To: <232b5d233f19b926b6e8c846d4030f745dbe8585.camel@infradead.org>
On 21.08.2019 16:04, David Woodhouse wrote:
> On Mon, 2019-08-12 at 11:10 +0200, Jan Beulich wrote:
>> On 09.08.2019 17:01, David Woodhouse wrote:
>>> --- a/xen/arch/x86/boot/head.S
>>> +++ b/xen/arch/x86/boot/head.S
>>> @@ -735,7 +735,17 @@ trampoline_setup:
>>> /* Switch to low-memory stack which lives at the end of trampoline region. */
>>> mov sym_fs(trampoline_phys),%edi
>>> lea TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE(%edi),%esp
>>> + cmpb $0, sym_fs(skip_realmode)
>>> + jz 1f
>>> + /* If no-real-mode, jump straight to trampoline_protmode_entry */
>>> + lea trampoline_protmode_entry-trampoline_start(%edi),%eax
>>> + /* EBX == 0 indicates we are the BP (Boot Processor). */
>>> + xor %ebx,%ebx
>>> + jmp 2f
>>> +1:
>>> + /* Go via 16-bit code in trampoline_boot_cpu_entry */
>>> lea trampoline_boot_cpu_entry-trampoline_start(%edi),%eax
>>> +2:
>>> pushl $BOOT_CS32
>>> push %eax
>>
>> May I suggest to slightly streamline this into
>>
>> /* Switch to low-memory stack which lives at the end of trampoline region. */
>> mov sym_fs(trampoline_phys),%edi
>> lea TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE(%edi),%esp
>> /* Go via 16-bit code in trampoline_boot_cpu_entry */
>> lea trampoline_boot_cpu_entry-trampoline_start(%edi),%eax
>> cmpb $0,sym_fs(skip_realmode)
>> je 1f
>> /* If no-real-mode, jump straight to trampoline_protmode_entry */
>> lea trampoline_protmode_entry-trampoline_start(%edi),%eax
>> /* EBX == 0 indicates we are the BP (Boot Processor). */
>> xor %ebx,%ebx
>> 1:
>> pushl $BOOT_CS32
>> push %eax
>>
>> perhaps with the second slightly adapted to it now being an override
>> rather than an alternative path?
>
> It's a *temporary* alternative path, and it's gone away by the end of
> the series.
Indeed I did notice it's temporary when making it to the later patches
of the series. If all parts go in at about the same time, I think I'm
okay with leaving the code as is.
>> Additionally I think it would be nice if the clearing of %ebx wasn't
>> replicated here and ...
>>
>>> --- a/xen/arch/x86/boot/trampoline.S
>>> +++ b/xen/arch/x86/boot/trampoline.S
>>> @@ -194,9 +194,6 @@ gdt_48: .word 6*8-1
>>>
>>> .code32
>>> trampoline_boot_cpu_entry:
>>> - cmpb $0,bootsym_rel(skip_realmode,5)
>>> - jnz .Lskip_realmode
>>> -
>>> /* Load pseudo-real-mode segments. */
>>> mov $BOOT_PSEUDORM_DS,%eax
>>> mov %eax,%ds
>>> @@ -276,7 +273,6 @@ trampoline_boot_cpu_entry:
>>> mov %eax,%gs
>>> mov %eax,%ss
>>>
>>> -.Lskip_realmode:
>>> /* EBX == 0 indicates we are the BP (Boot Processor). */
>>> xor %ebx,%ebx
>>
>> ... here. Why don't you further do
>>
>> .code32
>> trampoline_protmode_entry_bsp:
>> /* EBX == 0 indicates we are the BSP (Boot Strap Processor).
>> */
>> xor %ebx,%ebx
>> trampoline_protmode_entry:
>>
>> directing the BSP paths to the new label?
>
> Yeah, I kind of see your point. But that gives us one entry point which
> clears %ebx... and one which doesn't, so you still have to make sure
> it's not already zero for the AP startup.
>
> If we ended up with two simple entry points that didn't care about %ebx
> for trampoline_protmode_entry_bsp and trampoline_protmode_entry_ap then
> that'd be nice and simple — but I don't like the inconsistency.
>
> I think I prefer having to set %ebx explicitly in all three separate
> callers, over having one entry point that requires it and another that
> doesn't.
I think differently, but I'm not going to insist if Andrew agrees with
your preference.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-08-27 8:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1565362089.git.dwmw@amazon.co.uk>
2019-08-09 15:01 ` [Xen-devel] [PATCH v2 1/6] x86/boot: Remove gratuitous call back into low-memory code David Woodhouse
2019-08-09 15:01 ` [Xen-devel] [PATCH v2 2/6] x86/boot: Only jump into low trampoline code for real-mode boot David Woodhouse
2019-08-12 9:10 ` Jan Beulich
2019-08-21 14:04 ` David Woodhouse
2019-08-27 8:43 ` Jan Beulich [this message]
2019-08-09 15:01 ` [Xen-devel] [PATCH v2 3/6] x86/boot: Split bootsym() into four types of relocations David Woodhouse
2019-08-12 9:41 ` Jan Beulich
2019-08-19 15:24 ` David Woodhouse
2019-08-09 15:02 ` [Xen-devel] [PATCH v2 4/6] x86/boot: Rename trampoline_{start, end} to boot_trampoline_{start, end} David Woodhouse
2019-08-12 9:55 ` Jan Beulich
2019-08-19 15:24 ` David Woodhouse
2019-08-27 8:51 ` Jan Beulich
2019-08-27 9:31 ` David Woodhouse
2019-08-09 15:02 ` [Xen-devel] [PATCH v2 5/6] x86/boot: Copy 16-bit boot variables back up to Xen image David Woodhouse
2019-08-12 10:24 ` Jan Beulich
2019-08-19 15:25 ` David Woodhouse
2019-08-27 8:59 ` Jan Beulich
2019-08-27 9:19 ` David Woodhouse
2019-08-09 15:02 ` [Xen-devel] [PATCH v2 6/6] x86/boot: Do not use trampoline for no-real-mode boot paths David Woodhouse
2019-08-12 10:55 ` Jan Beulich
2019-08-19 15:25 ` David Woodhouse
2019-08-27 9:07 ` Jan Beulich
2019-08-27 9:12 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06e872c8-15f5-4b23-15ef-f4cb21e61a7c@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dwmw2@infradead.org \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).