Re: [Xen-devel] Enabling vm_event for a guest with more VCPUs than available ring buffer slots freezes the virtual machine

2017-02-07 Thread Mihai Donțu
On Wed, 8 Feb 2017 00:09:52 +0200 Mihai Donțu wrote: > On Tue, 7 Feb 2017 22:41:57 +0200 Razvan Cojocaru wrote: > > On 02/07/2017 10:20 PM, Tamas K Lengyel wrote: > > > On Tue, Feb 7, 2017 at 11:57 AM, Razvan Cojocaru wrote: > > > On 02/07/2017 08

Re: [Xen-devel] Enabling vm_event for a guest with more VCPUs than available ring buffer slots freezes the virtual machine

2017-02-07 Thread Mihai Donțu
g the guest on vm_event init is completely pointless - we > > might as well return some kind of error if max_vcpus > available slots. > > > > I don't follow the system performance argument. Surely completely > > blocking the guest is worse. > > > > > > I also don't see the point in marking a vCPU blocked if it is already > > paused. I think this behavior of blocking vCPUs makes only sense for > > asynchronous events. Razvan, could you test what happens if > > vm_event_mark_and_pause is only called if the vCPU is unpaused? > > It works for me with this change (using Xen 4.7 sources here): > > @@ -318,7 +329,11 @@ void vm_event_put_request(struct domain *d, > * on how this mechanism works to avoid waiting. */ > avail_req = vm_event_ring_available(ved); > if( current->domain == d && avail_req < d->max_vcpus ) > -vm_event_mark_and_pause(current, ved); > +{ > +if ( !atomic_read( ¤t->vm_event_pause_count ) ) > +vm_event_mark_and_pause(current, ved); > +} If I'm reading the code correctly, when max_vcpus is greater than the number of slots available in the ring, a race appears that can lead to a ring corruption (in debug mode ASSERT(free_req > 0) will trigger). For example, when a single slot is available, two vCPUs can race to vm_event_put_request() after both being given a green light in __vm_event_claim_slot(), whose return depends only on vm_event_ring_available() returning non-zero (which it can do, for both vCPUs at the same time). As it turns out, the bug being talked about prevented this from showing up. PS: https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=3643a961195f76ba849a213628c1979240e6fbdd -- Mihai Donțu ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel

Re: [Xen-devel] BUG_ON() vs ASSERT()

2016-09-14 Thread Mihai Donțu
On Tue, 13 Sep 2016 19:25:54 +0100 Andrew Cooper wrote: > On 13/09/16 14:46, Mihai Donțu wrote: > > On Tue, 13 Sep 2016 09:10:32 -0400 Konrad Rzeszutek Wilk wrote: > >> On Mon, Sep 12, 2016 at 09:23:41AM -0600, Jan Beulich wrote: > >>> All, > >>> &

Re: [Xen-devel] BUG_ON() vs ASSERT()

2016-09-13 Thread Mihai Donțu
(close to impossible to track down). For example, a while ago I posted a small patch that would BUG_ON() when it detected that the heap chunks were not properly linked. That's the type of bug that's a pain to detect. -- Mihai Donțu ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH 4/5] x86/emulate: add support for {, v}movq xmm, xmm/m64

2016-09-08 Thread Mihai Donțu
On Thursday 08 September 2016 07:45:19 Jan Beulich wrote: > From: Mihai Donțu > > Signed-off-by: Mihai Donțu > Signed-off-by: Jan Beulich > --- > v4: Re-base on decoding changes. Address my own review comments (where > still applicable). #UD when vex.l is set. V

Re: [Xen-devel] "Tried to do a paging op on itself"

2016-08-08 Thread Mihai Donțu
e any idea why the hypervisor does not see them as being > equal? You are misreading the code: a domain cannot call xc_shadow_control() on itself. I've never played with shadow paging, but you'd probably have more luck running your code from dom0 against a user domain. -- Mihai D

Re: [Xen-devel] [PATCH v3 1/3] x86/emulate: add support for {, v}movq xmm, xmm/m64

