|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 03/20] xen/grant: Introduce helpers to split a page into grant
Hi Stefano, On 16/07/2015 17:01, Stefano Stabellini wrote: On Thu, 9 Jul 2015, Julien Grall wrote:Currently, a grant is always based on the Xen page granularity (i.e 4KB). When Linux is using a different page granularity, a single page will be split between multiple grants. The new helpers will be in charge to split the Linux page into grant and Will fix it.
Ok. + len = min_t(unsigned int, PAGE_SIZE - offset, len); + goffset = offset & ~XEN_PAGE_MASK;I don't think we want to support cases where (offset & ~XEN_PAGE_MASK) != 0, we should just return error. We have to support offset != 0. The buffer received by the PV drivers may start in the middle of the page and finish before the end of the page. For instance blkfront is using biovec which contains 3 informations: the page, the offset in the page and the total length.
See my answer above. + fn(pfn_to_mfn(pfn), goffset, &glen, data);Allowing the callee to change glen makes the interface more complex and certainly doesn't match the gnttab_foreach_grant function name anymore. Why? Each time the callback is called, there is a new grant allocated. If netback needs it, could it just do the work inside its own function? I would rather keep gnttab_foreach_grant simple and move the complexity there. Moving the complexity in netback means adding a loop in the callback which will do exactly the same as this loop.That also means to use XEN_PAGE_SIZE & co which I'm trying to avoid in order to not confuse the developer. If they are hidden it likely mean less problem on 64KB when the developper is working on 4KB. IHMO, the complexity is not so bad and will be more lisible than yet another loop. [...]
See my remark above. + gnttab_foreach_grant(page, offset, len, fn, data); +} + +/* Get the number of grant in a specified region + * + * offset: Offset in the first pageI would generalize this function and support offset > PAGE_SIZE. At that point you could rename offset to "start". It's actually supported, maybe it's not clear enough. Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |