Re: [Xen-devel] [PATCH] xen/apic: implement io apic read withhypercall

From: Lin Ming
Date: Fri Apr 20 2012 - 11:40:40 EST


On Fri, 2012-04-20 at 16:06 +0100, Ian Campbell wrote:
> On Fri, 2012-04-20 at 15:50 +0100, Lin Ming wrote:
> > On Fri, Apr 20, 2012 at 9:12 PM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> > > On Fri, 2012-04-20 at 13:53 +0100, Andrew Cooper wrote:
> > >> >
> > >> > Under what circumstances can these hypercalls fail? Would a BUG_ON be
> > >> > appropriate/
> > >>
> > >> -EFAULT, -EPERM, anything xsm_apic() could return (which looks only to
> > >> be -EPERM).
> > >
> > > So either the guest has called a hypercall which it is not permitted to
> > > or it has called it with invalid parameters of one sort or another. Both
> > > of these would be a code bug in the guest and therefore asserting that
> > > no failure occurred is reasonable?
> > >
> > > What could the caller do with the error other than log it and collapse?
> > >
> > >> The call into Xen itself will return 0 as a value if an
> > >> invalid physbase is passed in the hypercall.

Just checked ioapic_guest_read.
It will return -EINVAL if an invalid physbase is passed in.

> > >
> > >> So a BUG_ON() is not safe/sensible for domU.
> > >
> > > I think you have successfully argued that it is ;-)
> >
> > BUG_ON is too severe.
>
> Why? Under what circumstances can this be correctly called in a way
> which would result in the hypercall failing?

Is BUG_ON() reasonable if invalid physbase passed in?

>
> > How about WARN_ON?
> >
> > ret = hypercall(...)
> >
> > if (ret) {
> > WARN_ON(1);
> > return -1;
> > }
> >
> >
> > >
> > > Ian.
>
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/