xen-devel, I''m working on a project in which I''d like to implement an upcall into dom0 from certain points within Xen, where Xen is running in the context of one of the unprivileged domains. The upcall will pass a variable-sized data structure (up to a few hundred bytes) to dom0, and I need Xen to block on the completion of this upcall. Also, it''s important that the source of the upcall start from within Xen itself, rather than the domU guest. For example, on each hypercall from a particular domU, I''d want to collect a bunch of state from within Xen and pass that state to dom0, then wait for a return value before continuing on with the hypercall. I''m looking for suggestions on the best way to go about this. I''ve just started looking at the event channel code and I''m wondering how I can best use this. My first thought is to create a virtual interrupt, but I''m not sure whether this will synchronously deliver the VIRQ and wait for dom0 to complete before proceeding. Another issue is how best to pass the data, though it appears a shared page between Xen and dom0 is the preferred approach. Any information or pointers to files/functions would be a great help. Thanks, Andrew ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
On 28 Feb 2005, at 23:04, Andrew Biggadike wrote:> I''m working on a project in which I''d like to implement an upcall into > dom0 from certain points within Xen, where Xen is running in the > context > of one of the unprivileged domains. The upcall will pass a > variable-sized data structure (up to a few hundred bytes) to dom0, and > I need Xen to block on the completion of this upcall. Also, it''s > important that the source of the upcall start from within Xen itself, > rather than the domU guest.In what context do you want to block? That of some other domain, or block all domains while dom0 executes, or something else? Xen doesn''t support arbitrary blocking within itself since it only maintains per-CPU stacks, not per-domain stacks. So you have to create a closure manually. -- Keir ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> For example, on each hypercall from a particular domU, I''d want to > collect a bunch of state from within Xen and pass that state to dom0, > then wait for a return value before continuing on with the > hypercall.Take a look at what happens with VT-x domains when they do a ''memory load'' from emulated MMIO space. You''ll have to think about what you want to happen with SMP guests -- block the VCPU or the whole guest. Ian ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:> In what context do you want to block? That of some other domain, or > block all domains while dom0 executes, or something else?I want to block in the context of the unprivileged domain that was running, and only block that domain. In the hypercall example I gave, I''d want the domain that invoked the hypercall to block within Xen until dom0 completed the upcall.> Xen doesn''t support arbitrary blocking within itself since it only > maintains per-CPU stacks, not per-domain stacks.Interesting. So this means the scheduler is only ever invoked on entry to and exit from Xen when there is no Xen state to worry about saving?> So you have to create a closure manually.This is a bit more work than I had bargained for, but it seems doable. Does temporarily setting a different schedule_tail() function to restore the state from the closure seem reasonable? Andrew ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
On 1 Mar 2005, at 20:53, Andrew Biggadike wrote:>> Xen doesn''t support arbitrary blocking within itself since it only >> maintains per-CPU stacks, not per-domain stacks. > > Interesting. So this means the scheduler is only ever invoked on > entry to and exit from Xen when there is no Xen state to worry about > saving?Or at other times when we really know what we are doing (e.g., interrupting long-lived hypercalls).>> So you have to create a closure manually. > > This is a bit more work than I had bargained for, but it seems doable. > Does temporarily setting a different schedule_tail() function to > restore the state from the closure seem reasonable?I think that would be an excellent place to hook in. -- Keir ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote: > > In what context do you want to block? That of some other domain, or > > block all domains while dom0 executes, or something else? > > I want to block in the context of the unprivileged domain that was > running, and only block that domain. In the hypercall example I gave, > I''d want the domain that invoked the hypercall to block within Xen until > dom0 completed the upcall.Why not just use an event channel? This is precisely what they are for. That way the invoking domain can simply kick an event, and block waiting for a response. No new magic required in Xen at all. S. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk> wrote:> Take a look at what happens with VT-x domains when they do a ''memory > load'' from emulated MMIO space.Just checking, are send_mmio_req() in vmx_platform.c and other places where the ARCH_VMX_IO_WAIT bit is touched the right places to be looking? Are these code paths blocking and returning to the same point within Xen? Most of the calls to do_block(), or the functions that invoke it, seem to be the end of the path and not continuing on within Xen. Thanks, Andrew ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
Steven Hand <Steven.Hand@cl.cam.ac.uk> wrote:> > Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote: > > > In what context do you want to block? That of some other domain, or > > > block all domains while dom0 executes, or something else? > > > > I want to block in the context of the unprivileged domain that was > > running, and only block that domain. In the hypercall example I gave, > > I''d want the domain that invoked the hypercall to block within Xen until > > dom0 completed the upcall. > > Why not just use an event channel? This is precisely what they > are for. That way the invoking domain can simply kick an event, > and block waiting for a response. No new magic required in Xen > at all.That''s what I was originally thinking, but from Keir''s first reply it seems that I can''t arbitrarily block within Xen since stacks are per-CPU rather than per-domain. I''d like to block within Xen and resume at that same point in Xen, not in the guest. If I understand the flow of things correctly, then using an event channel and blocking will resume the domain from the guest''s last execution context, rather than Xen''s. Please correct me if I''m wrong. Thanks, Andrew ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
On 2 Mar 2005, at 04:12, Andrew Biggadike wrote:> That''s what I was originally thinking, but from Keir''s first reply it > seems that I can''t arbitrarily block within Xen since stacks are > per-CPU > rather than per-domain. > > I''d like to block within Xen and resume at that same point in Xen, not > in the guest. If I understand the flow of things correctly, then using > an event channel and blocking will resume the domain from the guest''s > last execution context, rather than Xen''s. Please correct me if I''m > wrong.Yes that''s right. So you want to block on communications that the guest is unaware of? -- Keir ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:> >That''s what I was originally thinking, but from Keir''s first reply it > >seems that I can''t arbitrarily block within Xen since stacks are > >per-CPU rather than per-domain. > > > >I''d like to block within Xen and resume at that same point in Xen, not > >in the guest. If I understand the flow of things correctly, then using > >an event channel and blocking will resume the domain from the guest''s > >last execution context, rather than Xen''s. Please correct me if I''m > >wrong. > > Yes that''s right. So you want to block on communications that the guest > is unaware of?Yes, exactly. I''m looking at ways to do intrusion detection on the guest kernel, so I want to decide whether the guest should continue without it being involved in the decision or information flow. Andrew ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
On 2 Mar 2005, at 04:05, Andrew Biggadike wrote:> Just checking, are send_mmio_req() in vmx_platform.c and other places > where the ARCH_VMX_IO_WAIT bit is touched the right places to be > looking? > > Are these code paths blocking and returning to the same point within > Xen? Most of the calls to do_block(), or the functions that invoke it, > seem to be the end of the path and not continuing on within Xen.Yes, just roll your own code. It sounds like you are on teh right track anyway (e.g., hooking off schedule_tail()). -- Keir ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel