Multiple-page mem_event ring buffer?
Hello,
currently my code (and all the examples I could find in the Xen source code) uses a single page mem_event ring buffer, using code along the lines of:
/* Map the ring page */
unsigned long ring_pfn;xc_get_hvm_param(xci_, domain_, HVM_PARAM_ACCESS_RING_PFN, &ring_pfn);
unsigned long mmap_pfn = ring_pfn;ringPage_ = xc_map_foreign_batch(xci_, domain_, PROT_READ | PROT_WRITE,
&mmap_pfn, 1);
if (mmap_pfn & XEN_DOMCTL_PFINFO_XTAB) {
/* Map failed, populate ring page */
if (xc_domain_populate_physmap_exact(xci_, domain_,
1, 0, 0, &ring_pfn))
return SOME_ERROR;
mmap_pfn = ring_pfn;
ringPage = xc_map_foreign_batch(xci_, domain_,
PROT_READ | PROT_WRITE,
&mmap_pfn, 1);
if (mmap_pfn & XEN_DOMCTL_PFINFO_XTAB)
return SOME_OTHER ERROR;
}Could I safely use more than one page for the ring buffer (passing '2' as the last parameter of xc_map_foreign_batch(), and so on), or am I limited to 1 page by design?
Thanks,
Razvan Cojocaru
Quoted 30 lines · Razvan Cojocaru
Hello,
currently my code (and all the examples I could find in the Xen source code) uses a single page
mem_eventring buffer, using code along the lines of:/* Map the ring page */
unsigned longring_pfn;xc_get_hvm_param(xci_, domain_, HVM_PARAM_ACCESS_RING_PFN, &ring_pfn);unsigned long
mmap_pfn=ring_pfn;ringPage_= xc_map_foreign_batch(xci_,domain_,PROT_READ|PROT_WRITE,&mmap_pfn, 1);if (
mmap_pfn&XEN_DOMCTL_PFINFO_XTAB) {/* Map failed, populate ring page */ if (xc_domain_populate_physmap_exact(xci_, domain_, 1, 0, 0, &ring_pfn)) return SOME_ERROR; mmap_pfn = ring_pfn; ringPage = xc_map_foreign_batch(xci_, domain_, PROT_READ | PROT_WRITE, &mmap_pfn, 1); if (mmap_pfn & XEN_DOMCTL_PFINFO_XTAB) return SOME_OTHER ERROR; }
Quoted 3 lines
Could I safely use more than one page for the ring buffer (passing '2' as the last parameter of
xc_map_foreign_batch(), and so on), or am I limited to 1 page by design?
You should be able to as many as you want. Are you hitting any particular issues?
Quoted 10 lines
Thanks,
Razvan Cojocaru_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 6 lines
Quoted 3 lines
Could I safely use more than one page for the ring buffer (passing '2' as the last parameter of
xc_map_foreign_batch(), and so on), or am I limited to 1 page by design?You should be able to as many as you want. Are you hitting any particular issues?
Haven't tried it yet, I've just noticed that all the example code using it hardcoded '1' as the number of pages it asks for, xenaccess.c has a comment to the effect of "/* Map the ring _page_ */", and so on.
Thanks,
Razvan Cojocaru
Quoted 6 lines
Quoted 3 lines
Could I safely use more than one page for the ring buffer (passing '2' as the last parameter of
xc_map_foreign_batch(), and so on), or am I limited to 1 page by design?You should be able to as many as you want. Are you hitting any particular issues?
Actually, now that I've tried it, xc_domain_decrease_reservation_exact(xch, domain, RING_PAGES, 0, &ring_pfn) is failing for any RING_PAGES > 1.
Any ideas?
Thanks,
Razvan Cojocaru