Re: [Xen-devel] [PATCH v3 1/2] xen/x86: merge 2 hvm_event_... functions into 1

2016-02-15 Thread Razvan Cojocaru
On 02/15/2016 07:54 PM, Corneliu ZUZU wrote:
> On 2/15/2016 7:47 PM, Tamas K Lengyel wrote:
>>
>>
>> On Mon, Feb 15, 2016 at 10:40 AM, Corneliu ZUZU > > wrote:
>>
>> On 2/15/2016 10:30 AM, Razvan Cojocaru wrote:
>>
>> On 02/15/2016 08:35 AM, Corneliu ZUZU wrote:
>>
>> This patch merges almost identical functions
>> hvm_event_int3 and
>> hvm_event_single_step into a single function called
>> hvm_event_breakpoint.
>> Also fixes event.c file header comment in the process.
>>
>> Signed-off-by: Corneliu ZUZU
>> <cz...@bitdefender.com>
>> ---
>>   xen/arch/x86/hvm/event.c| 108
>> +++-
>>   xen/arch/x86/hvm/vmx/vmx.c  |  15 +++---
>>   xen/include/asm-x86/hvm/event.h |  11 ++--
>>   3 files changed, 67 insertions(+), 67 deletions(-)
>>
>> Looks good to me.
>>
>> Acked-by: Razvan Cojocaru
>> <rcojoc...@bitdefender.com>
>>
>>
>> Thanks,
>> Razvan
>>
>>
>> If the patch hasn't been merged to staging yet then include it. If
>> it's a longer series the cover page can indicate which patches are
>> still in need of review and which ones have been already acked.
>> Furthermore, for each patch under the Signed-off-by tag you can say
>> what changed in each revision. If nothing changed, you can say no
>> change or just don't put anything for that revision. See
>> http://lists.xen.org/archives/html/xen-devel/2016-02/msg00943.html
>> for an example. Also keep in mind that if the changes in a revision
>> are significant enough you can't keep the Acked-by tag on the patch,
>> it will need to be re-acked.
>>
>> Tamas
> 
> Got it, thanks.

This particular patch did make it into staging. It's
557c7873f35aa39bd84977b28948457b1b342f92.



___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 1/2] xen/x86: merge 2 hvm_event_... functions into 1

2016-02-15 Thread Corneliu ZUZU

On 2/15/2016 7:47 PM, Tamas K Lengyel wrote:



On Mon, Feb 15, 2016 at 10:40 AM, Corneliu ZUZU > wrote:


On 2/15/2016 10:30 AM, Razvan Cojocaru wrote:

On 02/15/2016 08:35 AM, Corneliu ZUZU wrote:

This patch merges almost identical functions
hvm_event_int3 and
hvm_event_single_step into a single function called
hvm_event_breakpoint.
Also fixes event.c file header comment in the process.

Signed-off-by: Corneliu ZUZU >
---
  xen/arch/x86/hvm/event.c| 108
+++-
  xen/arch/x86/hvm/vmx/vmx.c  |  15 +++---
  xen/include/asm-x86/hvm/event.h |  11 ++--
  3 files changed, 67 insertions(+), 67 deletions(-)

Looks good to me.

Acked-by: Razvan Cojocaru >


Thanks,
Razvan


If the patch hasn't been merged to staging yet then include it. If 
it's a longer series the cover page can indicate which patches are 
still in need of review and which ones have been already acked. 
Furthermore, for each patch under the Signed-off-by tag you can say 
what changed in each revision. If nothing changed, you can say no 
change or just don't put anything for that revision. See 
http://lists.xen.org/archives/html/xen-devel/2016-02/msg00943.html for 
an example. Also keep in mind that if the changes in a revision are 
significant enough you can't keep the Acked-by tag on the patch, it 
will need to be re-acked.


Tamas


Got it, thanks.

Corneliu.
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 1/2] xen/x86: merge 2 hvm_event_... functions into 1

2016-02-15 Thread Tamas K Lengyel
On Mon, Feb 15, 2016 at 10:40 AM, Corneliu ZUZU 
wrote:

