All of lore.kernel.org
 help / color / mirror / Atom feed
* Multiple-page mem_event ring buffer?
@ 2013-03-05 13:21 Razvan Cojocaru
  2013-03-05 14:21 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 6+ messages in thread
From: Razvan Cojocaru @ 2013-03-05 13:21 UTC (permalink / raw)
  To: xen-devel@lists.xen.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple-page mem_event ring buffer?
  2013-03-05 13:21 Razvan Cojocaru
@ 2013-03-05 14:21 ` Konrad Rzeszutek Wilk
  2013-03-05 14:34   ` Razvan Cojocaru
  2013-03-05 15:00   ` Razvan Cojocaru
  0 siblings, 2 replies; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-03-05 14:21 UTC (permalink / raw)
  To: Razvan Cojocaru; +Cc: xen-devel@lists.xen.org

On Tue, Mar 05, 2013 at 03:21:38PM +0200, Razvan Cojocaru wrote:
> 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?

You should be able to as many as you want. Are you hitting any
particular issues?

> 
> 
> Thanks,
> Razvan Cojocaru
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple-page mem_event ring buffer?
  2013-03-05 14:21 ` Konrad Rzeszutek Wilk
@ 2013-03-05 14:34   ` Razvan Cojocaru
  2013-03-05 15:00   ` Razvan Cojocaru
  1 sibling, 0 replies; 6+ messages in thread
From: Razvan Cojocaru @ 2013-03-05 14:34 UTC (permalink / raw)
  To: xen-devel@lists.xen.org

>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple-page mem_event ring buffer?
  2013-03-05 14:21 ` Konrad Rzeszutek Wilk
  2013-03-05 14:34   ` Razvan Cojocaru
@ 2013-03-05 15:00   ` Razvan Cojocaru
  1 sibling, 0 replies; 6+ messages in thread
From: Razvan Cojocaru @ 2013-03-05 15:00 UTC (permalink / raw)
  To: xen-devel@lists.xen.org

>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple-page mem_event ring buffer?
       [not found] <mailman.25393.1362491391.1399.xen-devel@lists.xen.org>
@ 2013-03-05 15:25 ` Andres Lagar-Cavilla
  2013-03-05 15:35   ` Razvan Cojocaru
  0 siblings, 1 reply; 6+ messages in thread
From: Andres Lagar-Cavilla @ 2013-03-05 15:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Razvan Cojocaru, Jan Beulich

>  
> 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?

You would have to change Xen itself to also view the N pages as a contiguous region in the virtual address space. I think vmap has been recently added for that purpose, but I know nothing about its limitations (cc'ing Jan).

You would also want to retain the old interface and add a new domctl for N-page ring setup. And some refactoring of all the places where that sequence of calls needed for setup is repeated. And a pony ;)

Thanks!
Andres
> 
> 
> Thanks,
> Razvan Cojocaru

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple-page mem_event ring buffer?
  2013-03-05 15:25 ` Multiple-page mem_event ring buffer? Andres Lagar-Cavilla
@ 2013-03-05 15:35   ` Razvan Cojocaru
  0 siblings, 0 replies; 6+ messages in thread
From: Razvan Cojocaru @ 2013-03-05 15:35 UTC (permalink / raw)
  To: xen-devel@lists.xen.org

>> 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 would have to change Xen itself to also view the N pages as a contiguous region in the virtual address space. I think vmap has been recently added for that purpose, but I know nothing about its limitations (cc'ing Jan).
>
> You would also want to retain the old interface and add a new domctl for N-page ring setup. And some refactoring of all the places where that sequence of calls needed for setup is repeated. And a pony ;)

Ah, that's what I thought. Will ask management to budget for the pony :)


Thanks,
Razvan Cojocaru

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-05 15:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.25393.1362491391.1399.xen-devel@lists.xen.org>
2013-03-05 15:25 ` Multiple-page mem_event ring buffer? Andres Lagar-Cavilla
2013-03-05 15:35   ` Razvan Cojocaru
2013-03-05 13:21 Razvan Cojocaru
2013-03-05 14:21 ` Konrad Rzeszutek Wilk
2013-03-05 14:34   ` Razvan Cojocaru
2013-03-05 15:00   ` Razvan Cojocaru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.