All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju@tsinghua.edu.cn>
To: David Miller <davem@davemloft.net>
Cc: doshir@vmware.com, pv-drivers@vmware.com, kuba@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: vmxnet3: avoid accessing the data mapped to streaming DMA
Date: Tue, 4 Aug 2020 10:17:26 +0800	[thread overview]
Message-ID: <6d4a6167-2480-0091-33a1-6b0cb81e4645@tsinghua.edu.cn> (raw)
In-Reply-To: <20200803.155949.39743839019093809.davem@davemloft.net>



On 2020/8/4 6:59, David Miller wrote:
> From: Jia-Ju Bai <baijiaju@tsinghua.edu.cn>
> Date: Sun,  2 Aug 2020 21:11:07 +0800
>
>> In vmxnet3_probe_device(), "adapter" is mapped to streaming DMA:
>>    adapter->adapter_pa = dma_map_single(..., adapter, ...);
>>
>> Then "adapter" is accessed at many places in this function.
>>
>> Theses accesses may cause data inconsistency between CPU cache and
>> hardware.
>>
>> To fix this problem, dma_map_single() is called after these accesses.
>>
>> Signed-off-by: Jia-Ju Bai <baijiaju@tsinghua.edu.cn>
> 'adapter' is accessed everywhere, in the entire driver, not just here
> in the probe function.

Okay, replacing dma_map_single() with dma_alloc_coherent() may be better.
If you think this solution is okay, I can submit a new patch.


Best wishes,
Jia-Ju Bai


      reply	other threads:[~2020-08-04  2:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 13:11 [PATCH] net: vmxnet3: avoid accessing the data mapped to streaming DMA Jia-Ju Bai
2020-08-03 22:59 ` David Miller
2020-08-04  2:17   ` Jia-Ju Bai [this message]

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=6d4a6167-2480-0091-33a1-6b0cb81e4645@tsinghua.edu.cn \
    --to=baijiaju@tsinghua.edu.cn \
    --cc=davem@davemloft.net \
    --cc=doshir@vmware.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pv-drivers@vmware.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.