Mailing List Archive

[PATCH 07/18] mini-os: avoid crash if no console is provided
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
extras/mini-os/console/xencons_ring.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/extras/mini-os/console/xencons_ring.c b/extras/mini-os/console/xencons_ring.c
index 22fd618..14a8bd1 100644
--- a/extras/mini-os/console/xencons_ring.c
+++ b/extras/mini-os/console/xencons_ring.c
@@ -25,7 +25,10 @@ static inline void notify_daemon(struct consfront_dev *dev)

static inline struct xencons_interface *xencons_interface(void)
{
- return mfn_to_virt(start_info.console.domU.mfn);
+ if (start_info.console.domU.evtchn)
+ return mfn_to_virt(start_info.console.domU.mfn);
+ else
+ return NULL;
}

int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
@@ -38,6 +41,8 @@ int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, uns
intf = xencons_interface();
else
intf = dev->ring;
+ if (!intf)
+ return sent;

cons = intf->out_cons;
prod = intf->out_prod;
--
1.7.7.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 07/18] mini-os: avoid crash if no console is provided [ In reply to ]
On Wed, 2012-01-11 at 17:21 +0000, Daniel De Graaf wrote:

When/why does this happen?

I guess it is because when starting the xenstore domain you cannot use
xenstore to communicate with xenconsoled (and/or it isn't even running
yet).

I wonder if there is a way we can do lazy-setup of the console for just
the xenstore domain?

Alternatively I seem to recall a little tool which Diego wrote to pull
the console ring out of a domain directly as a debuging aid but that
relies on us setting up a console ring and evtchn even if xenconsoled
cannot be involved which makes this patch unnecessary.

Ian.

> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> ---
> extras/mini-os/console/xencons_ring.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/extras/mini-os/console/xencons_ring.c b/extras/mini-os/console/xencons_ring.c
> index 22fd618..14a8bd1 100644
> --- a/extras/mini-os/console/xencons_ring.c
> +++ b/extras/mini-os/console/xencons_ring.c
> @@ -25,7 +25,10 @@ static inline void notify_daemon(struct consfront_dev *dev)
>
> static inline struct xencons_interface *xencons_interface(void)
> {
> - return mfn_to_virt(start_info.console.domU.mfn);
> + if (start_info.console.domU.evtchn)
> + return mfn_to_virt(start_info.console.domU.mfn);
> + else
> + return NULL;
> }
>
> int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
> @@ -38,6 +41,8 @@ int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, uns
> intf = xencons_interface();
> else
> intf = dev->ring;
> + if (!intf)
> + return sent;
>
> cons = intf->out_cons;
> prod = intf->out_prod;



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 07/18] mini-os: avoid crash if no console is provided [ In reply to ]
On 01/12/2012 05:03 AM, Ian Campbell wrote:
> On Wed, 2012-01-11 at 17:21 +0000, Daniel De Graaf wrote:
>
> When/why does this happen?

Initially, when I use a custom domain builder to create the xenstored
domain without a xenconsoled running yet (as xenconsoled needs xenstore).

> I guess it is because when starting the xenstore domain you cannot use
> xenstore to communicate with xenconsoled (and/or it isn't even running
> yet).
>
> I wonder if there is a way we can do lazy-setup of the console for just
> the xenstore domain?

Xenstored will produce output on the hypervisor console if Xen is compiled
with debugging. If xenstored produces a lot of output, it can block on
waiting for xenconsoled, which might be blocking on xenstored - so I don't
think we want to hook it up to the console in the normal case, or at least
not the same xenconsoled that talks to domUs.

> Alternatively I seem to recall a little tool which Diego wrote to pull
> the console ring out of a domain directly as a debuging aid but that
> relies on us setting up a console ring and evtchn even if xenconsoled
> cannot be involved which makes this patch unnecessary.
>
> Ian.

