Commit Graph

25 Commits

Author SHA1 Message Date
Marek Marczykowski
efbd9466f8 vchan/vm: implement libvchan_cleanup to release resources used by vchan link
In most cases after vchan close program terminates (or reexec itself to wait
for next connection), so cleanup isn't needed (not sure how about evtchn and
shared pages...).
But in case of stubdom it is needed to cleanup before waiting for new
connection - we can't reexec agent there.
2012-12-12 02:39:34 +01:00
Marek Marczykowski
eea3aa3b72 vchan: fix multiple server instances from single process
Use new u2mfn_fd for each ring_init call - each open fd to u2mfn is capable to
do only one u2mfn_alloc_kpage, so it can't be reused at the next ring_init.
2012-11-03 05:22:02 +01:00
Marek Marczykowski
6b23655fb7 vchan: specify data param of libvchan_write as const
It isn't (and shouldn't) modified by the function so mark it in declaration.
This will also help catching some errors.
2012-11-03 05:22:01 +01:00
Marek Marczykowski
cb5479666c win/vchan: reset the evtchn buffer in case of overflow
In case of evtchn buffer overflow (received more than 1024 events between
libvchan_wait calls) further reads returns ERROR_IO_DEVICE. The only way to
recover from that is to reset the buffer. Because vchan code doesn't take care
of number of fired events - only the fact that some event was fired - lost
events here shouldn't break anything. Events reported _after_ libvchan_wait
call will be collected and reported correctly.

Some more comments in the code (here and in qrexec-agent in the next commit).
2012-09-16 23:32:56 +02:00
Marek Marczykowski
ab52153ab2 win/vchan: remove outstanding evtchn events on libvchan_wait
Windows evtchn driver can double fire on one event (details in
xenpci/evtchn_device_interface.c:EvtChn_EvtIoWrite). Less intrusive way of
fixing it is just remove all events from queue on libvchan_wait (to prevent
queue fill).
This won't hurt because we are interested in events only sent
after xc_evtchn_unmask call which is one line below.
2012-08-23 21:39:41 +02:00
Marek Marczykowski
4fcaf3e7b7 Revert "win: unmask evtchn before checking if libvchan_wait is needed"
This reverts commit f7ce10db8f76f752cf9d65b420de352e70bdb048.
This should be fixed by doing 0-length reads in qrexec main loop (instead of
real read of fired port number).
2012-08-23 01:58:44 +02:00
Marek Marczykowski
ec47c5eb81 win: unmask evtchn before checking if libvchan_wait is needed
This should prevent the race, when evtchn is signalled between condition check
and libvchan_wait call.
2012-08-03 02:02:26 +02:00
Marek Marczykowski
01c9fdfe59 vchan: fix ASYNC_INIT macro 2012-06-04 14:59:11 +02:00
Marek Marczykowski
22207ddf75 vchan: introduce features macros
Use features macros (QREXEC_RING_V2 and ASYNC_INIT) instead of directly
depending on building environment. The macros are turned on (when required) in
libvchan.h based on target system.
2012-06-03 17:23:07 +02:00
Marek Marczykowski
f01b1b40ac vchan: fix xc_gnttab_open call 2012-06-03 17:23:07 +02:00
Marek Marczykowski
edf1ecfcfd vchan: remove unused variables 2012-06-03 17:23:07 +02:00
Marek Marczykowski
a2a21c0467 vchan: unify calls to xc_evtchn_close
Calls to this function can be the same on all systems and xen versions, so
simplify code.
2012-06-03 17:23:06 +02:00
Marek Marczykowski
87115716ba vchan/stubdom: remove temp hack (unneded now)
This was needed when stubdom have no write access to device/vchan.
2012-06-03 17:22:59 +02:00
Marek Marczykowski
1462e36454 win: convert vchan/sources to windows EOL-style 2012-06-02 12:34:35 +02:00
Marek Marczykowski
dd60d3da95 makefile: rename vchan Makefile to not conflict with windows build 2012-06-02 12:32:49 +02:00
Alexander Tereshkin
db324b270e libvchan_server_init() now does not wait for a client to connect. A server should wait for an incoming event and then call libvchan_server_handle_connected(). 2012-05-29 17:07:17 +04:00
Alexander Tereshkin
e31128341b Windows-related code moved to core/win directory. 2012-05-12 20:19:56 +04:00
Alexander Tereshkin
7ea3f4a792 vchan modifications for the Windows build. 2012-05-12 19:27:09 +04:00
Alexander Tereshkin
0f13ea2a84 Fixed a potential memory leak. 2012-05-12 18:32:36 +04:00
Alexander Tereshkin
85f926efaa Removed unnecessary access to /proc/u2mfn. 2012-05-12 18:22:16 +04:00
Marek Marczykowski
fda02f66b2 vchan: fix compile error 2012-02-27 14:58:46 +01:00
Marek Marczykowski
0c811322c5 dom0: vchan version for stubdom 2012-02-22 17:54:58 +01:00
Marek Marczykowski
3f310e5f3e Adopt vchan to xen-libs-4.1.0 API.
Add #ifdefs to support new and old API
2011-04-19 01:21:48 +02:00
Marek Marczykowski
14e50e983d gitignores 2011-03-23 19:57:48 -04:00
Rafal Wojtczuk
f263aa6b7c Moved vchan and u2mfn code to core. 2011-03-08 12:24:47 +01:00