Re: BUG: credit=sched2 machine hang when using DRAKVUF

2020-10-27 Thread Michał Leszczyński
- 23 paź, 2020 o 6:47, Jürgen Groß jgr...@suse.com napisał(a): > On 23.10.20 00:59, Michał Leszczyński wrote: >> Hello, >> >> when using DRAKVUF against a Windows 7 x64 DomU, the whole machine hangs >> after a >> few minutes. >> >> The chance

Re: BUG: credit=sched2 machine hang when using DRAKVUF

2020-10-23 Thread Michał Leszczyński
- 23 paź, 2020 o 6:47, Jürgen Groß jgr...@suse.com napisał(a): > On 23.10.20 00:59, Michał Leszczyński wrote: >> Hello, >> >> when using DRAKVUF against a Windows 7 x64 DomU, the whole machine hangs >> after a >> few minutes. >> >> The chance

BUG: credit=sched2 machine hang when using DRAKVUF

2020-10-22 Thread Michał Leszczyński
(but still occurring sometimes). The issue is observed with the default sched=credit2 and is no longer reproducible once sched=credit is set. Enclosed: panic log from my Dom0. Best regards, Michał Leszczyński CERT Polska paź 22 12:20:50 hostname kernel: rcu: INFO: rcu_sched self-detected stall

Re: [PATCH v6 00/11] Implement support for external IPT monitoring

2020-07-14 Thread Michał Leszczyński
- 7 lip 2020 o 21:39, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > Intel Processor Trace is an architectural extension available in modern Intel > family CPUs. It allows recording the detailed trace of activity while the > processor executes the code. One

[PATCH v6 11/11] tools/proctrace: add proctrace tool

2020-07-07 Thread Michał Leszczyński
@@ +# Copyright (C) CERT Polska - NASK PIB +# Author: Michał Leszczyński +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; under version 2 of the License

[PATCH v6 06/11] x86/hvm: processor trace interface in HVM

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Implement necessary changes in common code/HVM to support processor trace features. Define vmtrace_pt_* API and implement trace buffer allocation/deallocation in common code. Signed-off-by: Michal Leszczynski --- xen/arch/x86/domain.c | 21

[PATCH v6 05/11] tools/libxl: add vmtrace_pt_size parameter

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Allow to specify the size of per-vCPU trace buffer upon domain creation. This is zero by default (meaning: not enabled). Signed-off-by: Michal Leszczynski --- docs/man/xl.cfg.5.pod.in | 13 + tools/golang/xenlight/helpers.gen.go | 2 ++

[PATCH v6 08/11] x86/mm: add vmtrace_buf resource type

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Allow to map processor trace buffer using acquire_resource(). Signed-off-by: Michal Leszczynski --- xen/common/memory.c | 31 +++ xen/include/public/memory.h | 1 + 2 files changed, 32 insertions(+) diff --git

[PATCH v6 10/11] tools/libxc: add xc_vmtrace_* functions

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Add functions in libxc that use the new XEN_DOMCTL_vmtrace interface. Signed-off-by: Michal Leszczynski --- tools/libxc/Makefile | 1 + tools/libxc/include/xenctrl.h | 40 tools/libxc/xc_vmtrace.c | 87

[PATCH v6 07/11] x86/vmx: implement IPT in VMX

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Use Intel Processor Trace feature to provide vmtrace_pt_* interface for HVM/VMX. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmx.c | 110 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 + xen/include/asm-x86/hvm/vmx/vmx.h

[PATCH v6 09/11] x86/domctl: add XEN_DOMCTL_vmtrace_op

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Implement domctl to manage the runtime state of processor trace feature. Signed-off-by: Michal Leszczynski --- xen/arch/x86/domctl.c | 50 + xen/include/public/domctl.h | 28 + 2 files changed, 78

[PATCH v6 00/11] Implement support for external IPT monitoring

2020-07-07 Thread Michał Leszczyński
Intel Processor Trace is an architectural extension available in modern Intel family CPUs. It allows recording the detailed trace of activity while the processor executes the code. One might use the recorded trace to reconstruct the code flow. It means, to find out the executed code paths,

[PATCH v6 04/11] common: add vmtrace_pt_size domain parameter

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Add vmtrace_pt_size domain parameter in live domain and vmtrace_pt_order parameter in xen_domctl_createdomain. Signed-off-by: Michal Leszczynski --- xen/arch/x86/domain.c | 6 ++ xen/common/domain.c | 9 + xen/include/public/domctl.h | 1 +

[PATCH v6 01/11] memory: batch processing in acquire_resource()

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Allow to acquire large resources by allowing acquire_resource() to process items in batches, using hypercall continuation. Be aware that this modifies the behavior of acquire_resource call with frame_list=NULL. While previously it would return the size of internal array

