xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>, xen-devel@lists.xen.org
Subject: Re: [PATCH 4/6] xen: Allow hardare domain != dom0
Date: Wed, 05 Mar 2014 18:04:36 -0500	[thread overview]
Message-ID: <5317AD84.1030807@tycho.nsa.gov> (raw)
In-Reply-To: <531704C602000078001211E1@nat28.tlf.novell.com>

On 03/05/2014 05:04 AM, Jan Beulich wrote:
>>>> On 04.03.14 at 23:51, Daniel De Graaf <dgdegra@tycho.nsa.gov> wrote:
>> This adds a hypervisor command line option "hardware_dom=" which takes a
>> domain ID.  When the domain with this ID is created, it will be used as
>> the hardware domain.
>>
>> This is intended to be used when dom0 is a dedicated stub domain for
>> domain building, allowing the hardware domain to be de-privileged and
>> act only as a driver domain.
>
> Apart from the abstract question regarding the purpose of this, a
> couple of comments on the patch a such:
>
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -88,6 +88,9 @@ unsigned long __initdata highmem_start;
>>   size_param("highmem-start", highmem_start);
>>   #endif
>>
>> +unsigned int __read_mostly hardware_dom;
>> +integer_param("hardware_dom", hardware_dom);
>
> This ought to be domid_t, and live in common code.
>
>> --- a/xen/common/domctl.c
>> +++ b/xen/common/domctl.c
>> @@ -472,6 +472,14 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>>               break;
>>           }
>>
>> +        if (d->domain_id == hardware_dom) {
>
> Coding style.
>
>> +            printk("Initialising hardware domain %d\n", hardware_dom);
>> +            rangeset_swap(d->irq_caps, dom0->irq_caps);
>
> Why interrupts, but not I/O ports and MMIO?

I/O ports and MMIO are currently set up by the domain builder to
mirror those of dom0 with some exceptions.  I could swap all of
the ranges and then de-privilege the newly created domain if that
seems more symmetric (it may also simplify the creation of the
domain builder's specifications); I'll try testing that to ensure
it works as expected.

>> +
>> +            dom0 = d;
>
> This, I think, is the point where the variable name becomes
> intolerable: ASSERT(!dom0 || !dom0->domain_id) should be
> valid at all times as long as the variable name is dom0.

I will prepare a pure rename patch prior to this one which
renames the dom0 variable (and perhaps some functions with
dom0 in their name) to another name: hwdom or hardware_domain
would be my preference, with the hardware_dom global renamed
to hardware_domid to avoid confusion.

>> --- a/xen/common/rangeset.c
>> +++ b/xen/common/rangeset.c
>> @@ -438,3 +438,29 @@ void rangeset_domain_printk(
>>
>>       spin_unlock(&d->rangesets_lock);
>>   }
>> +
>> +void rangeset_swap(struct rangeset *a, struct rangeset *b)
>> +{
>> +    struct list_head tmp;
>> +    spin_lock(&a->lock);
>> +    spin_lock(&b->lock);
>> +    memcpy(&tmp, &a->range_list, sizeof(tmp));
>> +    memcpy(&a->range_list, &b->range_list, sizeof(tmp));
>> +    memcpy(&b->range_list, &tmp, sizeof(tmp));
>> +    if (a->range_list.next == &b->range_list) {
>> +        a->range_list.next = &a->range_list;
>> +        a->range_list.prev = &a->range_list;
>> +    } else {
>> +        a->range_list.next->prev = &a->range_list;
>> +        a->range_list.prev->next = &a->range_list;
>> +    }
>> +    if (b->range_list.next == &a->range_list) {
>> +        b->range_list.next = &b->range_list;
>> +        b->range_list.prev = &b->range_list;
>> +    } else {
>> +        b->range_list.next->prev = &b->range_list;
>> +        b->range_list.prev->next = &b->range_list;
>> +    }
>
> Coding style again.
>
> Jan

Will clean up this patch for style when I resubmit.

-- 
Daniel De Graaf
National Security Agency

  reply	other threads:[~2014-03-05 23:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 22:51 [PATCH 0/6] xen: Hardware domain support Daniel De Graaf
2014-03-04 22:51 ` [PATCH 1/6] xen: use domid check in is_hardware_domain Daniel De Graaf
2014-03-05  3:44   ` Julien Grall
2014-03-05  9:23   ` Jan Beulich
2014-03-05 15:25     ` Daniel De Graaf
2014-03-05 15:45       ` Jan Beulich
2014-03-05 21:23         ` Daniel De Graaf
2014-03-11 13:10       ` Ian Campbell
2014-03-04 22:51 ` [PATCH 2/6] xen/iommu: Move dom0 setup code out of __init Daniel De Graaf
2014-03-05  9:56   ` Jan Beulich
2014-03-05 22:25     ` Daniel De Graaf
2014-03-06  9:53       ` Jan Beulich
2014-03-04 22:51 ` [PATCH 3/6] xen: prevent 0 from being used as a dynamic domid Daniel De Graaf
2014-03-04 22:51 ` [PATCH 4/6] xen: Allow hardare domain != dom0 Daniel De Graaf
2014-03-05  3:50   ` Julien Grall
2014-03-05 23:04     ` Daniel De Graaf
2014-03-05 10:04   ` Jan Beulich
2014-03-05 23:04     ` Daniel De Graaf [this message]
2014-03-06  9:54       ` Jan Beulich
2014-03-04 22:51 ` [PATCH 5/6] tools/libxl: Allow dom0 to be destroyed Daniel De Graaf
2014-03-05 10:07   ` Jan Beulich
2014-03-05 12:02   ` Ian Jackson
2014-03-05 22:36     ` Daniel De Graaf
2014-03-10 16:45       ` Ian Jackson
2014-03-12 14:27         ` Daniel De Graaf
2014-03-13 17:17           ` Ian Jackson
2014-03-13 17:41             ` Daniel De Graaf
2014-03-14 14:32               ` Ian Jackson
2014-03-04 22:51 ` [PATCH 6/6] xenstored: add --master-domid to support domain builder Daniel De Graaf
2014-03-10 12:14   ` Ian Jackson
2014-03-04 23:32 ` Domain Builder Daniel De Graaf

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=5317AD84.1030807@tycho.nsa.gov \
    --to=dgdegra@tycho.nsa.gov \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --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 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).