* Grant a partial page
@ 2011-11-10 5:46 Daniel Castro
2011-11-10 8:02 ` Ian Campbell
2011-11-10 22:22 ` Konrad Rzeszutek Wilk
0 siblings, 2 replies; 6+ messages in thread
From: Daniel Castro @ 2011-11-10 5:46 UTC (permalink / raw)
To: xen-devel
Hello,
I to issue a grant on a page, but only partially.
I have a pointer to somewhere in memory and need to issue the grant
for such a pointer but not to the entire page.
I know FLAG GTF_sub_page is used for that purpose but grant_entry_v1
apparently has no fields for sub_page, should I change the code to use
Version 2 grant table entries?
Thanks,
Daniel
--
+-=====---------------------------+
| +---------------------------------+ | This space intentionally blank
for notetaking.
| | | Daniel Castro, |
| | | Consultant/Programmer.|
| | | U Andes |
+-------------------------------------+
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Grant a partial page
2011-11-10 5:46 Grant a partial page Daniel Castro
@ 2011-11-10 8:02 ` Ian Campbell
2011-11-10 8:18 ` Daniel Castro
2011-11-10 22:22 ` Konrad Rzeszutek Wilk
1 sibling, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2011-11-10 8:02 UTC (permalink / raw)
To: Daniel Castro; +Cc: xen-devel@lists.xensource.com
On Thu, 2011-11-10 at 05:46 +0000, Daniel Castro wrote:
> Hello,
> I to issue a grant on a page, but only partially.
> I have a pointer to somewhere in memory and need to issue the grant
> for such a pointer but not to the entire page.
> I know FLAG GTF_sub_page is used for that purpose but grant_entry_v1
> apparently has no fields for sub_page, should I change the code to use
> Version 2 grant table entries?
sub page grants are a feature of v2 grant tables only, they also require
you to make copy only grants (since you cannot enforce the subpage
aspect for a mapped grant).
Using v2 grant tables here has a few issues.
Firstly it is hard (if not impossible) to go back to v1 after switching
to v2 which presents a problem for the eventual guest OS (this could
probably be solved by suitable hypervisor modifications).
Secondly the otherend needs to be using copy grants and not mapping
grants. This generally would require some sort of protocol negotiation
via xenstore (i.e. netback would generally use mapping by default for
guest-TX pages).
I think you are better off either copying your subpage data into an
isolated page of its own (or maybe you can arrange for this to be true
of the original data) or deciding that you are happy to expose the rest
of the original page to the backend domain. Whether this second option
is safe or not depends on what is there, a read-only grant might provide
some more assurances here, depending on what the data actually is etc.
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Grant a partial page
2011-11-10 8:02 ` Ian Campbell
@ 2011-11-10 8:18 ` Daniel Castro
2011-11-10 8:26 ` Ian Campbell
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Castro @ 2011-11-10 8:18 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel@lists.xensource.com
On Thu, Nov 10, 2011 at 5:02 PM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Thu, 2011-11-10 at 05:46 +0000, Daniel Castro wrote:
>> Hello,
>> I to issue a grant on a page, but only partially.
>> I have a pointer to somewhere in memory and need to issue the grant
>> for such a pointer but not to the entire page.
>> I know FLAG GTF_sub_page is used for that purpose but grant_entry_v1
>> apparently has no fields for sub_page, should I change the code to use
>> Version 2 grant table entries?
>
> sub page grants are a feature of v2 grant tables only, they also require
> you to make copy only grants (since you cannot enforce the subpage
> aspect for a mapped grant).
>
> Using v2 grant tables here has a few issues.
>
> Firstly it is hard (if not impossible) to go back to v1 after switching
> to v2 which presents a problem for the eventual guest OS (this could
> probably be solved by suitable hypervisor modifications).
>
> Secondly the otherend needs to be using copy grants and not mapping
> grants. This generally would require some sort of protocol negotiation
> via xenstore (i.e. netback would generally use mapping by default for
> guest-TX pages).
>
> I think you are better off either copying your subpage data into an
> isolated page of its own (or maybe you can arrange for this to be true
> of the original data) or deciding that you are happy to expose the rest
> of the original page to the backend domain. Whether this second option
> is safe or not depends on what is there, a read-only grant might provide
> some more assurances here, depending on what the data actually is etc.
Ian, the problems I see are:
1. I have no idea what the size of the transfer will be, it could be
several pages.
2. I do not know where the pointer that indicates the buffer points
at, meaning that I have no idea what else will be there.
3. I do not know id the buffer pointer is page aligned.
If I stick to the current code, where I do not use DMA directly,
instead the backend does the DMA to my private buffer and I manually
copy to the guest buffer. Does that extra copy is worth the trouble to
do v2 grants?
Daniel
>
> Ian.
>
>
--
+-=====---------------------------+
| +---------------------------------+ | This space intentionally blank
for notetaking.
| | | Daniel Castro, |
| | | Consultant/Programmer.|
| | | U Andes |
+-------------------------------------+
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Grant a partial page
2011-11-10 8:18 ` Daniel Castro
@ 2011-11-10 8:26 ` Ian Campbell
0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2011-11-10 8:26 UTC (permalink / raw)
To: Daniel Castro; +Cc: xen-devel@lists.xensource.com
On Thu, 2011-11-10 at 08:18 +0000, Daniel Castro wrote:
> On Thu, Nov 10, 2011 at 5:02 PM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> > On Thu, 2011-11-10 at 05:46 +0000, Daniel Castro wrote:
> >> Hello,
> >> I to issue a grant on a page, but only partially.
> >> I have a pointer to somewhere in memory and need to issue the grant
> >> for such a pointer but not to the entire page.
> >> I know FLAG GTF_sub_page is used for that purpose but grant_entry_v1
> >> apparently has no fields for sub_page, should I change the code to use
> >> Version 2 grant table entries?
> >
> > sub page grants are a feature of v2 grant tables only, they also require
> > you to make copy only grants (since you cannot enforce the subpage
> > aspect for a mapped grant).
> >
> > Using v2 grant tables here has a few issues.
> >
> > Firstly it is hard (if not impossible) to go back to v1 after switching
> > to v2 which presents a problem for the eventual guest OS (this could
> > probably be solved by suitable hypervisor modifications).
> >
> > Secondly the otherend needs to be using copy grants and not mapping
> > grants. This generally would require some sort of protocol negotiation
> > via xenstore (i.e. netback would generally use mapping by default for
> > guest-TX pages).
> >
> > I think you are better off either copying your subpage data into an
> > isolated page of its own (or maybe you can arrange for this to be true
> > of the original data) or deciding that you are happy to expose the rest
> > of the original page to the backend domain. Whether this second option
> > is safe or not depends on what is there, a read-only grant might provide
> > some more assurances here, depending on what the data actually is etc.
> Ian, the problems I see are:
> 1. I have no idea what the size of the transfer will be, it could be
> several pages.
> 2. I do not know where the pointer that indicates the buffer points
> at, meaning that I have no idea what else will be there.
> 3. I do not know id the buffer pointer is page aligned.
> If I stick to the current code, where I do not use DMA directly,
> instead the backend does the DMA to my private buffer and I manually
> copy to the guest buffer. Does that extra copy is worth the trouble to
> do v2 grants?
In the context of SeaBIOS I don't think the copy matters too much.
Unless/until benchmarking shows otherwise I'd be inclined not to worry
about it.
Ian.
>
> Daniel
> >
> > Ian.
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Grant a partial page
2011-11-10 5:46 Grant a partial page Daniel Castro
2011-11-10 8:02 ` Ian Campbell
@ 2011-11-10 22:22 ` Konrad Rzeszutek Wilk
2011-11-11 6:44 ` Ian Campbell
1 sibling, 1 reply; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-11-10 22:22 UTC (permalink / raw)
To: Daniel Castro; +Cc: xen-devel
On Thu, Nov 10, 2011 at 02:46:37PM +0900, Daniel Castro wrote:
> Hello,
> I to issue a grant on a page, but only partially.
> I have a pointer to somewhere in memory and need to issue the grant
> for such a pointer but not to the entire page.
> I know FLAG GTF_sub_page is used for that purpose but grant_entry_v1
> apparently has no fields for sub_page, should I change the code to use
> Version 2 grant table entries?
Well, there is no implementation for V2 grants yet. Thought Annie just posted
a version.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Grant a partial page
2011-11-10 22:22 ` Konrad Rzeszutek Wilk
@ 2011-11-11 6:44 ` Ian Campbell
0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2011-11-11 6:44 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk; +Cc: Daniel Castro, xen-devel@lists.xensource.com
On Thu, 2011-11-10 at 22:22 +0000, Konrad Rzeszutek Wilk wrote:
> On Thu, Nov 10, 2011 at 02:46:37PM +0900, Daniel Castro wrote:
> > Hello,
> > I to issue a grant on a page, but only partially.
> > I have a pointer to somewhere in memory and need to issue the grant
> > for such a pointer but not to the entire page.
> > I know FLAG GTF_sub_page is used for that purpose but grant_entry_v1
> > apparently has no fields for sub_page, should I change the code to use
> > Version 2 grant table entries?
>
> Well, there is no implementation for V2 grants yet. Thought Annie just posted
> a version.
Daniel is working on SeaBIOS, not Linux...
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-11-11 6:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10 5:46 Grant a partial page Daniel Castro
2011-11-10 8:02 ` Ian Campbell
2011-11-10 8:18 ` Daniel Castro
2011-11-10 8:26 ` Ian Campbell
2011-11-10 22:22 ` Konrad Rzeszutek Wilk
2011-11-11 6:44 ` Ian Campbell
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.