2016-08-02 Thread Mihai Donțu
); > > + /* try to preserve the mandatory prefix for movq2dq */ > > + if ( !rex_prefix && vex.opcx == vex_none && vex.pfx == vex_f3 ) > > + buf[0] = 0xf3; > > + else > > + copy_REX_VEX(b

Re: [Xen-devel] [PATCH v3 1/3] x86/emulate: add support for {, v}movq xmm, xmm/m64

2016-08-01 Thread Mihai Donțu
mp;& vex.opcx == vex_none && vex.pfx == vex_f3 ) + buf[0] = 0xf3; + else + copy_REX_VEX(buf, rex_prefix, vex); asm volatile ( "call *%0" : : "r" (stub.func), "a" (mmvalp) : "memory" ); } -- Mihai DONȚU ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH v3 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, r32/m32 and {, v}movq mm, r64

2016-08-01 Thread Mihai Donțu
On Monday 01 August 2016 15:53:56 Andrew Cooper wrote: > On 01/08/16 15:48, Mihai Donțu wrote: > > > I'd rather pick a fixed register and update the regs->... field from that > > > after the stub was executed. E.g. using rAX and treating it just like a > > >

Re: [Xen-devel] [PATCH v3 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, r32/m32 and {, v}movq mm, r64

2016-08-01 Thread Mihai Donțu
On Monday 01 August 2016 17:48:33 Mihai Donțu wrote: > On Monday 01 August 2016 07:43:20 Jan Beulich wrote: > > > > > Your suggestion makes sense, but I'm starting to doubt my initial > > > > > patch. :-) I'm testing "movq xmm1, xmm1" an

Re: [Xen-devel] [PATCH v3 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, r32/m32 and {, v}movq mm, r64

2016-08-01 Thread Mihai Donțu
to an already complex code. Assuming I'll just pass to the stub "a"(ea.reg), would it be a good idea to just zero-out the 64bit register before that? It does not appear to be any instructions that write just the low dword. Or am I misunderstanding the zero-extension concept? -- Mihai DONȚU ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH v3 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, r32/m32 and {, v}movq mm, r64

2016-08-01 Thread Mihai Donțu
On Monday 01 August 2016 06:59:08 Jan Beulich wrote: > >>> On 01.08.16 at 14:53, wrote: > > On Monday 01 August 2016 10:52:12 Andrew Cooper wrote: > >> On 01/08/16 03:52, Mihai Donțu wrote: > >> > Found that Windows driver was using a SSE2 instruction

Re: [Xen-devel] [PATCH v3 1/3] x86/emulate: add support for {, v}movq xmm, xmm/m64

2016-08-01 Thread Mihai Donțu
uld then produce #UD. I see. Thanks for the hint. I'll try to write a test case and see if it "just works" or needs extra handling. -- Mihai DONȚU ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH v3 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, r32/m32 and {, v}movq mm, r64

2016-08-01 Thread Mihai Donțu
On Monday 01 August 2016 15:53:27 Mihai Donțu wrote: > On Monday 01 August 2016 10:52:12 Andrew Cooper wrote: > > On 01/08/16 03:52, Mihai Donțu wrote: > > > Found that Windows driver was using a SSE2 instruction MOVD. > > > > > > Signed-off-by: Zhi Wa

Re: [Xen-devel] [PATCH v3 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, r32/m32 and {, v}movq mm, r64

2016-08-01 Thread Mihai Donțu
On Monday 01 August 2016 10:52:12 Andrew Cooper wrote: > On 01/08/16 03:52, Mihai Donțu wrote: > > Found that Windows driver was using a SSE2 instruction MOVD. > > > > Signed-off-by: Zhi Wang > > Signed-off-by: Mihai Donțu > > --- > > Picked from the X

Re: [Xen-devel] [PATCH v3 3/3] x86/emulate: added tests for {, v}movd mm, r32/m32 and {, v}movq xmm, r64/m64

2016-08-01 Thread Mihai Donțu
On Monday 01 August 2016 10:54:10 Andrew Cooper wrote: > On 01/08/16 03:52, Mihai Donțu wrote: > > Signed-off-by: Mihai Donțu > > --- > > Changed since v2: > > * added tests for {,v}movq xmm,r64 > > --- > > tools/tests

[Xen-devel] [PATCH v3 3/3] x86/emulate: added tests for {, v}movd mm, r32/m32 and {, v}movq xmm, r64/m64

2016-07-31 Thread Mihai Donțu
Signed-off-by: Mihai Donțu --- Changed since v2: * added tests for {,v}movq xmm,r64 --- tools/tests/x86_emulator/test_x86_emulator.c | 120 +++ 1 file changed, 120 insertions(+) diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator

[Xen-devel] [PATCH v3 1/3] x86/emulate: add support for {, v}movq xmm, xmm/m64

2016-07-31 Thread Mihai Donțu
Signed-off-by: Mihai Donțu --- Changed since v2: * minor change to make it more obvious what the code does Changed since v1: * added a test for vmovq * made the tests depend on SSE and AVX, respectively * added emulator support for vmovq (0xd6 forces the operand size to 64bit) --- tools

[Xen-devel] [PATCH v3 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, r32/m32 and {, v}movq mm, r64

2016-07-31 Thread Mihai Donțu
Found that Windows driver was using a SSE2 instruction MOVD. Signed-off-by: Zhi Wang Signed-off-by: Mihai Donțu --- Picked from the XenServer 7 patch queue, as suggested by Andrew Cooper Changed since v2: * handle the case where the destination is a GPR --- xen/arch/x86/x86_emulate

Re: [Xen-devel] [PATCH v2 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, m32

2016-07-19 Thread Mihai Donțu
On Monday 18 July 2016 15:57:09 Andrew Cooper wrote: > On 18/07/16 15:30, Mihai Donțu wrote: > > @@ -4409,6 +4409,10 @@ x86_emulate( > > case 0x6f: /* movq mm/m64,mm */ > > /* {,v}movdq{a,u} xmm/m128,xmm */ > > /* vmovdq{a,u} ymm/m25

[Xen-devel] [PATCH v2 1/3] x86/emulate: add support for {, v}movq xmm, xmm/m64

2016-07-18 Thread Mihai Donțu
Signed-off-by: Mihai Donțu --- Changed since v1: * added a test for vmovq * made the tests depend on SSE and AVX, respectively * added emulator support for vmovq (0xd6 forces the operand size to 64bit) --- tools/tests/x86_emulator/test_x86_emulator.c | 44 xen

[Xen-devel] [PATCH v2 2/3] x86/emulate: add support of emulating SSE2 instruction {, v}movd mm, m32

2016-07-18 Thread Mihai Donțu
Found that Windows driver was using a SSE2 instruction MOVD. Signed-off-by: Zhi Wang Signed-off-by: Mihai Donțu --- Picked from the XenServer 7 patch queue, as suggested by Andrew Cooper --- xen/arch/x86/x86_emulate/x86_emulate.c | 30 +++--- 1 file changed, 27

[Xen-devel] [PATCH v2 3/3] x86/emulate: added tests for {, v}movd mm, m32

2016-07-18 Thread Mihai Donțu
Signed-off-by: Mihai Donțu --- tools/tests/x86_emulator/test_x86_emulator.c | 42 1 file changed, 42 insertions(+) diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c index 8994149..e2bd7ce 100644 --- a/tools

[Xen-devel] [PATCH] x86/emulate: add support for movq xmm,xmm/m64

2016-07-14 Thread Mihai Donțu
Signed-off-by: Mihai Donțu --- tools/tests/x86_emulator/test_x86_emulator.c | 23 +++ xen/arch/x86/x86_emulate/x86_emulate.c | 7 --- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests

Re: [Xen-devel] Side channel attack

2016-04-15 Thread Mihai Donțu
ure: $ printf "\xf\x31" | ndisasm -b 64 - 0F31 rdtsc -- Mihai Donțu ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel

Re: [Xen-devel] Bug in x86 instruction emulator?

2016-04-05 Thread Mihai Donțu
On Wed, 6 Apr 2016 02:57:35 +0300 Mihai Donțu wrote: > On Wed, 06 Apr 2016 01:38:32 +0200 wo...@openmailbox.org wrote: > > I'm running Xen 4.6.1 with Alpine Linux 3.3.3 in dom0. In a HVM domU > > with vga="qxl", Xorg will segfault instantly if tried started. Multipl

Re: [Xen-devel] Bug in x86 instruction emulator?

2016-04-05 Thread Mihai Donțu
wrt the SSE instruction set. But I do wonder why, in your case, these instructions need emulation at all. Unless touching the video RAM requires emulation. Can you try using a different video driver? I see xorg picked up qxl, maybe try vesa? -- Mihai Donțu _

Re: [Xen-devel] Interfering with memory accesses

2015-07-14 Thread Mihai Donțu
; large time penalty. Have you looked at http://libvmi.com/ ? -- Mihai Donțu ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH 1/4] hvmloader: Fixup pci_write* macros

2015-06-15 Thread Mihai Donțu
define macro(x) function(x * 2) ... macro(N + 3) You could treat this case separately though, but people often go for the "good practice". -- Mihai Donțu ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH v4] xmalloc: add support for checking the pool integrity

2015-05-12 Thread Mihai Donțu
On Wednesday 07 January 2015 19:20:38 Andrew Cooper wrote: > On 16/12/14 19:33, Mihai Donțu wrote: > > Implemented xmem_pool_check(), xmem_pool_check_locked() and > > xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. > > > > Signed-off-by: Mi

Re: [Xen-devel] Xen 4.6 Development Update (two months reminder)

2015-03-16 Thread Mihai Donțu
On Monday 16 March 2015 18:18:22 Razvan Cojocaru wrote: > On 03/16/2015 06:00 PM, Lars Kurth wrote: > > > >> On 16 Mar 2015, at 13:01, Mihai Donțu wrote: > >> > >> On Thu, 12 Mar 2015 10:21:56 + wei.l...@citrix.com wrote: > >>> We are now tw

Re: [Xen-devel] Xen 4.6 Development Update (two months reminder)

2015-03-16 Thread Mihai Donțu
merged. I'll let him choose the right moment. I will also pick up some of my [oldish] patches with reviews from Andrew and Ian and also try to tackle some of the x86 emulator challenges that we talked about some months ago. We've adjusted our plans and aim for a to-the-point set of ch

[Xen-devel] [PATCH v4] xmalloc: add support for checking the pool integrity

2014-12-16 Thread Mihai Donțu
Implemented xmem_pool_check(), xmem_pool_check_locked() and xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. Signed-off-by: Mihai Donțu --- Changes since v3: - try harder to respect the 80 column limit - use 'unsigned int' instead of 'int' where

Re: [Xen-devel] [PATCH v3] xmalloc: add support for checking the pool integrity

2014-12-10 Thread Mihai Donțu
On Wed, 10 Dec 2014 14:13:58 +0200 Mihai Donțu wrote: > Implemented xmem_pool_check(), xmem_pool_check_locked() and > xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. > > Signed-off-by: Mihai Donțu > > --- > Changes since v2: > - print the na

[Xen-devel] [PATCH] console: const-ify the arguments for __warn() and __bug()

2014-12-10 Thread Mihai Donțu
Both __warn() and __bug() take as first parameter the file name of the current compilation unit (__FILE__). Mark that parameter as constant to better reflect that. Signed-off-by: Mihai Donțu Reviewed-by: Andrew Cooper --- xen/drivers/char/console.c | 4 ++-- xen/include/xen/lib.h | 4

[Xen-devel] [PATCH v3] xmalloc: add support for checking the pool integrity

2014-12-10 Thread Mihai Donțu
Implemented xmem_pool_check(), xmem_pool_check_locked() and xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. Signed-off-by: Mihai Donțu --- Changes since v2: - print the name of the corrupted pool - adjusted the messages to better fit within 80 columns - minor style

Re: [Xen-devel] [PATCH] console: const-ify the arguments for __warn() and __bug()

2014-12-09 Thread Mihai Donțu
On Monday 08 December 2014 10:28:41 Andrew Cooper wrote: > On 08/12/14 00:19, Mihai Donțu wrote: > > Both __warn() and __bug() take as first parameter the file name of the > > current compilation unit (__FILE__). Mark that parameter as constant to > > better reflect that.

Re: [Xen-devel] [PATCH v2] xmalloc: add support for checking the pool integrity

2014-12-08 Thread Mihai Donțu
On Monday 08 December 2014 16:04:55 Ian Campbell wrote: > On Mon, 2014-12-08 at 18:00 +0200, Mihai Donțu wrote: > > On Monday 08 December 2014 10:18:01 Jan Beulich wrote: > > > >>> On 08.12.14 at 03:30, wrote: > > > > +#ifndef NDEBUG > > > > +s

Re: [Xen-devel] [PATCH v2] xmalloc: add support for checking the pool integrity

2014-12-08 Thread Mihai Donțu
+{ > > +return __xmem_pool_check_unlocked(file, line, pool ? pool : xenpool); > > For brevity, the shorter "pool ?: xenpool" is generally preferable. The > only place using this is not allowed are the public headers. > Will do. Thank you, -- Mihai DONȚU ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH v2] xmalloc: add support for checking the pool integrity

2014-12-07 Thread Mihai Donțu
On Mon, 8 Dec 2014 04:30:48 +0200 Mihai Donțu wrote: > Implemented xmem_pool_check(), xmem_pool_check_locked() and > xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. > > Signed-off-by: Mihai Donțu > > --- > Changes since v1: > - fixed the codings

[Xen-devel] [PATCH v2] xmalloc: add support for checking the pool integrity

2014-12-07 Thread Mihai Donțu
Implemented xmem_pool_check(), xmem_pool_check_locked() and xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. Signed-off-by: Mihai Donțu --- Changes since v1: - fixed the codingstyle - swaped _locked/_unlocked naming - reworked __xmem_pool_check_locked() a bit - used

[Xen-devel] [PATCH] console: const-ify the arguments for __warn() and __bug()

2014-12-07 Thread Mihai Donțu
Both __warn() and __bug() take as first parameter the file name of the current compilation unit (__FILE__). Mark that parameter as constant to better reflect that. Signed-off-by: Mihai Donțu --- xen/drivers/char/console.c | 4 ++-- xen/include/xen/lib.h | 4 ++-- 2 files changed, 4

Re: [Xen-devel] [PATCH] xmalloc: add support for checking the pool integrity

2014-12-07 Thread Mihai Donțu
; > while (0) > > ((void)(pool)) or at least drop the "0 &&" - after all you _want_ the > macro argument to be evaluated (in order to carry out side effects). > > > --- a/xen/include/xen/xmalloc.h > > +++ b/xen/include/xen/xmalloc.h > > @@ -123,4 +123,11 @@ uns

Re: [Xen-devel] [PATCH] xmalloc: add support for checking the pool integrity

2014-12-04 Thread Mihai Donțu
On Thursday 04 December 2014 19:01:40 Mihai Donțu wrote: > Implemented xmem_pool_check(), xmem_pool_check_locked() and > xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. > > Signed-off-by: Mihai Donțu > --- > xen/common/xm

[Xen-devel] [PATCH] xmalloc: add support for checking the pool integrity

2014-12-04 Thread Mihai Donțu
Implemented xmem_pool_check(), xmem_pool_check_locked() and xmem_pool_check_unlocked() to verity the integrity of the TLSF matrix. Signed-off-by: Mihai Donțu --- xen/common/xmalloc_tlsf.c | 119 +- xen/include/xen/xmalloc.h | 7 +++ 2 files changed