Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2354938imu; Thu, 24 Jan 2019 11:15:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN5HjYz6zQcIX4oGwzZbNCW2bjhDblglwb4YTTh/nzzYX/1TCljfAdo7FgRivacJCbeHr+C5 X-Received: by 2002:a62:6b8a:: with SMTP id g132mr7832315pfc.201.1548357355300; Thu, 24 Jan 2019 11:15:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548357355; cv=none; d=google.com; s=arc-20160816; b=VzLi6CAzXa634Hq93I//vwvU6Qevf/kcRPvwhcNXkSmD0bwUJ85lE0KY+/m83SFxiU DEUlsX6BqG4YJ7RAenMuz1FzNgE0iq6dCXn+bQNO/AdpZsnK16uXS64GwQeQLCT4mCww 8yHIRhwpM+hdibM5v/Wgdqz7Hh3n9t6he/JYKBSOHoo8GghTygv18/NUzPeEo5Ulkqpr MXb8Cc9w6Rkxz/9iNv32ywcHyY30qod5dK543N7UYmiWM9STM+fxjwaJNaLH4+c4PwgV gNB0kj3J+Y7ytX8yguMKxxQIGXXs32zjOz3k7Gglln63f6hT31IGW6XaQrea/n20jDHC 8CNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=VEE+N7y0DzmRuGEOXXeYUZAWk8KDZM07v5LUa4O+RYA=; b=ADeSydCoKp+znfOBjqc15x0zojhKqo9ylqZ3zjwr8RBvZRhff27uD6YMCqHTnWoWMQ 2/SS3AMwPJFDunuCqPq0tPaB6xCLEOqjRC2N3abiUwFRanIHgRjWz1Ic282G+nR9CAqe 07WUaw0YuHjJpi8cMMU6XnW21hgF0mN37cv6iKYz+8i9OMI8/7+q2BfEUTtBUod2MJss WiJ81XOIMVkmdncXuFay3exlAwS0muwcuFme/5mSYfH0CE+AM1KPD+EaD06QxRjqPus7 GaSI2EBNjFzyPFerRfFQWuoAl+ulokvXHidA3trLhEMnrsSJi9LCbe2Gkylr5qIGhInz HFGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kh1uDq7I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si22304601pgi.359.2019.01.24.11.15.39; Thu, 24 Jan 2019 11:15:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kh1uDq7I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729188AbfAXTO4 (ORCPT + 99 others); Thu, 24 Jan 2019 14:14:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:41542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbfAXTO4 (ORCPT ); Thu, 24 Jan 2019 14:14:56 -0500 Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 59341218CD; Thu, 24 Jan 2019 19:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548357295; bh=SgG+tTuQadc46MsfM9LEWr5Puz2LZJmWE5ycXm1/1pY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=kh1uDq7Ic8y/FmfhaRdCjVS+ksr3lJv4jaVXFKoI5abjZ8NlMjcNz6VagDeALiOm4 UH3r7U4Wl0xecEPKDEbEAV0PnZb6S02/4D4mnhiC6C23o4u7naRFaaYsOeH46ROO2L A3dO5bGsml+mrCeYnGwsa2fHBS+tQqAExtNt4LXo= Date: Thu, 24 Jan 2019 11:14:53 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-X260 To: Peng Fan cc: Stefano Stabellini , "hch@infradead.org" , "mst@redhat.com" , "jasowang@redhat.com" , "xen-devel@lists.xenproject.org" , "linux-remoteproc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "luto@kernel.org" , "jgross@suse.com" , "boris.ostrovsky@oracle.com" , "bjorn.andersson@linaro.org" , "jliang@xilinx.com" Subject: RE: [Xen-devel] [RFC] virtio_ring: check dma_mem for xen_domain In-Reply-To: Message-ID: References: <20190121050056.14325-1-peng.fan@nxp.com> <20190123071232.GA20526@infradead.org> <20190123211405.GA4971@infradead.org> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-539770563-1548357127=:17936" Content-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-539770563-1548357127=:17936 Content-Type: TEXT/PLAIN; CHARSET=UTF-8 Content-Transfer-Encoding: 8BIT Content-ID: On Thu, 24 Jan 2019, Peng Fan wrote: > Hi stefano, > > > -----Original Message----- > > From: Stefano Stabellini [mailto:sstabellini@kernel.org] > > Sent: 2019年1月24日 7:44 > > To: hch@infradead.org > > Cc: Stefano Stabellini ; Peng Fan > > ; mst@redhat.com; jasowang@redhat.com; > > xen-devel@lists.xenproject.org; linux-remoteproc@vger.kernel.org; > > linux-kernel@vger.kernel.org; virtualization@lists.linux-foundation.org; > > luto@kernel.org; jgross@suse.com; boris.ostrovsky@oracle.com; > > bjorn.andersson@linaro.org; jliang@xilinx.com > > Subject: Re: [Xen-devel] [RFC] virtio_ring: check dma_mem for xen_domain > > > > On Wed, 23 Jan 2019, hch@infradead.org wrote: > > > On Wed, Jan 23, 2019 at 01:04:33PM -0800, Stefano Stabellini wrote: > > > > If vring_use_dma_api is actually supposed to return true when > > > > dma_dev->dma_mem is set, then both Peng's patch and the patch I > > > > wrote are not fixing the real issue here. > > > > > > > > I don't know enough about remoteproc to know where the problem > > > > actually lies though. > > > > > > The problem is the following: > > > > > > Devices can declare a specific memory region that they want to use > > > when the driver calls dma_alloc_coherent for the device, this is done > > > using the shared-dma-pool DT attribute, which comes in two variants > > > that would be a little to much to explain here. > > > > > > remoteproc makes use of that because apparently the device can only > > > communicate using that region. But it then feeds back memory obtained > > > with dma_alloc_coherent into the virtio code. For that it calls > > > vmalloc_to_page on the dma_alloc_coherent, which is a huge no-go for > > > the ĐMA API and only worked accidentally on a few platform, and > > > apparently arm64 just changed a few internals that made it stop > > > working for remoteproc. > > > > > > The right answer is to not use the DMA API to allocate memory from a > > > device-speficic region, but to tie the driver directly into the DT > > > reserved memory API in a way that allows it to easilt obtain a struct > > > device for it. > > > > If I understand correctly, Peng should be able to reproduce the problem on > > native Linux without any Xen involvement simply by forcing > > vring_use_dma_api to return true. Peng, can you confirm? > > It is another issue without xen involvement, > There is an thread talking this: https://patchwork.kernel.org/patch/10742923/ > > Without xen, vring_use_dma_api will return false. > With xen, if vring_use_dma_api returns true, it will dma_map_xx and trigger dump. It is true that for Xen on ARM DomUs it is not necessary today to return true from vring_use_dma_api. However, returning true from vring_use_dma_api should not break Linux. When the rpmesg issue is fixed, this problem should also go away without any need for additional changes on the xen side I think. --8323329-539770563-1548357127=:17936--