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

Re: [Xen-devel] [PATCH] x86/hvm: do not register hpet mmio during s3 cycle



>>> On 07.11.17 at 21:39, <chanudete@xxxxxxxxxxxx> wrote:
> Do it once at domain creation (hpet_init).
> 
> Sleep -> Resume cycles will end up crashing an HVM guest with hpet as
> the sequence during resume takes the path:
> -> hvm_s3_suspend
>   -> hpet_reset
>     -> hpet_deinit
>     -> hpet_init
>       -> register_mmio_handler
>         -> hvm_next_io_handler
> 
> register_mmio_handler will use a new io handler each time, until
> eventually it reaches NR_IO_HANDLERS, then hvm_next_io_handler calls
> domain_crash.
> 
> Signed-off-by: Eric Chanudet <chanudete@xxxxxxxxxxxx>

This is certainly worthwhile to consider for 4.10 - please Cc
Julien on v2.

> +void hpet_reinit(struct domain *d)

static

> +{
> +    HPETState *h = domain_vhpet(d);
> +
> +    if ( !has_vhpet(d) )
> +        return;
> +
> +    hpet_set(h);

The local variable, being used only once, isn't needed.

> @@ -698,7 +713,7 @@ void hpet_deinit(struct domain *d)
>  void hpet_reset(struct domain *d)
>  {
>      hpet_deinit(d);
> -    hpet_init(d);
> +    hpet_reinit(d);
>  }

This being the only caller, it then becomes questionable whether
hpet_reinit() needs to be a separate function, or wouldn't better
be inlined here.

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