[Xen-devel] Relevance of global lock (/var/lock/xl) in xl tool

2019-06-07 Thread Michał Leszczyński
ementioned place, but I'm not sure if it's a correct impression. Does anyone know if there is a situation in which Xen would screw up without this lock? Best regards, Michał Leszczyński ___ Xen-devel mailing list Xen-devel@lists.xenproje

Re: [Xen-devel] Relevance of global lock (/var/lock/xl) in xl tool

2019-06-10 Thread Michał Leszczyński
st regards, Michał Leszczyński On 10.06.2019 11:41, Anthony PERARD wrote: > On Fri, Jun 07, 2019 at 02:06:30PM +0200, Michał Leszczyński wrote: >> Hello, > Hi, > >> when either "xl restore" or "xl create" command is invoked, a global lock is >> acq

Re: [PATCH 0/3] vm_event: fix race-condition when disabling monitor events

2020-05-15 Thread Michał Leszczyński
n between register event handling and disabling the vm_event interface. With Xen 4.13.0 and Windows 7 x64 DomU (2 VCPUs), my test program causes random BSODs on DomU once vm_event interface is disabled. I can confirm that after applying Patch 1 to Xen 4.13.0 the test program doesn't crash the DomU anymore, so it would actually resolve the mentioned bug. Best regards, Michał Leszczyński CERT Poland

BUG: credit=sched2 machine hang when using DRAKVUF

2020-10-22 Thread Michał Leszczyński
rare (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

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

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

[BUG] Core scheduling patches causing deadlock in some situations

2020-05-29 Thread Michał Leszczyński
u1~18.04) 7.5.0 cc_compile_by : root cc_compile_domain : cc_compile_date : Fri May 29 02:13:39 UTC 2020 build_id : 958cea737ee01f06e595d52191a6d7bb5ee67deb xend_config_format : 4 --- Best regards, Michał Leszczyński CERT Polska (XEN) parameter "no-real-mode" unknown! (XEN) parameter "ed

Re: [BUG] Core scheduling patches causing deadlock in some situations

2020-05-29 Thread Michał Leszczyński
- 29 maj 2020 o 14:44, Jürgen Groß jgr...@suse.com napisał(a): > On 29.05.20 14:30, Michał Leszczyński wrote: >> Hello, >> >> I'm running DRAKVUF on Dell Inc. PowerEdge R640/08HT8T server with Intel(R) >> Xeon(R) Gold 6132 CPU @ 2.60GHz CPU. >> When u

Re: [BUG] Core scheduling patches causing deadlock in some situations

2020-05-29 Thread Michał Leszczyński
- 29 maj 2020 o 15:15, Jürgen Groß jgr...@suse.com napisał(a): > On 29.05.20 14:51, Michał Leszczyński wrote: >> - 29 maj 2020 o 14:44, Jürgen Groß jgr...@suse.com napisał(a): >> >>> On 29.05.20 14:30, Michał Leszczyński wrote: >>>> Hello, >&

Re: [BUG] Core scheduling patches causing deadlock in some situations

2020-05-29 Thread Michał Leszczyński
- 29 maj 2020 o 18:12, Tamas K Lengyel tamas.k.leng...@gmail.com napisał(a): > On Fri, May 29, 2020 at 8:48 AM Tamas K Lengyel > wrote: >> >> On Fri, May 29, 2020 at 7:51 AM Michał Leszczyński >> wrote: >> > >> > - 29 maj 2020 o 15

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

2020-06-16 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, deter

[PATCH v1 1/7] x86/vmx: add Intel PT MSR definitions

2020-06-16 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 b328a47

[PATCH v1 2/7] x86/vmx: add IPT cpu feature

2020-06-16 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/vmx.c | 24 + xen/include/asm-x86/cpufeature.h| 1 + xen/include/asm-x86/hvm/h

[PATCH v1 3/7] x86/vmx: add ipt_state as part of vCPU state

2020-06-16 Thread Michał Leszczyński
Guest IPT state will be preserved across vmentry/vmexit using this structure. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmx.c | 2 ++ xen/include/asm-x86/hvm/vmx/vmcs.h | 10 ++ 2 files changed, 12 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arc

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

