netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Brian Johannesmeyer <bjohannesmeyer@gmail.com>
Cc: Ronak Doshi <ronak.doshi@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Andy King <acking@vmware.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Raphael Isemann <teemperor@gmail.com>
Subject: Re: [PATCH 0/2] vmxnet3: Fix inconsistent DMA accesses
Date: Thu, 14 Nov 2024 19:38:55 -0800	[thread overview]
Message-ID: <20241114193855.058f337f@kernel.org> (raw)
In-Reply-To: <20241113200001.3567479-1-bjohannesmeyer@gmail.com>

On Wed, 13 Nov 2024 20:59:59 +0100 Brian Johannesmeyer wrote:
> We found hundreds of inconsistent DMA accesses in the VMXNET3 driver. This
> patch series aims to fix them. (For a nice summary of the rules around
> accessing streaming DMA --- which, if violated, result in inconsistent
> accesses --- see Figure 4a of this paper [0]).
> 
> The inconsistent accesses occur because the `adapter` object is mapped into
> streaming DMA. However, when it is mapped into streaming DMA, it is then
> "owned" by the device. Hence, any access to `adapter` thereafter, if not
> preceded by a CPU-synchronization operation (e.g.,
> `dma_sync_single_for_cpu()`), may cause unexpected hardware behaviors.
> 
> This patch series consists of two patches:
> - Patch 1 adds synchronization operations into `vmxnet3_probe_device()`, to
>   mitigate the inconsistent accesses when `adapter` is initialized.
> However, this unfortunately does not mitigate all inconsistent accesses to
> it, because `adapter` is accessed elsewhere in the driver without proper
> synchronization.
> - Patch 2 removes `adapter` from streaming DMA, which entirely mitigates
>   the inconsistent accesses to it. It is not clear to me why `adapter` was
> mapped into DMA in the first place (in [1]), because it seems that before
> [1], it was not mapped into DMA. (However, I am not very familiar with the
> VMXNET3 internals, so someone is welcome to correct me here). Alternatively
> --- if `adapter` should indeed remain mapped in DMA --- then
> synchronization operations should be added throughout the driver code (as
> Patch 1 begins to do).

I guess we need to hear from vmxnet3 maintainers to know whether DMA
mapping is necessary for this virt device. But committing patch 1 just
to completely revert it in patch 2 seems a little odd.

Also trivial note, please checkpatch with --strict --max-line-length=80
-- 
pw-bot: cr

  parent reply	other threads:[~2024-11-15  3:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 19:59 [PATCH 0/2] vmxnet3: Fix inconsistent DMA accesses Brian Johannesmeyer
2024-11-13 20:00 ` [PATCH 1/2] vmxnet3: Fix inconsistent DMA accesses in vmxnet3_probe_device() Brian Johannesmeyer
2024-11-13 20:00 ` [PATCH 2/2] vmxnet3: Remove adapter from DMA region Brian Johannesmeyer
2024-11-15  3:38 ` Jakub Kicinski [this message]
2024-11-18 15:31   ` [PATCH 0/2] vmxnet3: Fix inconsistent DMA accesses Brian Johannesmeyer
2024-11-19  0:16     ` Jakub Kicinski
2024-11-19 17:10       ` Brian Johannesmeyer

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=20241114193855.058f337f@kernel.org \
    --to=kuba@kernel.org \
    --cc=acking@vmware.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bjohannesmeyer@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ronak.doshi@broadcom.com \
    --cc=teemperor@gmail.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).