From: Sagi Grimberg <sagi@grimberg.me>
To: David Miller <davem@davemloft.net>
Cc: sagi@lightbitslabs.com, linux-block@vger.kernel.org,
netdev@vger.kernel.org, keith.busch@intel.com, hch@lst.de,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 10/11] nvmet-tcp: add NVMe over TCP target driver
Date: Mon, 19 Nov 2018 15:14:44 -0800 [thread overview]
Message-ID: <f4997fa5-a0f1-2783-4732-15fbd7fcafd8@grimberg.me> (raw)
In-Reply-To: <20181119.145343.2254073323355763213.davem@davemloft.net>
>> I would love you to look at skb_copy_and_hash_datagram_iter as these
>> changes will require an ack from you.
>
> My first impression is that we now have this kind of code pattern
> in at least two main places and now this will be a third.
>
> I know that nobody likes callbacks because of spectre, but all of
> these cases could be done with something like:
>
> int __skb_datagram_iter(const struct sk_buff *skb, int offset,
> struct iov_iter *to, int len,
> int (*cb)(void *, int, struct iov_iter *, void *),
> void *data)
> {
> ...
> n = cb(skb->data + offset, copy, to, data);
> ...
> }
>
> You get the idea. Then we have one version of all the loops and
> the different (copy, copy+csum, copy+hash) cases all can be
> handled by __skb_datagram_iter() but just with a different 'cb'
> and private 'data'.
I already thought about that, but the fact that we copy both a buffer
and a page to the iter (in the most general case) we'd have to carry
two callbacks for indirection.. That wasn't something I thought as
acceptable...
I guess we could rework skb_copy_datagram_iter to not call
copy_page_to_iter and open-code kmapping so we can get away with a
single code path? Unless I'm missing something?
Also, looking a bit closer there is a slight difference between the copy
vs. the copy_and_csum variants. copy allows for a short_copy if we copy
less than we expect while the csum faults it. I'm thinking that the
copy_and_hash variant should also fault? Although I'm not sure I
understand the fault entirely as csum is supposed to be cumulative, any
insight?
next prev parent reply other threads:[~2018-11-20 9:40 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 17:16 [PATCH 00/11] TCP transport binding for NVMe over Fabrics Sagi Grimberg
2018-11-15 17:16 ` [PATCH 01/11] ath6kl: add ath6kl_ prefix to crypto_type Sagi Grimberg
2018-11-15 17:16 ` [PATCH 02/11] iov_iter: introduce hash_and_copy iter helpers Sagi Grimberg
2018-11-15 17:16 ` [PATCH 03/11] datagram: introduce skb_copy_and_hash_datagram_iter helper Sagi Grimberg
2018-11-15 17:16 ` [PATCH 04/11] nvme-core: add work elements to struct nvme_ctrl Sagi Grimberg
2018-11-17 22:18 ` Max Gurtovoy
2018-11-15 17:16 ` [PATCH 05/11] nvmet: Add install_queue callout Sagi Grimberg
2018-11-17 22:36 ` Max Gurtovoy
2018-11-19 21:21 ` Sagi Grimberg
2018-11-15 17:16 ` [PATCH 06/11] nvmet: allow configfs tcp trtype configuration Sagi Grimberg
2018-11-17 22:38 ` Max Gurtovoy
2018-11-15 17:16 ` [PATCH 07/11] nvme-fabrics: allow user passing header digest Sagi Grimberg
2018-11-15 17:16 ` [PATCH 08/11] nvme-fabrics: allow user passing data digest Sagi Grimberg
2018-11-15 17:16 ` [PATCH 09/11] nvme-tcp: Add protocol header Sagi Grimberg
2018-11-15 17:16 ` [PATCH 10/11] nvmet-tcp: add NVMe over TCP target driver Sagi Grimberg
2018-11-17 20:15 ` David Miller
2018-11-17 22:48 ` Max Gurtovoy
2018-11-19 21:37 ` Sagi Grimberg
2018-11-19 21:26 ` Sagi Grimberg
2018-11-19 22:53 ` David Miller
2018-11-19 23:14 ` Sagi Grimberg [this message]
2018-11-19 23:18 ` David Miller
2018-11-19 23:24 ` Sagi Grimberg
2018-11-20 1:44 ` David Miller
2018-11-15 17:16 ` [PATCH 11/11] nvme-tcp: add NVMe over TCP host driver Sagi Grimberg
2018-11-15 17:16 ` [PATCH nvme-cli 12/11] nvme: Add TCP transport Sagi Grimberg
2018-11-15 17:16 ` [PATCH nvme-cli 13/11] fabrics: add tcp port tsas decoding Sagi Grimberg
2018-11-15 17:16 ` [PATCH nvme-cli 14/11] fabrics: add transport header and data digest Sagi Grimberg
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=f4997fa5-a0f1-2783-4732-15fbd7fcafd8@grimberg.me \
--to=sagi@grimberg.me \
--cc=davem@davemloft.net \
--cc=hch@lst.de \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=sagi@lightbitslabs.com \
/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).