diff mbox

[v2,2/2] xl: Register the AER event handler to handle AER errors.

Message ID 20170727001639.5505-3-venu.busireddy@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Venu Busireddy July 27, 2017, 12:16 a.m. UTC
When a guest is created, register the AER event handler to handle the
AER errors. When an AER error occurs, the handler will forcibly remove
the erring PCIe device from the guest.

Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
---
 tools/xl/xl_vmcontrol.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Wei Liu July 28, 2017, 3:58 p.m. UTC | #1
On Wed, Jul 26, 2017 at 07:16:39PM -0500, Venu Busireddy wrote:
> When a guest is created, register the AER event handler to handle the
> AER errors. When an AER error occurs, the handler will forcibly remove
> the erring PCIe device from the guest.
> 
> Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
> ---
>  tools/xl/xl_vmcontrol.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
> index 89c2b25..10a48a9 100644
> --- a/tools/xl/xl_vmcontrol.c
> +++ b/tools/xl/xl_vmcontrol.c
> @@ -966,6 +966,15 @@ start:
>      LOG("Waiting for domain %s (domid %u) to die [pid %ld]",
>          d_config.c_info.name, domid, (long)getpid());
>  
> +    ret = libxl_reg_aer_events_handler(ctx, domid);
> +    if (ret) {
> +        /*
> +         * This error may not be severe enough to fail the creation of the VM.
> +         * Log the error, and continue with the creation.
> +         */

What does this comment mean? This is called after the guest is created,
right?
Venu Busireddy July 28, 2017, 4:06 p.m. UTC | #2
On 2017-07-28 16:58:16 +0100, Wei Liu wrote:
> On Wed, Jul 26, 2017 at 07:16:39PM -0500, Venu Busireddy wrote:
> > When a guest is created, register the AER event handler to handle the
> > AER errors. When an AER error occurs, the handler will forcibly remove
> > the erring PCIe device from the guest.
> > 
> > Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
> > ---
> >  tools/xl/xl_vmcontrol.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
> > index 89c2b25..10a48a9 100644
> > --- a/tools/xl/xl_vmcontrol.c
> > +++ b/tools/xl/xl_vmcontrol.c
> > @@ -966,6 +966,15 @@ start:
> >      LOG("Waiting for domain %s (domid %u) to die [pid %ld]",
> >          d_config.c_info.name, domid, (long)getpid());
> >  
> > +    ret = libxl_reg_aer_events_handler(ctx, domid);
> > +    if (ret) {
> > +        /*
> > +         * This error may not be severe enough to fail the creation of the VM.
> > +         * Log the error, and continue with the creation.
> > +         */
> 
> What does this comment mean? This is called after the guest is created,
> right?

Maybe too many words. I can change it as:

/* Log the error, and move on...  */

Is that okay?

Venu
Wei Liu July 28, 2017, 4:14 p.m. UTC | #3
On Fri, Jul 28, 2017 at 09:06:03AM -0700, Venu Busireddy wrote:
> On 2017-07-28 16:58:16 +0100, Wei Liu wrote:
> > On Wed, Jul 26, 2017 at 07:16:39PM -0500, Venu Busireddy wrote:
> > > When a guest is created, register the AER event handler to handle the
> > > AER errors. When an AER error occurs, the handler will forcibly remove
> > > the erring PCIe device from the guest.
> > > 
> > > Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
> > > ---
> > >  tools/xl/xl_vmcontrol.c | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
> > > index 89c2b25..10a48a9 100644
> > > --- a/tools/xl/xl_vmcontrol.c
> > > +++ b/tools/xl/xl_vmcontrol.c
> > > @@ -966,6 +966,15 @@ start:
> > >      LOG("Waiting for domain %s (domid %u) to die [pid %ld]",
> > >          d_config.c_info.name, domid, (long)getpid());
> > >  
> > > +    ret = libxl_reg_aer_events_handler(ctx, domid);
> > > +    if (ret) {
> > > +        /*
> > > +         * This error may not be severe enough to fail the creation of the VM.
> > > +         * Log the error, and continue with the creation.
> > > +         */
> > 
> > What does this comment mean? This is called after the guest is created,
> > right?
> 
> Maybe too many words. I can change it as:
> 
> /* Log the error, and move on...  */
> 
> Is that okay?
> 

Fine.
diff mbox

Patch

diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index 89c2b25..10a48a9 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -966,6 +966,15 @@  start:
     LOG("Waiting for domain %s (domid %u) to die [pid %ld]",
         d_config.c_info.name, domid, (long)getpid());
 
+    ret = libxl_reg_aer_events_handler(ctx, domid);
+    if (ret) {
+        /*
+         * This error may not be severe enough to fail the creation of the VM.
+         * Log the error, and continue with the creation.
+         */
+        LOG("libxl_reg_aer_events_handler() failed, ret = 0x%08x", ret);
+    }
+
     ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
     if (ret) goto out;
 
@@ -993,6 +1002,7 @@  start:
             LOG("Domain %u has shut down, reason code %d 0x%x", domid,
                 event->u.domain_shutdown.shutdown_reason,
                 event->u.domain_shutdown.shutdown_reason);
+            libxl_unreg_aer_events_handler(ctx, domid);
             switch (handle_domain_death(&domid, event, &d_config)) {
             case DOMAIN_RESTART_SOFT_RESET:
                 domid_soft_reset = domid;
@@ -1059,6 +1069,7 @@  start:
 
         case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
             LOG("Domain %u has been destroyed.", domid);
+            libxl_unreg_aer_events_handler(ctx, domid);
             libxl_event_free(ctx, event);
             ret = 0;
             goto out;