[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [BUG]: when using `xl restore`,xc_evtchn_alloc_unbound will raise this error
On Fri, Jan 4, 2013 at 11:23 AM, 马磊 <aware.why@xxxxxxxxx> wrote:
On Mon, Dec 31, 2012 at 8:03 PM, Wei Liu <Wei.Liu2@xxxxxxxxxx> wrote:
On Mon, 2012-12-31 at 03:10 +0000, 马磊 wrote:
>
>
>
> I think the two files are mostly the same, but to be sure you
> need to
> look into the source file in both Linux and Xen. You should
> start from
> the hypervisor level, find out why it returns -EPERM. Root
> user in Dom0
> has nothing to do with privilege in hypervisor level.
>
>
> Wei.
>
> The scene is that there are more than 10 processes, each process calls
> `xl restore` to start a VM where a virus sample will run to detect the
> sample's behaviour about every 120 seconds.
> For a long time, such as 5 days or 15 days, the xen server where the
> processes run will raise this error with a certain probability.
> Maybe it has something to do with the hypervisor's stability.
This is not a usual scenario. Sorry I don't know how to reproduce this.
But the code path in hypervisor for evtchn_alloc_unbound is quite short,
you may try adding some debug output along the path to see which step
fails then report back.
Wei.
BTW, it's needed to tell you my environment background; I installed centos6.2 and then installed xen rpms from
http://xenbits.xen.org/people/mayoung/EL6.xen/.
At present, I'm not sure what function used to add the debug statement (is it printk?) and where to look for the debug log info (is it /var/log/message?) .
The returned errno is from src/xen/common/event_channel.c 874-long do_event_channel_op(int cmd, XEN_GUEST_HANDLE(void) arg)
880 case EVTCHNOP_alloc_unbound: {
881 struct evtchn_alloc_unbound alloc_unbound;
882 if ( copy_from_guest(&alloc_unbound, arg, 1) != 0 )
884 rc = evtchn_alloc_unbound(&alloc_unbound); // only here returns -1(EPERM) , others return -EFAULT
885 if ( (rc == 0) && (copy_to_guest(arg, &alloc_unbound, 1) != 0) )
886 rc = -EFAULT; /* Cleaning up here would be a mess! */
Two statements below may affect the rc. 124-static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
129 domid_t dom = alloc->dom;
132 rc = rcu_lock_target_domain_by_id(dom, &d);
136 spin_lock(&d->event_lock);
138 if ( (port = get_free_port(d)) < 0 )
139 ERROR_EXIT_DOM(port, d);
140 chn = evtchn_from_port(d, port);
142 rc = xsm_evtchn_unbound(d, chn, alloc->remote_dom);
146 chn->state = ECS_UNBOUND;
147 if ( (chn->u.unbound.remote_domid = alloc->remote_dom) == DOMID_SELF )
148 chn->u.unbound.remote_domid = current->domain->domain_id; 153 spin_unlock(&d->event_lock);
154 rcu_unlock_domain(d);
I looked into it again and found that it was caused probably by src/xen/common/domain.c:
421-int rcu_lock_target_domain_by_id(domid_t dom, struct domain **d)
423 if ( dom == DOMID_SELF )
425 *d = rcu_lock_current_domain();
429 if ( (*d = rcu_lock_domain_by_id(dom)) == NULL )
432 if ( !IS_PRIV_FOR(current->domain, *d) )
434 rcu_unlock_domain(*d);
the macro `IS_PRIV_FOR` is defined here src/xen/include/xen/sched.h:
638#define IS_PRIV_FOR(_d, _t) (IS_PRIV(_d) || ((_d)->target && (_d)->target == (_t)))
I couldn't understand that what
IS_PRIV_FOR means?!
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|