All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/traps: Avoid the #GP slowpath for guest #DB exceptions
@ 2015-01-08 13:25 Andrew Cooper
  2015-01-08 14:00 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2015-01-08 13:25 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Keir Fraser, Jan Beulich, Tim Deegan

do_debug() is capable of correctly dealing with #DB exceptions in guest
context, and indeed needs to be as the 'icebp' instruction skips the DPL
check anyway.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Keir Fraser <keir@xen.org>
CC: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3cd8746..e9bc3d6 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3518,7 +3518,7 @@ void __init init_idt_traps(void)
      * has been read and saved on the stack.
      */
     set_intr_gate(TRAP_divide_error,&divide_error);
-    set_intr_gate(TRAP_debug,&debug);
+    set_swint_gate(TRAP_debug,&debug);       /* usable from all privileges */
     set_intr_gate(TRAP_nmi,&nmi);
     set_swint_gate(TRAP_int3,&int3);         /* usable from all privileges */
     set_swint_gate(TRAP_overflow,&overflow); /* usable from all privileges */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/traps: Avoid the #GP slowpath for guest #DB exceptions
  2015-01-08 13:25 [PATCH] x86/traps: Avoid the #GP slowpath for guest #DB exceptions Andrew Cooper
@ 2015-01-08 14:00 ` Jan Beulich
  2015-01-09 17:09   ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2015-01-08 14:00 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Tim Deegan, Keir Fraser, Xen-devel

>>> On 08.01.15 at 14:25, <andrew.cooper3@citrix.com> wrote:
> do_debug() is capable of correctly dealing with #DB exceptions in guest
> context, and indeed needs to be as the 'icebp' instruction skips the DPL
> check anyway.

I don't follow: ICEBP doesn't check DPL, right, but what does setting
DPL to 3 buy us? Other than for INTO and INT3, we don't want to
encourage use of INT $0x01 instructions, nor am I aware of anyone
commonly using them. Yet afaict only they would be affected by your
change. Actual #DB, just like any other hardware exceptions, don't
consider DPL just like ICEBP doesn't.

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/traps: Avoid the #GP slowpath for guest #DB exceptions
  2015-01-08 14:00 ` Jan Beulich
@ 2015-01-09 17:09   ` Andrew Cooper
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2015-01-09 17:09 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Tim Deegan, Keir Fraser, Xen-devel

On 08/01/15 14:00, Jan Beulich wrote:
>>>> On 08.01.15 at 14:25, <andrew.cooper3@citrix.com> wrote:
>> do_debug() is capable of correctly dealing with #DB exceptions in guest
>> context, and indeed needs to be as the 'icebp' instruction skips the DPL
>> check anyway.
> I don't follow: ICEBP doesn't check DPL, right, but what does setting
> DPL to 3 buy us? Other than for INTO and INT3, we don't want to
> encourage use of INT $0x01 instructions, nor am I aware of anyone
> commonly using them. Yet afaict only they would be affected by your
> change. Actual #DB, just like any other hardware exceptions, don't
> consider DPL just like ICEBP doesn't.
>
> Jan
>

I noticed it as I was attempting to get my debugtraps test case working
for PV guests, which does indeed use 'int $0x1'.  But as you point out,
it is only 'int $0x1' we would gain a fastpath for, which doesn't really
make it worthwhile.

~Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-09 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 13:25 [PATCH] x86/traps: Avoid the #GP slowpath for guest #DB exceptions Andrew Cooper
2015-01-08 14:00 ` Jan Beulich
2015-01-09 17:09   ` Andrew Cooper

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.