Skip to contentSkip to conversation

why xenstore-* hangs if xenstored is not started

DISCUSSION Yu Zhiguo 3 participants 10 messages Jun 22, 2010

lore
Share & tools
lore

Yu Zhiguo

author
#0 lore raw

Running xenstore-* when xenstored is not started, it will hang and
cannot accept any signal, e.g. SIGINT.
I seems that the process is blocked at accessing '/proc/xen/xenbus'.

 # mount -t xenfs xenfs /proc/xen/
 # xenstore-ls

call trace:
do_ls() -> xs_directory() -> xs_talkv() -> xs_write_all() -> write()

BLOCK is no problem but why process cannot accept signal, Any opinion?

If start xenstored in other console, xenstore-ls executes and then
receive the signal, seems the signal is pended...

Signature · 2 lines
Regards
Yu Zhiguo
#1 lore raw
Quoted 7 lines · Yu Zhiguo

Running xenstore-* when xenstored is not started, it will hang and
cannot accept any signal, e.g. SIGINT.
I seems that the process is blocked at accessing '/proc/xen/xenbus'.

  # mount -t xenfs xenfs /proc/xen/
  # xenstore-ls
Quoted 9 lines

call trace:
do_ls() -> xs_directory() -> xs_talkv() -> xs_write_all() -> write()

BLOCK is no problem but why process cannot accept signal, Any opinion?

If start xenstored in other console, xenstore-ls executes and then
receive the signal, seems the signal is pended...

That's the common behavior of task stuck in a kernel operation (ps aux will show the task at D, and /proc/<pid>/wchan will tell you exactly where it's blocked in the kernel).

the write is going to wait for a xenstored reply in kernel mode since by default the xenstore-* tools use the kernel xenstore page to communicate with xenstored.

The unix socket operations doesn't have this "problems" (xenstore-* -s)

Signature · 1 line
Vincent
author
#2 lore raw

Hi,

Quoted 10 lines · Vincent Hanquez

That's the common behavior of task stuck in a kernel operation (ps aux will show the task at D, and /proc/<pid>/wchan will tell you exactly where it's blocked in the kernel).

the write is going to wait for a xenstored reply in kernel mode since by default the xenstore-* tools use the kernel xenstore page to communicate with xenstored.

The unix socket operations doesn't have this "problems" (xenstore-* -s)

Thanks~~
I confirmed the task is at D+ and there are no this "problem" if use option -s. But I think S+ is better than D+...

Yu

#3 lore raw
Quoted 12 lines · Yu Zhiguo

Hi,

Quoted 8 lines · Vincent Hanquez

That's the common behavior of task stuck in a kernel operation (ps aux will show the task at D, and /proc/<pid>/wchan will tell you exactly where it's blocked in the kernel).

the write is going to wait for a xenstored reply in kernel mode since by default the xenstore-* tools use the kernel xenstore page to communicate with xenstored.

Quoted 6 lines
Quoted 2 lines

The unix socket operations doesn't have this "problems" (xenstore-* -s)

Thanks~~
I confirmed the task is at D+ and there are no this "problem" if use option -s. But I think S+ is better than D+...

I don't think it's very easy to have interruptible sleep here, it would change radically the protocol. the kernel xenstored page need to be handled "atomically" since requests and their replied cannot be intertwined. Maybe a timeout would be the one requiring the less change ?

Signature · 1 line
Vincent
author
#4 lore raw

Hi Vincent,

Quoted 11 lines · Vincent Hanquez
Quoted 5 lines

Thanks~~
I confirmed the task is at D+ and there are no this "problem" if use option -s.
But I think S+ is better than D+...

I don't think it's very easy to have interruptible sleep here, it would change radically the protocol. the kernel xenstored page need to be handled "atomically" since requests and their replied cannot be intertwined. Maybe a timeout would be the one requiring the less change ?

I'm not familiar with those code and not sure how can fix it,
but I think a timeout is better than doing nothing.

Signature · 2 lines
Regards
Yu Zhiguo
#5 lore raw
In reply to Yu Zhiguo
Quoted 11 lines · Yu Zhiguo

Running xenstore-* when xenstored is not started, it will hang and
cannot accept any signal, e.g. SIGINT.
I seems that the process is blocked at accessing '/proc/xen/xenbus'.

 # mount -t xenfs xenfs /proc/xen/
 # xenstore-ls

call trace:
do_ls() -> xs_directory() -> xs_talkv() -> xs_write_all() -> write()

BLOCK is no problem but why process cannot accept signal, Any opinion?

Does the xenstore driver in the dom0 kernel put the process into uninterruptible sleep? The 2.6.18 kernel simply returns -ENODEV in this case I think. So perhaps pv_ops has different and inferior behaviour. At least using interruptible sleep would be preferable.

-- Keir

Quoted 2 lines

If start xenstored in other console, xenstore-ls executes and then
receive the signal, seems the signal is pended...

#6 lore raw
Quoted 3 lines · Keir Fraser

Does the xenstore driver in the dom0 kernel put the process into uninterruptible sleep? The 2.6.18 kernel simply returns -ENODEV in this case I think. So perhaps pv_ops has different and inferior behaviour.

the behavior was the same in 2.6.18.

Signature · 1 line
Vincent
#7 lore raw
Quoted 6 lines · Vincent Hanquez
Quoted 3 lines · Keir Fraser

Does the xenstore driver in the dom0 kernel put the process into uninterruptible sleep? The 2.6.18 kernel simply returns -ENODEV in this case I think. So perhaps pv_ops has different and inferior behaviour.

the behavior was the same in 2.6.18.

Ah, I just see 'if (!is_xenstored_ready()) return -ENODEV' in 2.6.18's xenbus_dev.c. I assumed that would have an effect on this case.

-- Keir

#8 lore raw
Quoted 4 lines · Keir Fraser
Quoted 1 line · Vincent Hanquez

On 22/06/10 08:45, Keir Fraser wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Does the xenstore driver in the dom0 kernel put the process into uninterruptible sleep? The 2.6.18 kernel simply returns -ENODEV in this case I think. So perhaps pv_ops has different and inferior behaviour.

the behavior was the same in 2.6.18.

Ah, I just see 'if (!is_xenstored_ready()) return -ENODEV' in 2.6.18's xenbus_dev.c. I assumed that would have an effect on this case.

hm, maybe it does afterall, and I'm confuse this with a more general case; the D state would happens if xenstored doesn't want to reply or is dead. This behavior has been there as long as I can remember.

I'm pretty sure though that a while ago (relatively old XenServer kernel) starting a xenstore-* without starting xenstored would make it stuck until xenstored start.

Signature · 1 line
Vincent
author
#9 lore raw
In reply to Keir Fraser

Hi Keir,

Quoted 8 lines · Keir Fraser
Quoted 2 lines

BLOCK is no problem but why process cannot accept signal, Any opinion?

Does the xenstore driver in the dom0 kernel put the process into uninterruptible sleep? The 2.6.18 kernel simply returns -ENODEV in this case I think. So perhaps pv_ops has different and inferior behaviour. At least using interruptible sleep would be preferable.

Yes, the process is uninterruptible.
I agree with you, interruptible sleep is user-friendliness.

Yu