[Xen-devel] [PATCH 6/9] x86/vvmx: Remove operand reading from decode_vmx_inst()

2017-10-26 Thread Euan Harris
Use operand_read() to read memory operands instead of using the value read by decode_vmx_inst() in the following functions: * nvmx_handle_invept() * nvmx_handle_invvpid() * nvmx_handle_vmclear() * nvmx_handle_vmptrld() * nvmx_handle_vmxon() * nvmx_handle_vmwrite() Signed-off-by: Euan

[Xen-devel] [PATCH 1/9] x86/vvmx: Remove enum vmx_regs_enc

2017-10-26 Thread Euan Harris
This is the standard register encoding, is not VVMX-specific and is only used in a couple of places. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c| 8 xen/include/asm-x86/hvm/vmx/vvmx.h | 22 -- 2 files changed, 4 insertions(+), 26 deletions

[Xen-devel] [PATCH 5/9] x86/vvmx: Replace direct calls to reg_read() with operand_read()

2017-10-26 Thread Euan Harris
Use operand_read() to read register operands in the following functions: * nvmx_handle_vmread() * nvmx_handle_vmwrite() * nvmx_handle_invept() Direct reading of memory operands will be replaced in a separate patch. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c | 29

[Xen-devel] [PATCH 4/9] x86/vvmx: Remove unnecessary VMX operand reads

2017-10-26 Thread Euan Harris
* vpid is never used in nvmx_handle_invept() so there is no point in reading it. * vmptrst's operand is the memory address to which to write the VMCS pointer. gpa is the pointer to write. Reading the address into gpa is meaningless. Signed-off-by: Euan Harris --- xen/arc

[Xen-devel] [PATCH 9/9] x86/vvmx: Use hvm_copy_{to, from}_guest_virt() to read operands

2017-10-26 Thread Euan Harris
(), which use well-tested memory access code used in various other parts of the hypervisor. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c | 80 +++-- 1 file changed, 26 insertions(+), 54 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b

[Xen-devel] [PATCH 2/9] x86/vvmx: Unify operands in struct vmx_inst_decoded

2017-10-26 Thread Euan Harris
e always map to op[0].type in this patch because previously operand 2 could only be a register and so type was never checked when accessing it. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c | 52 - 1 file changed, 28 insertions(+), 24 deleti

[Xen-devel] [PATCH 0/9] x86/vvmx: Read instruction operands correctly on VM exit

2017-10-26 Thread Euan Harris
{to,from}_guest_virt() helpers and use them to read memory operands in place of the incorrect segmentation logic in decode_vmx_inst(). Euan Harris (9): x86/vvmx: Remove enum vmx_regs_enc x86/vvmx: Unify operands in struct vmx_inst_decoded x86/vvmx: Extract operand reading logic into ope

[Xen-devel] [PATCH 7/9] x86/vvmx: Use correct sizes when reading operands

2017-10-26 Thread Euan Harris
reading fixed-size operands, we pass the size of the variable into which the operand is to be read. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c | 48 +++-- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/hvm/vmx

[Xen-devel] [PATCH 3/9] x86/vvmx: Extract operand reading logic into operand_read()

2017-10-26 Thread Euan Harris
patch should not change the overall behaviour of the code. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c | 59 - 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c

[Xen-devel] [PATCH 8/9] x86/hvm: Add hvm_copy_{to, from}_guest_virt() helpers

2017-10-26 Thread Euan Harris
hvm_copy_{to,from}_guest_virt() copy data to and from a guest, performing segmentatino and paging checks on the provided seg:offset virtual address. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/hvm.c| 57 +++ xen/include/asm-x86/hvm/support.h

[Xen-devel] [PATCH v3 2/3] python: Extract registered watch search logic from xspy_read_watch()

2017-09-22 Thread Euan Harris
. Signed-off-by: Euan Harris Reviewed-by: Wei Liu Acked-by: Marek Marczykowski-Górecki --- Changed since v1: * Remove stray newline * Fix indentation --- tools/python/xen/lowlevel/xs/xs.c | 60 --- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a

[Xen-devel] [PATCH v3 1/3] python: Add binding for xs_fileno()

2017-09-22 Thread Euan Harris
xs_fileno() returns a file descriptor which receives events when Xenstore watches fire. Exposing this in the Python bindings is a prerequisite for writing event-driven clients in Python. Signed-off-by: Euan Harris Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Wei Liu --- Changed since v2

[Xen-devel] [PATCH v3 3/3] python: Add binding for non-blocking xs_check_watch()

