Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2525728pxa; Mon, 3 Aug 2020 19:18:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTJbxIDGFqPOrWDVtzgqYPMkVDpBTU70Q2Im0yLBAMas4WIk4tZYzNA4pLUaaobiIb53Sp X-Received: by 2002:aa7:d45a:: with SMTP id q26mr18078548edr.95.1596507512107; Mon, 03 Aug 2020 19:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596507512; cv=none; d=google.com; s=arc-20160816; b=uxDFcldTe6wkv8uG9J2n5Aw6VpiFhk7pp2Gj3P9PS/7RCCe72N8Cex5elBqkRn4SgI MvZ1TOL+nyXPgBDLjfhrCBKkHQIK8bpWagCi7fu9VqHR6dZP31yOXyFHkQ1KgBzGhj0+ FNPTH83T7ME0jCXeBBbmCkut3VNlU/rXK2J3bQlX3uHGVcZNItUnnuTx4PXfU84wnGYD h3p1ZY4GNaopxzd4GpQZivln+nKPgOnP69snXopFCu1q7arQIwXtGUjfkfKwNs7Rs91I LCzpft2jl3t1tULa76l/xwdeBeEUyIkrE0paAgWZUSrudaXexIGbcqqZHNB1zjK1wPLT 4Ktw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=qJvtW4PlATy8pbR3GEnniT12joPKaWUB26cJXNEeQHs=; b=PT8ORYiednLghByLGR5PRt5lBMNPLjBekqjxBpmA7BJDj44QtImKe3G8gOFDpLtruh UHLn2M/1xyF5SMpJqX+3cSTwuDY4MPcN4AJ4EMB0rGH9FgTNrjTua+Yu9SeviW7/Ldd7 yO5ZJ27ht5K7R1o/4buUQbLSRFZhxS8Z7FlM8MqD9RO1dS+DFhuBK7EuQR0wpp5Y1JCs nVUThcRT1qKq6rZbj/Uvqtc2bTi06XGyJIFF2zQL8m0W26U6kYesjcWGCyRW48mxzmj6 y/fq9KJ5T2gEESnVZ8WKN/YWdRYIvpdPxIv8M3IIecmIwo3QryA+Ej98sWMwHwSgU19W m7Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si11813949eja.559.2020.08.03.19.18.10; Mon, 03 Aug 2020 19:18:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727069AbgHDCRr (ORCPT + 99 others); Mon, 3 Aug 2020 22:17:47 -0400 Received: from zg8tmtm5lju5ljm3lje2naaa.icoremail.net ([139.59.37.164]:48754 "HELO zg8tmtm5lju5ljm3lje2naaa.icoremail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1725975AbgHDCRq (ORCPT ); Mon, 3 Aug 2020 22:17:46 -0400 Received: from [166.111.139.118] (unknown [166.111.139.118]) by app-3 (Coremail) with SMTP id EQQGZQAH6sY2xShf9izvAw--.9502S2; Tue, 04 Aug 2020 10:17:28 +0800 (CST) Subject: Re: [PATCH] net: vmxnet3: avoid accessing the data mapped to streaming DMA To: David Miller Cc: doshir@vmware.com, pv-drivers@vmware.com, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200802131107.15857-1-baijiaju@tsinghua.edu.cn> <20200803.155949.39743839019093809.davem@davemloft.net> From: Jia-Ju Bai Message-ID: <6d4a6167-2480-0091-33a1-6b0cb81e4645@tsinghua.edu.cn> Date: Tue, 4 Aug 2020 10:17:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200803.155949.39743839019093809.davem@davemloft.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-CM-TRANSID: EQQGZQAH6sY2xShf9izvAw--.9502S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Xw4xCr47tFWDKF18tF4ktFb_yoW3uFg_Cw 4Iywn3C398CwsruFn5tFy3Arn293yqqr1jvr1FqF1Ik343AFZFga1Uur97Jrn3tw4SyFZ3 uw1YqrWDXr1UWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIkYjsxI4VWxJwAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I 8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI 64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8Jw Am72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07AlzVAYIcxG8wCY 02Avz4vE14v_Gr1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxV Aqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r12 6r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6x kF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWrJr0_WFyUJwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf 9x07j5wIDUUUUU= X-CM-SenderInfo: xedlyxhdmxq3pvlqwxlxdovvfxof0/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/8/4 6:59, David Miller wrote: > From: Jia-Ju Bai > 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 > '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