[Xen-devel] [PATCH V5 3/3] x86/altp2m: fix display frozen when switching to a new view early

2018-11-11 Thread Razvan Cojocaru
p2m_change_entry_type_global(), p2m_memory_type_changed and p2m_change_type_range() to propagate their changes to all valid altp2ms. Signed-off-by: Razvan Cojocaru Suggested-by: George Dunlap --- CC: Jun Nakajima CC: Kevin Tian CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu --- Changes

[Xen-devel] [PATCH V5 0/3] Fix VGA logdirty related display freezes with altp2m

2018-11-11 Thread Razvan Cojocaru
This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display). Since the last version of the series, what was previously the second (and last) patch has been split in two patches, the first of which only conc

Re: [Xen-devel] [PATCH V5 2/3] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-13 Thread Razvan Cojocaru
On 11/13/18 7:57 PM, George Dunlap wrote: > On 11/11/18 2:07 PM, Razvan Cojocaru wrote: >> This patch is a pre-requisite for the one fixing VGA logdirty >> freezes when using altp2m. It only concerns itself with the >> ranges allocation / deallocation / initialization part.

Re: [Xen-devel] [PATCH V5 2/3] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-13 Thread Razvan Cojocaru
On 11/13/18 8:43 PM, Razvan Cojocaru wrote: > On 11/13/18 7:57 PM, George Dunlap wrote: >> On 11/11/18 2:07 PM, Razvan Cojocaru wrote: >> At the moment we essentially have two "init" states: >> * After domain creation; altp2m structures allocated, but no rangesets, &

Re: [Xen-devel] [PATCH V5 1/3] x86/altp2m: propagate ept.ad changes to all active altp2ms

