From: "H. Peter Anvin" <hpa@zytor.com>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
mingo@redhat.com, peterz@infradead.org
Cc: tglx@linutronix.de, konrad.wilk@oracle.com,
david.vrabel@citrix.com, masami.hiramatsu.pt@hitachi.com,
rostedt@goodmis.org, luto@amacapital.net, JBeulich@suse.com,
jgross@suse.com, bpoirier@suse.de, x86@kernel.org,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
"Luis R. Rodriguez" <mcgrof@suse.com>,
Borislav Petkov <bp@suse.de>
Subject: Re: [PATCH v2 2/2] x86/xen: allow privcmd hypercalls to be preempted
Date: Wed, 10 Dec 2014 16:29:06 -0800 [thread overview]
Message-ID: <5488E552.8050207@zytor.com> (raw)
In-Reply-To: <1418254487-9988-3-git-send-email-mcgrof@do-not-panic.com>
On 12/10/2014 03:34 PM, Luis R. Rodriguez wrote:
> diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
> index 344b63f..40b5c0c 100644
> --- a/arch/x86/kernel/entry_32.S
> +++ b/arch/x86/kernel/entry_32.S
> @@ -982,7 +982,28 @@ ENTRY(xen_hypervisor_callback)
> ENTRY(xen_do_upcall)
> 1: mov %esp, %eax
> call xen_evtchn_do_upcall
> +#ifdef CONFIG_PREEMPT
> jmp ret_from_intr
> +#else
> + GET_THREAD_INFO(%ebp)
> +#ifdef CONFIG_VM86
> + movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS
> + movb PT_CS(%esp), %al
> + andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
> +#else
> + movl PT_CS(%esp), %eax
> + andl $SEGMENT_RPL_MASK, %eax
> +#endif
> + cmpl $USER_RPL, %eax
> + jae resume_userspace # returning to v8086 or userspace
> + DISABLE_INTERRUPTS(CLBR_ANY)
> + cmpb $0,PER_CPU_VAR(xen_in_preemptible_hcall)
> + jz resume_kernel
> + movb $0,PER_CPU_VAR(xen_in_preemptible_hcall)
> + call cond_resched_irq
> + movb $1,PER_CPU_VAR(xen_in_preemptible_hcall)
> + jmp resume_kernel
> +#endif /* CONFIG_PREEMPT */
> CFI_ENDPROC
> ENDPROC(xen_hypervisor_callback)
>
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index c0226ab..0ccdd06 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -1170,7 +1170,23 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
> popq %rsp
> CFI_DEF_CFA_REGISTER rsp
> decl PER_CPU_VAR(irq_count)
> +#ifdef CONFIG_PREEMPT
> jmp error_exit
> +#else
> + movl %ebx, %eax
> + RESTORE_REST
> + DISABLE_INTERRUPTS(CLBR_NONE)
> + TRACE_IRQS_OFF
> + GET_THREAD_INFO(%rcx)
> + testl %eax, %eax
> + je error_exit_user
> + cmpb $0,PER_CPU_VAR(xen_in_preemptible_hcall)
> + jz retint_kernel
> + movb $0,PER_CPU_VAR(xen_in_preemptible_hcall)
> + call cond_resched_irq
> + movb $1,PER_CPU_VAR(xen_in_preemptible_hcall)
> + jmp retint_kernel
> +#endif /* CONFIG_PREEMPT */
> CFI_ENDPROC
> END(xen_do_hypervisor_callback)
>
> @@ -1398,6 +1414,7 @@ ENTRY(error_exit)
> GET_THREAD_INFO(%rcx)
> testl %eax,%eax
> jne retint_kernel
> +error_exit_user:
> LOCKDEP_SYS_EXIT_IRQ
> movl TI_flags(%rcx),%edx
> movl $_TIF_WORK_MASK,%edi
You're adding a bunch of code for the *non*-preemptive case here... why?
-hpa
next prev parent reply other threads:[~2014-12-11 0:30 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 23:34 [PATCH v2 0/2] x86: add xen hypercall preemption Luis R. Rodriguez
2014-12-10 23:34 ` [PATCH v2 1/2] sched: add cond_resched_irq() Luis R. Rodriguez
2014-12-10 23:34 ` Luis R. Rodriguez
2014-12-11 13:31 ` Jan Beulich
2014-12-11 13:31 ` Jan Beulich
[not found] ` <5489AADA020000780004EFB9@suse.com>
2014-12-11 21:06 ` Luis R. Rodriguez
2014-12-11 21:06 ` Luis R. Rodriguez
2014-12-10 23:34 ` [PATCH v2 2/2] x86/xen: allow privcmd hypercalls to be preempted Luis R. Rodriguez
2014-12-10 23:51 ` Andy Lutomirski
2014-12-10 23:51 ` Andy Lutomirski
2014-12-11 0:55 ` Luis R. Rodriguez
2014-12-11 0:55 ` Luis R. Rodriguez
2014-12-11 1:04 ` Andy Lutomirski
2014-12-11 1:04 ` Andy Lutomirski
2014-12-11 11:09 ` [Xen-devel] " David Vrabel
2014-12-11 21:05 ` Luis R. Rodriguez
2014-12-11 21:05 ` Luis R. Rodriguez
2014-12-11 11:09 ` David Vrabel
2014-12-11 0:29 ` H. Peter Anvin [this message]
2014-12-11 1:03 ` Luis R. Rodriguez
2014-12-11 1:03 ` Luis R. Rodriguez
2014-12-11 18:47 ` H. Peter Anvin
2014-12-11 20:39 ` Luis R. Rodriguez
2014-12-11 20:39 ` Luis R. Rodriguez
2014-12-11 18:47 ` H. Peter Anvin
2014-12-11 0:29 ` H. Peter Anvin
2014-12-18 19:23 ` [Xen-devel] " Konrad Rzeszutek Wilk
2015-01-13 21:21 ` Luis R. Rodriguez
2015-01-13 21:21 ` Luis R. Rodriguez
2014-12-18 19:23 ` Konrad Rzeszutek Wilk
2014-12-10 23:34 ` Luis R. Rodriguez
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=5488E552.8050207@zytor.com \
--to=hpa@zytor.com \
--cc=JBeulich@suse.com \
--cc=bp@suse.de \
--cc=bpoirier@suse.de \
--cc=david.vrabel@citrix.com \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mcgrof@do-not-panic.com \
--cc=mcgrof@suse.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--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 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.