> On 2/15/2016 10:30 AM, Razvan Cojocaru wrote:
>
>> On 02/15/2016 08:35 AM, Corneliu ZUZU wrote:
>>
>>> This patch merges almost identical functions hvm_event_int3 and
>>> hvm_event_single_step into a single function called hvm_event_breakpoint.
>>> Also fixes event.c file header comment in the process.
>>>
>>> Signed-off-by: Corneliu ZUZU 
>>> ---
>>>   xen/arch/x86/hvm/event.c| 108
>>> +++-
>>>   xen/arch/x86/hvm/vmx/vmx.c  |  15 +++---
>>>   xen/include/asm-x86/hvm/event.h |  11 ++--
>>>   3 files changed, 67 insertions(+), 67 deletions(-)
>>>
>> Looks good to me.
>>
>> Acked-by: Razvan Cojocaru 
>>
>>
>> Thanks,
>> Razvan
>>
>>
If the patch hasn't been merged to staging yet then include it. If it's a
longer series the cover page can indicate which patches are still in need
of review and which ones have been already acked. Furthermore, for each
patch under the Signed-off-by tag you can say what changed in each
revision. If nothing changed, you can say no change or just don't put
anything for that revision. See
http://lists.xen.org/archives/html/xen-devel/2016-02/msg00943.html for an
example. Also keep in mind that if the changes in a revision are
significant enough you can't keep the Acked-by tag on the patch, it will
need to be re-acked.

Tamas
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 1/2] xen/x86: merge 2 hvm_event_... functions into 1

2016-02-15 Thread Corneliu ZUZU

On 2/15/2016 10:30 AM, Razvan Cojocaru wrote:

On 02/15/2016 08:35 AM, Corneliu ZUZU wrote:

This patch merges almost identical functions hvm_event_int3 and
hvm_event_single_step into a single function called hvm_event_breakpoint.
Also fixes event.c file header comment in the process.

Signed-off-by: Corneliu ZUZU 
---
  xen/arch/x86/hvm/event.c| 108 +++-
  xen/arch/x86/hvm/vmx/vmx.c  |  15 +++---
  xen/include/asm-x86/hvm/event.h |  11 ++--
  3 files changed, 67 insertions(+), 67 deletions(-)

Looks good to me.

Acked-by: Razvan Cojocaru 


Thanks,
Razvan



I forgot to ask: when getting an Acked-By response, should I include 
that patch in the next patch-series
or ommit it? I've done that w/ the first patch in the last patch-series, 
but IDK if I was correct to do so.


Thanks,
Corneliu.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 1/2] xen/x86: merge 2 hvm_event_... functions into 1

2016-02-15 Thread Razvan Cojocaru
On 02/15/2016 08:35 AM, Corneliu ZUZU wrote:
> This patch merges almost identical functions hvm_event_int3 and
> hvm_event_single_step into a single function called hvm_event_breakpoint.
> Also fixes event.c file header comment in the process.
> 
> Signed-off-by: Corneliu ZUZU 
> ---
>  xen/arch/x86/hvm/event.c| 108 
> +++-
>  xen/arch/x86/hvm/vmx/vmx.c  |  15 +++---
>  xen/include/asm-x86/hvm/event.h |  11 ++--
>  3 files changed, 67 insertions(+), 67 deletions(-)

Looks good to me.

Acked-by: Razvan Cojocaru 


Thanks,
Razvan

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 1/2] xen/x86: merge 2 hvm_event_... functions into 1

2016-02-14 Thread Corneliu ZUZU
This patch merges almost identical functions hvm_event_int3 and
hvm_event_single_step into a single function called hvm_event_breakpoint.
Also fixes event.c file header comment in the process.

Signed-off-by: Corneliu ZUZU 
---
 xen/arch/x86/hvm/event.c| 108 +++-
 xen/arch/x86/hvm/vmx/vmx.c  |  15 +++---
 xen/include/asm-x86/hvm/event.h |  11 ++--
 3 files changed, 67 insertions(+), 67 deletions(-)

