Hypercall-page initialization
hi,
I my unprivileged domain builder, I have run into the problem of how to setup the hypercall-page. I suppose I can decode the kernel binary header to figure out where to put the page, and then memcpy it from loader to linux and things will work.
But wouldn't it be better if the hypercall used to populate the page was available to the domU, so that its startup-code could call on Xen to populate the page? I find the current approach of hardcoding the page location in the kernel header pretty ugly.
Jacob
Quoted 9 lines · Jacob Gorm Hansen
I my unprivileged domain builder, I have run into the problem of how to setup the hypercall-page. I suppose I can decode the kernel binary header to figure out where to put the page, and then memcpy it from loader to linux and things will work.
But wouldn't it be better if the hypercall used to populate the page was available to the domU, so that its startup-code could call on Xen to populate the page? I find the current approach of hardcoding the page location in the kernel header pretty ugly.
We can make the hypercall for filling the page one that can be executed by unpriv domains (i.e., make it not a dom0_op).
Or if you want to fill it in from within the domU, how about if we did something like reserve some space of MSRs for Xen use (e.g., hex Bxxxxxxx). Then we could say that, if the guest writes an MFN to a particular one of those MSRs, it gets filled with hypercall-page goodness. :-)
-- Keir
Quoted 2 lines · Keir Fraser
We can make the hypercall for filling the page one that can be executed by unpriv domains (i.e., make it not a
dom0_op).
That would be fine with me, though I guess purists would argue that it would remove some flexibility, e.g. int 0x82 (or another hardcoded trap vector) would have always have to be supported.
Quoted 5 lines
Or if you want to fill it in from within the domU, how about if we did something like reserve some space of MSRs for Xen use (e.g., hex Bxxxxxxx). Then we could say that, if the guest writes an MFN to a particular one of those MSRs, it gets filled with hypercall-page goodness. :-)
Hmm would that work in paravirt mode also? I guess Xen would trap the exception and do the right thing? I suppose this has the advantage of avoiding any hardcoded trap vectors.
Quoted 1 line
-- Keir
Jacob
Quoted 9 lines · Jacob Gorm Hansen
Quoted 5 lines
Or if you want to fill it in from within the domU, how about if we did something like reserve some space of MSRs for Xen use (e.g., hex Bxxxxxxx). Then we could say that, if the guest writes an MFN to a particular one of those MSRs, it gets filled with hypercall-page goodness. :-)
Hmm would that work in paravirt mode also? I guess Xen would trap the exception and do the right thing? I suppose this has the advantage of avoiding any hardcoded trap vectors.
Yes, although it does sound kinda gross, it will work and ultimately I think it sounds quite attractive compared with the alternatives. Not sure how to decide what MSR range to pick to reserve... Apart from that it's trivial to implement.
-- Keir
Quoted 9 lines · Keir Fraser
Quoted 6 lines · Jacob Gorm Hansen
Quoted 5 lines
Or if you want to fill it in from within the domU, how about if we did something like reserve some space of MSRs for Xen use (e.g., hex Bxxxxxxx). Then we could say that, if the guest writes an MFN to a particular one of those MSRs, it gets filled with hypercall-page goodness. :-)
Quoted 8 lines
Quoted 3 lines
Hmm would that work in paravirt mode also? I guess Xen would trap the exception and do the right thing? I suppose this has the advantage of avoiding any hardcoded trap vectors.
Yes, although it does sound kinda gross, it will work and ultimately I think it sounds quite attractive compared with the alternatives. Not sure how to decide what MSR range to pick to reserve... Apart from that it's trivial to implement.
hi,
I've bumped my head against this again, and a quick fix would be to make the dom0 op unprivileged. If you can tell me where in the xen source you would like op to be moved, I send in a patch for it.
Jacob