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

Re: [Xen-devel] [PATCH 12/20] xen: avoid calling rcu_lock_*target_domain when an XSM hook exists



>>> On 11.09.12 at 15:26, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> wrote:
> On 09/11/2012 03:36 AM, Jan Beulich wrote:
>>>>> On 10.09.12 at 21:49, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> wrote:
>>> --- a/xen/common/grant_table.c
>>> +++ b/xen/common/grant_table.c
>>> @@ -195,30 +195,6 @@ double_gt_unlock(struct grant_table *lgt, struct 
>>> grant_table *rgt)
>>>          spin_unlock(&rgt->lock);
>>>  }
>>>  
>>> -static struct domain *gt_lock_target_domain_by_id(domid_t dom)
>>> -{
>>> -    struct domain *d;
>>> -    int rc = GNTST_general_error;
>>> -
>>> -    switch ( rcu_lock_target_domain_by_id(dom, &d) )
>>> -    {
>>> -    case 0:
>>> -        return d;
>>> -
>>> -    case -ESRCH:
>>> -        gdprintk(XENLOG_INFO, "Bad domid %d.\n", dom);
>>> -        rc = GNTST_bad_domain;
>>> -        break;
>>> -
>>> -    case -EPERM:
>>> -        rc = GNTST_permission_denied;
>>> -        break;
>>> -    }
>>> -
>>> -    ASSERT(rc < 0 && -rc <= MAX_ERRNO);
>>> -    return ERR_PTR(rc);
>>> -}
>>> -
>> 
>> Removing that function again is fine as long as you retain the
>> distinguished error codes, which ...
>> 
>>>  static inline int
>>>  __get_maptrack_handle(
>>>      struct grant_table *t)
>>> @@ -1304,11 +1280,12 @@ gnttab_setup_table(
>>>          goto out1;
>>>      }
>>>  
>>> -    d = gt_lock_target_domain_by_id(op.dom);
>>> -    if ( IS_ERR(d) )
>>> +    d = rcu_lock_domain_by_any_id(op.dom);
>>> +    if ( d == NULL )
>>>      {
>>> -        op.status = PTR_ERR(d);
>>> -        goto out1;
>>> +        gdprintk(XENLOG_INFO, "Bad domid %d.\n", op.dom);
>>> +        op.status = GNTST_bad_domain;
>> 
>> ... you don't.
> 
> Actually, I do. The only distinguishing error code here is
> GNTST_permission_denied, which is now only triggered by the XSM
> hook.

Ah, okay, that wasn't visible from the patch context (and the
sum of the patches was too large to track all the details
mentally). Sorry for the noise then.

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®.