diff --git a/xen/arch/x86/hvm/event.c b/xen/arch/x86/hvm/event.c
index a3d4892..874a36c 100644
--- a/xen/arch/x86/hvm/event.c
+++ b/xen/arch/x86/hvm/event.c
@@ -1,22 +1,24 @@
 /*
-* event.c: Common hardware virtual machine event abstractions.
-*
-* Copyright (c) 2004, Intel Corporation.
-* Copyright (c) 2005, International Business Machines Corporation.
-* Copyright (c) 2008, Citrix Systems, Inc.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms and conditions of the GNU General Public License,
-* version 2, as published by the Free Software Foundation.
-*
-* This program is distributed in the hope it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-* more details.
-*
-* You should have received a copy of the GNU General Public License along with
-* this program; If not, see .
-*/
+ * arch/x86/hvm/event.c
+ *
+ * Arch-specific hardware virtual machine event abstractions.
+ *
+ * Copyright (c) 2004, Intel Corporation.
+ * Copyright (c) 2005, International Business Machines Corporation.
+ * Copyright (c) 2008, Citrix Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see .
+ */
 
 #include 
 #include 
@@ -151,61 +153,51 @@ void hvm_event_guest_request(void)
 }
 }
 
-int hvm_event_int3(unsigned long rip)
+static inline unsigned long gfn_of_rip(unsigned long rip)
 {
-int rc = 0;
 struct vcpu *curr = current;
+struct segment_register sreg;
+uint32_t pfec = PFEC_page_present | PFEC_insn_fetch;
 
-if ( curr->domain->arch.monitor.software_breakpoint_enabled )
-{
-struct segment_register sreg;
-uint32_t pfec = PFEC_page_present | PFEC_insn_fetch;
-vm_event_request_t req = {
-.reason = VM_EVENT_REASON_SOFTWARE_BREAKPOINT,
-.vcpu_id = curr->vcpu_id,
-};
-
-hvm_get_segment_register(curr, x86_seg_ss, );
-if ( sreg.attr.fields.dpl == 3 )
-pfec |= PFEC_user_mode;
+hvm_get_segment_register(curr, x86_seg_ss, );
+if ( sreg.attr.fields.dpl == 3 )
+pfec |= PFEC_user_mode;
 
-hvm_get_segment_register(curr, x86_seg_cs, );
-req.u.software_breakpoint.gfn = paging_gva_to_gfn(curr,
-  sreg.base + rip,
-  );
-
-rc = hvm_event_traps(1, );
-}
+hvm_get_segment_register(curr, x86_seg_cs, );
 
-return rc;
+return paging_gva_to_gfn(curr, sreg.base + rip, );
 }
 
-int hvm_event_single_step(unsigned long rip)
+int hvm_event_breakpoint(unsigned long rip,
+ enum hvm_event_breakpoint_type type)
 {
-int rc = 0;
 struct vcpu *curr = current;
+struct arch_domain *ad = >domain->arch;
+vm_event_request_t req;
 
-if ( curr->domain->arch.monitor.singlestep_enabled )
+switch ( type )
 {
-struct segment_register sreg;
-uint32_t pfec = PFEC_page_present | PFEC_insn_fetch;
-vm_event_request_t req = {
-.reason = VM_EVENT_REASON_SINGLESTEP,
-.vcpu_id = curr->vcpu_id,
-};
-
-hvm_get_segment_register(curr, x86_seg_ss, );
-if ( sreg.attr.fields.dpl == 3 )
-pfec |= PFEC_user_mode;
+case HVM_EVENT_SOFTWARE_BREAKPOINT:
+if ( !ad->monitor.software_breakpoint_enabled )
+return 0;
+req.reason = VM_EVENT_REASON_SOFTWARE_BREAKPOINT;
+req.u.software_breakpoint.gfn = gfn_of_rip(rip);
+break;
 
-hvm_get_segment_register(curr, x86_seg_cs, );
-req.u.singlestep.gfn = paging_gva_to_gfn(curr, sreg.base + rip,
- );
+case HVM_EVENT_SINGLESTEP_BREAKPOINT:
+if ( !ad->monitor.singlestep_enabled )
+return 0;
+