From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
X86 ML <x86@kernel.org>, Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH v2] x86/entry/64/paravirt: Use paravirt-safe macro to access eflags
Date: Fri, 1 Dec 2017 11:57:21 -0500 [thread overview]
Message-ID: <fb622b26-acb0-3203-51fe-62bfa1b5cc5b@oracle.com> (raw)
In-Reply-To: <CALCETrUmV7_khBps8F9V7QjvO4+WF+7hJb-GBhpvr8j=zZV8Fg@mail.gmail.com>
On 12/01/2017 11:22 AM, Andy Lutomirski wrote:
> On Tue, Nov 28, 2017 at 7:28 AM, Boris Ostrovsky
> <boris.ostrovsky@oracle.com> wrote:
>> Commit 1d3e53e8624a ("x86/entry/64: Refactor IRQ stacks and make
>> them NMI-safe") added DEBUG_ENTRY_ASSERT_IRQS_OFF macro that acceses
>> eflags using 'pushfq' instruction when testing for IF bit. On PV Xen
>> guests looking at IF flag directly will always see it set, resulting
>> in 'ud2'.
>>
>> Introduce SAVE_FLAGS() macro that will use appropriate save_fl pv op
>> when running paravirt.
>>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> ---
>> V2:
>> * Preserve %rax in DEBUG_ENTRY_ASSERT_IRQS_OFF
>> * Return (pop) %rax in SAVE_FLAGS for !CONFIG_PARAVIRT (irqflags.h)
>>
>> arch/x86/entry/entry_64.S | 7 ++++---
>> arch/x86/include/asm/irqflags.h | 3 +++
>> arch/x86/include/asm/paravirt.h | 9 +++++++++
>> arch/x86/kernel/asm-offsets_64.c | 3 +++
>> 4 files changed, 19 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
>> index f81d50d..c208dc1 100644
>> --- a/arch/x86/entry/entry_64.S
>> +++ b/arch/x86/entry/entry_64.S
>> @@ -466,12 +466,13 @@ END(irq_entries_start)
>>
>> .macro DEBUG_ENTRY_ASSERT_IRQS_OFF
>> #ifdef CONFIG_DEBUG_ENTRY
>> - pushfq
>> - testl $X86_EFLAGS_IF, (%rsp)
>> + pushq %rax
>> + SAVE_FLAGS(CLBR_ANY)
>> + testl $X86_EFLAGS_IF, %eax
> Confused. You're both using CLBR_ANY and RAX. Did you perhaps mean CLBR_NONE?
CLBR_NONE will restore all registers, won't it? So it should be
CLBR_RAX, should it? Otherwise we'll lose return value.
-boris
>
>> jz .Lokay_\@
>> ud2
>> .Lokay_\@:
>> - addq $8, %rsp
>> + popq %rax
>> #endif
>> .endm
>>
>>
next prev parent reply other threads:[~2017-12-01 16:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 15:28 Boris Ostrovsky
2017-11-29 7:25 ` Juergen Gross
2017-12-01 16:22 ` Andy Lutomirski
2017-12-01 16:57 ` Boris Ostrovsky [this message]
2017-12-01 17:44 ` Andy Lutomirski
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=fb622b26-acb0-3203-51fe-62bfa1b5cc5b@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®