On Tue, Jun 20, 2017 at 03:19:33PM -0700, Stefano Stabellini wrote: > On Tue, 20 Jun 2017, Paul Durrant wrote: > > If grant copy is available then it will always be used in preference to > > persistent maps. In this case feature-persistent should not be advertized > > to the frontend, otherwise it may needlessly copy data into persistently > > granted buffers. > > > > Signed-off-by: Paul Durrant <paul.durr...@citrix.com> > > CC'ing Roger. > > It is true that using feature-persistent together with grant copies is a > a very bad idea. > > But this change enstablishes an explicit preference of > feature_grant_copy over feature-persistent in the xen_disk backend. It > is not obvious to me that it should be the case. > > Why is feature_grant_copy (without feature-persistent) better than > feature-persistent (without feature_grant_copy)? Shouldn't we simply > avoid grant copies to copy data to persistent grants?
When using persistent grants the frontend must always copy data from the buffer to the persistent grant, there's no way to avoid this. Using grant_copy we move the copy from the frontend to the backend, which means the CPU time of the copy is accounted to the backend. This is not ideal, but IMHO it's better than persistent grants because it avoids keeping a pool of mapped grants that consume memory and make the code more complex. Do you have some performance data showing the difference between persistent grants vs grant copy? Roger.