[PATCH v6 03/11] x86/vmx: add IPT cpu feature

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Check if Intel Processor Trace feature is supported by current processor. Define vmtrace_supported global variable. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmcs.c | 15 ++- xen/common/domain.c | 2

[PATCH v6 02/11] x86/vmx: add Intel PT MSR definitions

2020-07-07 Thread Michał Leszczyński
From: Michal Leszczynski Define constants related to Intel Processor Trace features. Signed-off-by: Michal Leszczynski Acked-by: Andrew Cooper --- xen/include/asm-x86/msr-index.h | 24 1 file changed, 24 insertions(+) diff --git a/xen/include/asm-x86/msr-index.h

Re: [PATCH v4 03/10] tools/libxl: add vmtrace_pt_size parameter

2020-07-07 Thread Michał Leszczyński
- 7 lip 2020 o 13:21, Jan Beulich jbeul...@suse.com napisał(a): > On 07.07.2020 13:17, Michał Leszczyński wrote: >> So would it be OK to use uint32_t everywhere and to store the trace buffer >> size as number of kB? I think this is the most straightforward option. >>

Re: [PATCH v4 03/10] tools/libxl: add vmtrace_pt_size parameter

2020-07-07 Thread Michał Leszczyński
wrote: >>>>> Hi, >>>>> >>>>> On 03/07/2020 11:11, Roger Pau Monné wrote: >>>>>> On Fri, Jul 03, 2020 at 11:56:38AM +0200, Jan Beulich wrote: >>>>>>> On 03.07.2020 11:44, Roger Pau Monné wrote: >>>>>

Re: [PATCH v5 06/11] x86/hvm: processor trace interface in HVM

2020-07-06 Thread Michał Leszczyński
- 6 lip 2020 o 10:31, Jan Beulich jbeul...@suse.com napisał(a): > On 05.07.2020 21:11, Michał Leszczyński wrote: >> - 5 lip 2020 o 20:54, Michał Leszczyński michal.leszczyn...@cert.pl >> napisał(a): >>> --- a/xen/arch/x86/domain.c >>> +++ b/xen/arch/x86

Re: [PATCH v5 11/11] tools/proctrace: add proctrace tool

2020-07-06 Thread Michał Leszczyński
- 6 lip 2020 o 11:47, Andrew Cooper andrew.coop...@citrix.com napisał(a): > On 06/07/2020 09:33, Jan Beulich wrote: >> On 05.07.2020 20:58, Michał Leszczyński wrote: >>> - 5 lip 2020 o 20:55, Michał Leszczyński michal.leszczyn...@cert.pl >>> napisał(a): >>

Re: [PATCH v5 04/11] common: add vmtrace_pt_size domain parameter

2020-07-06 Thread Michał Leszczyński
- 5 lip 2020 o 20:54, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > From: Michal Leszczynski > > Add vmtrace_pt_size domain parameter in live domain and > vmtrace_pt_order parameter in xen_domctl_createdomain. > > Signed-off-by: Michal Leszczynski

Re: [PATCH v5 06/11] x86/hvm: processor trace interface in HVM

2020-07-06 Thread Michał Leszczyński
- 6 lip 2020 o 10:42, Roger Pau Monné roger@citrix.com napisał(a): > On Sun, Jul 05, 2020 at 08:54:59PM +0200, Michał Leszczyński wrote: >> From: Michal Leszczynski >> >> Implement necessary changes in common code/HVM to support >> processor trace featur

Re: [PATCH v5 06/11] x86/hvm: processor trace interface in HVM

2020-07-05 Thread Michał Leszczyński
- 5 lip 2020 o 20:54, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > From: Michal Leszczynski > > Implement necessary changes in common code/HVM to support > processor trace features. Define vmtrace_pt_* API and > implement trace buffer allocation/deallocation i

Re: [PATCH v5 05/11] tools/libxl: add vmtrace_pt_size parameter

2020-07-05 Thread Michał Leszczyński
- 5 lip 2020 o 20:54, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > From: Michal Leszczynski > > Allow to specify the size of per-vCPU trace buffer upon > domain creation. This is zero by default (meaning: not enabled). > > Signed-off-by: Michal Leszczynski

Re: [PATCH v5 11/11] tools/proctrace: add proctrace tool

2020-07-05 Thread Michał Leszczyński
- 5 lip 2020 o 20:55, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > From: Michal Leszczynski > > Add an demonstration tool that uses xc_vmtrace_* calls in order > to manage external IPT monitoring for DomU. > > Signed-off-by: Michal Leszczynski >

[PATCH v5 10/11] tools/libxc: add xc_vmtrace_* functions

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Add functions in libxc that use the new XEN_DOMCTL_vmtrace interface. Signed-off-by: Michal Leszczynski --- tools/libxc/Makefile | 1 + tools/libxc/include/xenctrl.h | 39 +++ tools/libxc/xc_vmtrace.c | 73

