xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Shriram Rajagopalan <rshriram@cs.ubc.ca>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Anthony Perard <anthony.perard@citrix.com>,
	"brendan@cs.ubc.ca" <brendan@cs.ubc.ca>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH 3 of 6] libxl: QMP stop/resume & refactor QEMU suspend/resume/save
Date: Tue, 31 Jan 2012 15:53:42 -0800	[thread overview]
Message-ID: <CAP8mzPMHGfRRATgAya9vFqdcK85R_zUBXsa17S2URfpDqWEHMA@mail.gmail.com> (raw)
In-Reply-To: <CAP8mzPMer3bnxqBRCJYCYqi5nR9DcjQzmRbebNDKD39bm=v+pg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2847 bytes --]

On Tue, Jan 31, 2012 at 9:32 AM, Shriram Rajagopalan <rshriram@cs.ubc.ca>wrote:

> On Tue, Jan 31, 2012 at 1:54 AM, Ian Campbell <Ian.Campbell@citrix.com>wrote:
>
>> On Tue, 2012-01-31 at 01:05 +0000, rshriram@cs.ubc.ca wrote:
>> > +int libxl__domain_resume_device_model(libxl__gc *gc, uint32_t domid)
>> > +{
>> > +
>> > +    switch (libxl__device_model_version_running(gc, domid)) {
>> > +    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: {
>> > +        libxl__qemu_traditional_cmd(gc, domid, "continue");
>>
>> No libxl__wait_for_device_model -> "running"?
>>
>>
> Nope. Thats how xend/remus also does it. There seems to be no reference to
> such
> a state anywhere.
>
>
>>  > +        break;
>> > +    }
>> > +    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
>> > +        if (libxl__qmp_resume(gc, domid))
>> > +            return ERROR_FAIL;
>> > +    default:
>> > +        return ERROR_INVAL;
>> > +    }
>> > +
>> > +    return 0;
>> > +}
>> > +
>> >  static int libxl__domain_suspend_common_callback(void *data)
>> >  {
>> >      struct suspendinfo *si = data;
>> > @@ -454,7 +509,7 @@ static int libxl__domain_suspend_common_
>> >              return 0;
>> >          }
>> >          si->guest_responded = 1;
>> > -        return 1;
>> > +        goto suspend_dm;
>> >      }
>> >
>> >      if (si->hvm && (!hvm_pvdrv || hvm_s_state)) {
>> > @@ -532,7 +587,7 @@ static int libxl__domain_suspend_common_
>> >              shutdown_reason = (info.flags >> XEN_DOMINF_shutdownshift)
>> & XEN_DOMINF_shutdownmask;
>> >              if (shutdown_reason == SHUTDOWN_suspend) {
>> >                  LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "guest has
>> suspended");
>> > -                return 1;
>> > +                goto suspend_dm;
>> >              }
>> >          }
>> >
>> > @@ -541,6 +596,17 @@ static int libxl__domain_suspend_common_
>> >
>> >      LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "guest did not suspend");
>> >      return 0;
>> > +
>> > + suspend_dm:
>>
>> The goto's make the code flow a bit tricky to follow (this function is
>> already a bit tricksy with the early exit for the evtchn suspend case).
>>
>> Why not pass si to libxl__domain_suspend_device_model and let it contain
>> the "if !hvm return" and logging stuff so you can just call in in place
>> of the two goto statements?
>>
>>
> will do.
>
>
I gave it a shot. Passing suspendinfo struct to suspend_device_model is not
feasible, as the function is declared in libxl_internal.h, but suspendinfo
struct
declaration is local to libxl_dom.c.  I am not sure if its worthwhile to
declare a private struct like suspendinfo in libxl_internal.h, just to get
rid of this goto.

OTOH, passing a dummy hvm parameter to the function looks a bit silly

libxl__domain_suspend_device_model(libxl__gc *gc, uint32_t domid, int hvm)

What do you think? goto needs to go?

shriram

[-- Attachment #1.2: Type: text/html, Size: 4191 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2012-01-31 23:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31  1:05 [PATCH 0 of 6] libxl: refactor suspend/resume code rshriram
2012-01-31  1:05 ` [PATCH 1 of 6] libxl: helper function to send commands to traditional qemu rshriram
2012-01-31  9:46   ` Ian Campbell
2012-01-31 17:30     ` Shriram Rajagopalan
2012-02-09 18:08       ` Ian Jackson
2012-01-31  1:05 ` [PATCH 2 of 6] libxl: bugfix: create_domain() return to caller if !daemonize rshriram
2012-01-31  9:47   ` Ian Campbell
2012-02-09 18:06     ` Ian Jackson
2012-01-31  1:05 ` [PATCH 3 of 6] libxl: QMP stop/resume & refactor QEMU suspend/resume/save rshriram
2012-01-31  9:54   ` Ian Campbell
2012-01-31 17:32     ` Shriram Rajagopalan
2012-01-31 23:53       ` Shriram Rajagopalan [this message]
2012-02-01 10:46         ` Ian Campbell
2012-01-31  1:05 ` [PATCH 4 of 6] libxl: support suspend_cancel in domain_resume rshriram
2012-01-31 10:00   ` Ian Campbell
2012-01-31 10:04     ` Ian Campbell
2012-01-31 17:52     ` Shriram Rajagopalan
2012-02-01 10:47       ` Ian Campbell
2012-02-01 10:53       ` Ian Campbell
2012-02-01 15:48         ` Pasi Kärkkäinen
2012-02-01 16:02           ` Ian Campbell
2012-02-01 19:30             ` Shriram Rajagopalan
2012-02-02  7:04               ` Shriram Rajagopalan
2012-02-02  7:59                 ` Ian Campbell
2012-02-02  7:58               ` Ian Campbell
2012-01-31  1:05 ` [PATCH 5 of 6] libxl: refactor migrate_domain and generalize migrate_receive rshriram
2012-01-31 10:19   ` Ian Campbell
2012-01-31  1:05 ` [PATCH 6 of 6] libxl: resume instead of unpause on xl save -c rshriram
2012-01-31 10:21   ` Ian Campbell
2012-01-31 17:55     ` Shriram Rajagopalan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP8mzPMHGfRRATgAya9vFqdcK85R_zUBXsa17S2URfpDqWEHMA@mail.gmail.com \
    --to=rshriram@cs.ubc.ca \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=brendan@cs.ubc.ca \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).