From: David Miller <davem@davemloft.net>
To: nikita.yoush@cogentembedded.com
Cc: jeffrey.t.kirsher@intel.com, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
cphealy@gmail.com
Subject: Re: igb driver can cause cache invalidation of non-owned memory?
Date: Mon, 10 Oct 2016 07:57:31 -0400 (EDT) [thread overview]
Message-ID: <20161010.075731.2449861168238706.davem@davemloft.net> (raw)
In-Reply-To: <10474d19-df1a-3b09-917e-70659be3a56c@cogentembedded.com>
From: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Date: Mon, 10 Oct 2016 12:51:28 +0300
> Hmm... I'm not about device writing to memory.
This absolutely is about whether the device wrote into the
area or not.
> Sequence in igb driver is:
>
> dma_map(full_page)
> <device writes here>
> sync_to_cpu(half_page);
> skb_add_rx_frag(skb, half_page);
> napi_gro_receive(skb);
> ...
> dma_unmap(full_page)
>
> What I'm concerned about is - same area is first passed up to network
> stack, and _later_ dma_unmap()ed. Is this indeed safe?
dma_unmap() should never write anything unless the device has
meanwhile written to that chunk of memory.
If the device made no intervening writes into the area, dma_unmap()
should not cause any data to be written to that area, period.
In your example above, consider the case where the device never
writes into the memory area after sync_to_cpu(). In that case
there is nothing that dma_unmap() can possibly write. All the
data has been synced, and no device writes into the memory are
have occurred.
next prev parent reply other threads:[~2016-10-10 11:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-10 8:52 igb driver can cause cache invalidation of non-owned memory? Nikita Yushchenko
2016-10-10 9:01 ` David Miller
2016-10-10 9:51 ` Nikita Yushchenko
2016-10-10 11:57 ` David Miller [this message]
2016-10-10 12:27 ` Nikita Yushchenko
2016-10-10 12:31 ` Nikita Yushchenko
2016-10-10 15:11 ` Alexander Duyck
2016-10-10 17:00 ` Nikita Yushchenko
2016-10-10 17:38 ` Alexander Duyck
2016-10-12 6:55 ` Nikita Yushchenko
2016-10-12 15:32 ` Alexander Duyck
2016-10-12 16:03 ` David Laight
2016-10-12 16:11 ` Nikita Yushchenko
2016-10-12 17:56 ` Alexander Duyck
2016-10-12 18:12 ` Nikita Yushchenko
2016-10-12 18:30 ` Alexander Duyck
2016-10-13 10:39 ` David Laight
2016-10-13 11:00 ` Nikita Yushchenko
2016-10-13 20:32 ` Alexander Duyck
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=20161010.075731.2449861168238706.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=cphealy@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikita.yoush@cogentembedded.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