[PATCH v5 04/11] common: add vmtrace_pt_size domain parameter

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Add vmtrace_pt_size domain parameter in live domain and vmtrace_pt_order parameter in xen_domctl_createdomain. Signed-off-by: Michal Leszczynski --- xen/common/domain.c | 12 xen/include/public/domctl.h | 1 + xen/include/xen/sched.h | 4

[PATCH v5 01/11] memory: batch processing in acquire_resource()

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Allow to acquire large resources by allowing acquire_resource() to process items in batches, using hypercall continuation. Be aware that this modifies the behavior of acquire_resource call with frame_list=NULL. While previously it would return the size of internal array

[PATCH v5 11/11] tools/proctrace: add proctrace tool

2020-07-05 Thread Michał Leszczyński
@@ +# Copyright (C) CERT Polska - NASK PIB +# Author: Michał Leszczyński +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; under version 2 of the License

[PATCH v5 09/11] x86/domctl: add XEN_DOMCTL_vmtrace_op

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Implement domctl to manage the runtime state of processor trace feature. Signed-off-by: Michal Leszczynski --- xen/arch/x86/domctl.c | 48 + xen/include/public/domctl.h | 26 2 files changed, 74

[PATCH v5 06/11] x86/hvm: processor trace interface in HVM

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Implement necessary changes in common code/HVM to support processor trace features. Define vmtrace_pt_* API and implement trace buffer allocation/deallocation in common code. Signed-off-by: Michal Leszczynski --- xen/arch/x86/domain.c | 19 +++

[PATCH v5 03/11] x86/vmx: add IPT cpu feature

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Check if Intel Processor Trace feature is supported by current processor. Define vmtrace_supported global variable. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmcs.c | 15 ++- xen/common/domain.c | 2

[PATCH v5 07/11] x86/vmx: implement IPT in VMX

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Use Intel Processor Trace feature to provide vmtrace_pt_* interface for HVM/VMX. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmx.c | 109 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 + xen/include/asm-x86/hvm/vmx/vmx.h

[PATCH v5 08/11] x86/mm: add vmtrace_buf resource type

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Allow to map processor trace buffer using acquire_resource(). Signed-off-by: Michal Leszczynski --- xen/common/memory.c | 28 xen/include/public/memory.h | 1 + 2 files changed, 29 insertions(+) diff --git a/xen/common/memory.c

[PATCH v5 05/11] tools/libxl: add vmtrace_pt_size parameter

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Allow to specify the size of per-vCPU trace buffer upon domain creation. This is zero by default (meaning: not enabled). Signed-off-by: Michal Leszczynski --- docs/man/xl.cfg.5.pod.in | 11 +++ tools/golang/xenlight/helpers.gen.go | 2 ++

[PATCH v5 02/11] x86/vmx: add Intel PT MSR definitions

2020-07-05 Thread Michał Leszczyński
From: Michal Leszczynski Define constants related to Intel Processor Trace features. Signed-off-by: Michal Leszczynski Acked-by: Andrew Cooper --- xen/include/asm-x86/msr-index.h | 24 1 file changed, 24 insertions(+) diff --git a/xen/include/asm-x86/msr-index.h

[PATCH v5 00/11] Implement support for external IPT monitoring

2020-07-05 Thread Michał Leszczyński
Intel Processor Trace is an architectural extension available in modern Intel family CPUs. It allows recording the detailed trace of activity while the processor executes the code. One might use the recorded trace to reconstruct the code flow. It means, to find out the executed code paths,

Re: [PATCH v4 02/10] x86/vmx: add IPT cpu feature

2020-07-04 Thread Michał Leszczyński
- 3 lip 2020 o 9:58, Julien Grall jul...@xen.org napisał(a): > Hi, > > On 02/07/2020 21:28, Michał Leszczyński wrote: >> - 2 lip 2020 o 16:31, Julien Grall jul...@xen.org napisał(a): >> >>> On 02/07/2020 15:17, Jan Beulich wrote: >>>> On 02.07.2

Re: [PATCH v4 02/10] x86/vmx: add IPT cpu feature

2020-07-02 Thread Michał Leszczyński
- 2 lip 2020 o 10:34, Jan Beulich jbeul...@suse.com napisał(a): > On 02.07.2020 10:10, Roger Pau Monné wrote: >> On Wed, Jul 01, 2020 at 10:42:55PM +0100, Andrew Cooper wrote: >>> On 30/06/2020 13:33, Michał Leszczyński wrote: >>>> diff --git a/xen/arch/x86/hvm

Re: [PATCH v4 02/10] x86/vmx: add IPT cpu feature

