Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5096819imu; Wed, 19 Dec 2018 05:38:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJ6AYcWxtIpHaPMxwLBp/2ZWwv4hdQqEvMJ/WL/R2oe2b/8UveH/RK/3GmgCLkcuplLU8e X-Received: by 2002:a17:902:24e7:: with SMTP id l36mr20370851plg.61.1545226719863; Wed, 19 Dec 2018 05:38:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545226719; cv=none; d=google.com; s=arc-20160816; b=1AFaOfUJXJwWC1oxs4xKa8hjQ+aoFvygiWfzCdT4YAS1M4r06mJBU692lFvBOYEcJS ISCWL+FS/Ys2MWkmuGxpaJqeBC+GmHUyzzAvWio18fxfE4QUUM18PdNY3DyFBIZtoEgc D5Bq7shRsqezc8FSlHblE85ZrTrcNcVj35SbhZjG2MPxp/+c/EhZIwLKW2eNoS6Dd7LQ iEYAH38EFv6ovX11sIs2z3PwEbIL9G3DKWHoB1JNNlliBCdBLIJNajGUbJtk7UI6aAVD ICCbqoWSL3RQGbJ7VVW8Q/kT9LXhVRVHA748nDB9jI+CGPv6HygDwQlJ4+s/I/OGAxn0 wDMA== 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:dkim-signature; bh=nVLY4n/0PV2xXg8jVcVqjI9na0lD5yGDU1orL7RgDTs=; b=gnP6G8ml8LqwjZtTwszt8pRwVb6HSTWwcwK/HmL8VTsCkvlZAHhzDMgscw76LxYPFd jB/584c64Oemwk6PjQujMfz0q6jL5/LieeVNn+H8/qzHS47kvOYsxp9bIpDNK+SiJV2H eZzLVrNXFRIR62H1zyHSSVlPeU2SKmvvYThizp2zJariQwZPFap1M5DnI4ug9OieJa+l 0Gra6EqosSO8zM0fqRJLy2DcWWyJS2Z3s+o62CPnCdV0OV4CXG2Ys2paWgENDXiXqfew +XA5yUZ3VW7aYNLWjY6g/hqy51onZfiY4QfaAcgVKg03IG9DUkY4r4V2UL25sXloY1d7 UJgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IWMhxdW0; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si16111124pld.194.2018.12.19.05.38.24; Wed, 19 Dec 2018 05:38:39 -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=@gmail.com header.s=20161025 header.b=IWMhxdW0; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729194AbeLSNVv (ORCPT + 99 others); Wed, 19 Dec 2018 08:21:51 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36462 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbeLSNVu (ORCPT ); Wed, 19 Dec 2018 08:21:50 -0500 Received: by mail-lj1-f194.google.com with SMTP id g11-v6so17392179ljk.3 for ; Wed, 19 Dec 2018 05:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=nVLY4n/0PV2xXg8jVcVqjI9na0lD5yGDU1orL7RgDTs=; b=IWMhxdW0GIk6wDZHD57VakpBFXR1doXDGbPu8xjiV02SQOEHgtRVYucb3T1zjlILiw 2mhuc6b4aBxSTihVVPbNYPIq9vG0hQuLSuGgS1I3NoxuLHsukD6sUKwT+2GnC6cs6Otd JBwg9Qpq4UgjUyDwsK3173UNKQb2HLhmelkA0DoyLTN4gooOTHQBqelzawscRBjndr58 Z5SgPswN7mw+torabpUJV9RIHijKR9cX53a6Mq3yRb9j2ddJgqsDNKNgul0Zv+gl4LgZ Byr604zoRR35YRTtGjhC+TMgRAU4LEW8/j/zDnqccE8avs+RQQrJKMNT/39pGM9ddXOD Nd7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=nVLY4n/0PV2xXg8jVcVqjI9na0lD5yGDU1orL7RgDTs=; b=Hm+ak4SSgrk0uuk42cbMcJnAzp/VgDC2m+OjkHgjvabFoJagRHH80v3AbdHr3scI9U utaD63npwwQuzHOSsY82M/il4/rk3PpXT1Zdx8Te6D+z1gI96/CO3oz4n+gd6XEHESkq uJ5V0jpIkgiYwI1m6m4VAsIyc0YNOFwltjBKurh8wllm6xSa4cqmqRUx+Pm4N7awTAkW I9W2UFxj/mO+72sx2HcgnybJ31Sz3+ZgjkhWjhTdo+xFomnxITtuPgW+c5KcWVJntxLI CkHg+IxlzGqA0Cvv7oCICKSDafccpgdSx9Sygise83HL3mmXh2n4z9e8piqmX7dYofcv G3Hw== X-Gm-Message-State: AA+aEWYJV102FNRcvQDq2uYARLLwmt9+AXmt4HdrcGqw//ipaEY/LFSH 0NqqqHIV1bl0DkpaqNWPMKI= X-Received: by 2002:a2e:2b11:: with SMTP id q17-v6mr12411966lje.25.1545225708179; Wed, 19 Dec 2018 05:21:48 -0800 (PST) Received: from [10.17.182.20] (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id w9sm3819992lfc.66.2018.12.19.05.21.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 05:21:47 -0800 (PST) Subject: Re: [PATCH] drm/xen-front: Make shmem backed display buffer coherent To: Gerd Hoffmann Cc: =?UTF-8?Q?Noralf_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 References: <20181127103252.20994-1-andr2000@gmail.com> <17640791-5306-f7e4-8588-dd39c14e975b@tronnes.org> <20181219131452.cehks3kabcwuuk7i@sirius.home.kraxel.org> From: Oleksandr Andrushchenko Message-ID: Date: Wed, 19 Dec 2018 15:21:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181219131452.cehks3kabcwuuk7i@sirius.home.kraxel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/19/18 3:14 PM, Gerd Hoffmann wrote: > 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 ... Yes, you are right here. This is why I wrote about the IOMMU and other conditions. E.g. you can have a device which only expects 32-bit, but thanks to IOMMU it can access pages above 4GiB seamlessly. So, this is why I *hope* that this code *may* help such devices. Do you think I don't need that and have to remove? >>>> +    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 Well, x86... I am on arm which doesn't define that... > HTH, > Gerd > Thank you, Oleksandr