Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5210201imu; Wed, 19 Dec 2018 07:24:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/XaYZWruoTO/hYl8QGZ6iAdvNCWCdCcN9L0a0gymY0Jok2nsWpRdoiipbyKgKfhd8qcpNak X-Received: by 2002:a17:902:9006:: with SMTP id a6mr20459072plp.334.1545233041401; Wed, 19 Dec 2018 07:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545233041; cv=none; d=google.com; s=arc-20160816; b=fUjdp98y8pnGMQcmtYbVd3Uq2C/QKaUHheA5v0KtwCzGdlVWyrzjlrRsiwClVc/1Bd Boe8BBWtSp65dw/AUXr+CXg74MwFYs1Pf1ExU114CWjQC8pjPYkRuVpdOvX+07ctshGI XWaQbhMJHDsBpG87Wj7k6TiwFHQCzM4+mDQ3n0+aEa38UyMJTMR/uQ6urhTyExuadLv6 //U0mwwLd/aGKOWcPv7YH/KNR9VtmB9UUbUmvZusiDRVOLdM0OM5tpPK/fbEvG4Rg2N6 An5zjuWP50/bxnWsghnz+VWjjypMCorJicu5JC8c+QuwHtfujQzmV9sEbiSqnVxuBUPn +1Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=oyHOu5Jg+4z+t58IWPaZHlr1/Mp2gHrC9O1rs+seQ6E=; b=ONypnr5QHH7IhFCfp4a71kzly+jpUlJhpSa3OMqqNTsbeIhDwQNH6LZNOF6zJ9hpMX OPHj8zIpf1zbyl5jJbgpsq9DNc0sxX7M4X9JfGPfY5c/iSTIFwnrq06KsTnxWD8kt9lU QWRgix/CfN04OgCnOjFFO6/cMRg0bQUJ/+n+0RsZW4GC7aeO2Ii45hYMVWSdQk0RMDAc Nu0wY18eKaApl/L/DUlG1tnjP44hSUCIhcRozRN6/dta6ITTSt91aIfvMUVKT7YpXKHq jD75vWbU/mq4PG5EAka4y48mS4DrNShzes5vkMy30AIM0qRx8mWyaWM1x87NIzPcZoU/ T07Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n28si17028288pfb.88.2018.12.19.07.23.37; Wed, 19 Dec 2018 07:24:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728758AbeLSNOy (ORCPT + 99 others); Wed, 19 Dec 2018 08:14:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37706 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbeLSNOy (ORCPT ); Wed, 19 Dec 2018 08:14:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AEF1C074EF9; Wed, 19 Dec 2018 13:14:54 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-174.ams2.redhat.com [10.36.117.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D00D60198; Wed, 19 Dec 2018 13:14:53 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BDDC816E29; Wed, 19 Dec 2018 14:14:52 +0100 (CET) Date: Wed, 19 Dec 2018 14:14:52 +0100 From: Gerd Hoffmann To: Oleksandr Andrushchenko Cc: Noralf =?utf-8?Q?Tr=C3=B8nnes?= , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, daniel.vetter@intel.com, jgross@suse.com, boris.ostrovsky@oracle.com, Oleksandr Andrushchenko Subject: Re: [PATCH] drm/xen-front: Make shmem backed display buffer coherent Message-ID: <20181219131452.cehks3kabcwuuk7i@sirius.home.kraxel.org> References: <20181127103252.20994-1-andr2000@gmail.com> <17640791-5306-f7e4-8588-dd39c14e975b@tronnes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 19 Dec 2018 13:14:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > > +??? mapping = xen_obj->base.filp->f_mapping; > > > +??? mapping_set_gfp_mask(mapping, GFP_USER | __GFP_DMA32); > > Let's see if I understand what you're doing: > > > > Here you say that the pages should be DMA accessible for devices that can > > only see 4GB. > > Yes, your understanding is correct. As we are a para-virtualized device we > do not have strict requirements for 32-bit DMA. But, via dma-buf export, > the buffer we create can be used by real HW, e.g. one can pass-through > real HW devices into a guest domain and they can import our buffer (yes, > they can be IOMMU backed and other conditions may apply). > So, this is why we are limiting to DMA32 here, just to allow more possible > use-cases Sure this actually helps? It's below 4G in guest physical address space, so it can be backed by pages which are actually above 4G in host physical address space ... > > > +??? if (!dma_map_sg(dev->dev, xen_obj->sgt->sgl, xen_obj->sgt->nents, > > > +??????????? DMA_BIDIRECTIONAL)) { > > > > > > Are you using the DMA streaming API as a way to flush the caches? > Yes > > Does this mean that GFP_USER isn't making the buffer coherent? > > No, it didn't help. I had a question [1] if there are any other better way > to achieve the same, but didn't have any response yet. So, I implemented > it via DMA API which helped. set_pages_array_*() ? See arch/x86/include/asm/set_memory.h HTH, Gerd