Carlo Maiero
2010-Sep-22 14:37 UTC
[Xen-devel] Error on creation of Event channel (17= file_exists)
I''m creating an event channel between hypervisor and xen. Starting from trace.c xentrace.c I''ve put this line in the xen.h #define VIRQ_XENINI 11 I''ve put in the hypervisor this code: /*notify DOM0 event of xenini*/ static void xenini_notify_dom0(unsigned long unused){ send_guest_global_virq(dom0, VIRQ_XENINI); } static DECLARE_TASKLET(xenini_notify_dom0_tasklet, xenini_notify_dom0, 0); so if i have to notify to dom0 an event, i just need to call: tasklet_schedule(&xenini_notify_dom0_tasklet); true?? (it seems to work) In a process running on dom0 i''m running this code: static void event_init(void) { int rc; rc = xc_evtchn_open(); if (rc < 0) { perror(xc_get_last_error()->message); exit(EXIT_FAILURE); } event_fd = xc_evtchn_fd(rc); rc = xc_evtchn_bind_virq(event_fd, VIRQ_XENINI); if (rc == -1) { PERROR("failed to bind to VIRQ_XENINI port"); exit(EXIT_FAILURE); } virq_port = rc; } and i create a successful way to create the channel. but when i shut down the process in dom0. when i try to restart it. It says: ERROR: failed to bind to VIRQ_XENINI port (17= file_exists). what i have to add when i close the program? _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Sep-22 15:03 UTC
Re: [Xen-devel] Error on creation of Event channel (17= file_exists)
On 22/09/2010 15:37, "Carlo Maiero" <zesster@gmail.com> wrote:> and i create a successful way to create the channel. > but when i shut down the process in dom0. when i try to restart it. > It says: ERROR: failed to bind to VIRQ_XENINI port (17= file_exists). > > what i have to add when i close the program?If your original process really is dead and had no children, then the kernel''s evtchn device driver should have unbound the event channel when the file handle on the driver was released. So restart should then work okay. If it''s not working then it''s potentially a kernel driver bug. What dom0 kernel are you using? -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Carlo Maiero
2010-Sep-22 15:23 UTC
Re: [Xen-devel] Error on creation of Event channel (17= file_exists)
2010/9/22 Keir Fraser <keir.fraser@eu.citrix.com>> On 22/09/2010 15:37, "Carlo Maiero" <zesster@gmail.com> wrote: > > > and i create a successful way to create the channel. > > but when i shut down the process in dom0. when i try to restart it. > > It says: ERROR: failed to bind to VIRQ_XENINI port (17= file_exists). > > > > what i have to add when i close the program? > > If your original process really is dead and had no children, then the > kernel''s evtchn device driver should have unbound the event channel when > the > file handle on the driver was released. So restart should then work okay. > If > it''s not working then it''s potentially a kernel driver bug. What dom0 > kernel > are you using? > > -- Keir > > Restart works fine, i''m using debian 2.6.26-xen-686. So i''m not closingproperly the program? _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Sep-22 15:30 UTC
Re: [Xen-devel] Error on creation of Event channel (17= file_exists)
On 22/09/2010 16:23, "Carlo Maiero" <zesster@gmail.com> wrote:> 2010/9/22 Keir Fraser <keir.fraser@eu.citrix.com> >> On 22/09/2010 15:37, "Carlo Maiero" <zesster@gmail.com> wrote: >> >>> and i create a successful way to create the channel. >>> but when i shut down the process in dom0. when i try to restart it. >>> It says: ERROR: failed to bind to VIRQ_XENINI port (17= file_exists). >>> >>> what i have to add when i close the program? >> >> If your original process really is dead and had no children, then the >> kernel''s evtchn device driver should have unbound the event channel when the >> file handle on the driver was released. So restart should then work okay. If >> it''s not working then it''s potentially a kernel driver bug. What dom0 kernel >> are you using? >> >> -- Keir >> > Restart works fine, i''m using debian 2.6.26-xen-686. So i''m not closing > properly the program?Looking at kernel linux-2.6.18-xen (others will have something similar) the driver is implemented in drivers/xen/evtchn/evtchn.c and the function evtchn_release() deals with closing of a file handle. You can see it iterates over all event channels and unbinds all of those which were associated with the handle being released. So, either your process is not closing properly, or that shutdown logic in the kernel driver is not doing its job properly in the particular kernel that you are using. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel