Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Devel

[V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH

 

 

Xen devel RSS feed   Index | Next | Previous | View Threaded


mukesh.rathor at oracle

Jul 23, 2013, 6:59 PM

Post #1 of 8 (37 views)
Permalink
[V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH

This patch supports invalid op emulation for PVH by calling appropriate
copy macros and and HVM function to inject PF.

Signed-off-by: Mukesh Rathor <mukesh.rathor [at] oracle>
Reviewed-by: Jan Beulich <jbeulich [at] suse>
---
xen/arch/x86/traps.c | 17 ++++++++++++++---
xen/include/asm-x86/traps.h | 1 +
2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 378ef0a..a3ca70b 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -459,6 +459,11 @@ static void instruction_done(
struct cpu_user_regs *regs, unsigned long eip, unsigned int bpmatch)
{
regs->eip = eip;
+
+ /* PVH fixme: debug trap below */
+ if ( is_pvh_vcpu(current) )
+ return;
+
regs->eflags &= ~X86_EFLAGS_RF;
if ( bpmatch || (regs->eflags & X86_EFLAGS_TF) )
{
@@ -913,7 +918,7 @@ static int emulate_invalid_rdtscp(struct cpu_user_regs *regs)
return EXCRET_fault_fixed;
}

-static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
+int emulate_forced_invalid_op(struct cpu_user_regs *regs)
{
char sig[5], instr[2];
unsigned long eip, rc;
@@ -921,7 +926,7 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
eip = regs->eip;

/* Check for forced emulation signature: ud2 ; .ascii "xen". */
- if ( (rc = copy_from_user(sig, (char *)eip, sizeof(sig))) != 0 )
+ if ( (rc = raw_copy_from_guest(sig, (char *)eip, sizeof(sig))) != 0 )
{
propagate_page_fault(eip + sizeof(sig) - rc, 0);
return EXCRET_fault_fixed;
@@ -931,7 +936,7 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
eip += sizeof(sig);

/* We only emulate CPUID. */
- if ( ( rc = copy_from_user(instr, (char *)eip, sizeof(instr))) != 0 )
+ if ( ( rc = raw_copy_from_guest(instr, (char *)eip, sizeof(instr))) != 0 )
{
propagate_page_fault(eip + sizeof(instr) - rc, 0);
return EXCRET_fault_fixed;
@@ -1076,6 +1081,12 @@ void propagate_page_fault(unsigned long addr, u16 error_code)
struct vcpu *v = current;
struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce;

+ if ( is_pvh_vcpu(v) )
+ {
+ hvm_inject_page_fault(error_code, addr);
+ return;
+ }
+
v->arch.pv_vcpu.ctrlreg[2] = addr;
arch_set_cr2(v, addr);

diff --git a/xen/include/asm-x86/traps.h b/xen/include/asm-x86/traps.h
index 82cbcee..1d9b087 100644
--- a/xen/include/asm-x86/traps.h
+++ b/xen/include/asm-x86/traps.h
@@ -48,5 +48,6 @@ extern int guest_has_trap_callback(struct domain *d, uint16_t vcpuid,
*/
extern int send_guest_trap(struct domain *d, uint16_t vcpuid,
unsigned int trap_nr);
+int emulate_forced_invalid_op(struct cpu_user_regs *regs);

#endif /* ASM_TRAP_H */
--
1.7.2.3


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


George.Dunlap at eu

Aug 7, 2013, 4:29 AM

Post #2 of 8 (22 views)
Permalink
Re: [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH [In reply to]

On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor <mukesh.rathor [at] oracle> wrote:
> This patch supports invalid op emulation for PVH by calling appropriate
> copy macros and and HVM function to inject PF.
>
> Signed-off-by: Mukesh Rathor <mukesh.rathor [at] oracle>
> Reviewed-by: Jan Beulich <jbeulich [at] suse>
> ---
> xen/arch/x86/traps.c | 17 ++++++++++++++---
> xen/include/asm-x86/traps.h | 1 +
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
> index 378ef0a..a3ca70b 100644
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -459,6 +459,11 @@ static void instruction_done(
> struct cpu_user_regs *regs, unsigned long eip, unsigned int bpmatch)
> {
> regs->eip = eip;
> +
> + /* PVH fixme: debug trap below */
> + if ( is_pvh_vcpu(current) )
> + return;

What exactly does this comment mean? Do you mean, "FIXME: Make debug
trapping work for PVH guests"? (i.e., this functionality will be
implemented later?)

> +
> regs->eflags &= ~X86_EFLAGS_RF;
> if ( bpmatch || (regs->eflags & X86_EFLAGS_TF) )
> {
> @@ -913,7 +918,7 @@ static int emulate_invalid_rdtscp(struct cpu_user_regs *regs)
> return EXCRET_fault_fixed;
> }
>
> -static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
> +int emulate_forced_invalid_op(struct cpu_user_regs *regs)

Why make this non-static? No one is using this in this patch. If a
later patch needs it, you should make it non-static there, so we can
decide at that point if making it non-static is merited or not.

> {
> char sig[5], instr[2];
> unsigned long eip, rc;
> @@ -921,7 +926,7 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
> eip = regs->eip;
>
> /* Check for forced emulation signature: ud2 ; .ascii "xen". */
> - if ( (rc = copy_from_user(sig, (char *)eip, sizeof(sig))) != 0 )
> + if ( (rc = raw_copy_from_guest(sig, (char *)eip, sizeof(sig))) != 0 )
> {
> propagate_page_fault(eip + sizeof(sig) - rc, 0);
> return EXCRET_fault_fixed;
> @@ -931,7 +936,7 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
> eip += sizeof(sig);
>
> /* We only emulate CPUID. */
> - if ( ( rc = copy_from_user(instr, (char *)eip, sizeof(instr))) != 0 )
> + if ( ( rc = raw_copy_from_guest(instr, (char *)eip, sizeof(instr))) != 0 )
> {
> propagate_page_fault(eip + sizeof(instr) - rc, 0);
> return EXCRET_fault_fixed;
> @@ -1076,6 +1081,12 @@ void propagate_page_fault(unsigned long addr, u16 error_code)
> struct vcpu *v = current;
> struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce;
>
> + if ( is_pvh_vcpu(v) )
> + {
> + hvm_inject_page_fault(error_code, addr);
> + return;
> + }

Would it make more sense to rename this function
"pv_inject_page_fault", and then make a macro to switch between the
two?


> +
> v->arch.pv_vcpu.ctrlreg[2] = addr;
> arch_set_cr2(v, addr);
>
> diff --git a/xen/include/asm-x86/traps.h b/xen/include/asm-x86/traps.h
> index 82cbcee..1d9b087 100644
> --- a/xen/include/asm-x86/traps.h
> +++ b/xen/include/asm-x86/traps.h
> @@ -48,5 +48,6 @@ extern int guest_has_trap_callback(struct domain *d, uint16_t vcpuid,
> */
> extern int send_guest_trap(struct domain *d, uint16_t vcpuid,
> unsigned int trap_nr);
> +int emulate_forced_invalid_op(struct cpu_user_regs *regs);

Same as above re making the function non-static.

-George

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


mukesh.rathor at oracle

Aug 7, 2013, 6:49 PM

Post #3 of 8 (21 views)
Permalink
Re: [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH [In reply to]

On Wed, 7 Aug 2013 12:29:13 +0100
George Dunlap <George.Dunlap [at] eu> wrote:

> On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor
> <mukesh.rathor [at] oracle> wrote:
> > This patch supports invalid op emulation for PVH by calling
> > appropriate copy macros and and HVM function to inject PF.
> >
> > Signed-off-by: Mukesh Rathor <mukesh.rathor [at] oracle>
> > Reviewed-by: Jan Beulich <jbeulich [at] suse>
> > ---
> > xen/arch/x86/traps.c | 17 ++++++++++++++---
> > xen/include/asm-x86/traps.h | 1 +
> > 2 files changed, 15 insertions(+), 3 deletions(-)
> >
> > diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
> > index 378ef0a..a3ca70b 100644
> > --- a/xen/arch/x86/traps.c
> > +++ b/xen/arch/x86/traps.c
> > @@ -459,6 +459,11 @@ static void instruction_done(
> > struct cpu_user_regs *regs, unsigned long eip, unsigned int
> > bpmatch) {
> > regs->eip = eip;
> > +
> > + /* PVH fixme: debug trap below */
> > + if ( is_pvh_vcpu(current) )
> > + return;
>
> What exactly does this comment mean? Do you mean, "FIXME: Make debug
> trapping work for PVH guests"? (i.e., this functionality will be
> implemented later?)

Correct, future work. Look at what the db trap is doing and make
it work for PVH if it doesn't already.

> > +
> > regs->eflags &= ~X86_EFLAGS_RF;
> > if ( bpmatch || (regs->eflags & X86_EFLAGS_TF) )
> > {
> > @@ -913,7 +918,7 @@ static int emulate_invalid_rdtscp(struct
> > cpu_user_regs *regs) return EXCRET_fault_fixed;
> > }
> >
> > -static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
> > +int emulate_forced_invalid_op(struct cpu_user_regs *regs)
>
> Why make this non-static? No one is using this in this patch. If a
> later patch needs it, you should make it non-static there, so we can
> decide at that point if making it non-static is merited or not.

Sigh! Originally, it was that way, but then to keep that patch from
getting too big, it got moved here after few versions. We are making
emulation available for outside the PV, ie, to PVH.

> > + if ( (rc = raw_copy_from_guest(sig, (char *)eip,
> > sizeof(sig))) != 0 ) {
> > propagate_page_fault(eip + sizeof(sig) - rc, 0);
> > return EXCRET_fault_fixed;
> > @@ -931,7 +936,7 @@ static int emulate_forced_invalid_op(struct
> > cpu_user_regs *regs) eip += sizeof(sig);
> >
> > /* We only emulate CPUID. */
> > - if ( ( rc = copy_from_user(instr, (char *)eip,
> > sizeof(instr))) != 0 )
> > + if ( ( rc = raw_copy_from_guest(instr, (char *)eip,
> > sizeof(instr))) != 0 ) {
> > propagate_page_fault(eip + sizeof(instr) - rc, 0);
> > return EXCRET_fault_fixed;
> > @@ -1076,6 +1081,12 @@ void propagate_page_fault(unsigned long
> > addr, u16 error_code) struct vcpu *v = current;
> > struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce;
> >
> > + if ( is_pvh_vcpu(v) )
> > + {
> > + hvm_inject_page_fault(error_code, addr);
> > + return;
> > + }
>
> Would it make more sense to rename this function
> "pv_inject_page_fault", and then make a macro to switch between the
> two?

I don't think so, propagate_page_fault seems generic enough.


-mukesh


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


george.dunlap at eu

Aug 8, 2013, 1:55 AM

Post #4 of 8 (21 views)
Permalink
Re: [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH [In reply to]

On 08/08/13 02:49, Mukesh Rathor wrote:
> On Wed, 7 Aug 2013 12:29:13 +0100
> George Dunlap <George.Dunlap [at] eu> wrote:
>
>> On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor
>> <mukesh.rathor [at] oracle> wrote:
>>> This patch supports invalid op emulation for PVH by calling
>>> appropriate copy macros and and HVM function to inject PF.
>>>
>>> Signed-off-by: Mukesh Rathor <mukesh.rathor [at] oracle>
>>> Reviewed-by: Jan Beulich <jbeulich [at] suse>
>>> ---
>>> xen/arch/x86/traps.c | 17 ++++++++++++++---
>>> xen/include/asm-x86/traps.h | 1 +
>>> 2 files changed, 15 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
>>> index 378ef0a..a3ca70b 100644
>>> --- a/xen/arch/x86/traps.c
>>> +++ b/xen/arch/x86/traps.c
>>> @@ -459,6 +459,11 @@ static void instruction_done(
>>> struct cpu_user_regs *regs, unsigned long eip, unsigned int
>>> bpmatch) {
>>> regs->eip = eip;
>>> +
>>> + /* PVH fixme: debug trap below */
>>> + if ( is_pvh_vcpu(current) )
>>> + return;
>> What exactly does this comment mean? Do you mean, "FIXME: Make debug
>> trapping work for PVH guests"? (i.e., this functionality will be
>> implemented later?)
> Correct, future work. Look at what the db trap is doing and make
> it work for PVH if it doesn't already.
>
>>> +
>>> regs->eflags &= ~X86_EFLAGS_RF;
>>> if ( bpmatch || (regs->eflags & X86_EFLAGS_TF) )
>>> {
>>> @@ -913,7 +918,7 @@ static int emulate_invalid_rdtscp(struct
>>> cpu_user_regs *regs) return EXCRET_fault_fixed;
>>> }
>>>
>>> -static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
>>> +int emulate_forced_invalid_op(struct cpu_user_regs *regs)
>> Why make this non-static? No one is using this in this patch. If a
>> later patch needs it, you should make it non-static there, so we can
>> decide at that point if making it non-static is merited or not.
> Sigh! Originally, it was that way, but then to keep that patch from
> getting too big, it got moved here after few versions. We are making
> emulation available for outside the PV, ie, to PVH.

As far as I'm concerned, the size of the patch itself is immaterial; the
only important question, regarding how to break down patches (just like
in breaking down functions), is how easy or difficult it is to
understand the whole thing.

Now it's typically the case that long patches are hard to understand,
and that breaking them down into smaller chunks makes them easier to
read. But a division like this, where you've moved some random hunk
into a different patch with which it has no logical relation, makes the
series *harder* to understand, not easier.

Additionally, as the series evolves, it makes it difficult to keep all
of the dependencies straight. Suppose you changed your approach for
that future patch so that you didn't need this public anymore. You, and
all the reviewers, could easily forget about the dependency, since it's
in a separate patch which may have already been classified as "OK".

It's like taking a function named foo() and breaking it down into
foo_1() and foo_2(). You're making the function shorter, but achieving
the opposite of what having short functions is supposed to achieve. :-)

>
>>> + if ( (rc = raw_copy_from_guest(sig, (char *)eip,
>>> sizeof(sig))) != 0 ) {
>>> propagate_page_fault(eip + sizeof(sig) - rc, 0);
>>> return EXCRET_fault_fixed;
>>> @@ -931,7 +936,7 @@ static int emulate_forced_invalid_op(struct
>>> cpu_user_regs *regs) eip += sizeof(sig);
>>>
>>> /* We only emulate CPUID. */
>>> - if ( ( rc = copy_from_user(instr, (char *)eip,
>>> sizeof(instr))) != 0 )
>>> + if ( ( rc = raw_copy_from_guest(instr, (char *)eip,
>>> sizeof(instr))) != 0 ) {
>>> propagate_page_fault(eip + sizeof(instr) - rc, 0);
>>> return EXCRET_fault_fixed;
>>> @@ -1076,6 +1081,12 @@ void propagate_page_fault(unsigned long
>>> addr, u16 error_code) struct vcpu *v = current;
>>> struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce;
>>>
>>> + if ( is_pvh_vcpu(v) )
>>> + {
>>> + hvm_inject_page_fault(error_code, addr);
>>> + return;
>>> + }
>> Would it make more sense to rename this function
>> "pv_inject_page_fault", and then make a macro to switch between the
>> two?
> I don't think so, propagate_page_fault seems generic enough.

What I meant was something similar to what I suggested for patch 10 --
make propagate_page_fault() truly generic, by making it check what mode
is running and calling either pv_inject_page_fault() or
hvm_inject_page_fault() as appropriate.

-George

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


mukesh.rathor at oracle

Aug 8, 2013, 5:17 PM

Post #5 of 8 (18 views)
Permalink
Re: [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH [In reply to]

On Thu, 8 Aug 2013 09:55:26 +0100
George Dunlap <george.dunlap [at] eu> wrote:

> On 08/08/13 02:49, Mukesh Rathor wrote:
> > On Wed, 7 Aug 2013 12:29:13 +0100
> > George Dunlap <George.Dunlap [at] eu> wrote:
> >
> >> On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor
.........
> >>> + if ( (rc = raw_copy_from_guest(sig, (char *)eip,
> >>> sizeof(sig))) != 0 ) {
> >>> propagate_page_fault(eip + sizeof(sig) - rc, 0);
> >>> return EXCRET_fault_fixed;
> >>> @@ -931,7 +936,7 @@ static int emulate_forced_invalid_op(struct
> >>> cpu_user_regs *regs) eip += sizeof(sig);
> >>>
> >>> /* We only emulate CPUID. */
> >>> - if ( ( rc = copy_from_user(instr, (char *)eip,
> >>> sizeof(instr))) != 0 )
> >>> + if ( ( rc = raw_copy_from_guest(instr, (char *)eip,
> >>> sizeof(instr))) != 0 ) {
> >>> propagate_page_fault(eip + sizeof(instr) - rc, 0);
> >>> return EXCRET_fault_fixed;
> >>> @@ -1076,6 +1081,12 @@ void propagate_page_fault(unsigned long
> >>> addr, u16 error_code) struct vcpu *v = current;
> >>> struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce;
> >>>
> >>> + if ( is_pvh_vcpu(v) )
> >>> + {
> >>> + hvm_inject_page_fault(error_code, addr);
> >>> + return;
> >>> + }
> >> Would it make more sense to rename this function
> >> "pv_inject_page_fault", and then make a macro to switch between the
> >> two?
> > I don't think so, propagate_page_fault seems generic enough.
>
> What I meant was something similar to what I suggested for patch 10
> -- make propagate_page_fault() truly generic, by making it check what
> mode is running and calling either pv_inject_page_fault() or
> hvm_inject_page_fault() as appropriate.

I guess, what you mean:

propagate_page_fault():
{
if (pvh)
hvm_inject_pf

else if pv
pv_inject_pf
}

where pv_inject_pf() is all the code after my "if pvh" in the current
patch. Small enough change I can accomodate in the next patch.

Mukesh

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


mukesh.rathor at oracle

Aug 9, 2013, 7:13 PM

Post #6 of 8 (14 views)
Permalink
Re: [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH [In reply to]

On Thu, 8 Aug 2013 09:55:26 +0100
George Dunlap <george.dunlap [at] eu> wrote:

> On 08/08/13 02:49, Mukesh Rathor wrote:
> > On Wed, 7 Aug 2013 12:29:13 +0100
> > George Dunlap <George.Dunlap [at] eu> wrote:
> >
> >> On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor
> >> <mukesh.rathor [at] oracle> wrote:
> >>> This patch supports invalid op emulation for PVH by calling
> >>> appropriate copy macros and and HVM function to inject PF.
> >>>
> >>> Signed-off-by: Mukesh Rathor <mukesh.rathor [at] oracle>
> >>> Reviewed-by: Jan Beulich <jbeulich [at] suse>
> >>> ---
> >>> xen/arch/x86/traps.c | 17 ++++++++++++++---
> >>> xen/include/asm-x86/traps.h | 1 +
> >> Why make this non-static? No one is using this in this patch. If
> >> a later patch needs it, you should make it non-static there, so we
> >> can decide at that point if making it non-static is merited or not.
> > Sigh! Originally, it was that way, but then to keep that patch from
> > getting too big, it got moved here after few versions. We are making
> > emulation available for outside the PV, ie, to PVH.
>
> As far as I'm concerned, the size of the patch itself is immaterial;
> the only important question, regarding how to break down patches
> (just like in breaking down functions), is how easy or difficult it
> is to understand the whole thing.
>
> Now it's typically the case that long patches are hard to understand,
> and that breaking them down into smaller chunks makes them easier to
> read. But a division like this, where you've moved some random hunk
> into a different patch with which it has no logical relation, makes
> the series *harder* to understand, not easier.
>
> Additionally, as the series evolves, it makes it difficult to keep
> all of the dependencies straight. Suppose you changed your approach
> for that future patch so that you didn't need this public anymore.
> You, and all the reviewers, could easily forget about the dependency,
> since it's in a separate patch which may have already been classified
> as "OK".

But that would happen even if the function was static. Say I make
changes in function for PVH, dont' make it public. Now I forget to
use it, the function has been changed already?

We make it public to be used by future patch, I'll add which patch is
using it to make it easier to understand. Not making it public makes
possible another comment -- why the change if it can't be used by
another PVH module anyways. Can't please all reviewers
simultaneously!!! All my life so far, all reviews are done by one
person per file, and that makes so much sense..... this is hell!!!

Mukesh

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


JBeulich at suse

Aug 12, 2013, 12:38 AM

Post #7 of 8 (5 views)
Permalink
Re: [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH [In reply to]

>>> On 10.08.13 at 04:13, Mukesh Rathor <mukesh.rathor [at] oracle> wrote:
> On Thu, 8 Aug 2013 09:55:26 +0100
> George Dunlap <george.dunlap [at] eu> wrote:
>
>> On 08/08/13 02:49, Mukesh Rathor wrote:
>> > On Wed, 7 Aug 2013 12:29:13 +0100
>> > George Dunlap <George.Dunlap [at] eu> wrote:
>> >
>> >> On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor
>> >> <mukesh.rathor [at] oracle> wrote:
>> >>> This patch supports invalid op emulation for PVH by calling
>> >>> appropriate copy macros and and HVM function to inject PF.
>> >>>
>> >>> Signed-off-by: Mukesh Rathor <mukesh.rathor [at] oracle>
>> >>> Reviewed-by: Jan Beulich <jbeulich [at] suse>
>> >>> ---
>> >>> xen/arch/x86/traps.c | 17 ++++++++++++++---
>> >>> xen/include/asm-x86/traps.h | 1 +
>> >> Why make this non-static? No one is using this in this patch. If
>> >> a later patch needs it, you should make it non-static there, so we
>> >> can decide at that point if making it non-static is merited or not.
>> > Sigh! Originally, it was that way, but then to keep that patch from
>> > getting too big, it got moved here after few versions. We are making
>> > emulation available for outside the PV, ie, to PVH.
>>
>> As far as I'm concerned, the size of the patch itself is immaterial;
>> the only important question, regarding how to break down patches
>> (just like in breaking down functions), is how easy or difficult it
>> is to understand the whole thing.
>>
>> Now it's typically the case that long patches are hard to understand,
>> and that breaking them down into smaller chunks makes them easier to
>> read. But a division like this, where you've moved some random hunk
>> into a different patch with which it has no logical relation, makes
>> the series *harder* to understand, not easier.
>>
>> Additionally, as the series evolves, it makes it difficult to keep
>> all of the dependencies straight. Suppose you changed your approach
>> for that future patch so that you didn't need this public anymore.
>> You, and all the reviewers, could easily forget about the dependency,
>> since it's in a separate patch which may have already been classified
>> as "OK".
>
> But that would happen even if the function was static. Say I make
> changes in function for PVH, dont' make it public. Now I forget to
> use it, the function has been changed already?
>
> We make it public to be used by future patch, I'll add which patch is
> using it to make it easier to understand. Not making it public makes
> possible another comment -- why the change if it can't be used by
> another PVH module anyways. Can't please all reviewers
> simultaneously!!! All my life so far, all reviews are done by one
> person per file, and that makes so much sense..... this is hell!!!

Yes, I see how this is not pleasant for you. But that's the way it is
with community projects. And I've seem numerous occasions
where there were multiple reviewers, and one has to find a way
to make all of them happy.

For what it's worth - I had pointed out the non-logical breakup of
the series as an issue quite early in the process, and merely gave
in realizing that your life with this is already difficult enough.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


george.dunlap at eu

Aug 12, 2013, 2:35 AM

Post #8 of 8 (4 views)
Permalink
Re: [V10 PATCH 11/23] PVH xen: support invalid op emulation for PVH [In reply to]

On 10/08/13 03:13, Mukesh Rathor wrote:
> On Thu, 8 Aug 2013 09:55:26 +0100
> George Dunlap <george.dunlap [at] eu> wrote:
>
>> On 08/08/13 02:49, Mukesh Rathor wrote:
>>> On Wed, 7 Aug 2013 12:29:13 +0100
>>> George Dunlap <George.Dunlap [at] eu> wrote:
>>>
>>>> On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor
>>>> <mukesh.rathor [at] oracle> wrote:
>>>>> This patch supports invalid op emulation for PVH by calling
>>>>> appropriate copy macros and and HVM function to inject PF.
>>>>>
>>>>> Signed-off-by: Mukesh Rathor <mukesh.rathor [at] oracle>
>>>>> Reviewed-by: Jan Beulich <jbeulich [at] suse>
>>>>> ---
>>>>> xen/arch/x86/traps.c | 17 ++++++++++++++---
>>>>> xen/include/asm-x86/traps.h | 1 +
>>>> Why make this non-static? No one is using this in this patch. If
>>>> a later patch needs it, you should make it non-static there, so we
>>>> can decide at that point if making it non-static is merited or not.
>>> Sigh! Originally, it was that way, but then to keep that patch from
>>> getting too big, it got moved here after few versions. We are making
>>> emulation available for outside the PV, ie, to PVH.
>> As far as I'm concerned, the size of the patch itself is immaterial;
>> the only important question, regarding how to break down patches
>> (just like in breaking down functions), is how easy or difficult it
>> is to understand the whole thing.
>>
>> Now it's typically the case that long patches are hard to understand,
>> and that breaking them down into smaller chunks makes them easier to
>> read. But a division like this, where you've moved some random hunk
>> into a different patch with which it has no logical relation, makes
>> the series *harder* to understand, not easier.
>>
>> Additionally, as the series evolves, it makes it difficult to keep
>> all of the dependencies straight. Suppose you changed your approach
>> for that future patch so that you didn't need this public anymore.
>> You, and all the reviewers, could easily forget about the dependency,
>> since it's in a separate patch which may have already been classified
>> as "OK".
> But that would happen even if the function was static. Say I make
> changes in function for PVH, dont' make it public. Now I forget to
> use it, the function has been changed already?

I said "as the patch series evolves" -- that means before it gets
applied. If the hunk making it public is in the same patch that it's
used, it is much more likely to be noticed.

> We make it public to be used by future patch, I'll add which patch is
> using it to make it easier to understand.

Why don't you just *move it* to the patch that's actually using it (the
last patch in the series, it would seem -- the one which implements the
PVH exit handler)? In the time it took you to write this e-mail, you
could have moved that one hunk to the other patch 5 times.

> Not making it public makes
> possible another comment -- why the change if it can't be used by
> another PVH module anyways. Can't please all reviewers
> simultaneously!!!
> All my life so far, all reviews are done by one
> person per file, and that makes so much sense..... this is hell!!!

Did someone actually say to you, "This patch is too long, make it shorter"?

I'm not asking for the moon, and I'm not trying to grind your gears.
I'm just trying to help you write better patches -- ones which are
easier to review, and ones which will be easier for people looking back
at to figure out what's going on. And more importantly, in comments in
the rest of the series, I'm trying to make code which is easier to
understand.

This is important enough to me that I'd actually be willing to take your
series and reformat it myself, to demonstrate what I'm talking about.
It would be a good exercise for me to become familiar with the code; the
only problem is that I'm not up to speed with the details of the
hardware at this point.

-George

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel

Xen devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.