[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 6/7] xen: Allow hardare domain != dom0



>>> On 11.04.14 at 17:07, <dgdegra@xxxxxxxxxxxxx> wrote:
> On 04/11/2014 05:13 AM, Jan Beulich wrote:
>>>>> On 27.03.14 at 12:52, <dgdegra@xxxxxxxxxxxxx> wrote:
>>> @@ -794,7 +795,7 @@ void watchdog_domain_destroy(struct domain *d);
>>>    *    (that is, this would not be suitable for a driver domain)
>>>    *  - There is never a reason to deny dom0 access to this
>>>    */
>>> -#define is_hardware_domain(_d) ((_d)->domain_id == 0)
>>> +#define is_hardware_domain(d)  ((d)->domain_id == hardware_domid)
>>
>> This macro should imo evaluate to true for Dom0 until the hardware
>> domain go created, i.e. you should compare _d with hardware_domain
>> rather than their IDs. With that the definition of hardware_domid can
>> then also be moved inside the #ifdef requested above.
> 
> This isn't quite as simple as changing the function since there are
> some places where is_hardware_domain needs to return false for domain 0
> when a hardware domain is used.  Also, the hardware_domain variable is
> not set until domain_create returns, so there are a few places where the
> domain ID still needs to be checked explicitly.  It should be possible
> to create an is_hardware_domid function for those cases, if comparing to
> hardware_domain is preferred for most cases; I think that would belong in
> a new patch 5.5/7 (i.e. 6/8 in v4).
> 
> Otherwise, I think the is_hardware_domain definition should be:
> 
> #ifdef CONFIG_LATE_HWDOM
> #define is_hardware_domain(_d) ((_d)->domain_id == hardware_domid)
> #else
> #define is_hardware_domain(_d) ((_d)->domain_id == 0)
> #endif
> 
> This also allows hardware_domid to be declared inside the #ifdef.

But that still wouldn't necessarily do the correct thing for any use of
the macro before that new special case code in domain_create() got
run. Maybe my thinking of this is wrong, but as I tried to state above,
I would expect Dom0 to be the hardware domain up to the point
where the intended hardware domain gets created, at which point all
state Dom0 obtained because of having been the de-facto hardware
domain get transferred to hardware_domain.

And btw, the above could be simplified by just having

#define hardware_domid 0

alongside the extern declaration of it (in a respective conditional).
That way all eventual future uses of the variable don't need to also
be enclosed in conditionals.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.