[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-next 4/7] x86/traps: move all PV emulation and hypercalls to pv/traps.c



>>> On 06.04.17 at 19:14, <wei.liu2@xxxxxxxxxx> wrote:
> @@ -1576,1963 +1358,173 @@ void __init do_early_page_fault(struct 
> cpu_user_regs *regs)
>      }
>  }
>  
> -long do_fpu_taskswitch(int set)
> +void do_general_protection(struct cpu_user_regs *regs)
>  {
>      struct vcpu *v = current;
> +    unsigned long fixup;

Same comment as on one of the patches in the other series: For
reviewers' sake, if the diff can't be produced such that plain
removals also come out as such, please split this into smaller steps.

> --- a/xen/include/asm-x86/traps.h
> +++ b/xen/include/asm-x86/traps.h
> @@ -51,4 +51,23 @@ uint32_t guest_io_read(unsigned int port, unsigned int 
> bytes,
>  void guest_io_write(unsigned int port, unsigned int bytes, uint32_t data,
>                      struct domain *);
>  
> +int emulate_privileged_op(struct cpu_user_regs *regs);
> +int emulate_invalid_rdtscp(struct cpu_user_regs *regs);
> +int emulate_forced_invalid_op(struct cpu_user_regs *regs);
> +void emulate_gate_op(struct cpu_user_regs *regs);
> +
> +static inline const char *trapstr(unsigned int trapnr)
> +{
> +    static const char * const strings[] = {
> +        "divide error", "debug", "nmi", "bkpt", "overflow", "bounds",
> +        "invalid opcode", "device not available", "double fault",
> +        "coprocessor segment", "invalid tss", "segment not found",
> +        "stack error", "general protection fault", "page fault",
> +        "spurious interrupt", "coprocessor error", "alignment check",
> +        "machine check", "simd error", "virtualisation exception"
> +    };
> +
> +    return trapnr < ARRAY_SIZE(strings) ? strings[trapnr] : "???";
> +}

This doesn't belong into a header - using it from more than one CU
would mean multiple instances of the static array and strings. This
isn't C++, where they can be folded by the linker. We don't need
this on any fast paths (as the intention here is to provide input to
printk(), which is inherently slow), so there's no reason not to make
this an out of line function.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.