All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH 7/7] tools/libxl: Allow dom0 to be destroyed
Date: Wed, 19 Mar 2014 11:12:46 -0400	[thread overview]
Message-ID: <5329B3EE.6040401@tycho.nsa.gov> (raw)
In-Reply-To: <1395226968.10203.54.camel@kazak.uk.xensource.com>

On 03/19/2014 07:02 AM, Ian Campbell wrote:
> On Tue, 2014-03-18 at 17:34 -0400, Daniel De Graaf wrote:
>> @@ -3076,12 +3076,13 @@ static void unpause_domain(uint32_t domid)
>>       libxl_domain_unpause(ctx, domid);
>>   }
>>
>> -static void destroy_domain(uint32_t domid)
>> +static void destroy_domain(uint32_t domid, int force)
>>   {
>>       int rc;
>>
>> -    if (domid == 0) {
>> -        fprintf(stderr, "Cannot destroy privileged domain 0.\n\n");
>> +    if (domid == 0 && !force) {
>> +        fprintf(stderr, "Destroying domain 0 is only supported in a"
>> +                " disaggregated environment and requires the -f flag.\n\n");
>
>>From a user point of view perhaps this would be clearer if worded
> something like:
>
>          Not destroying domain 0, use -f to force.

OK, I like that error message better.

> Is the error message on attempted self destruction informative? If not
> then append "This can only be done from another domain, e.g. a
> disaggregated toolstack domain".

libxl: error: libxl.c:1411:libxl__destroy_domid: xc_domain_pause failed for 0
libxl: error: libxl.c:1471:devices_destroy_cb: xc_domain_destroy failed for 0
libxl: error: libxl.c:1342:domain_destroy_callback: unable to destroy guest with domid 0
libxl: error: libxl.c:1269:domain_destroy_cb: destruction of domain 0 failed
destroy failed (rc=-3)

It seems that libxl should include the errno from the hypervisor (EINVAL
in this case) somewhere in its output.

> Last random thought: Does this code know or have the potential to know
> which domain it is running in?

Not easily; I discussed this with Ian Jackson for the v1 patch, and we
decided that determining your own domain ID here was too cumbersome.

> All of this info should also be added to the man page and the help text
> in xl_cmdtable.c needs to have the -f added to it.

Ah, yes, documentation... will do.

>>           exit(-1);
>>       }
>>       rc = libxl_domain_destroy(ctx, domid, 0);
>> @@ -4166,12 +4167,15 @@ int main_unpause(int argc, char **argv)
>>   int main_destroy(int argc, char **argv)
>>   {
>>       int opt;
>> +    int force = 0;
>>
>> -    SWITCH_FOREACH_OPT(opt, "", NULL, "destroy", 1) {
>> -        /* No options */
>> +    SWITCH_FOREACH_OPT(opt, "f", NULL, "destroy", 1) {
>> +    case 'f':
>> +        force = 1;
>> +        break;
>>       }
>>
>> -    destroy_domain(find_domain(argv[optind]));
>> +    destroy_domain(find_domain(argv[optind]), force);
>>       return 0;
>>   }


-- 
Daniel De Graaf
National Security Agency

  reply	other threads:[~2014-03-19 15:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 21:34 [PATCH v2 0/7] xen: Hardware domain support Daniel De Graaf
2014-03-18 21:34 ` [PATCH 1/7] xen: use domid check in is_hardware_domain Daniel De Graaf
2014-03-19  9:03   ` Jan Beulich
2014-03-18 21:34 ` [PATCH 2/7] xen/iommu: Move dom0 setup code to __hwdom_init Daniel De Graaf
2014-03-19  9:02   ` Jan Beulich
2014-03-19 14:06     ` Daniel De Graaf
2014-03-19 14:14       ` Jan Beulich
2014-03-18 21:34 ` [PATCH 3/7] xen: prevent 0 from being used as a dynamic domid Daniel De Graaf
2014-03-18 21:34 ` [PATCH 4/7] xen: rename dom0 to hardware_domain Daniel De Graaf
2014-03-19  9:09   ` Jan Beulich
2014-03-18 21:34 ` [PATCH 5/7] xen: rename various functions referencing dom0 Daniel De Graaf
2014-03-19  9:13   ` Jan Beulich
2014-03-19 15:25     ` Daniel De Graaf
2014-03-19 15:32       ` Jan Beulich
2014-03-18 21:34 ` [PATCH 6/7] xen: Allow hardare domain != dom0 Daniel De Graaf
2014-03-19  9:15   ` Jan Beulich
2014-03-18 21:34 ` [PATCH 7/7] tools/libxl: Allow dom0 to be destroyed Daniel De Graaf
2014-03-19 11:02   ` Ian Campbell
2014-03-19 15:12     ` Daniel De Graaf [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-03-27 11:52 [PATCH v3 0/7] xen: Hardware domain support Daniel De Graaf
2014-03-27 11:52 ` [PATCH 7/7] tools/libxl: Allow dom0 to be destroyed Daniel De Graaf
2014-03-27 15:35   ` Ian Campbell
2014-04-02 15:08     ` Ian Jackson

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=5329B3EE.6040401@tycho.nsa.gov \
    --to=dgdegra@tycho.nsa.gov \
    --cc=Ian.Campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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.