2020-06-16 Thread Michał Leszczyński
Provide an interface for privileged domains to manage external IPT monitoring. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/hvm.c | 170 xen/include/public/hvm/hvm_op.h | 27 + 2 files changed, 197 insertions(+) diff --git a/xen/arch/x86/

[PATCH v1 5/7] tools/libxc: add xc_ptbuf_* functions

2020-06-16 Thread Michał Leszczyński
Add functions in libxc that use the new HVMOP_vmtrace interface. Signed-off-by: Michal Leszczynski --- tools/libxc/include/xenctrl.h | 59 +++ tools/libxc/xc_tbuf.c | 108 ++ 2 files changed, 167 insertions(+) diff --git a/tools/libxc/inc

[PATCH v1 6/7] tools/proctrace: add proctrace tool

2020-06-16 Thread Michał Leszczyński
more useful to permit linking proprietary 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 000000..d9231dfa24 --- /dev

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

2020-06-16 Thread Michał Leszczyński
Enable IPT when entering the VM and disable it on vmexit. Register state is persisted using vCPU ipt_state structure. Signed-off-by: Michal Leszczynski --- xen/arch/x86/hvm/vmx/vmx.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/

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

2020-06-16 Thread Michał Leszczyński
- 16 cze 2020 o 19:38, Roger Pau Monné roger@citrix.com napisał(a): > On Tue, Jun 16, 2020 at 05:24:11PM +0200, Michał Leszczyński wrote: >> Enable IPT when entering the VM and disable it on vmexit. >> Register state is persisted using vCPU ipt_state structure. > &

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

2020-06-16 Thread Michał Leszczyński
- 16 cze 2020 o 20:17, Andrew Cooper andrew.coop...@citrix.com napisał(a): > On 16/06/2020 16:16, Michał Leszczyński wrote: >> Intel Processor Trace is an architectural extension available in modern Intel >> family CPUs. It allows recording the detailed trace of act

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

2020-06-17 Thread Michał Leszczyński
- 17 cze 2020 o 11:09, Roger Pau Monné roger@citrix.com napisał(a): > On Tue, Jun 16, 2020 at 07:47:07PM +0200, Michał Leszczyński wrote: >> - 16 cze 2020 o 19:38, Roger Pau Monné roger@citrix.com napisał(a): >> >> > On Tue, Jun 16, 2020 at 05:24:11PM +

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): &

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: Michal Leszc

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 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
- 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 gue

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

2020-06-18 Thread Michał Leszczyński
2c08c27f50fcead23c27a30f9e/libvmi/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 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
- 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 >>&g

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
- 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: Michal Leszc

[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, deter

[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 deletions(-)

[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 b328a47

[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 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 + xen/arch/x86/hvm/vmx/vmx

[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 insertions(

[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 ++ too

[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 ++

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 migh

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 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 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 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 backwar

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
- 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 guests, so

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 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-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 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 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-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.

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 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 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
> +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 HVMOP_vmtrace_ipt

[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, deter

[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 a/xen/common/me

[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 b328a47

[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 insertions

[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 + xen/arch/x86/hvm/vmx/vmx

[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 7/7] tools/proctrace: add proctrace tool

2020-06-22 Thread Michał Leszczyński
more useful to permit linking proprietary 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 000000..76d7387a64 --- /dev

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

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-24 Thread Michał Leszczyński
m some advanced scenario 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 v3 4/7] x86/vmx: add do_vmtrace_op

2020-06-29 Thread Michał Leszczyński
endable to x86 PV > 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

[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 the

[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 ++ xen/in

[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 + xen/include/asm-x86/hvm/v

[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 b/xen/include/asm-x8

[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 ++ tools/gola

[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 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 b/xen/a

[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 insertions(

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

2020-06-30 Thread Michał Leszczyński
ry, you may +consider it more useful to permit linking proprietary 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 000

[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(-)

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

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 02/10] x86/vmx: add IPT cpu feature

2020-07-02 Thread Michał Leszczyński
cases... > > 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 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-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

[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 b/xe

[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, deter

[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 ++ tools/gol

[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 b/

[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 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. +# +# This

[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 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 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 insertions(

[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

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 >

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 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 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 features.

  1   2   >