2020-07-02 Thread Michał Leszczyński
> Cheers, > > [1] <9a3f4d58-e5ad-c7a1-6c5f-42aa92101...@xen.org> > [2] > > -- > Julien Grall Guys, could you express your final decision on this topic? While I understand the discussion and the arguments you've raised, I would like to know what particular elements should be moved where. So are we going abstract way, or non-abstract-x86 only way? Best regards, Michał Leszczyński CERT Polska

Re: [PATCH v4 03/10] tools/libxl: add vmtrace_pt_size parameter

2020-07-02 Thread Michał Leszczyński
- 2 lip 2020 o 11:00, Roger Pau Monné roger@citrix.com napisał(a): > On Tue, Jun 30, 2020 at 02:33:46PM +0200, Michał Leszczyński wrote: >> diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h >> index 59bdc28c89..7b8289d436 100644 >> --- a/xen/in

Re: [PATCH v4 01/10] x86/vmx: add Intel PT MSR definitions

2020-06-30 Thread Michał Leszczyński
- 30 cze 2020 o 20:03, Tamas K Lengyel tamas.k.leng...@gmail.com napisał(a): > On Tue, Jun 30, 2020 at 11:39 AM Andrew Cooper > wrote: >> >> On 30/06/2020 13:33, Michał Leszczyński wrote: >> > diff --git a/xen/include/asm-x86/msr-index.h >> > b/xen/in

[PATCH v4 06/10] memory: batch processing in acquire_resource()

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Allow to acquire large resources by allowing acquire_resource() to process items in batches, using hypercall continuation. Signed-off-by: Michal Leszczynski --- xen/common/memory.c | 32 +--- 1 file changed, 29 insertions(+), 3 deletions(-)

[PATCH v4 10/10] tools/proctrace: add proctrace tool

2020-06-30 Thread Michał Leszczyński
y applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tools/proctrace/Makefile b/tools/proctrace/Makefile new file mode 100644 index 00..2983c477fe --- /dev/null +++ b/tools/proctrace/Makefile

[PATCH v4 07/10] x86/mm: add vmtrace_buf resource type

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Allow to map processor trace buffer using acquire_resource(). Signed-off-by: Michal Leszczynski --- xen/arch/x86/mm.c | 25 + xen/include/public/memory.h | 1 + 2 files changed, 26 insertions(+) diff --git a/xen/arch/x86/mm.c

[PATCH v4 08/10] x86/domctl: add XEN_DOMCTL_vmtrace_op

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Implement domctl to manage the runtime state of processor trace feature. Signed-off-by: Michal Leszczynski --- xen/arch/x86/domctl.c | 48 + xen/include/public/domctl.h | 26 2 files changed, 74

[PATCH v4 03/10] tools/libxl: add vmtrace_pt_size parameter

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Allow to specify the size of per-vCPU trace buffer upon domain creation. This is zero by default (meaning: not enabled). Signed-off-by: Michal Leszczynski --- docs/man/xl.cfg.5.pod.in | 10 ++ tools/golang/xenlight/helpers.gen.go | 2 ++

[PATCH v4 09/10] tools/libxc: add xc_vmtrace_* functions

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Add functions in libxc that use the new XEN_DOMCTL_vmtrace interface. Signed-off-by: Michal Leszczynski --- tools/libxc/Makefile | 1 + tools/libxc/include/xenctrl.h | 39 +++ tools/libxc/xc_vmtrace.c | 73

[PATCH v4 05/10] common/domain: allocate vmtrace_pt_buffer

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Allocate processor trace buffer for each vCPU when the domain is created, deallocate trace buffers on domain destruction. Signed-off-by: Michal Leszczynski --- xen/arch/x86/domain.c| 11 +++ xen/common/domain.c | 32

[PATCH v4 04/10] x86/vmx: implement processor tracing for VMX

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Use Intel Processor Trace feature in order to provision vmtrace_pt_* features. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmx.c | 89 ++ xen/include/asm-x86/hvm/hvm.h | 38 +

[PATCH v4 01/10] x86/vmx: add Intel PT MSR definitions

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Define constants related to Intel Processor Trace features. Signed-off-by: Michal Leszczynski --- xen/include/asm-x86/msr-index.h | 37 + 1 file changed, 37 insertions(+) diff --git a/xen/include/asm-x86/msr-index.h

[PATCH v4 02/10] x86/vmx: add IPT cpu feature

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Check if Intel Processor Trace feature is supported by current processor. Define vmtrace_supported global variable. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmcs.c | 7 ++- xen/common/domain.c | 2 ++

[PATCH v4 00/10] Implement support for external IPT monitoring

2020-06-30 Thread Michał Leszczyński
From: Michal Leszczynski Intel Processor Trace is an architectural extension available in modern Intel family CPUs. It allows recording the detailed trace of activity while the processor executes the code. One might use the recorded trace to reconstruct the code flow. It means, to find out

