[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] XC_PAGE_SIZE or XEN_PAGE_SIZE?



On 12/02/2016 01:03 PM, Jan Beulich wrote:
On 02.12.16 at 08:49, <andr2000@xxxxxxxxx> wrote:
While working on display protocol I found that there is no(?) common

???_PAGE_SIZE define I can use for both Xen and Linux kernel:

Xen defines XC_PAGE_SIZE which is also used in Linux user-space and

kernel has XEN_PAGE_SIZE, but no XC_PAGE_SIZE.

So, the question is which define should I use?
In the abstract protocol there should be no need for this other
than in comments (as is the case for all other protocols with the
exception of vscsiif, which had a need to define its own
VSCSIIF_PAGE_SIZE), where I think just PAGE_SIZE will be fine.
In the end, frontend and backend are required to agree on a
page size via some side channel anyway, which usually is
achieved by base architecture assumptions (after all both run
on the same physical machine and hence with the same set of
architecture prerequisites). Arguably this is not an optimal model
(namely on architectures supporting varying page sizes), but if
we were to change it we should probably do so for all protocols.

In the implementation you use the manifest constant available: If
your code is in user space, use XC_PAGE_SIZE. In the kernel you'd
obviously use XEN_PAGE_SIZE.
I'll give you an example:
#define XENDISPL_PAGE_SIZE 4096
#define XENDISPL_IN_RING_OFFS (sizeof(struct xendispl_event_page))
#define XENDISPL_IN_RING_SIZE (XENDISPL_PAGE_SIZE - XENDISPL_IN_RING_OFFS)

By this code I define an event ring for async messages from front to back.
This is almost the same as already defined in kbdif and fbif which define it to 2048
In my case I wanted to rely on page size.
Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.