2018-11-13 Thread Razvan Cojocaru
On 11/14/18 7:44 AM, Tian, Kevin wrote: >> From: Razvan Cojocaru [mailto:rcojoc...@bitdefender.com] >> Sent: Sunday, November 11, 2018 10:07 PM >> >> This patch is a pre-requisite for fixing the logdirty VGA issue >> (display freezes when switching to a new altp

Re: [Xen-devel] [PATCH V5 3/3] x86/altp2m: fix display frozen when switching to a new view early

2018-11-13 Thread Razvan Cojocaru
On 11/14/18 7:55 AM, Tian, Kevin wrote: >> From: Razvan Cojocaru [mailto:rcojoc...@bitdefender.com] >> Sent: Sunday, November 11, 2018 10:07 PM >> >> When an new altp2m view is created very early on guest boot, the >> display will freeze (although the guest will r

Re: [Xen-devel] [PATCH V5 3/3] x86/altp2m: fix display frozen when switching to a new view early

2018-11-13 Thread Razvan Cojocaru
On 11/14/18 9:35 AM, Tian, Kevin wrote: +#ifdef CONFIG_HVM +/* There's already a memory_type_changed() in asm/mtrr.h. */ +static void _memory_type_changed(struct p2m_domain *p2m) +{ +if ( p2m->memory_type_changed ) +p2m->memory_type_changed(p2m); } >>

Re: [Xen-devel] [PATCH V5 2/3] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-14 Thread Razvan Cojocaru
On 11/14/18 1:58 PM, George Dunlap wrote: > On 11/13/18 6:43 PM, Razvan Cojocaru wrote: >> On 11/13/18 7:57 PM, George Dunlap wrote: >>> On 11/11/18 2:07 PM, Razvan Cojocaru wrote: >>>> @@ -2341,6 +2380,7 @@ int p2m_destroy_altp2m_by_id(struct dom

Re: [Xen-devel] [PATCH V5 2/3] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-14 Thread Razvan Cojocaru
On 11/14/18 4:00 PM, Jan Beulich wrote: >>>> On 14.11.18 at 13:50, wrote: >> On 11/14/18 1:58 PM, George Dunlap wrote: >>> On 11/13/18 6:43 PM, Razvan Cojocaru wrote: >>>> On 11/13/18 7:57 PM, George Dunlap wrote: >>>>> On 11/11/18 2:07 PM, R

[Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-14 Thread Razvan Cojocaru
p2m_change_entry_type_global(), p2m_memory_type_changed and p2m_change_type_range() to propagate their changes to all valid altp2ms. With the introduction of altp2m fields in p2m_memory_type_changed() the whole function has been put under CONFIG_HVM. Signed-off-by: Razvan Cojocaru Suggested-by: George Dunlap

[Xen-devel] [PATCH V6 2/4] x86/mm: introduce p2m_{init, free}_logdirty()

2018-11-14 Thread Razvan Cojocaru
-by: Razvan Cojocaru --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu --- Changes since V5: - Added this new patch by splitting the former second patch for easier review. --- xen/arch/x86/mm/p2m.c | 46 ++ 1 file changed,

[Xen-devel] [PATCH V6 0/4] Fix VGA logdirty related display freezes with altp2m

2018-11-14 Thread Razvan Cojocaru
This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display). Since the last version of the series, what was previously the second patch has been split in two patches. The first patch propagates ept.ad cha

[Xen-devel] [PATCH V6 3/4] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-14 Thread Razvan Cojocaru
ed to reduce code repetition, and it now takes the p2m lock. Similar refactoring has been done with p2m_activate_altp2m(). Signed-off-by: Razvan Cojocaru --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu --- Changes since V5: - This is the second part of the former second

[Xen-devel] [PATCH V6 1/4] x86/altp2m: propagate ept.ad changes to all active altp2ms

2018-11-14 Thread Razvan Cojocaru
.ad value. The p2m_{en,dis}able_hardware_log_dirty() hostp2m locking has been moved to the new ept_{en,dis}able_hardware_log_dirty() functions as part of the code refactoring, while locks for the individual altp2ms are taken in ept_set_ad_sync() (called by ept_{en,dis}able_pml()). Signed-off-by:

Re: [Xen-devel] [PATCH V6 3/4] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-15 Thread Razvan Cojocaru
On 11/15/18 12:56 PM, Jan Beulich wrote: On 14.11.18 at 21:40, wrote: >> --- a/xen/arch/x86/mm/p2m.c >> +++ b/xen/arch/x86/mm/p2m.c >> @@ -2282,6 +2282,34 @@ bool_t p2m_altp2m_lazy_copy(struct vcpu *v, paddr_t >> gpa, >> return 1; >> } >> >> +static void p2m_reset_altp2m(struct domai

Re: [Xen-devel] [PATCH V6 3/4] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-15 Thread Razvan Cojocaru
On 11/15/18 5:52 PM, George Dunlap wrote: > > >> On Nov 14, 2018, at 8:40 PM, Razvan Cojocaru >> wrote: >> >> This patch is a pre-requisite for the one fixing VGA logdirty >> freezes when using altp2m. It only concerns itself with the >> ranges alloc

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-15 Thread Razvan Cojocaru
On 11/15/18 7:34 PM, George Dunlap wrote: > > >> On Nov 14, 2018, at 8:40 PM, Razvan Cojocaru >> wrote: >> >> When an new altp2m view is created very early on guest boot, the >> display will freeze (although the guest will run normally). This >> ma

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-15 Thread Razvan Cojocaru
On 11/15/18 10:26 PM, George Dunlap wrote: > > >> On Nov 14, 2018, at 8:40 PM, Razvan Cojocaru >> wrote: >> >> When an new altp2m view is created very early on guest boot, the >> display will freeze (although the guest will run normally). This >> ma

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-16 Thread Razvan Cojocaru
On 11/16/18 12:08 PM, Jan Beulich wrote: > I've seen you mention such or alike a couple of times now while > discussing this series, and I have to admit that I'm a little frightened: > Making a change just based on the observation that nothing breaks > is setting us up for breakage in some corner c

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-16 Thread Razvan Cojocaru
On 11/16/18 2:03 PM, George Dunlap wrote: > On 11/16/18 10:08 AM, Jan Beulich wrote: >>>>> On 15.11.18 at 18:54, wrote: >>> On 11/15/18 7:34 PM, George Dunlap wrote: >>>>> On Nov 14, 2018, at 8:40 PM, Razvan Cojocaru >>>>> wrote: >

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-16 Thread Razvan Cojocaru
On 11/16/18 2:03 PM, George Dunlap wrote: > The code is definitely complicated enough, though, that I may have > missed something, which is why I asked Razvan if there was a reason he > changed it. > > For the purposes of this patch, I propose having p2m_altp2m_init_ept() > set max_mapped_pfn to 0

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-16 Thread Razvan Cojocaru
On 11/16/18 7:59 PM, George Dunlap wrote: > On 11/16/18 2:10 PM, Razvan Cojocaru wrote: >> On 11/16/18 2:03 PM, George Dunlap wrote: >>> The code is definitely complicated enough, though, that I may have >>> missed something, which is why I asked Razvan if there was

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-17 Thread Razvan Cojocaru
On 11/16/18 9:50 PM, Razvan Cojocaru wrote: > On 11/16/18 7:59 PM, George Dunlap wrote: >> On the other hand, we want the logdirty rangesets to actually match the >> host's rangesets; using altp2m->max_mapped_pfn for this is clearly >> wrong. The easiest fix would

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-19 Thread Razvan Cojocaru
On 11/19/18 2:42 PM, Jan Beulich wrote: On 16.11.18 at 16:52, wrote: >> On 11/16/18 3:05 PM, George Dunlap wrote: >>> Now take change_type_range. The global effect of change_type_range >>> should be that reads of the p2m which happen afterwards should have the >>> new, changed value. >>> >>>

Re: [Xen-devel] [PATCH V6 4/4] x86/altp2m: fix display frozen when switching to a new view early

2018-11-19 Thread Razvan Cojocaru
On 11/19/18 5:58 PM, George Dunlap wrote: > On 11/17/18 6:58 PM, Razvan Cojocaru wrote: >> On 11/16/18 9:50 PM, Razvan Cojocaru wrote: >>> On 11/16/18 7:59 PM, George Dunlap wrote: >>>> On the other hand, we want the logdirty rangesets to actually match the >&

[Xen-devel] [PATCH V7 5/5] p2m: change_range_type: Only invalidate mapped gfns

2018-11-19 Thread Razvan Cojocaru
change_range_type() invalidates gfn ranges to lazily change the type of a range of gfns, and also modifies the logdirty rangesets of that p2m. At the moment, it clips both down by the hostp2m. While this will result in correct behavior, it's not entirely efficient, since invalidated entries outsid

[Xen-devel] [PATCH V7 1/5] x86/mm: introduce p2m_{init, free}_logdirty()

2018-11-19 Thread Razvan Cojocaru
-by: Razvan Cojocaru Reviewed-by: George Dunlap --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu --- Changes since V6: - Added George's Reviewed-by. --- xen/arch/x86/mm/p2m.c | 46 ++ 1 file changed, 34 insertions(+), 12 d

[Xen-devel] (no subject)

2018-11-19 Thread Razvan Cojocaru
This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display). The first patch introduces p2m_{init,free}_logdirty(), the second allocates a new logdirty rangeset for each new altp2m, and the fourth propaga

[Xen-devel] [PATCH V7 3/5] x86/altp2m: fix display frozen when switching to a new view early

2018-11-19 Thread Razvan Cojocaru
p2m_change_entry_type_global(), p2m_memory_type_changed(), p2m_change_type_range() and p2m_finish_type_change() to propagate their changes to all valid altp2ms. With the introduction of altp2m fields in p2m_memory_type_changed() the whole function has been put under CONFIG_HVM. Signed-off-by: Razvan Cojocaru

[Xen-devel] [PATCH V7 2/5] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-19 Thread Razvan Cojocaru
helper function to do altp2m activiation (appropriately handling failures). Also, refactor p2m_reset_altp2m() so that it can be used to remove redundant codepaths, fixing the locking while we’re at it. While we're here, switch global_logdirty from bool_t to bool. Signed-off-by: Razvan Coj

[Xen-devel] [PATCH V7 4/5] p2m: Always use hostp2m when clipping rangesets

2018-11-19 Thread Razvan Cojocaru
The logdirty rangesets of the altp2ms need to be kept in sync with the hostp2m. This means when iterating through the altp2ms, we need to use the host p2m to clip the rangeset, not the indiviual altp2m's value. This change also: - Documents that the end is non-inclusive - Calculates an "inclusi

Re: [Xen-devel] (no subject)

2018-11-19 Thread Razvan Cojocaru
Apologies, the subject should have been, of course, "[PATCH V7 0/5] Fix VGA logdirty related display freezes with altp2m", which I did paste in, but ommited to uncomment. Sorry, Razvan ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://l

Re: [Xen-devel] [PATCH V7 3/5] x86/altp2m: fix display frozen when switching to a new view early

2018-11-20 Thread Razvan Cojocaru
and >> p2m_finish_type_change() to propagate their changes to all >> valid altp2ms. >> >> With the introduction of altp2m fields in p2m_memory_type_changed() >> the whole function has been put under CONFIG_HVM. >> >> Signed-off-by: Razvan Cojocaru >> Sugge

Re: [Xen-devel] [PATCH V7 2/5] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-20 Thread Razvan Cojocaru
On 11/20/18 11:05 AM, Jan Beulich wrote: On 19.11.18 at 18:26, wrote: >> For now, only do allocation/deallocation; keeping them in sync >> will be done in subsequent patches. >> >> Logdirty synchronization will only be done for active altp2ms; >> so allocate logdirty rangesets (copying the ho

Re: [Xen-devel] [PATCH V7 2/5] x86/mm: allocate logdirty_ranges for altp2ms

2018-11-20 Thread Razvan Cojocaru
On 11/20/18 12:27 PM, Jan Beulich wrote: On 20.11.18 at 11:02, wrote: >> On 11/20/18 11:05 AM, Jan Beulich wrote: >> On 19.11.18 at 18:26, wrote: For now, only do allocation/deallocation; keeping them in sync will be done in subsequent patches. Logdirty synchronizatio

[Xen-devel] [PATCH] x86/mem_access: move p2m_mem_access_sanity_check() from header

2018-11-20 Thread Razvan Cojocaru
(). Including xen/mem_access.h is useful for code wanting to use p2m_access_t. Signed-off-by: Razvan Cojocaru --- xen/arch/x86/mm/mem_access.c | 5 + xen/include/asm-x86/mem_access.h | 5 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm/mem_access.c b/xen

Re: [Xen-devel] [PATCH] x86/mem_access: move p2m_mem_access_sanity_check() from header

2018-11-21 Thread Razvan Cojocaru
On 11/21/18 12:00 PM, Jan Beulich wrote: On 20.11.18 at 19:05, wrote: >> --- a/xen/arch/x86/mm/mem_access.c >> +++ b/xen/arch/x86/mm/mem_access.c >> @@ -541,6 +541,11 @@ void arch_p2m_set_access_required(struct domain *d, >> bool access_required) >> #endif >> } >> >> +bool p2m_mem_access

[Xen-devel] [PATCH V8 1/7] x86/mm: introduce p2m_{init, free}_logdirty()

2018-11-21 Thread Razvan Cojocaru
-by: Razvan Cojocaru Reviewed-by: George Dunlap --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- Changes since V7: - None. --- xen/arch/x86/mm/p2m.c | 46 ++ 1 file changed, 34 insertions(+),

[Xen-devel] [PATCH V8 7/7] p2m: change_range_type: Only invalidate mapped gfns

2018-11-21 Thread Razvan Cojocaru
change_range_type() invalidates gfn ranges to lazily change the type of a range of gfns, and also modifies the logdirty rangesets of that p2m. At the moment, it clips both down by the hostp2m. While this will result in correct behavior, it's not entirely efficient, since invalidated entries outsid

[Xen-devel] [PATCH V8 3/7] x86/p2m: allocate logdirty_ranges for altp2ms

2018-11-21 Thread Razvan Cojocaru
-off-by: Razvan Cojocaru --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- xen/arch/x86/mm/p2m.c | 46 +++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xe

[Xen-devel] [PATCH V8 6/7] p2m: Always use hostp2m when clipping rangesets

2018-11-21 Thread Razvan Cojocaru
The logdirty rangesets of the altp2ms need to be kept in sync with the hostp2m. This means when iterating through the altp2ms, we need to use the host p2m to clip the rangeset, not the indiviual altp2m's value. This change also: - Documents that the end is non-inclusive - Calculates an "inclusi

[Xen-devel] [PATCH V8 5/7] x86/altp2m: fix display frozen when switching to a new view early

2018-11-21 Thread Razvan Cojocaru
Signed-off-by: Razvan Cojocaru --- CC: Jun Nakajima CC: Kevin Tian CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- Changes since V7: - Reversed tag order (suggested by Jan Beulich). --- xen/arch/x86/mm/p2m-ept.c | 9 ++- xen/arch/x86/m

[Xen-devel] [PATCH V8 0/7] Fix VGA logdirty related display freezes with altp2m

2018-11-21 Thread Razvan Cojocaru
This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display). The series introduces p2m_{init,free}_logdirty(), allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to

[Xen-devel] [PATCH V8 4/7] x86/p2m: refactor p2m_reset_altp2m()

2018-11-21 Thread Razvan Cojocaru
Refactor p2m_reset_altp2m() so that it can be used to remove redundant codepaths, fixing the locking while we're at it. Signed-off-by: Razvan Cojocaru --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- xen/arch/x8

[Xen-devel] [PATCH V8 2/7] x86/p2m: switch global_logdirty from bool_t to bool

2018-11-21 Thread Razvan Cojocaru
Signed-off-by: Razvan Cojocaru --- CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- xen/include/asm-x86/p2m.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 6d849a5..b52fefd 10

Re: [Xen-devel] [PATCH V8 3/7] x86/p2m: allocate logdirty_ranges for altp2ms

2018-11-21 Thread Razvan Cojocaru
On 11/21/18 12:45 PM, Jan Beulich wrote: On 21.11.18 at 11:19, wrote: >> +static int p2m_activate_altp2m(struct domain *d, unsigned int idx) >> +{ >> +struct p2m_domain *hostp2m, *p2m; >> +int rc; >> + >> +ASSERT(idx < MAX_ALTP2M); >> + >> +p2m = d->arch.altp2m_p2m[idx]; >> +

Re: [Xen-devel] [PATCH V8 4/7] x86/p2m: refactor p2m_reset_altp2m()

2018-11-21 Thread Razvan Cojocaru
On 11/21/18 12:49 PM, Jan Beulich wrote: On 21.11.18 at 11:19, wrote: >> Refactor p2m_reset_altp2m() so that it can be used to remove >> redundant codepaths, fixing the locking while we're at it. > > Still no word about ... > >> +static void p2m_reset_altp2m(struct domain *d, unsigned int i

[Xen-devel] [PATCH] x86/p2m: constify p2m_mem_access_sanity_check()

2018-11-21 Thread Razvan Cojocaru
Signed-off-by: Razvan Cojocaru --- xen/arch/x86/mm/mem_access.c | 2 +- xen/include/asm-x86/mem_access.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c index 30c2f1a..56c06a4 100644 --- a/xen/arch/x86/mm

Re: [Xen-devel] [PATCH] x86/p2m: constify p2m_mem_access_sanity_check()

2018-11-21 Thread Razvan Cojocaru
On 11/21/18 1:52 PM, George Dunlap wrote: > On 11/21/18 11:41 AM, Jan Beulich wrote: >>>>> On 21.11.18 at 12:03, wrote: >>> On 11/21/18 11:01 AM, Razvan Cojocaru wrote: >>>> Signed-off-by: Razvan Cojocaru >>> >>> Why? >> >>

[Xen-devel] [PATCH V2] x86/p2m: constify p2m_mem_access_sanity_check()

2018-11-21 Thread Razvan Cojocaru
Minor improvement; simply improving code quality by using consts wherever reasonable. Suggested-by: Jan Beulich Signed-off-by: Razvan Cojocaru --- xen/arch/x86/mm/mem_access.c | 2 +- xen/include/asm-x86/mem_access.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a

Re: [Xen-devel] [PATCH 04/14] x86/p2m: Fix locking in p2m_altp2m_lazy_copy()

2018-11-21 Thread Razvan Cojocaru
e a single exit path, and defer taking the ap2m lock > until it is necessary to do so. Leave some comments behind to help people > attempting to follow the logic. > > Signed-off-by: Andrew Cooper > --- > CC: Jan Beulich > CC: Wei Liu > CC: Roger Pau Monné > CC: Ra

Re: [Xen-devel] [PATCH 05/14] x86/p2m: Don't overwrite p2m_altp2m_lazy_copy()'s callers p2m pointer

2018-11-21 Thread Razvan Cojocaru
; Signed-off-by: Andrew Cooper Right, I see you've changed the return type of p2m_altp2m_lazy_copy() from bool_t to bool here, so please disregard my previous comment. Reviewed-by: Razvan Cojocaru Thanks, Razvan ___ Xen-devel mai

Re: [Xen-devel] [PATCH 06/14] x86/hvm: Make the altp2m locking easier to follow

2018-11-21 Thread Razvan Cojocaru
it is in use, > and always unlock the hostp2m's gfn. This also drops the ternary expression > in the logdirty case. > > Extend the logdirty comment to identify where the locking violation is liable > to occur. > > No (intended) overall change in behaviour. > > S

Re: [Xen-devel] [PATCH 10/14] x86/mm: Switch {get, put}_gfn() infrastructure to using gfn_t

2018-11-21 Thread Razvan Cojocaru
te_vmfunc_ve(), which will need addressing now we can discuss the > problem and options publicly. > > Signed-off-by: Andrew Cooper For the mem_access bits: Acked-by: Razvan Cojocaru Thanks, Razvan ___ Xen-devel mailing list Xen-de

Re: [Xen-devel] [PATCH v1] x86/hvm: Generic instruction re-execution mechanism for execute faults

2018-11-21 Thread Razvan Cojocaru
On 11/16/18 7:04 PM, Roger Pau Monné wrote: >> +if ( a == v ) >> +continue; >> + >> +/* Pause, synced. */ >> +while ( !a->arch.in_host ) > Why not use a->is_running as a way to know whether the vCPU is > running? > > I think the logic of using vc

Re: [Xen-devel] [PATCH v1] x86/hvm: Generic instruction re-execution mechanism for execute faults

2018-11-22 Thread Razvan Cojocaru
On 11/22/18 12:05 PM, Roger Pau Monné wrote: > On Wed, Nov 21, 2018 at 08:55:48PM +0200, Razvan Cojocaru wrote: >> On 11/16/18 7:04 PM, Roger Pau Monné wrote: >>>> +if ( a == v ) >>>> +continue; >>>> + >>>> +

[Xen-devel] [PATCH V9 4/7] x86/p2m: refactor p2m_reset_altp2m()

2018-11-22 Thread Razvan Cojocaru
the altp2m idx was disabled; so before getting used again, p2m_init_altp2m_ept() would get called, which resets them. Always setting them in p2m_reset_altp2m(), while redundant, is preferable to an extra conditional. Signed-off-by: Razvan Cojocaru --- CC: George Dunlap CC: Jan Beulich CC: Andrew

[Xen-devel] [PATCH V9 6/7] p2m: Always use hostp2m when clipping rangesets

2018-11-22 Thread Razvan Cojocaru
The logdirty rangesets of the altp2ms need to be kept in sync with the hostp2m. This means when iterating through the altp2ms, we need to use the host p2m to clip the rangeset, not the indiviual altp2m's value. This change also: - Documents that the end is non-inclusive - Calculates an "inclusi

[Xen-devel] [PATCH V9 1/7] x86/mm: introduce p2m_{init, free}_logdirty()

2018-11-22 Thread Razvan Cojocaru
-by: Razvan Cojocaru Reviewed-by: George Dunlap --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- Changes since V8: - None. --- xen/arch/x86/mm/p2m.c | 46 ++ 1 file changed, 34 insertions(+),

[Xen-devel] [PATCH V9 3/7] x86/p2m: allocate logdirty_ranges for altp2ms

2018-11-22 Thread Razvan Cojocaru
-off-by: Razvan Cojocaru --- CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- Changes since V8: - Indented the "out:" label from p2m_activate_altp2m() by one blank. --- xen/arch/x86/mm/p2m.c | 46 +

[Xen-devel] [PATCH V9 2/7] x86/p2m: switch global_logdirty from bool_t to bool

2018-11-22 Thread Razvan Cojocaru
Signed-off-by: Razvan Cojocaru --- CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- Changes since V8: - None. --- xen/include/asm-x86/p2m.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm

[Xen-devel] [PATCH V9 5/7] x86/altp2m: fix display frozen when switching to a new view early

2018-11-22 Thread Razvan Cojocaru
Signed-off-by: Razvan Cojocaru --- CC: Jun Nakajima CC: Kevin Tian CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Wei Liu CC: "Roger Pau Monné" --- Changes since V8: - None. --- xen/arch/x86/mm/p2m-ept.c | 9 ++- xen/arch/x86/mm/p2m-pt.c | 8 +++ xen/arch/x8

[Xen-devel] [PATCH V9 7/7] p2m: change_range_type: Only invalidate mapped gfns

2018-11-22 Thread Razvan Cojocaru
change_range_type() invalidates gfn ranges to lazily change the type of a range of gfns, and also modifies the logdirty rangesets of that p2m. At the moment, it clips both down by the hostp2m. While this will result in correct behavior, it's not entirely efficient, since invalidated entries outsid

[Xen-devel] [PATCH V9 0/7] Fix VGA logdirty related display freezes with altp2m

2018-11-22 Thread Razvan Cojocaru
This series aims to prevent the display from freezing when enabling altp2m and switching to a new view (and assorted problems when resizing the display). The series introduces p2m_{init,free}_logdirty(), allocates a new logdirty rangeset for each new altp2m, and propagates (under lock) changes to

Re: [Xen-devel] [PATCH V2] x86/p2m: constify p2m_mem_access_sanity_check()

2018-11-22 Thread Razvan Cojocaru
On 11/21/18 2:09 PM, Razvan Cojocaru wrote: > Minor improvement; simply improving code quality by using consts > wherever reasonable. > > Suggested-by: Jan Beulich > Signed-off-by: Razvan Cojocaru Tamas, I think we need your ack for this?

Re: [Xen-devel] [PATCH v1] x86/hvm: Generic instruction re-execution mechanism for execute faults

2018-11-22 Thread Razvan Cojocaru
On 11/22/18 12:58 PM, Roger Pau Monné wrote: > On Thu, Nov 22, 2018 at 12:14:59PM +0200, Razvan Cojocaru wrote: >> On 11/22/18 12:05 PM, Roger Pau Monné wrote: >>> On Wed, Nov 21, 2018 at 08:55:48PM +0200, Razvan Cojocaru wrote: >>>> On 11/16/18

Re: [Xen-devel] [PATCH v1] x86/hvm: Generic instruction re-execution mechanism for execute faults

2018-11-22 Thread Razvan Cojocaru
On 11/22/18 4:49 PM, Roger Pau Monné wrote: > On Thu, Nov 22, 2018 at 02:48:07PM +0200, Razvan Cojocaru wrote: >> On 11/22/18 12:58 PM, Roger Pau Monné wrote: >>> On Thu, Nov 22, 2018 at 12:14:59PM +0200, Razvan Cojocaru wrote: >>>> On 11/22/18 12:05 PM, Roger Pau Mon

Re: [Xen-devel] [PATCH v1] x86/hvm: Generic instruction re-execution mechanism for execute faults

2018-11-22 Thread Razvan Cojocaru
On 11/22/18 5:37 PM, Roger Pau Monné wrote: > I don't think you are supposed to try to pause other vcpus while > holding a lock, as you can see it's quite likely that you will end up > deadlocking because the vCPU you are trying to pause is stuck waiting > on the lock that you are holding. > > You

Re: [Xen-devel] [PATCH v1] x86/hvm: Generic instruction re-execution mechanism for execute faults

2018-11-22 Thread Razvan Cojocaru
On 11/22/18 7:08 PM, Roger Pau Monné wrote: > On Thu, Nov 22, 2018 at 06:52:07PM +0200, Razvan Cojocaru wrote: >> On 11/22/18 5:37 PM, Roger Pau Monné wrote: >>> I don't think you are supposed to try to pause other vcpus while >>> holding a lock, as you can see it&

Re: [Xen-devel] [PATCH v2] x86/hvm: Add MSR old value

2017-12-22 Thread Razvan Cojocaru
On 12/05/2017 11:07 AM, Jan Beulich wrote: On 04.12.17 at 16:45, wrote: >>> On Fri, Oct 13, 2017 at 03:50:57PM +0300, Alexandru Isaila wrote: This patch adds the old value param and the onchangeonly option to the VM_EVENT_REASON_MOV_TO_MSR event. The param was added to th

Re: [Xen-devel] [PATCH v2] x86/hvm: Add MSR old value

2018-01-03 Thread Razvan Cojocaru
On 01/03/2018 12:00 PM, Jan Beulich wrote: On 22.12.17 at 10:09, wrote: >> On 12/05/2017 11:07 AM, Jan Beulich wrote: >> On 04.12.17 at 16:45, wrote: > On Fri, Oct 13, 2017 at 03:50:57PM +0300, Alexandru Isaila wrote: >> This patch adds the old value param and the onchangeonly o

Re: [Xen-devel] [PATCH v1] x86/mm: Supresses vm_events caused by page-walks

2018-01-05 Thread Razvan Cojocaru
On 10/30/2017 07:38 PM, Tamas K Lengyel wrote: > On Mon, Oct 30, 2017 at 11:19 AM, Razvan Cojocaru > wrote: >> On 10/30/2017 07:07 PM, Tamas K Lengyel wrote: >>> On Mon, Oct 30, 2017 at 11:01 AM, Razvan Cojocaru >>> wrote: >>>> On 10/30/2017 06:39 PM, T

[Xen-devel] AMD / SVM vm_event support

2018-01-18 Thread Razvan Cojocaru
Hello, We're looking at potentially working with vm_event on SVM hosts. To that end, we've removed a few cpu_has_vmx tests and saw that some things just work. That is, unfortunately, not the case for EPT events. There's this old thread about NPT support: https://lists.gt.net/xen/devel/339571 b

Re: [Xen-devel] Xen Introspection, KPTI, and CR3 bit 63 leads to guest VMENTRY failures during introspection

2018-01-24 Thread Razvan Cojocaru
On 01/25/2018 12:31 AM, Bitweasil . wrote: > I've recently discovered that if you attempt to use introspection to > capture CR3 changes with the new KPTI enabled kernels, the guest dies > shortly after the start of introspection with failed VM entry due to > invalid guest state. > > I believe the

Re: [Xen-devel] Xen Introspection, KPTI, and CR3 bit 63 leads to guest VMENTRY failures during introspection

2018-01-25 Thread Razvan Cojocaru
On 01/25/2018 02:15 AM, Andrew Cooper wrote: > On 24/01/2018 22:31, Bitweasil . wrote: >> I've recently discovered that if you attempt to use introspection to >> capture CR3 changes with the new KPTI enabled kernels, the guest dies >> shortly after the start of introspection with failed VM entry du

Re: [Xen-devel] Xen Introspection, KPTI, and CR3 bit 63 leads to guest VMENTRY failures during introspection

2018-01-25 Thread Razvan Cojocaru
On 01/25/2018 02:25 PM, Razvan Cojocaru wrote: > On 01/25/2018 02:15 AM, Andrew Cooper wrote: >> On 24/01/2018 22:31, Bitweasil . wrote: >>> I've recently discovered that if you attempt to use introspection to >>> capture CR3 changes with the new KPTI enabled ker

Re: [Xen-devel] Xen Introspection, KPTI, and CR3 bit 63 leads to guest VMENTRY failures during introspection

2018-01-25 Thread Razvan Cojocaru
On 01/25/2018 12:31 AM, Bitweasil . wrote: > I've recently discovered that if you attempt to use introspection to > capture CR3 changes with the new KPTI enabled kernels, the guest dies > shortly after the start of introspection with failed VM entry due to > invalid guest state. > > I believe the

Re: [Xen-devel] Xen Introspection, KPTI, and CR3 bit 63 leads to guest VMENTRY failures during introspection

2018-01-25 Thread Razvan Cojocaru
On 01/26/2018 12:17 AM, Bitweasil . wrote: > Razvan - > > Yes, that patch resolves the issues.  Performance is abysmal (as > expected with a CR3 switch on every syscall), but things behave properly.> > Jan - > > It turns out that unrelated code in my livepatch was causing the > crashing when I fi

Re: [Xen-devel] Xen Introspection, KPTI, and CR3 bit 63 leads to guest VMENTRY failures during introspection

2018-01-25 Thread Razvan Cojocaru
On 01/26/2018 02:02 AM, Bitweasil . wrote: > This also impacts the "on change only" control setting code. > > From some debugging code: hvm_event_cr, value: 80001aad, old: > 1aad > > This should not count as a changed CR3 value for reporting purposes. > > The following patch resolves

[Xen-devel] [PATCH] x86/hvm: fix domain crash when CR3 has the noflush bit set

2018-01-26 Thread Razvan Cojocaru
the noflush bit in hvm_set_cr3() (and, for completeness, to compare old vs new CR3 values in hvm_monitor_cr() after clearing the noflush bit for them as well). Signed-off-by: Razvan Cojocaru Reported-by: Bitweasil Suggested-by: Andrew Cooper --- xen/arch/x86/hvm/hvm.c | 3 +++ xen/arch/x86

Re: [Xen-devel] [PATCH] x86/hvm: fix domain crash when CR3 has the noflush bit set

2018-01-26 Thread Razvan Cojocaru
On 01/26/2018 12:27 PM, Jan Beulich wrote: On 26.01.18 at 10:39, wrote: >> --- a/xen/arch/x86/hvm/hvm.c >> +++ b/xen/arch/x86/hvm/hvm.c >> @@ -2324,6 +2324,9 @@ int hvm_set_cr3(unsigned long value, bool_t may_defer) >> } >> } >> >> +if ( hvm_pcid_enabled(v) ) /* Clear the

Re: [Xen-devel] Xen Introspection, KPTI, and CR3 bit 63 leads to guest VMENTRY failures during introspection

2018-01-26 Thread Razvan Cojocaru
On 01/26/2018 06:17 PM, Bitweasil . wrote: > The proposed changes would only have an impact if CR3 exiting is > enabled, which implies a pair of world switches and other code execution > in a different region of memory and with different page tables anyway. > > Under normal operation, CR3 exiting

Re: [PATCH v4 for-4.14] x86/monitor: revert default behavior when monitoring register write events

2020-06-08 Thread Razvan Cojocaru
On 6/9/20 1:50 AM, Tamas K Lengyel wrote: > On Mon, Jun 8, 2020 at 3:16 PM Razvan Cojocaru > wrote: >> 1. A security application that is unable to _prevent_ things being done >> to a system is not doing a very good job, since in that case you can >> only collect stats

Re: [PATCH v4 for-4.14] x86/monitor: revert default behavior when monitoring register write events

2020-06-08 Thread Razvan Cojocaru
On 6/8/20 6:55 PM, Jan Beulich wrote: > On 03.06.2020 17:07, Roger Pau Monné wrote: >> On Wed, Jun 03, 2020 at 06:52:37AM -0600, Tamas K Lengyel wrote: >>> For the last couple years we have received numerous reports from users of >>> monitor vm_events of spurious guest crashes when using events. In

Re: [PATCH v4 for-4.14] x86/monitor: revert default behavior when monitoring register write events

2020-06-08 Thread Razvan Cojocaru
On 6/8/20 10:54 PM, Tamas K Lengyel wrote: > On Mon, Jun 8, 2020 at 12:58 PM Razvan Cojocaru >> And last but not least, the proper sequence is: 1. unsubscribe from >> register write events, 2. process all events "still in the chamber" >> (keep checking the ring buff

Re: [PATCH v4 for-4.14] x86/monitor: revert default behavior when monitoring register write events

2020-06-08 Thread Razvan Cojocaru
On 6/8/20 11:44 PM, Tamas K Lengyel wrote: > On Mon, Jun 8, 2020 at 2:14 PM Razvan Cojocaru > wrote: >> >> On 6/8/20 10:54 PM, Tamas K Lengyel wrote: >>> On Mon, Jun 8, 2020 at 12:58 PM Razvan Cojocaru >>>> And last but not least, the proper sequence is:

[Xen-devel] [PATCH RESEND] MAINTAINERS: hand over vm_event maintainership

2019-06-13 Thread Razvan Cojocaru
Remove myself as vm_event maintaner, add Alexandru and Petre as Bitdefender vm_event maintainers. Signed-off-by: Razvan Cojocaru --- Re-sent to add Tamas', Petre's and Alexandru's addresses. --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

Re: [Xen-devel] [RFC PATCH 2/2] x86/mm: Add mem access rights to NPT

2019-06-13 Thread Razvan Cojocaru
On 6/13/19 6:19 PM, Tamas Lengyel wrote: On Wed, Sep 26, 2018 at 10:49 AM George Dunlap wrote: From: Isaila Alexandru This patch adds access control for NPT mode. There aren’t enough extra bits to store the access rights in the NPT p2m table, so we add a radix tree to store extra informatio

Re: [Xen-devel] [PATCH] MAINTAINERS: Add myself as a Designated reviewer to vm_event

2019-06-19 Thread Razvan Cojocaru
/linux-2.6/ VM EVENT, MEM ACCESS and MONITOR M:Razvan Cojocaru +R: Alexandru Isaila M:Tamas K Lengyel S:Supported F:tools/tests/xen-access Acked-by: Razvan Cojocaru ___ Xen-devel mailing list Xen-devel

Re: [Xen-devel] [PATCH] MAINTAINERS: Add myself as reviewer for vm_event

2019-06-20 Thread Razvan Cojocaru
/ VM EVENT, MEM ACCESS and MONITOR M:Razvan Cojocaru +R: Petre Pircalabu M:Tamas K Lengyel S:Supported F:tools/tests/xen-access Acked-by: Razvan Cojocaru ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https

Re: [Xen-devel] [PATCH] MAINTAINERS: Add myself as reviewer for vm_event

2019-06-20 Thread Razvan Cojocaru
/MAINTAINERS @@ -412,6 +412,7 @@ F: unmodified_drivers/linux-2.6/ VM EVENT, MEM ACCESS and MONITOR M:Razvan Cojocaru +R: Petre Pircalabu M:Tamas K Lengyel I would place the addition after the list of M(aintainers). Since this and Alexandru's are trivial patches and wha

Re: [Xen-devel] [PATCH RESEND] MAINTAINERS: hand over vm_event maintainership

2019-06-21 Thread Razvan Cojocaru
On 6/21/19 6:15 PM, Jan Beulich wrote: On 13.06.19 at 17:11, wrote: On Thu, Jun 13, 2019 at 8:01 AM Razvan Cojocaru wrote: Remove myself as vm_event maintaner, add Alexandru and Petre as Bitdefender vm_event maintainers. Signed-off-by: Razvan Cojocaru Acked-by: Tamas K Lengyel I&#x

Re: [Xen-devel] [PATCH v5] x86/emulate: Send vm_event from emulate

2019-07-01 Thread Razvan Cojocaru
On 7/1/19 5:45 PM, Alexandru Stefan ISAILA wrote: On 01.07.2019 16:13, Jan Beulich wrote: On 04.06.19 at 13:49, wrote: This patch aims to have mem access vm events sent from the emulator. This is useful where we want to only emulate a page walk without checking the EPT, but we still want to

Re: [Xen-devel] [PATCH v7] x86/emulate: Send vm_event from emulate

2019-07-19 Thread Razvan Cojocaru
On 7/19/19 4:18 PM, Jan Beulich wrote: On 19.07.2019 14:34, Alexandru Stefan ISAILA wrote: On 18.07.2019 15:58, Jan Beulich wrote: On 03.07.2019 12:56, Alexandru Stefan ISAILA wrote: A/D bit writes (on page walks) can be considered benign by an introspection agent, so receiving vm_events for t

Re: [Xen-devel] [PATCH v7] x86/emulate: Send vm_event from emulate

2019-07-19 Thread Razvan Cojocaru
On 7/19/19 4:38 PM, Jan Beulich wrote: On 19.07.2019 15:30, Razvan Cojocaru wrote: On 7/19/19 4:18 PM, Jan Beulich wrote: On 19.07.2019 14:34, Alexandru Stefan ISAILA wrote: On 18.07.2019 15:58, Jan Beulich wrote: On 03.07.2019 12:56, Alexandru Stefan ISAILA wrote: A/D bit writes (on page

<    1   2   3   4   5   6