Skip to contentSkip to conversation

passing hypercall parameters by pointer

DISCUSSION Tian, Kevin 4 participants 4 messages Aug 18, 2005 – Aug 19, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines

From: Hollis Blanchard
Sent: Thursday, August 18, 2005 6:05 AM

       case DOM0_GETMEMLIST:
           op->u.getmemlist.buffer =

virt_to_phys(op->u.getmemlist.buffer);

Quoted 1 line
           break;

If following Ian's suggestion, you have to create a list of pfn here instead of only converting start address. There's no guaranty that the buffer is limited in one page. ;-)

Thanks,
Kevin

Quoted 10 lines
       case DOM0_SETDOMAININFO:
           ...
       case DOM0_READCONSOLE:
           ...
       }
   }
   break;
   }

Right now the kernel doesn't peer inside the hypercall structures at

all.

Quoted 9 lines

--
Hollis Blanchard
IBM Linux Technology Center

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 10 lines · Kevin
Quoted 6 lines

From: Hollis Blanchard
Sent: Thursday, August 18, 2005 6:05 AM

       case DOM0_GETMEMLIST:
           op->u.getmemlist.buffer = 
virt_to_phys(op->u.getmemlist.buffer);
           break;

If following Ian's suggestion, you have to create a list of pfn here instead of only converting start address. There's no guaranty that the buffer is limited in one page. ;-)

Actually that was an explicitly stated limitation.

But I think I like this scatterlist idea. So for every pointer (buffer in the above example), instead the pseudo-physical address to a scatterlist will be passed to the hypervisor, and then copy_to/from_user expects a scatterlist address instead of a pointer. I think the copy_to/from_user and get/put_user API would need to change though: you'd need the value, the scatterlist pointer, and an offset into the scatterlist.

So x86 would need a slight API change, but could continue without dealing with any scatterlists, i.e. no ABI change.

The PowerPC kernel would need knowledge of every hypercall structure to create and translate the scatterlist. I know that's an idea Jimi isn't fond of, but it really seems like the best solution here.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"HB" == Hollis Blanchard <[email protected]> writes:

hmm let me bubble up my intro :)

HB> I know that's an idea Jimi isn't fond of, but it really seems HB> like the best solution here.

Why I dislike this solution.
1. Currently, the kernel has no intimate knowledge of the managment calls. This is goodness since this gives the freedom to "innovate" in the management area without impacting the kernel, we now would require kernel updates that grok management structures, creating more opportunity for versioning chaos and bloating of the kernel patch.
2. We are complicating the kernel and the hypervisor in order to keep a user app simple. Does anyone care that a user app suffer a little performace impact? Frankly, I'm much more worried about unecessarily impacting the hypervisor.

I believe a negotiated managment area that the application serializes all arguements into to be a far better solution, the area can be of arbitrary size and it the added complexity to the application is trivial.

Am I missing something?
-JX

Signature · 2 lines
 "I got an idea, an idea so smart my head would explode if I even
  began to know what I was talking about." -- Peter Griffin (Family Guy)
#3 lore raw
Quoted 6 lines · Jimi Xenidis

I believe a negotiated managment area that the application serializes all arguements into to be a far better solution, the area can be of arbitrary size and it the added complexity to the application is trivial.

Am I missing something?

This is the correct answer imo. get_pfn_list() needs to die anyway: there are better ways to get the list of mfns belonging to a guest (you can get the list back from increase_reservation, or you can map the guest's pfn->mfn map).

The current mlock() scheme in libxc is screwed anyway -- we mlock/munlock regions that may overlap at page granularity. Fixing this would lead naturally to a preallocation scheme.

-- Keir