<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
I got the cause,see the following,<BR>
welcome comments.<BR>
<BR>
static int read_from_vdi_port(void)<BR>
{<BR>
/* There are 2 scenarios where we can get called recursively:<BR>
1) spice-vmc vmc_read triggering flush of throttled data, recalling us<BR>
2) the buf we push to the client may be send immediately without<BR>
blocking, in which case its free function will recall us<BR>
This messes up the state machine, so ignore recursive calls.<BR>
This is why we always must be called in a loop. */<BR>
static int inside_call = 0;<BR>
int quit_loop = 0;<BR>
VDIPortState *state = &reds->agent_state;<BR>
SpiceCharDeviceInterface *sif;<BR>
VDIReadBuf *dispatch_buf;<BR>
int total = 0;<BR>
int n;<BR>
if (inside_call) {<BR>
return 0;<BR>
}<BR>
inside_call = 1;<BR>
<BR>
sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);<BR>
if (!reds->agent_state.connected || reds->mig_target) {<BR>
inside_call = 0;<BR>
<FONT COLOR="#ff0000">//root cause is here,it should call read function to consume the spice_vmc data,if not,"virtio_serial_throttle_port(&svc->port, false);" will not execute,so spice_vmc will block something</FONT><BR>
<FONT COLOR="#ff0000"> //the following 2 lines code is ugly,but it resolved the issue.</FONT><BR>
<FONT COLOR="#ff0000">uint8_t a[2048];</FONT><BR>
<FONT COLOR="#ff0000"> sif->read(vdagent, a, 2048);</FONT><BR>
return 0;<BR>
}<BR>
<BR>
while (!quit_loop && reds->agent_state.connected) {<BR>
switch (state->read_state) {<BR>
case VDI_PORT_READ_STATE_READ_HADER:<BR>
n = sif->read(vdagent, state->recive_pos, state->recive_len);<BR>
if (!n) {<BR>
quit_loop = 1;<BR>
break;<BR>
}<BR>
total += n;<BR>
if ((state->recive_len -= n)) {<BR>
state->recive_pos += n;<BR>
quit_loop = 1;<BR>
break;<BR>
}<BR>
state->message_recive_len = state->vdi_chunk_header.size;<BR>
state->read_state = VDI_PORT_READ_STATE_GET_BUFF;<BR>
case VDI_PORT_READ_STATE_GET_BUFF: {<BR>
RingItem *item;<BR>
<BR>
if (!(item = ring_get_head(&state->read_bufs))) {<BR>
quit_loop = 1;<BR>
break;<BR>
}<BR>
<BR>
ring_remove(item);<BR>
state->current_read_buf = (VDIReadBuf *)item;<BR>
state->recive_pos = state->current_read_buf->data;<BR>
state->recive_len = MIN(state->message_recive_len,<BR>
sizeof(state->current_read_buf->data));<BR>
state->current_read_buf->len = state->recive_len;<BR>
state->message_recive_len -= state->recive_len;<BR>
state->read_state = VDI_PORT_READ_STATE_READ_DATA;<BR>
}<BR>
case VDI_PORT_READ_STATE_READ_DATA:<BR>
n = sif->read(vdagent, state->recive_pos, state->recive_len);<BR>
if (!n) {<BR>
quit_loop = 1;<BR>
break;<BR>
}<BR>
total += n;<BR>
if ((state->recive_len -= n)) {<BR>
state->recive_pos += n;<BR>
break;<BR>
}<BR>
dispatch_buf = state->current_read_buf;<BR>
state->current_read_buf = NULL;<BR>
state->recive_pos = NULL;<BR>
if (state->message_recive_len == 0) {<BR>
state->read_state = VDI_PORT_READ_STATE_READ_HADER;<BR>
state->recive_pos = (uint8_t *)&state->vdi_chunk_header;<BR>
state->recive_len = sizeof(state->vdi_chunk_header);<BR>
} else {<BR>
state->read_state = VDI_PORT_READ_STATE_GET_BUFF;<BR>
}<BR>
dispatch_vdi_port_data(state->vdi_chunk_header.port, dispatch_buf);<BR>
}<BR>
}<BR>
inside_call = 0;<BR>
return total;<BR>
}<BR>
<BR>
On Tue, 2010-11-02 at 16:03 +0800, Alon Levy wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On Tue, Nov 02, 2010 at 12:48:22PM +0800, Coolper Chen wrote:
> If spice client keeps connecting Windows XP(vdservice running on
> it),reboot XP remotely or locally,it's ok.
> when XP hung-up,use spice client connecting to XP,XP will continue
> reboot.
Nice workaround. We need to fix this bug.
>
> On Mon, 2010-11-01 at 17:47 +0800, Coolper Chen wrote:
> > If no vdservice,there's no this issue.
> >
> > On Mon, 2010-11-01 at 17:26 +0800, Arnon Gilboa wrote:
> > > Please uninstall vdservice & vioser driver, try to reproduce it without
> > > them, and update us with the results.
> > > Thanks,
> > > Arnon
> > >
> > > Coolper Chen wrote:
> > > > hi,
> > > > I'm testing spice.I found an issue about vd_agent,when there's no spice
> > > > client connected to the Windows XP guest,I can't remotely reboot Windows
> > > > XP more than 3 times,in the third time,the Windows XP guest will hung up
> > > > in shutting down process,then wait a long time,there's no change(I have
> > > > a monitor in guest,I can know when the guest OS is ready).If I use
> > > > spicec to connect windows xp,I see windows xp shut down and then start.
> > > >
> > > > I compare the normal process of spicec connecting guest with it,I found
> > > > vd_agent sends some messages(VD_AGENT_ANNOUNCE_CAPABILITIES, 3 messages)
> > > > to spice client when Windows XP restart 3 times.
> > > >
> > > > What causes Windows XP not reboot?
> > > >
> > > > I'm using spice 0.6.3 and Windows XP.
> > > >
> > > > Coolper
> > > >
> > > > _______________________________________________
> > > > Spice-devel mailing list
> > > > <A HREF="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</A>
> > > > <A HREF="http://lists.freedesktop.org/mailman/listinfo/spice-devel">http://lists.freedesktop.org/mailman/listinfo/spice-devel</A>
> > > >
> > >
> >
> >
> > _______________________________________________
> > Spice-devel mailing list
> > <A HREF="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</A>
> > <A HREF="http://lists.freedesktop.org/mailman/listinfo/spice-devel">http://lists.freedesktop.org/mailman/listinfo/spice-devel</A>
>
>
> _______________________________________________
> Spice-devel mailing list
> <A HREF="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</A>
> <A HREF="http://lists.freedesktop.org/mailman/listinfo/spice-devel">http://lists.freedesktop.org/mailman/listinfo/spice-devel</A>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>