xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Re: Create a iSCSI DomU with disks in another DomU running on the same Dom0
Date: Sat, 12 Jan 2013 13:11:32 +0100	[thread overview]
Message-ID: <50F152F4.5000105@citrix.com> (raw)
In-Reply-To: <20130111210935.GA30742@phenom.dumpdata.com>

On 11/01/13 22:09, Konrad Rzeszutek Wilk wrote:
> On Fri, Jan 11, 2013 at 08:29:12PM +0100, Roger Pau Monné wrote:
>> On 11/01/13 19:51, Konrad Rzeszutek Wilk wrote:
>>> On Fri, Jan 11, 2013 at 04:57:52PM +0100, Roger Pau Monné wrote:
>>>> Hello Konrad,
>>>>
>>>> I've found the problem, blkback is adding granted pages to the bio that 
>>>> is then passed to the underlying block device. When using a iscsi 
>>>> target running on another DomU in the same h/w this bios end up in 
>>>> netback, and then when performing the gnttab copy operation, it 
>>>> complains because the passed mfn belongs to a different domain.
>>>
>>> OK, so my original theory was sound. The m2p override "sticks".
>>>>
>>>> I've checked this by applying the appended patch to blkback, which 
>>>> allocates a buffer to pass to the bio instead of using the granted 
>>>> page. Of course this should not applied, since it implies additional 
>>>> memcpys.
>>>>
>>>> I think the right way to solve this would be to change netback to 
>>>> use gnttab_map and memcpy instead of gnttab_copy, but I guess this 
>>>> will imply a performance degradation (haven't benchmarked it, but I 
>>>> assume gnttab_copy is used in netback because it is faster than 
>>>> gnttab_map + memcpy + gnttab_unmap).
>>>
>>> Or blkback is altered to use grant_copy.
>>
>> This would not work with the persistent-grants extension, and also when
>> scaling to a large number of guests will probably have a degraded
>> performance due to the grant table lock (compared to using persistent
>> grants).
>>
>>> Or perhaps m2p_override
>>> can do multiple PAGE_FOREIGN? (So if it detects a collision it will
>>> do something smart.. like allocate a new page or update the 
>>> kmap_op with extra information).
>>
>> What we could do is add extra information to m2p_override, containing
>> the grant_ref_t and domid, so when a FOREIGN_FRAME is detected in
>> grant_copy (or netback) the grant_ref_t and domid of the passed mfn is
>> used instead of the mfn (provided that grant_copy can perform a copy
>> between two grant references of different domains).

Since the issue I'm having is not common I'm not sure if this solution
is worth it, it will imply storing a pointer to a struct in the page
private data, that stores the mfn, grant reference and domid (now we are
only storing the mfn in the page private data).

>>>
>>>
>>> And yes, grant_map in netback is much much slower that grant_copy
>>> (I tested 2.6.32 vs 3.7 using a Xen 4.1.3 with the grant_copy fixes
>>> that Jan came up with).
>>
>> Yes, I see there's no way we are going to use grant_map instead of
>> grant_copy. I guess this will no longer be true once netback/front
>> starts using the persistent grants extension.
> 
> Hm? Annie posted patches for the persistent grants on netback/netfront
> and they did not show much improvement (as you are already doing grant_copy).
> 
> Or are you saying change netback to use grant_map and utilize the
> skb->deconstructor to keep track of it? And then do persistent grant
> extensions on it?

I'm not really familiar with the net code, but I've had a quick look at
the grant_copy operation in Xen and it is indeed using the grant lock to
protect some parts of the code.

Using persistent grants should provide better performance in the long
run because once the grant is mapped we don't have to issue any more
grant operations, thus avoiding grant lock contention (maybe I'm missing
something here). skb deconstructor should probably be used in netfront,
to return the persistently mapped grant to the list of free grants, but
I'm not sure if we will need to use it in netback.

  reply	other threads:[~2013-01-12 12:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21  8:29 Create a iSCSI DomU with disks in another DomU running on the same Dom0 Roger Pau Monné
2012-12-21 14:03 ` Konrad Rzeszutek Wilk
2012-12-21 14:47   ` Roger Pau Monné
2012-12-21 17:35     ` Konrad Rzeszutek Wilk
2013-01-02 13:05       ` Roger Pau Monné
2013-01-02 21:36         ` Konrad Rzeszutek Wilk
2013-01-09 19:23           ` Roger Pau Monné
2013-01-11 15:06             ` Konrad Rzeszutek Wilk
2013-01-11 15:57               ` Roger Pau Monné
2013-01-11 18:51                 ` Konrad Rzeszutek Wilk
2013-01-11 19:29                   ` Roger Pau Monné
2013-01-11 21:09                     ` Konrad Rzeszutek Wilk
2013-01-12 12:11                       ` Roger Pau Monné [this message]
2013-01-14 15:24                         ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F152F4.5000105@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).