2017-09-22 Thread Euan Harris
xs_check_watch() checks for watch notifications without blocking. Together with the binding for xs_fileno(), this makes it possible to write event-driven clients in Python. Signed-off-by: Euan Harris Reviewed-by: Wei Liu Acked-by: Marek Marczykowski-Górecki --- tools/python/xen/lowlevel/xs

[Xen-devel] [PATCH v3 0/3] python: Add non-blocking Xenstore watch bindings

2017-09-22 Thread Euan Harris
sh.check_watch() in a generator, but this is easier to do in Python than in the C bindings. Euan Harris (3): python: Add binding for xs_fileno() python: Extract registered watch search logic from xspy_read_watch() python: Add binding for non-blocking xs_check_watch() tools/python/xen/lowlevel/

[Xen-devel] [PATCH v2 3/3] python: Add binding for non-blocking xs_check_watch()

2017-09-21 Thread Euan Harris
xs_check_watch() checks for watch notifications without blocking. Together with the binding for xs_fileno(), this makes it possible to write event-driven clients in Python. Signed-off-by: Euan Harris Reviewed-by: Wei Liu --- tools/python/xen/lowlevel/xs/xs.c | 28

[Xen-devel] [PATCH v2 0/3] python: Add non-blocking Xenstore watch bindings

2017-09-21 Thread Euan Harris
sh.check_watch() in a generator, but this is easier to do in Python than in the C bindings. Euan Harris (3): python: Add binding for xs_fileno() python: Extract registered watch search logic from xspy_read_watch() python: Add binding for non-blocking xs_check_watch() tools/python/xen/lowlevel/

[Xen-devel] [PATCH v2 1/3] python: Add binding for xs_fileno()

2017-09-21 Thread Euan Harris
xs_fileno() returns a file descriptor which receives events when Xenstore watches fire. Exposing this in the Python bindings is a prerequisite for writing event-driven clients in Python. Signed-off-by: Euan Harris Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Wei Liu --- tools/python/xen

[Xen-devel] [PATCH v2 2/3] python: Extract registered watch search logic from xspy_read_watch()

2017-09-21 Thread Euan Harris
. Signed-off-by: Euan Harris Reviewed-by: Wei Liu --- Changed since v1: * Remove stray newline * Fix indentation tools/python/xen/lowlevel/xs/xs.c | 60 --- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools

[Xen-devel] [PATCH 2/3] python: Extract registered watch search logic from xspy_read_watch()

2017-09-15 Thread Euan Harris
. Signed-off-by: Euan Harris --- tools/python/xen/lowlevel/xs/xs.c | 61 --- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c index 9f1b916..a4b50a0 100644 --- a/tools/python/xen

[Xen-devel] [PATCH 0/3] python: Add non-blocking Xenstore watch bindings

2017-09-15 Thread Euan Harris
sh.check_watch() in a generator, but this is easier to do in Python than in the C bindings. Euan Harris (3): python: Add wrapper for xs_fileno() python: Extract registered watch search logic from xspy_read_watch() python: Add binding for non-blocking xs_check_watch() tools/python/xen/lowlevel/

[Xen-devel] [PATCH 1/3] python: Add binding for xs_fileno()

2017-09-15 Thread Euan Harris
xs_fileno() returns a file descriptor which receives events when Xenstore watches fire. Exposing this in the Python bindings is a prerequisite for writing event-driven clients in Python. Signed-off-by: Euan Harris --- tools/python/xen/lowlevel/xs/xs.c | 20 1 file changed

[Xen-devel] [PATCH 3/3] python: Add binding for non-blocking xs_check_watch()

2017-09-15 Thread Euan Harris
xs_check_watch() checks for watch notifications without blocking. Together with the binding for xs_fileno(), this makes it possible to write event-driven clients in Python. Signed-off-by: Euan Harris --- tools/python/xen/lowlevel/xs/xs.c | 28 1 file changed, 28

Re: [Xen-devel] [PATCH 2/2] nested vmx: Validate host VMX MSRs before accessing them

