From: Zoltan Kiss <zoltan.kiss@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: <wei.liu2@citrix.com>, <xen-devel@lists.xenproject.org>,
<paul.durrant@citrix.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <jonathan.davies@citrix.com>
Subject: Re: [PATCH net-next v2 2/2] xen-netback: Grant copy the header instead of map and memcpy
Date: Tue, 1 Apr 2014 20:09:44 +0100 [thread overview]
Message-ID: <533B0EF8.6000900@citrix.com> (raw)
In-Reply-To: <1396352440.8667.117.camel@kazak.uk.xensource.com>
On 01/04/14 12:40, Ian Campbell wrote:
> On Mon, 2014-03-31 at 16:08 +0100, Zoltan Kiss wrote:
>>
>> check_frags:
>> - for (i = start; i < nr_frags; i++) {
>> + for (i = 0; i < nr_frags; i++, gop_map++) {
>> int j, newerr;
>>
>> pending_idx = frag_get_pending_idx(&shinfo->frags[i]);
>> - tx_info = &vif->pending_tx_info[pending_idx];
>>
>> /* Check error status: if okay then remember grant handle. */
>> - newerr = (++gop_map)->status;
>> + newerr = (gop_map)->status;
>
> You've reworked the handling of gop_map and when and where it is
> incremented, which might be a legit cleanup but does it relate to the
> bulk of this change somehow that I'm missing?
That original "++gop_map" assumed the header was also grant mapped, and
incremented the pointer first here, which is wrong now.
>
>> [...]
>> __skb_put(skb, data_len);
>> + vif->tx_copy_ops[*copy_ops].source.u.ref = txreq.gref;
>> + vif->tx_copy_ops[*copy_ops].source.domid = vif->domid;
>> + vif->tx_copy_ops[*copy_ops].source.offset = txreq.offset;
>> +
>> + vif->tx_copy_ops[*copy_ops].dest.u.gmfn =
>> + virt_to_mfn(skb->data);
>> + vif->tx_copy_ops[*copy_ops].dest.domid = DOMID_SELF;
>> + vif->tx_copy_ops[*copy_ops].dest.offset =
>> + offset_in_page(skb->data);
>> +
>> + vif->tx_copy_ops[*copy_ops].len = data_len;
>> + vif->tx_copy_ops[*copy_ops].flags = GNTCOPY_source_gref;
>
> We have gnttab_set_map_op. Should we have gnttap_set_copy_op too?
This is the only place at the moment when we do this, so I wouldn't
bother to do it.
>
>> - BUG_ON(ret);
>> + else {
>> + gnttab_batch_copy(vif->tx_copy_ops, nr_cops);
>> + if (nr_mops != 0) {
>
>
> if (nr_mops) would do.
>
>> + ret = gnttab_map_refs(vif->tx_map_ops,
>
> So we use gnttab_batch_copy and gnttab_map_refs.
>
> Shouldn't we either use gnttab_batch_copy and gnttab_batch_map or
> gnttab_copy gnttab_map_refs. (where gnttab_copy might be a bare
> GNTTABOP_copy or might be a helper wrapper).
>
> The point of the batch interface is to handle page unsharing etc, but
> doing it only for copies seems like a waste one way or another.
The difference between gnttab_batch_map and gnttab_map_refs is that the
latter calls set_foreign_p2m_mapping, which we need for sure.
gnttab_batch_copy calls the hypercall and tries again if op->status ==
GNTST_eagain. I think that's exactly what we need here as well.
The naming might be confusing indeed, but that should be the topic of an
another patch.
Zoli
next prev parent reply other threads:[~2014-04-01 19:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 15:08 [PATCH net-next v2 1/2] xen-netback: Rename map ops Zoltan Kiss
2014-03-31 15:08 ` [PATCH net-next v2 2/2] xen-netback: Grant copy the header instead of map and memcpy Zoltan Kiss
2014-04-01 9:40 ` Paul Durrant
2014-04-01 18:55 ` Zoltan Kiss
2014-04-02 7:29 ` Ian Campbell
2014-04-01 11:40 ` Ian Campbell
2014-04-01 19:09 ` Zoltan Kiss [this message]
2014-04-02 7:32 ` Ian Campbell
2014-04-02 13:11 ` David Vrabel
2014-04-02 13:15 ` Ian Campbell
2014-04-02 14:41 ` [Xen-devel] " Zoltan Kiss
2014-04-01 11:18 ` [PATCH net-next v2 1/2] xen-netback: Rename map ops Ian Campbell
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=533B0EF8.6000900@citrix.com \
--to=zoltan.kiss@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=jonathan.davies@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul.durrant@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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).