Re: [PATCH v3 4/7] x86/vmx: add do_vmtrace_op

2020-06-29 Thread Michał Leszczyński
t; guests and ARM CoreSight, and oughtn't to explode when creating guests > on non-Intel hardware. > > Thanks, > > ~Andrew Thanks for your review, I'm almost done addressing all these remarks. I've converted HVMOP to DOMCTL and splitted patches to smaller pieces. I will send v4 soon. Best regards, Michał Leszczyński

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-24 Thread Michał Leszczyński
and is trying to run many domains (e.g. 20), it's much better to have 19 domains working fine and 1 prematurely crashing because of -ENOMEM, rather than have all 20 domains randomly crashing in runtime because it turned out there is a shortage of memory. Best regards, Michał Leszczyński CERT Polska

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-22 Thread Michał Leszczyński
- 22 cze 2020 o 18:16, Jan Beulich jbeul...@suse.com napisał(a): > On 22.06.2020 18:02, Michał Leszczyński wrote: >> - 22 cze 2020 o 17:22, Jan Beulich jbeul...@suse.com napisał(a): >>> On 22.06.2020 16:35, Michał Leszczyński wrote: >>>> - 22 cze 2

Re: [PATCH v3 0/7] Implement support for external IPT monitoring

2020-06-22 Thread Michał Leszczyński
- 22 cze 2020 o 20:06, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > This patch series implements an interface that Dom0 could use in order to > enable IPT for particular vCPUs in DomU, allowing for external monitoring. > Such > a feature has numerous applications

[PATCH v3 7/7] tools/proctrace: add proctrace tool

2020-06-22 Thread Michał Leszczyński
+library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tools/proctrace/Makefile b/tools/proctrace/Makefile new file mode 100644 index 00..76d7387a64 --- /dev/null +++ b/tools/proctrace/Makefile @@ -0,0 +1,50 @@ +# Copyrigh

[PATCH v3 6/7] tools/libxl: add vmtrace_pt_size parameter

2020-06-22 Thread Michał Leszczyński
Allow to specify the size of per-vCPU trace buffer upon domain creation. This is zero by default (meaning: not enabled). Signed-off-by: Michal Leszczynski --- docs/man/xl.cfg.5.pod.in | 10 ++ tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go

[PATCH v3 5/7] tools/libxc: add xc_vmtrace_* functions

2020-06-22 Thread Michał Leszczyński
Add functions in libxc that use the new HVMOP_vmtrace interface. Signed-off-by: Michal Leszczynski --- tools/libxc/Makefile | 1 + tools/libxc/include/xenctrl.h | 39 +++ tools/libxc/xc_vmtrace.c | 94 +++ 3 files changed, 134

[PATCH v3 4/7] x86/vmx: add do_vmtrace_op

2020-06-22 Thread Michał Leszczyński
Provide an interface for privileged domains to manage external IPT monitoring. Guest IPT state will be preserved across vmentry/vmexit using ipt_state structure. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/hvm.c | 168 +

[PATCH v3 3/7] x86/vmx: add IPT cpu feature

2020-06-22 Thread Michał Leszczyński
Check if Intel Processor Trace feature is supported by current processor. Define hvm_ipt_supported function. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmcs.c | 7 ++- xen/include/asm-x86/cpufeature.h| 1 + xen/include/asm-x86/hvm/hvm.h

[PATCH v3 2/7] x86/vmx: add Intel PT MSR definitions

2020-06-22 Thread Michał Leszczyński
Define constants related to Intel Processor Trace features. Signed-off-by: Michal Leszczynski --- xen/include/asm-x86/msr-index.h | 37 + 1 file changed, 37 insertions(+) diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h index

[PATCH v3 1/7] memory: batch processing in acquire_resource()

2020-06-22 Thread Michał Leszczyński
Allow to acquire large resources by allowing acquire_resource() to process items in batches, using hypercall continuation. Signed-off-by: Michal Leszczynski --- xen/common/memory.c | 32 +--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git

[PATCH v3 0/7] Implement support for external IPT monitoring

