From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Daniel Kiper <daniel.kiper@oracle.com>,
Keir Fraser <keir@xen.org>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] x86/setup: Correct register clobbers for the asm statement when resyncing the stack
Date: Tue, 21 Oct 2014 11:03:18 +0100 [thread overview]
Message-ID: <54462F66.6050801@citrix.com> (raw)
In-Reply-To: <544639190200007800040901@mail.emea.novell.com>
On 21/10/14 09:44, Jan Beulich wrote:
>>>> On 20.10.14 at 19:30, <andrew.cooper3@citrix.com> wrote:
>> When resyncing the stack, the asm statement does not identify %rsi, %rdi and
>> %rcx as clobbered by the 'rep movsq'.
>>
>> Luckily, there are no functional problems in the generated code. GCC
>> decides
>> not to save any of them before calling boostrap_map(), which clobbers them.
>>
>> Correct the clobbers, by listing them as earlyclobber discarded outputs.
>>
>> Reported-by: Daniel Kiper <daniel.kiper@oracle.com>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> CC: Keir Fraser <keir@xen.org>
>> CC: Jan Beulich <JBeulich@suse.com>
>>
>> ---
>>
>> I have done an audit of the other uses of `rep $STRINGOP` and this is the
>> only
>> asm statement with incorrect clobbers.
>> ---
>> xen/arch/x86/setup.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index 8c8b91f..f470c4a 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -836,6 +836,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>> l2_pgentry_t *pl2e;
>> uint64_t load_start;
>> int i, j, k;
>> + long _discard;
> I can't see why you couldn't use i, j, or k for the discarding purposes.
A parameter with the name "_discard" is far more explicit about its
purpose when read as part of the output parameter list.
I could switch to i and leave a comment by the parameters if you insist.
>
>> @@ -902,11 +903,13 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>> "movq %%cr4,%%rsi ; "
>> "andb $0x7f,%%sil ; "
>> "movq %%rsi,%%cr4 ; " /* CR4.PGE == 0 */
>> - "movq %0,%%cr3 ; " /* CR3 == new pagetables */
>> + "movq %6,%%cr3 ; " /* CR3 == new pagetables */
>> "orb $0x80,%%sil ; "
>> "movq %%rsi,%%cr4 " /* CR4.PGE == 1 */
>> - : : "r" (__pa(idle_pg_table)), "S" (cpu0_stack),
>> - "D" (__va(__pa(cpu0_stack))), "c" (STACK_SIZE / 8) : "memory" );
>> + : "=&S"(_discard), "=&D"(_discard), "=&c"(_discard)
>> + : "0"(cpu0_stack), "1"(__va(__pa(cpu0_stack))),
>> + "2"(STACK_SIZE / 8), "r"(__pa(idle_pg_table))
>> + : "memory" );
> Among the inputs, please put the one actively used by number first,
> or convert to labeled operands.
As far as I can tell, it is impossible to get the idle pagetables to
parameter %0 as it is not present in the output list. I have switched
to a named parameter.
> Also please don't corrupt the
> formatting - there ought to be a blank between the closing constraint
> quote and the opening parenthesis in all operands.
Done
~Andrew
next prev parent reply other threads:[~2014-10-21 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 17:30 [PATCH] x86/setup: Correct register clobbers for the asm statement when resyncing the stack Andrew Cooper
2014-10-20 20:21 ` Daniel Kiper
2014-10-21 8:44 ` Jan Beulich
2014-10-21 10:03 ` Andrew Cooper [this message]
2014-10-21 14:31 ` Jan Beulich
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=54462F66.6050801@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=daniel.kiper@oracle.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.