All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Andrew Jones <drjones@redhat.com>, Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	David Vrabel <david.vrabel@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v4 8/9] libxl: soft reset support
Date: Fri, 05 Dec 2014 11:45:14 +0100	[thread overview]
Message-ID: <87oarifk91.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20141204160133.GA31446@zion.uk.xensource.com> (Wei Liu's message of "Thu, 4 Dec 2014 16:01:33 +0000")

Wei Liu <wei.liu2@citrix.com> writes:

> (I've skipped the internal implementation since I don't know what's
>  required to fulfil soft reset.)
>
> On Wed, Dec 03, 2014 at 06:16:20PM +0100, Vitaly Kuznetsov wrote:
> [...]
>> +                                         libxl__domain_create_state *dcs);
>>  
>>  /* Each time the dm needs to be saved, we must call suspend and then save */
>>  _hidden int libxl__domain_suspend_device_model(libxl__gc *gc,
>> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
>> index 53611dc..eb833f0 100644
>> --- a/tools/libxl/xl_cmdimpl.c
>> +++ b/tools/libxl/xl_cmdimpl.c
>> @@ -2043,7 +2043,8 @@ static void reload_domain_config(uint32_t domid,
>>  }
>>  
>>  /* Returns 1 if domain should be restarted,
>> - * 2 if domain should be renamed then restarted, or 0
>> + * 2 if domain should be renamed then restarted,
>> + * 3 if domain performed soft reset, or 0
>>   * Can update r_domid if domain is destroyed etc */
>>  static int handle_domain_death(uint32_t *r_domid,
>>                                 libxl_event *event,
>> @@ -2069,6 +2070,9 @@ static int handle_domain_death(uint32_t *r_domid,
>>      case LIBXL_SHUTDOWN_REASON_WATCHDOG:
>>          action = d_config->on_watchdog;
>>          break;
>> +    case LIBXL_SHUTDOWN_REASON_SOFT_RESET:
>> +        LOG("Domain performed soft reset.");
>> +        return 3;
>
> Would it be useful to provide "on_soft_reset" option in xl? Will the
> admin be interested in performing some other action when domain does
> soft reset? Say, for security reason admin want to prohibit domain from
> soft resetting itself.
>

Makes sense, let's add it.

>>      default:
>>          LOG("Unknown shutdown reason code %d. Destroying domain.",
>>              event->u.domain_shutdown.shutdown_reason);
>> @@ -2285,6 +2289,7 @@ static void evdisable_disk_ejects(libxl_evgen_disk_eject **diskws,
>>  static uint32_t create_domain(struct domain_create *dom_info)
>>  {
>>      uint32_t domid = INVALID_DOMID;
>> +    uint32_t domid_old = INVALID_DOMID;
>>  
>>      libxl_domain_config d_config;
>>  
>> @@ -2510,7 +2515,18 @@ start:
>>           * restore/migrate-receive it again.
>>           */
>>          restoring = 0;
>> -    }else{
>> +    } else if (domid_old != INVALID_DOMID) {
>> +        /* Do soft reset */
>> +        d_config.b_info.nodemap.size = 0;
>
> What's the reason for doing this?
>
> If you encounter problem with this it should probably be fixed in
> libxl.

Ah, sorry, I forgot about this hackaround (which was required since
194e7183 if I'm not mistaken). The root cause is that
reload_domain_config() was missing on soft_reset path and we were
hitting "Can run NUMA placement only if the domain does not have any
NUMA node affinity set already" clause.

I will fix this along with "on_soft_reset" implementation.

>
> Wei.
>
>> +        ret = libxl_domain_soft_reset(ctx, &d_config,
>> +                                      &domid, domid_old,
>> +                                      0, 0);
>> +
>> +        if ( ret ) {
>> +            goto error_out;
>> +        }
>> +        domid_old = INVALID_DOMID;
>> +    } else {
>>          ret = libxl_domain_create_new(ctx, &d_config, &domid,
>>                                        0, autoconnect_console_how);
>>      }
>> @@ -2574,6 +2590,8 @@ start:
>>                  event->u.domain_shutdown.shutdown_reason,
>>                  event->u.domain_shutdown.shutdown_reason);
>>              switch (handle_domain_death(&domid, event, &d_config)) {
>> +            case 3:
>> +                domid_old = domid;
>>              case 2:
>>                  if (!preserve_domain(&domid, event, &d_config)) {
>>                      /* If we fail then exit leaving the old domain in place. */
>> -- 
>> 1.9.3
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel

-- 
  Vitaly

  reply	other threads:[~2014-12-05 10:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 17:16 [PATCH v4 0/9] toolstack-based approach to pvhvm guest kexec Vitaly Kuznetsov
2014-12-03 17:16 ` [PATCH v4 1/9] xen: introduce DOMDYING_locked state Vitaly Kuznetsov
2014-12-03 17:16 ` [PATCH v4 2/9] xen: introduce SHUTDOWN_soft_reset shutdown reason Vitaly Kuznetsov
2014-12-03 17:16 ` [PATCH v4 3/9] libxl: support " Vitaly Kuznetsov
2014-12-03 17:16 ` [PATCH v4 4/9] xen: introduce XEN_DOMCTL_devour Vitaly Kuznetsov
2014-12-04  0:50   ` Julien Grall
2014-12-04 10:19     ` David Vrabel
2014-12-04 10:52       ` Julien Grall
2014-12-04 15:12     ` Vitaly Kuznetsov
2014-12-04 15:54       ` Julien Grall
2014-12-04 11:01   ` Julien Grall
2014-12-04 14:48     ` Vitaly Kuznetsov
2014-12-03 17:16 ` [PATCH v4 5/9] libxc: support XEN_DOMCTL_devour Vitaly Kuznetsov
2014-12-03 17:16 ` [PATCH v4 6/9] libxl: add libxl__domain_soft_reset_destroy_old() Vitaly Kuznetsov
2014-12-04 16:20   ` Wei Liu
2014-12-03 17:16 ` [PATCH v4 7/9] libxc: introduce soft reset for HVM domains Vitaly Kuznetsov
2014-12-03 17:16 ` [PATCH v4 8/9] libxl: soft reset support Vitaly Kuznetsov
2014-12-04 16:01   ` Wei Liu
2014-12-05 10:45     ` Vitaly Kuznetsov [this message]
2014-12-03 17:16 ` [PATCH v4 9/9] xsm: add XEN_DOMCTL_devour support Vitaly Kuznetsov
2014-12-04 11:17 ` [PATCH v4 0/9] toolstack-based approach to pvhvm guest kexec Olaf Hering
2014-12-04 14:29   ` Vitaly Kuznetsov
2014-12-04 11:55 ` Wei Liu
2014-12-04 14:46   ` Vitaly Kuznetsov
2014-12-04 15:08     ` Wei Liu
2014-12-11 14:24 ` Olaf Hering
2014-12-11 15:24   ` David Vrabel
2014-12-11 15:30     ` Olaf Hering

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=87oarifk91.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=drjones@redhat.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.