2020-06-22 Thread Michał Leszczyński
Intel Processor Trace is an architectural extension available in modern Intel family CPUs. It allows recording the detailed trace of activity while the processor executes the code. One might use the recorded trace to reconstruct the code flow. It means, to find out the executed code paths,

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-22 Thread Michał Leszczyński
> +struct xen_hvm_vmtrace_op { > +/* IN variable */ > +uint32_t version; /* HVMOP_VMTRACE_INTERFACE_VERSION */ > +uint32_t cmd; > +/* Enable/disable external vmtrace for given domain */ > +#define HVMOP_vmtrace_ipt_enable 1 > +#define

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-22 Thread Michał Leszczyński
- 22 cze 2020 o 18:25, Roger Pau Monné roger@citrix.com napisał(a): > On Mon, Jun 22, 2020 at 06:16:57PM +0200, Jan Beulich wrote: >> On 22.06.2020 18:02, Michał Leszczyński wrote: >> > - 22 cze 2020 o 17:22, Jan Beulich jbeul...@suse.com napisał(a): >> >&g

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-22 Thread Michał Leszczyński
- 22 cze 2020 o 18:16, Jan Beulich jbeul...@suse.com napisał(a): > On 22.06.2020 18:02, Michał Leszczyński wrote: >> - 22 cze 2020 o 17:22, Jan Beulich jbeul...@suse.com napisał(a): >>> On 22.06.2020 16:35, Michał Leszczyński wrote: >>>> - 22 cze 2

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-22 Thread Michał Leszczyński
- 22 cze 2020 o 17:22, Jan Beulich jbeul...@suse.com napisał(a): > On 22.06.2020 16:35, Michał Leszczyński wrote: >> - 22 cze 2020 o 15:25, Jan Beulich jbeul...@suse.com napisał(a): >>> On 19.06.2020 01:41, Michał Leszczyński wrote: >>>> + >>&g

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-22 Thread Michał Leszczyński
- 22 cze 2020 o 15:25, Jan Beulich jbeul...@suse.com napisał(a): > On 19.06.2020 01:41, Michał Leszczyński wrote: >> + >> +domain_pause(d); > > Who's the intended caller of this interface? You making it a hvm-op > suggests the guest may itself call this. But o

Re: [PATCH v2 1/7] xen/mm: lift 32 item limit from mfn/gfn arrays

2020-06-21 Thread Michał Leszczyński
- 19 cze 2020 o 14:39, Jan Beulich jbeul...@suse.com napisał(a): > On 19.06.2020 14:35, Michał Leszczyński wrote: >> - 19 cze 2020 o 13:34, Roger Pau Monné roger@citrix.com napisał(a): >> >>> On Fri, Jun 19, 2020 at 01:38:00AM +0200, Michał Leszczyński wrot

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-21 Thread Michał Leszczyński
- 19 cze 2020 o 1:41, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > Provide an interface for privileged domains to manage > external IPT monitoring. Guest IPT state will be preserved > across vmentry/vmexit using ipt_state structure. > > Signed-off-by: Mic

Re: [PATCH v2 3/7] x86/vmx: add IPT cpu feature

2020-06-21 Thread Michał Leszczyński
- 19 cze 2020 o 15:44, Roger Pau Monné roger@citrix.com napisał(a): > On Fri, Jun 19, 2020 at 01:40:21AM +0200, Michał Leszczyński wrote: >> Check if Intel Processor Trace feature is supported by current >> processor. Define hvm_ipt_supported function. >> >

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-21 Thread Michał Leszczyński
- 19 cze 2020 o 17:50, Jan Beulich jbeul...@suse.com napisał(a): > On 19.06.2020 17:30, Roger Pau Monné wrote: >> On Fri, Jun 19, 2020 at 01:41:03AM +0200, Michał Leszczyński wrote: >>> --- a/xen/arch/x86/hvm/hvm.c >>> +++ b/xen/arch/x86/hvm/hvm.c >

Re: [PATCH v2 3/7] x86/vmx: add IPT cpu feature

2020-06-19 Thread Michał Leszczyński
- 19 cze 2020 o 15:44, Roger Pau Monné roger@citrix.com napisał(a): > On Fri, Jun 19, 2020 at 01:40:21AM +0200, Michał Leszczyński wrote: >> Check if Intel Processor Trace feature is supported by current >> processor. Define hvm_ipt_supported function. >> >

Re: [PATCH for-4.14] x86/msr: Disallow access to Processor Trace MSRs

2020-06-19 Thread Michał Leszczyński
- 19 cze 2020 o 14:49, Jan Beulich jbeul...@suse.com napisał(a): > On 19.06.2020 14:10, Michał Leszczyński wrote: >> - 19 cze 2020 o 13:58, Andrew Cooper andrew.coop...@citrix.com >> napisał(a): >> >>> We do not expose the feature to gue

Re: [PATCH v2 1/7] xen/mm: lift 32 item limit from mfn/gfn arrays

2020-06-19 Thread Michał Leszczyński
- 19 cze 2020 o 13:34, Roger Pau Monné roger@citrix.com napisał(a): > On Fri, Jun 19, 2020 at 01:38:00AM +0200, Michał Leszczyński wrote: >> Replace on-stack array allocation with heap allocation >> in order to lift the limit of 32 items in mfn/gfn arrays >> when cal

Re: [PATCH for-4.14] x86/msr: Disallow access to Processor Trace MSRs

2020-06-19 Thread Michał Leszczyński
> CC: Paul Durrant > CC: Michał Leszczyński > > Paul: For 4.14. This needs backporting to older trees as well. > > Michał: CC'ing, just to keep you in the loop. Xen has some dubious default > MSR semantics which we're still in the middle of untangling in a backwards > co

Re: [PATCH v2 1/7] xen/mm: lift 32 item limit from mfn/gfn arrays

2020-06-19 Thread Michał Leszczyński
- 19 cze 2020 o 13:48, Jan Beulich jbeul...@suse.com napisał(a): > On 19.06.2020 13:36, Michał Leszczyński wrote: >> - 19 cze 2020 o 13:34, Roger Pau Monné roger@citrix.com napisał(a): >> >>> On Fri, Jun 19, 2020 at 01:38:00AM +0200, Michał Leszczyński wrot

Re: [PATCH v2 1/7] xen/mm: lift 32 item limit from mfn/gfn arrays

2020-06-19 Thread Michał Leszczyński
- 19 cze 2020 o 13:34, Roger Pau Monné roger@citrix.com napisał(a): > On Fri, Jun 19, 2020 at 01:38:00AM +0200, Michał Leszczyński wrote: >> Replace on-stack array allocation with heap allocation >> in order to lift the limit of 32 items in mfn/gfn arrays >> when cal

Re: [PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-18 Thread Michał Leszczyński
- 19 cze 2020 o 1:41, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > Provide an interface for privileged domains to manage > external IPT monitoring. Guest IPT state will be preserved > across vmentry/vmexit using ipt_state structure. > > Signed-off-by: Mic

Re: [PATCH v2 0/7] Implement support for external IPT monitoring

2020-06-18 Thread Michał Leszczyński
- 19 cze 2020 o 1:34, Michał Leszczyński michal.leszczyn...@cert.pl napisał(a): > Intel Processor Trace is an architectural extension available in modern Intel > family CPUs. It allows recording the detailed trace of activity while the > processor executes the code. One

[PATCH v2 7/7] tools/proctrace: add proctrace tool

2020-06-18 Thread Michał Leszczyński
Add an demonstration tool that uses xc_vmtrace_* calls in order to manage external IPT monitoring for DomU. Signed-off-by: Michal Leszczynski --- tools/proctrace/COPYING | 339 tools/proctrace/Makefile| 50 ++ tools/proctrace/proctrace.c | 153

[PATCH v2 5/7] tools/libxc: add xc_vmtrace_* functions

2020-06-18 Thread Michał Leszczyński
Add functions in libxc that use the new HVMOP_vmtrace interface. Signed-off-by: Michal Leszczynski --- tools/libxc/Makefile | 1 + tools/libxc/include/xenctrl.h | 39 ++ tools/libxc/xc_vmtrace.c | 97 +++ 3 files changed, 137

[PATCH v2 6/7] tools/libxl: add vmtrace_pt_size parameter

2020-06-18 Thread Michał Leszczyński
Allow to specify the size of per-vCPU trace buffer upon domain creation. This is zero by default (meaning: not enabled). Signed-off-by: Michal Leszczynski --- tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/libxl/libxl_types.idl | 2 ++

[PATCH v2 4/7] x86/vmx: add do_vmtrace_op

2020-06-18 Thread Michał Leszczyński
Provide an interface for privileged domains to manage external IPT monitoring. Guest IPT state will be preserved across vmentry/vmexit using ipt_state structure. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/hvm.c | 167 +

[PATCH v2 3/7] x86/vmx: add IPT cpu feature

2020-06-18 Thread Michał Leszczyński
Check if Intel Processor Trace feature is supported by current processor. Define hvm_ipt_supported function. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmcs.c | 4 xen/include/asm-x86/cpufeature.h| 1 + xen/include/asm-x86/hvm/hvm.h

[PATCH v2 2/7] x86/vmx: add Intel PT MSR definitions

2020-06-18 Thread Michał Leszczyński
Define constants related to Intel Processor Trace features. Signed-off-by: Michal Leszczynski --- xen/include/asm-x86/msr-index.h | 37 + 1 file changed, 37 insertions(+) diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h index

[PATCH v2 1/7] xen/mm: lift 32 item limit from mfn/gfn arrays

2020-06-18 Thread Michał Leszczyński
Replace on-stack array allocation with heap allocation in order to lift the limit of 32 items in mfn/gfn arrays when calling acquire_resource. Signed-off-by: Michal Leszczynski --- xen/common/memory.c | 39 +-- 1 file changed, 17 insertions(+), 22

[PATCH v2 0/7] Implement support for external IPT monitoring

2020-06-18 Thread Michał Leszczyński
Intel Processor Trace is an architectural extension available in modern Intel family CPUs. It allows recording the detailed trace of activity while the processor executes the code. One might use the recorded trace to reconstruct the code flow. It means, to find out the executed code paths,

Re: [PATCH v1 4/7] x86/vmx: add do_vmtrace_op

2020-06-18 Thread Michał Leszczyński
- 16 cze 2020 o 19:23, Roger Pau Monné roger@citrix.com napisał(a): > On Tue, Jun 16, 2020 at 05:22:06PM +0200, Michał Leszczyński wrote: >> Provide an interface for privileged domains to manage >> external IPT monitoring. >> >> Signed-off-by: Mich

Re: [PATCH v1 0/7] Implement support for external IPT monitoring

2020-06-18 Thread Michał Leszczyński
- 17 cze 2020 o 18:19, Andrew Cooper andrew.coop...@citrix.com napisał(a): > On 17/06/2020 04:02, Tamas K Lengyel wrote: >> On Tue, Jun 16, 2020 at 2:17 PM Andrew Cooper >> wrote: >>> On 16/06/2020 19:47, Michał Leszczyński wrote: >>>> - 16 cze 202

Re: [PATCH v1 4/7] x86/vmx: add do_vmtrace_op

2020-06-18 Thread Michał Leszczyński
- 18 cze 2020 o 14:51, Jan Beulich jbeul...@suse.com napisał(a): > On 18.06.2020 13:55, Roger Pau Monné wrote: >> On Thu, Jun 18, 2020 at 01:01:39PM +0200, Michał Leszczyński wrote: >>> It was previously stated that: >>> >>>> PVH or HVM domain >>

Re: [PATCH v1 7/7] x86/vmx: switch IPT MSRs on vmentry/vmexit

2020-06-18 Thread Michał Leszczyński
- 18 cze 2020 o 10:52, Roger Pau Monné roger@citrix.com napisał(a): > On Wed, Jun 17, 2020 at 08:56:57PM +0200, Michał Leszczyński wrote: >> - 17 cze 2020 o 17:14, Andrew Cooper andrew.coop...@citrix.com >> napisał(a): >> >> > On 17/06/2020 13:51, Roger

Re: [PATCH v1 4/7] x86/vmx: add do_vmtrace_op

2020-06-18 Thread Michał Leszczyński
vmi/driver/xen/xen.c#L51 An essential abstraction xen_get_memory() relies on xc_map_foreign_range(). Doesn't this mean that it's not usable from PVH or HVM domains, or did I got it all wrong? Best regards, Michał Leszczyński CERT Polska

Re: [PATCH v1 0/7] Implement support for external IPT monitoring

2020-06-17 Thread Michał Leszczyński
- 18 cze 2020 o 1:29, Kang, Luwei luwei.k...@intel.com napisał(a): >> > > How does KVM deal with this, do they insert/modify trace packets on >> > > trapped and emulated instructions by the VMM? >> > >> > The KVM includes instruction decoder and >> emulator(arch/x86/kvm/emulate.c), and the

Re: [PATCH v1 0/7] Implement support for external IPT monitoring

2020-06-17 Thread Michał Leszczyński
- 17 cze 2020 o 18:19, Andrew Cooper andrew.coop...@citrix.com napisał(a): > On 17/06/2020 04:02, Tamas K Lengyel wrote: >> On Tue, Jun 16, 2020 at 2:17 PM Andrew Cooper >> wrote: >>> On 16/06/2020 19:47, Michał Leszczyński wrote: >>>> - 16 cze 202

Re: [PATCH v1 0/7] Implement support for external IPT monitoring

2020-06-17 Thread Michał Leszczyński
- 17 cze 2020 o 18:27, Tamas K Lengyel tamas.k.leng...@gmail.com napisał(a): > On Wed, Jun 17, 2020 at 10:19 AM Andrew Cooper > wrote: >> >> On 17/06/2020 04:02, Tamas K Lengyel wrote: >> > On Tue, Jun 16, 2020 at 2:17 PM Andrew Cooper >> > wrot

Re: [PATCH v1 4/7] x86/vmx: add do_vmtrace_op

2020-06-17 Thread Michał Leszczyński
- 16 cze 2020 o 19:23, Roger Pau Monné roger@citrix.com napisał(a): > On Tue, Jun 16, 2020 at 05:22:06PM +0200, Michał Leszczyński wrote: >> Provide an interface for privileged domains to manage >> external IPT monitoring. >> >> Signed-off-by: Mich

Re: [PATCH v1 7/7] x86/vmx: switch IPT MSRs on vmentry/vmexit

2020-06-17 Thread Michał Leszczyński
- 17 cze 2020 o 17:14, Andrew Cooper andrew.coop...@citrix.com napisał(a): > On 17/06/2020 13:51, Roger Pau Monné wrote: >> On Wed, Jun 17, 2020 at 01:54:45PM +0200, Michał Leszczyński wrote: >>> - 17 cze 2020 o 11:09, Roger Pau Monné roger@citrix.com napisał(a): &

  1   2   >