2016-06-09 Thread Euan Harris
On Thu, Jun 09, 2016 at 06:47:55AM -0600, Jan Beulich wrote: > > /* > > - * Those MSRs are available only when bit 55 of > > - * MSR_IA32_VMX_BASIC is set. > > + * These MSRs are only available when flags in other MSRs are set. > > + * These prerequisites are listed in the Inte

[Xen-devel] [PATCH 0/2] Validate host VMX MSRs before accessing them

2016-06-09 Thread Euan Harris
. Euan Harris (2): nested vmx: Fix comment typos in nvmx_msr_read_intercept() nested vmx: Validate host VMX MSRs before accessing them xen/arch/x86/hvm/vmx/vvmx.c | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) -- 1.7.10.4

[Xen-devel] [PATCH 1/2] nested vmx: Fix comment typos in nvmx_msr_read_intercept()

2016-06-09 Thread Euan Harris
Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index faa8b69..d9493ff 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c

[Xen-devel] [PATCH 2/2] nested vmx: Validate host VMX MSRs before accessing them

2016-06-09 Thread Euan Harris
crash with a GPF. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vvmx.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index d9493ff..ddc25bf 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b

Re: [Xen-devel] [PATCH] nested vmx: Intercept guest rdmsr for MSR_IA32_VMX_VMFUNC

2016-06-07 Thread Euan Harris
On Tue, Jun 07, 2016 at 04:35:28AM -0600, Jan Beulich wrote: > > @@ -2624,7 +2624,7 @@ static int vmx_msr_read_intercept(unsigned int msr, > > uint64_t *msr_content) > > __vmread(GUEST_IA32_DEBUGCTL, msr_content); > > break; > > case IA32_FEATURE_CONTROL_MSR: > > -case M

[Xen-devel] [PATCH] nested vmx: Intercept guest rdmsr for MSR_IA32_VMX_VMFUNC

2016-06-07 Thread Euan Harris
Guest reads of MSR_IA32_VMX_VMFUNC should be handled by the logic in vmx_msr_read_intercept(). Otherwise a guest can read the raw host value of this MSR, even if nested vmx is disabled. Signed-off-by: Euan Harris --- xen/arch/x86/hvm/vmx/vmx.c |2 +- 1 file changed, 1 insertion(+), 1

[Xen-devel] [PATCH] doc: Fix nonexistent error code in libxl_event_check example

2015-07-02 Thread Euan Harris
Fix example code in comment.libxl_event_check() can return ERROR_NOT_READY; LIBXL_NOT_READY does not exist. Signed-off-by: Euan Harris --- tools/libxl/libxl_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_event.h b/tools/libxl/libxl_event.h

Re: [Xen-devel] Cancelling asynchronous operations in libxl

2015-06-24 Thread Euan Harris
Hi, On Wed, Jan 28, 2015 at 04:57:19PM +, Ian Jackson wrote: > Euan Harris writes ("Re: Cancelling asynchronous operations in libxl"): > > On Tue, Jan 20, 2015 at 04:38:24PM +, Ian Jackson wrote: > > > * Is an API along these lines going to meet your needs ?

[Xen-devel] RFC: Proposal to improve error reporting in libxl

2015-05-20 Thread Euan Harris
Hi, Several of us at Citrix are currently working on rewriting xenopsd - the component of the Xapi toolstack which handles domain creation, destruction, device attachment and so on - to use libxl instead of libxc. One of the problems we have run into is that error reporting in libxl is not detaile

Re: [Xen-devel] [RFC PATCH v2 00/29] libxl: Cancelling asynchronous operations

2015-04-14 Thread Euan Harris
On Tue, Apr 07, 2015 at 06:19:52PM +0100, Ian Jackson wrote: > I also mentioned that you counting invocations of > libxl__ao_cancellable_register is less than ideal because it is very > coarse-grained. Yes. A nice feature of counting calls to libxl__ao_cancellable_register is that it is closely t

Re: [Xen-devel] [RFC PATCH v2 00/29] libxl: Cancelling asynchronous operations

2015-04-09 Thread Euan Harris
On Tue, Apr 07, 2015 at 06:19:52PM +0100, Ian Jackson wrote: > On the contrary, I think many long-running operations, such as suspend > and migrations, involve multiple iterations of the libxl event loop. > Actual suspend/migrate is done in a helper process; the main process > is responsible for pr

Re: [Xen-devel] [RFC PATCH v2 00/29] libxl: Cancelling asynchronous operations

2015-04-07 Thread Euan Harris
Hi, On Wed, Feb 18, 2015 at 04:10:35PM +, Euan Harris wrote: > We had a chat about testing these changes, and integrating them into xenopsd. > We agreed that we each had slightly different expectations of what we were > going to do, and when. I think we came to the follow

Re: [Xen-devel] [RFC PATCH v2 00/29] libxl: Cancelling asynchronous operations

2015-03-20 Thread Euan Harris
On Tue, Mar 03, 2015 at 12:08:04PM +, Ian Campbell wrote: > > I wouldn't recommend testing it yet until I've at least smoke tested > > it to see that things still work if you don't cancel them. > > Would review of the series be useful and/or appreciated at this stage? > > Perhaps the first ha

Re: [Xen-devel] [RFC PATCH v2 00/29] libxl: Cancelling asynchronous operations

2015-02-18 Thread Euan Harris
Hi, On Tue, Feb 10, 2015 at 08:09:47PM +, Ian Jackson wrote: > I have rebased this onto current staging. I have compiled it but > NOT EXECUTED IT AT ALL. Euan, I thought it would be useful to give > you something you could start to work on building against. > > I wouldn't recommend testing

Re: [Xen-devel] [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE

2015-02-05 Thread Euan Harris
On Thu, Feb 05, 2015 at 03:26:00PM +, Ian Jackson wrote: > Jan Beulich writes ("Re: [PATCH] tools: work around collision of -O0 and > -D_FORTIFY_SOURCE"): > > For one, PY_XCFLAGS='' wouldn't help, as we get -O0 from the > > incoming CFLAGS. > > Sorry, I meant PY_XCFLAGS='' or -O1 (as appropri

Re: [Xen-devel] Cancelling asynchronous operations in libxl

2015-02-03 Thread Euan Harris
Hi, On Mon, Feb 02, 2015 at 05:43:58PM +, Ian Jackson wrote: > Ian Jackson writes ("Re: Cancelling asynchronous operations in libxl"): > > Euan Harris writes ("Re: Cancelling asynchronous operations in libxl"): > > > The API you propose for libxl_ao_

Re: [Xen-devel] Cancelling asynchronous operations in libxl

2015-01-28 Thread Euan Harris
Hi, On Tue, Jan 20, 2015 at 04:38:24PM +, Ian Jackson wrote: > * Is an API along these lines going to meet your needs ? The API you propose for libxl_ao_cancel, as described in the comment in libxl.h, looks reasonable to us.The comment for ERROR_NOTIMPLEMENTED is a bit confusing: under w

[Xen-devel] [PATCH] libxl: Don't derefence null new_name pointer in libxl_domain_rename()

2014-12-01 Thread Euan Harris
libxl__domain_rename() unconditionally dereferences its new_name parameter, to check whether it is an empty string. Add a check to avoid a segfault if new_name is null. Signed-off-by: Euan Harris --- tools/libxl/libxl.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff

[Xen-devel] [PATCH v2] tools/Rules.mk: Don't optimize debug builds; add macro debugging information

2014-12-01 Thread Euan Harris
overrides the -O1 flag specified earlier. Also specify -g3, to add macro debugging information which allows gdb to expand macro invocations. This is useful as libxl uses many non-trivial macros. Signed-off-by: Euan Harris Changes since v1: * moved flag override to tools/Rules.mk so it affects all

Re: [Xen-devel] [PATCH] libxl/Makefile: Don't optimize debug builds; add macro debugging information

2014-12-01 Thread Euan Harris
On Mon, Dec 01, 2014 at 11:43:13AM +, Ian Campbell wrote: > On Mon, 2014-12-01 at 10:39 +0000, Euan Harris wrote: > > libxl debug builds are built with optimization level -O1, inherited from > > the CFLAGS definition in StdGNU.mk. Optimizations confuse the debugger, >

[Xen-devel] [PATCH] libxl: libxl_domain_info: fix typo in error message

2014-12-01 Thread Euan Harris
Signed-off-by: Euan Harris --- tools/libxl/libxl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index f84f7c2..c50c323 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -674,7 +674,7 @@ int libxl_domain_info

[Xen-devel] [PATCH] libxl/Makefile: Don't optimize debug builds; add macro debugging information

2014-12-01 Thread Euan Harris
overrides the -O1 flag specified earlier. Also specify -g3, to add macro debugging information which allows gdb to expand macro invocations. This is useful as libxl uses many non-trivial macros. Signed-off-by: Euan Harris --- tools/libxl/Makefile |6 ++ 1 files changed, 6 insertions(+), 0

Re: [Xen-devel] libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?

2014-11-18 Thread Euan Harris
> > I believe so, yes. The comment under "Devices" in libxl.h probably ought > > to be adjusted to say so explicitly. > > > > Ian (J) -- do you agree? > > I do. I think this applies to other kinds of device too, which might > have unspecified parameters which get filled in. > > Euan, would you

[Xen-devel] [PATCH] libxl: Document device parameter of libxl_device__add functions

2014-11-18 Thread Euan Harris
The device parameter of libxl_device__add is an in/out parameter. Unspecified fields are filled in with appropriate values for the created device when the function returns. Document this behaviour. Signed-off-by: Euan Harris --- tools/libxl/libxl.h | 4 1 file changed, 4 insertions

[Xen-devel] libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?

2014-11-18 Thread Euan Harris
Hi, If I call libxl_device_nic_add and pass in a mostly-default libxl_device_nic structure, the function fills in the unspecified default config fields with data for the NIC which it has just created: libxl_device_nic nic; libxl_device_nic_init(&nic); /* nic.de