Netdev List
 help / color / mirror / Atom feed
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 05:01:25 -0400 (EDT)	[thread overview]
Message-ID: <20161010.050125.1981283393312167625.davem@davemloft.net> (raw)
In-Reply-To: <0b57cbe2-84f7-6c0a-904a-d166571234b5@cogentembedded.com>

From: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Date: Mon, 10 Oct 2016 11:52:06 +0300

> With this scheme, page used for Rx is completely dma_map()ed at
> allocation time, split into two buffers, and individual buffer is
> sync_to_cpu()ed AND PASSED TO NETWORK STACK via skb_add_rx_frag() -
> while driver driver still uses other buffer. Later, when driver decides
> to no longer use this page, it will dma_unmap() it completely - which on
> archs with non-coherent caches means cache invalidation. This cache
> invalidation will include area that is already passed elsewhere.

This should happen only if the device wrote into that piece of the
memory which it absolutely should not.

When the dma sync occurs, no dirty data should be in the caches for
the portion of the page any more, and therefore nothing should be
written back unless the device illegally wrote to that part of the
page again.

If something is causing data to be written back even if the device
doesn't write into that area again, it's a bug.

And FWIW the swiommu code has this bug.  It should never (re-)copy
back into the mapped area after a sync unless the device wrote into
that area in the time between the sync and the unmap.

  reply	other threads:[~2016-10-10  9:01 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 [this message]
2016-10-10  9:51   ` Nikita Yushchenko
2016-10-10 11:57     ` David Miller
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.050125.1981283393312167625.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