This runs into the same blocking problem if xenstored produces too much
output.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
[PATCH 07/18] mini-os: avoid crash if no console is provided [ In reply to ]
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
extras/mini-os/console/xencons_ring.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/extras/mini-os/console/xencons_ring.c b/extras/mini-os/console/xencons_ring.c
index 22fd618..14a8bd1 100644
--- a/extras/mini-os/console/xencons_ring.c
+++ b/extras/mini-os/console/xencons_ring.c
@@ -25,7 +25,10 @@ static inline void notify_daemon(struct consfront_dev *dev)

static inline struct xencons_interface *xencons_interface(void)
{
- return mfn_to_virt(start_info.console.domU.mfn);
+ if (start_info.console.domU.evtchn)
+ return mfn_to_virt(start_info.console.domU.mfn);
+ else
+ return NULL;
}

int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
@@ -38,6 +41,8 @@ int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, uns
intf = xencons_interface();
else
intf = dev->ring;
+ if (!intf)
+ return sent;

cons = intf->out_cons;
prod = intf->out_prod;
--
1.7.7.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 07/18] mini-os: avoid crash if no console is provided [ In reply to ]
On Thu, 2012-01-12 at 17:56 +0000, Daniel De Graaf wrote:
> On 01/12/2012 05:03 AM, Ian Campbell wrote:
> > On Wed, 2012-01-11 at 17:21 +0000, Daniel De Graaf wrote:
> >
> > When/why does this happen?
>
> Initially, when I use a custom domain builder to create the xenstored
> domain without a xenconsoled running yet (as xenconsoled needs xenstore).

Right, that makes sense.

> > I guess it is because when starting the xenstore domain you cannot use
> > xenstore to communicate with xenconsoled (and/or it isn't even running
> > yet).
> >
> > I wonder if there is a way we can do lazy-setup of the console for just
> > the xenstore domain?
>
> Xenstored will produce output on the hypervisor console if Xen is compiled
> with debugging. If xenstored produces a lot of output, it can block on
> waiting for xenconsoled, which might be blocking on xenstored - so I don't
> think we want to hook it up to the console in the normal case, or at least
> not the same xenconsoled that talks to domUs.

Hrm, yes.

> > Alternatively I seem to recall a little tool which Diego wrote to pull
> > the console ring out of a domain directly as a debuging aid but that
> > relies on us setting up a console ring and evtchn even if xenconsoled
> > cannot be involved which makes this patch unnecessary.

> This runs into the same blocking problem if xenstored produces too much
> output.

What about if the tools/xenstore/init-xenstore-domain tool you posted in
your v2 provides console_mfn and console_evtch to the stubdom (via the
shared info) and after it has started the domain it would daemonize and
sit there pumping stuff out of the stubdom console ring and
into /var/log or syslog or something. There should be no interaction
with xenstore there, should there?

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 07/18] mini-os: avoid crash if no console is provided [ In reply to ]
On Thu, 2012-01-12 at 23:35 +0000, Daniel De Graaf wrote:
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> ---
> extras/mini-os/console/xencons_ring.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/extras/mini-os/console/xencons_ring.c b/extras/mini-os/console/xencons_ring.c
> index 22fd618..14a8bd1 100644
> --- a/extras/mini-os/console/xencons_ring.c
> +++ b/extras/mini-os/console/xencons_ring.c
> @@ -25,7 +25,10 @@ static inline void notify_daemon(struct consfront_dev *dev)
>
> static inline struct xencons_interface *xencons_interface(void)
> {
> - return mfn_to_virt(start_info.console.domU.mfn);
> + if (start_info.console.domU.evtchn)
> + return mfn_to_virt(start_info.console.domU.mfn);
> + else
> + return NULL;
> }
>
> int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
> @@ -38,6 +41,8 @@ int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, uns
> intf = xencons_interface();
> else
> intf = dev->ring;
> + if (!intf)
> + return sent;

Indentation. Otherwise

Acked-by: Ian Campbell <ian.campbell@citrix.com>

Although I would still prefer if we could figure out some scheme to get
logs out of this domain...

Ian.



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel